repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/entity/EntityPurity.java
// Path: src/main/java/matgm50/twarden/util/PurityHelper.java // public class PurityHelper { // // public static boolean isTainted(Entity entity) { // // if(entity instanceof ITaintedMob) { // // return true; // // } // // return false; // // } // // public static boolean isTainted(MovingObjectPosition mop) { // // if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { // // if (mop.entityHit != null) { // // return isTainted(mop.entityHit); // // } // // } // // return false; // // } // // public static void purifyEntity(Entity toPurify) { // // if (toPurify != null) { // // World world = toPurify.worldObj; // // if(isTainted(toPurify)) { // // if(!world.isRemote) { // // Entity purified = getPureState(toPurify); // purified.setPositionAndRotation(toPurify.posX, toPurify.posY, toPurify.posZ, toPurify.rotationYaw, toPurify.rotationPitch); // // toPurify.setDead(); // world.spawnEntityInWorld(purified); // // } // // } // // } // // } // // public static void checkAndPurify(MovingObjectPosition mop) { // // if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { // // purifyEntity(mop.entityHit); // // } // // } // // public static Entity getPureState(Entity entity){ // // if(entity instanceof EntityTaintChicken) { // // return new EntityChicken(entity.worldObj); // // } // // if(entity instanceof EntityTaintCow) { // // return new EntityCow(entity.worldObj); // // } // // if(entity instanceof EntityTaintCreeper) { // // return new EntityCreeper(entity.worldObj); // // } // // if(entity instanceof EntityTaintPig) { // // return new EntityPig(entity.worldObj); // // } // // if(entity instanceof EntityTaintSheep) { // // return new EntitySheep(entity.worldObj); // // } // // if(entity instanceof EntityTaintSpider) { // // return new EntitySpider(entity.worldObj); // // } // // if(entity instanceof EntityTaintVillager) { // // return new EntityVillager(entity.worldObj); // // } // // return entity; // // } // // }
import matgm50.twarden.util.PurityHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.common.Thaumcraft;
} super.onUpdate(); } @Override protected void onImpact(MovingObjectPosition mop) { for (int i = 0; i < 9; i++) { float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 0, true, 0.02F); fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); } if(!worldObj.isRemote) {
// Path: src/main/java/matgm50/twarden/util/PurityHelper.java // public class PurityHelper { // // public static boolean isTainted(Entity entity) { // // if(entity instanceof ITaintedMob) { // // return true; // // } // // return false; // // } // // public static boolean isTainted(MovingObjectPosition mop) { // // if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { // // if (mop.entityHit != null) { // // return isTainted(mop.entityHit); // // } // // } // // return false; // // } // // public static void purifyEntity(Entity toPurify) { // // if (toPurify != null) { // // World world = toPurify.worldObj; // // if(isTainted(toPurify)) { // // if(!world.isRemote) { // // Entity purified = getPureState(toPurify); // purified.setPositionAndRotation(toPurify.posX, toPurify.posY, toPurify.posZ, toPurify.rotationYaw, toPurify.rotationPitch); // // toPurify.setDead(); // world.spawnEntityInWorld(purified); // // } // // } // // } // // } // // public static void checkAndPurify(MovingObjectPosition mop) { // // if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { // // purifyEntity(mop.entityHit); // // } // // } // // public static Entity getPureState(Entity entity){ // // if(entity instanceof EntityTaintChicken) { // // return new EntityChicken(entity.worldObj); // // } // // if(entity instanceof EntityTaintCow) { // // return new EntityCow(entity.worldObj); // // } // // if(entity instanceof EntityTaintCreeper) { // // return new EntityCreeper(entity.worldObj); // // } // // if(entity instanceof EntityTaintPig) { // // return new EntityPig(entity.worldObj); // // } // // if(entity instanceof EntityTaintSheep) { // // return new EntitySheep(entity.worldObj); // // } // // if(entity instanceof EntityTaintSpider) { // // return new EntitySpider(entity.worldObj); // // } // // if(entity instanceof EntityTaintVillager) { // // return new EntityVillager(entity.worldObj); // // } // // return entity; // // } // // } // Path: src/main/java/matgm50/twarden/entity/EntityPurity.java import matgm50.twarden.util.PurityHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.common.Thaumcraft; } super.onUpdate(); } @Override protected void onImpact(MovingObjectPosition mop) { for (int i = 0; i < 9; i++) { float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 0, true, 0.02F); fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); } if(!worldObj.isRemote) {
PurityHelper.checkAndPurify(mop);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/util/wardenic/upgrade/WardenicUpgradeEarth.java
// Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // }
import matgm50.twarden.util.DamageSourceWarden; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import java.util.List;
package matgm50.twarden.util.wardenic.upgrade; /** * Created by MasterAbdoTGM50 on 8/30/2014. */ public class WardenicUpgradeEarth extends WardenicUpgrade { public WardenicUpgradeEarth(Aspect aspect) {super(aspect);} @Override public void onTick(World world, EntityPlayer player, ItemStack stack) { super.onTick(world, player, stack); player.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), 0, 5)); } @Override public void onAttacked(LivingHurtEvent event) { super.onAttacked(event); if(event.source.damageType == "fall") { List entities = new ArrayList<Entity>();
// Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // Path: src/main/java/matgm50/twarden/util/wardenic/upgrade/WardenicUpgradeEarth.java import matgm50.twarden.util.DamageSourceWarden; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; import thaumcraft.api.aspects.Aspect; import java.util.ArrayList; import java.util.List; package matgm50.twarden.util.wardenic.upgrade; /** * Created by MasterAbdoTGM50 on 8/30/2014. */ public class WardenicUpgradeEarth extends WardenicUpgrade { public WardenicUpgradeEarth(Aspect aspect) {super(aspect);} @Override public void onTick(World world, EntityPlayer player, ItemStack stack) { super.onTick(world, player, stack); player.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), 0, 5)); } @Override public void onAttacked(LivingHurtEvent event) { super.onAttacked(event); if(event.source.damageType == "fall") { List entities = new ArrayList<Entity>();
DamageSource damageSource = new DamageSourceWarden("warden", event.entity);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenBoots.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenBoots extends ItemWardenArmor { public ItemWardenBoots() { super(3);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenBoots.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenBoots extends ItemWardenArmor { public ItemWardenBoots() { super(3);
setUnlocalizedName(ItemLib.WARDEN_BOOTS_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenBoots.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenBoots extends ItemWardenArmor { public ItemWardenBoots() { super(3); setUnlocalizedName(ItemLib.WARDEN_BOOTS_NAME); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenBoots.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenBoots extends ItemWardenArmor { public ItemWardenBoots() { super(3); setUnlocalizedName(ItemLib.WARDEN_BOOTS_NAME); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardenboots");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzChiseled.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzChiseled extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzChiseled() { super(Material.rock);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzChiseled.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzChiseled extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzChiseled() { super(Material.rock);
setBlockName(BlockLib.QUARTZ_CHISELED_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzChiseled.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzChiseled extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzChiseled() { super(Material.rock); setBlockName(BlockLib.QUARTZ_CHISELED_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzChiseled.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzChiseled extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzChiseled() { super(Material.rock); setBlockName(BlockLib.QUARTZ_CHISELED_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzChiseled.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzChiseled extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzChiseled() { super(Material.rock); setBlockName(BlockLib.QUARTZ_CHISELED_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeStone); setHardness(0.8F); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzChiseled.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzChiseled extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzChiseled() { super(Material.rock); setBlockName(BlockLib.QUARTZ_CHISELED_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeStone); setHardness(0.8F); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) {
topIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "infusedquartzchiseledtop" );
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWaslieHammer.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class ItemWaslieHammer extends Item { public ItemWaslieHammer() { super();
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWaslieHammer.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class ItemWaslieHammer extends Item { public ItemWaslieHammer() { super();
setUnlocalizedName(ItemLib.WASLIE_HAMMER_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWaslieHammer.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class ItemWaslieHammer extends Item { public ItemWaslieHammer() { super(); setUnlocalizedName(ItemLib.WASLIE_HAMMER_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWaslieHammer.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class ItemWaslieHammer extends Item { public ItemWaslieHammer() { super(); setUnlocalizedName(ItemLib.WASLIE_HAMMER_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWaslieHammer.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class ItemWaslieHammer extends Item { public ItemWaslieHammer() { super(); setUnlocalizedName(ItemLib.WASLIE_HAMMER_NAME); setCreativeTab(TWarden.tabTWarden); setMaxStackSize(1); canRepair = false; } @Override public EnumRarity getRarity(ItemStack stack) { return EnumRarity.rare; } @Override public boolean isItemTool(ItemStack stack) { return true; } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.openGui(TWarden.instance, 0, par2World, 0, 0, 0); return par1ItemStack; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWaslieHammer.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class ItemWaslieHammer extends Item { public ItemWaslieHammer() { super(); setUnlocalizedName(ItemLib.WASLIE_HAMMER_NAME); setCreativeTab(TWarden.tabTWarden); setMaxStackSize(1); canRepair = false; } @Override public EnumRarity getRarity(ItemStack stack) { return EnumRarity.rare; } @Override public boolean isItemTool(ItemStack stack) { return true; } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.openGui(TWarden.instance, 0, par2World, 0, 0, 0); return par1ItemStack; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wasliehammer");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/world/GenExubitura.java
// Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // }
import cpw.mods.fml.common.IWorldGenerator; import matgm50.twarden.block.ModBlocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import java.util.Random;
package matgm50.twarden.world; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class GenExubitura implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { int X = chunkX * 16 + random.nextInt(128); int Z = chunkZ * 16 + random.nextInt(128); int Y = world.getHeightValue(X, Z);
// Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // Path: src/main/java/matgm50/twarden/world/GenExubitura.java import cpw.mods.fml.common.IWorldGenerator; import matgm50.twarden.block.ModBlocks; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import java.util.Random; package matgm50.twarden.world; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class GenExubitura implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { int X = chunkX * 16 + random.nextInt(128); int Z = chunkZ * 16 + random.nextInt(128); int Y = world.getHeightValue(X, Z);
if (world.isAirBlock(X, Y, Z) && ModBlocks.blockExubitura.canBlockStay(world, X, Y, Z) && random.nextInt(1000) <= 10) {
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockWitor.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.config.Config; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 9/2/2014. */ public class BlockWitor extends BlockContainer { protected BlockWitor() { super(Config.airyMaterial);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockWitor.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.config.Config; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 9/2/2014. */ public class BlockWitor extends BlockContainer { protected BlockWitor() { super(Config.airyMaterial);
setBlockName(BlockLib.BLOCK_WITOR_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockWitor.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.config.Config; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 9/2/2014. */ public class BlockWitor extends BlockContainer { protected BlockWitor() { super(Config.airyMaterial); setBlockName(BlockLib.BLOCK_WITOR_NAME); setStepSound(Block.soundTypeCloth);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockWitor.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.config.Config; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 9/2/2014. */ public class BlockWitor extends BlockContainer { protected BlockWitor() { super(Config.airyMaterial); setBlockName(BlockLib.BLOCK_WITOR_NAME); setStepSound(Block.soundTypeCloth);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockWitor.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.config.Config; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 9/2/2014. */ public class BlockWitor extends BlockContainer { protected BlockWitor() { super(Config.airyMaterial); setBlockName(BlockLib.BLOCK_WITOR_NAME); setStepSound(Block.soundTypeCloth); setCreativeTab(TWarden.tabTWarden); setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) { blockIcon = register.registerIcon("thaumcraft:blank"); } @Override public int getRenderType() {return -1;} @Override public int getLightValue() {return 15;} public boolean renderAsNormalBlock() {return false;} public boolean isOpaqueCube() {return false;} public Item getItemDropped(int par1, Random par2Random, int par3) {return null;} @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {return null;} public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side){return false;} @Override
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockWitor.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.common.config.Config; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 9/2/2014. */ public class BlockWitor extends BlockContainer { protected BlockWitor() { super(Config.airyMaterial); setBlockName(BlockLib.BLOCK_WITOR_NAME); setStepSound(Block.soundTypeCloth); setCreativeTab(TWarden.tabTWarden); setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) { blockIcon = register.registerIcon("thaumcraft:blank"); } @Override public int getRenderType() {return -1;} @Override public int getLightValue() {return 15;} public boolean renderAsNormalBlock() {return false;} public boolean isOpaqueCube() {return false;} public Item getItemDropped(int par1, Random par2Random, int par3) {return null;} @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {return null;} public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side){return false;} @Override
public TileEntity createNewTileEntity(World world, int meta) {return new TileWitor();}
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/proxy/ClientProxy.java
// Path: src/main/java/matgm50/twarden/entity/EntityPurity.java // public class EntityPurity extends EntityThrowable { // // public EntityPurity(World par1World) { // // super(par1World); // // } // // public EntityPurity(World par1World, EntityLivingBase par2EntityLivingBase) { // // super(par1World, par2EntityLivingBase); // // } // // public EntityPurity(World par1World, double par2, double par4, double par6) { // // super(par1World, par2, par4, par6); // // } // // @Override // protected float getGravityVelocity() { // // return 0.001F; // // } // // @Override // public void onUpdate() { // // if (this.worldObj.isRemote) { // // for (int i = 0; i < 3; i++) { // // Thaumcraft.proxy.wispFX2(this.worldObj, this.posX + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posY + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posZ + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, 0.3F, 2, true, false, 0.02F); // // double x2 = (this.posX + this.prevPosX) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double y2 = (this.posY + this.prevPosY) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double z2 = (this.posZ + this.prevPosZ) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // // Thaumcraft.proxy.wispFX2(this.worldObj, x2, y2, z2, 0.3F, 2, true, false, 0.02F); // // } // // } // // super.onUpdate(); // // } // // @Override // protected void onImpact(MovingObjectPosition mop) { // // for (int i = 0; i < 9; i++) { // // float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 0, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // } // // if(!worldObj.isRemote) { // // PurityHelper.checkAndPurify(mop); // setDead(); // // } // // } // // } // // Path: src/main/java/matgm50/twarden/client/renderer/RendererPurity.java // public class RendererPurity extends Render { // // public RendererPurity() { // // this.shadowSize = 0.1F; // // } // // public void renderEntityAt(Entity entity, double x, double y, double z, float freq, float pTicks) {} // // @Override // public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { // // renderEntityAt(entity, d, d1, d2, f, f1); // // } // // @Override // protected ResourceLocation getEntityTexture(Entity entity) { // // return AbstractClientPlayer.locationStevePng; // // } // }
import cpw.mods.fml.client.registry.RenderingRegistry; import matgm50.twarden.entity.EntityPurity; import matgm50.twarden.client.renderer.RendererPurity;
package matgm50.twarden.proxy; /** * Created by MasterAbdoTGM50 on 5/11/2014. */ public class ClientProxy extends CommonProxy { @Override public void initRenderers() {
// Path: src/main/java/matgm50/twarden/entity/EntityPurity.java // public class EntityPurity extends EntityThrowable { // // public EntityPurity(World par1World) { // // super(par1World); // // } // // public EntityPurity(World par1World, EntityLivingBase par2EntityLivingBase) { // // super(par1World, par2EntityLivingBase); // // } // // public EntityPurity(World par1World, double par2, double par4, double par6) { // // super(par1World, par2, par4, par6); // // } // // @Override // protected float getGravityVelocity() { // // return 0.001F; // // } // // @Override // public void onUpdate() { // // if (this.worldObj.isRemote) { // // for (int i = 0; i < 3; i++) { // // Thaumcraft.proxy.wispFX2(this.worldObj, this.posX + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posY + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posZ + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, 0.3F, 2, true, false, 0.02F); // // double x2 = (this.posX + this.prevPosX) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double y2 = (this.posY + this.prevPosY) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double z2 = (this.posZ + this.prevPosZ) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // // Thaumcraft.proxy.wispFX2(this.worldObj, x2, y2, z2, 0.3F, 2, true, false, 0.02F); // // } // // } // // super.onUpdate(); // // } // // @Override // protected void onImpact(MovingObjectPosition mop) { // // for (int i = 0; i < 9; i++) { // // float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 0, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // } // // if(!worldObj.isRemote) { // // PurityHelper.checkAndPurify(mop); // setDead(); // // } // // } // // } // // Path: src/main/java/matgm50/twarden/client/renderer/RendererPurity.java // public class RendererPurity extends Render { // // public RendererPurity() { // // this.shadowSize = 0.1F; // // } // // public void renderEntityAt(Entity entity, double x, double y, double z, float freq, float pTicks) {} // // @Override // public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { // // renderEntityAt(entity, d, d1, d2, f, f1); // // } // // @Override // protected ResourceLocation getEntityTexture(Entity entity) { // // return AbstractClientPlayer.locationStevePng; // // } // } // Path: src/main/java/matgm50/twarden/proxy/ClientProxy.java import cpw.mods.fml.client.registry.RenderingRegistry; import matgm50.twarden.entity.EntityPurity; import matgm50.twarden.client.renderer.RendererPurity; package matgm50.twarden.proxy; /** * Created by MasterAbdoTGM50 on 5/11/2014. */ public class ClientProxy extends CommonProxy { @Override public void initRenderers() {
RenderingRegistry.registerEntityRenderingHandler(EntityPurity.class, new RendererPurity());
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/proxy/ClientProxy.java
// Path: src/main/java/matgm50/twarden/entity/EntityPurity.java // public class EntityPurity extends EntityThrowable { // // public EntityPurity(World par1World) { // // super(par1World); // // } // // public EntityPurity(World par1World, EntityLivingBase par2EntityLivingBase) { // // super(par1World, par2EntityLivingBase); // // } // // public EntityPurity(World par1World, double par2, double par4, double par6) { // // super(par1World, par2, par4, par6); // // } // // @Override // protected float getGravityVelocity() { // // return 0.001F; // // } // // @Override // public void onUpdate() { // // if (this.worldObj.isRemote) { // // for (int i = 0; i < 3; i++) { // // Thaumcraft.proxy.wispFX2(this.worldObj, this.posX + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posY + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posZ + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, 0.3F, 2, true, false, 0.02F); // // double x2 = (this.posX + this.prevPosX) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double y2 = (this.posY + this.prevPosY) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double z2 = (this.posZ + this.prevPosZ) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // // Thaumcraft.proxy.wispFX2(this.worldObj, x2, y2, z2, 0.3F, 2, true, false, 0.02F); // // } // // } // // super.onUpdate(); // // } // // @Override // protected void onImpact(MovingObjectPosition mop) { // // for (int i = 0; i < 9; i++) { // // float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 0, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // } // // if(!worldObj.isRemote) { // // PurityHelper.checkAndPurify(mop); // setDead(); // // } // // } // // } // // Path: src/main/java/matgm50/twarden/client/renderer/RendererPurity.java // public class RendererPurity extends Render { // // public RendererPurity() { // // this.shadowSize = 0.1F; // // } // // public void renderEntityAt(Entity entity, double x, double y, double z, float freq, float pTicks) {} // // @Override // public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { // // renderEntityAt(entity, d, d1, d2, f, f1); // // } // // @Override // protected ResourceLocation getEntityTexture(Entity entity) { // // return AbstractClientPlayer.locationStevePng; // // } // }
import cpw.mods.fml.client.registry.RenderingRegistry; import matgm50.twarden.entity.EntityPurity; import matgm50.twarden.client.renderer.RendererPurity;
package matgm50.twarden.proxy; /** * Created by MasterAbdoTGM50 on 5/11/2014. */ public class ClientProxy extends CommonProxy { @Override public void initRenderers() {
// Path: src/main/java/matgm50/twarden/entity/EntityPurity.java // public class EntityPurity extends EntityThrowable { // // public EntityPurity(World par1World) { // // super(par1World); // // } // // public EntityPurity(World par1World, EntityLivingBase par2EntityLivingBase) { // // super(par1World, par2EntityLivingBase); // // } // // public EntityPurity(World par1World, double par2, double par4, double par6) { // // super(par1World, par2, par4, par6); // // } // // @Override // protected float getGravityVelocity() { // // return 0.001F; // // } // // @Override // public void onUpdate() { // // if (this.worldObj.isRemote) { // // for (int i = 0; i < 3; i++) { // // Thaumcraft.proxy.wispFX2(this.worldObj, this.posX + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posY + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, this.posZ + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F, 0.3F, 2, true, false, 0.02F); // // double x2 = (this.posX + this.prevPosX) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double y2 = (this.posY + this.prevPosY) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // double z2 = (this.posZ + this.prevPosZ) / 2.0D + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F; // // Thaumcraft.proxy.wispFX2(this.worldObj, x2, y2, z2, 0.3F, 2, true, false, 0.02F); // // } // // } // // super.onUpdate(); // // } // // @Override // protected void onImpact(MovingObjectPosition mop) { // // for (int i = 0; i < 9; i++) { // // float fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // float fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 0, true, 0.02F); // // fx = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fy = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // fz = (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.3F; // Thaumcraft.proxy.wispFX3(this.worldObj, this.posX + fx, this.posY + fy, this.posZ + fz, this.posX + fx * 8.0F, this.posY + fy * 8.0F, this.posZ + fz * 8.0F, 0.3F, 2, true, 0.02F); // // } // // if(!worldObj.isRemote) { // // PurityHelper.checkAndPurify(mop); // setDead(); // // } // // } // // } // // Path: src/main/java/matgm50/twarden/client/renderer/RendererPurity.java // public class RendererPurity extends Render { // // public RendererPurity() { // // this.shadowSize = 0.1F; // // } // // public void renderEntityAt(Entity entity, double x, double y, double z, float freq, float pTicks) {} // // @Override // public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { // // renderEntityAt(entity, d, d1, d2, f, f1); // // } // // @Override // protected ResourceLocation getEntityTexture(Entity entity) { // // return AbstractClientPlayer.locationStevePng; // // } // } // Path: src/main/java/matgm50/twarden/proxy/ClientProxy.java import cpw.mods.fml.client.registry.RenderingRegistry; import matgm50.twarden.entity.EntityPurity; import matgm50.twarden.client.renderer.RendererPurity; package matgm50.twarden.proxy; /** * Created by MasterAbdoTGM50 on 5/11/2014. */ public class ClientProxy extends CommonProxy { @Override public void initRenderers() {
RenderingRegistry.registerEntityRenderingHandler(EntityPurity.class, new RendererPurity());
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/util/TabTWarden.java
// Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // }
import matgm50.twarden.item.ModItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item;
package matgm50.twarden.util; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class TabTWarden extends CreativeTabs { public TabTWarden(String label) { super(label); } @Override public Item getTabIconItem() {
// Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // Path: src/main/java/matgm50/twarden/util/TabTWarden.java import matgm50.twarden.item.ModItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; package matgm50.twarden.util; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class TabTWarden extends CreativeTabs { public TabTWarden(String label) { super(label); } @Override public Item getTabIconItem() {
return ModItems.itemWardenAmulet;
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemFocusIllumination.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ItemFocusIllumination extends ItemFocusBasic { private IIcon depth, orn; public ItemFocusIllumination() { super();
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemFocusIllumination.java import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ItemFocusIllumination extends ItemFocusBasic { private IIcon depth, orn; public ItemFocusIllumination() { super();
setUnlocalizedName(ItemLib.ILLUMI_FOCUS_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemFocusIllumination.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ItemFocusIllumination extends ItemFocusBasic { private IIcon depth, orn; public ItemFocusIllumination() { super(); setUnlocalizedName(ItemLib.ILLUMI_FOCUS_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemFocusIllumination.java import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ItemFocusIllumination extends ItemFocusBasic { private IIcon depth, orn; public ItemFocusIllumination() { super(); setUnlocalizedName(ItemLib.ILLUMI_FOCUS_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemFocusIllumination.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ItemFocusIllumination extends ItemFocusBasic { private IIcon depth, orn; public ItemFocusIllumination() { super(); setUnlocalizedName(ItemLib.ILLUMI_FOCUS_NAME); setCreativeTab(TWarden.tabTWarden); } @Override public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemFocusIllumination.java import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ItemFocusIllumination extends ItemFocusBasic { private IIcon depth, orn; public ItemFocusIllumination() { super(); setUnlocalizedName(ItemLib.ILLUMI_FOCUS_NAME); setCreativeTab(TWarden.tabTWarden); } @Override public void registerIcons(IIconRegister register) {
icon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "purityfocus");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemFocusIllumination.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting;
@Override public IIcon getOrnament() {return orn;} @Override public int getFocusColor() {return 0x6698FF;} public ItemStack onFocusRightClick(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop) { ItemWandCasting wand = (ItemWandCasting)itemStack.getItem(); if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { if (!world.isRemote) { if (wand.consumeAllVis(itemStack, player, getVisCost(), true, false)) { int x = mop.blockX; int y = mop.blockY; int z = mop.blockZ; if (mop.sideHit == 0) {y--;} if (mop.sideHit == 1) {y++;} if (mop.sideHit == 2) {z--;} if (mop.sideHit == 3) {z++;} if (mop.sideHit == 4) {x--;} if (mop.sideHit == 5) {x++;}
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemFocusIllumination.java import matgm50.twarden.TWarden; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.wands.ItemFocusBasic; import thaumcraft.common.items.wands.ItemWandCasting; @Override public IIcon getOrnament() {return orn;} @Override public int getFocusColor() {return 0x6698FF;} public ItemStack onFocusRightClick(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop) { ItemWandCasting wand = (ItemWandCasting)itemStack.getItem(); if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { if (!world.isRemote) { if (wand.consumeAllVis(itemStack, player, getVisCost(), true, false)) { int x = mop.blockX; int y = mop.blockY; int z = mop.blockZ; if (mop.sideHit == 0) {y--;} if (mop.sideHit == 1) {y++;} if (mop.sideHit == 2) {z--;} if (mop.sideHit == 3) {z++;} if (mop.sideHit == 4) {x--;} if (mop.sideHit == 5) {x++;}
world.setBlock(x, y, z, ModBlocks.blockWitor, 0, 2);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenHelm.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import thaumcraft.api.IGoggles; import thaumcraft.api.nodes.IRevealer;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenHelm extends ItemWardenArmor implements IRevealer, IGoggles{ public ItemWardenHelm() { super(0);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenHelm.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import thaumcraft.api.IGoggles; import thaumcraft.api.nodes.IRevealer; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenHelm extends ItemWardenArmor implements IRevealer, IGoggles{ public ItemWardenHelm() { super(0);
setUnlocalizedName(ItemLib.WARDEN_HELM_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenHelm.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import thaumcraft.api.IGoggles; import thaumcraft.api.nodes.IRevealer;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenHelm extends ItemWardenArmor implements IRevealer, IGoggles{ public ItemWardenHelm() { super(0); setUnlocalizedName(ItemLib.WARDEN_HELM_NAME); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenHelm.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import thaumcraft.api.IGoggles; import thaumcraft.api.nodes.IRevealer; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenHelm extends ItemWardenArmor implements IRevealer, IGoggles{ public ItemWardenHelm() { super(0); setUnlocalizedName(ItemLib.WARDEN_HELM_NAME); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardenhelm");
elminsterjimmy/XBoxApi
RESTfulShell/src/main/java/com/elminster/restful/service/AdminServiceImpl.java
// Path: RESTfulShell/src/main/java/com/elminster/restful/dao/IAdminDao.java // public interface IAdminDao { // // public void dumpData() throws Exception; // // public void restoreData() throws Exception; // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/data/ExitCode.java // public enum ExitCode { // // NORMAL(0), // COOKIE_SAVE_FAILED(0x01), // DB_DUMP_FAILED(0x02); // // private final int code; // // ExitCode(int code) { // this.code = code; // } // // public int getCode() { // return code; // } // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/util/SystemSetting.java // public class SystemSetting extends CommonConfiguration { // // /** the system properties. */ // private static final String SYSTEM_PROPERTIES = "system.properties"; // /** the property name: last api called time. */ // private static final String LAST_API_CALLED_TIME = "LAST_API_CALLED_TIME"; // /** the property name: MS live username. */ // private static final String MS_LIVE_USERNAME = "MS_LIVE_USERNAME"; // /** the property name: MS live password. */ // private static final String MS_LIVE_PASSWORD = "MS_LIVE_PASSWORD"; // // /** the singleton instance. */ // public static final SystemSetting INSTANCE = new SystemSetting(); // /** the logger. */ // private static final Log logger = LogFactory.getLog(SystemSetting.class); // // /** // * Constructor. // */ // private SystemSetting() { // super(); // } // // /** // * Load the resource files. // */ // protected void loadResources() { // // load the system properties, if not exist create it. // if (!FileUtil.isFileExist(SYSTEM_PROPERTIES)) { // try { // FileUtil.createNewFile(SYSTEM_PROPERTIES); // } catch (IOException e) { // if (logger.isWarnEnabled()) { // logger.warn("failed to create system properties."); // } // } // } // InputStream is = null; // try { // is = new FileInputStream(SYSTEM_PROPERTIES); // properties.load(is); // } catch (IOException e) { // throw new IllegalStateException("Cannot initialize the system setting: " + e); // } finally { // if (null != is) { // try { // is.close(); // } catch (IOException e) { // if (logger.isDebugEnabled()) { // logger.debug(e); // } // } // } // } // } // // /** // * @see com.elminster.common.config.CommonConfiguration#persist() // */ // @Override // public void persist() throws IOException { // super.persist(); // String comments = "updated on " + DateUtil.getCurrentDateStr(); // OutputStream out = null; // try { // out = new FileOutputStream(SYSTEM_PROPERTIES); // properties.store(out, comments); // } finally { // if (null != out) { // out.close(); // } // } // } // // /** // * Get the MS live username. // * @return the MS live username // */ // public String getMSLiveUsername() { // return this.getStringProperty(MS_LIVE_USERNAME); // } // // /** // * Get the MS live password. // * @return the MS live password // */ // public String getMSLivePassword() { // return this.getStringProperty(MS_LIVE_PASSWORD); // } // // //////////// FIXME The API stats should be stored in the db. For convenience, using properties instead. //////////// // /** // * Update the last API called time. // */ // public void updateLastApiCalledTime() { // setProperty(LAST_API_CALLED_TIME, System.currentTimeMillis()); // } // // /** // * Get the last API called time. // * @return the last api called time // */ // public long getLastApiCalledTime() { // return this.getLongProperty(LAST_API_CALLED_TIME, 0L); // } // }
import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.elminster.common.util.ExceptionUtil; import com.elminster.restful.dao.IAdminDao; import com.elminster.restful.data.ExitCode; import com.elminster.retrieve.xbox.util.SystemSetting;
package com.elminster.restful.service; /** * The admin service. * * @author jgu * @version 1.0 */ @Service public class AdminServiceImpl implements IAdminService { /** the logger. **/ private static final Log logger = LogFactory.getLog(AdminServiceImpl.class);
// Path: RESTfulShell/src/main/java/com/elminster/restful/dao/IAdminDao.java // public interface IAdminDao { // // public void dumpData() throws Exception; // // public void restoreData() throws Exception; // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/data/ExitCode.java // public enum ExitCode { // // NORMAL(0), // COOKIE_SAVE_FAILED(0x01), // DB_DUMP_FAILED(0x02); // // private final int code; // // ExitCode(int code) { // this.code = code; // } // // public int getCode() { // return code; // } // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/util/SystemSetting.java // public class SystemSetting extends CommonConfiguration { // // /** the system properties. */ // private static final String SYSTEM_PROPERTIES = "system.properties"; // /** the property name: last api called time. */ // private static final String LAST_API_CALLED_TIME = "LAST_API_CALLED_TIME"; // /** the property name: MS live username. */ // private static final String MS_LIVE_USERNAME = "MS_LIVE_USERNAME"; // /** the property name: MS live password. */ // private static final String MS_LIVE_PASSWORD = "MS_LIVE_PASSWORD"; // // /** the singleton instance. */ // public static final SystemSetting INSTANCE = new SystemSetting(); // /** the logger. */ // private static final Log logger = LogFactory.getLog(SystemSetting.class); // // /** // * Constructor. // */ // private SystemSetting() { // super(); // } // // /** // * Load the resource files. // */ // protected void loadResources() { // // load the system properties, if not exist create it. // if (!FileUtil.isFileExist(SYSTEM_PROPERTIES)) { // try { // FileUtil.createNewFile(SYSTEM_PROPERTIES); // } catch (IOException e) { // if (logger.isWarnEnabled()) { // logger.warn("failed to create system properties."); // } // } // } // InputStream is = null; // try { // is = new FileInputStream(SYSTEM_PROPERTIES); // properties.load(is); // } catch (IOException e) { // throw new IllegalStateException("Cannot initialize the system setting: " + e); // } finally { // if (null != is) { // try { // is.close(); // } catch (IOException e) { // if (logger.isDebugEnabled()) { // logger.debug(e); // } // } // } // } // } // // /** // * @see com.elminster.common.config.CommonConfiguration#persist() // */ // @Override // public void persist() throws IOException { // super.persist(); // String comments = "updated on " + DateUtil.getCurrentDateStr(); // OutputStream out = null; // try { // out = new FileOutputStream(SYSTEM_PROPERTIES); // properties.store(out, comments); // } finally { // if (null != out) { // out.close(); // } // } // } // // /** // * Get the MS live username. // * @return the MS live username // */ // public String getMSLiveUsername() { // return this.getStringProperty(MS_LIVE_USERNAME); // } // // /** // * Get the MS live password. // * @return the MS live password // */ // public String getMSLivePassword() { // return this.getStringProperty(MS_LIVE_PASSWORD); // } // // //////////// FIXME The API stats should be stored in the db. For convenience, using properties instead. //////////// // /** // * Update the last API called time. // */ // public void updateLastApiCalledTime() { // setProperty(LAST_API_CALLED_TIME, System.currentTimeMillis()); // } // // /** // * Get the last API called time. // * @return the last api called time // */ // public long getLastApiCalledTime() { // return this.getLongProperty(LAST_API_CALLED_TIME, 0L); // } // } // Path: RESTfulShell/src/main/java/com/elminster/restful/service/AdminServiceImpl.java import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.elminster.common.util.ExceptionUtil; import com.elminster.restful.dao.IAdminDao; import com.elminster.restful.data.ExitCode; import com.elminster.retrieve.xbox.util.SystemSetting; package com.elminster.restful.service; /** * The admin service. * * @author jgu * @version 1.0 */ @Service public class AdminServiceImpl implements IAdminService { /** the logger. **/ private static final Log logger = LogFactory.getLog(AdminServiceImpl.class);
private final IAdminDao adminDao;
elminsterjimmy/XBoxApi
RESTfulShell/src/main/java/com/elminster/restful/service/AdminServiceImpl.java
// Path: RESTfulShell/src/main/java/com/elminster/restful/dao/IAdminDao.java // public interface IAdminDao { // // public void dumpData() throws Exception; // // public void restoreData() throws Exception; // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/data/ExitCode.java // public enum ExitCode { // // NORMAL(0), // COOKIE_SAVE_FAILED(0x01), // DB_DUMP_FAILED(0x02); // // private final int code; // // ExitCode(int code) { // this.code = code; // } // // public int getCode() { // return code; // } // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/util/SystemSetting.java // public class SystemSetting extends CommonConfiguration { // // /** the system properties. */ // private static final String SYSTEM_PROPERTIES = "system.properties"; // /** the property name: last api called time. */ // private static final String LAST_API_CALLED_TIME = "LAST_API_CALLED_TIME"; // /** the property name: MS live username. */ // private static final String MS_LIVE_USERNAME = "MS_LIVE_USERNAME"; // /** the property name: MS live password. */ // private static final String MS_LIVE_PASSWORD = "MS_LIVE_PASSWORD"; // // /** the singleton instance. */ // public static final SystemSetting INSTANCE = new SystemSetting(); // /** the logger. */ // private static final Log logger = LogFactory.getLog(SystemSetting.class); // // /** // * Constructor. // */ // private SystemSetting() { // super(); // } // // /** // * Load the resource files. // */ // protected void loadResources() { // // load the system properties, if not exist create it. // if (!FileUtil.isFileExist(SYSTEM_PROPERTIES)) { // try { // FileUtil.createNewFile(SYSTEM_PROPERTIES); // } catch (IOException e) { // if (logger.isWarnEnabled()) { // logger.warn("failed to create system properties."); // } // } // } // InputStream is = null; // try { // is = new FileInputStream(SYSTEM_PROPERTIES); // properties.load(is); // } catch (IOException e) { // throw new IllegalStateException("Cannot initialize the system setting: " + e); // } finally { // if (null != is) { // try { // is.close(); // } catch (IOException e) { // if (logger.isDebugEnabled()) { // logger.debug(e); // } // } // } // } // } // // /** // * @see com.elminster.common.config.CommonConfiguration#persist() // */ // @Override // public void persist() throws IOException { // super.persist(); // String comments = "updated on " + DateUtil.getCurrentDateStr(); // OutputStream out = null; // try { // out = new FileOutputStream(SYSTEM_PROPERTIES); // properties.store(out, comments); // } finally { // if (null != out) { // out.close(); // } // } // } // // /** // * Get the MS live username. // * @return the MS live username // */ // public String getMSLiveUsername() { // return this.getStringProperty(MS_LIVE_USERNAME); // } // // /** // * Get the MS live password. // * @return the MS live password // */ // public String getMSLivePassword() { // return this.getStringProperty(MS_LIVE_PASSWORD); // } // // //////////// FIXME The API stats should be stored in the db. For convenience, using properties instead. //////////// // /** // * Update the last API called time. // */ // public void updateLastApiCalledTime() { // setProperty(LAST_API_CALLED_TIME, System.currentTimeMillis()); // } // // /** // * Get the last API called time. // * @return the last api called time // */ // public long getLastApiCalledTime() { // return this.getLongProperty(LAST_API_CALLED_TIME, 0L); // } // }
import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.elminster.common.util.ExceptionUtil; import com.elminster.restful.dao.IAdminDao; import com.elminster.restful.data.ExitCode; import com.elminster.retrieve.xbox.util.SystemSetting;
package com.elminster.restful.service; /** * The admin service. * * @author jgu * @version 1.0 */ @Service public class AdminServiceImpl implements IAdminService { /** the logger. **/ private static final Log logger = LogFactory.getLog(AdminServiceImpl.class); private final IAdminDao adminDao; private EntityManager em; @Autowired public AdminServiceImpl(IAdminDao adminDao) { this.adminDao = adminDao; } @Autowired public void setEntityManager(EntityManager em) { this.em = em; } /** * dump the data. */ @Override public int savepoint() {
// Path: RESTfulShell/src/main/java/com/elminster/restful/dao/IAdminDao.java // public interface IAdminDao { // // public void dumpData() throws Exception; // // public void restoreData() throws Exception; // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/data/ExitCode.java // public enum ExitCode { // // NORMAL(0), // COOKIE_SAVE_FAILED(0x01), // DB_DUMP_FAILED(0x02); // // private final int code; // // ExitCode(int code) { // this.code = code; // } // // public int getCode() { // return code; // } // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/util/SystemSetting.java // public class SystemSetting extends CommonConfiguration { // // /** the system properties. */ // private static final String SYSTEM_PROPERTIES = "system.properties"; // /** the property name: last api called time. */ // private static final String LAST_API_CALLED_TIME = "LAST_API_CALLED_TIME"; // /** the property name: MS live username. */ // private static final String MS_LIVE_USERNAME = "MS_LIVE_USERNAME"; // /** the property name: MS live password. */ // private static final String MS_LIVE_PASSWORD = "MS_LIVE_PASSWORD"; // // /** the singleton instance. */ // public static final SystemSetting INSTANCE = new SystemSetting(); // /** the logger. */ // private static final Log logger = LogFactory.getLog(SystemSetting.class); // // /** // * Constructor. // */ // private SystemSetting() { // super(); // } // // /** // * Load the resource files. // */ // protected void loadResources() { // // load the system properties, if not exist create it. // if (!FileUtil.isFileExist(SYSTEM_PROPERTIES)) { // try { // FileUtil.createNewFile(SYSTEM_PROPERTIES); // } catch (IOException e) { // if (logger.isWarnEnabled()) { // logger.warn("failed to create system properties."); // } // } // } // InputStream is = null; // try { // is = new FileInputStream(SYSTEM_PROPERTIES); // properties.load(is); // } catch (IOException e) { // throw new IllegalStateException("Cannot initialize the system setting: " + e); // } finally { // if (null != is) { // try { // is.close(); // } catch (IOException e) { // if (logger.isDebugEnabled()) { // logger.debug(e); // } // } // } // } // } // // /** // * @see com.elminster.common.config.CommonConfiguration#persist() // */ // @Override // public void persist() throws IOException { // super.persist(); // String comments = "updated on " + DateUtil.getCurrentDateStr(); // OutputStream out = null; // try { // out = new FileOutputStream(SYSTEM_PROPERTIES); // properties.store(out, comments); // } finally { // if (null != out) { // out.close(); // } // } // } // // /** // * Get the MS live username. // * @return the MS live username // */ // public String getMSLiveUsername() { // return this.getStringProperty(MS_LIVE_USERNAME); // } // // /** // * Get the MS live password. // * @return the MS live password // */ // public String getMSLivePassword() { // return this.getStringProperty(MS_LIVE_PASSWORD); // } // // //////////// FIXME The API stats should be stored in the db. For convenience, using properties instead. //////////// // /** // * Update the last API called time. // */ // public void updateLastApiCalledTime() { // setProperty(LAST_API_CALLED_TIME, System.currentTimeMillis()); // } // // /** // * Get the last API called time. // * @return the last api called time // */ // public long getLastApiCalledTime() { // return this.getLongProperty(LAST_API_CALLED_TIME, 0L); // } // } // Path: RESTfulShell/src/main/java/com/elminster/restful/service/AdminServiceImpl.java import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.elminster.common.util.ExceptionUtil; import com.elminster.restful.dao.IAdminDao; import com.elminster.restful.data.ExitCode; import com.elminster.retrieve.xbox.util.SystemSetting; package com.elminster.restful.service; /** * The admin service. * * @author jgu * @version 1.0 */ @Service public class AdminServiceImpl implements IAdminService { /** the logger. **/ private static final Log logger = LogFactory.getLog(AdminServiceImpl.class); private final IAdminDao adminDao; private EntityManager em; @Autowired public AdminServiceImpl(IAdminDao adminDao) { this.adminDao = adminDao; } @Autowired public void setEntityManager(EntityManager em) { this.em = em; } /** * dump the data. */ @Override public int savepoint() {
int ec = ExitCode.NORMAL.getCode();
elminsterjimmy/XBoxApi
RESTfulShell/src/main/java/com/elminster/restful/service/AdminServiceImpl.java
// Path: RESTfulShell/src/main/java/com/elminster/restful/dao/IAdminDao.java // public interface IAdminDao { // // public void dumpData() throws Exception; // // public void restoreData() throws Exception; // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/data/ExitCode.java // public enum ExitCode { // // NORMAL(0), // COOKIE_SAVE_FAILED(0x01), // DB_DUMP_FAILED(0x02); // // private final int code; // // ExitCode(int code) { // this.code = code; // } // // public int getCode() { // return code; // } // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/util/SystemSetting.java // public class SystemSetting extends CommonConfiguration { // // /** the system properties. */ // private static final String SYSTEM_PROPERTIES = "system.properties"; // /** the property name: last api called time. */ // private static final String LAST_API_CALLED_TIME = "LAST_API_CALLED_TIME"; // /** the property name: MS live username. */ // private static final String MS_LIVE_USERNAME = "MS_LIVE_USERNAME"; // /** the property name: MS live password. */ // private static final String MS_LIVE_PASSWORD = "MS_LIVE_PASSWORD"; // // /** the singleton instance. */ // public static final SystemSetting INSTANCE = new SystemSetting(); // /** the logger. */ // private static final Log logger = LogFactory.getLog(SystemSetting.class); // // /** // * Constructor. // */ // private SystemSetting() { // super(); // } // // /** // * Load the resource files. // */ // protected void loadResources() { // // load the system properties, if not exist create it. // if (!FileUtil.isFileExist(SYSTEM_PROPERTIES)) { // try { // FileUtil.createNewFile(SYSTEM_PROPERTIES); // } catch (IOException e) { // if (logger.isWarnEnabled()) { // logger.warn("failed to create system properties."); // } // } // } // InputStream is = null; // try { // is = new FileInputStream(SYSTEM_PROPERTIES); // properties.load(is); // } catch (IOException e) { // throw new IllegalStateException("Cannot initialize the system setting: " + e); // } finally { // if (null != is) { // try { // is.close(); // } catch (IOException e) { // if (logger.isDebugEnabled()) { // logger.debug(e); // } // } // } // } // } // // /** // * @see com.elminster.common.config.CommonConfiguration#persist() // */ // @Override // public void persist() throws IOException { // super.persist(); // String comments = "updated on " + DateUtil.getCurrentDateStr(); // OutputStream out = null; // try { // out = new FileOutputStream(SYSTEM_PROPERTIES); // properties.store(out, comments); // } finally { // if (null != out) { // out.close(); // } // } // } // // /** // * Get the MS live username. // * @return the MS live username // */ // public String getMSLiveUsername() { // return this.getStringProperty(MS_LIVE_USERNAME); // } // // /** // * Get the MS live password. // * @return the MS live password // */ // public String getMSLivePassword() { // return this.getStringProperty(MS_LIVE_PASSWORD); // } // // //////////// FIXME The API stats should be stored in the db. For convenience, using properties instead. //////////// // /** // * Update the last API called time. // */ // public void updateLastApiCalledTime() { // setProperty(LAST_API_CALLED_TIME, System.currentTimeMillis()); // } // // /** // * Get the last API called time. // * @return the last api called time // */ // public long getLastApiCalledTime() { // return this.getLongProperty(LAST_API_CALLED_TIME, 0L); // } // }
import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.elminster.common.util.ExceptionUtil; import com.elminster.restful.dao.IAdminDao; import com.elminster.restful.data.ExitCode; import com.elminster.retrieve.xbox.util.SystemSetting;
package com.elminster.restful.service; /** * The admin service. * * @author jgu * @version 1.0 */ @Service public class AdminServiceImpl implements IAdminService { /** the logger. **/ private static final Log logger = LogFactory.getLog(AdminServiceImpl.class); private final IAdminDao adminDao; private EntityManager em; @Autowired public AdminServiceImpl(IAdminDao adminDao) { this.adminDao = adminDao; } @Autowired public void setEntityManager(EntityManager em) { this.em = em; } /** * dump the data. */ @Override public int savepoint() { int ec = ExitCode.NORMAL.getCode(); // save cookies try {
// Path: RESTfulShell/src/main/java/com/elminster/restful/dao/IAdminDao.java // public interface IAdminDao { // // public void dumpData() throws Exception; // // public void restoreData() throws Exception; // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/data/ExitCode.java // public enum ExitCode { // // NORMAL(0), // COOKIE_SAVE_FAILED(0x01), // DB_DUMP_FAILED(0x02); // // private final int code; // // ExitCode(int code) { // this.code = code; // } // // public int getCode() { // return code; // } // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/util/SystemSetting.java // public class SystemSetting extends CommonConfiguration { // // /** the system properties. */ // private static final String SYSTEM_PROPERTIES = "system.properties"; // /** the property name: last api called time. */ // private static final String LAST_API_CALLED_TIME = "LAST_API_CALLED_TIME"; // /** the property name: MS live username. */ // private static final String MS_LIVE_USERNAME = "MS_LIVE_USERNAME"; // /** the property name: MS live password. */ // private static final String MS_LIVE_PASSWORD = "MS_LIVE_PASSWORD"; // // /** the singleton instance. */ // public static final SystemSetting INSTANCE = new SystemSetting(); // /** the logger. */ // private static final Log logger = LogFactory.getLog(SystemSetting.class); // // /** // * Constructor. // */ // private SystemSetting() { // super(); // } // // /** // * Load the resource files. // */ // protected void loadResources() { // // load the system properties, if not exist create it. // if (!FileUtil.isFileExist(SYSTEM_PROPERTIES)) { // try { // FileUtil.createNewFile(SYSTEM_PROPERTIES); // } catch (IOException e) { // if (logger.isWarnEnabled()) { // logger.warn("failed to create system properties."); // } // } // } // InputStream is = null; // try { // is = new FileInputStream(SYSTEM_PROPERTIES); // properties.load(is); // } catch (IOException e) { // throw new IllegalStateException("Cannot initialize the system setting: " + e); // } finally { // if (null != is) { // try { // is.close(); // } catch (IOException e) { // if (logger.isDebugEnabled()) { // logger.debug(e); // } // } // } // } // } // // /** // * @see com.elminster.common.config.CommonConfiguration#persist() // */ // @Override // public void persist() throws IOException { // super.persist(); // String comments = "updated on " + DateUtil.getCurrentDateStr(); // OutputStream out = null; // try { // out = new FileOutputStream(SYSTEM_PROPERTIES); // properties.store(out, comments); // } finally { // if (null != out) { // out.close(); // } // } // } // // /** // * Get the MS live username. // * @return the MS live username // */ // public String getMSLiveUsername() { // return this.getStringProperty(MS_LIVE_USERNAME); // } // // /** // * Get the MS live password. // * @return the MS live password // */ // public String getMSLivePassword() { // return this.getStringProperty(MS_LIVE_PASSWORD); // } // // //////////// FIXME The API stats should be stored in the db. For convenience, using properties instead. //////////// // /** // * Update the last API called time. // */ // public void updateLastApiCalledTime() { // setProperty(LAST_API_CALLED_TIME, System.currentTimeMillis()); // } // // /** // * Get the last API called time. // * @return the last api called time // */ // public long getLastApiCalledTime() { // return this.getLongProperty(LAST_API_CALLED_TIME, 0L); // } // } // Path: RESTfulShell/src/main/java/com/elminster/restful/service/AdminServiceImpl.java import java.io.IOException; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.elminster.common.util.ExceptionUtil; import com.elminster.restful.dao.IAdminDao; import com.elminster.restful.data.ExitCode; import com.elminster.retrieve.xbox.util.SystemSetting; package com.elminster.restful.service; /** * The admin service. * * @author jgu * @version 1.0 */ @Service public class AdminServiceImpl implements IAdminService { /** the logger. **/ private static final Log logger = LogFactory.getLog(AdminServiceImpl.class); private final IAdminDao adminDao; private EntityManager em; @Autowired public AdminServiceImpl(IAdminDao adminDao) { this.adminDao = adminDao; } @Autowired public void setEntityManager(EntityManager em) { this.em = em; } /** * dump the data. */ @Override public int savepoint() { int ec = ExitCode.NORMAL.getCode(); // save cookies try {
SystemSetting.INSTANCE.persist();
elminsterjimmy/XBoxApi
RESTfulShell/src/main/java/com/elminster/restful/controller/AdminController.java
// Path: RESTfulShell/src/main/java/com/elminster/restful/application/Application.java // @SpringBootApplication // // same as @Configuration @EnableAutoConfiguration @ComponentScan // @ComponentScan(basePackages="com.elminster.restful") // public class Application { // // public static ConfigurableApplicationContext context; // // public static void main(String[] args) { // SpringApplication app = new SpringApplication(Application.class); // app.setShowBanner(false); // context = app.run(args); // } // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/service/IAdminService.java // public interface IAdminService { // // public int savepoint(); // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/exception/ServiceException.java // public class ServiceException extends Exception { // // /** // * // */ // private static final long serialVersionUID = 1L; // // public ServiceException() { // super(); // } // // public ServiceException(String message, Throwable cause) { // super(message, cause); // } // // public ServiceException(String message) { // super(message); // } // // public ServiceException(Throwable cause) { // super(cause); // } // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.elminster.restful.application.Application; import com.elminster.restful.service.IAdminService; import com.elminster.retrieve.xbox.exception.ServiceException;
package com.elminster.restful.controller; /** * The admin controller. * * @author jgu * @version 1.0 */ @Controller public class AdminController {
// Path: RESTfulShell/src/main/java/com/elminster/restful/application/Application.java // @SpringBootApplication // // same as @Configuration @EnableAutoConfiguration @ComponentScan // @ComponentScan(basePackages="com.elminster.restful") // public class Application { // // public static ConfigurableApplicationContext context; // // public static void main(String[] args) { // SpringApplication app = new SpringApplication(Application.class); // app.setShowBanner(false); // context = app.run(args); // } // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/service/IAdminService.java // public interface IAdminService { // // public int savepoint(); // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/exception/ServiceException.java // public class ServiceException extends Exception { // // /** // * // */ // private static final long serialVersionUID = 1L; // // public ServiceException() { // super(); // } // // public ServiceException(String message, Throwable cause) { // super(message, cause); // } // // public ServiceException(String message) { // super(message); // } // // public ServiceException(Throwable cause) { // super(cause); // } // } // Path: RESTfulShell/src/main/java/com/elminster/restful/controller/AdminController.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.elminster.restful.application.Application; import com.elminster.restful.service.IAdminService; import com.elminster.retrieve.xbox.exception.ServiceException; package com.elminster.restful.controller; /** * The admin controller. * * @author jgu * @version 1.0 */ @Controller public class AdminController {
private final IAdminService adminService;
elminsterjimmy/XBoxApi
RESTfulShell/src/main/java/com/elminster/restful/controller/AdminController.java
// Path: RESTfulShell/src/main/java/com/elminster/restful/application/Application.java // @SpringBootApplication // // same as @Configuration @EnableAutoConfiguration @ComponentScan // @ComponentScan(basePackages="com.elminster.restful") // public class Application { // // public static ConfigurableApplicationContext context; // // public static void main(String[] args) { // SpringApplication app = new SpringApplication(Application.class); // app.setShowBanner(false); // context = app.run(args); // } // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/service/IAdminService.java // public interface IAdminService { // // public int savepoint(); // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/exception/ServiceException.java // public class ServiceException extends Exception { // // /** // * // */ // private static final long serialVersionUID = 1L; // // public ServiceException() { // super(); // } // // public ServiceException(String message, Throwable cause) { // super(message, cause); // } // // public ServiceException(String message) { // super(message); // } // // public ServiceException(Throwable cause) { // super(cause); // } // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.elminster.restful.application.Application; import com.elminster.restful.service.IAdminService; import com.elminster.retrieve.xbox.exception.ServiceException;
package com.elminster.restful.controller; /** * The admin controller. * * @author jgu * @version 1.0 */ @Controller public class AdminController { private final IAdminService adminService; @Autowired public AdminController(IAdminService adminService) { this.adminService = adminService; } @RequestMapping(value = "/admin/dump", method = RequestMethod.GET)
// Path: RESTfulShell/src/main/java/com/elminster/restful/application/Application.java // @SpringBootApplication // // same as @Configuration @EnableAutoConfiguration @ComponentScan // @ComponentScan(basePackages="com.elminster.restful") // public class Application { // // public static ConfigurableApplicationContext context; // // public static void main(String[] args) { // SpringApplication app = new SpringApplication(Application.class); // app.setShowBanner(false); // context = app.run(args); // } // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/service/IAdminService.java // public interface IAdminService { // // public int savepoint(); // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/exception/ServiceException.java // public class ServiceException extends Exception { // // /** // * // */ // private static final long serialVersionUID = 1L; // // public ServiceException() { // super(); // } // // public ServiceException(String message, Throwable cause) { // super(message, cause); // } // // public ServiceException(String message) { // super(message); // } // // public ServiceException(Throwable cause) { // super(cause); // } // } // Path: RESTfulShell/src/main/java/com/elminster/restful/controller/AdminController.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.elminster.restful.application.Application; import com.elminster.restful.service.IAdminService; import com.elminster.retrieve.xbox.exception.ServiceException; package com.elminster.restful.controller; /** * The admin controller. * * @author jgu * @version 1.0 */ @Controller public class AdminController { private final IAdminService adminService; @Autowired public AdminController(IAdminService adminService) { this.adminService = adminService; } @RequestMapping(value = "/admin/dump", method = RequestMethod.GET)
public @ResponseBody int dump() throws ServiceException {
elminsterjimmy/XBoxApi
RESTfulShell/src/main/java/com/elminster/restful/controller/AdminController.java
// Path: RESTfulShell/src/main/java/com/elminster/restful/application/Application.java // @SpringBootApplication // // same as @Configuration @EnableAutoConfiguration @ComponentScan // @ComponentScan(basePackages="com.elminster.restful") // public class Application { // // public static ConfigurableApplicationContext context; // // public static void main(String[] args) { // SpringApplication app = new SpringApplication(Application.class); // app.setShowBanner(false); // context = app.run(args); // } // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/service/IAdminService.java // public interface IAdminService { // // public int savepoint(); // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/exception/ServiceException.java // public class ServiceException extends Exception { // // /** // * // */ // private static final long serialVersionUID = 1L; // // public ServiceException() { // super(); // } // // public ServiceException(String message, Throwable cause) { // super(message, cause); // } // // public ServiceException(String message) { // super(message); // } // // public ServiceException(Throwable cause) { // super(cause); // } // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.elminster.restful.application.Application; import com.elminster.restful.service.IAdminService; import com.elminster.retrieve.xbox.exception.ServiceException;
package com.elminster.restful.controller; /** * The admin controller. * * @author jgu * @version 1.0 */ @Controller public class AdminController { private final IAdminService adminService; @Autowired public AdminController(IAdminService adminService) { this.adminService = adminService; } @RequestMapping(value = "/admin/dump", method = RequestMethod.GET) public @ResponseBody int dump() throws ServiceException { return adminService.savepoint(); } @RequestMapping(value = "/admin/shutdown", method = RequestMethod.GET) public void shutdown() { final int exitCode = adminService.savepoint(); ExitCodeGenerator exitCodeGenerator = new ExitCodeGenerator() { @Override public int getExitCode() { return exitCode; } };
// Path: RESTfulShell/src/main/java/com/elminster/restful/application/Application.java // @SpringBootApplication // // same as @Configuration @EnableAutoConfiguration @ComponentScan // @ComponentScan(basePackages="com.elminster.restful") // public class Application { // // public static ConfigurableApplicationContext context; // // public static void main(String[] args) { // SpringApplication app = new SpringApplication(Application.class); // app.setShowBanner(false); // context = app.run(args); // } // } // // Path: RESTfulShell/src/main/java/com/elminster/restful/service/IAdminService.java // public interface IAdminService { // // public int savepoint(); // } // // Path: XBoxApi/src/main/java/com/elminster/retrieve/xbox/exception/ServiceException.java // public class ServiceException extends Exception { // // /** // * // */ // private static final long serialVersionUID = 1L; // // public ServiceException() { // super(); // } // // public ServiceException(String message, Throwable cause) { // super(message, cause); // } // // public ServiceException(String message) { // super(message); // } // // public ServiceException(Throwable cause) { // super(cause); // } // } // Path: RESTfulShell/src/main/java/com/elminster/restful/controller/AdminController.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.SpringApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.elminster.restful.application.Application; import com.elminster.restful.service.IAdminService; import com.elminster.retrieve.xbox.exception.ServiceException; package com.elminster.restful.controller; /** * The admin controller. * * @author jgu * @version 1.0 */ @Controller public class AdminController { private final IAdminService adminService; @Autowired public AdminController(IAdminService adminService) { this.adminService = adminService; } @RequestMapping(value = "/admin/dump", method = RequestMethod.GET) public @ResponseBody int dump() throws ServiceException { return adminService.savepoint(); } @RequestMapping(value = "/admin/shutdown", method = RequestMethod.GET) public void shutdown() { final int exitCode = adminService.savepoint(); ExitCodeGenerator exitCodeGenerator = new ExitCodeGenerator() { @Override public int getExitCode() { return exitCode; } };
SpringApplication.exit(Application.context, exitCodeGenerator);
OleksandrKucherenko/binding-tc
binder/src/main/java/com/artfulbits/binding/Formatting.java
// Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToModel.java // public interface ToModel<TOut, TIn> { // /** // * Convert Out- value into In- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toModel(final TIn value); // } // // Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToView.java // public interface ToView<TOut, TIn> { // /** // * Convert In- value into Out- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toView(final TIn value); // }
import com.artfulbits.binding.toolbox.ToModel; import com.artfulbits.binding.toolbox.ToView;
package com.artfulbits.binding; /** * Interface responsible for converting values in to-, from- directions.<br/> Main rule for inheritors of the * interface:<br/> <code> assertEqual( In, toIn(toOut(In)) );<br/> assertEqual( Out, toOut(toIn(Out)) ); </code> * * @param <TRight> type from right side of binding (Model). * @param <TLeft> type from left side of binding (View). */ @SuppressWarnings("unused") public interface Formatting<TLeft, TRight>
// Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToModel.java // public interface ToModel<TOut, TIn> { // /** // * Convert Out- value into In- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toModel(final TIn value); // } // // Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToView.java // public interface ToView<TOut, TIn> { // /** // * Convert In- value into Out- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toView(final TIn value); // } // Path: binder/src/main/java/com/artfulbits/binding/Formatting.java import com.artfulbits.binding.toolbox.ToModel; import com.artfulbits.binding.toolbox.ToView; package com.artfulbits.binding; /** * Interface responsible for converting values in to-, from- directions.<br/> Main rule for inheritors of the * interface:<br/> <code> assertEqual( In, toIn(toOut(In)) );<br/> assertEqual( Out, toOut(toIn(Out)) ); </code> * * @param <TRight> type from right side of binding (Model). * @param <TLeft> type from left side of binding (View). */ @SuppressWarnings("unused") public interface Formatting<TLeft, TRight>
extends ToView<TLeft, TRight>, ToModel<TRight, TLeft> {
OleksandrKucherenko/binding-tc
binder/src/main/java/com/artfulbits/binding/Formatting.java
// Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToModel.java // public interface ToModel<TOut, TIn> { // /** // * Convert Out- value into In- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toModel(final TIn value); // } // // Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToView.java // public interface ToView<TOut, TIn> { // /** // * Convert In- value into Out- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toView(final TIn value); // }
import com.artfulbits.binding.toolbox.ToModel; import com.artfulbits.binding.toolbox.ToView;
package com.artfulbits.binding; /** * Interface responsible for converting values in to-, from- directions.<br/> Main rule for inheritors of the * interface:<br/> <code> assertEqual( In, toIn(toOut(In)) );<br/> assertEqual( Out, toOut(toIn(Out)) ); </code> * * @param <TRight> type from right side of binding (Model). * @param <TLeft> type from left side of binding (View). */ @SuppressWarnings("unused") public interface Formatting<TLeft, TRight>
// Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToModel.java // public interface ToModel<TOut, TIn> { // /** // * Convert Out- value into In- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toModel(final TIn value); // } // // Path: binder/src/main/java/com/artfulbits/binding/toolbox/ToView.java // public interface ToView<TOut, TIn> { // /** // * Convert In- value into Out- value. // * // * @param value the instance to convert // * @return the converted value // * @throws com.artfulbits.binding.exceptions.OneWayBindingError in case if allowed only one way binding. // */ // TOut toView(final TIn value); // } // Path: binder/src/main/java/com/artfulbits/binding/Formatting.java import com.artfulbits.binding.toolbox.ToModel; import com.artfulbits.binding.toolbox.ToView; package com.artfulbits.binding; /** * Interface responsible for converting values in to-, from- directions.<br/> Main rule for inheritors of the * interface:<br/> <code> assertEqual( In, toIn(toOut(In)) );<br/> assertEqual( Out, toOut(toIn(Out)) ); </code> * * @param <TRight> type from right side of binding (Model). * @param <TLeft> type from left side of binding (View). */ @SuppressWarnings("unused") public interface Formatting<TLeft, TRight>
extends ToView<TLeft, TRight>, ToModel<TRight, TLeft> {
OleksandrKucherenko/binding-tc
binder/src/main/java/com/artfulbits/binding/reflection/Property.java
// Path: binder/src/main/java/com/artfulbits/binding/exceptions/WrongConfigurationError.java // public class WrongConfigurationError extends ConfigurationError { // /* [ CONSTANTS ] ================================================================================================= */ // // /** Serialization identifier. */ // private static final long serialVersionUID = 498019655467980342L; // // /* [ CONSTRUCTORS ] ============================================================================================== */ // // public WrongConfigurationError(final String msg) { // super(msg); // } // // public WrongConfigurationError(final String msg, final Throwable inner) { // super(msg, inner); // } // // /* [ GETTER / SETTER METHODS ] =================================================================================== */ // // /** Create a long message from inner exceptions. */ // @Override // public String getMessage() { // final StringBuilder sb = new StringBuilder(); // final String separator = "\n"; // // for (final Throwable t : getReasons()) { // sb.append(separator).append(t.getMessage()); // } // // return super.getMessage() + sb.toString(); // } // }
import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.artfulbits.binding.exceptions.WrongConfigurationError; import java.util.List; import java.util.Locale;
package com.artfulbits.binding.reflection; /** Class is responsible for accessing a specific abstract 'field' by using reflection. */ @SuppressWarnings("unused") public class Property<T> { /* [ CONSTANTS ] ================================================================================================= */ /** Use this constant for defining 'empty' name of the getter or setter. */ public static final String NO_NAME = ""; /** Array of possible prefixes used for getting the value. */ private static final String[] KNOWN_GETTERS = new String[]{"get", "has", "is", "exceeds", "m", ""}; /** Array of possible prefixes used for setting the value. */ private static final String[] KNOWN_SETTERS = new String[]{"set", "m", ""}; /* [ MEMBERS ] =================================================================================================== */ /** Property data type. */ private final Class<T> mType; /** Property name pattern. */ private final String mName; /** reference on reflected class entry used for GET operation. */ private Entry mResolvedGet; /** reference on reflected class entry used for SET operation. */ private Entry mResolvedSet; /** Name of found 'get' entry. */ private String mStrictGet; /** Name of found 'set' entry. */ private String mStrictSet; /* [ CONSTRUCTORS ] ============================================================================================== */ /** Expected automatic 'get' and 'set' finding. */ public Property(@NonNull final Class<T> type, @NonNull final String name) { mType = type; mName = name; } /** 'get' and 'set' are explicitly defined. */ public Property(@NonNull final Class<T> type, @NonNull final String getName, @NonNull final String setName) { mType = type; mName = null; mStrictGet = getName; mStrictSet = setName; } /** * Resolve property logic to human readable string. * <p/> * Example 1: .getText() | setText()<br/> Example 2: .findViewById(...) | &lt;none&gt;()<br/> Example 3: .{Text}(...) * | &lt;none&gt;()<br/> */ @Override public String toString() { final boolean isPattern = (null != mName && !NO_NAME.equals(mName)); final boolean isStrictGet = (null != mStrictGet && !NO_NAME.equals(mStrictGet)); final boolean isStrictSet = (null != mStrictSet && !NO_NAME.equals(mStrictSet)); final String search = isPattern ? "{" + mName + "}" : "<none>"; final String getter = isStrictGet ? (null == mResolvedGet ? "{" + mStrictGet + "}" : mResolvedGet.toString()) : search; final String setter = isStrictSet ? (null == mResolvedSet ? "{" + mStrictSet + "}" : mResolvedSet.toString()) : search; return String.format(Locale.US, "%s | %s", getter, setter); } @NonNull public String toGetterString() { final boolean isPattern = (null != mName && !NO_NAME.equals(mName)); final boolean isGet = (null != mStrictGet && !NO_NAME.equals(mStrictGet)); final String search = isPattern ? "{" + mName + "}" : "<none>"; return isGet ? (null == mResolvedGet) ? "{" + mStrictGet + "}" : mResolvedGet.toString() : search; } @NonNull public String toSetterString() { final boolean isPattern = (null != mName && !NO_NAME.equals(mName)); final boolean isSet = (null != mStrictSet && !NO_NAME.equals(mStrictSet)); final String search = isPattern ? "{" + mName + "}" : "<none>"; return isSet ? (null == mResolvedSet) ? "{" + mStrictSet + "}" : mResolvedSet.toString() : search; } /* [ GETTER / SETTER METHODS ] =================================================================================== */ /** Get property data type. */ @NonNull public final Class<T> getDataType() { return mType; } /** Get resolved 'get' entry name. Null - if not resolved yet. */ @Nullable public String getGetterName() { return mStrictGet; } /** Get resolved 'set' entry name. Null - if not resolved yet. */ @Nullable public String getSetterName() { return mStrictSet; } /** Get property value. */ public T get(@NonNull final Object instance) { return get(instance, getterArguments()); } @SuppressWarnings("unchecked") public T get(@NonNull final Object instance, final Object... args) { try { if (null == mResolvedGet) { mResolvedGet = extractGetter(instance); } if (null == mResolvedGet) {
// Path: binder/src/main/java/com/artfulbits/binding/exceptions/WrongConfigurationError.java // public class WrongConfigurationError extends ConfigurationError { // /* [ CONSTANTS ] ================================================================================================= */ // // /** Serialization identifier. */ // private static final long serialVersionUID = 498019655467980342L; // // /* [ CONSTRUCTORS ] ============================================================================================== */ // // public WrongConfigurationError(final String msg) { // super(msg); // } // // public WrongConfigurationError(final String msg, final Throwable inner) { // super(msg, inner); // } // // /* [ GETTER / SETTER METHODS ] =================================================================================== */ // // /** Create a long message from inner exceptions. */ // @Override // public String getMessage() { // final StringBuilder sb = new StringBuilder(); // final String separator = "\n"; // // for (final Throwable t : getReasons()) { // sb.append(separator).append(t.getMessage()); // } // // return super.getMessage() + sb.toString(); // } // } // Path: binder/src/main/java/com/artfulbits/binding/reflection/Property.java import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.artfulbits.binding.exceptions.WrongConfigurationError; import java.util.List; import java.util.Locale; package com.artfulbits.binding.reflection; /** Class is responsible for accessing a specific abstract 'field' by using reflection. */ @SuppressWarnings("unused") public class Property<T> { /* [ CONSTANTS ] ================================================================================================= */ /** Use this constant for defining 'empty' name of the getter or setter. */ public static final String NO_NAME = ""; /** Array of possible prefixes used for getting the value. */ private static final String[] KNOWN_GETTERS = new String[]{"get", "has", "is", "exceeds", "m", ""}; /** Array of possible prefixes used for setting the value. */ private static final String[] KNOWN_SETTERS = new String[]{"set", "m", ""}; /* [ MEMBERS ] =================================================================================================== */ /** Property data type. */ private final Class<T> mType; /** Property name pattern. */ private final String mName; /** reference on reflected class entry used for GET operation. */ private Entry mResolvedGet; /** reference on reflected class entry used for SET operation. */ private Entry mResolvedSet; /** Name of found 'get' entry. */ private String mStrictGet; /** Name of found 'set' entry. */ private String mStrictSet; /* [ CONSTRUCTORS ] ============================================================================================== */ /** Expected automatic 'get' and 'set' finding. */ public Property(@NonNull final Class<T> type, @NonNull final String name) { mType = type; mName = name; } /** 'get' and 'set' are explicitly defined. */ public Property(@NonNull final Class<T> type, @NonNull final String getName, @NonNull final String setName) { mType = type; mName = null; mStrictGet = getName; mStrictSet = setName; } /** * Resolve property logic to human readable string. * <p/> * Example 1: .getText() | setText()<br/> Example 2: .findViewById(...) | &lt;none&gt;()<br/> Example 3: .{Text}(...) * | &lt;none&gt;()<br/> */ @Override public String toString() { final boolean isPattern = (null != mName && !NO_NAME.equals(mName)); final boolean isStrictGet = (null != mStrictGet && !NO_NAME.equals(mStrictGet)); final boolean isStrictSet = (null != mStrictSet && !NO_NAME.equals(mStrictSet)); final String search = isPattern ? "{" + mName + "}" : "<none>"; final String getter = isStrictGet ? (null == mResolvedGet ? "{" + mStrictGet + "}" : mResolvedGet.toString()) : search; final String setter = isStrictSet ? (null == mResolvedSet ? "{" + mStrictSet + "}" : mResolvedSet.toString()) : search; return String.format(Locale.US, "%s | %s", getter, setter); } @NonNull public String toGetterString() { final boolean isPattern = (null != mName && !NO_NAME.equals(mName)); final boolean isGet = (null != mStrictGet && !NO_NAME.equals(mStrictGet)); final String search = isPattern ? "{" + mName + "}" : "<none>"; return isGet ? (null == mResolvedGet) ? "{" + mStrictGet + "}" : mResolvedGet.toString() : search; } @NonNull public String toSetterString() { final boolean isPattern = (null != mName && !NO_NAME.equals(mName)); final boolean isSet = (null != mStrictSet && !NO_NAME.equals(mStrictSet)); final String search = isPattern ? "{" + mName + "}" : "<none>"; return isSet ? (null == mResolvedSet) ? "{" + mStrictSet + "}" : mResolvedSet.toString() : search; } /* [ GETTER / SETTER METHODS ] =================================================================================== */ /** Get property data type. */ @NonNull public final Class<T> getDataType() { return mType; } /** Get resolved 'get' entry name. Null - if not resolved yet. */ @Nullable public String getGetterName() { return mStrictGet; } /** Get resolved 'set' entry name. Null - if not resolved yet. */ @Nullable public String getSetterName() { return mStrictSet; } /** Get property value. */ public T get(@NonNull final Object instance) { return get(instance, getterArguments()); } @SuppressWarnings("unchecked") public T get(@NonNull final Object instance, final Object... args) { try { if (null == mResolvedGet) { mResolvedGet = extractGetter(instance); } if (null == mResolvedGet) {
throw new WrongConfigurationError("Cannot resolve GET to real method/field." +
OleksandrKucherenko/binding-tc
binder/src/main/java/com/artfulbits/binding/toolbox/Molds.java
// Path: binder/src/main/java/com/artfulbits/binding/Formatting.java // @SuppressWarnings("unused") // public interface Formatting<TLeft, TRight> // extends ToView<TLeft, TRight>, ToModel<TRight, TLeft> { // } // // Path: binder/src/main/java/com/artfulbits/binding/exceptions/OneWayBindingError.java // public class OneWayBindingError extends Error { // /** Serialization id. */ // private static final long serialVersionUID = -3510027916462788278L; // }
import android.support.annotation.NonNull; import android.text.TextUtils; import com.artfulbits.binding.Formatting; import com.artfulbits.binding.exceptions.OneWayBindingError;
package com.artfulbits.binding.toolbox; /** * Methods for construction of typical data type converter's. * <p/> * Why MOLD? I like short names. Synonyms are: mold, makeup, cast, formatting, formatter, converter. */ @SuppressWarnings({"unused", "unchecked"}) public final class Molds { /* [ CONSTRUCTORS ] ============================================================================================== */ /** hidden constructor. */ private Molds() { throw new AssertionError(); } /* [ STATIC METHODS - GENERIC ] ================================================================================== */ /** No formatting. Input and Output is the same value. */ @NonNull
// Path: binder/src/main/java/com/artfulbits/binding/Formatting.java // @SuppressWarnings("unused") // public interface Formatting<TLeft, TRight> // extends ToView<TLeft, TRight>, ToModel<TRight, TLeft> { // } // // Path: binder/src/main/java/com/artfulbits/binding/exceptions/OneWayBindingError.java // public class OneWayBindingError extends Error { // /** Serialization id. */ // private static final long serialVersionUID = -3510027916462788278L; // } // Path: binder/src/main/java/com/artfulbits/binding/toolbox/Molds.java import android.support.annotation.NonNull; import android.text.TextUtils; import com.artfulbits.binding.Formatting; import com.artfulbits.binding.exceptions.OneWayBindingError; package com.artfulbits.binding.toolbox; /** * Methods for construction of typical data type converter's. * <p/> * Why MOLD? I like short names. Synonyms are: mold, makeup, cast, formatting, formatter, converter. */ @SuppressWarnings({"unused", "unchecked"}) public final class Molds { /* [ CONSTRUCTORS ] ============================================================================================== */ /** hidden constructor. */ private Molds() { throw new AssertionError(); } /* [ STATIC METHODS - GENERIC ] ================================================================================== */ /** No formatting. Input and Output is the same value. */ @NonNull
public static <T, V> Formatting<T, V> direct() {
OleksandrKucherenko/binding-tc
binder/src/main/java/com/artfulbits/binding/toolbox/Molds.java
// Path: binder/src/main/java/com/artfulbits/binding/Formatting.java // @SuppressWarnings("unused") // public interface Formatting<TLeft, TRight> // extends ToView<TLeft, TRight>, ToModel<TRight, TLeft> { // } // // Path: binder/src/main/java/com/artfulbits/binding/exceptions/OneWayBindingError.java // public class OneWayBindingError extends Error { // /** Serialization id. */ // private static final long serialVersionUID = -3510027916462788278L; // }
import android.support.annotation.NonNull; import android.text.TextUtils; import com.artfulbits.binding.Formatting; import com.artfulbits.binding.exceptions.OneWayBindingError;
package com.artfulbits.binding.toolbox; /** * Methods for construction of typical data type converter's. * <p/> * Why MOLD? I like short names. Synonyms are: mold, makeup, cast, formatting, formatter, converter. */ @SuppressWarnings({"unused", "unchecked"}) public final class Molds { /* [ CONSTRUCTORS ] ============================================================================================== */ /** hidden constructor. */ private Molds() { throw new AssertionError(); } /* [ STATIC METHODS - GENERIC ] ================================================================================== */ /** No formatting. Input and Output is the same value. */ @NonNull public static <T, V> Formatting<T, V> direct() { return new Formatting<T, V>() { @Override public T toView(V value) { return (T) value; } @Override public V toModel(T value) { return (V) value; } }; } /** Reverse formatting instance. */ @NonNull public static <T, V> Formatting<T, V> reverse(@NonNull final Formatting<V, T> f) { return new Formatting<T, V>() { @Override public T toView(final V value) { return f.toModel(value); } @Override public V toModel(final T value) { return f.toView(value); } }; } /** * Create one way binding - allowed only POP operation, from MODEL to VIEW. VIEW to MODEL - not allowed. */ @NonNull public static <T, V> Formatting<T, V> onlyPop(@NonNull final Formatting<T, V> f) { return new Formatting<T, V>() { @Override public T toView(final V value) { return f.toView(value); } @Override public V toModel(final T value) {
// Path: binder/src/main/java/com/artfulbits/binding/Formatting.java // @SuppressWarnings("unused") // public interface Formatting<TLeft, TRight> // extends ToView<TLeft, TRight>, ToModel<TRight, TLeft> { // } // // Path: binder/src/main/java/com/artfulbits/binding/exceptions/OneWayBindingError.java // public class OneWayBindingError extends Error { // /** Serialization id. */ // private static final long serialVersionUID = -3510027916462788278L; // } // Path: binder/src/main/java/com/artfulbits/binding/toolbox/Molds.java import android.support.annotation.NonNull; import android.text.TextUtils; import com.artfulbits.binding.Formatting; import com.artfulbits.binding.exceptions.OneWayBindingError; package com.artfulbits.binding.toolbox; /** * Methods for construction of typical data type converter's. * <p/> * Why MOLD? I like short names. Synonyms are: mold, makeup, cast, formatting, formatter, converter. */ @SuppressWarnings({"unused", "unchecked"}) public final class Molds { /* [ CONSTRUCTORS ] ============================================================================================== */ /** hidden constructor. */ private Molds() { throw new AssertionError(); } /* [ STATIC METHODS - GENERIC ] ================================================================================== */ /** No formatting. Input and Output is the same value. */ @NonNull public static <T, V> Formatting<T, V> direct() { return new Formatting<T, V>() { @Override public T toView(V value) { return (T) value; } @Override public V toModel(T value) { return (V) value; } }; } /** Reverse formatting instance. */ @NonNull public static <T, V> Formatting<T, V> reverse(@NonNull final Formatting<V, T> f) { return new Formatting<T, V>() { @Override public T toView(final V value) { return f.toModel(value); } @Override public V toModel(final T value) { return f.toView(value); } }; } /** * Create one way binding - allowed only POP operation, from MODEL to VIEW. VIEW to MODEL - not allowed. */ @NonNull public static <T, V> Formatting<T, V> onlyPop(@NonNull final Formatting<T, V> f) { return new Formatting<T, V>() { @Override public T toView(final V value) { return f.toView(value); } @Override public V toModel(final T value) {
throw new OneWayBindingError();
jirkapinkas/jsitemapgenerator
src/test/java/cz/jiripinkas/jsitemapgenerator/generator/SitemapGeneratorTest.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // // Path: src/test/java/cz/jiripinkas/jsitemapgenerator/util/TestUtil.java // public class TestUtil { // // public static void testSitemapXsd(InputStream sitemapXml, File xsd) throws SAXException, IOException { // Source xmlFile = new StreamSource(sitemapXml); // SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // Schema schema = schemaFactory.newSchema(xsd); // Validator validator = schema.newValidator(); // validator.validate(xmlFile); // } // // public static void testSitemapXsdFile(File file, File xsd) throws IOException, SAXException { // try (FileInputStream inputStream = new FileInputStream(file)) { // testSitemapXsd(inputStream, xsd); // } // } // // }
import cz.jiripinkas.jsitemapgenerator.*; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import cz.jiripinkas.jsitemapgenerator.util.TestUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.io.ByteArrayInputStream; import java.io.File; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import static org.junit.jupiter.api.Assertions.*;
@Test void testConstructAlternateUrls() { String actualAlternateUrl = SitemapGenerator.of("http://www.javavids.com") .constructUrl(WebPage.builder() .name("latest.php") .alternateName("de", "latest-de.php") .alternateName("es", "latest-es.php") .build()); String expectedAlaternateUrl = "<loc>http://www.javavids.com/latest.php</loc>\n<xhtml:link rel=\"alternate\" hreflang=\"de\" href=\"http://www.javavids.com/latest-de.php\"/>\n" + "<xhtml:link rel=\"alternate\" hreflang=\"es\" href=\"http://www.javavids.com/latest-es.php\"/>\n"; assertEquals(expectedAlaternateUrl, actualAlternateUrl); } @Test void testConstructAlternateUrls2() { String actualAlternateUrl = SitemapGenerator.of("http://www.javavids.com").constructUrl(WebPage.builder() .name("latest.php") .alternateName("de", () -> "latest-de.php") .alternateName("es", () -> "latest-es.php") .build()); String expectedAlternateUrl = "<loc>http://www.javavids.com/latest.php</loc>\n<xhtml:link rel=\"alternate\" hreflang=\"de\" href=\"http://www.javavids.com/latest-de.php\"/>\n" + "<xhtml:link rel=\"alternate\" hreflang=\"es\" href=\"http://www.javavids.com/latest-es.php\"/>\n"; assertEquals(expectedAlternateUrl, actualAlternateUrl); } @Test void testConstructSitemap() throws Exception { String sitemap = sitemapGenerator.toString(); ByteArrayInputStream sitemapXml = new ByteArrayInputStream(sitemap.getBytes(StandardCharsets.UTF_8));
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // // Path: src/test/java/cz/jiripinkas/jsitemapgenerator/util/TestUtil.java // public class TestUtil { // // public static void testSitemapXsd(InputStream sitemapXml, File xsd) throws SAXException, IOException { // Source xmlFile = new StreamSource(sitemapXml); // SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // Schema schema = schemaFactory.newSchema(xsd); // Validator validator = schema.newValidator(); // validator.validate(xmlFile); // } // // public static void testSitemapXsdFile(File file, File xsd) throws IOException, SAXException { // try (FileInputStream inputStream = new FileInputStream(file)) { // testSitemapXsd(inputStream, xsd); // } // } // // } // Path: src/test/java/cz/jiripinkas/jsitemapgenerator/generator/SitemapGeneratorTest.java import cz.jiripinkas.jsitemapgenerator.*; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import cz.jiripinkas.jsitemapgenerator.util.TestUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.io.ByteArrayInputStream; import java.io.File; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import static org.junit.jupiter.api.Assertions.*; @Test void testConstructAlternateUrls() { String actualAlternateUrl = SitemapGenerator.of("http://www.javavids.com") .constructUrl(WebPage.builder() .name("latest.php") .alternateName("de", "latest-de.php") .alternateName("es", "latest-es.php") .build()); String expectedAlaternateUrl = "<loc>http://www.javavids.com/latest.php</loc>\n<xhtml:link rel=\"alternate\" hreflang=\"de\" href=\"http://www.javavids.com/latest-de.php\"/>\n" + "<xhtml:link rel=\"alternate\" hreflang=\"es\" href=\"http://www.javavids.com/latest-es.php\"/>\n"; assertEquals(expectedAlaternateUrl, actualAlternateUrl); } @Test void testConstructAlternateUrls2() { String actualAlternateUrl = SitemapGenerator.of("http://www.javavids.com").constructUrl(WebPage.builder() .name("latest.php") .alternateName("de", () -> "latest-de.php") .alternateName("es", () -> "latest-es.php") .build()); String expectedAlternateUrl = "<loc>http://www.javavids.com/latest.php</loc>\n<xhtml:link rel=\"alternate\" hreflang=\"de\" href=\"http://www.javavids.com/latest-de.php\"/>\n" + "<xhtml:link rel=\"alternate\" hreflang=\"es\" href=\"http://www.javavids.com/latest-es.php\"/>\n"; assertEquals(expectedAlternateUrl, actualAlternateUrl); } @Test void testConstructSitemap() throws Exception { String sitemap = sitemapGenerator.toString(); ByteArrayInputStream sitemapXml = new ByteArrayInputStream(sitemap.getBytes(StandardCharsets.UTF_8));
TestUtil.testSitemapXsd(sitemapXml, new File("src/test/resources/sitemap.xsd"));
jirkapinkas/jsitemapgenerator
src/test/java/cz/jiripinkas/jsitemapgenerator/generator/SitemapGeneratorTest.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // // Path: src/test/java/cz/jiripinkas/jsitemapgenerator/util/TestUtil.java // public class TestUtil { // // public static void testSitemapXsd(InputStream sitemapXml, File xsd) throws SAXException, IOException { // Source xmlFile = new StreamSource(sitemapXml); // SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // Schema schema = schemaFactory.newSchema(xsd); // Validator validator = schema.newValidator(); // validator.validate(xmlFile); // } // // public static void testSitemapXsdFile(File file, File xsd) throws IOException, SAXException { // try (FileInputStream inputStream = new FileInputStream(file)) { // testSitemapXsd(inputStream, xsd); // } // } // // }
import cz.jiripinkas.jsitemapgenerator.*; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import cz.jiripinkas.jsitemapgenerator.util.TestUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.io.ByteArrayInputStream; import java.io.File; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import static org.junit.jupiter.api.Assertions.*;
} @Test void testPingGoogleSuccess2() throws Exception { HttpClient httpClientMock = Mockito.mock(HttpClient.class); SitemapGenerator sitemapGenerator = SitemapGenerator.of("https://www.example.com/"); sitemapGenerator.setHttpClient(httpClientMock); Mockito.when(httpClientMock.get(Mockito.anyString())) .thenReturn(500); Mockito.when(httpClientMock.get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.example.com%2Fcustomsitemap.xml")) .thenReturn(200); sitemapGenerator.ping(Ping.builder().engines(Ping.SearchEngine.GOOGLE).sitemapUrl("customsitemap.xml").build()); Mockito.verify(httpClientMock).get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.example.com%2Fcustomsitemap.xml"); } @Test void testPingGoogleSuccess3() throws Exception { HttpClient httpClientMock = Mockito.mock(HttpClient.class); SitemapGenerator sitemapGenerator = SitemapGenerator.of("https://www.example.com/"); sitemapGenerator.setHttpClient(httpClientMock); Mockito.when(httpClientMock.get(Mockito.anyString())) .thenReturn(500); Mockito.when(httpClientMock.get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.customdomain.com%2Fcustomsitemap.xml")) .thenReturn(200); sitemapGenerator.ping(Ping.builder().engines(Ping.SearchEngine.GOOGLE).sitemapUrl("https://www.customdomain.com/customsitemap.xml").build()); Mockito.verify(httpClientMock).get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.customdomain.com%2Fcustomsitemap.xml"); } @Test void testPingGoogleError1() {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // // Path: src/test/java/cz/jiripinkas/jsitemapgenerator/util/TestUtil.java // public class TestUtil { // // public static void testSitemapXsd(InputStream sitemapXml, File xsd) throws SAXException, IOException { // Source xmlFile = new StreamSource(sitemapXml); // SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); // Schema schema = schemaFactory.newSchema(xsd); // Validator validator = schema.newValidator(); // validator.validate(xmlFile); // } // // public static void testSitemapXsdFile(File file, File xsd) throws IOException, SAXException { // try (FileInputStream inputStream = new FileInputStream(file)) { // testSitemapXsd(inputStream, xsd); // } // } // // } // Path: src/test/java/cz/jiripinkas/jsitemapgenerator/generator/SitemapGeneratorTest.java import cz.jiripinkas.jsitemapgenerator.*; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import cz.jiripinkas.jsitemapgenerator.util.TestUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.io.ByteArrayInputStream; import java.io.File; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import static org.junit.jupiter.api.Assertions.*; } @Test void testPingGoogleSuccess2() throws Exception { HttpClient httpClientMock = Mockito.mock(HttpClient.class); SitemapGenerator sitemapGenerator = SitemapGenerator.of("https://www.example.com/"); sitemapGenerator.setHttpClient(httpClientMock); Mockito.when(httpClientMock.get(Mockito.anyString())) .thenReturn(500); Mockito.when(httpClientMock.get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.example.com%2Fcustomsitemap.xml")) .thenReturn(200); sitemapGenerator.ping(Ping.builder().engines(Ping.SearchEngine.GOOGLE).sitemapUrl("customsitemap.xml").build()); Mockito.verify(httpClientMock).get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.example.com%2Fcustomsitemap.xml"); } @Test void testPingGoogleSuccess3() throws Exception { HttpClient httpClientMock = Mockito.mock(HttpClient.class); SitemapGenerator sitemapGenerator = SitemapGenerator.of("https://www.example.com/"); sitemapGenerator.setHttpClient(httpClientMock); Mockito.when(httpClientMock.get(Mockito.anyString())) .thenReturn(500); Mockito.when(httpClientMock.get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.customdomain.com%2Fcustomsitemap.xml")) .thenReturn(200); sitemapGenerator.ping(Ping.builder().engines(Ping.SearchEngine.GOOGLE).sitemapUrl("https://www.customdomain.com/customsitemap.xml").build()); Mockito.verify(httpClientMock).get("https://www.google.com/ping?sitemap=https%3A%2F%2Fwww.customdomain.com%2Fcustomsitemap.xml"); } @Test void testPingGoogleError1() {
assertThrows(WebmasterToolsException.class, () -> {
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // }
import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Date; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream;
try { httpResponse = execute.invoke(ping.getHttpClientImplementation(), httpGet); Method getEntity = Class.forName("org.apache.http.HttpResponse").getMethod("getEntity"); Object httpEntity = getEntity.invoke(httpResponse); Method consume = Class.forName("org.apache.http.util.EntityUtils").getMethod("consume", Class.forName("org.apache.http.HttpEntity")); consume.invoke(null, httpEntity); Object getStatusLine = Class.forName("org.apache.http.HttpResponse").getMethod("getStatusLine").invoke(httpResponse); int getStatusCode = (Integer) Class.forName("org.apache.http.StatusLine").getMethod("getStatusCode").invoke(getStatusLine); if(getStatusCode != 200) { responseIsNot200 = true; } } finally { if(httpResponse != null) { Class.forName("java.io.Closeable").getMethod("close").invoke(httpResponse); } } // same code without reflection // org.apache.http.impl.client.CloseableHttpClient closeableHttpClient = (org.apache.http.impl.client.CloseableHttpClient) ping.getHttpClientImplementation(); // org.apache.http.client.methods.HttpGet httpGet = new org.apache.http.client.methods.HttpGet(pingUrl); // try (org.apache.http.client.methods.CloseableHttpResponse httpResponse = closeableHttpClient.execute(httpGet)) { // org.apache.http.HttpEntity httpEntity = httpResponse.getEntity(); // org.apache.http.util.EntityUtils.consume(httpEntity); // if(httpResponse.getStatusLine().getStatusCode() != 200) { // responseIsNot200 = true; // } // } } else { throw new UnsupportedOperationException("Unknown HttpClientType!"); } if(responseIsNot200) {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Date; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream; try { httpResponse = execute.invoke(ping.getHttpClientImplementation(), httpGet); Method getEntity = Class.forName("org.apache.http.HttpResponse").getMethod("getEntity"); Object httpEntity = getEntity.invoke(httpResponse); Method consume = Class.forName("org.apache.http.util.EntityUtils").getMethod("consume", Class.forName("org.apache.http.HttpEntity")); consume.invoke(null, httpEntity); Object getStatusLine = Class.forName("org.apache.http.HttpResponse").getMethod("getStatusLine").invoke(httpResponse); int getStatusCode = (Integer) Class.forName("org.apache.http.StatusLine").getMethod("getStatusCode").invoke(getStatusLine); if(getStatusCode != 200) { responseIsNot200 = true; } } finally { if(httpResponse != null) { Class.forName("java.io.Closeable").getMethod("close").invoke(httpResponse); } } // same code without reflection // org.apache.http.impl.client.CloseableHttpClient closeableHttpClient = (org.apache.http.impl.client.CloseableHttpClient) ping.getHttpClientImplementation(); // org.apache.http.client.methods.HttpGet httpGet = new org.apache.http.client.methods.HttpGet(pingUrl); // try (org.apache.http.client.methods.CloseableHttpResponse httpResponse = closeableHttpClient.execute(httpGet)) { // org.apache.http.HttpEntity httpEntity = httpResponse.getEntity(); // org.apache.http.util.EntityUtils.consume(httpEntity); // if(httpResponse.getStatusLine().getStatusCode() != 200) { // responseIsNot200 = true; // } // } } else { throw new UnsupportedOperationException("Unknown HttpClientType!"); } if(responseIsNot200) {
throw new WebmasterToolsException(searchEngine.getPrettyName() + " could not be informed about new sitemap! Return code != 200");
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // }
import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Date; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream;
} /** * Reset default extension value * * @return this */ public T resetDefaultExtension() { defaultExtension = null; return getThis(); } /** * Sets default priority for all subsequent WebPages to maximum (1.0) * * @return this */ public T defaultPriorityMax() { defaultPriority = 1.0; return getThis(); } /** * Sets default priority for all subsequent WebPages * * @param priority Default priority * @return this */ public T defaultPriority(Double priority) { if (priority < 0.0 || priority > 1.0) {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Date; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream; } /** * Reset default extension value * * @return this */ public T resetDefaultExtension() { defaultExtension = null; return getThis(); } /** * Sets default priority for all subsequent WebPages to maximum (1.0) * * @return this */ public T defaultPriorityMax() { defaultPriority = 1.0; return getThis(); } /** * Sets default priority for all subsequent WebPages * * @param priority Default priority * @return this */ public T defaultPriority(Double priority) { if (priority < 0.0 || priority > 1.0) {
throw new InvalidPriorityException("Priority must be between 0 and 1.0");
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // }
import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Date; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream;
* If webPageName is null, return baseUrl. * If webPageName is not null, check if webPageName is absolute (can be URL from CDN) or relative URL. * If it's relative URL, prepend baseUrl and return result * * @param webPageName WebPageName * @param escapeSpecialCharacters Escape special characters? * Special characters must be escaped if the URL will be stored to sitemap. * If this method is called for ping Google / Bing functionality, special characters must not be escaped. * @return Correct URL */ protected String getAbsoluteUrl(String webPageName, boolean escapeSpecialCharacters) { if(escapeSpecialCharacters) { webPageName = UrlUtil.escapeXmlSpecialCharacters(webPageName); } try { String resultString; if (webPageName != null) { URI uri = new URI(webPageName); String stringUrl; if (uri.isAbsolute()) { stringUrl = webPageName; } else { stringUrl = UrlUtil.connectUrlParts(baseUrl, webPageName); } resultString = stringUrl; } else { resultString = baseUrl; } return new URL(resultString).toString(); } catch (MalformedURLException | URISyntaxException e) {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/WebmasterToolsException.java // public class WebmasterToolsException extends RuntimeException { // // public WebmasterToolsException(String message, Throwable ex) { // super(message, ex); // } // // public WebmasterToolsException(String message) { // super(message); // } // // public WebmasterToolsException(Throwable cause) { // super(cause); // } // } // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import cz.jiripinkas.jsitemapgenerator.exception.WebmasterToolsException; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.Date; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.zip.GZIPOutputStream; * If webPageName is null, return baseUrl. * If webPageName is not null, check if webPageName is absolute (can be URL from CDN) or relative URL. * If it's relative URL, prepend baseUrl and return result * * @param webPageName WebPageName * @param escapeSpecialCharacters Escape special characters? * Special characters must be escaped if the URL will be stored to sitemap. * If this method is called for ping Google / Bing functionality, special characters must not be escaped. * @return Correct URL */ protected String getAbsoluteUrl(String webPageName, boolean escapeSpecialCharacters) { if(escapeSpecialCharacters) { webPageName = UrlUtil.escapeXmlSpecialCharacters(webPageName); } try { String resultString; if (webPageName != null) { URI uri = new URI(webPageName); String stringUrl; if (uri.isAbsolute()) { stringUrl = webPageName; } else { stringUrl = UrlUtil.connectUrlParts(baseUrl, webPageName); } resultString = stringUrl; } else { resultString = baseUrl; } return new URL(resultString).toString(); } catch (MalformedURLException | URISyntaxException e) {
throw new InvalidUrlException(e);
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractGenerator.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // }
import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import java.io.ByteArrayInputStream; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Map; import java.util.TreeMap; import java.util.function.Function; import java.util.function.Supplier;
package cz.jiripinkas.jsitemapgenerator; /** * Abstract Generator * * @param <I> Concrete implementation of AbstractGenerator, for example SitemapGenerator */ public abstract class AbstractGenerator<I extends AbstractGenerator> { protected Map<String, WebPage> urls = new TreeMap<>(); protected String baseUrl; /** * Construct web sitemap. * * @param baseUrl All URLs must start with this baseUrl, for example * http://www.javavids.com * @param root If Base URL is root (for example http://www.javavids.com or if * it's some path like http://www.javalibs.com/blog) */ public AbstractGenerator(String baseUrl, boolean root) { try { new URL(baseUrl); } catch (MalformedURLException e) {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidUrlException.java // public class InvalidUrlException extends RuntimeException { // // public InvalidUrlException(Throwable cause) { // super(cause); // } // // } // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractGenerator.java import cz.jiripinkas.jsitemapgenerator.exception.InvalidUrlException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import java.io.ByteArrayInputStream; import java.io.StringWriter; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Map; import java.util.TreeMap; import java.util.function.Function; import java.util.function.Supplier; package cz.jiripinkas.jsitemapgenerator; /** * Abstract Generator * * @param <I> Concrete implementation of AbstractGenerator, for example SitemapGenerator */ public abstract class AbstractGenerator<I extends AbstractGenerator> { protected Map<String, WebPage> urls = new TreeMap<>(); protected String baseUrl; /** * Construct web sitemap. * * @param baseUrl All URLs must start with this baseUrl, for example * http://www.javavids.com * @param root If Base URL is root (for example http://www.javavids.com or if * it's some path like http://www.javalibs.com/blog) */ public AbstractGenerator(String baseUrl, boolean root) { try { new URL(baseUrl); } catch (MalformedURLException e) {
throw new InvalidUrlException(e);
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/WebPage.java
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // }
import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.*; import java.util.function.Supplier;
public void setShortName(String shortName) { this.shortName = shortName; } public String getShortDescription() { return shortDescription; } public void setShortDescription(String shortDescription) { this.shortDescription = shortDescription; } public void setName(String name) { this.name = name; } public void setAlternateNames(Map<String, String> alternateNames) { this.alternateNames = alternateNames; } public void setLastMod(Date lastMod) { this.lastMod = lastMod; } public void setChangeFreq(ChangeFreq changeFreq) { this.changeFreq = changeFreq; } public void setPriority(Double priority) { if (priority < MIN_PRIORITY || priority > MAX_PRIORITY) {
// Path: src/main/java/cz/jiripinkas/jsitemapgenerator/exception/InvalidPriorityException.java // public class InvalidPriorityException extends RuntimeException { // // public InvalidPriorityException(String message) { // super(message); // } // } // Path: src/main/java/cz/jiripinkas/jsitemapgenerator/WebPage.java import cz.jiripinkas.jsitemapgenerator.exception.InvalidPriorityException; import java.sql.Timestamp; import java.time.LocalDateTime; import java.util.*; import java.util.function.Supplier; public void setShortName(String shortName) { this.shortName = shortName; } public String getShortDescription() { return shortDescription; } public void setShortDescription(String shortDescription) { this.shortDescription = shortDescription; } public void setName(String name) { this.name = name; } public void setAlternateNames(Map<String, String> alternateNames) { this.alternateNames = alternateNames; } public void setLastMod(Date lastMod) { this.lastMod = lastMod; } public void setChangeFreq(ChangeFreq changeFreq) { this.changeFreq = changeFreq; } public void setPriority(Double priority) { if (priority < MIN_PRIORITY || priority > MAX_PRIORITY) {
throw new InvalidPriorityException("Priority must be between " + MIN_PRIORITY + " and " + MAX_PRIORITY);
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/DownstreamCounterForCorrelation.java
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // }
import org.panda.causalpath.network.Relation; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.stream.Collectors;
package org.panda.causalpath.analyzer; /** * This class is for counting significant correlations at the downstream of a protein. * * @author Ozgun Babur */ public class DownstreamCounterForCorrelation { CausalitySearcher cs; public DownstreamCounterForCorrelation(CausalitySearcher cs) { this.cs = cs; }
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/DownstreamCounterForCorrelation.java import org.panda.causalpath.network.Relation; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; package org.panda.causalpath.analyzer; /** * This class is for counting significant correlations at the downstream of a protein. * * @author Ozgun Babur */ public class DownstreamCounterForCorrelation { CausalitySearcher cs; public DownstreamCounterForCorrelation(CausalitySearcher cs) { this.cs = cs; }
public Map<String, Integer>[] run(Set<Relation> relations)
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/CausalityHelper.java
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // }
import org.panda.causalpath.data.ExperimentData;
package org.panda.causalpath.analyzer; /** * This two-data change detector checks if the data changed in similar (1) or opposite (-1) directions. 0 means at least * one data is not changed. This class helps causality detection when controls and tests are compared. */ public class CausalityHelper implements TwoDataChangeDetector { @Override
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/CausalityHelper.java import org.panda.causalpath.data.ExperimentData; package org.panda.causalpath.analyzer; /** * This two-data change detector checks if the data changed in similar (1) or opposite (-1) directions. 0 means at least * one data is not changed. This class helps causality detection when controls and tests are compared. */ public class CausalityHelper implements TwoDataChangeDetector { @Override
public int getChangeSign(ExperimentData data1, ExperimentData data2)
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/OneDataChangeDetector.java
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // }
import org.panda.causalpath.data.ExperimentData;
package org.panda.causalpath.analyzer; /** * Detects a change in an experiment data. */ public interface OneDataChangeDetector extends Cloneable { /** * Returns 1 if the change is positive, -1 if the change is negative, 0 if the change is insignificant (not * detected). */
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/OneDataChangeDetector.java import org.panda.causalpath.data.ExperimentData; package org.panda.causalpath.analyzer; /** * Detects a change in an experiment data. */ public interface OneDataChangeDetector extends Cloneable { /** * Returns 1 if the change is positive, -1 if the change is negative, 0 if the change is insignificant (not * detected). */
int getChangeSign(ExperimentData data);
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/TwoDataChangeDetector.java
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // }
import org.panda.causalpath.data.ExperimentData;
package org.panda.causalpath.analyzer; /** * Detects a change in a pair of experiment data. */ public interface TwoDataChangeDetector { /** * 1: Ends change in the same direction * -1: Ends change in opposite directions * 0: At least one end did not change */
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/TwoDataChangeDetector.java import org.panda.causalpath.data.ExperimentData; package org.panda.causalpath.analyzer; /** * Detects a change in a pair of experiment data. */ public interface TwoDataChangeDetector { /** * 1: Ends change in the same direction * -1: Ends change in opposite directions * 0: At least one end did not change */
int getChangeSign(ExperimentData data1, ExperimentData data2);
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/DataLabelShuffler.java
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // }
import org.panda.causalpath.data.*; import org.panda.causalpath.network.Relation; import java.util.*; import java.util.stream.Collectors;
package org.panda.causalpath.analyzer; /** * This class is for shuffling the rows of the data. It first converts data in simpler format, then provides shuffling * multiple times. Does not support correlation-based runs. * * @author Ozgun Babur */ public class DataLabelShuffler {
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/DataLabelShuffler.java import org.panda.causalpath.data.*; import org.panda.causalpath.network.Relation; import java.util.*; import java.util.stream.Collectors; package org.panda.causalpath.analyzer; /** * This class is for shuffling the rows of the data. It first converts data in simpler format, then provides shuffling * multiple times. Does not support correlation-based runs. * * @author Ozgun Babur */ public class DataLabelShuffler {
Set<Relation> relations;
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/NSCForCorrelation.java
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // }
import org.panda.causalpath.network.Relation; import org.panda.utility.ArrayUtil; import org.panda.utility.FileUtil; import org.panda.utility.Progress; import org.panda.utility.statistics.FDR; import org.panda.utility.statistics.KernelDensityPlot; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set;
package org.panda.causalpath.analyzer; /** * Calculates the significance of several things in the result network. These are the size of the network overall, and * the significance of downstream correlation frequency at the downstream of proteins. * * @author Ozgun Babur */ public class NSCForCorrelation extends NetworkSignificanceCalculator { /** * The result maps that indicate p-values for a node downstream composition. */ Map<String, Double> pvals; /** * If this parameter is set, this class can record the null distribution of network sizes. */ private String fileToWriteNullDistVals; /** * Constructor with the network. */
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/NSCForCorrelation.java import org.panda.causalpath.network.Relation; import org.panda.utility.ArrayUtil; import org.panda.utility.FileUtil; import org.panda.utility.Progress; import org.panda.utility.statistics.FDR; import org.panda.utility.statistics.KernelDensityPlot; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; package org.panda.causalpath.analyzer; /** * Calculates the significance of several things in the result network. These are the size of the network overall, and * the significance of downstream correlation frequency at the downstream of proteins. * * @author Ozgun Babur */ public class NSCForCorrelation extends NetworkSignificanceCalculator { /** * The result maps that indicate p-values for a node downstream composition. */ Map<String, Double> pvals; /** * If this parameter is set, this class can record the null distribution of network sizes. */ private String fileToWriteNullDistVals; /** * Constructor with the network. */
public NSCForCorrelation(Set<Relation> relations, CausalitySearcher cs)
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/data/ExperimentData.java
// Path: src/main/java/org/panda/causalpath/analyzer/OneDataChangeDetector.java // public interface OneDataChangeDetector extends Cloneable // { // /** // * Returns 1 if the change is positive, -1 if the change is negative, 0 if the change is insignificant (not // * detected). // */ // int getChangeSign(ExperimentData data); // // /** // * Gets the numerical value of the change. // */ // double getChangeValue(ExperimentData data); // // OneDataChangeDetector makeACopy(); // }
import org.panda.causalpath.analyzer.OneDataChangeDetector; import java.util.Collections; import java.util.HashSet; import java.util.Set;
package org.panda.causalpath.data; /** * Base class for a series of experiment data for a gene. */ public abstract class ExperimentData { /** * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a * mutation, or an identifier for a mass spectometry peak. */ public String id; /** * List of gene symbols that the measurement applies. */ protected Set<String> geneSymbols; /** * How does a positive value in this experiment data affects the gene's activity? Only negative example is * methylation so far. */ public int getEffect() { return 1; } /** * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, * or can decide based on a threshold, etc. */
// Path: src/main/java/org/panda/causalpath/analyzer/OneDataChangeDetector.java // public interface OneDataChangeDetector extends Cloneable // { // /** // * Returns 1 if the change is positive, -1 if the change is negative, 0 if the change is insignificant (not // * detected). // */ // int getChangeSign(ExperimentData data); // // /** // * Gets the numerical value of the change. // */ // double getChangeValue(ExperimentData data); // // OneDataChangeDetector makeACopy(); // } // Path: src/main/java/org/panda/causalpath/data/ExperimentData.java import org.panda.causalpath.analyzer.OneDataChangeDetector; import java.util.Collections; import java.util.HashSet; import java.util.Set; package org.panda.causalpath.data; /** * Base class for a series of experiment data for a gene. */ public abstract class ExperimentData { /** * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a * mutation, or an identifier for a mass spectometry peak. */ public String id; /** * List of gene symbols that the measurement applies. */ protected Set<String> geneSymbols; /** * How does a positive value in this experiment data affects the gene's activity? Only negative example is * methylation so far. */ public int getEffect() { return 1; } /** * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, * or can decide based on a threshold, etc. */
protected OneDataChangeDetector chDet;
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/ThresholdDetector.java
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // // Path: src/main/java/org/panda/causalpath/data/CategoricalData.java // public abstract class CategoricalData extends ExperimentData // { // public SingleCategoricalData[] data; // // public CategoricalData(String id, String symbol) // { // super(id, symbol); // } // // public CategoricalData(String id, Set<String> symbols) // { // super(id, symbols); // } // // /** // * Sometimes we need the data array to be less structured for practical purposes. This method represents the // * category array as an integer array. // */ // public int[] getCategories() // { // int[] c = new int[data.length]; // // for (int i = 0; i < c.length; i++) // { // c[i] = data[i].getCategory(); // } // // return c; // } // // public int getNumberOfCategories() // { // return (int) IntStream.of(getCategories()).distinct().count(); // } // // /** // * Method getting the category array as parameter for efficiency purposes. // */ // public int getNumberOfCategories(int[] cat) // { // return (int) IntStream.of(cat).distinct().count(); // } // }
import org.panda.causalpath.data.ExperimentData; import org.panda.causalpath.data.NumericData; import org.panda.causalpath.data.CategoricalData; import org.panda.utility.ArrayUtil;
package org.panda.causalpath.analyzer; /** * Detects a change if the absolute of mean value is over the threshold. */ public class ThresholdDetector implements OneDataChangeDetector { /** * Threshold to use. */ protected double threshold; /** * Method to reduce multiple values into one value. */ AveragingMethod avgMet; public ThresholdDetector(double threshold) { this.threshold = threshold; } public ThresholdDetector(double threshold, AveragingMethod avgMet) { this.threshold = threshold; this.avgMet = avgMet; } public void setAveragingMethod(AveragingMethod method) { this.avgMet = method; } public void setThreshold(double threshold) { this.threshold = threshold; } @Override
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // // Path: src/main/java/org/panda/causalpath/data/CategoricalData.java // public abstract class CategoricalData extends ExperimentData // { // public SingleCategoricalData[] data; // // public CategoricalData(String id, String symbol) // { // super(id, symbol); // } // // public CategoricalData(String id, Set<String> symbols) // { // super(id, symbols); // } // // /** // * Sometimes we need the data array to be less structured for practical purposes. This method represents the // * category array as an integer array. // */ // public int[] getCategories() // { // int[] c = new int[data.length]; // // for (int i = 0; i < c.length; i++) // { // c[i] = data[i].getCategory(); // } // // return c; // } // // public int getNumberOfCategories() // { // return (int) IntStream.of(getCategories()).distinct().count(); // } // // /** // * Method getting the category array as parameter for efficiency purposes. // */ // public int getNumberOfCategories(int[] cat) // { // return (int) IntStream.of(cat).distinct().count(); // } // } // Path: src/main/java/org/panda/causalpath/analyzer/ThresholdDetector.java import org.panda.causalpath.data.ExperimentData; import org.panda.causalpath.data.NumericData; import org.panda.causalpath.data.CategoricalData; import org.panda.utility.ArrayUtil; package org.panda.causalpath.analyzer; /** * Detects a change if the absolute of mean value is over the threshold. */ public class ThresholdDetector implements OneDataChangeDetector { /** * Threshold to use. */ protected double threshold; /** * Method to reduce multiple values into one value. */ AveragingMethod avgMet; public ThresholdDetector(double threshold) { this.threshold = threshold; } public ThresholdDetector(double threshold, AveragingMethod avgMet) { this.threshold = threshold; this.avgMet = avgMet; } public void setAveragingMethod(AveragingMethod method) { this.avgMet = method; } public void setThreshold(double threshold) { this.threshold = threshold; } @Override
public int getChangeSign(ExperimentData data)
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/ThresholdDetector.java
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // // Path: src/main/java/org/panda/causalpath/data/CategoricalData.java // public abstract class CategoricalData extends ExperimentData // { // public SingleCategoricalData[] data; // // public CategoricalData(String id, String symbol) // { // super(id, symbol); // } // // public CategoricalData(String id, Set<String> symbols) // { // super(id, symbols); // } // // /** // * Sometimes we need the data array to be less structured for practical purposes. This method represents the // * category array as an integer array. // */ // public int[] getCategories() // { // int[] c = new int[data.length]; // // for (int i = 0; i < c.length; i++) // { // c[i] = data[i].getCategory(); // } // // return c; // } // // public int getNumberOfCategories() // { // return (int) IntStream.of(getCategories()).distinct().count(); // } // // /** // * Method getting the category array as parameter for efficiency purposes. // */ // public int getNumberOfCategories(int[] cat) // { // return (int) IntStream.of(cat).distinct().count(); // } // }
import org.panda.causalpath.data.ExperimentData; import org.panda.causalpath.data.NumericData; import org.panda.causalpath.data.CategoricalData; import org.panda.utility.ArrayUtil;
{ this.avgMet = method; } public void setThreshold(double threshold) { this.threshold = threshold; } @Override public int getChangeSign(ExperimentData data) { double v = getChangeValue(data); if (Math.abs(v) >= threshold) return v > 0 ? 1 : -1; else return 0; } public double getChangeValue(ExperimentData data) { if (data instanceof NumericData) { NumericData nd = (NumericData) data; switch (avgMet) { case FIRST_VALUE: return nd.vals[0]; case ARITHMETIC_MEAN: return ArrayUtil.mean(nd.vals); case FOLD_CHANGE_MEAN: return foldChangeGeometricMean(nd.vals); case MAX: return maxOfAbs(nd.vals); } }
// Path: src/main/java/org/panda/causalpath/data/ExperimentData.java // public abstract class ExperimentData // { // /** // * ID of the measurement. This can be an identifier of the antibody in an RPPA experiment, or gene symbol for a // * mutation, or an identifier for a mass spectometry peak. // */ // public String id; // // /** // * List of gene symbols that the measurement applies. // */ // protected Set<String> geneSymbols; // // /** // * How does a positive value in this experiment data affects the gene's activity? Only negative example is // * methylation so far. // */ // public int getEffect() // { // return 1; // } // // /** // * A plug-in detector for the change in the experiment data. This detector may compare a test and a control group, // * or can decide based on a threshold, etc. // */ // protected OneDataChangeDetector chDet; // // /** // * Repeat of the same experiments, if available. // */ // protected Set<ExperimentData> repeatData; // // public ExperimentData(String id, Set<String> geneSymbols) // { // this.id = id; // this.geneSymbols = geneSymbols; // } // // public ExperimentData(String id, String geneSymbol) // { // this(id, Collections.singleton(geneSymbol)); // } // // public int getChangeSign() // { // if (chDet == null) // { // throw new RuntimeException("getChangeSign can be called only after setting the change detector."); // } // // return chDet.getChangeSign(this); // } // // public double getChangeValue() // { // if (chDet == null) // { // throw new RuntimeException("getChangeValue can be called only after setting the change detector."); // } // // return chDet.getChangeValue(this); // } // // public Set<String> getGeneSymbols() // { // return geneSymbols; // } // // public void setChDet(OneDataChangeDetector chDet) // { // this.chDet = chDet; // } // // public OneDataChangeDetector getChDet() // { // return chDet; // } // // public String getId() // { // return id; // } // // public boolean hasChangeDetector() // { // return this.chDet != null; // } // // @Override // public int hashCode() // { // return id.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof ExperimentData && ((ExperimentData) obj).id.equals(id); // } // // /** // * An experiment data is not site specific by default. // */ // public boolean isSiteSpecific() // { // return false; // } // // /** // * Generates a copy of the object. // */ // public abstract ExperimentData copy(); // // public abstract DataType getType(); // // @Override // public String toString() // { // return id; // } // // public void addRepeatData(ExperimentData data) // { // if (this.repeatData == null) this.repeatData = new HashSet<>(); // this.repeatData.add(data); // } // // public boolean hasRepeatData() // { // return this.repeatData != null && !this.repeatData.isEmpty(); // } // // public Set<ExperimentData> getRepeatData() // { // return repeatData; // } // } // // Path: src/main/java/org/panda/causalpath/data/CategoricalData.java // public abstract class CategoricalData extends ExperimentData // { // public SingleCategoricalData[] data; // // public CategoricalData(String id, String symbol) // { // super(id, symbol); // } // // public CategoricalData(String id, Set<String> symbols) // { // super(id, symbols); // } // // /** // * Sometimes we need the data array to be less structured for practical purposes. This method represents the // * category array as an integer array. // */ // public int[] getCategories() // { // int[] c = new int[data.length]; // // for (int i = 0; i < c.length; i++) // { // c[i] = data[i].getCategory(); // } // // return c; // } // // public int getNumberOfCategories() // { // return (int) IntStream.of(getCategories()).distinct().count(); // } // // /** // * Method getting the category array as parameter for efficiency purposes. // */ // public int getNumberOfCategories(int[] cat) // { // return (int) IntStream.of(cat).distinct().count(); // } // } // Path: src/main/java/org/panda/causalpath/analyzer/ThresholdDetector.java import org.panda.causalpath.data.ExperimentData; import org.panda.causalpath.data.NumericData; import org.panda.causalpath.data.CategoricalData; import org.panda.utility.ArrayUtil; { this.avgMet = method; } public void setThreshold(double threshold) { this.threshold = threshold; } @Override public int getChangeSign(ExperimentData data) { double v = getChangeValue(data); if (Math.abs(v) >= threshold) return v > 0 ? 1 : -1; else return 0; } public double getChangeValue(ExperimentData data) { if (data instanceof NumericData) { NumericData nd = (NumericData) data; switch (avgMet) { case FIRST_VALUE: return nd.vals[0]; case ARITHMETIC_MEAN: return ArrayUtil.mean(nd.vals); case FOLD_CHANGE_MEAN: return foldChangeGeometricMean(nd.vals); case MAX: return maxOfAbs(nd.vals); } }
else if (data instanceof CategoricalData)
PathwayAndDataAnalysis/causalpath
src/main/java/org/panda/causalpath/analyzer/NSCForComparison.java
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // }
import org.panda.causalpath.network.Relation; import org.panda.utility.ArrayUtil; import org.panda.utility.FileUtil; import org.panda.utility.Progress; import org.panda.utility.statistics.FDR; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream;
package org.panda.causalpath.analyzer; /** * Calculates the significance of several things in the result network. These are the size of the network overall, the * significance of downstream change frequency at the downstream of proteins, and the significance of downstream * evidence for activation/inactivation of the protein. * * @author Ozgun Babur */ public class NSCForComparison extends NetworkSignificanceCalculator { /** * The result maps that indicate p-values for a node downstream composition. */ Map<String, Double>[] pvalMaps; protected double[] significanceThreshold; /** * Constructor with required objects. * @param relations set of relations to process * @param cs the configured causality searcher */
// Path: src/main/java/org/panda/causalpath/network/Relation.java // public class Relation // { // /** // * Source gene. // */ // public String source; // // /** // * Target gene. // */ // public String target; // // /** // * The type of the relation. // */ // public RelationType type; // // /** // * Set of experiment data associated with source gene. // */ // public GeneWithData sourceData; // // /** // * Set of experiment data associated with target gene. // */ // public GeneWithData targetData; // // /** // * Pathway Commons IDs of the mediator objects for the relation. // */ // private String mediators; // // /** // * A change detector that can evaluate pairs of experiment data to see if this relation can explain the causality // * between them. // */ // public TwoDataChangeDetector chDet; // // /** // * Sites for the target. Needed when the relation is a phosphorylation or dephosphorylation. // */ // public Set<ProteinSite> sites; // // /** // * For performance reasons. This design assumes the proximityThreshold will not change during execution of the // * program. // */ // private Set<String> targetWithSites; // // public Relation(String source, String target, RelationType type, String mediators) // { // this.source = source; // this.target = target; // this.type = type; // this.mediators = mediators; // } // // public Relation(String line) // { // String[] token = line.split("\t"); // this.source = token[0]; // this.target = token[2]; // this.type = RelationType.getType(token[1]); // if (token.length > 3) this.mediators = token[3]; // if (token.length > 4) // { // sites = Arrays.stream(token[4].split(";")).map(s -> new ProteinSite(Integer.valueOf(s.substring(1)), // String.valueOf(s.charAt(0)), 0)).collect(Collectors.toSet()); // } // } // // /** // * Sign of the relation. // */ // public int getSign() // { // return type.sign; // } // // public String toString() // { // return source + "\t" + type.getName() + "\t" + target + "\t" + mediators + "\t" + getSitesInString(); // } // // public String getMediators() // { // return mediators; // } // // public Set<String> getTargetWithSites(int proximityThr) // { // if (targetWithSites == null) // { // targetWithSites = new HashSet<>(); // // if (sites != null) // { // for (ProteinSite site : sites) // { // for (int i = 0; i <= proximityThr; i++) // { // targetWithSites.add(target + "_" + (site.getSite() + i)); // targetWithSites.add(target + "_" + (site.getSite() - i)); // } // } // } // } // // return targetWithSites; // } // // public String getSitesInString() // { // return sites == null ? "" : CollectionUtil.merge(sites, ";"); // } // // public Set<ExperimentData> getAllData() // { // return CollectionUtil.getUnion(sourceData.getData(), targetData.getData()); // } // // public void setChDet(TwoDataChangeDetector chDet) // { // this.chDet = chDet; // } // // @Override // public int hashCode() // { // return source.hashCode() + target.hashCode() + type.hashCode(); // } // // @Override // public boolean equals(Object obj) // { // return obj instanceof Relation && ((Relation) obj).source.equals(source) && // ((Relation) obj).target.equals(target) && ((Relation) obj).type.equals(type); // } // // public Relation copy() // { // Relation cln = new Relation(source, target, type, mediators); // cln.sites = sites; // return cln; // } // } // Path: src/main/java/org/panda/causalpath/analyzer/NSCForComparison.java import org.panda.causalpath.network.Relation; import org.panda.utility.ArrayUtil; import org.panda.utility.FileUtil; import org.panda.utility.Progress; import org.panda.utility.statistics.FDR; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; package org.panda.causalpath.analyzer; /** * Calculates the significance of several things in the result network. These are the size of the network overall, the * significance of downstream change frequency at the downstream of proteins, and the significance of downstream * evidence for activation/inactivation of the protein. * * @author Ozgun Babur */ public class NSCForComparison extends NetworkSignificanceCalculator { /** * The result maps that indicate p-values for a node downstream composition. */ Map<String, Double>[] pvalMaps; protected double[] significanceThreshold; /** * Constructor with required objects. * @param relations set of relations to process * @param cs the configured causality searcher */
public NSCForComparison(Set<Relation> relations, CausalitySearcher cs)
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/Resource.java
// Path: src/main/java/com/myjeeva/digitalocean/common/ResourceType.java // public enum ResourceType { // @SerializedName("droplet") // DROPLET("droplet"), // // @SerializedName("volume") // VOLUME("volume"), // // @SerializedName("image") // IMAGE("image"), // // @SerializedName("backend") // BACKEND("backend"), // // @SerializedName("floating_ip") // FLOATING_IP("floating_ip"), // // @SerializedName("load_balancer") // LOAD_BALANCER("load_balancer"); // // private String value; // // private ResourceType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ResourceType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ResourceType rt : ResourceType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import com.myjeeva.digitalocean.common.ResourceType; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Resource represent a single resource for associating/disassociating with tag on DigitalOcean. * * @author Jeevanandam M. ([email protected]) * @since v2.5 */ public class Resource { @Expose @SerializedName("resource_id") private String id; @Expose @SerializedName("resource_type")
// Path: src/main/java/com/myjeeva/digitalocean/common/ResourceType.java // public enum ResourceType { // @SerializedName("droplet") // DROPLET("droplet"), // // @SerializedName("volume") // VOLUME("volume"), // // @SerializedName("image") // IMAGE("image"), // // @SerializedName("backend") // BACKEND("backend"), // // @SerializedName("floating_ip") // FLOATING_IP("floating_ip"), // // @SerializedName("load_balancer") // LOAD_BALANCER("load_balancer"); // // private String value; // // private ResourceType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ResourceType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ResourceType rt : ResourceType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/Resource.java import com.myjeeva.digitalocean.common.ResourceType; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Resource represent a single resource for associating/disassociating with tag on DigitalOcean. * * @author Jeevanandam M. ([email protected]) * @since v2.5 */ public class Resource { @Expose @SerializedName("resource_id") private String id; @Expose @SerializedName("resource_type")
private ResourceType type;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/ForwardingRules.java
// Path: src/main/java/com/myjeeva/digitalocean/common/Protocol.java // public enum Protocol { // @SerializedName("http") // HTTP("http"), // // @SerializedName("https") // HTTPS("https"), // // @SerializedName("tcp") // TCP("tcp"); // // private String value; // // private Protocol(String value) { // this.value = value; // } // // public static Protocol fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (Protocol ds : Protocol.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // }
import com.myjeeva.digitalocean.common.Protocol; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DigitalOcean Load Balancer forwarding rule object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class ForwardingRules extends Base { private static final long serialVersionUID = -442836096026412279L; @Expose @SerializedName("entry_protocol")
// Path: src/main/java/com/myjeeva/digitalocean/common/Protocol.java // public enum Protocol { // @SerializedName("http") // HTTP("http"), // // @SerializedName("https") // HTTPS("https"), // // @SerializedName("tcp") // TCP("tcp"); // // private String value; // // private Protocol(String value) { // this.value = value; // } // // public static Protocol fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (Protocol ds : Protocol.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/ForwardingRules.java import com.myjeeva.digitalocean.common.Protocol; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DigitalOcean Load Balancer forwarding rule object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class ForwardingRules extends Base { private static final long serialVersionUID = -442836096026412279L; @Expose @SerializedName("entry_protocol")
private Protocol entryProtocol;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/Project.java
// Path: src/main/java/com/myjeeva/digitalocean/common/Environment.java // public enum Environment { // @SerializedName("Development") // DEVELOPMENT("development"), // // @SerializedName("Staging") // STAGING("staging"), // // @SerializedName("Production") // PRODUCTION("production"); // // private String value; // // private Environment(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static Environment fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (Environment environment : Environment.values()) { // if (value.equalsIgnoreCase(environment.value)) { // return environment; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.Environment; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
package com.myjeeva.digitalocean.pojo; /** * Represents Project attributes of DigitalOcean. * * @author Thomas Crombez ([email protected]) */ public class Project extends Base { private static final long serialVersionUID = -594801578631188284L; private String id; @SerializedName("owner_uuid") private String ownerUuid; @SerializedName("owner_id") private String ownerId; @Expose private String name; @Expose private String description; @Expose private String purpose;
// Path: src/main/java/com/myjeeva/digitalocean/common/Environment.java // public enum Environment { // @SerializedName("Development") // DEVELOPMENT("development"), // // @SerializedName("Staging") // STAGING("staging"), // // @SerializedName("Production") // PRODUCTION("production"); // // private String value; // // private Environment(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static Environment fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (Environment environment : Environment.values()) { // if (value.equalsIgnoreCase(environment.value)) { // return environment; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/Project.java import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.Environment; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; package com.myjeeva.digitalocean.pojo; /** * Represents Project attributes of DigitalOcean. * * @author Thomas Crombez ([email protected]) */ public class Project extends Base { private static final long serialVersionUID = -594801578631188284L; private String id; @SerializedName("owner_uuid") private String ownerUuid; @SerializedName("owner_id") private String ownerId; @Expose private String name; @Expose private String description; @Expose private String purpose;
@Expose private Environment environment;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/LoadBalancer.java
// Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancerStatus.java // public enum LoadBalancerStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("active") // ACTIVE("active"), // // @SerializedName("errored") // ERRORED("errored"); // // private String value; // // private LoadBalancerStatus(String value) { // this.value = value; // } // // public static LoadBalancerStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancerStatus ds : LoadBalancerStatus.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancingAlgorithm.java // public enum LoadBalancingAlgorithm { // @SerializedName("round_robin") // ROUND_ROBIN("round_robin"), // // @SerializedName("least_connections") // LEAST_CONNECTIONS("least_connections"); // // private String value; // // private LoadBalancingAlgorithm(String value) { // this.value = value; // } // // public static LoadBalancingAlgorithm fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancingAlgorithm ds : LoadBalancingAlgorithm.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // }
import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.LoadBalancerStatus; import com.myjeeva.digitalocean.common.LoadBalancingAlgorithm; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Load Balancer object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class LoadBalancer extends Base { private static final long serialVersionUID = -442836096026412279L; private String id; @Expose private String name; private String ip;
// Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancerStatus.java // public enum LoadBalancerStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("active") // ACTIVE("active"), // // @SerializedName("errored") // ERRORED("errored"); // // private String value; // // private LoadBalancerStatus(String value) { // this.value = value; // } // // public static LoadBalancerStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancerStatus ds : LoadBalancerStatus.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancingAlgorithm.java // public enum LoadBalancingAlgorithm { // @SerializedName("round_robin") // ROUND_ROBIN("round_robin"), // // @SerializedName("least_connections") // LEAST_CONNECTIONS("least_connections"); // // private String value; // // private LoadBalancingAlgorithm(String value) { // this.value = value; // } // // public static LoadBalancingAlgorithm fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancingAlgorithm ds : LoadBalancingAlgorithm.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/LoadBalancer.java import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.LoadBalancerStatus; import com.myjeeva.digitalocean.common.LoadBalancingAlgorithm; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Load Balancer object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class LoadBalancer extends Base { private static final long serialVersionUID = -442836096026412279L; private String id; @Expose private String name; private String ip;
@Expose private LoadBalancingAlgorithm algorithm;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/LoadBalancer.java
// Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancerStatus.java // public enum LoadBalancerStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("active") // ACTIVE("active"), // // @SerializedName("errored") // ERRORED("errored"); // // private String value; // // private LoadBalancerStatus(String value) { // this.value = value; // } // // public static LoadBalancerStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancerStatus ds : LoadBalancerStatus.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancingAlgorithm.java // public enum LoadBalancingAlgorithm { // @SerializedName("round_robin") // ROUND_ROBIN("round_robin"), // // @SerializedName("least_connections") // LEAST_CONNECTIONS("least_connections"); // // private String value; // // private LoadBalancingAlgorithm(String value) { // this.value = value; // } // // public static LoadBalancingAlgorithm fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancingAlgorithm ds : LoadBalancingAlgorithm.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // }
import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.LoadBalancerStatus; import com.myjeeva.digitalocean.common.LoadBalancingAlgorithm; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Load Balancer object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class LoadBalancer extends Base { private static final long serialVersionUID = -442836096026412279L; private String id; @Expose private String name; private String ip; @Expose private LoadBalancingAlgorithm algorithm; private Region region;
// Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancerStatus.java // public enum LoadBalancerStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("active") // ACTIVE("active"), // // @SerializedName("errored") // ERRORED("errored"); // // private String value; // // private LoadBalancerStatus(String value) { // this.value = value; // } // // public static LoadBalancerStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancerStatus ds : LoadBalancerStatus.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/LoadBalancingAlgorithm.java // public enum LoadBalancingAlgorithm { // @SerializedName("round_robin") // ROUND_ROBIN("round_robin"), // // @SerializedName("least_connections") // LEAST_CONNECTIONS("least_connections"); // // private String value; // // private LoadBalancingAlgorithm(String value) { // this.value = value; // } // // public static LoadBalancingAlgorithm fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (LoadBalancingAlgorithm ds : LoadBalancingAlgorithm.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/LoadBalancer.java import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.LoadBalancerStatus; import com.myjeeva.digitalocean.common.LoadBalancingAlgorithm; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Load Balancer object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class LoadBalancer extends Base { private static final long serialVersionUID = -442836096026412279L; private String id; @Expose private String name; private String ip; @Expose private LoadBalancingAlgorithm algorithm; private Region region;
private LoadBalancerStatus status;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/Droplet.java
// Path: src/main/java/com/myjeeva/digitalocean/common/DropletStatus.java // public enum DropletStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("active") // ACTIVE("active"), // // @SerializedName("off") // OFF("off"), // // @SerializedName("archive") // ARCHIVE("archive"); // // private String value; // // private DropletStatus(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static DropletStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (DropletStatus ds : DropletStatus.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.DropletStatus; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Droplet attributes of DigitalOcean. Revised as per v2 API data structure. * * @author Jeevanandam M. ([email protected]) */ public class Droplet extends Base { private static final long serialVersionUID = 1110964622197874436L; private Integer id; private String name; private List<String> names; @SerializedName("memory") private Integer memorySizeInMb; @SerializedName("vcpus") private Integer virutalCpuCount; @SerializedName("disk") private Integer diskSize; private Region region; private Image image; @SerializedName("size_slug") private String size; private boolean locked;
// Path: src/main/java/com/myjeeva/digitalocean/common/DropletStatus.java // public enum DropletStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("active") // ACTIVE("active"), // // @SerializedName("off") // OFF("off"), // // @SerializedName("archive") // ARCHIVE("archive"); // // private String value; // // private DropletStatus(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static DropletStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (DropletStatus ds : DropletStatus.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/Droplet.java import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.DropletStatus; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Droplet attributes of DigitalOcean. Revised as per v2 API data structure. * * @author Jeevanandam M. ([email protected]) */ public class Droplet extends Base { private static final long serialVersionUID = 1110964622197874436L; private Integer id; private String name; private List<String> names; @SerializedName("memory") private Integer memorySizeInMb; @SerializedName("vcpus") private Integer virutalCpuCount; @SerializedName("disk") private Integer diskSize; private Region region; private Image image; @SerializedName("size_slug") private String size; private boolean locked;
private DropletStatus status;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/HealthCheck.java
// Path: src/main/java/com/myjeeva/digitalocean/common/Protocol.java // public enum Protocol { // @SerializedName("http") // HTTP("http"), // // @SerializedName("https") // HTTPS("https"), // // @SerializedName("tcp") // TCP("tcp"); // // private String value; // // private Protocol(String value) { // this.value = value; // } // // public static Protocol fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (Protocol ds : Protocol.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // }
import com.myjeeva.digitalocean.common.Protocol; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DigitalOcean Load Balancer health check object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class HealthCheck extends Base { private static final long serialVersionUID = -442836096026412279L;
// Path: src/main/java/com/myjeeva/digitalocean/common/Protocol.java // public enum Protocol { // @SerializedName("http") // HTTP("http"), // // @SerializedName("https") // HTTPS("https"), // // @SerializedName("tcp") // TCP("tcp"); // // private String value; // // private Protocol(String value) { // this.value = value; // } // // public static Protocol fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (Protocol ds : Protocol.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/HealthCheck.java import com.myjeeva.digitalocean.common.Protocol; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DigitalOcean Load Balancer health check object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class HealthCheck extends Base { private static final long serialVersionUID = -442836096026412279L;
@Expose private Protocol protocol;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/Image.java
// Path: src/main/java/com/myjeeva/digitalocean/common/ImageStatus.java // public enum ImageStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("available") // AVAILABLE("available"), // // @SerializedName("pending") // PENDING("pending"), // // @SerializedName("deleted") // DELETED("deleted"); // // private String value; // // private ImageStatus(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageStatus s : ImageStatus.values()) { // if (value.equalsIgnoreCase(s.value)) { // return s; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/ImageType.java // public enum ImageType { // @SerializedName("snapshot") // SNAPSHOT("snapshot"), // // @SerializedName("backup") // BACKUP("backup"), // // /** // * #89 - // * https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-custom-images-and-image-tagging/ // */ // @SerializedName("custom") // CUSTOM("custom"); // // private String value; // // private ImageType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageType rt : ImageType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.ImageStatus; import com.myjeeva.digitalocean.common.ImageType; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Droplet Image (also public images aka Distribution) attributes of DigitalOcean * (distribution, snapshots or backups). Revised as per v2 API data structure. * * @author Jeevanandam M. ([email protected]) */ public class Image extends Base { private static final long serialVersionUID = 1321111459154107563L; private Integer id; @Expose private String name; @Expose private String distribution; private String slug; @SerializedName("public") private boolean availablePublic; private List<String> regions; @SerializedName("created_at") private Date createdDate; @SerializedName("min_disk_size") private Integer minDiskSize; @SerializedName("size_gigabytes") private Double size;
// Path: src/main/java/com/myjeeva/digitalocean/common/ImageStatus.java // public enum ImageStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("available") // AVAILABLE("available"), // // @SerializedName("pending") // PENDING("pending"), // // @SerializedName("deleted") // DELETED("deleted"); // // private String value; // // private ImageStatus(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageStatus s : ImageStatus.values()) { // if (value.equalsIgnoreCase(s.value)) { // return s; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/ImageType.java // public enum ImageType { // @SerializedName("snapshot") // SNAPSHOT("snapshot"), // // @SerializedName("backup") // BACKUP("backup"), // // /** // * #89 - // * https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-custom-images-and-image-tagging/ // */ // @SerializedName("custom") // CUSTOM("custom"); // // private String value; // // private ImageType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageType rt : ImageType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/Image.java import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.ImageStatus; import com.myjeeva.digitalocean.common.ImageType; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Droplet Image (also public images aka Distribution) attributes of DigitalOcean * (distribution, snapshots or backups). Revised as per v2 API data structure. * * @author Jeevanandam M. ([email protected]) */ public class Image extends Base { private static final long serialVersionUID = 1321111459154107563L; private Integer id; @Expose private String name; @Expose private String distribution; private String slug; @SerializedName("public") private boolean availablePublic; private List<String> regions; @SerializedName("created_at") private Date createdDate; @SerializedName("min_disk_size") private Integer minDiskSize; @SerializedName("size_gigabytes") private Double size;
private ImageType type;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/Image.java
// Path: src/main/java/com/myjeeva/digitalocean/common/ImageStatus.java // public enum ImageStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("available") // AVAILABLE("available"), // // @SerializedName("pending") // PENDING("pending"), // // @SerializedName("deleted") // DELETED("deleted"); // // private String value; // // private ImageStatus(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageStatus s : ImageStatus.values()) { // if (value.equalsIgnoreCase(s.value)) { // return s; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/ImageType.java // public enum ImageType { // @SerializedName("snapshot") // SNAPSHOT("snapshot"), // // @SerializedName("backup") // BACKUP("backup"), // // /** // * #89 - // * https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-custom-images-and-image-tagging/ // */ // @SerializedName("custom") // CUSTOM("custom"); // // private String value; // // private ImageType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageType rt : ImageType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.ImageStatus; import com.myjeeva.digitalocean.common.ImageType; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Droplet Image (also public images aka Distribution) attributes of DigitalOcean * (distribution, snapshots or backups). Revised as per v2 API data structure. * * @author Jeevanandam M. ([email protected]) */ public class Image extends Base { private static final long serialVersionUID = 1321111459154107563L; private Integer id; @Expose private String name; @Expose private String distribution; private String slug; @SerializedName("public") private boolean availablePublic; private List<String> regions; @SerializedName("created_at") private Date createdDate; @SerializedName("min_disk_size") private Integer minDiskSize; @SerializedName("size_gigabytes") private Double size; private ImageType type; // #89 - start // https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-custom-images-and-image-tagging/ @Expose private String url; @Expose private String region; @Expose private String description; @Expose private List<String> tags;
// Path: src/main/java/com/myjeeva/digitalocean/common/ImageStatus.java // public enum ImageStatus { // @SerializedName("new") // NEW("new"), // // @SerializedName("available") // AVAILABLE("available"), // // @SerializedName("pending") // PENDING("pending"), // // @SerializedName("deleted") // DELETED("deleted"); // // private String value; // // private ImageStatus(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageStatus fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageStatus s : ImageStatus.values()) { // if (value.equalsIgnoreCase(s.value)) { // return s; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // // Path: src/main/java/com/myjeeva/digitalocean/common/ImageType.java // public enum ImageType { // @SerializedName("snapshot") // SNAPSHOT("snapshot"), // // @SerializedName("backup") // BACKUP("backup"), // // /** // * #89 - // * https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-custom-images-and-image-tagging/ // */ // @SerializedName("custom") // CUSTOM("custom"); // // private String value; // // private ImageType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static ImageType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (ImageType rt : ImageType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/Image.java import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.ImageStatus; import com.myjeeva.digitalocean.common.ImageType; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Droplet Image (also public images aka Distribution) attributes of DigitalOcean * (distribution, snapshots or backups). Revised as per v2 API data structure. * * @author Jeevanandam M. ([email protected]) */ public class Image extends Base { private static final long serialVersionUID = 1321111459154107563L; private Integer id; @Expose private String name; @Expose private String distribution; private String slug; @SerializedName("public") private boolean availablePublic; private List<String> regions; @SerializedName("created_at") private Date createdDate; @SerializedName("min_disk_size") private Integer minDiskSize; @SerializedName("size_gigabytes") private Double size; private ImageType type; // #89 - start // https://developers.digitalocean.com/documentation/changelog/api-v2/support-for-custom-images-and-image-tagging/ @Expose private String url; @Expose private String region; @Expose private String description; @Expose private List<String> tags;
private ImageStatus status;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/DomainRecord.java
// Path: src/main/java/com/myjeeva/digitalocean/common/CaaTagType.java // public enum CaaTagType { // @SerializedName("issue") // ISSUE("issue"), // // @SerializedName("issuewild") // ISSUE_WILD("issuewild"), // // @SerializedName("iodef") // IODEF("iodef"); // // private String value; // // private CaaTagType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static CaaTagType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (CaaTagType rt : CaaTagType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.myjeeva.digitalocean.common.CaaTagType;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DomainRecord (TLD) Record attributes of DigitalOcean DNS. Revised as per v2 API data * structure. * * @author Jeevanandam M. ([email protected]) */ public class DomainRecord extends Base { private static final long serialVersionUID = 5656335027984698525L; private Integer id; @Expose private String type; @Expose private String name; @Expose private String data; @Expose private Integer priority; @Expose private Integer port; @Expose private Integer weight; @Expose private Integer ttl; @Expose private Integer flags;
// Path: src/main/java/com/myjeeva/digitalocean/common/CaaTagType.java // public enum CaaTagType { // @SerializedName("issue") // ISSUE("issue"), // // @SerializedName("issuewild") // ISSUE_WILD("issuewild"), // // @SerializedName("iodef") // IODEF("iodef"); // // private String value; // // private CaaTagType(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static CaaTagType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (CaaTagType rt : CaaTagType.values()) { // if (value.equalsIgnoreCase(rt.value)) { // return rt; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/DomainRecord.java import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.myjeeva.digitalocean.common.CaaTagType; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DomainRecord (TLD) Record attributes of DigitalOcean DNS. Revised as per v2 API data * structure. * * @author Jeevanandam M. ([email protected]) */ public class DomainRecord extends Base { private static final long serialVersionUID = 5656335027984698525L; private Integer id; @Expose private String type; @Expose private String name; @Expose private String data; @Expose private Integer priority; @Expose private Integer port; @Expose private Integer weight; @Expose private Integer ttl; @Expose private Integer flags;
@Expose private CaaTagType tag;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/Certificate.java
// Path: src/main/java/com/myjeeva/digitalocean/common/CertificateState.java // public enum CertificateState { // @SerializedName("pending") // PENDING("pending"), // // @SerializedName("verified") // VERIFIED("verified"), // // @SerializedName("error") // ERROR("error"); // // private String value; // // private CertificateState(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static CertificateState fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (CertificateState cs : CertificateState.values()) { // if (value.equalsIgnoreCase(cs.value)) { // return cs; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // }
import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.CertificateState; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Certificate attributes * * @author Jeevanandam M. ([email protected]) * @since v2.12 */ public class Certificate extends Base { private static final long serialVersionUID = -7525532097995479493L; private String id; @Expose private String name; @SerializedName("not_after") private String notAfter; @SerializedName("sha1_fingerprint") private String sha1Fingerprint; @SerializedName("created_at") private Date createdDate; @Expose @SerializedName("private_key") private String privateKey; @Expose @SerializedName("leaf_certificate") private String leafCertificate; @Expose @SerializedName("certificate_chain") private String certificateChain;
// Path: src/main/java/com/myjeeva/digitalocean/common/CertificateState.java // public enum CertificateState { // @SerializedName("pending") // PENDING("pending"), // // @SerializedName("verified") // VERIFIED("verified"), // // @SerializedName("error") // ERROR("error"); // // private String value; // // private CertificateState(String value) { // this.value = value; // } // // @Override // public String toString() { // return this.value; // } // // public static CertificateState fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (CertificateState cs : CertificateState.values()) { // if (value.equalsIgnoreCase(cs.value)) { // return cs; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/Certificate.java import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.myjeeva.digitalocean.common.CertificateState; import java.util.Date; import java.util.List; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents Certificate attributes * * @author Jeevanandam M. ([email protected]) * @since v2.12 */ public class Certificate extends Base { private static final long serialVersionUID = -7525532097995479493L; private String id; @Expose private String name; @SerializedName("not_after") private String notAfter; @SerializedName("sha1_fingerprint") private String sha1Fingerprint; @SerializedName("created_at") private Date createdDate; @Expose @SerializedName("private_key") private String privateKey; @Expose @SerializedName("leaf_certificate") private String leafCertificate; @Expose @SerializedName("certificate_chain") private String certificateChain;
@Expose private CertificateState state;
jeevatkm/digitalocean-api-java
src/main/java/com/myjeeva/digitalocean/pojo/StickySessions.java
// Path: src/main/java/com/myjeeva/digitalocean/common/StickySessionType.java // public enum StickySessionType { // @SerializedName("cookies") // Cookies("cookies"), // // @SerializedName("none") // None("none"); // // private String value; // // private StickySessionType(String value) { // this.value = value; // } // // public static StickySessionType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (StickySessionType ds : StickySessionType.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // }
import com.myjeeva.digitalocean.common.StickySessionType; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName;
/** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DigitalOcean Load Balancer sticky sessions object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class StickySessions extends Base { private static final long serialVersionUID = -2697068548366505704L;
// Path: src/main/java/com/myjeeva/digitalocean/common/StickySessionType.java // public enum StickySessionType { // @SerializedName("cookies") // Cookies("cookies"), // // @SerializedName("none") // None("none"); // // private String value; // // private StickySessionType(String value) { // this.value = value; // } // // public static StickySessionType fromValue(String value) { // if (StringUtils.isBlank(value)) { // throw new IllegalArgumentException("Value cannot be null or empty!"); // } // // for (StickySessionType ds : StickySessionType.values()) { // if (value.equalsIgnoreCase(ds.value)) { // return ds; // } // } // // throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); // } // // @Override // public String toString() { // return this.value; // } // } // Path: src/main/java/com/myjeeva/digitalocean/pojo/StickySessions.java import com.myjeeva.digitalocean.common.StickySessionType; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * The MIT License * * <p>Copyright (c) 2013-2020 Jeevanandam M. ([email protected]) * * <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * <p>The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.myjeeva.digitalocean.pojo; /** * Represents DigitalOcean Load Balancer sticky sessions object * * @author Thomas Lehoux (https://github.com/tlehoux) * @since v2.11 */ public class StickySessions extends Base { private static final long serialVersionUID = -2697068548366505704L;
@Expose private StickySessionType type = StickySessionType.None;
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/MustacheTemplater.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/MissingParameterException.java // public class MissingParameterException extends IllegalArgumentException { // public MissingParameterException(final String name) { // super("Missing template parameter: " + name); // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/template/Templater.java // public abstract class Templater { // // public static Templater getDefault() { // return new MustacheTemplater(); // } // // public abstract void execute(final Reader input, final Writer output, final String name, final Object parameters); // // public String execute(final String input, final String name, final Object parameters) throws IOException { // if (input == null) { // return null; // } // // try (final Reader reader = new StringReader(input)) { // final StringWriter writer = new StringWriter(); // execute(reader, writer, name, parameters); // return writer.toString(); // } // } // }
import com.github.mustachejava.DefaultMustacheFactory; import com.github.mustachejava.Mustache; import com.github.mustachejava.MustacheException; import com.google.common.base.Throwables; import com.jamierf.dropwizard.debpkg.template.MissingParameterException; import com.jamierf.dropwizard.debpkg.template.Templater; import java.io.Reader; import java.io.Writer;
package com.jamierf.dropwizard.debpkg.template.mustache; public class MustacheTemplater extends Templater { private static final DefaultMustacheFactory MUSTACHE = new DefaultMustacheFactory(); static { MUSTACHE.setObjectHandler(new StrictReflectionObjectHandler()); } @Override public void execute(final Reader input, final Writer output, final String name, final Object parameters) { try { final Mustache template = MUSTACHE.compile(input, name); template.execute(output, parameters); } catch (MustacheException e) { final Throwable cause = Throwables.getRootCause(e);
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/MissingParameterException.java // public class MissingParameterException extends IllegalArgumentException { // public MissingParameterException(final String name) { // super("Missing template parameter: " + name); // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/template/Templater.java // public abstract class Templater { // // public static Templater getDefault() { // return new MustacheTemplater(); // } // // public abstract void execute(final Reader input, final Writer output, final String name, final Object parameters); // // public String execute(final String input, final String name, final Object parameters) throws IOException { // if (input == null) { // return null; // } // // try (final Reader reader = new StringReader(input)) { // final StringWriter writer = new StringWriter(); // execute(reader, writer, name, parameters); // return writer.toString(); // } // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/MustacheTemplater.java import com.github.mustachejava.DefaultMustacheFactory; import com.github.mustachejava.Mustache; import com.github.mustachejava.MustacheException; import com.google.common.base.Throwables; import com.jamierf.dropwizard.debpkg.template.MissingParameterException; import com.jamierf.dropwizard.debpkg.template.Templater; import java.io.Reader; import java.io.Writer; package com.jamierf.dropwizard.debpkg.template.mustache; public class MustacheTemplater extends Templater { private static final DefaultMustacheFactory MUSTACHE = new DefaultMustacheFactory(); static { MUSTACHE.setObjectHandler(new StrictReflectionObjectHandler()); } @Override public void execute(final Reader input, final Writer output, final String name, final Object parameters) { try { final Mustache template = MUSTACHE.compile(input, name); template.execute(output, parameters); } catch (MustacheException e) { final Throwable cause = Throwables.getRootCause(e);
Throwables.propagateIfInstanceOf(cause, MissingParameterException.class);
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/filter/DependencyFilterTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/filter/DependencyFilter.java // public class DependencyFilter implements Predicate<Dependency> { // // private final StringMatchingFilter groupFilter; // private final StringMatchingFilter artifactFilter; // // public DependencyFilter(final String groupId, final String artifactId) { // groupFilter = new StringMatchingFilter(groupId); // artifactFilter = new StringMatchingFilter(artifactId); // } // // @Override // public boolean apply(final Dependency dependency) { // return dependency != null // && groupFilter.apply(dependency.getGroupId()) // && artifactFilter.apply(dependency.getArtifactId()); // } // }
import com.jamierf.dropwizard.debpkg.filter.DependencyFilter; import org.apache.maven.model.Dependency; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue;
package com.jamierf.dropwizard.debpkg.filter; public class DependencyFilterTest { private static Dependency createDependency(String groupId, String artifactId, String version) { final Dependency dependency = new Dependency(); dependency.setGroupId(groupId); dependency.setArtifactId(artifactId); dependency.setVersion(version); return dependency; }
// Path: src/main/java/com/jamierf/dropwizard/debpkg/filter/DependencyFilter.java // public class DependencyFilter implements Predicate<Dependency> { // // private final StringMatchingFilter groupFilter; // private final StringMatchingFilter artifactFilter; // // public DependencyFilter(final String groupId, final String artifactId) { // groupFilter = new StringMatchingFilter(groupId); // artifactFilter = new StringMatchingFilter(artifactId); // } // // @Override // public boolean apply(final Dependency dependency) { // return dependency != null // && groupFilter.apply(dependency.getGroupId()) // && artifactFilter.apply(dependency.getArtifactId()); // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/filter/DependencyFilterTest.java import com.jamierf.dropwizard.debpkg.filter.DependencyFilter; import org.apache.maven.model.Dependency; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; package com.jamierf.dropwizard.debpkg.filter; public class DependencyFilterTest { private static Dependency createDependency(String groupId, String artifactId, String version) { final Dependency dependency = new Dependency(); dependency.setGroupId(groupId); dependency.setArtifactId(artifactId); dependency.setVersion(version); return dependency; }
private DependencyFilter filter;
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/FileResource.java // public class FileResource extends Resource { // // private final File file; // // public FileResource(final File file, final boolean filter, final String target, final String user, final String group, final int mode) { // super(filter, target, user, group, mode); // // this.file = checkNotNull(file); // Preconditions.checkArgument(file.exists(), String.format("File %s not found", file.getAbsolutePath())); // } // // @Override // public ByteSource getSource() { // return Files.asByteSource(file); // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // }
import com.google.common.base.Function; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.FileResource; import com.jamierf.dropwizard.debpkg.resource.Resource;
package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducer implements Function<ResourceConfiguration, Resource> { private final String defaultUser; public ResourceProducer(final String defaultUser) { this.defaultUser = defaultUser; } @Override public Resource apply(final ResourceConfiguration input) { final String user = input.getUser().or(defaultUser);
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/FileResource.java // public class FileResource extends Resource { // // private final File file; // // public FileResource(final File file, final boolean filter, final String target, final String user, final String group, final int mode) { // super(filter, target, user, group, mode); // // this.file = checkNotNull(file); // Preconditions.checkArgument(file.exists(), String.format("File %s not found", file.getAbsolutePath())); // } // // @Override // public ByteSource getSource() { // return Files.asByteSource(file); // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java import com.google.common.base.Function; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.FileResource; import com.jamierf.dropwizard.debpkg.resource.Resource; package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducer implements Function<ResourceConfiguration, Resource> { private final String defaultUser; public ResourceProducer(final String defaultUser) { this.defaultUser = defaultUser; } @Override public Resource apply(final ResourceConfiguration input) { final String user = input.getUser().or(defaultUser);
return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode());
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/DefaultDropwizardMojoTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // }
import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableSet; import com.jamierf.dropwizard.debpkg.resource.Resource; import org.junit.Before; import org.junit.Test; import javax.annotation.Nullable; import java.util.Map; import java.util.Set; import static org.junit.Assert.*;
@Test public void testPgpParameter() { assertNull(plugin.pgp); } @Test public void testValidateParameter() { assertTrue(plugin.validate); } @Test public void testFilesParameter() { assertNotNull(plugin.files); assertTrue(plugin.files.isEmpty()); } @Test public void testParameterMapContainsExpectedValues() { final Map<String, Object> params = plugin.buildParameterMap(); assertEquals(plugin.project, params.get("project")); assertEquals(plugin.deb, params.get("deb")); assertEquals(plugin.jvm, params.get("jvm")); assertEquals(plugin.unix, params.get("unix")); assertEquals(plugin.dropwizard, params.get("dw")); assertEquals(plugin.dropwizard, params.get("dropwizard")); assertEquals(plugin.path, params.get("path")); } @Test public void testResourceListContainsExpectedResources() {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/DefaultDropwizardMojoTest.java import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableSet; import com.jamierf.dropwizard.debpkg.resource.Resource; import org.junit.Before; import org.junit.Test; import javax.annotation.Nullable; import java.util.Map; import java.util.Set; import static org.junit.Assert.*; @Test public void testPgpParameter() { assertNull(plugin.pgp); } @Test public void testValidateParameter() { assertTrue(plugin.validate); } @Test public void testFilesParameter() { assertNotNull(plugin.files); assertTrue(plugin.files.isEmpty()); } @Test public void testParameterMapContainsExpectedValues() { final Map<String, Object> params = plugin.buildParameterMap(); assertEquals(plugin.project, params.get("project")); assertEquals(plugin.deb, params.get("deb")); assertEquals(plugin.jvm, params.get("jvm")); assertEquals(plugin.unix, params.get("unix")); assertEquals(plugin.dropwizard, params.get("dw")); assertEquals(plugin.dropwizard, params.get("dropwizard")); assertEquals(plugin.path, params.get("path")); } @Test public void testResourceListContainsExpectedResources() {
final Set<String> targets = ImmutableSet.copyOf(Collections2.transform(plugin.buildResourceList(), new Function<Resource, String>() {
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/ConfiguredDropwizardMojoTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // }
import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*;
@Test public void testArtifactFileParameter() { assertNotNull(plugin.artifactFile); } @Test public void testOutputFileParameter() { assertNotNull(plugin.outputFile); } @Test public void testPgpParameter() { assertNotNull(plugin.pgp); assertEquals("test", plugin.pgp.getAlias()); assertEquals("test.jks", plugin.pgp.getKeyring().getName()); assertEquals("qwerty", plugin.pgp.getPassphrase()); } @Test public void testValidateParameter() { assertTrue(plugin.validate); } @Test @SuppressWarnings("OctalInteger") public void testFilesParameter() { assertNotNull(plugin.files); assertEquals(1, plugin.files.size());
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/ConfiguredDropwizardMojoTest.java import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; @Test public void testArtifactFileParameter() { assertNotNull(plugin.artifactFile); } @Test public void testOutputFileParameter() { assertNotNull(plugin.outputFile); } @Test public void testPgpParameter() { assertNotNull(plugin.pgp); assertEquals("test", plugin.pgp.getAlias()); assertEquals("test.jks", plugin.pgp.getKeyring().getName()); assertEquals("qwerty", plugin.pgp.getPassphrase()); } @Test public void testValidateParameter() { assertTrue(plugin.validate); } @Test @SuppressWarnings("OctalInteger") public void testFilesParameter() { assertNotNull(plugin.files); assertEquals(1, plugin.files.size());
final ResourceConfiguration resource = plugin.files.get(0);
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java // public class PgpConfiguration { // // @Parameter(required = true) // private String alias = null; // // @Parameter(required = true) // private File keyring = null; // // @Parameter(required = true) // private String passphrase = null; // // public String getAlias() { // return checkNotNull(alias); // } // // public PgpConfiguration setAlias(final String alias) { // this.alias = alias; // return this; // } // // public File getKeyring() { // return checkNotNull(keyring); // } // // public PgpConfiguration setKeyring(final File keyring) { // this.keyring = keyring; // return this; // } // // public String getPassphrase() { // return checkNotNull(passphrase); // } // // public PgpConfiguration setPassphrase(final String passphrase) { // this.passphrase = passphrase; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java // public class ResourceDataProducer implements Function<Resource, DataProducer> { // // private final File inputDir; // // public ResourceDataProducer(final File inputDir) { // this.inputDir = inputDir; // } // // @Override // public DataProducer apply(final Resource resource) { // final File source = new File(inputDir, "files" + resource.getTarget()); // return new DataProducer() { // @Override // public void produce(DataConsumer receiver) throws IOException { // try (final InputStream in = new FileInputStream(source)) { // receiver.onEachFile( // in, // resource.getTarget(), // "", // resource.getUser(), 0, // resource.getGroup(), 0, // resource.getMode(), // source.length() // ); // } // } // }; // } // }
import com.google.common.base.Optional; import com.google.common.collect.Collections2; import com.jamierf.dropwizard.debpkg.config.PgpConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer; import org.vafer.jdeb.*; import java.io.File; import java.net.URI; import java.util.Collection; import java.util.Collections;
package com.jamierf.dropwizard.debpkg.packaging; public class PackageBuilder { private static final Compression COMPRESSION = Compression.GZIP; private final String title; private final String description; private final URI homepage; private final Console log;
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java // public class PgpConfiguration { // // @Parameter(required = true) // private String alias = null; // // @Parameter(required = true) // private File keyring = null; // // @Parameter(required = true) // private String passphrase = null; // // public String getAlias() { // return checkNotNull(alias); // } // // public PgpConfiguration setAlias(final String alias) { // this.alias = alias; // return this; // } // // public File getKeyring() { // return checkNotNull(keyring); // } // // public PgpConfiguration setKeyring(final File keyring) { // this.keyring = keyring; // return this; // } // // public String getPassphrase() { // return checkNotNull(passphrase); // } // // public PgpConfiguration setPassphrase(final String passphrase) { // this.passphrase = passphrase; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java // public class ResourceDataProducer implements Function<Resource, DataProducer> { // // private final File inputDir; // // public ResourceDataProducer(final File inputDir) { // this.inputDir = inputDir; // } // // @Override // public DataProducer apply(final Resource resource) { // final File source = new File(inputDir, "files" + resource.getTarget()); // return new DataProducer() { // @Override // public void produce(DataConsumer receiver) throws IOException { // try (final InputStream in = new FileInputStream(source)) { // receiver.onEachFile( // in, // resource.getTarget(), // "", // resource.getUser(), 0, // resource.getGroup(), 0, // resource.getMode(), // source.length() // ); // } // } // }; // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java import com.google.common.base.Optional; import com.google.common.collect.Collections2; import com.jamierf.dropwizard.debpkg.config.PgpConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer; import org.vafer.jdeb.*; import java.io.File; import java.net.URI; import java.util.Collection; import java.util.Collections; package com.jamierf.dropwizard.debpkg.packaging; public class PackageBuilder { private static final Compression COMPRESSION = Compression.GZIP; private final String title; private final String description; private final URI homepage; private final Console log;
private final Optional<PgpConfiguration> pgpConfiguration;
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java // public class PgpConfiguration { // // @Parameter(required = true) // private String alias = null; // // @Parameter(required = true) // private File keyring = null; // // @Parameter(required = true) // private String passphrase = null; // // public String getAlias() { // return checkNotNull(alias); // } // // public PgpConfiguration setAlias(final String alias) { // this.alias = alias; // return this; // } // // public File getKeyring() { // return checkNotNull(keyring); // } // // public PgpConfiguration setKeyring(final File keyring) { // this.keyring = keyring; // return this; // } // // public String getPassphrase() { // return checkNotNull(passphrase); // } // // public PgpConfiguration setPassphrase(final String passphrase) { // this.passphrase = passphrase; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java // public class ResourceDataProducer implements Function<Resource, DataProducer> { // // private final File inputDir; // // public ResourceDataProducer(final File inputDir) { // this.inputDir = inputDir; // } // // @Override // public DataProducer apply(final Resource resource) { // final File source = new File(inputDir, "files" + resource.getTarget()); // return new DataProducer() { // @Override // public void produce(DataConsumer receiver) throws IOException { // try (final InputStream in = new FileInputStream(source)) { // receiver.onEachFile( // in, // resource.getTarget(), // "", // resource.getUser(), 0, // resource.getGroup(), 0, // resource.getMode(), // source.length() // ); // } // } // }; // } // }
import com.google.common.base.Optional; import com.google.common.collect.Collections2; import com.jamierf.dropwizard.debpkg.config.PgpConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer; import org.vafer.jdeb.*; import java.io.File; import java.net.URI; import java.util.Collection; import java.util.Collections;
package com.jamierf.dropwizard.debpkg.packaging; public class PackageBuilder { private static final Compression COMPRESSION = Compression.GZIP; private final String title; private final String description; private final URI homepage; private final Console log; private final Optional<PgpConfiguration> pgpConfiguration; public PackageBuilder(final String title, final String description, final URI homepage, final Console log, final Optional<PgpConfiguration> pgpConfiguration) { this.title = title; this.description = description; this.homepage = homepage; this.log = log; this.pgpConfiguration = pgpConfiguration; }
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java // public class PgpConfiguration { // // @Parameter(required = true) // private String alias = null; // // @Parameter(required = true) // private File keyring = null; // // @Parameter(required = true) // private String passphrase = null; // // public String getAlias() { // return checkNotNull(alias); // } // // public PgpConfiguration setAlias(final String alias) { // this.alias = alias; // return this; // } // // public File getKeyring() { // return checkNotNull(keyring); // } // // public PgpConfiguration setKeyring(final File keyring) { // this.keyring = keyring; // return this; // } // // public String getPassphrase() { // return checkNotNull(passphrase); // } // // public PgpConfiguration setPassphrase(final String passphrase) { // this.passphrase = passphrase; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java // public class ResourceDataProducer implements Function<Resource, DataProducer> { // // private final File inputDir; // // public ResourceDataProducer(final File inputDir) { // this.inputDir = inputDir; // } // // @Override // public DataProducer apply(final Resource resource) { // final File source = new File(inputDir, "files" + resource.getTarget()); // return new DataProducer() { // @Override // public void produce(DataConsumer receiver) throws IOException { // try (final InputStream in = new FileInputStream(source)) { // receiver.onEachFile( // in, // resource.getTarget(), // "", // resource.getUser(), 0, // resource.getGroup(), 0, // resource.getMode(), // source.length() // ); // } // } // }; // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java import com.google.common.base.Optional; import com.google.common.collect.Collections2; import com.jamierf.dropwizard.debpkg.config.PgpConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer; import org.vafer.jdeb.*; import java.io.File; import java.net.URI; import java.util.Collection; import java.util.Collections; package com.jamierf.dropwizard.debpkg.packaging; public class PackageBuilder { private static final Compression COMPRESSION = Compression.GZIP; private final String title; private final String description; private final URI homepage; private final Console log; private final Optional<PgpConfiguration> pgpConfiguration; public PackageBuilder(final String title, final String description, final URI homepage, final Console log, final Optional<PgpConfiguration> pgpConfiguration) { this.title = title; this.description = description; this.homepage = homepage; this.log = log; this.pgpConfiguration = pgpConfiguration; }
public void createPackage(final Collection<Resource> resources, final File inputDir, final File debFile) throws PackagingException {
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java // public class PgpConfiguration { // // @Parameter(required = true) // private String alias = null; // // @Parameter(required = true) // private File keyring = null; // // @Parameter(required = true) // private String passphrase = null; // // public String getAlias() { // return checkNotNull(alias); // } // // public PgpConfiguration setAlias(final String alias) { // this.alias = alias; // return this; // } // // public File getKeyring() { // return checkNotNull(keyring); // } // // public PgpConfiguration setKeyring(final File keyring) { // this.keyring = keyring; // return this; // } // // public String getPassphrase() { // return checkNotNull(passphrase); // } // // public PgpConfiguration setPassphrase(final String passphrase) { // this.passphrase = passphrase; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java // public class ResourceDataProducer implements Function<Resource, DataProducer> { // // private final File inputDir; // // public ResourceDataProducer(final File inputDir) { // this.inputDir = inputDir; // } // // @Override // public DataProducer apply(final Resource resource) { // final File source = new File(inputDir, "files" + resource.getTarget()); // return new DataProducer() { // @Override // public void produce(DataConsumer receiver) throws IOException { // try (final InputStream in = new FileInputStream(source)) { // receiver.onEachFile( // in, // resource.getTarget(), // "", // resource.getUser(), 0, // resource.getGroup(), 0, // resource.getMode(), // source.length() // ); // } // } // }; // } // }
import com.google.common.base.Optional; import com.google.common.collect.Collections2; import com.jamierf.dropwizard.debpkg.config.PgpConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer; import org.vafer.jdeb.*; import java.io.File; import java.net.URI; import java.util.Collection; import java.util.Collections;
package com.jamierf.dropwizard.debpkg.packaging; public class PackageBuilder { private static final Compression COMPRESSION = Compression.GZIP; private final String title; private final String description; private final URI homepage; private final Console log; private final Optional<PgpConfiguration> pgpConfiguration; public PackageBuilder(final String title, final String description, final URI homepage, final Console log, final Optional<PgpConfiguration> pgpConfiguration) { this.title = title; this.description = description; this.homepage = homepage; this.log = log; this.pgpConfiguration = pgpConfiguration; } public void createPackage(final Collection<Resource> resources, final File inputDir, final File debFile) throws PackagingException {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/PgpConfiguration.java // public class PgpConfiguration { // // @Parameter(required = true) // private String alias = null; // // @Parameter(required = true) // private File keyring = null; // // @Parameter(required = true) // private String passphrase = null; // // public String getAlias() { // return checkNotNull(alias); // } // // public PgpConfiguration setAlias(final String alias) { // this.alias = alias; // return this; // } // // public File getKeyring() { // return checkNotNull(keyring); // } // // public PgpConfiguration setKeyring(final File keyring) { // this.keyring = keyring; // return this; // } // // public String getPassphrase() { // return checkNotNull(passphrase); // } // // public PgpConfiguration setPassphrase(final String passphrase) { // this.passphrase = passphrase; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceDataProducer.java // public class ResourceDataProducer implements Function<Resource, DataProducer> { // // private final File inputDir; // // public ResourceDataProducer(final File inputDir) { // this.inputDir = inputDir; // } // // @Override // public DataProducer apply(final Resource resource) { // final File source = new File(inputDir, "files" + resource.getTarget()); // return new DataProducer() { // @Override // public void produce(DataConsumer receiver) throws IOException { // try (final InputStream in = new FileInputStream(source)) { // receiver.onEachFile( // in, // resource.getTarget(), // "", // resource.getUser(), 0, // resource.getGroup(), 0, // resource.getMode(), // source.length() // ); // } // } // }; // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/packaging/PackageBuilder.java import com.google.common.base.Optional; import com.google.common.collect.Collections2; import com.jamierf.dropwizard.debpkg.config.PgpConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceDataProducer; import org.vafer.jdeb.*; import java.io.File; import java.net.URI; import java.util.Collection; import java.util.Collections; package com.jamierf.dropwizard.debpkg.packaging; public class PackageBuilder { private static final Compression COMPRESSION = Compression.GZIP; private final String title; private final String description; private final URI homepage; private final Console log; private final Optional<PgpConfiguration> pgpConfiguration; public PackageBuilder(final String title, final String description, final URI homepage, final Console log, final Optional<PgpConfiguration> pgpConfiguration) { this.title = title; this.description = description; this.homepage = homepage; this.log = log; this.pgpConfiguration = pgpConfiguration; } public void createPackage(final Collection<Resource> resources, final File inputDir, final File debFile) throws PackagingException {
final Collection<DataProducer> dataProducers = Collections2.transform(resources, new ResourceDataProducer(inputDir));
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/template/Templater.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/MustacheTemplater.java // public class MustacheTemplater extends Templater { // // private static final DefaultMustacheFactory MUSTACHE = new DefaultMustacheFactory(); // // static { // MUSTACHE.setObjectHandler(new StrictReflectionObjectHandler()); // } // // @Override // public void execute(final Reader input, final Writer output, final String name, final Object parameters) { // try { // final Mustache template = MUSTACHE.compile(input, name); // template.execute(output, parameters); // } // catch (MustacheException e) { // final Throwable cause = Throwables.getRootCause(e); // Throwables.propagateIfInstanceOf(cause, MissingParameterException.class); // throw e; // } // } // }
import com.jamierf.dropwizard.debpkg.template.mustache.MustacheTemplater; import java.io.*;
package com.jamierf.dropwizard.debpkg.template; public abstract class Templater { public static Templater getDefault() {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/MustacheTemplater.java // public class MustacheTemplater extends Templater { // // private static final DefaultMustacheFactory MUSTACHE = new DefaultMustacheFactory(); // // static { // MUSTACHE.setObjectHandler(new StrictReflectionObjectHandler()); // } // // @Override // public void execute(final Reader input, final Writer output, final String name, final Object parameters) { // try { // final Mustache template = MUSTACHE.compile(input, name); // template.execute(output, parameters); // } // catch (MustacheException e) { // final Throwable cause = Throwables.getRootCause(e); // Throwables.propagateIfInstanceOf(cause, MissingParameterException.class); // throw e; // } // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/template/Templater.java import com.jamierf.dropwizard.debpkg.template.mustache.MustacheTemplater; import java.io.*; package com.jamierf.dropwizard.debpkg.template; public abstract class Templater { public static Templater getDefault() {
return new MustacheTemplater();
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducerTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java // public class ResourceProducer implements Function<ResourceConfiguration, Resource> { // // private final String defaultUser; // // public ResourceProducer(final String defaultUser) { // this.defaultUser = defaultUser; // } // // @Override // public Resource apply(final ResourceConfiguration input) { // final String user = input.getUser().or(defaultUser); // return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode()); // } // }
import com.google.common.io.Files; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceProducer; import org.apache.tools.tar.TarEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import static org.junit.Assert.*;
package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File source;
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java // public class ResourceProducer implements Function<ResourceConfiguration, Resource> { // // private final String defaultUser; // // public ResourceProducer(final String defaultUser) { // this.defaultUser = defaultUser; // } // // @Override // public Resource apply(final ResourceConfiguration input) { // final String user = input.getUser().or(defaultUser); // return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode()); // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducerTest.java import com.google.common.io.Files; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceProducer; import org.apache.tools.tar.TarEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import static org.junit.Assert.*; package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File source;
private ResourceProducer producer;
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducerTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java // public class ResourceProducer implements Function<ResourceConfiguration, Resource> { // // private final String defaultUser; // // public ResourceProducer(final String defaultUser) { // this.defaultUser = defaultUser; // } // // @Override // public Resource apply(final ResourceConfiguration input) { // final String user = input.getUser().or(defaultUser); // return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode()); // } // }
import com.google.common.io.Files; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceProducer; import org.apache.tools.tar.TarEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import static org.junit.Assert.*;
package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File source; private ResourceProducer producer; @Before public void setUp() throws IOException { source = temporaryFolder.newFile(); Files.write("hello world".getBytes(), source); producer = new ResourceProducer("tester"); } @Test public void testDefaults() {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java // public class ResourceProducer implements Function<ResourceConfiguration, Resource> { // // private final String defaultUser; // // public ResourceProducer(final String defaultUser) { // this.defaultUser = defaultUser; // } // // @Override // public Resource apply(final ResourceConfiguration input) { // final String user = input.getUser().or(defaultUser); // return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode()); // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducerTest.java import com.google.common.io.Files; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceProducer; import org.apache.tools.tar.TarEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import static org.junit.Assert.*; package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File source; private ResourceProducer producer; @Before public void setUp() throws IOException { source = temporaryFolder.newFile(); Files.write("hello world".getBytes(), source); producer = new ResourceProducer("tester"); } @Test public void testDefaults() {
final Resource resource = producer.apply(new ResourceConfiguration().setSource(source).setTarget("/tmp/test"));
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducerTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java // public class ResourceProducer implements Function<ResourceConfiguration, Resource> { // // private final String defaultUser; // // public ResourceProducer(final String defaultUser) { // this.defaultUser = defaultUser; // } // // @Override // public Resource apply(final ResourceConfiguration input) { // final String user = input.getUser().or(defaultUser); // return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode()); // } // }
import com.google.common.io.Files; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceProducer; import org.apache.tools.tar.TarEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import static org.junit.Assert.*;
package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File source; private ResourceProducer producer; @Before public void setUp() throws IOException { source = temporaryFolder.newFile(); Files.write("hello world".getBytes(), source); producer = new ResourceProducer("tester"); } @Test public void testDefaults() {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/config/ResourceConfiguration.java // public class ResourceConfiguration { // // @Parameter(required = true) // private File source; // // @Parameter(required = true) // private String target; // // @Parameter // private boolean filter = true; // // @Parameter // private String user = null; // // @Parameter // private int mode = TarEntry.DEFAULT_FILE_MODE; // // public File getSource() { // return source; // } // // public ResourceConfiguration setSource(final File source) { // this.source = source; // return this; // } // // public String getTarget() { // return target; // } // // public ResourceConfiguration setTarget(final String target) { // this.target = target; // return this; // } // // public boolean isFilter() { // return filter; // } // // public ResourceConfiguration setFilter(final boolean filter) { // this.filter = filter; // return this; // } // // public Optional<String> getUser() { // return Optional.fromNullable(user); // } // // public ResourceConfiguration setUser(final String user) { // this.user = user; // return this; // } // // public int getMode() { // return mode; // } // // public ResourceConfiguration setMode(final int mode) { // this.mode = mode; // return this; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/resource/Resource.java // public abstract class Resource { // // private final boolean filter; // private final String target; // private final String user; // private final String group; // private final int mode; // // public Resource(final boolean filter, final String target, final String user, final String group, final int mode) { // this.target = checkNotNull(target); // this.user = checkNotNull(user); // this.group = checkNotNull(group); // this.filter = filter; // this.mode = mode; // } // // public abstract ByteSource getSource(); // // public boolean isFilter() { // return filter; // } // // public String getTarget() { // return target; // } // // public String getUser() { // return user; // } // // public String getGroup() { // return group; // } // // public int getMode() { // return mode; // } // } // // Path: src/main/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducer.java // public class ResourceProducer implements Function<ResourceConfiguration, Resource> { // // private final String defaultUser; // // public ResourceProducer(final String defaultUser) { // this.defaultUser = defaultUser; // } // // @Override // public Resource apply(final ResourceConfiguration input) { // final String user = input.getUser().or(defaultUser); // return new FileResource(input.getSource(), input.isFilter(), input.getTarget(), user, user, input.getMode()); // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/transforms/ResourceProducerTest.java import com.google.common.io.Files; import com.jamierf.dropwizard.debpkg.config.ResourceConfiguration; import com.jamierf.dropwizard.debpkg.resource.Resource; import com.jamierf.dropwizard.debpkg.transforms.ResourceProducer; import org.apache.tools.tar.TarEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import java.io.File; import java.io.IOException; import static org.junit.Assert.*; package com.jamierf.dropwizard.debpkg.transforms; public class ResourceProducerTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File source; private ResourceProducer producer; @Before public void setUp() throws IOException { source = temporaryFolder.newFile(); Files.write("hello world".getBytes(), source); producer = new ResourceProducer("tester"); } @Test public void testDefaults() {
final Resource resource = producer.apply(new ResourceConfiguration().setSource(source).setTarget("/tmp/test"));
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/template/MustacheTemplateTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/MustacheTemplater.java // public class MustacheTemplater extends Templater { // // private static final DefaultMustacheFactory MUSTACHE = new DefaultMustacheFactory(); // // static { // MUSTACHE.setObjectHandler(new StrictReflectionObjectHandler()); // } // // @Override // public void execute(final Reader input, final Writer output, final String name, final Object parameters) { // try { // final Mustache template = MUSTACHE.compile(input, name); // template.execute(output, parameters); // } // catch (MustacheException e) { // final Throwable cause = Throwables.getRootCause(e); // Throwables.propagateIfInstanceOf(cause, MissingParameterException.class); // throw e; // } // } // }
import com.github.mustachejava.MustacheException; import com.google.common.collect.ImmutableMap; import com.google.common.io.Resources; import com.jamierf.dropwizard.debpkg.template.mustache.MustacheTemplater; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collections; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull;
package com.jamierf.dropwizard.debpkg.template; public class MustacheTemplateTest { private static String getTemplate(String path) throws IOException { return Resources.toString(MustacheTemplateTest.class.getResource(path), StandardCharsets.UTF_8); } private Templater templater; @Before public void setUp() {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/MustacheTemplater.java // public class MustacheTemplater extends Templater { // // private static final DefaultMustacheFactory MUSTACHE = new DefaultMustacheFactory(); // // static { // MUSTACHE.setObjectHandler(new StrictReflectionObjectHandler()); // } // // @Override // public void execute(final Reader input, final Writer output, final String name, final Object parameters) { // try { // final Mustache template = MUSTACHE.compile(input, name); // template.execute(output, parameters); // } // catch (MustacheException e) { // final Throwable cause = Throwables.getRootCause(e); // Throwables.propagateIfInstanceOf(cause, MissingParameterException.class); // throw e; // } // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/template/MustacheTemplateTest.java import com.github.mustachejava.MustacheException; import com.google.common.collect.ImmutableMap; import com.google.common.io.Resources; import com.jamierf.dropwizard.debpkg.template.mustache.MustacheTemplater; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collections; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; package com.jamierf.dropwizard.debpkg.template; public class MustacheTemplateTest { private static String getTemplate(String path) throws IOException { return Resources.toString(MustacheTemplateTest.class.getResource(path), StandardCharsets.UTF_8); } private Templater templater; @Before public void setUp() {
templater = new MustacheTemplater();
reines/dropwizard-debpkg-maven-plugin
src/test/java/com/jamierf/dropwizard/debpkg/filter/StringMatchingFilterTest.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/filter/StringMatchingFilter.java // public class StringMatchingFilter implements Predicate<String> { // // private final String expected; // // public StringMatchingFilter(final String expected) { // this.expected = expected; // } // // @Override // public boolean apply(final String actual) { // return actual != null && expected.equals(actual); // } // }
import com.jamierf.dropwizard.debpkg.filter.StringMatchingFilter; import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue;
package com.jamierf.dropwizard.debpkg.filter; public class StringMatchingFilterTest { private static boolean match(String a, String b) {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/filter/StringMatchingFilter.java // public class StringMatchingFilter implements Predicate<String> { // // private final String expected; // // public StringMatchingFilter(final String expected) { // this.expected = expected; // } // // @Override // public boolean apply(final String actual) { // return actual != null && expected.equals(actual); // } // } // Path: src/test/java/com/jamierf/dropwizard/debpkg/filter/StringMatchingFilterTest.java import com.jamierf.dropwizard.debpkg.filter.StringMatchingFilter; import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; package com.jamierf.dropwizard.debpkg.filter; public class StringMatchingFilterTest { private static boolean match(String a, String b) {
return new StringMatchingFilter(a).apply(b);
reines/dropwizard-debpkg-maven-plugin
src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/StrictReflectionObjectHandler.java
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/MissingParameterException.java // public class MissingParameterException extends IllegalArgumentException { // public MissingParameterException(final String name) { // super("Missing template parameter: " + name); // } // }
import com.github.mustachejava.reflect.Guard; import com.github.mustachejava.reflect.MissingWrapper; import com.github.mustachejava.reflect.ReflectionObjectHandler; import com.jamierf.dropwizard.debpkg.template.MissingParameterException; import java.util.List;
package com.jamierf.dropwizard.debpkg.template.mustache; public class StrictReflectionObjectHandler extends ReflectionObjectHandler { @Override protected MissingWrapper createMissingWrapper(final String name, final List<Guard> guards) {
// Path: src/main/java/com/jamierf/dropwizard/debpkg/template/MissingParameterException.java // public class MissingParameterException extends IllegalArgumentException { // public MissingParameterException(final String name) { // super("Missing template parameter: " + name); // } // } // Path: src/main/java/com/jamierf/dropwizard/debpkg/template/mustache/StrictReflectionObjectHandler.java import com.github.mustachejava.reflect.Guard; import com.github.mustachejava.reflect.MissingWrapper; import com.github.mustachejava.reflect.ReflectionObjectHandler; import com.jamierf.dropwizard.debpkg.template.MissingParameterException; import java.util.List; package com.jamierf.dropwizard.debpkg.template.mustache; public class StrictReflectionObjectHandler extends ReflectionObjectHandler { @Override protected MissingWrapper createMissingWrapper(final String name, final List<Guard> guards) {
throw new MissingParameterException(name);
android-jian/topnews
app/src/main/java/com/topnews/android/ui/ScreenCutActivity.java
// Path: app/src/main/java/com/topnews/android/adapter/ShareIconAdapter.java // public class ShareIconAdapter extends RecyclerView.Adapter<ShareIconAdapter.ViewHolder>{ // // private ArrayList<ShareIconInfo> mDatas; // private ImageView mImage; // private EditText et_input; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // ImageView iv_cutoon; // ImageView iv_select; // // View itemView; // // public ViewHolder(View itemView) { // super(itemView); // // this.itemView=itemView; // // iv_cutoon= (ImageView) itemView.findViewById(R.id.iv_cutoon); // iv_select= (ImageView) itemView.findViewById(R.id.iv_select); // } // } // // public ShareIconAdapter(ArrayList<ShareIconInfo> mDatas, ImageView imageView , EditText editText){ // // this.mDatas=mDatas; // this.mImage=imageView; // this.et_input=editText; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.share_recycler_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.itemView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // for (ShareIconInfo iconBean:mDatas) { // iconBean.isSelected=false; // } // // int position=holder.getAdapterPosition(); // mDatas.get(position).isSelected=true; // notifyDataSetChanged(); // mImage.setImageResource(mDatas.get(position).mIconId); // et_input.setText(mDatas.get(position).des); // // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // ShareIconInfo mIcon=mDatas.get(position); // // holder.iv_cutoon.setImageResource(mIcon.mIconId); // holder.iv_select.setImageResource(R.drawable.select); // // if(mIcon.isSelected){ // holder.iv_select.setVisibility(View.VISIBLE); // }else{ // holder.iv_select.setVisibility(View.INVISIBLE); // } // // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // } // // Path: app/src/main/java/com/topnews/android/gson/ShareIconInfo.java // public class ShareIconInfo { // // public boolean isSelected; // // public int mIconId; //图片Id // // public String des; //描述信息 // }
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.adapter.ShareIconAdapter; import com.topnews.android.gson.ShareIconInfo; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare;
package com.topnews.android.ui; public class ScreenCutActivity extends AppCompatActivity implements View.OnClickListener{ private ImageView imageView; private RecyclerView mRecycler; private int[] iconIds;
// Path: app/src/main/java/com/topnews/android/adapter/ShareIconAdapter.java // public class ShareIconAdapter extends RecyclerView.Adapter<ShareIconAdapter.ViewHolder>{ // // private ArrayList<ShareIconInfo> mDatas; // private ImageView mImage; // private EditText et_input; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // ImageView iv_cutoon; // ImageView iv_select; // // View itemView; // // public ViewHolder(View itemView) { // super(itemView); // // this.itemView=itemView; // // iv_cutoon= (ImageView) itemView.findViewById(R.id.iv_cutoon); // iv_select= (ImageView) itemView.findViewById(R.id.iv_select); // } // } // // public ShareIconAdapter(ArrayList<ShareIconInfo> mDatas, ImageView imageView , EditText editText){ // // this.mDatas=mDatas; // this.mImage=imageView; // this.et_input=editText; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.share_recycler_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.itemView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // for (ShareIconInfo iconBean:mDatas) { // iconBean.isSelected=false; // } // // int position=holder.getAdapterPosition(); // mDatas.get(position).isSelected=true; // notifyDataSetChanged(); // mImage.setImageResource(mDatas.get(position).mIconId); // et_input.setText(mDatas.get(position).des); // // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // ShareIconInfo mIcon=mDatas.get(position); // // holder.iv_cutoon.setImageResource(mIcon.mIconId); // holder.iv_select.setImageResource(R.drawable.select); // // if(mIcon.isSelected){ // holder.iv_select.setVisibility(View.VISIBLE); // }else{ // holder.iv_select.setVisibility(View.INVISIBLE); // } // // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // } // // Path: app/src/main/java/com/topnews/android/gson/ShareIconInfo.java // public class ShareIconInfo { // // public boolean isSelected; // // public int mIconId; //图片Id // // public String des; //描述信息 // } // Path: app/src/main/java/com/topnews/android/ui/ScreenCutActivity.java import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.adapter.ShareIconAdapter; import com.topnews.android.gson.ShareIconInfo; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare; package com.topnews.android.ui; public class ScreenCutActivity extends AppCompatActivity implements View.OnClickListener{ private ImageView imageView; private RecyclerView mRecycler; private int[] iconIds;
private ArrayList<ShareIconInfo> mDatas;
android-jian/topnews
app/src/main/java/com/topnews/android/ui/ScreenCutActivity.java
// Path: app/src/main/java/com/topnews/android/adapter/ShareIconAdapter.java // public class ShareIconAdapter extends RecyclerView.Adapter<ShareIconAdapter.ViewHolder>{ // // private ArrayList<ShareIconInfo> mDatas; // private ImageView mImage; // private EditText et_input; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // ImageView iv_cutoon; // ImageView iv_select; // // View itemView; // // public ViewHolder(View itemView) { // super(itemView); // // this.itemView=itemView; // // iv_cutoon= (ImageView) itemView.findViewById(R.id.iv_cutoon); // iv_select= (ImageView) itemView.findViewById(R.id.iv_select); // } // } // // public ShareIconAdapter(ArrayList<ShareIconInfo> mDatas, ImageView imageView , EditText editText){ // // this.mDatas=mDatas; // this.mImage=imageView; // this.et_input=editText; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.share_recycler_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.itemView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // for (ShareIconInfo iconBean:mDatas) { // iconBean.isSelected=false; // } // // int position=holder.getAdapterPosition(); // mDatas.get(position).isSelected=true; // notifyDataSetChanged(); // mImage.setImageResource(mDatas.get(position).mIconId); // et_input.setText(mDatas.get(position).des); // // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // ShareIconInfo mIcon=mDatas.get(position); // // holder.iv_cutoon.setImageResource(mIcon.mIconId); // holder.iv_select.setImageResource(R.drawable.select); // // if(mIcon.isSelected){ // holder.iv_select.setVisibility(View.VISIBLE); // }else{ // holder.iv_select.setVisibility(View.INVISIBLE); // } // // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // } // // Path: app/src/main/java/com/topnews/android/gson/ShareIconInfo.java // public class ShareIconInfo { // // public boolean isSelected; // // public int mIconId; //图片Id // // public String des; //描述信息 // }
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.adapter.ShareIconAdapter; import com.topnews.android.gson.ShareIconInfo; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare;
package com.topnews.android.ui; public class ScreenCutActivity extends AppCompatActivity implements View.OnClickListener{ private ImageView imageView; private RecyclerView mRecycler; private int[] iconIds; private ArrayList<ShareIconInfo> mDatas; private ImageView iv_icon_show; private EditText et_input; private Toolbar toolbar; private ImageView mOne; private ImageView mTwo; private ImageView mThree;
// Path: app/src/main/java/com/topnews/android/adapter/ShareIconAdapter.java // public class ShareIconAdapter extends RecyclerView.Adapter<ShareIconAdapter.ViewHolder>{ // // private ArrayList<ShareIconInfo> mDatas; // private ImageView mImage; // private EditText et_input; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // ImageView iv_cutoon; // ImageView iv_select; // // View itemView; // // public ViewHolder(View itemView) { // super(itemView); // // this.itemView=itemView; // // iv_cutoon= (ImageView) itemView.findViewById(R.id.iv_cutoon); // iv_select= (ImageView) itemView.findViewById(R.id.iv_select); // } // } // // public ShareIconAdapter(ArrayList<ShareIconInfo> mDatas, ImageView imageView , EditText editText){ // // this.mDatas=mDatas; // this.mImage=imageView; // this.et_input=editText; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.share_recycler_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.itemView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // for (ShareIconInfo iconBean:mDatas) { // iconBean.isSelected=false; // } // // int position=holder.getAdapterPosition(); // mDatas.get(position).isSelected=true; // notifyDataSetChanged(); // mImage.setImageResource(mDatas.get(position).mIconId); // et_input.setText(mDatas.get(position).des); // // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // ShareIconInfo mIcon=mDatas.get(position); // // holder.iv_cutoon.setImageResource(mIcon.mIconId); // holder.iv_select.setImageResource(R.drawable.select); // // if(mIcon.isSelected){ // holder.iv_select.setVisibility(View.VISIBLE); // }else{ // holder.iv_select.setVisibility(View.INVISIBLE); // } // // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // } // // Path: app/src/main/java/com/topnews/android/gson/ShareIconInfo.java // public class ShareIconInfo { // // public boolean isSelected; // // public int mIconId; //图片Id // // public String des; //描述信息 // } // Path: app/src/main/java/com/topnews/android/ui/ScreenCutActivity.java import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.adapter.ShareIconAdapter; import com.topnews.android.gson.ShareIconInfo; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare; package com.topnews.android.ui; public class ScreenCutActivity extends AppCompatActivity implements View.OnClickListener{ private ImageView imageView; private RecyclerView mRecycler; private int[] iconIds; private ArrayList<ShareIconInfo> mDatas; private ImageView iv_icon_show; private EditText et_input; private Toolbar toolbar; private ImageView mOne; private ImageView mTwo; private ImageView mThree;
private ShareIconAdapter mAdapter;
android-jian/topnews
app/src/main/java/com/topnews/android/ui/HomeActivity.java
// Path: app/src/main/java/com/topnews/android/pager/BasePagerFactory.java // public class BasePagerFactory { // // private static HashMap<Integer, BasePagerFragment> pagerMaps=new HashMap<Integer, BasePagerFragment>(); // // /** // * 创建相应位置的fragment对象 // * @param position // * @return // */ // public static BasePagerFragment creatFragment(int position){ // // BasePagerFragment fragment=pagerMaps.get(position); // if(fragment==null){ // switch (position) { // case 0: // fragment=new HomeFragment(); // break; // case 1: // fragment=new TalkingFragment(); // break; // case 2: // fragment=new TopicFragment(); // break; // case 3: // fragment=new SettingFragment(); // break; // // default: // break; // } // pagerMaps.put(position, fragment); // } // // return fragment; // } // } // // Path: app/src/main/java/com/topnews/android/pager/BasePagerFragment.java // public class BasePagerFragment extends Fragment{ // // } // // Path: app/src/main/java/com/topnews/android/view/NoScrollViewPager.java // public class NoScrollViewPager extends ViewPager { // // public NoScrollViewPager(Context context) { // super(context); // } // // public NoScrollViewPager(Context context, AttributeSet attrs) { // super(context, attrs); // } // // //重写此方法,触摸时什么都不做,从而实现对滑动事件的禁用 // @Override // public boolean onTouchEvent(MotionEvent ev) { // return true; // } // // //事件拦截 return false 不拦截子控件的事件 // @Override // public boolean onInterceptTouchEvent(MotionEvent ev) { // return false; // } // }
import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.widget.RadioGroup; import com.topnews.android.R; import com.topnews.android.pager.BasePagerFactory; import com.topnews.android.pager.BasePagerFragment; import com.topnews.android.view.NoScrollViewPager;
case R.id.btn_talking: vp_content.setCurrentItem(1); break; case R.id.btn_topic: vp_content.setCurrentItem(2); break; case R.id.btn_setting: vp_content.setCurrentItem(3); break; default: break; } } }); } public class MyFragmentAdapter extends FragmentPagerAdapter { public MyFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) {
// Path: app/src/main/java/com/topnews/android/pager/BasePagerFactory.java // public class BasePagerFactory { // // private static HashMap<Integer, BasePagerFragment> pagerMaps=new HashMap<Integer, BasePagerFragment>(); // // /** // * 创建相应位置的fragment对象 // * @param position // * @return // */ // public static BasePagerFragment creatFragment(int position){ // // BasePagerFragment fragment=pagerMaps.get(position); // if(fragment==null){ // switch (position) { // case 0: // fragment=new HomeFragment(); // break; // case 1: // fragment=new TalkingFragment(); // break; // case 2: // fragment=new TopicFragment(); // break; // case 3: // fragment=new SettingFragment(); // break; // // default: // break; // } // pagerMaps.put(position, fragment); // } // // return fragment; // } // } // // Path: app/src/main/java/com/topnews/android/pager/BasePagerFragment.java // public class BasePagerFragment extends Fragment{ // // } // // Path: app/src/main/java/com/topnews/android/view/NoScrollViewPager.java // public class NoScrollViewPager extends ViewPager { // // public NoScrollViewPager(Context context) { // super(context); // } // // public NoScrollViewPager(Context context, AttributeSet attrs) { // super(context, attrs); // } // // //重写此方法,触摸时什么都不做,从而实现对滑动事件的禁用 // @Override // public boolean onTouchEvent(MotionEvent ev) { // return true; // } // // //事件拦截 return false 不拦截子控件的事件 // @Override // public boolean onInterceptTouchEvent(MotionEvent ev) { // return false; // } // } // Path: app/src/main/java/com/topnews/android/ui/HomeActivity.java import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.widget.RadioGroup; import com.topnews.android.R; import com.topnews.android.pager.BasePagerFactory; import com.topnews.android.pager.BasePagerFragment; import com.topnews.android.view.NoScrollViewPager; case R.id.btn_talking: vp_content.setCurrentItem(1); break; case R.id.btn_topic: vp_content.setCurrentItem(2); break; case R.id.btn_setting: vp_content.setCurrentItem(3); break; default: break; } } }); } public class MyFragmentAdapter extends FragmentPagerAdapter { public MyFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) {
BasePagerFragment fragment= BasePagerFactory.creatFragment(position);
android-jian/topnews
app/src/main/java/com/topnews/android/ui/HomeActivity.java
// Path: app/src/main/java/com/topnews/android/pager/BasePagerFactory.java // public class BasePagerFactory { // // private static HashMap<Integer, BasePagerFragment> pagerMaps=new HashMap<Integer, BasePagerFragment>(); // // /** // * 创建相应位置的fragment对象 // * @param position // * @return // */ // public static BasePagerFragment creatFragment(int position){ // // BasePagerFragment fragment=pagerMaps.get(position); // if(fragment==null){ // switch (position) { // case 0: // fragment=new HomeFragment(); // break; // case 1: // fragment=new TalkingFragment(); // break; // case 2: // fragment=new TopicFragment(); // break; // case 3: // fragment=new SettingFragment(); // break; // // default: // break; // } // pagerMaps.put(position, fragment); // } // // return fragment; // } // } // // Path: app/src/main/java/com/topnews/android/pager/BasePagerFragment.java // public class BasePagerFragment extends Fragment{ // // } // // Path: app/src/main/java/com/topnews/android/view/NoScrollViewPager.java // public class NoScrollViewPager extends ViewPager { // // public NoScrollViewPager(Context context) { // super(context); // } // // public NoScrollViewPager(Context context, AttributeSet attrs) { // super(context, attrs); // } // // //重写此方法,触摸时什么都不做,从而实现对滑动事件的禁用 // @Override // public boolean onTouchEvent(MotionEvent ev) { // return true; // } // // //事件拦截 return false 不拦截子控件的事件 // @Override // public boolean onInterceptTouchEvent(MotionEvent ev) { // return false; // } // }
import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.widget.RadioGroup; import com.topnews.android.R; import com.topnews.android.pager.BasePagerFactory; import com.topnews.android.pager.BasePagerFragment; import com.topnews.android.view.NoScrollViewPager;
case R.id.btn_talking: vp_content.setCurrentItem(1); break; case R.id.btn_topic: vp_content.setCurrentItem(2); break; case R.id.btn_setting: vp_content.setCurrentItem(3); break; default: break; } } }); } public class MyFragmentAdapter extends FragmentPagerAdapter { public MyFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) {
// Path: app/src/main/java/com/topnews/android/pager/BasePagerFactory.java // public class BasePagerFactory { // // private static HashMap<Integer, BasePagerFragment> pagerMaps=new HashMap<Integer, BasePagerFragment>(); // // /** // * 创建相应位置的fragment对象 // * @param position // * @return // */ // public static BasePagerFragment creatFragment(int position){ // // BasePagerFragment fragment=pagerMaps.get(position); // if(fragment==null){ // switch (position) { // case 0: // fragment=new HomeFragment(); // break; // case 1: // fragment=new TalkingFragment(); // break; // case 2: // fragment=new TopicFragment(); // break; // case 3: // fragment=new SettingFragment(); // break; // // default: // break; // } // pagerMaps.put(position, fragment); // } // // return fragment; // } // } // // Path: app/src/main/java/com/topnews/android/pager/BasePagerFragment.java // public class BasePagerFragment extends Fragment{ // // } // // Path: app/src/main/java/com/topnews/android/view/NoScrollViewPager.java // public class NoScrollViewPager extends ViewPager { // // public NoScrollViewPager(Context context) { // super(context); // } // // public NoScrollViewPager(Context context, AttributeSet attrs) { // super(context, attrs); // } // // //重写此方法,触摸时什么都不做,从而实现对滑动事件的禁用 // @Override // public boolean onTouchEvent(MotionEvent ev) { // return true; // } // // //事件拦截 return false 不拦截子控件的事件 // @Override // public boolean onInterceptTouchEvent(MotionEvent ev) { // return false; // } // } // Path: app/src/main/java/com/topnews/android/ui/HomeActivity.java import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.widget.RadioGroup; import com.topnews.android.R; import com.topnews.android.pager.BasePagerFactory; import com.topnews.android.pager.BasePagerFragment; import com.topnews.android.view.NoScrollViewPager; case R.id.btn_talking: vp_content.setCurrentItem(1); break; case R.id.btn_topic: vp_content.setCurrentItem(2); break; case R.id.btn_setting: vp_content.setCurrentItem(3); break; default: break; } } }); } public class MyFragmentAdapter extends FragmentPagerAdapter { public MyFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) {
BasePagerFragment fragment= BasePagerFactory.creatFragment(position);
android-jian/topnews
magicindicator/src/main/java/net/lucode/hackware/magicindicator/FragmentContainerHelper.java
// Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/commonnavigator/model/PositionData.java // public class PositionData { // public int mLeft; // public int mTop; // public int mRight; // public int mBottom; // public int mContentLeft; // public int mContentTop; // public int mContentRight; // public int mContentBottom; // // public int width() { // return mRight - mLeft; // } // // public int height() { // return mBottom - mTop; // } // // public int contentWidth() { // return mContentRight - mContentLeft; // } // // public int contentHeight() { // return mContentBottom - mContentTop; // } // // public int horizontalCenter() { // return mLeft + width() / 2; // } // // public int verticalCenter() { // return mTop + height() / 2; // } // }
import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.os.Build; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; import java.util.ArrayList; import java.util.List;
}; private ValueAnimator.AnimatorUpdateListener mAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float positionOffsetSum = (Float) animation.getAnimatedValue(); int position = (int) positionOffsetSum; float positionOffset = positionOffsetSum - position; if (positionOffsetSum < 0) { position = position - 1; positionOffset = 1.0f + positionOffset; } dispatchPageScrolled(position, positionOffset, 0); } }; public FragmentContainerHelper() { } public FragmentContainerHelper(MagicIndicator magicIndicator) { mMagicIndicators.add(magicIndicator); } /** * IPagerIndicator支持弹性效果的辅助方法 * * @param positionDataList * @param index * @return */
// Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/commonnavigator/model/PositionData.java // public class PositionData { // public int mLeft; // public int mTop; // public int mRight; // public int mBottom; // public int mContentLeft; // public int mContentTop; // public int mContentRight; // public int mContentBottom; // // public int width() { // return mRight - mLeft; // } // // public int height() { // return mBottom - mTop; // } // // public int contentWidth() { // return mContentRight - mContentLeft; // } // // public int contentHeight() { // return mContentBottom - mContentTop; // } // // public int horizontalCenter() { // return mLeft + width() / 2; // } // // public int verticalCenter() { // return mTop + height() / 2; // } // } // Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/FragmentContainerHelper.java import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.os.Build; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import net.lucode.hackware.magicindicator.buildins.commonnavigator.model.PositionData; import java.util.ArrayList; import java.util.List; }; private ValueAnimator.AnimatorUpdateListener mAnimatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float positionOffsetSum = (Float) animation.getAnimatedValue(); int position = (int) positionOffsetSum; float positionOffset = positionOffsetSum - position; if (positionOffsetSum < 0) { position = position - 1; positionOffset = 1.0f + positionOffset; } dispatchPageScrolled(position, positionOffset, 0); } }; public FragmentContainerHelper() { } public FragmentContainerHelper(MagicIndicator magicIndicator) { mMagicIndicators.add(magicIndicator); } /** * IPagerIndicator支持弹性效果的辅助方法 * * @param positionDataList * @param index * @return */
public static PositionData getImitativePositionData(List<PositionData> positionDataList, int index) {
android-jian/topnews
magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/commonnavigator/titles/ClipPagerTitleView.java
// Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/UIUtil.java // public final class UIUtil { // // public static int dip2px(Context context, double dpValue) { // float density = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * density + 0.5); // } // // public static int getScreenWidth(Context context) { // return context.getResources().getDisplayMetrics().widthPixels; // } // } // // Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/commonnavigator/abs/IMeasurablePagerTitleView.java // public interface IMeasurablePagerTitleView extends IPagerTitleView { // int getContentLeft(); // // int getContentTop(); // // int getContentRight(); // // int getContentBottom(); // }
import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.view.View; import net.lucode.hackware.magicindicator.buildins.UIUtil; import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IMeasurablePagerTitleView;
package net.lucode.hackware.magicindicator.buildins.commonnavigator.titles; /** * 类似今日头条切换效果的指示器标题 * 博客: http://hackware.lucode.net * Created by hackware on 2016/6/26. */ public class ClipPagerTitleView extends View implements IMeasurablePagerTitleView { private String mText; private int mTextColor; private int mClipColor; private boolean mLeftToRight; private float mClipPercent; private Paint mPaint; private Rect mTextBounds = new Rect(); public ClipPagerTitleView(Context context) { super(context); init(context); } private void init(Context context) {
// Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/UIUtil.java // public final class UIUtil { // // public static int dip2px(Context context, double dpValue) { // float density = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * density + 0.5); // } // // public static int getScreenWidth(Context context) { // return context.getResources().getDisplayMetrics().widthPixels; // } // } // // Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/commonnavigator/abs/IMeasurablePagerTitleView.java // public interface IMeasurablePagerTitleView extends IPagerTitleView { // int getContentLeft(); // // int getContentTop(); // // int getContentRight(); // // int getContentBottom(); // } // Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/commonnavigator/titles/ClipPagerTitleView.java import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.view.View; import net.lucode.hackware.magicindicator.buildins.UIUtil; import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IMeasurablePagerTitleView; package net.lucode.hackware.magicindicator.buildins.commonnavigator.titles; /** * 类似今日头条切换效果的指示器标题 * 博客: http://hackware.lucode.net * Created by hackware on 2016/6/26. */ public class ClipPagerTitleView extends View implements IMeasurablePagerTitleView { private String mText; private int mTextColor; private int mClipColor; private boolean mLeftToRight; private float mClipPercent; private Paint mPaint; private Rect mTextBounds = new Rect(); public ClipPagerTitleView(Context context) { super(context); init(context); } private void init(Context context) {
int textSize = UIUtil.dip2px(context, 16);
android-jian/topnews
app/src/main/java/com/topnews/android/view/SwipeLayout.java
// Path: app/src/main/java/com/topnews/android/utils/SwipeLayoutManager.java // public class SwipeLayoutManager { // // private static SwipeLayoutManager manager=null; // // private SwipeLayoutManager(){} // // public static SwipeLayoutManager getInstance(){ // // if (manager==null){ // synchronized (SwipeLayoutManager.class){ // if (manager==null){ // manager=new SwipeLayoutManager(); // } // } // } // // return manager; // } // // //用来记录当前打开的SwipeLayout // private SwipeLayout currentLayout; // // public void setSwipeLayout(SwipeLayout layout){ // // this.currentLayout=layout; // } // // public SwipeLayout getSwipeLayout(){ // // return currentLayout; // } // // public void clearSwipeLayout(){ // // this.currentLayout=null; // } // // /** // * 关闭当前已经打开的swipeLayout // */ // public void closeCurrentLayout(){ // if (currentLayout!=null){ // currentLayout.close(); // } // } // // /** // * 判断当前是否能够滑动 如果没有打开的,则可以滑动 // * 如果有打开的 则判断打开的swipeLayout和当前layout是否是同一个 // * @param layout // * @return // */ // public boolean isShouldSwipe(SwipeLayout layout){ // // if(currentLayout==null){ // return true; // }else{ // return currentLayout==layout; // } // } // }
import android.content.Context; import android.support.v4.view.ViewCompat; import android.support.v4.widget.ViewDragHelper; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import com.topnews.android.utils.SwipeLayoutManager;
super.onFinishInflate(); contentView = getChildAt(0); deleteView = getChildAt(1); } //此方法在measure方法后调用 @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); contentWidth = contentView.getMeasuredWidth(); contentHeight = contentView.getMeasuredHeight(); deleteWidth = deleteView.getMeasuredWidth(); deleteHeight = deleteView.getMeasuredHeight(); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { //super.onLayout(changed, left, top, right, bottom); contentView.layout(0,0,contentWidth,contentHeight); deleteView.layout(contentView.getRight(),0,contentView.getRight()+deleteWidth,deleteHeight); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { boolean result=dragHelper.shouldInterceptTouchEvent(ev); //如果当前有打开的,则需要直接拦截,交给onTouchEvent处理 打开的swipeLayout和当前layout不是同一个
// Path: app/src/main/java/com/topnews/android/utils/SwipeLayoutManager.java // public class SwipeLayoutManager { // // private static SwipeLayoutManager manager=null; // // private SwipeLayoutManager(){} // // public static SwipeLayoutManager getInstance(){ // // if (manager==null){ // synchronized (SwipeLayoutManager.class){ // if (manager==null){ // manager=new SwipeLayoutManager(); // } // } // } // // return manager; // } // // //用来记录当前打开的SwipeLayout // private SwipeLayout currentLayout; // // public void setSwipeLayout(SwipeLayout layout){ // // this.currentLayout=layout; // } // // public SwipeLayout getSwipeLayout(){ // // return currentLayout; // } // // public void clearSwipeLayout(){ // // this.currentLayout=null; // } // // /** // * 关闭当前已经打开的swipeLayout // */ // public void closeCurrentLayout(){ // if (currentLayout!=null){ // currentLayout.close(); // } // } // // /** // * 判断当前是否能够滑动 如果没有打开的,则可以滑动 // * 如果有打开的 则判断打开的swipeLayout和当前layout是否是同一个 // * @param layout // * @return // */ // public boolean isShouldSwipe(SwipeLayout layout){ // // if(currentLayout==null){ // return true; // }else{ // return currentLayout==layout; // } // } // } // Path: app/src/main/java/com/topnews/android/view/SwipeLayout.java import android.content.Context; import android.support.v4.view.ViewCompat; import android.support.v4.widget.ViewDragHelper; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import com.topnews.android.utils.SwipeLayoutManager; super.onFinishInflate(); contentView = getChildAt(0); deleteView = getChildAt(1); } //此方法在measure方法后调用 @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); contentWidth = contentView.getMeasuredWidth(); contentHeight = contentView.getMeasuredHeight(); deleteWidth = deleteView.getMeasuredWidth(); deleteHeight = deleteView.getMeasuredHeight(); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { //super.onLayout(changed, left, top, right, bottom); contentView.layout(0,0,contentWidth,contentHeight); deleteView.layout(contentView.getRight(),0,contentView.getRight()+deleteWidth,deleteHeight); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { boolean result=dragHelper.shouldInterceptTouchEvent(ev); //如果当前有打开的,则需要直接拦截,交给onTouchEvent处理 打开的swipeLayout和当前layout不是同一个
if (!SwipeLayoutManager.getInstance().isShouldSwipe(this)){
android-jian/topnews
app/src/main/java/com/topnews/android/view/LoadingPage.java
// Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // }
import android.content.Context; import android.support.annotation.UiThread; import android.util.AttributeSet; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import com.topnews.android.R; import com.topnews.android.utils.UIUtils;
package com.topnews.android.view; /** * Created by dell on 2017/2/28. * * 根据当前状态来显示不同页面的自定义控件 * * 页面状态:未加载、正在加载、数据为空、加载失败、加载成功 */ public abstract class LoadingPage extends FrameLayout { private static final int PAGE_LOAD_UNDO=1; private static final int PAGE_LOAD_LOADING=2; private static final int PAGE_LOAD_NONE=3; private static final int PAGE_LOAD_FAIL=4; private static final int PAGE_LOAD_SUCCESS=5; private int currentState=PAGE_LOAD_UNDO; //当前状态 private View pageLoading; private View pageError; private View pageEmpty; private View pageSuccess; public LoadingPage(Context context) { super(context); initView(); } public LoadingPage(Context context, AttributeSet attrs) { super(context, attrs); initView(); } public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initView(); } public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { super(context, attrs, defStyleAttr, defStyleRes); initView(); } /** * 初始化布局 * @return */ public void initView(){ if(pageLoading==null){ //初始化加载中的布局
// Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // } // Path: app/src/main/java/com/topnews/android/view/LoadingPage.java import android.content.Context; import android.support.annotation.UiThread; import android.util.AttributeSet; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import com.topnews.android.R; import com.topnews.android.utils.UIUtils; package com.topnews.android.view; /** * Created by dell on 2017/2/28. * * 根据当前状态来显示不同页面的自定义控件 * * 页面状态:未加载、正在加载、数据为空、加载失败、加载成功 */ public abstract class LoadingPage extends FrameLayout { private static final int PAGE_LOAD_UNDO=1; private static final int PAGE_LOAD_LOADING=2; private static final int PAGE_LOAD_NONE=3; private static final int PAGE_LOAD_FAIL=4; private static final int PAGE_LOAD_SUCCESS=5; private int currentState=PAGE_LOAD_UNDO; //当前状态 private View pageLoading; private View pageError; private View pageEmpty; private View pageSuccess; public LoadingPage(Context context) { super(context); initView(); } public LoadingPage(Context context, AttributeSet attrs) { super(context, attrs); initView(); } public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); initView(); } public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { super(context, attrs, defStyleAttr, defStyleRes); initView(); } /** * 初始化布局 * @return */ public void initView(){ if(pageLoading==null){ //初始化加载中的布局
pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null);
android-jian/topnews
app/src/main/java/com/topnews/android/fragment/GameFragment.java
// Path: app/src/main/java/com/topnews/android/view/LoadingPage.java // public abstract class LoadingPage extends FrameLayout { // // private static final int PAGE_LOAD_UNDO=1; // private static final int PAGE_LOAD_LOADING=2; // private static final int PAGE_LOAD_NONE=3; // private static final int PAGE_LOAD_FAIL=4; // private static final int PAGE_LOAD_SUCCESS=5; // // private int currentState=PAGE_LOAD_UNDO; //当前状态 // // private View pageLoading; // private View pageError; // private View pageEmpty; // private View pageSuccess; // // public LoadingPage(Context context) { // super(context); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs) { // super(context, attrs); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { // super(context, attrs, defStyleAttr, defStyleRes); // // initView(); // } // // /** // * 初始化布局 // * @return // */ // public void initView(){ // // if(pageLoading==null){ //初始化加载中的布局 // pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null); // addView(pageLoading); // } // // if(pageError==null){ //初始化页面加载失败的布局 // pageError = View.inflate(UIUtils.getContext(), R.layout.page_error,null); // // Button btn_error= (Button) pageError.findViewById(R.id.btn_error); // btn_error.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // onLoad(); // } // }); // // addView(pageError); // } // // if (pageEmpty==null){ //初始化加载数据为空的布局 // pageEmpty=View.inflate(UIUtils.getContext(),R.layout.page_empty,null); // addView(pageEmpty); // } // // showRightPage(); // // } // // /** // * 根据当前状态决定显示哪个布局 // */ // public void showRightPage(){ // // pageLoading.setVisibility((currentState==PAGE_LOAD_UNDO || currentState==PAGE_LOAD_LOADING)?View.VISIBLE:View.GONE); // // pageEmpty.setVisibility((currentState==PAGE_LOAD_NONE)?View.VISIBLE:View.GONE); // // pageError.setVisibility((currentState==PAGE_LOAD_FAIL)?View.VISIBLE:View.GONE); // // if (pageSuccess==null && currentState==PAGE_LOAD_SUCCESS){ //初始化加载数据成功的布局 // pageSuccess=onCreateSuccessView(); // // if (pageSuccess!=null){ // addView(pageSuccess); // } // } // // if (pageSuccess!=null){ // pageSuccess.setVisibility((currentState==PAGE_LOAD_SUCCESS)?View.VISIBLE:View.GONE); // } // } // // /** // * 数据加载 // */ // public void onLoad(){ // // if (currentState!=PAGE_LOAD_LOADING){ //如果当前没有正在加载数据,就开始加载数据 // currentState=PAGE_LOAD_LOADING; // new Thread(){ // // @Override // public void run() { // final ResultState mState=dataLoad(); // // UIUtils.runOnUiThread(new Runnable() { // @Override // public void run() { // if (mState!=null){ // currentState=mState.getState(); // showRightPage(); // } // } // }); // } // }.start(); // } // } // // /** // * 初始化加载数据成功的布局 // * @return // */ // public abstract View onCreateSuccessView(); // // /** // * 数据加载 返回值表示请求网络结束后的状态 // * @return // */ // public abstract ResultState dataLoad(); // // public enum ResultState{ // // STATE_SUCCESS(PAGE_LOAD_SUCCESS),STATE_ERROR(PAGE_LOAD_FAIL),STATE_EMPTY(PAGE_LOAD_NONE); // // private int state; // private ResultState(int state){ // this.state=state; // } // // public int getState(){ // return this.state; // } // } // // }
import android.view.View; import com.topnews.android.view.LoadingPage;
package com.topnews.android.fragment; /** * Created by dell on 2017/2/25. */ public class GameFragment extends BaseFragment { @Override public View onCreateSuccessView() { return null; } @Override
// Path: app/src/main/java/com/topnews/android/view/LoadingPage.java // public abstract class LoadingPage extends FrameLayout { // // private static final int PAGE_LOAD_UNDO=1; // private static final int PAGE_LOAD_LOADING=2; // private static final int PAGE_LOAD_NONE=3; // private static final int PAGE_LOAD_FAIL=4; // private static final int PAGE_LOAD_SUCCESS=5; // // private int currentState=PAGE_LOAD_UNDO; //当前状态 // // private View pageLoading; // private View pageError; // private View pageEmpty; // private View pageSuccess; // // public LoadingPage(Context context) { // super(context); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs) { // super(context, attrs); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { // super(context, attrs, defStyleAttr, defStyleRes); // // initView(); // } // // /** // * 初始化布局 // * @return // */ // public void initView(){ // // if(pageLoading==null){ //初始化加载中的布局 // pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null); // addView(pageLoading); // } // // if(pageError==null){ //初始化页面加载失败的布局 // pageError = View.inflate(UIUtils.getContext(), R.layout.page_error,null); // // Button btn_error= (Button) pageError.findViewById(R.id.btn_error); // btn_error.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // onLoad(); // } // }); // // addView(pageError); // } // // if (pageEmpty==null){ //初始化加载数据为空的布局 // pageEmpty=View.inflate(UIUtils.getContext(),R.layout.page_empty,null); // addView(pageEmpty); // } // // showRightPage(); // // } // // /** // * 根据当前状态决定显示哪个布局 // */ // public void showRightPage(){ // // pageLoading.setVisibility((currentState==PAGE_LOAD_UNDO || currentState==PAGE_LOAD_LOADING)?View.VISIBLE:View.GONE); // // pageEmpty.setVisibility((currentState==PAGE_LOAD_NONE)?View.VISIBLE:View.GONE); // // pageError.setVisibility((currentState==PAGE_LOAD_FAIL)?View.VISIBLE:View.GONE); // // if (pageSuccess==null && currentState==PAGE_LOAD_SUCCESS){ //初始化加载数据成功的布局 // pageSuccess=onCreateSuccessView(); // // if (pageSuccess!=null){ // addView(pageSuccess); // } // } // // if (pageSuccess!=null){ // pageSuccess.setVisibility((currentState==PAGE_LOAD_SUCCESS)?View.VISIBLE:View.GONE); // } // } // // /** // * 数据加载 // */ // public void onLoad(){ // // if (currentState!=PAGE_LOAD_LOADING){ //如果当前没有正在加载数据,就开始加载数据 // currentState=PAGE_LOAD_LOADING; // new Thread(){ // // @Override // public void run() { // final ResultState mState=dataLoad(); // // UIUtils.runOnUiThread(new Runnable() { // @Override // public void run() { // if (mState!=null){ // currentState=mState.getState(); // showRightPage(); // } // } // }); // } // }.start(); // } // } // // /** // * 初始化加载数据成功的布局 // * @return // */ // public abstract View onCreateSuccessView(); // // /** // * 数据加载 返回值表示请求网络结束后的状态 // * @return // */ // public abstract ResultState dataLoad(); // // public enum ResultState{ // // STATE_SUCCESS(PAGE_LOAD_SUCCESS),STATE_ERROR(PAGE_LOAD_FAIL),STATE_EMPTY(PAGE_LOAD_NONE); // // private int state; // private ResultState(int state){ // this.state=state; // } // // public int getState(){ // return this.state; // } // } // // } // Path: app/src/main/java/com/topnews/android/fragment/GameFragment.java import android.view.View; import com.topnews.android.view.LoadingPage; package com.topnews.android.fragment; /** * Created by dell on 2017/2/25. */ public class GameFragment extends BaseFragment { @Override public View onCreateSuccessView() { return null; } @Override
public LoadingPage.ResultState dataLoad() {
android-jian/topnews
app/src/main/java/com/topnews/android/utils/UIUtils.java
// Path: app/src/main/java/com/topnews/android/global/BaseApplication.java // public class BaseApplication extends Application{ // // private static Context mContext; // // private static Handler mHandler; // // private static int mainThreadId; // // @Override // public void onCreate() { // // super.onCreate(); // // this.mContext=getApplicationContext(); // mHandler=new Handler(); // mainThreadId=android.os.Process.myTid(); //获取主线程id // // Bmob.initialize(this, "c3afc6b5c969611f04beb79125e3ec2f"); // LitePalApplication.initialize(this); // ZXingLibrary.initDisplayOpinion(this); // // getSharedPreferences("config",MODE_PRIVATE).edit().putBoolean("night", false).commit(); // } // // public static Context getmContext(){ // // return mContext; // } // // public static Handler getmHandler(){ // // return mHandler; // } // // public static int getMainThreadId(){ // // return mainThreadId; // } // }
import android.content.Context; import android.os.Handler; import com.topnews.android.global.BaseApplication;
package com.topnews.android.utils; /** * Created by dell on 2017/2/26. * * UI工具类 */ public class UIUtils { /** * 获取上下文对象 * @return */ public static Context getContext(){
// Path: app/src/main/java/com/topnews/android/global/BaseApplication.java // public class BaseApplication extends Application{ // // private static Context mContext; // // private static Handler mHandler; // // private static int mainThreadId; // // @Override // public void onCreate() { // // super.onCreate(); // // this.mContext=getApplicationContext(); // mHandler=new Handler(); // mainThreadId=android.os.Process.myTid(); //获取主线程id // // Bmob.initialize(this, "c3afc6b5c969611f04beb79125e3ec2f"); // LitePalApplication.initialize(this); // ZXingLibrary.initDisplayOpinion(this); // // getSharedPreferences("config",MODE_PRIVATE).edit().putBoolean("night", false).commit(); // } // // public static Context getmContext(){ // // return mContext; // } // // public static Handler getmHandler(){ // // return mHandler; // } // // public static int getMainThreadId(){ // // return mainThreadId; // } // } // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java import android.content.Context; import android.os.Handler; import com.topnews.android.global.BaseApplication; package com.topnews.android.utils; /** * Created by dell on 2017/2/26. * * UI工具类 */ public class UIUtils { /** * 获取上下文对象 * @return */ public static Context getContext(){
return BaseApplication.getmContext();
android-jian/topnews
app/src/main/java/com/topnews/android/fragment/TechFragment.java
// Path: app/src/main/java/com/topnews/android/view/LoadingPage.java // public abstract class LoadingPage extends FrameLayout { // // private static final int PAGE_LOAD_UNDO=1; // private static final int PAGE_LOAD_LOADING=2; // private static final int PAGE_LOAD_NONE=3; // private static final int PAGE_LOAD_FAIL=4; // private static final int PAGE_LOAD_SUCCESS=5; // // private int currentState=PAGE_LOAD_UNDO; //当前状态 // // private View pageLoading; // private View pageError; // private View pageEmpty; // private View pageSuccess; // // public LoadingPage(Context context) { // super(context); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs) { // super(context, attrs); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { // super(context, attrs, defStyleAttr, defStyleRes); // // initView(); // } // // /** // * 初始化布局 // * @return // */ // public void initView(){ // // if(pageLoading==null){ //初始化加载中的布局 // pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null); // addView(pageLoading); // } // // if(pageError==null){ //初始化页面加载失败的布局 // pageError = View.inflate(UIUtils.getContext(), R.layout.page_error,null); // // Button btn_error= (Button) pageError.findViewById(R.id.btn_error); // btn_error.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // onLoad(); // } // }); // // addView(pageError); // } // // if (pageEmpty==null){ //初始化加载数据为空的布局 // pageEmpty=View.inflate(UIUtils.getContext(),R.layout.page_empty,null); // addView(pageEmpty); // } // // showRightPage(); // // } // // /** // * 根据当前状态决定显示哪个布局 // */ // public void showRightPage(){ // // pageLoading.setVisibility((currentState==PAGE_LOAD_UNDO || currentState==PAGE_LOAD_LOADING)?View.VISIBLE:View.GONE); // // pageEmpty.setVisibility((currentState==PAGE_LOAD_NONE)?View.VISIBLE:View.GONE); // // pageError.setVisibility((currentState==PAGE_LOAD_FAIL)?View.VISIBLE:View.GONE); // // if (pageSuccess==null && currentState==PAGE_LOAD_SUCCESS){ //初始化加载数据成功的布局 // pageSuccess=onCreateSuccessView(); // // if (pageSuccess!=null){ // addView(pageSuccess); // } // } // // if (pageSuccess!=null){ // pageSuccess.setVisibility((currentState==PAGE_LOAD_SUCCESS)?View.VISIBLE:View.GONE); // } // } // // /** // * 数据加载 // */ // public void onLoad(){ // // if (currentState!=PAGE_LOAD_LOADING){ //如果当前没有正在加载数据,就开始加载数据 // currentState=PAGE_LOAD_LOADING; // new Thread(){ // // @Override // public void run() { // final ResultState mState=dataLoad(); // // UIUtils.runOnUiThread(new Runnable() { // @Override // public void run() { // if (mState!=null){ // currentState=mState.getState(); // showRightPage(); // } // } // }); // } // }.start(); // } // } // // /** // * 初始化加载数据成功的布局 // * @return // */ // public abstract View onCreateSuccessView(); // // /** // * 数据加载 返回值表示请求网络结束后的状态 // * @return // */ // public abstract ResultState dataLoad(); // // public enum ResultState{ // // STATE_SUCCESS(PAGE_LOAD_SUCCESS),STATE_ERROR(PAGE_LOAD_FAIL),STATE_EMPTY(PAGE_LOAD_NONE); // // private int state; // private ResultState(int state){ // this.state=state; // } // // public int getState(){ // return this.state; // } // } // // }
import android.view.View; import com.topnews.android.view.LoadingPage;
package com.topnews.android.fragment; /** * Created by dell on 2017/2/25. */ public class TechFragment extends BaseFragment { @Override public View onCreateSuccessView() { return null; } @Override
// Path: app/src/main/java/com/topnews/android/view/LoadingPage.java // public abstract class LoadingPage extends FrameLayout { // // private static final int PAGE_LOAD_UNDO=1; // private static final int PAGE_LOAD_LOADING=2; // private static final int PAGE_LOAD_NONE=3; // private static final int PAGE_LOAD_FAIL=4; // private static final int PAGE_LOAD_SUCCESS=5; // // private int currentState=PAGE_LOAD_UNDO; //当前状态 // // private View pageLoading; // private View pageError; // private View pageEmpty; // private View pageSuccess; // // public LoadingPage(Context context) { // super(context); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs) { // super(context, attrs); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { // super(context, attrs, defStyleAttr, defStyleRes); // // initView(); // } // // /** // * 初始化布局 // * @return // */ // public void initView(){ // // if(pageLoading==null){ //初始化加载中的布局 // pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null); // addView(pageLoading); // } // // if(pageError==null){ //初始化页面加载失败的布局 // pageError = View.inflate(UIUtils.getContext(), R.layout.page_error,null); // // Button btn_error= (Button) pageError.findViewById(R.id.btn_error); // btn_error.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // onLoad(); // } // }); // // addView(pageError); // } // // if (pageEmpty==null){ //初始化加载数据为空的布局 // pageEmpty=View.inflate(UIUtils.getContext(),R.layout.page_empty,null); // addView(pageEmpty); // } // // showRightPage(); // // } // // /** // * 根据当前状态决定显示哪个布局 // */ // public void showRightPage(){ // // pageLoading.setVisibility((currentState==PAGE_LOAD_UNDO || currentState==PAGE_LOAD_LOADING)?View.VISIBLE:View.GONE); // // pageEmpty.setVisibility((currentState==PAGE_LOAD_NONE)?View.VISIBLE:View.GONE); // // pageError.setVisibility((currentState==PAGE_LOAD_FAIL)?View.VISIBLE:View.GONE); // // if (pageSuccess==null && currentState==PAGE_LOAD_SUCCESS){ //初始化加载数据成功的布局 // pageSuccess=onCreateSuccessView(); // // if (pageSuccess!=null){ // addView(pageSuccess); // } // } // // if (pageSuccess!=null){ // pageSuccess.setVisibility((currentState==PAGE_LOAD_SUCCESS)?View.VISIBLE:View.GONE); // } // } // // /** // * 数据加载 // */ // public void onLoad(){ // // if (currentState!=PAGE_LOAD_LOADING){ //如果当前没有正在加载数据,就开始加载数据 // currentState=PAGE_LOAD_LOADING; // new Thread(){ // // @Override // public void run() { // final ResultState mState=dataLoad(); // // UIUtils.runOnUiThread(new Runnable() { // @Override // public void run() { // if (mState!=null){ // currentState=mState.getState(); // showRightPage(); // } // } // }); // } // }.start(); // } // } // // /** // * 初始化加载数据成功的布局 // * @return // */ // public abstract View onCreateSuccessView(); // // /** // * 数据加载 返回值表示请求网络结束后的状态 // * @return // */ // public abstract ResultState dataLoad(); // // public enum ResultState{ // // STATE_SUCCESS(PAGE_LOAD_SUCCESS),STATE_ERROR(PAGE_LOAD_FAIL),STATE_EMPTY(PAGE_LOAD_NONE); // // private int state; // private ResultState(int state){ // this.state=state; // } // // public int getState(){ // return this.state; // } // } // // } // Path: app/src/main/java/com/topnews/android/fragment/TechFragment.java import android.view.View; import com.topnews.android.view.LoadingPage; package com.topnews.android.fragment; /** * Created by dell on 2017/2/25. */ public class TechFragment extends BaseFragment { @Override public View onCreateSuccessView() { return null; } @Override
public LoadingPage.ResultState dataLoad() {
android-jian/topnews
app/src/main/java/com/topnews/android/pager/TopicFragment.java
// Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // }
import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.topnews.android.R; import com.topnews.android.utils.UIUtils;
package com.topnews.android.pager; /** * Created by dell on 2017/3/23. */ public class TopicFragment extends BasePagerFragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // } // Path: app/src/main/java/com/topnews/android/pager/TopicFragment.java import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.topnews.android.R; import com.topnews.android.utils.UIUtils; package com.topnews.android.pager; /** * Created by dell on 2017/3/23. */ public class TopicFragment extends BasePagerFragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=View.inflate(UIUtils.getContext(), R.layout.topic_pager,null);
android-jian/topnews
magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/circlenavigator/CircleNavigator.java
// Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/UIUtil.java // public final class UIUtil { // // public static int dip2px(Context context, double dpValue) { // float density = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * density + 0.5); // } // // public static int getScreenWidth(Context context) { // return context.getResources().getDisplayMetrics().widthPixels; // } // }
import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PointF; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import net.lucode.hackware.magicindicator.abs.IPagerNavigator; import net.lucode.hackware.magicindicator.buildins.UIUtil; import java.util.ArrayList; import java.util.List;
package net.lucode.hackware.magicindicator.buildins.circlenavigator; /** * 圆圈式的指示器 * 博客: http://hackware.lucode.net * Created by hackware on 2016/6/26. */ public class CircleNavigator extends View implements IPagerNavigator { private int mRadius; private int mCircleColor; private int mStrokeWidth; private int mCircleSpacing; private int mCurrentIndex; private int mTotalCount; private Interpolator mStartInterpolator = new LinearInterpolator(); private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private List<PointF> mCirclePoints = new ArrayList<PointF>(); private float mIndicatorX; // 事件回调 private boolean mTouchable; private OnCircleClickListener mCircleClickListener; private float mDownX; private float mDownY; private int mTouchSlop; private boolean mFollowTouch = true; // 是否跟随手指滑动 public CircleNavigator(Context context) { super(context); init(context); } private void init(Context context) { mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
// Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/UIUtil.java // public final class UIUtil { // // public static int dip2px(Context context, double dpValue) { // float density = context.getResources().getDisplayMetrics().density; // return (int) (dpValue * density + 0.5); // } // // public static int getScreenWidth(Context context) { // return context.getResources().getDisplayMetrics().widthPixels; // } // } // Path: magicindicator/src/main/java/net/lucode/hackware/magicindicator/buildins/circlenavigator/CircleNavigator.java import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PointF; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import net.lucode.hackware.magicindicator.abs.IPagerNavigator; import net.lucode.hackware.magicindicator.buildins.UIUtil; import java.util.ArrayList; import java.util.List; package net.lucode.hackware.magicindicator.buildins.circlenavigator; /** * 圆圈式的指示器 * 博客: http://hackware.lucode.net * Created by hackware on 2016/6/26. */ public class CircleNavigator extends View implements IPagerNavigator { private int mRadius; private int mCircleColor; private int mStrokeWidth; private int mCircleSpacing; private int mCurrentIndex; private int mTotalCount; private Interpolator mStartInterpolator = new LinearInterpolator(); private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private List<PointF> mCirclePoints = new ArrayList<PointF>(); private float mIndicatorX; // 事件回调 private boolean mTouchable; private OnCircleClickListener mCircleClickListener; private float mDownX; private float mDownY; private int mTouchSlop; private boolean mFollowTouch = true; // 是否跟随手指滑动 public CircleNavigator(Context context) { super(context); init(context); } private void init(Context context) { mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mRadius = UIUtil.dip2px(context, 3);
android-jian/topnews
app/src/main/java/com/topnews/android/ui/KeepDetailActivity.java
// Path: app/src/main/java/com/topnews/android/gson/KeepInfo.java // public class KeepInfo implements Serializable{ // // private String title; // // private String contentUri; // // private boolean state; // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getContentUri() { // return contentUri; // } // // public void setContentUri(String contentUri) { // this.contentUri = contentUri; // } // // public boolean isState() { // return state; // } // // public void setState(boolean state) { // this.state = state; // } // }
import android.graphics.Bitmap; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import com.topnews.android.R; import com.topnews.android.gson.KeepInfo;
package com.topnews.android.ui; public class KeepDetailActivity extends AppCompatActivity { private Toolbar toolbar; private ProgressBar mProgress; private WebView mWebView;
// Path: app/src/main/java/com/topnews/android/gson/KeepInfo.java // public class KeepInfo implements Serializable{ // // private String title; // // private String contentUri; // // private boolean state; // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getContentUri() { // return contentUri; // } // // public void setContentUri(String contentUri) { // this.contentUri = contentUri; // } // // public boolean isState() { // return state; // } // // public void setState(boolean state) { // this.state = state; // } // } // Path: app/src/main/java/com/topnews/android/ui/KeepDetailActivity.java import android.graphics.Bitmap; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import com.topnews.android.R; import com.topnews.android.gson.KeepInfo; package com.topnews.android.ui; public class KeepDetailActivity extends AppCompatActivity { private Toolbar toolbar; private ProgressBar mProgress; private WebView mWebView;
private KeepInfo keepInfo;
android-jian/topnews
app/src/main/java/com/topnews/android/fragment/PlayFragment.java
// Path: app/src/main/java/com/topnews/android/view/LoadingPage.java // public abstract class LoadingPage extends FrameLayout { // // private static final int PAGE_LOAD_UNDO=1; // private static final int PAGE_LOAD_LOADING=2; // private static final int PAGE_LOAD_NONE=3; // private static final int PAGE_LOAD_FAIL=4; // private static final int PAGE_LOAD_SUCCESS=5; // // private int currentState=PAGE_LOAD_UNDO; //当前状态 // // private View pageLoading; // private View pageError; // private View pageEmpty; // private View pageSuccess; // // public LoadingPage(Context context) { // super(context); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs) { // super(context, attrs); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { // super(context, attrs, defStyleAttr, defStyleRes); // // initView(); // } // // /** // * 初始化布局 // * @return // */ // public void initView(){ // // if(pageLoading==null){ //初始化加载中的布局 // pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null); // addView(pageLoading); // } // // if(pageError==null){ //初始化页面加载失败的布局 // pageError = View.inflate(UIUtils.getContext(), R.layout.page_error,null); // // Button btn_error= (Button) pageError.findViewById(R.id.btn_error); // btn_error.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // onLoad(); // } // }); // // addView(pageError); // } // // if (pageEmpty==null){ //初始化加载数据为空的布局 // pageEmpty=View.inflate(UIUtils.getContext(),R.layout.page_empty,null); // addView(pageEmpty); // } // // showRightPage(); // // } // // /** // * 根据当前状态决定显示哪个布局 // */ // public void showRightPage(){ // // pageLoading.setVisibility((currentState==PAGE_LOAD_UNDO || currentState==PAGE_LOAD_LOADING)?View.VISIBLE:View.GONE); // // pageEmpty.setVisibility((currentState==PAGE_LOAD_NONE)?View.VISIBLE:View.GONE); // // pageError.setVisibility((currentState==PAGE_LOAD_FAIL)?View.VISIBLE:View.GONE); // // if (pageSuccess==null && currentState==PAGE_LOAD_SUCCESS){ //初始化加载数据成功的布局 // pageSuccess=onCreateSuccessView(); // // if (pageSuccess!=null){ // addView(pageSuccess); // } // } // // if (pageSuccess!=null){ // pageSuccess.setVisibility((currentState==PAGE_LOAD_SUCCESS)?View.VISIBLE:View.GONE); // } // } // // /** // * 数据加载 // */ // public void onLoad(){ // // if (currentState!=PAGE_LOAD_LOADING){ //如果当前没有正在加载数据,就开始加载数据 // currentState=PAGE_LOAD_LOADING; // new Thread(){ // // @Override // public void run() { // final ResultState mState=dataLoad(); // // UIUtils.runOnUiThread(new Runnable() { // @Override // public void run() { // if (mState!=null){ // currentState=mState.getState(); // showRightPage(); // } // } // }); // } // }.start(); // } // } // // /** // * 初始化加载数据成功的布局 // * @return // */ // public abstract View onCreateSuccessView(); // // /** // * 数据加载 返回值表示请求网络结束后的状态 // * @return // */ // public abstract ResultState dataLoad(); // // public enum ResultState{ // // STATE_SUCCESS(PAGE_LOAD_SUCCESS),STATE_ERROR(PAGE_LOAD_FAIL),STATE_EMPTY(PAGE_LOAD_NONE); // // private int state; // private ResultState(int state){ // this.state=state; // } // // public int getState(){ // return this.state; // } // } // // }
import android.view.View; import com.topnews.android.view.LoadingPage;
package com.topnews.android.fragment; /** * Created by dell on 2017/2/25. */ public class PlayFragment extends BaseFragment { @Override public View onCreateSuccessView() { return null; } @Override
// Path: app/src/main/java/com/topnews/android/view/LoadingPage.java // public abstract class LoadingPage extends FrameLayout { // // private static final int PAGE_LOAD_UNDO=1; // private static final int PAGE_LOAD_LOADING=2; // private static final int PAGE_LOAD_NONE=3; // private static final int PAGE_LOAD_FAIL=4; // private static final int PAGE_LOAD_SUCCESS=5; // // private int currentState=PAGE_LOAD_UNDO; //当前状态 // // private View pageLoading; // private View pageError; // private View pageEmpty; // private View pageSuccess; // // public LoadingPage(Context context) { // super(context); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs) { // super(context, attrs); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // // initView(); // } // // public LoadingPage(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int currentState) { // super(context, attrs, defStyleAttr, defStyleRes); // // initView(); // } // // /** // * 初始化布局 // * @return // */ // public void initView(){ // // if(pageLoading==null){ //初始化加载中的布局 // pageLoading = View.inflate(UIUtils.getContext(), R.layout.page_loading,null); // addView(pageLoading); // } // // if(pageError==null){ //初始化页面加载失败的布局 // pageError = View.inflate(UIUtils.getContext(), R.layout.page_error,null); // // Button btn_error= (Button) pageError.findViewById(R.id.btn_error); // btn_error.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // onLoad(); // } // }); // // addView(pageError); // } // // if (pageEmpty==null){ //初始化加载数据为空的布局 // pageEmpty=View.inflate(UIUtils.getContext(),R.layout.page_empty,null); // addView(pageEmpty); // } // // showRightPage(); // // } // // /** // * 根据当前状态决定显示哪个布局 // */ // public void showRightPage(){ // // pageLoading.setVisibility((currentState==PAGE_LOAD_UNDO || currentState==PAGE_LOAD_LOADING)?View.VISIBLE:View.GONE); // // pageEmpty.setVisibility((currentState==PAGE_LOAD_NONE)?View.VISIBLE:View.GONE); // // pageError.setVisibility((currentState==PAGE_LOAD_FAIL)?View.VISIBLE:View.GONE); // // if (pageSuccess==null && currentState==PAGE_LOAD_SUCCESS){ //初始化加载数据成功的布局 // pageSuccess=onCreateSuccessView(); // // if (pageSuccess!=null){ // addView(pageSuccess); // } // } // // if (pageSuccess!=null){ // pageSuccess.setVisibility((currentState==PAGE_LOAD_SUCCESS)?View.VISIBLE:View.GONE); // } // } // // /** // * 数据加载 // */ // public void onLoad(){ // // if (currentState!=PAGE_LOAD_LOADING){ //如果当前没有正在加载数据,就开始加载数据 // currentState=PAGE_LOAD_LOADING; // new Thread(){ // // @Override // public void run() { // final ResultState mState=dataLoad(); // // UIUtils.runOnUiThread(new Runnable() { // @Override // public void run() { // if (mState!=null){ // currentState=mState.getState(); // showRightPage(); // } // } // }); // } // }.start(); // } // } // // /** // * 初始化加载数据成功的布局 // * @return // */ // public abstract View onCreateSuccessView(); // // /** // * 数据加载 返回值表示请求网络结束后的状态 // * @return // */ // public abstract ResultState dataLoad(); // // public enum ResultState{ // // STATE_SUCCESS(PAGE_LOAD_SUCCESS),STATE_ERROR(PAGE_LOAD_FAIL),STATE_EMPTY(PAGE_LOAD_NONE); // // private int state; // private ResultState(int state){ // this.state=state; // } // // public int getState(){ // return this.state; // } // } // // } // Path: app/src/main/java/com/topnews/android/fragment/PlayFragment.java import android.view.View; import com.topnews.android.view.LoadingPage; package com.topnews.android.fragment; /** * Created by dell on 2017/2/25. */ public class PlayFragment extends BaseFragment { @Override public View onCreateSuccessView() { return null; } @Override
public LoadingPage.ResultState dataLoad() {
android-jian/topnews
app/src/main/java/com/topnews/android/ui/SplashActivity.java
// Path: app/src/main/java/com/topnews/android/ui/HomeActivity.java // public class HomeActivity extends AppCompatActivity { // // private NoScrollViewPager vp_content; // // private RadioGroup rg_group; // private Toolbar toolbar; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_home); // // toolbar = (Toolbar) findViewById(R.id.toolBar); // rg_group = (RadioGroup) findViewById(R.id.rg_group); // vp_content = (NoScrollViewPager) findViewById(R.id.vp_content); // // setSupportActionBar(toolbar); // // MyFragmentAdapter adapter=new MyFragmentAdapter(getSupportFragmentManager()); // vp_content.setAdapter(adapter); // vp_content.setOffscreenPageLimit(3); // // rg_group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // // switch (checkedId){ // case R.id.btn_home: // vp_content.setCurrentItem(0); // break; // // case R.id.btn_talking: // vp_content.setCurrentItem(1); // break; // // case R.id.btn_topic: // vp_content.setCurrentItem(2); // break; // // case R.id.btn_setting: // vp_content.setCurrentItem(3); // break; // // default: // break; // } // } // }); // // } // // public class MyFragmentAdapter extends FragmentPagerAdapter { // // public MyFragmentAdapter(FragmentManager fm) { // super(fm); // } // // @Override // public Fragment getItem(int position) { // // BasePagerFragment fragment= BasePagerFactory.creatFragment(position); // // return fragment; // } // // @Override // public int getCount() { // return 4; // } // // } // // }
import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.SystemClock; import com.topnews.android.R; import com.topnews.android.ui.HomeActivity;
package com.topnews.android.ui; public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Thread(){ @Override public void run() { SystemClock.sleep(2000); enterHome(); } }.start(); } /** * 进入主界面 销毁当前activity */ private void enterHome(){
// Path: app/src/main/java/com/topnews/android/ui/HomeActivity.java // public class HomeActivity extends AppCompatActivity { // // private NoScrollViewPager vp_content; // // private RadioGroup rg_group; // private Toolbar toolbar; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_home); // // toolbar = (Toolbar) findViewById(R.id.toolBar); // rg_group = (RadioGroup) findViewById(R.id.rg_group); // vp_content = (NoScrollViewPager) findViewById(R.id.vp_content); // // setSupportActionBar(toolbar); // // MyFragmentAdapter adapter=new MyFragmentAdapter(getSupportFragmentManager()); // vp_content.setAdapter(adapter); // vp_content.setOffscreenPageLimit(3); // // rg_group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // // switch (checkedId){ // case R.id.btn_home: // vp_content.setCurrentItem(0); // break; // // case R.id.btn_talking: // vp_content.setCurrentItem(1); // break; // // case R.id.btn_topic: // vp_content.setCurrentItem(2); // break; // // case R.id.btn_setting: // vp_content.setCurrentItem(3); // break; // // default: // break; // } // } // }); // // } // // public class MyFragmentAdapter extends FragmentPagerAdapter { // // public MyFragmentAdapter(FragmentManager fm) { // super(fm); // } // // @Override // public Fragment getItem(int position) { // // BasePagerFragment fragment= BasePagerFactory.creatFragment(position); // // return fragment; // } // // @Override // public int getCount() { // return 4; // } // // } // // } // Path: app/src/main/java/com/topnews/android/ui/SplashActivity.java import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.SystemClock; import com.topnews.android.R; import com.topnews.android.ui.HomeActivity; package com.topnews.android.ui; public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Thread(){ @Override public void run() { SystemClock.sleep(2000); enterHome(); } }.start(); } /** * 进入主界面 销毁当前activity */ private void enterHome(){
Intent intent=new Intent(this,HomeActivity.class);
android-jian/topnews
app/src/main/java/com/topnews/android/ui/LoginActivity.java
// Path: app/src/main/java/com/topnews/android/gson/MyUser.java // public class MyUser extends BmobUser implements Serializable{ // // private String icon; //我的头像 // // private List<KeepInfo> keep; //我的收藏 // // public String getIcon() { // return icon; // } // // public void setIcon(String icon) { // this.icon = icon; // } // // public List<KeepInfo> getKeep() { // return keep; // } // // public void setKeep(List<KeepInfo> keep) { // this.keep = keep; // } // }
import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.gson.MyUser; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.LogInListener;
package com.topnews.android.ui; public class LoginActivity extends AppCompatActivity { private EditText mUserName,mPassword; private Button mLogin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mUserName= (EditText) findViewById(R.id.login_email_phone); mPassword= (EditText) findViewById(R.id.login_password); mLogin= (Button) findViewById(R.id.btn_login); mLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (TextUtils.isEmpty(mUserName.getText()) || TextUtils.isEmpty(mPassword.getText())){ Toast.makeText(LoginActivity.this,"请输入登录账号或密码",Toast.LENGTH_SHORT).show(); return; } String loginAccount=mUserName.getText().toString().trim(); String loginPassword=mPassword.getText().toString().trim();
// Path: app/src/main/java/com/topnews/android/gson/MyUser.java // public class MyUser extends BmobUser implements Serializable{ // // private String icon; //我的头像 // // private List<KeepInfo> keep; //我的收藏 // // public String getIcon() { // return icon; // } // // public void setIcon(String icon) { // this.icon = icon; // } // // public List<KeepInfo> getKeep() { // return keep; // } // // public void setKeep(List<KeepInfo> keep) { // this.keep = keep; // } // } // Path: app/src/main/java/com/topnews/android/ui/LoginActivity.java import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.gson.MyUser; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.LogInListener; package com.topnews.android.ui; public class LoginActivity extends AppCompatActivity { private EditText mUserName,mPassword; private Button mLogin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mUserName= (EditText) findViewById(R.id.login_email_phone); mPassword= (EditText) findViewById(R.id.login_password); mLogin= (Button) findViewById(R.id.btn_login); mLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (TextUtils.isEmpty(mUserName.getText()) || TextUtils.isEmpty(mPassword.getText())){ Toast.makeText(LoginActivity.this,"请输入登录账号或密码",Toast.LENGTH_SHORT).show(); return; } String loginAccount=mUserName.getText().toString().trim(); String loginPassword=mPassword.getText().toString().trim();
BmobUser.loginByAccount(loginAccount, loginPassword, new LogInListener<MyUser>() {
android-jian/topnews
app/src/main/java/com/topnews/android/ui/NewsDetailActivity.java
// Path: app/src/main/java/com/topnews/android/gson/KeepInfo.java // public class KeepInfo implements Serializable{ // // private String title; // // private String contentUri; // // private boolean state; // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getContentUri() { // return contentUri; // } // // public void setContentUri(String contentUri) { // this.contentUri = contentUri; // } // // public boolean isState() { // return state; // } // // public void setState(boolean state) { // this.state = state; // } // } // // Path: app/src/main/java/com/topnews/android/gson/MyUser.java // public class MyUser extends BmobUser implements Serializable{ // // private String icon; //我的头像 // // private List<KeepInfo> keep; //我的收藏 // // public String getIcon() { // return icon; // } // // public void setIcon(String icon) { // this.icon = icon; // } // // public List<KeepInfo> getKeep() { // return keep; // } // // public void setKeep(List<KeepInfo> keep) { // this.keep = keep; // } // } // // Path: app/src/main/java/com/topnews/android/gson/TopInfo.java // public class TopInfo implements Serializable{ // // public String id; // // public String title; // // public String source; // // public String imgeUrl; // // public String ContentUrl; // // public int curPage; //当前页面 // // @Override // public boolean equals(Object obj) { // // if (!(obj instanceof TopInfo)) // return false; // // TopInfo info= (TopInfo) obj; // // return this.title.equals(info.title); // } // } // // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // }
import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Rect; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.gson.KeepInfo; import com.topnews.android.gson.MyUser; import com.topnews.android.gson.TopInfo; import com.topnews.android.utils.UIUtils; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.UpdateListener; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare;
package com.topnews.android.ui; public class NewsDetailActivity extends AppCompatActivity { private Toolbar toolbar; private ProgressBar mProgress; private WebView mWebView;
// Path: app/src/main/java/com/topnews/android/gson/KeepInfo.java // public class KeepInfo implements Serializable{ // // private String title; // // private String contentUri; // // private boolean state; // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getContentUri() { // return contentUri; // } // // public void setContentUri(String contentUri) { // this.contentUri = contentUri; // } // // public boolean isState() { // return state; // } // // public void setState(boolean state) { // this.state = state; // } // } // // Path: app/src/main/java/com/topnews/android/gson/MyUser.java // public class MyUser extends BmobUser implements Serializable{ // // private String icon; //我的头像 // // private List<KeepInfo> keep; //我的收藏 // // public String getIcon() { // return icon; // } // // public void setIcon(String icon) { // this.icon = icon; // } // // public List<KeepInfo> getKeep() { // return keep; // } // // public void setKeep(List<KeepInfo> keep) { // this.keep = keep; // } // } // // Path: app/src/main/java/com/topnews/android/gson/TopInfo.java // public class TopInfo implements Serializable{ // // public String id; // // public String title; // // public String source; // // public String imgeUrl; // // public String ContentUrl; // // public int curPage; //当前页面 // // @Override // public boolean equals(Object obj) { // // if (!(obj instanceof TopInfo)) // return false; // // TopInfo info= (TopInfo) obj; // // return this.title.equals(info.title); // } // } // // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // } // Path: app/src/main/java/com/topnews/android/ui/NewsDetailActivity.java import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Rect; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import android.widget.Toast; import com.topnews.android.R; import com.topnews.android.gson.KeepInfo; import com.topnews.android.gson.MyUser; import com.topnews.android.gson.TopInfo; import com.topnews.android.utils.UIUtils; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import cn.bmob.v3.BmobUser; import cn.bmob.v3.exception.BmobException; import cn.bmob.v3.listener.UpdateListener; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare; package com.topnews.android.ui; public class NewsDetailActivity extends AppCompatActivity { private Toolbar toolbar; private ProgressBar mProgress; private WebView mWebView;
private TopInfo topInfo;
android-jian/topnews
app/src/main/java/com/topnews/android/keepfragment/KeepTwoFragment.java
// Path: app/src/main/java/com/topnews/android/adapter/KeepTwoAdapter.java // public class KeepTwoAdapter extends RecyclerView.Adapter<KeepTwoAdapter.ViewHolder>{ // // private List<String> mDatas; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // private final TextView mContent; // private final SwipeLayout mSwipe; // private final TextView mDelete; // // public ViewHolder(View itemView) { // super(itemView); // // mContent = (TextView) itemView.findViewById(R.id.tv_content); // mSwipe = (SwipeLayout) itemView.findViewById(R.id.swipe_layout); // mDelete= (TextView) itemView.findViewById(R.id.tv_delete); // } // } // // public KeepTwoAdapter(List<String> mDatas){ // // this.mDatas=mDatas; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_keep_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.mContent.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // } // }); // // holder.mDelete.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // SwipeLayoutManager.getInstance().clearSwipeLayout(); // holder.mSwipe.setCurrentState(SwipeLayout.STATE_CLOSE); // mDatas.remove(holder.getAdapterPosition()); // // notifyItemRemoved(holder.getAdapterPosition()); // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // String data = mDatas.get(position); // holder.mContent.setText(data); // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // // } // // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // }
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.topnews.android.R; import com.topnews.android.adapter.KeepTwoAdapter; import com.topnews.android.utils.UIUtils; import java.util.ArrayList; import java.util.List;
package com.topnews.android.keepfragment; /** * Created by dell on 2017/3/28. * * 用户收藏页-专题 */ public class KeepTwoFragment extends BaseKeepFragment { private List<String> mDatas; private RecyclerView mRecycler; @Override public void dataLoad() { mDatas = new ArrayList<String>(); for (int i=0;i<60;i++){ mDatas.add("这是第"+i+"条测试数据"); } setCurState(DATA_LOAD_SUCCESS); } @Override public View onSuccessView() {
// Path: app/src/main/java/com/topnews/android/adapter/KeepTwoAdapter.java // public class KeepTwoAdapter extends RecyclerView.Adapter<KeepTwoAdapter.ViewHolder>{ // // private List<String> mDatas; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // private final TextView mContent; // private final SwipeLayout mSwipe; // private final TextView mDelete; // // public ViewHolder(View itemView) { // super(itemView); // // mContent = (TextView) itemView.findViewById(R.id.tv_content); // mSwipe = (SwipeLayout) itemView.findViewById(R.id.swipe_layout); // mDelete= (TextView) itemView.findViewById(R.id.tv_delete); // } // } // // public KeepTwoAdapter(List<String> mDatas){ // // this.mDatas=mDatas; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_keep_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.mContent.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // } // }); // // holder.mDelete.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // SwipeLayoutManager.getInstance().clearSwipeLayout(); // holder.mSwipe.setCurrentState(SwipeLayout.STATE_CLOSE); // mDatas.remove(holder.getAdapterPosition()); // // notifyItemRemoved(holder.getAdapterPosition()); // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // String data = mDatas.get(position); // holder.mContent.setText(data); // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // // } // // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // } // Path: app/src/main/java/com/topnews/android/keepfragment/KeepTwoFragment.java import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.topnews.android.R; import com.topnews.android.adapter.KeepTwoAdapter; import com.topnews.android.utils.UIUtils; import java.util.ArrayList; import java.util.List; package com.topnews.android.keepfragment; /** * Created by dell on 2017/3/28. * * 用户收藏页-专题 */ public class KeepTwoFragment extends BaseKeepFragment { private List<String> mDatas; private RecyclerView mRecycler; @Override public void dataLoad() { mDatas = new ArrayList<String>(); for (int i=0;i<60;i++){ mDatas.add("这是第"+i+"条测试数据"); } setCurState(DATA_LOAD_SUCCESS); } @Override public View onSuccessView() {
View view=View.inflate(UIUtils.getContext(), R.layout.user_keep,null);
android-jian/topnews
app/src/main/java/com/topnews/android/keepfragment/KeepTwoFragment.java
// Path: app/src/main/java/com/topnews/android/adapter/KeepTwoAdapter.java // public class KeepTwoAdapter extends RecyclerView.Adapter<KeepTwoAdapter.ViewHolder>{ // // private List<String> mDatas; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // private final TextView mContent; // private final SwipeLayout mSwipe; // private final TextView mDelete; // // public ViewHolder(View itemView) { // super(itemView); // // mContent = (TextView) itemView.findViewById(R.id.tv_content); // mSwipe = (SwipeLayout) itemView.findViewById(R.id.swipe_layout); // mDelete= (TextView) itemView.findViewById(R.id.tv_delete); // } // } // // public KeepTwoAdapter(List<String> mDatas){ // // this.mDatas=mDatas; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_keep_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.mContent.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // } // }); // // holder.mDelete.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // SwipeLayoutManager.getInstance().clearSwipeLayout(); // holder.mSwipe.setCurrentState(SwipeLayout.STATE_CLOSE); // mDatas.remove(holder.getAdapterPosition()); // // notifyItemRemoved(holder.getAdapterPosition()); // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // String data = mDatas.get(position); // holder.mContent.setText(data); // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // // } // // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // }
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.topnews.android.R; import com.topnews.android.adapter.KeepTwoAdapter; import com.topnews.android.utils.UIUtils; import java.util.ArrayList; import java.util.List;
package com.topnews.android.keepfragment; /** * Created by dell on 2017/3/28. * * 用户收藏页-专题 */ public class KeepTwoFragment extends BaseKeepFragment { private List<String> mDatas; private RecyclerView mRecycler; @Override public void dataLoad() { mDatas = new ArrayList<String>(); for (int i=0;i<60;i++){ mDatas.add("这是第"+i+"条测试数据"); } setCurState(DATA_LOAD_SUCCESS); } @Override public View onSuccessView() { View view=View.inflate(UIUtils.getContext(), R.layout.user_keep,null); mRecycler = (RecyclerView) view.findViewById(R.id.recycler_view); LinearLayoutManager manager=new LinearLayoutManager(UIUtils.getContext()); mRecycler.setLayoutManager(manager);
// Path: app/src/main/java/com/topnews/android/adapter/KeepTwoAdapter.java // public class KeepTwoAdapter extends RecyclerView.Adapter<KeepTwoAdapter.ViewHolder>{ // // private List<String> mDatas; // // static class ViewHolder extends RecyclerView.ViewHolder{ // // private final TextView mContent; // private final SwipeLayout mSwipe; // private final TextView mDelete; // // public ViewHolder(View itemView) { // super(itemView); // // mContent = (TextView) itemView.findViewById(R.id.tv_content); // mSwipe = (SwipeLayout) itemView.findViewById(R.id.swipe_layout); // mDelete= (TextView) itemView.findViewById(R.id.tv_delete); // } // } // // public KeepTwoAdapter(List<String> mDatas){ // // this.mDatas=mDatas; // } // // @Override // public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // // View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_keep_item,parent,false); // final ViewHolder holder=new ViewHolder(view); // // holder.mContent.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // } // }); // // holder.mDelete.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // SwipeLayoutManager.getInstance().closeCurrentLayout(); // SwipeLayoutManager.getInstance().clearSwipeLayout(); // holder.mSwipe.setCurrentState(SwipeLayout.STATE_CLOSE); // mDatas.remove(holder.getAdapterPosition()); // // notifyItemRemoved(holder.getAdapterPosition()); // } // }); // // return holder; // } // // @Override // public void onBindViewHolder(ViewHolder holder, int position) { // // String data = mDatas.get(position); // holder.mContent.setText(data); // } // // @Override // public int getItemCount() { // return mDatas.size(); // } // // } // // Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // } // Path: app/src/main/java/com/topnews/android/keepfragment/KeepTwoFragment.java import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import com.topnews.android.R; import com.topnews.android.adapter.KeepTwoAdapter; import com.topnews.android.utils.UIUtils; import java.util.ArrayList; import java.util.List; package com.topnews.android.keepfragment; /** * Created by dell on 2017/3/28. * * 用户收藏页-专题 */ public class KeepTwoFragment extends BaseKeepFragment { private List<String> mDatas; private RecyclerView mRecycler; @Override public void dataLoad() { mDatas = new ArrayList<String>(); for (int i=0;i<60;i++){ mDatas.add("这是第"+i+"条测试数据"); } setCurState(DATA_LOAD_SUCCESS); } @Override public View onSuccessView() { View view=View.inflate(UIUtils.getContext(), R.layout.user_keep,null); mRecycler = (RecyclerView) view.findViewById(R.id.recycler_view); LinearLayoutManager manager=new LinearLayoutManager(UIUtils.getContext()); mRecycler.setLayoutManager(manager);
mRecycler.setAdapter(new KeepTwoAdapter(mDatas));
android-jian/topnews
app/src/main/java/com/topnews/android/ui/UserKeepActivity.java
// Path: app/src/main/java/com/topnews/android/keepfragment/KeepFragmentAdapter.java // public class KeepFragmentAdapter extends FragmentPagerAdapter { // // private final String[] mTabNames; // // public KeepFragmentAdapter(FragmentManager fm) { // super(fm); // // mTabNames = new String[]{"文章","专题","跟帖"}; // } // // @Override // public Fragment getItem(int position) { // // BaseKeepFragment fragment=KeepFragmentFactory.creatFragment(position); // // return fragment; // } // // @Override // public int getCount() { // return mTabNames.length; // } // // @Override // public CharSequence getPageTitle(int position) { // // return mTabNames[position]; // } // }
import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import com.topnews.android.R; import com.topnews.android.keepfragment.KeepFragmentAdapter;
package com.topnews.android.ui; public class UserKeepActivity extends AppCompatActivity { private Toolbar toolbar; private TabLayout mTabLayout; private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_keep); mTabLayout = (TabLayout) findViewById(R.id.keep_tab_layout); mViewPager = (ViewPager) findViewById(R.id.keep_view_pager); toolbar = (Toolbar) findViewById(R.id.keep_toolBar); setSupportActionBar(toolbar);
// Path: app/src/main/java/com/topnews/android/keepfragment/KeepFragmentAdapter.java // public class KeepFragmentAdapter extends FragmentPagerAdapter { // // private final String[] mTabNames; // // public KeepFragmentAdapter(FragmentManager fm) { // super(fm); // // mTabNames = new String[]{"文章","专题","跟帖"}; // } // // @Override // public Fragment getItem(int position) { // // BaseKeepFragment fragment=KeepFragmentFactory.creatFragment(position); // // return fragment; // } // // @Override // public int getCount() { // return mTabNames.length; // } // // @Override // public CharSequence getPageTitle(int position) { // // return mTabNames[position]; // } // } // Path: app/src/main/java/com/topnews/android/ui/UserKeepActivity.java import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import com.topnews.android.R; import com.topnews.android.keepfragment.KeepFragmentAdapter; package com.topnews.android.ui; public class UserKeepActivity extends AppCompatActivity { private Toolbar toolbar; private TabLayout mTabLayout; private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_keep); mTabLayout = (TabLayout) findViewById(R.id.keep_tab_layout); mViewPager = (ViewPager) findViewById(R.id.keep_view_pager); toolbar = (Toolbar) findViewById(R.id.keep_toolBar); setSupportActionBar(toolbar);
mViewPager.setAdapter(new KeepFragmentAdapter(getSupportFragmentManager()));
android-jian/topnews
app/src/main/java/com/topnews/android/keepfragment/BaseKeepFragment.java
// Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // }
import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.topnews.android.R; import com.topnews.android.utils.UIUtils;
package com.topnews.android.keepfragment; /** * Created by dell on 2017/3/28. */ public abstract class BaseKeepFragment extends Fragment { public static final int DATA_LOADING=0; //数据正在加载 public static final int DATA_LOAD_SUCCESS=1; //数据加载成功 public static final int DATA_LOAD_ERROR=2; //数据加载失败 public static final int DATA_LOAD_NONE=3; //数据加载为空 public int curState=DATA_LOADING; //默认为正在加载 private FrameLayout mKeep; //动态加载页面 private View keepLoading; private View loadError; private View loadNone; private View loadSuccess; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// Path: app/src/main/java/com/topnews/android/utils/UIUtils.java // public class UIUtils { // // /** // * 获取上下文对象 // * @return // */ // public static Context getContext(){ // // return BaseApplication.getmContext(); // } // // /** // * 获取主线程id // * @return // */ // public static int getMainThreadId(){ // return BaseApplication.getMainThreadId(); // } // // /** // * 获取handler实例 // * @return // */ // public static Handler getHandler(){ // return BaseApplication.getmHandler(); // } // // /** // * 判断当前是否运行在主线程 // * @return // */ // public static boolean isRunOnUiThread(){ // return getMainThreadId()==android.os.Process.myTid(); // } // // /** // * 确保当前的操作运行在UI主线程 // * @param runnable // */ // public static void runOnUiThread(Runnable runnable){ // if(isRunOnUiThread()){ // runOnUiThread(runnable); // }else{ // getHandler().post(runnable); // } // } // // /** // * 获取字符串数组 // * @param id // * @return // */ // public static String[] getStringArray(int id){ // return getContext().getResources().getStringArray(id); // } // // /** // * dp转px // * @param dp // * @return // */ // public static int dip2px(int dp){ // int mDensity=(int) getContext().getResources().getDisplayMetrics().density; // return dp*mDensity; // } // // /** // * px转dp // * @param px // * @return // */ // public static float px2dip(int px){ // float mDensity=getContext().getResources().getDisplayMetrics().density; // return px/mDensity; // } // } // Path: app/src/main/java/com/topnews/android/keepfragment/BaseKeepFragment.java import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.topnews.android.R; import com.topnews.android.utils.UIUtils; package com.topnews.android.keepfragment; /** * Created by dell on 2017/3/28. */ public abstract class BaseKeepFragment extends Fragment { public static final int DATA_LOADING=0; //数据正在加载 public static final int DATA_LOAD_SUCCESS=1; //数据加载成功 public static final int DATA_LOAD_ERROR=2; //数据加载失败 public static final int DATA_LOAD_NONE=3; //数据加载为空 public int curState=DATA_LOADING; //默认为正在加载 private FrameLayout mKeep; //动态加载页面 private View keepLoading; private View loadError; private View loadNone; private View loadSuccess; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=View.inflate(UIUtils.getContext(),R.layout.keep_total,null);