hexsha
stringlengths
40
40
size
int64
8
1.04M
content
stringlengths
8
1.04M
avg_line_length
float64
2.24
100
max_line_length
int64
4
1k
alphanum_fraction
float64
0.25
0.97
ee147e5648e0958c681ab2e2ca88246535c8bd21
22,808
/* * Copyright (c) 2020, itofu1 * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.questhelper.quests.creatureoffenkenstrain; import com.questhelper.ItemCollections; import com.questhelper.QuestDescriptor; import com.questhelper.QuestHelperQuest; import com.questhelper.Zone; import com.questhelper.banktab.BankSlotIcons; import com.questhelper.panel.PanelDetails; import com.questhelper.questhelpers.BasicQuestHelper; import com.questhelper.requirements.ItemRequirement; import com.questhelper.requirements.ItemRequirements; import com.questhelper.requirements.QuestRequirement; import com.questhelper.requirements.Requirement; import com.questhelper.requirements.SkillRequirement; import com.questhelper.requirements.util.LogicType; import com.questhelper.steps.ConditionalStep; import com.questhelper.steps.DetailedQuestStep; import com.questhelper.steps.DigStep; import com.questhelper.steps.ItemStep; import com.questhelper.steps.NpcStep; import com.questhelper.steps.ObjectStep; import com.questhelper.steps.QuestStep; import com.questhelper.requirements.conditional.*; import net.runelite.api.ItemID; import net.runelite.api.NpcID; import net.runelite.api.ObjectID; import net.runelite.api.QuestState; import net.runelite.api.Skill; import net.runelite.api.coords.WorldPoint; import java.util.*; @QuestDescriptor( quest = QuestHelperQuest.CREATURE_OF_FENKENSTRAIN ) public class CreatureOfFenkenstrain extends BasicQuestHelper { ItemRequirement armor, hammer, ghostSpeakAmulet, silverBar, bronzeWire, needle, thread, spade, coins, telegrabOrCoins, pickledBrain, obsidianAmulet, marbleAmulet, starAmulet, decapitatedHead, decapitatedHeadWithBrain, cavernKey, torso, legs, arms, shedKey, brush, canes, extendedBrush3, conductorMould, lightningRod, towerKey, fenkenstrainTeleports, teleportToFurnance, staminaPotion; Zone barZone, castleZoneFloor0, castleZoneFloor1, experimentCave, graveIsland, castleTower, monsterTower; ConditionForStep hasPickledBrain, inCanifisBar, inCastleFloor0, inCastleFloor1, hasObsidianAmulet, hasMarbleAmulet, hasStarAmulet, hasGhostSpeakAmulet, followingGardenerForHead, hasDecapitatedHead, hasDecapitatedHeadWithBrain, putStarOnGrave, inExperiementCave, hasCavernKey, hasTorso, hasLegs, hasArm, inGraveIsland, hasShedKey, usedShedKey, hasBrush, hasBrush3, hasCanes, hasLightningRod, hasMould, inCastleTower, usedTowerKey, hasTowerKey, inMonsterTower, keyNearby; QuestStep getPickledBrain, talkToFrenkenstrain, goUpstairsForStar, getBook1, getBook2, combineAmulet, pickupKey, goDownstairsForStar, talkToGardenerForHead, goToHeadGrave, combinedHead, useStarOnGrave, killExperiment, leaveExperimentCave, getTorso, getArm, getLeg, deliverBodyParts, gatherNeedleAndThread, talkToGardenerForKey, searchForBrush, grabCanes, extendBrush, goUpWestStairs, searchFirePlace, makeLightningRod, goUpWestStairsWithRod, goUpTowerLadder, repairConductor, goBackToFirstFloor, talkToFenkenstrainAfterFixingRod, goToMonsterFloor1, openLockedDoor, goToMonsterFloor2, talkToMonster, pickPocketFenkenstrain, enterExperimentCave; @Override public Map<Integer, QuestStep> loadSteps() { setupItemRequirements(); setupZones(); setupConditions(); setupSteps(); Map<Integer, QuestStep> steps = new HashMap<>(); ConditionalStep grabTheBrain = new ConditionalStep(this, getPickledBrain); grabTheBrain.addStep(hasPickledBrain, talkToFrenkenstrain); steps.put(0, grabTheBrain); ConditionalStep gatherBodyParts = new ConditionalStep(this, goUpstairsForStar); gatherBodyParts.addStep(new Conditions(hasDecapitatedHeadWithBrain, hasArm, hasLegs, hasTorso), deliverBodyParts); gatherBodyParts.addStep(new Conditions(inGraveIsland, hasTorso, hasArm, hasDecapitatedHeadWithBrain), getLeg); gatherBodyParts.addStep(new Conditions(inGraveIsland, hasTorso, hasDecapitatedHeadWithBrain), getArm); gatherBodyParts.addStep(new Conditions(inGraveIsland, hasDecapitatedHeadWithBrain), getTorso); gatherBodyParts.addStep(new Conditions(inExperiementCave, hasDecapitatedHeadWithBrain, hasCavernKey), leaveExperimentCave); gatherBodyParts.addStep(new Conditions(inExperiementCave, hasDecapitatedHeadWithBrain, keyNearby), pickupKey); gatherBodyParts.addStep(new Conditions(inExperiementCave, hasDecapitatedHeadWithBrain), killExperiment); gatherBodyParts.addStep(new Conditions(hasDecapitatedHeadWithBrain, putStarOnGrave), enterExperimentCave); gatherBodyParts.addStep(new Conditions(hasDecapitatedHeadWithBrain, hasStarAmulet), useStarOnGrave); gatherBodyParts.addStep(new Conditions(hasDecapitatedHead, hasPickledBrain), combinedHead); gatherBodyParts.addStep(new Conditions(hasDecapitatedHead), getPickledBrain); gatherBodyParts.addStep(followingGardenerForHead, goToHeadGrave); gatherBodyParts.addStep(new Conditions(inCastleFloor1, hasStarAmulet), goDownstairsForStar); gatherBodyParts.addStep(new Conditions(hasStarAmulet), talkToGardenerForHead); gatherBodyParts.addStep(new Conditions(hasObsidianAmulet, hasMarbleAmulet), combineAmulet); gatherBodyParts.addStep(new Conditions(inCastleFloor1, hasObsidianAmulet), getBook2); gatherBodyParts.addStep(new Conditions(inCastleFloor1), getBook1); ConditionalStep fixLightningRod = new ConditionalStep(this, talkToGardenerForKey); fixLightningRod.addStep(new Conditions(inCastleTower, hasLightningRod), repairConductor); fixLightningRod.addStep(new Conditions(hasLightningRod, inCastleFloor1), goUpTowerLadder); fixLightningRod.addStep(new Conditions(hasLightningRod), goUpWestStairs); fixLightningRod.addStep(new Conditions(hasMould), makeLightningRod); fixLightningRod.addStep(new Conditions(inCastleFloor1, hasBrush3), searchFirePlace); fixLightningRod.addStep(new Conditions(hasBrush3), goUpWestStairs); fixLightningRod.addStep(new Conditions(LogicType.AND, hasBrush, hasCanes), extendBrush); fixLightningRod.addStep(new Conditions(hasBrush), grabCanes); fixLightningRod.addStep(new Conditions(LogicType.OR, usedShedKey, hasShedKey), searchForBrush); ConditionalStep talkToFenkentrain = new ConditionalStep(this, goBackToFirstFloor); talkToFenkentrain.addStep(inCastleFloor0, talkToFenkenstrainAfterFixingRod); ConditionalStep goToMonster = new ConditionalStep(this, goToMonsterFloor1); goToMonster.addStep(inMonsterTower, talkToMonster); goToMonster.addStep(new Conditions(usedTowerKey, inCastleFloor1), goToMonsterFloor2); goToMonster.addStep(new Conditions(hasTowerKey, inCastleFloor1), openLockedDoor); steps.put(1, gatherBodyParts); steps.put(2, gatherNeedleAndThread); steps.put(3, fixLightningRod); steps.put(4, talkToFenkentrain); steps.put(5, goToMonster); steps.put(6, pickPocketFenkenstrain); return steps; } public void setupItemRequirements() { ItemRequirement telegrab = new ItemRequirements("Telegrab runes", new ItemRequirement("Law rune", ItemID.LAW_RUNE), new ItemRequirement("Air rune", ItemID.AIR_RUNE)); ItemRequirement coins50 = new ItemRequirement("Coins", ItemID.COINS_995, 50); // TODO: Add magic req once rebased telegrabOrCoins = new ItemRequirements(LogicType.OR, "33 Magic and runes to cast telegrab, or 50 coins", coins50, telegrab); hammer = new ItemRequirement("Hammer", ItemID.HAMMER); ghostSpeakAmulet = new ItemRequirement("Ghostspeak amulet", ItemCollections.getGhostspeak()); silverBar = new ItemRequirement("Silver bar", ItemID.SILVER_BAR); bronzeWire = new ItemRequirement("Bronze wires", ItemID.BRONZE_WIRE, 3); needle = new ItemRequirement("Needle", ItemID.NEEDLE); thread = new ItemRequirement("Threads", ItemID.THREAD, 5); spade = new ItemRequirement("Spade", ItemID.SPADE); coins = new ItemRequirement("Coins at least", ItemID.COINS_995, 100); pickledBrain = new ItemRequirement("Pickled Brain", ItemID.PICKLED_BRAIN); obsidianAmulet = new ItemRequirement("Obsidian Amulet", ItemID.OBSIDIAN_AMULET); marbleAmulet = new ItemRequirement("Marble Amulet", ItemID.MARBLE_AMULET); starAmulet = new ItemRequirement("Star Amulet", ItemID.STAR_AMULET); decapitatedHead = new ItemRequirement("Decapitated Head", ItemID.DECAPITATED_HEAD); decapitatedHeadWithBrain = new ItemRequirement("Decapitated Head (with brain)", ItemID.DECAPITATED_HEAD_4198); armor = new ItemRequirement("Armour and weapons defeat a level 51 monster and run past level 72 monsters", -1, -1); armor.setDisplayItemId(BankSlotIcons.getCombatGear()); cavernKey = new ItemRequirement("Tavern Key", ItemID.CAVERN_KEY); torso = new ItemRequirement("Torso", ItemID.TORSO); legs = new ItemRequirement("Legs", ItemID.LEGS); arms = new ItemRequirement("Arms", ItemID.ARMS); shedKey = new ItemRequirement("Shed key", ItemID.SHED_KEY); brush = new ItemRequirement("Brush", ItemID.GARDEN_BRUSH); brush.addAlternates(ItemID.EXTENDED_BRUSH, ItemID.EXTENDED_BRUSH_4192); canes = new ItemRequirement("Garden Canes (3)", ItemID.GARDEN_CANE); extendedBrush3 = new ItemRequirement("Extended Brush", ItemID.EXTENDED_BRUSH_4193); conductorMould = new ItemRequirement("Conductor Mold", ItemID.CONDUCTOR_MOULD); lightningRod = new ItemRequirement("Lightning Rod", ItemID.CONDUCTOR); towerKey = new ItemRequirement("Tower Key", ItemID.TOWER_KEY); fenkenstrainTeleports = new ItemRequirement("Fenkenstrain's Castle Teleport", ItemID.FENKENSTRAINS_CASTLE_TELEPORT, 2); teleportToFurnance = new ItemRequirement("Teleport to any furnance such as glory for edgeville teleport, ectophial to Port Phasmatys or a Falador teleport", ItemCollections.getAmuletOfGlories()); teleportToFurnance.addAlternates(ItemID.ECTOPHIAL, ItemID.FALADOR_TELEPORT); staminaPotion = new ItemRequirement("Stamina potions", ItemCollections.getStaminaPotions(), -1); } public void setupZones() { barZone = new Zone(new WorldPoint(3488, 3477, 0), new WorldPoint(3504, 3471, 0)); castleZoneFloor0 = new Zone(new WorldPoint(3526, 3574, 0), new WorldPoint(3566, 3531, 0)); castleZoneFloor1 = new Zone(new WorldPoint(3526, 3574, 1), new WorldPoint(3566, 3531, 1)); experimentCave = new Zone(new WorldPoint(3466, 9921, 0), new WorldPoint(3582, 9982, 0)); graveIsland = new Zone(new WorldPoint(3484, 3585, 0), new WorldPoint(3517, 3561, 0)); castleTower = new Zone(new WorldPoint(3544, 3543, 2), new WorldPoint(3552, 3536, 2)); monsterTower = new Zone(new WorldPoint(3544, 3558, 2), new WorldPoint(3553, 3551, 2)); } public void setupConditions() { inCanifisBar = new ZoneCondition(barZone); inCastleFloor0 = new ZoneCondition(castleZoneFloor0); inCastleFloor1 = new ZoneCondition(castleZoneFloor1); hasPickledBrain = new ItemRequirementCondition(pickledBrain); putStarOnGrave = new VarbitCondition(192, 1); hasMarbleAmulet = new Conditions(LogicType.OR, new ItemRequirementCondition(marbleAmulet), putStarOnGrave); hasObsidianAmulet = new Conditions(LogicType.OR, new ItemRequirementCondition(obsidianAmulet), putStarOnGrave); hasGhostSpeakAmulet = new ItemRequirementCondition(ghostSpeakAmulet); hasStarAmulet = new Conditions(LogicType.OR, new ItemRequirementCondition(starAmulet), putStarOnGrave); followingGardenerForHead = new VarbitCondition(185, 1); hasDecapitatedHead = new ItemRequirementCondition(decapitatedHead); hasDecapitatedHeadWithBrain = new Conditions(LogicType.OR, new ItemRequirementCondition(decapitatedHeadWithBrain), new VarbitCondition(189, 1)); inExperiementCave = new ZoneCondition(experimentCave); inGraveIsland = new ZoneCondition(graveIsland); hasCavernKey = new Conditions(LogicType.OR, new ItemRequirementCondition(cavernKey), new VarbitCondition(199, 1)); keyNearby = new ItemCondition(cavernKey); hasTorso = new Conditions(LogicType.OR, new ItemRequirementCondition(torso), new VarbitCondition(188, 1)); hasLegs = new Conditions(LogicType.OR, new ItemRequirementCondition(legs), new VarbitCondition(187, 1)); hasArm = new Conditions(LogicType.OR, new ItemRequirementCondition(arms), new VarbitCondition(186, 1)); // Needle given, 190 = 1 // Thread given, 191 0->5 hasShedKey = new ItemRequirementCondition(shedKey); usedShedKey = new VarbitCondition(200, 1); hasBrush = new ItemRequirementCondition(brush); hasBrush3 = new ItemRequirementCondition(extendedBrush3); hasCanes = new ItemRequirementCondition(canes); hasLightningRod = new ItemRequirementCondition(lightningRod); hasMould = new ItemRequirementCondition(conductorMould); inCastleTower = new ZoneCondition(castleTower); usedTowerKey = new VarbitCondition(198, 1); hasTowerKey = new ItemRequirementCondition(towerKey); inMonsterTower = new ZoneCondition(monsterTower); } public void setupSteps() { getPickledBrain = new DetailedQuestStep(this, new WorldPoint(3492, 3474, 0), "Head to the Canifis bar and either buy the pickled brain for 50 coins, or telegrab it.", telegrabOrCoins); getPickledBrain.addDialogStep("I'll buy one."); talkToFrenkenstrain = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3551, 3548, 0), "Talk to Dr.Fenkenstrain to start the quest"); talkToFrenkenstrain.addDialogStep("Yes."); talkToFrenkenstrain.addDialogStep("Braindead"); talkToFrenkenstrain.addDialogStep("Grave-digging"); goUpstairsForStar = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3560, 3552, 0), "Go up the staircase to grab the items you will need."); getBook1 = new ObjectStep(this, ObjectID.BOOKCASE_5166, new WorldPoint(3555, 3558, 1), "Search the nearby bookcase for Handy Maggot Avoidance Techniques."); getBook1.addDialogSteps("Handy Maggot Avoidance Techniques"); getBook2 = new ObjectStep(this, ObjectID.BOOKCASE_5166, new WorldPoint(3542, 3558, 1), "Search the west bookcase for The Joy of Grave Digging."); getBook2.addDialogSteps("The Joy of Gravedigging"); combineAmulet = new ItemStep(this, "Combine the two amulet by using one on the other.", marbleAmulet.highlighted(), obsidianAmulet.highlighted()); goDownstairsForStar = new ObjectStep(this, ObjectID.STAIRCASE_5207, new WorldPoint(3573, 3553, 1), "Go back to the ground floor"); talkToGardenerForHead = new NpcStep(this, NpcID.GARDENER_GHOST, new WorldPoint(3548, 3562, 0), "Talk to the Gardener Ghost.", ghostSpeakAmulet.equipped()); talkToGardenerForHead.addDialogStep("What happened to your head?"); goToHeadGrave = new DigStep(this, new WorldPoint(3608, 3490, 0), "Go to the grave of the gardener and dig for his head."); combinedHead = new ItemStep(this, "Use the decapitated head on the pickled brain to create a decapitated head.", decapitatedHead.highlighted(), pickledBrain.highlighted()); useStarOnGrave = new ObjectStep(this, ObjectID.MEMORIAL, new WorldPoint(3578, 3528, 0), "Use the Star Amulet on the memorial and push it to go in the caves.", starAmulet.highlighted()); useStarOnGrave.addIcon(ItemID.STAR_AMULET); enterExperimentCave = new ObjectStep(this, ObjectID.MEMORIAL, new WorldPoint(3578, 3528, 0), "Push the memorial south east of the castle."); killExperiment = new NpcStep(this, NpcID.EXPERIMENT, new WorldPoint(3557, 9946, 0), "Kill the level 51 Experiment north-west of the ladder to get a key.", true); pickupKey = new ItemStep(this, "Pick up the key.", cavernKey); killExperiment.addSubSteps(pickupKey); leaveExperimentCave = new ObjectStep(this, ObjectID.LADDER_17387, new WorldPoint(3504, 9970, 0), "Leave the caves by going north-west, be sure to pick up the key from the level 51 experiment."); getTorso = new DigStep(this, new WorldPoint(3503, 3576, 0), "Use your spade on this tile to get torsos."); getArm = new DigStep(this, new WorldPoint(3504, 3576, 0), "Use your spade on this tile to get arms."); getLeg = new DigStep(this, new WorldPoint(3505, 3576, 0), "Use your spade on this tile to get legs."); deliverBodyParts = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3551, 3548, 0), "Deliver the body parts to Dr.Fenkenstrain, use a teleport to Fenkenstrain's castle or run back through " + "the caves."); deliverBodyParts.addDialogStep("I have some body parts for you."); gatherNeedleAndThread = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3551, 3548, 0), "Get a needle and 5 threads and deliver them to Dr.Fenkenstrain.", needle, thread); talkToGardenerForKey = new NpcStep(this, NpcID.GARDENER_GHOST, new WorldPoint(3548, 3562, 0), "Talk to the Gardener Ghost and ask for the shed key.", ghostSpeakAmulet.equipped(), bronzeWire, silverBar); talkToGardenerForKey.addDialogStep("Do you know where the key to the shed is?"); searchForBrush = new ObjectStep(this, ObjectID.CUPBOARD_5156, new WorldPoint(3546, 3564, 0), "Open the cupboard and search it for a brush.", bronzeWire, silverBar); grabCanes = new ObjectStep(this, ObjectID.PILE_OF_CANES, new WorldPoint(3551, 3564, 0), "Grab 3 canes from the pile.", bronzeWire, silverBar); extendBrush = new DetailedQuestStep(this, "Use all 3 canes on the brush one at a time.", canes.highlighted(), brush.highlighted(), bronzeWire, silverBar); goUpWestStairs = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3538, 3552, 0), "Go up to the second floor of the castle."); searchFirePlace = new ObjectStep(this, ObjectID.FIREPLACE_5165, new WorldPoint(3544, 3555, 1), "Use the extended brush on the fireplace to get the conductor mould.", extendedBrush3.highlighted()); searchFirePlace.addIcon(ItemID.EXTENDED_BRUSH_4193); makeLightningRod = new DetailedQuestStep(this, "Go to any furnace make a lightning rod.", silverBar, conductorMould); goUpWestStairsWithRod = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3537, 3553, 0), "Return to the castle and go upstairs."); goUpTowerLadder = new ObjectStep(this, ObjectID.LADDER_16683, new WorldPoint(3548, 3539, 1), "Go up to the third floor using the ladder in the middle of the castle."); repairConductor = new ObjectStep(this, ObjectID.LIGHTNING_CONDUCTOR, new WorldPoint(3549, 3537, 2), "Repair the lightning Conductor."); goBackToFirstFloor = new DetailedQuestStep(this, "Go back to the the first floor of the castle and talk to Dr" + ".Fenkenstrain."); talkToFenkenstrainAfterFixingRod = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3551, 3548, 0), "Go back to the the first floor of the castle and talk to Dr.Fenkenstrain."); goToMonsterFloor1 = new ObjectStep(this, ObjectID.STAIRCASE_5206, new WorldPoint(3538, 3552, 0), "Go up to the second floor to confront Fenkenstrain's monster."); openLockedDoor = new ObjectStep(this, ObjectID.DOOR_5172, new WorldPoint(3548, 3551, 1), "Use the Tower Key on the door."); goToMonsterFloor2 = new ObjectStep(this, ObjectID.LADDER_16683, new WorldPoint(3548, 3554, 1), "Go up the ladder"); talkToMonster = new NpcStep(this, NpcID.FENKENSTRAINS_MONSTER, new WorldPoint(3548, 3555, 2), "Talk to Fenkenstrain's monster."); pickPocketFenkenstrain = new NpcStep(this, NpcID.DR_FENKENSTRAIN, new WorldPoint(3551, 3548, 0), "Go back to Dr.Fenkenstrain, instead of talking to him right click and pickpocket him."); } @Override public ArrayList<ItemRequirement> getItemRequirements() { return new ArrayList<>(Arrays.asList(hammer, ghostSpeakAmulet, silverBar, bronzeWire, needle, thread, spade, coins, telegrabOrCoins, armor)); } @Override public ArrayList<ItemRequirement> getItemRecommended() { ArrayList<ItemRequirement> reqs = new ArrayList<>(); reqs.add(fenkenstrainTeleports); reqs.add(teleportToFurnance); reqs.add(staminaPotion); return reqs; } @Override public ArrayList<String> getCombatRequirements() { return new ArrayList<>(Collections.singletonList("Able to defeat an experiment (level 51)")); } @Override public List<Requirement> getGeneralRequirements() { ArrayList<Requirement> req = new ArrayList<>(); req.add(new QuestRequirement(QuestHelperQuest.PRIEST_IN_PERIL, QuestState.FINISHED)); req.add(new QuestRequirement(QuestHelperQuest.THE_RESTLESS_GHOST, QuestState.FINISHED)); req.add(new SkillRequirement(Skill.CRAFTING, 20, true)); req.add(new SkillRequirement(Skill.THIEVING, 25, true)); return req; } @Override public ArrayList<PanelDetails> getPanels() { ArrayList<PanelDetails> allSteps = new ArrayList<>(); allSteps.add(new PanelDetails("Starting off", Arrays.asList(getPickledBrain, talkToFrenkenstrain), telegrabOrCoins)); allSteps.add(new PanelDetails("Graverobbing", Arrays.asList(goUpstairsForStar, getBook1, getBook2, combineAmulet, goDownstairsForStar, talkToGardenerForHead, goToHeadGrave, combinedHead, useStarOnGrave, enterExperimentCave, killExperiment, leaveExperimentCave, getTorso, getArm, getLeg, deliverBodyParts), ghostSpeakAmulet, spade, armor, needle, thread)); allSteps.add(new PanelDetails("Getting tools", Collections.singletonList(gatherNeedleAndThread), ghostSpeakAmulet, needle, thread)); allSteps.add(new PanelDetails("Attracting lightning", Arrays.asList(talkToGardenerForKey, searchForBrush, grabCanes, extendBrush, goUpWestStairs, searchFirePlace, makeLightningRod, goUpWestStairsWithRod, goUpTowerLadder, repairConductor, goBackToFirstFloor, talkToFenkenstrainAfterFixingRod), ghostSpeakAmulet, bronzeWire, silverBar, hammer)); allSteps.add(new PanelDetails("Facing the monster", Arrays.asList(goToMonsterFloor1, openLockedDoor, goToMonsterFloor2, talkToMonster))); allSteps.add(new PanelDetails("Finishing off", Collections.singletonList(pickPocketFenkenstrain))); return allSteps; } }
54.826923
158
0.787443
4f4d77c8f8611670742f8c2754d188500569ea0f
3,080
package example1.mothership.service; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.hazelcast.config.Config; import com.hazelcast.config.RingbufferConfig; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.ringbuffer.Ringbuffer; import example1.mothership.service.processors.FromJsonProcessor; import example1.mothership.service.processors.ValidateProcessor; import example1.mothership.service.routes.CommandsPullerRoute; import example1.mothership.service.routes.CommandsRestRoute; import example1.mothership.util.HazelcastIdempotentRepository; import org.apache.camel.CamelContext; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.SimpleRegistry; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; import static example1.mothership.core.MothershipDataSchema.MothershipCommand; public class MothershipServiceCtxListener implements ServletContextListener { CamelContext context; @Override public void contextInitialized(ServletContextEvent servletContextEvent) { RingbufferConfig rbConfig = new RingbufferConfig("default") .setCapacity(50 * 1000); Config config = new Config(); config.addRingBufferConfig(rbConfig); HazelcastInstance hz = Hazelcast.newHazelcastInstance(config); Ringbuffer<String> commandsRb = hz.getRingbuffer("commands"); ObjectMapper mapper = new ObjectMapper(); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); mapper.setDefaultPrettyPrinter(new DefaultPrettyPrinter()); mapper.registerModule(new Jdk8Module()); ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); Validator validator = factory.getValidator(); ValidateProcessor<MothershipCommand> validateProcessor = new ValidateProcessor<>(validator, MothershipCommand.class); SimpleRegistry registry = new SimpleRegistry(); HazelcastIdempotentRepository repo = new HazelcastIdempotentRepository(hz, "commands"); context = new DefaultCamelContext(registry); try { context.addRoutes(new CommandsRestRoute(new FromJsonProcessor<>(mapper, MothershipCommand.class), validateProcessor, commandsRb)); context.addRoutes(new CommandsPullerRoute(commandsRb, repo)); context.start(); } catch (Exception e) { // e.printStackTrace(); } } @Override public void contextDestroyed(ServletContextEvent servletContextEvent) { try { context.stop(); } catch (Exception e) { // e.printStackTrace(); } } }
38.5
109
0.743831
86af6751cf02a7915f256a08709091e306e0fb0c
3,696
package android.support.v7.widget; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.os.Build; import android.support.annotation.RestrictTo; import android.support.v7.content.res.AppCompatResources; import android.widget.ImageView; @RestrictTo({RestrictTo.Scope.LIBRARY_GROUP}) public class AppCompatImageHelper { private final ImageView mView; public AppCompatImageHelper(ImageView imageView) { this.mView = imageView; } /* access modifiers changed from: package-private */ public boolean hasOverlappingRendering() { return Build.VERSION.SDK_INT < 21 || !(this.mView.getBackground() instanceof RippleDrawable); } /* JADX WARNING: Code restructure failed: missing block: B:4:0x000a, code lost: r1 = android.support.v7.widget.TintTypedArray.obtainStyledAttributes(r6.mView.getContext(), r7, android.support.v7.appcompat.R.styleable.AppCompatImageView, r8, 0); */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void loadFromAttributes(android.util.AttributeSet r7, int r8) { /* r6 = this; r1 = 0 r5 = -1 android.widget.ImageView r0 = r6.mView // Catch:{ all -> 0x003c } android.graphics.drawable.Drawable r0 = r0.getDrawable() // Catch:{ all -> 0x003c } if (r0 != 0) goto L_0x0031 android.widget.ImageView r2 = r6.mView // Catch:{ all -> 0x003c } android.content.Context r2 = r2.getContext() // Catch:{ all -> 0x003c } int[] r3 = android.support.v7.appcompat.R.styleable.AppCompatImageView // Catch:{ all -> 0x003c } r4 = 0 android.support.v7.widget.TintTypedArray r1 = android.support.v7.widget.TintTypedArray.obtainStyledAttributes(r2, r7, r3, r8, r4) // Catch:{ all -> 0x003c } int r2 = android.support.v7.appcompat.R.styleable.AppCompatImageView_srcCompat // Catch:{ all -> 0x003c } r3 = -1 int r2 = r1.getResourceId(r2, r3) // Catch:{ all -> 0x003c } if (r2 == r5) goto L_0x0031 android.widget.ImageView r0 = r6.mView // Catch:{ all -> 0x003c } android.content.Context r0 = r0.getContext() // Catch:{ all -> 0x003c } android.graphics.drawable.Drawable r0 = android.support.v7.content.res.AppCompatResources.getDrawable(r0, r2) // Catch:{ all -> 0x003c } if (r0 == 0) goto L_0x0031 android.widget.ImageView r2 = r6.mView // Catch:{ all -> 0x003c } r2.setImageDrawable(r0) // Catch:{ all -> 0x003c } L_0x0031: if (r0 == 0) goto L_0x0036 android.support.v7.widget.DrawableUtils.fixDrawable(r0) // Catch:{ all -> 0x003c } L_0x0036: if (r1 == 0) goto L_0x003b r1.recycle() L_0x003b: return L_0x003c: r0 = move-exception if (r1 == 0) goto L_0x0042 r1.recycle() L_0x0042: throw r0 */ throw new UnsupportedOperationException("Method not decompiled: android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(android.util.AttributeSet, int):void"); } public void setImageResource(int i) { if (i != 0) { Drawable drawable = AppCompatResources.getDrawable(this.mView.getContext(), i); if (drawable != null) { DrawableUtils.fixDrawable(drawable); } this.mView.setImageDrawable(drawable); return; } this.mView.setImageDrawable((Drawable) null); } }
46.2
177
0.618506
c637e19f43b2200e4fd3d0281dc960a5d3e18781
751
package com.secdec.codedx.api.client; public class TriageStatus { private String type; private String display; private String settable; public static final String TYPE_STATUS = "status"; public static final String TYPE_USER = "user"; public String getType() { return type; } public void setType(String type) { this.type = type; } public String getDisplay() { return display; } public void setDisplay(String display) { this.display = display; } public String getSettable() { return settable; } public void setSettable(String settable) { this.settable = settable; } @Override public String toString() { return "FindingStatus [type=" + type + ", display=" + display + ", settable=" + settable + "]"; } }
19.25641
63
0.691079
1e5c51db173a33ebe16082b7a28a8595acaba784
1,108
/* Copyright 2006 Jerry Huxtable Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.jhlabs.image; import java.awt.image.*; public class IteratedFilter extends AbstractBufferedImageOp { private BufferedImageOp filter; private int iterations; public IteratedFilter( BufferedImageOp filter, int iterations ) { this.filter = filter; this.iterations = iterations; } public BufferedImage filter( BufferedImage src, BufferedImage dst ) { BufferedImage image = src; for ( int i = 0; i < iterations; i++ ) image = filter.filter( image, dst ); return image; } }
28.410256
73
0.732852
51c28350392d169a732ad4655480a5350d833958
10,530
/** * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.thinkgem.jeesite.sierac.entity; import java.util.Date; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import org.hibernate.validator.constraints.Length; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.thinkgem.jeesite.common.persistence.DataEntity; import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField; /** * CRUD操作Entity * * @author mjj * @version 2017-02-13 */ @JsonInclude(JsonInclude.Include.ALWAYS) public class RdcOutHeader extends DataEntity<RdcOutHeader> { private static final long serialVersionUID = 1L; private String code; // 业务代码 private String orderCode; // 出库单号 private String outTypeCode; // 出库类型代码 private String uploadId; // 上传id private Date uploadTime; // 上传日期 private String scanBy; // 扫描者 private Date scanBeginTime; // 扫描开始时间 private Integer billType; // 单据类型 private String billStatus; // 单据状态 private String submitBy; // 提交者 private Date submitDate; // 出库单日期 private String sendId; // 发货仓id private String sendCode; // 发货仓代码 private String sendName; // 发货仓名称 private String receiveId; // 收货人id private String receiveName; // 客户姓名 private String receivePhone; // 客户手机号 private String receiveAddress; // 客户地址 private Integer expectPcsQty;// 计划数量 private Integer actualPcsQty;// 实际数量 private Date beginSubmitDate; // 开始 出库单日期 private Date endSubmitDate; // 结束 出库单日期 /** * api附加 */ private String headerId; private String productId; private String pCode;// 产品代码 private String pSku;// 产品sku private String pName;// 产品名称 private String batchCode;// 批号 public RdcOutHeader() { super(); } public RdcOutHeader(String id) { super(id); } @Length(min = 0, max = 64, message = "业务代码长度必须介于 0 和 64 之间") public String getCode() { return code; } public void setCode(String code) { this.code = code; } @JsonIgnore @ExcelField(title = "出库单号", align = 2, sort = 1) @NotNull(message = "出库单号不能为空") @Length(min = 3, max = 10, message = "出库单号长度必须介于 3 和 10 之间") public String getOrderCode() { return orderCode; } public void setOrderCode(String orderCode) { this.orderCode = orderCode; } @JsonIgnore @Length(min = 0, max = 64, message = "出库类型代码长度必须介于 0 和 64 之间") public String getOutTypeCode() { return outTypeCode; } public void setOutTypeCode(String outTypeCode) { this.outTypeCode = outTypeCode; } @JsonIgnore @Length(min = 0, max = 64, message = "上传id长度必须介于 0 和 64 之间") public String getUploadId() { return uploadId; } public void setUploadId(String uploadId) { this.uploadId = uploadId; } @NotNull(message = "上传日期不能为空") // @Pattern(regexp = // "(\\d{2}|\\d{4})(?:\\-)?([0]{1}\\d{1}|[1]{1}[0-2]{1})(?:\\-)?([0-2]{1}\\d{1}|[3]{1}[0-1]{1})(?:\\s)?([0-1]{1}\\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\\d{1})(?::)?([0-5]{1}\\d{1})", // message = "请正确填写上传日期") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelField(title = "上传日期", align = 2, sort = 10) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date getUploadTime() { return uploadTime; } public void setUploadTime(Date uploadTime) { this.uploadTime = uploadTime; } @Length(min = 0, max = 64, message = "扫描者长度必须介于 0 和 64 之间") public String getScanBy() { return scanBy; } public void setScanBy(String scanBy) { this.scanBy = scanBy; } @JsonIgnore @NotNull(message = "扫描开始时间不能为空") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelField(title = "扫描开始时间", align = 2, sort = 9) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date getScanBeginTime() { return scanBeginTime; } public void setScanBeginTime(Date scanBeginTime) { this.scanBeginTime = scanBeginTime; } public Integer getBillType() { return billType; } public void setBillType(Integer billType) { this.billType = billType; } @NotNull(message = "单据状态不能为空") @Pattern(regexp = "^\\d$", message = "请正确填写单据状态") @ExcelField(title = "单据状态", align = 2, sort = 7) public String getBillStatus() { return billStatus; } public void setBillStatus(String billStatus) { this.billStatus = billStatus; } @Length(min = 0, max = 255, message = "提交者长度必须介于 0 和 255 之间") public String getSubmitBy() { return submitBy; } public void setSubmitBy(String submitBy) { this.submitBy = submitBy; } @JsonIgnore @NotNull(message = "出库日期不能为空") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelField(title = "出库日期", align = 2, sort = 8) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") public Date getSubmitDate() { return submitDate; } public void setSubmitDate(Date submitDate) { this.submitDate = submitDate; } @Length(min = 0, max = 64, message = "发货仓id长度必须介于 0 和 64 之间") public String getSendId() { return sendId; } public void setSendId(String sendId) { this.sendId = sendId; } @NotNull(message = "发货仓代码不能为空") @ExcelField(title = "发货仓代码", align = 2, sort = 2) @Length(min = 3, max = 10, message = "发货仓代码长度必须介于 3 和 10 之间") public String getSendCode() { return sendCode; } public void setSendCode(String sendCode) { this.sendCode = sendCode; } @JsonIgnore @NotNull(message = "发货仓名称不能为空") @ExcelField(title = "发货仓名称", align = 2, sort = 3) @Length(min = 3, max = 10, message = "发货仓名称长度必须介于 0 和 255 之间") public String getSendName() { return sendName; } public void setSendName(String sendName) { this.sendName = sendName; } @Length(min = 0, max = 64, message = "收货人id长度必须介于 0 和 64 之间") public String getReceiveId() { return receiveId; } public void setReceiveId(String receiveId) { this.receiveId = receiveId; } @ExcelField(title = "客户姓名", align = 2, sort = 4) @NotNull(message = "客户姓名不能为空") @Pattern(regexp = "^[A-Za-z0-9\u4e00-\u9fa5]+$", message = "请正确填写客户姓名") public String getReceiveName() { return receiveName; } public void setReceiveName(String receiveName) { this.receiveName = receiveName; } @JsonIgnore @NotNull(message = "客户手机号不能为空") @Pattern(regexp = "^1[34578]\\d{9}$", message = "请正确填写客户手机号") @ExcelField(title = "客户手机号", align = 2, sort = 5) public String getReceivePhone() { return receivePhone; } public void setReceivePhone(String receivePhone) { this.receivePhone = receivePhone; } @JsonIgnore @NotNull(message = "客户地址不能为空") @ExcelField(title = "客户地址", align = 2, sort = 6) public String getReceiveAddress() { return receiveAddress; } public void setReceiveAddress(String receiveAddress) { this.receiveAddress = receiveAddress; } @JsonIgnore public Date getBeginSubmitDate() { return beginSubmitDate; } public void setBeginSubmitDate(Date beginSubmitDate) { this.beginSubmitDate = beginSubmitDate; } @JsonIgnore public Date getEndSubmitDate() { return endSubmitDate; } public void setEndSubmitDate(Date endSubmitDate) { this.endSubmitDate = endSubmitDate; } /** * api附加 */ public String getHeaderId() { return headerId; } public void setHeaderId(String headerId) { this.headerId = headerId; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getpCode() { return pCode; } public void setpCode(String pCode) { this.pCode = pCode; } public String getpSku() { return pSku; } public void setpSku(String pSku) { this.pSku = pSku; } public String getpName() { return pName; } public void setpName(String pName) { this.pName = pName; } public String getBatchCode() { return batchCode; } public void setBatchCode(String batchCode) { this.batchCode = batchCode; } public Integer getExpectPcsQty() { return expectPcsQty; } public void setExpectPcsQty(Integer expectPcsQty) { this.expectPcsQty = expectPcsQty; } public void setActualPcsQty(Integer actualPcsQty) { this.actualPcsQty = actualPcsQty; } public Integer getActualPcsQty() { return actualPcsQty; } @Override public String toString() { return "RdcOutHeader [code=" + code + ", orderCode=" + orderCode + ", outTypeCode=" + outTypeCode + ", uploadId=" + uploadId + ", uploadTime=" + uploadTime + ", scanBy=" + scanBy + ", scanBeginTime=" + scanBeginTime + ", billType=" + billType + ", billStatus=" + billStatus + ", submitBy=" + submitBy + ", submitDate=" + submitDate + ", sendId=" + sendId + ", sendCode=" + sendCode + ", sendName=" + sendName + ", receiveId=" + receiveId + ", receiveName=" + receiveName + ", receivePhone=" + receivePhone + ", receiveAddress=" + receiveAddress + ", expectPcsQty=" + expectPcsQty + ", actualPcsQty=" + actualPcsQty + ", beginSubmitDate=" + beginSubmitDate + ", endSubmitDate=" + endSubmitDate + ", headerId=" + headerId + ", productId=" + productId + ", pCode=" + pCode + ", pSku=" + pSku + ", pName=" + pName + ", batchCode=" + batchCode + "]"; } }
26.862245
185
0.592593
3b40425bffd78ff8a3c75c9eb7aea19d3ca2f400
7,481
// This file is part of OpenTSDB. // Copyright (C) 2013 The OpenTSDB Authors. // // This program is free software: you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 2.1 of the License, or (at your // option) any later version. This program is distributed in the hope that it // will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser // General Public License for more details. You should have received a copy // of the GNU Lesser General Public License along with this program. If not, // see <http://www.gnu.org/licenses/>. package net.opentsdb.tsd; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.jboss.netty.handler.codec.http.HttpMethod; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import net.opentsdb.core.RowKey; import net.opentsdb.core.TSDB; import net.opentsdb.core.Tags; import net.opentsdb.search.SearchQuery; import net.opentsdb.search.TimeSeriesLookup; import net.opentsdb.search.SearchQuery.SearchType; import net.opentsdb.uid.NoSuchUniqueId; import net.opentsdb.uid.NoSuchUniqueName; import net.opentsdb.uid.UniqueId; import net.opentsdb.utils.Pair; /** * Handles very basic search calls by passing the user's query to the configured * search plugin and pushing the response back through the serializers. * Also allows for time series lookups given a metric, tag name, tag value or * combination thereof using the tsdb-meta table. * @since 2.0 */ final class SearchRpc implements HttpRpc { /** * Handles the /api/search/&lt;type&gt; endpoint * @param tsdb The TSDB to which we belong * @param query The HTTP query to work with */ @Override public void execute(TSDB tsdb, HttpQuery query) { final HttpMethod method = query.getAPIMethod(); if (method != HttpMethod.GET && method != HttpMethod.POST) { throw new BadRequestException("Unsupported method: " + method.getName()); } // the uri will be /api/vX/search/<type> or /api/search/<type> final String[] uri = query.explodeAPIPath(); final String endpoint = uri.length > 1 ? uri[1] : ""; final SearchType type; final SearchQuery search_query; try { type = SearchQuery.parseSearchType(endpoint); } catch (IllegalArgumentException e) { throw new BadRequestException("Invalid search query type supplied", e); } if (query.hasContent()) { search_query = query.serializer().parseSearchQueryV1(); } else { search_query = parseQueryString(query, type); } search_query.setType(type); if (type == SearchType.LOOKUP) { processLookup(tsdb, query, search_query); return; } try { final SearchQuery results = tsdb.executeSearch(search_query).joinUninterruptibly(); query.sendReply(query.serializer().formatSearchResultsV1(results)); } catch (IllegalStateException e) { throw new BadRequestException("Searching is not enabled", e); } catch (Exception e) { throw new RuntimeException(e); } } /** * Parses required search values from the query string * @param query The HTTP query to work with * @param type The type of search query requested * @return A parsed SearchQuery object */ private final SearchQuery parseQueryString(final HttpQuery query, final SearchType type) { final SearchQuery search_query = new SearchQuery(); if (type == SearchType.LOOKUP) { final String query_string = query.getRequiredQueryStringParam("m"); search_query.setTags(new ArrayList<Pair<String, String>>()); try { search_query.setMetric(Tags.parseWithMetric(query_string, search_query.getTags())); } catch (IllegalArgumentException e) { throw new BadRequestException("Unable to parse query", e); } return search_query; } // process a regular search query search_query.setQuery(query.getRequiredQueryStringParam("query")); if (query.hasQueryStringParam("limit")) { final String limit = query.getQueryStringParam("limit"); try { search_query.setLimit(Integer.parseInt(limit)); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'limit' to a valid number"); } } if (query.hasQueryStringParam("start_index")) { final String idx = query.getQueryStringParam("start_index"); try { search_query.setStartIndex(Integer.parseInt(idx)); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'start_index' to a valid number"); } } return search_query; } /** * Processes a lookup query against the tsdb-meta table, returning (and * resolving) the TSUIDs of any series that matched the query. * @param tsdb The TSDB to which we belong * @param query The HTTP query to work with * @param search_query A search query configured with at least a metric * or a list of tag pairs. If neither are set, the method will throw an error. * @throws BadRequestException if the metric and tags are null or empty or * a UID fails to resolve. * @since 2.1 */ private void processLookup(final TSDB tsdb, final HttpQuery query, final SearchQuery search_query) { if (search_query.getMetric() == null && (search_query.getTags() == null || search_query.getTags().size() < 1)) { throw new BadRequestException( "Missing metric and tags. Please supply at least one value."); } final long start = System.currentTimeMillis(); try { final List<byte[]> tsuids = new TimeSeriesLookup(tsdb, search_query).lookup(); search_query.setTotalResults(tsuids.size()); // TODO maybe track in nanoseconds so we can get a floating point. But most // lookups will probably take a fair amount of time. search_query.setTime(System.currentTimeMillis() - start); final List<Object> results = new ArrayList<Object>(tsuids.size()); Map<String, Object> series; List<byte[]> tag_ids; // TODO - honor limit and pagination for (final byte[] tsuid : tsuids) { series = new HashMap<String, Object>((tsuid.length / 2) + 1); try { series.put("tsuid", UniqueId.uidToString(tsuid)); series.put("metric", RowKey.metricNameAsync(tsdb, tsuid) .joinUninterruptibly()); tag_ids = UniqueId.getTagPairsFromTSUID(tsuid); series.put("tags", Tags.resolveIdsAsync(tsdb, tag_ids) .joinUninterruptibly()); } catch (NoSuchUniqueId nsui) { throw new BadRequestException(HttpResponseStatus.NOT_FOUND, "Unable to resolve one or more UIDs", nsui); } catch (Exception e) { throw new RuntimeException("Shouldn't be here", e); } results.add(series); } search_query.setResults(results); query.sendReply(query.serializer().formatSearchResultsV1(search_query)); } catch (NoSuchUniqueName nsun) { throw new BadRequestException(HttpResponseStatus.NOT_FOUND, "Unable to resolve one or more names", nsun); } } }
37.218905
81
0.678385
3f6ace3f33f56e98675845fe61b9d80a6478fb15
7,030
/* * Copyright (C) 2005 Luca Veltri - University of Parma - Italy * * This file is part of MjSip (http://www.mjsip.org) * * MjSip is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MjSip is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MjSip; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author(s): * Luca Veltri (luca.veltri@unipr.it) */ package org.zoolu.tools; import java.io.*; import java.util.Date; // import java.util.Locale; // import java.text.DateFormat; // import java.text.SimpleDateFormat; /** * Class Log allows the printing of log messages onto standard output or files * or any PrintStream. * <p> * Every Log has a <i>verboselevel</i> associated with it; any log request with * <i>loglevel</i> less or equal to the <i>verbose-level</i> is logged. <br> * Verbose level 0 indicates no log. The log levels should be greater than 0. * <p> * Parameter <i>logname</i>, if non-null, is used as log header (i.e. written * at the begin of each log row). */ public class Log { /** ***************************** Attributes ****************************** */ /** (static) Default maximum log file size (4MB) */ // public static final long MAX_SIZE=4096*1024; // 4MB public static final long MAX_SIZE = 1024 * 1024; // 1MB /** The log output stream */ PrintStream out_stream; /** The log tag at the beginning of each log row */ String log_tag; /** * The <i>log_level</i>. * <p> * Only messages with a level less or equal this <i>log_level</i> are * effectively logged */ int verbose_level; /** * The maximum size of the log stream/file [bytes] Value -1 indicates no * maximum size */ long max_size; /** The size of the log tag (e.g. "MyLog: " has tag_size=7) */ int tag_size; /** Whether messages are logged */ boolean do_log; /** The char counter of the already logged data */ long counter; /** **************************** Constructors ***************************** */ /** * Associates a new Log to the PrintStream <i>outstream</i>. Log size has * no bound */ public Log(PrintStream out_stream, String log_tag, int verbose_level) { init(out_stream, log_tag, verbose_level, -1); } /** * Associates a new Log to the file <i>filename</i>. Log size is limited to * the MAX_SIZE */ public Log(String file_name, String log_tag, int verbose_level) { PrintStream os = null; if (verbose_level > 0) { try { os = new PrintStream(new FileOutputStream(file_name)); } catch (IOException e) { e.printStackTrace(); } init(os, log_tag, verbose_level, MAX_SIZE); } } /** * Associates a new Log to the file <i>filename</i>. Log size is limited to * <i>logsize</i> [bytes] */ public Log(String file_name, String log_tag, int verbose_level, long max_size) { PrintStream os = null; if (verbose_level > 0) { try { os = new PrintStream(new FileOutputStream(file_name)); } catch (IOException e) { e.printStackTrace(); } init(os, log_tag, verbose_level, max_size); } else { init(null, log_tag, 0, 0); do_log = false; } } /** * Associates a new Log to the file <i>filename</i>. Log size is limited to * <i>logsize</i> [bytes] */ public Log(String file_name, String log_tag, int verbose_level, long max_size, boolean append) { PrintStream os = null; if (verbose_level > 0) { try { os = new PrintStream(new FileOutputStream(file_name, append)); } catch (IOException e) { e.printStackTrace(); } init(os, log_tag, verbose_level, max_size); } else { init(null, log_tag, 0, 0); do_log = false; } } /** ************************** Protected methods *************************** */ /** Initializes the log */ protected void init(PrintStream out_stream, String log_tag, int verbose_level, long max_size) { this.out_stream = out_stream; this.log_tag = log_tag; this.verbose_level = verbose_level; this.max_size = max_size; if (log_tag != null) tag_size = log_tag.length() + 2; else tag_size = 0; do_log = true; counter = 0; } /** Flushes */ protected Log flush() { if (verbose_level > 0) out_stream.flush(); return this; } /** *************************** Public methods **************************** */ /** Closes the log */ public void close() { do_log = false; out_stream.close(); } /** Logs the Exception */ public Log printException(Exception e, int level) { // ByteArrayOutputStream // err=new // ByteArrayOutputStream(); // e.printStackTrace(new PrintStream(err)); // return println("Exception: "+err.toString(),level); return println("Exception: " + ExceptionPrinter.getStackTraceOf(e), level); } /** Logs the Exception.toString() and Exception.printStackTrace() */ public Log printException(Exception e) { return printException(e, 1); } /** Logs the packet timestamp */ public Log printPacketTimestamp(String proto, String remote_addr, int remote_port, int len, String message, int level) { String str = remote_addr + ":" + remote_port + "/" + proto + " (" + len + " bytes)"; if (message != null) str += ": " + message; println(DateFormat.formatHHMMSS(new Date()) + ", " + str, level); return this; } /** * Prints the <i>log</i> if <i>level</i> isn't greater than the Log * <i>verbose_level</i> */ public Log println(String message, int level) { return print(message + "\r\n", level).flush(); } /** Prints the <i>log</i> if the Log <i>verbose_level</i> is greater than 0 */ public Log println(String message) { return println(message, 1); } /** Prints the <i>log</i> if the Log <i>verbose_level</i> is greater than 0 */ public Log print(String message) { return print(message, 1); } /** * Prints the <i>log</i> if <i>level</i> isn't greater than the Log * <i>verbose_level</i> */ public Log print(String message, int level) { if (do_log && level <= verbose_level) { if (log_tag != null) out_stream.print(log_tag + ": " + message); else out_stream.print(message); if (max_size >= 0) { counter += tag_size + message.length(); if (counter > max_size) { out_stream .println("\r\n----MAXIMUM LOG SIZE----\r\nSuccessive logs are lost."); do_log = false; } } } return this; } }
28.007968
81
0.614509
149d740a4990467fcb1ecba574836e451ff3880f
2,815
package com.milind.assigment.domain; import java.io.Serializable; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; @Entity @Table(name = "CustomerCustomerDemo") public class CustomerCustomerDemo implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId private CustomerCustomerDemoId customerCustomerDemoId; @NotNull(message = "Customer ID cannot be NULL") @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "CustomerID") private Customers customer; @NotNull(message = "Customer Type ID cannot be NULL") @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "CustomerTypeID") private CustomerDemographics customerDemographics; public CustomerCustomerDemoId getCustomerCustomerDemoId() { return customerCustomerDemoId; } public void setCustomerCustomerDemoId(CustomerCustomerDemoId customerCustomerDemoId) { this.customerCustomerDemoId = customerCustomerDemoId; } public Customers getCustomer() { return customer; } public void setCustomer(Customers customer) { this.customer = customer; } public CustomerDemographics getCustomerDemographics() { return customerDemographics; } public void setCustomerDemographics(CustomerDemographics customerDemographics) { this.customerDemographics = customerDemographics; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((customer == null) ? 0 : customer.hashCode()); result = prime * result + ((customerCustomerDemoId == null) ? 0 : customerCustomerDemoId.hashCode()); result = prime * result + ((customerDemographics == null) ? 0 : customerDemographics.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CustomerCustomerDemo other = (CustomerCustomerDemo) obj; if (customer == null) { if (other.customer != null) return false; } else if (!customer.equals(other.customer)) return false; if (customerCustomerDemoId == null) { if (other.customerCustomerDemoId != null) return false; } else if (!customerCustomerDemoId.equals(other.customerCustomerDemoId)) return false; if (customerDemographics == null) { if (other.customerDemographics != null) return false; } else if (!customerDemographics.equals(other.customerDemographics)) return false; return true; } @Override public String toString() { return "CustomerCustomerDemo [customerCustomerDemo=" + customerCustomerDemoId + "]"; } }
28.434343
103
0.753819
4fd5ce522df515cbad3b082ae35a9ec516d008f6
3,557
package com.cjhxfund.autocode.wesklake.model.xsd.table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; /** * <p>TableFieldType complex type�� Java �ࡣ * * <p>����ģʽƬ��ָ�������ڴ����е�Ԥ�����ݡ� * * <pre> * &lt;complexType name="TableFieldType"> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string"> * &lt;attribute name="FieldName" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="Remark" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="Nullable" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="ClientCached" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TableFieldType", propOrder = { "value" }) public class TableFieldType { @XmlValue protected String value; @XmlAttribute(name = "FieldName") protected String fieldName; @XmlAttribute(name = "Remark") protected String remark; @XmlAttribute(name = "Nullable") protected String nullable; @XmlAttribute(name = "ClientCached") protected String clientCached; /** * ��ȡvalue���Ե�ֵ�� * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * ����value���Ե�ֵ�� * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * ��ȡfieldName���Ե�ֵ�� * * @return * possible object is * {@link String } * */ public String getFieldName() { return fieldName; } /** * ����fieldName���Ե�ֵ�� * * @param value * allowed object is * {@link String } * */ public void setFieldName(String value) { this.fieldName = value; } /** * ��ȡremark���Ե�ֵ�� * * @return * possible object is * {@link String } * */ public String getRemark() { return remark; } /** * ����remark���Ե�ֵ�� * * @param value * allowed object is * {@link String } * */ public void setRemark(String value) { this.remark = value; } /** * ��ȡnullable���Ե�ֵ�� * * @return * possible object is * {@link String } * */ public String getNullable() { return nullable; } /** * ����nullable���Ե�ֵ�� * * @param value * allowed object is * {@link String } * */ public void setNullable(String value) { this.nullable = value; } /** * ��ȡclientCached���Ե�ֵ�� * * @return * possible object is * {@link String } * */ public String getClientCached() { return clientCached; } /** * ����clientCached���Ե�ֵ�� * * @param value * allowed object is * {@link String } * */ public void setClientCached(String value) { this.clientCached = value; } }
21.047337
93
0.515603
6f2059798b4a5599e8d651486983ed839065ca6f
16,297
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.synapse.implementation; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.synapse.fluent.SqlPoolVulnerabilityAssessmentRuleBaselinesClient; import com.azure.resourcemanager.synapse.fluent.models.SqlPoolVulnerabilityAssessmentRuleBaselineInner; import com.azure.resourcemanager.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline; import com.azure.resourcemanager.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselines; import com.azure.resourcemanager.synapse.models.VulnerabilityAssessmentName; import com.azure.resourcemanager.synapse.models.VulnerabilityAssessmentPolicyBaselineName; public final class SqlPoolVulnerabilityAssessmentRuleBaselinesImpl implements SqlPoolVulnerabilityAssessmentRuleBaselines { private static final ClientLogger LOGGER = new ClientLogger(SqlPoolVulnerabilityAssessmentRuleBaselinesImpl.class); private final SqlPoolVulnerabilityAssessmentRuleBaselinesClient innerClient; private final com.azure.resourcemanager.synapse.SynapseManager serviceManager; public SqlPoolVulnerabilityAssessmentRuleBaselinesImpl( SqlPoolVulnerabilityAssessmentRuleBaselinesClient innerClient, com.azure.resourcemanager.synapse.SynapseManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public void delete( String resourceGroupName, String workspaceName, String sqlPoolName, VulnerabilityAssessmentName vulnerabilityAssessmentName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { this .serviceClient() .delete(resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName); } public Response<Void> deleteWithResponse( String resourceGroupName, String workspaceName, String sqlPoolName, VulnerabilityAssessmentName vulnerabilityAssessmentName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, Context context) { return this .serviceClient() .deleteWithResponse( resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName, context); } public SqlPoolVulnerabilityAssessmentRuleBaseline get( String resourceGroupName, String workspaceName, String sqlPoolName, VulnerabilityAssessmentName vulnerabilityAssessmentName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { SqlPoolVulnerabilityAssessmentRuleBaselineInner inner = this .serviceClient() .get(resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName); if (inner != null) { return new SqlPoolVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); } else { return null; } } public Response<SqlPoolVulnerabilityAssessmentRuleBaseline> getWithResponse( String resourceGroupName, String workspaceName, String sqlPoolName, VulnerabilityAssessmentName vulnerabilityAssessmentName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName, Context context) { Response<SqlPoolVulnerabilityAssessmentRuleBaselineInner> inner = this .serviceClient() .getWithResponse( resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new SqlPoolVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); } else { return null; } } public SqlPoolVulnerabilityAssessmentRuleBaseline getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); if (workspaceName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); } String sqlPoolName = Utils.getValueFromIdByName(id, "sqlPools"); if (sqlPoolName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'sqlPools'.", id))); } VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); if (vulnerabilityAssessmentName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format( "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", id))); } String ruleId = Utils.getValueFromIdByName(id, "rules"); if (ruleId == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); } VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); if (baselineName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); } return this .getWithResponse( resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName, Context.NONE) .getValue(); } public Response<SqlPoolVulnerabilityAssessmentRuleBaseline> getByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); if (workspaceName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); } String sqlPoolName = Utils.getValueFromIdByName(id, "sqlPools"); if (sqlPoolName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'sqlPools'.", id))); } VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); if (vulnerabilityAssessmentName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format( "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", id))); } String ruleId = Utils.getValueFromIdByName(id, "rules"); if (ruleId == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); } VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); if (baselineName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); } return this .getWithResponse( resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName, context); } public void deleteById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); if (workspaceName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); } String sqlPoolName = Utils.getValueFromIdByName(id, "sqlPools"); if (sqlPoolName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'sqlPools'.", id))); } VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); if (vulnerabilityAssessmentName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format( "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", id))); } String ruleId = Utils.getValueFromIdByName(id, "rules"); if (ruleId == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); } VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); if (baselineName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); } this .deleteWithResponse( resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName, Context.NONE); } public Response<Void> deleteByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); if (workspaceName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); } String sqlPoolName = Utils.getValueFromIdByName(id, "sqlPools"); if (sqlPoolName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'sqlPools'.", id))); } VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.fromString(Utils.getValueFromIdByName(id, "vulnerabilityAssessments")); if (vulnerabilityAssessmentName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String .format( "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", id))); } String ruleId = Utils.getValueFromIdByName(id, "rules"); if (ruleId == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); } VulnerabilityAssessmentPolicyBaselineName baselineName = VulnerabilityAssessmentPolicyBaselineName.fromString(Utils.getValueFromIdByName(id, "baselines")); if (baselineName == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); } return this .deleteWithResponse( resourceGroupName, workspaceName, sqlPoolName, vulnerabilityAssessmentName, ruleId, baselineName, context); } private SqlPoolVulnerabilityAssessmentRuleBaselinesClient serviceClient() { return this.innerClient; } private com.azure.resourcemanager.synapse.SynapseManager manager() { return this.serviceManager; } public SqlPoolVulnerabilityAssessmentRuleBaselineImpl define(VulnerabilityAssessmentPolicyBaselineName name) { return new SqlPoolVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); } }
44.527322
119
0.597104
b532b0c50eac874ccb601fb12d84f9bdadb21247
936
package hx.web.front.service.gateway; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.client.RestTemplate; /** * @author mingliang(andyming @ aliyun.com) * @date 2018-07-18 22:46 */ @Controller @RequestMapping("/index") public class IndexController { @Autowired private RestTemplate restTemplate; @RequestMapping(value = "/home",method = RequestMethod.GET) public void index(){ restTemplate.getForEntity("http://localhost:8082/web/gateway/routing/view.login.vue",String.class).getBody(); // String json = restTemplate.postForEntity(targetURL, paramMap, String.class).getBody(); // System.out.println(json); // return json; // return "rule/home"; } }
32.275862
118
0.736111
daa327e039d76d22c6fdb64da8d6903186047a61
605
package fr.novaria.utils.collect; import java.util.Iterator; import java.util.Map; import static com.google.common.base.Preconditions.checkNotNull; public final class MapUtils { public static <K, V> void putAll(Map<K, V> map, Iterator<? extends Map.Entry<? extends K, ? extends V>> iterator) { checkNotNull(map); checkNotNull(iterator); while (iterator.hasNext()) { final Map.Entry<? extends K, ? extends V> next = iterator.next(); map.put(next.getKey(), next.getValue()); } } private MapUtils() { /* Cannot be instantiated */ } }
27.5
119
0.642975
e2248d500bb9ed438cfbbd05f8d8e6cf3a819cef
980
package com.ooqiu.gaming.service.redis.api.impl; import com.alibaba.dubbo.config.annotation.Service; import com.ooqiu.gaming.service.redis.api.RedisService; import com.ooqui.gaming.server.commons.constant.DubboVersionConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import java.util.concurrent.TimeUnit; @Service(version = DubboVersionConstant.DUBBO_VERSION_GAMING_SERVER_SERVICE_REDIS) public class RedisServiceImpl implements RedisService { @Autowired private RedisTemplate redisTemplate; @Override public Object get(String key) { return redisTemplate.opsForValue().get(key); } @Override public void set(String key, Object value) { redisTemplate.opsForValue().set(key, value); } @Override public void set(String key, Object value, int seconds) { redisTemplate.opsForValue().set(key, value, seconds, TimeUnit.SECONDS); } }
31.612903
82
0.762245
dc5234e4dfee9cb0f89587151770e4d7747156f5
2,754
package com.sonyericsson.jenkins.plugins.bfa; import com.codahale.metrics.MetricRegistry; import com.sonyericsson.jenkins.plugins.bfa.model.FailureCause; import com.sonyericsson.jenkins.plugins.bfa.model.IFailureCauseMetricData; import jenkins.metrics.api.Metrics; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.SortedSet; public final class MetricsManager { static final String CAUSEPREFIX = "jenkins_bfa.cause."; static final String CATEGORYPREFIX = "jenkins_bfa.category."; /**A magic cause to represent builds that match no causes in the database. */ public static final FailureCause UNKNOWNCAUSE = new FailureCause("no matching cause", ""); private MetricsManager() { } private static Set<String> getMetricNames(IFailureCauseMetricData cause) { Set<String> metrics = new HashSet<String>(); metrics.add(CAUSEPREFIX + cause.getName()); List<String> categoriesForCause = cause.getCategories(); if (categoriesForCause != null) { for (String string : categoriesForCause) { metrics.add(CATEGORYPREFIX + string); } } return metrics; } /** * Add metrics into the MetricRegistry from the Metrics plugin. * * @param cause The Cause to add metrics for */ public static void addMetric(IFailureCauseMetricData cause) { MetricRegistry metricRegistry = Metrics.metricRegistry(); SortedSet<String> existingMetrics = metricRegistry.getNames(); Set<String> metrics = getMetricNames(cause); for (String metric : metrics) { if (!existingMetrics.contains(metric)) { metricRegistry.counter(metric); } } } /** * Increment counters for the metric and its categories. * @param causes The cause to increment counters for * @param squashCauses Whether or not to squash cause metrics */ public static void incCounters(List<? extends IFailureCauseMetricData> causes, boolean squashCauses) { MetricRegistry metricRegistry = Metrics.metricRegistry(); if (squashCauses) { Set<String> metrics = new HashSet<>(); for (IFailureCauseMetricData cause : causes) { metrics.addAll(getMetricNames(cause)); } for (String metric : metrics) { metricRegistry.counter(metric).inc(); } } else { for (IFailureCauseMetricData cause : causes) { Set<String> metrics = getMetricNames(cause); for (String metric : metrics) { metricRegistry.counter(metric).inc(); } } } } }
36.236842
106
0.641975
1b6eae44c16f4d17e7e0c0433d67e256e9744f88
2,041
import org.junit.Ignore; import org.junit.Test; import org.logicng.datastructures.Assignment; import org.logicng.datastructures.Tristate; import org.logicng.formulas.Formula; import org.logicng.formulas.FormulaFactory; import org.logicng.formulas.Literal; import org.logicng.formulas.Variable; import org.logicng.solvers.MiniSat; import org.logicng.solvers.SATSolver; public class Playground { @Ignore @Test public void assignmentAndSat() { FormulaFactory f = new FormulaFactory(); Variable a = f.variable("A"); Variable b = f.variable("B"); Literal notC = f.literal("C", false); // A & ~(B | ~C); CNF: A & ~B & C => true for A=1, B=0, C=1 Formula formula = f.and(a, f.not(f.or(b, notC))); // assign a positive literal for TRUE and a negative literal for FALSE Assignment assignment = new Assignment(); assignment.addLiteral(a); assignment.addLiteral(b.negate()); assignment.addLiteral(notC.negate()); System.out.println(formula.evaluate(assignment)); // true // NNF and CNF Formula nnf = formula.nnf(); Formula cnf = formula.cnf(); // SAT final SATSolver miniSat = MiniSat.miniSat(f); miniSat.add(formula); final Tristate result = miniSat.sat(); } @Ignore @Test public void restrict() { FormulaFactory f = new FormulaFactory(); Variable a = f.variable("A"); Variable b = f.variable("B"); Literal notC = f.literal("C", false); // A & ~(B | ~C); CNF: A & ~B & C => true for A=1, B=0, C=1 Formula formula = f.and(a, f.not(f.or(b, notC))); // assign a positive literal for TRUE and a negative literal for FALSE Assignment assignment = new Assignment(); assignment.addLiteral(a); assignment.addLiteral(b.negate()); assignment.addLiteral(notC.negate()); System.out.println(assignment.formula(f)); System.out.println(formula.restrict(assignment)); } }
34.016667
78
0.626654
18d55257836e471a8c0482c563575858c62ab5d7
1,063
package org.dryomys.exceptions; import org.dryomys.util.NumericUtils; /** * * @author Gabriele Falace * */ public class ExceptionFactory { private ExceptionFactory() { } /** * Creates an UnsupportedNumberTypeException based on the first object that * is of an unsupported type, given an array of objects. * * @param numbers * an array of Number in which at least one is not of a supported * type * @return an UnsupportedNumberTypeException referring to the first object * of an unsupported type */ public static final UnsupportedTypeException createUnsupportedNumberType(Number... numbers) { UnsupportedTypeException unte = new UnsupportedTypeException( "Unsupported type, not related to a particular number"); for (Number o : numbers) { if (o != null && !NumericUtils.isProper(o)) { unte = new UnsupportedTypeException(o); break; } } return unte; } }
27.973684
97
0.61524
11edd2674f661796d181ea520a8bc3e0f160d828
3,388
package coco.tx; import geo.coco.log.LogUtil; import java.util.LinkedList; public class Queue<E> implements Transmitter<E> { private final Receiver<E> mReceiver; private final LinkedList<E> mQueue = new LinkedList<E>(); private final boolean mSingleThread; private int mMaxSize = Integer.MAX_VALUE; private Boolean mRunning = true; private Boolean mStarted = false; private Boolean mStopped = false; private boolean mFlag1 = false, mFlag2 = false; public Queue(Receiver<E> pReceiver, String pName, long pStartupTimeout, boolean pSingleThread) { if (pReceiver == null) { throw new NullPointerException(); } mReceiver = pReceiver; mSingleThread = pSingleThread; if (!mSingleThread) { if (pName != null) { new Thread(new DispatchingThread(), pName).start(); } else { new Thread(new DispatchingThread()).start(); } if (pStartupTimeout > 0) { waitFor(pStartupTimeout); } } else { mStarted = true; } } public Queue(Receiver<E> pReceiver, long pStartupTimeout, boolean pSingleThread) { this(pReceiver, null, pStartupTimeout, pSingleThread); } public Queue(Receiver<E> pReceiver, boolean pSingleThread) { this(pReceiver, null, 10000, pSingleThread); } public Queue(Receiver<E> pReceiver, String pName, boolean pSingleThread) { this(pReceiver, pName, 10000, pSingleThread); } public void send(E pMessage) { send(pMessage, false); } public void send(E pMessage, boolean pVip) { if (!mStarted) { if (mFlag2) { return; } mFlag2 = true; throw new RuntimeException("queue not started"); } if (mStopped) { if (mFlag1) { return; } mFlag1 = true; throw new RuntimeException("queue stopped"); } if (mSingleThread) { mReceiver.receive(pMessage); return; } synchronized (mQueue) { if (pVip) { mQueue.addFirst(pMessage); } else { mQueue.addLast(pMessage); } mQueue.notify(); } } public boolean isActive() { return mStarted && mRunning; } public void setMaxSize(int pMaxQueueLength) { mMaxSize = pMaxQueueLength; } public int size() { return mQueue.size(); } public void stop() { mRunning = false; synchronized (mQueue) { mQueue.notify(); } } protected boolean waitFor(long pTimeout) { long t = System.currentTimeMillis(); while (!mStarted && System.currentTimeMillis() - t < pTimeout) { try { Thread.sleep(10); } catch (InterruptedException e) { LogUtil.getInstance().logThrowable(e); } } return mStarted; } private class DispatchingThread implements Runnable { public void run() { try { E tE; while (mRunning) { if (!mStarted) { mStarted = true; } synchronized (mQueue) { mQueue.wait(); } while (!mQueue.isEmpty() && mRunning) { synchronized (mQueue) { tE = mQueue.removeFirst(); } mReceiver.receive(tE); if (mQueue.size() > mMaxSize) { mRunning = false; throw new RuntimeException( "max queue length reached: " + mQueue.size()); } } } } catch (Exception e) { LogUtil.getInstance().logThrowable(e); } synchronized (mQueue) { mStopped = true; mQueue.clear(); } } } }
21.579618
76
0.615998
6671bca9da4a4978259db0e3ef2a5b9f0ae61f7b
1,570
package ge.edu.freeuni.sdp.iot.chat.bot.proxies; import ge.edu.freeuni.sdp.iot.chat.bot.model.BathVentSwitch; import org.json.JSONObject; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Response; /** * Created by Koko on 11.07.2016. */ public class BathVentSwitchProxy extends ServiceProxy { public BathVentSwitchProxy(String uri) { super(uri); } public BathVentSwitch getBathVentStatus() { Response response = client. target(uri) .request() .get(); if (!isSuccess(response)) return null; JSONObject object; try { object = new JSONObject(response.readEntity(String.class)); } catch (Exception e) { return null; } return BathVentSwitch.fromJson(object); } public BathVentSwitch changeBathVentStatus(String status, int timeout) { JSONObject jsonObject = new JSONObject(); jsonObject.put("set_status", status); jsonObject.put("timeout", timeout); Response response = client .target(uri) .request() .header("Content-Type", "application/json") .put(Entity.json(jsonObject.toString())); if (!isSuccess(response)) { return null; } JSONObject object; try { object = new JSONObject(response.readEntity(String.class)); } catch (Exception e) { return null; } return BathVentSwitch.fromJson(object); } }
29.074074
76
0.585987
eefcc956d0d6be0f370b8a83c5b9c3398e25a1ba
4,521
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gnagoli.flowable.admin.client.admin.logic.service.engine; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; import org.gnagoli.flowable.admin.client.admin.logic.domain.ServerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Map; /** * Service for invoking Flowable REST services. */ @Service public class AppDefinitionService { private static final Logger LOGGER = LoggerFactory.getLogger(AppDefinitionService.class); @Autowired protected FlowableClientService clientUtil; @Autowired protected ObjectMapper objectMapper; public JsonNode listAppDefinitions(ServerConfig serverConfig, Map<String, String[]> parameterMap) { URIBuilder builder = clientUtil.createUriBuilder("app-repository/app-definitions"); for (String name : parameterMap.keySet()) { builder.addParameter(name, parameterMap.get(name)[0]); } HttpGet get = new HttpGet(clientUtil.getServerUrl(serverConfig, builder.toString())); return clientUtil.executeRequest(get, serverConfig); } public JsonNode getAppDefinition(ServerConfig serverConfig, String appDefinitionId) { HttpGet get = new HttpGet(clientUtil.getServerUrl(serverConfig, "app-repository/app-definitions/" + appDefinitionId)); return clientUtil.executeRequest(get, serverConfig); } public JsonNode getAppDefinitionProcessDefinitions(ServerConfig serverConfig, String deploymentId) { return getDefinitions("repository/deployments?parentDeploymentId=" + deploymentId, "repository/process-definitions?deploymentId=", serverConfig); } public JsonNode getAppDefinitionCaseDefinitions(ServerConfig serverConfig, String deploymentId) { return getDefinitions("cmmn-repository/deployments?parentDeploymentId=" + deploymentId, "cmmn-repository/case-definitions?deploymentId=", serverConfig); } public JsonNode getAppDefinitionDecisionTables(ServerConfig serverConfig, String deploymentId) { return getDefinitions("dmn-repository/deployments?parentDeploymentId=" + deploymentId, "dmn-repository/decision-tables?deploymentId=", serverConfig); } public JsonNode getAppDefinitionFormDefinitions(ServerConfig serverConfig, String deploymentId) { return getDefinitions("form-repository/deployments?parentDeploymentId=" + deploymentId, "form-repository/form-definitions?deploymentId=", serverConfig); } protected JsonNode getDefinitions(String deploymentUrl, String definitionUrl, ServerConfig serverConfig) { HttpGet get = new HttpGet(clientUtil.getServerUrl(serverConfig, deploymentUrl)); JsonNode deploymentsNode = clientUtil.executeRequest(get, serverConfig); if (deploymentsNode != null && deploymentsNode.has("data")) { JsonNode deploymentArrayNode = deploymentsNode.get("data"); if (deploymentArrayNode.isNull() == false && deploymentArrayNode.isArray() && deploymentArrayNode.size() > 0) { String restDeploymentId = deploymentArrayNode.get(0).get("id").asText(); HttpGet getDefinitions = new HttpGet(clientUtil.getServerUrl(serverConfig, definitionUrl + restDeploymentId)); return clientUtil.executeRequest(getDefinitions, serverConfig); } } ObjectNode emptyDefinitionNode = objectMapper.createObjectNode(); emptyDefinitionNode.put("size", 0); emptyDefinitionNode.putArray("data"); return emptyDefinitionNode; } }
47.589474
126
0.731475
6efcac02981634d3f8be66556f51d580d8b73759
1,738
package de.hsw.jpa.beans; import java.util.ArrayList; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Version; @Entity @Table(name = "T_ADDRESS") public class Address { @Id private long id; @Column private String street; @Column private String zipCity; @Version private long version; @OneToMany(mappedBy= "address") private List<CustomerAddress> customers = new ArrayList<>(); public Address() { } public Address(String street, String zipCity, long version) { this.street = street; this.zipCity = zipCity; this.version = version; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getZipCity() { return zipCity; } public void setZipCity(String zipCity) { this.zipCity = zipCity; } public long getVersion() { return version; } public void setVersion(long version) { this.version = version; } @Override public String toString() { return "Address [customers=" + customers + ", id=" + id + ", street=" + street + ", version=" + version + ", zipCity=" + zipCity + "]"; } public List<CustomerAddress> getCustomers() { return customers; } public void setCustomers(List<CustomerAddress> customers) { this.customers = customers; } }
19.75
111
0.617376
92ed445b7a58a8280bcdd587f438f7ec5abf171d
632
package com.hirath.urbanbean; public abstract class Message { private Object bean; private String tag; private String description; public Message(Object bean, String tag, String description) { this.bean = bean; this.tag = tag; this.description = description; } public Object getBean() { return bean; } public String getTag() { return tag; } public String getDescription() { return description; } @Override public String toString() { return "bean : " + bean + ", tag: " + tag + ", description; " + description; } }
20.387097
84
0.591772
c2f1db33672b3e037d45808c9ba592728674fbc1
1,428
/* ========================================== * JGraphT : a free Java graph-theory library * ========================================== * * Project Info: http://jgrapht.sourceforge.net/ * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh) * * (C) Copyright 2003-2008, by Barak Naveh and Contributors. * * This program and the accompanying materials are dual-licensed under * either * * (a) the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation, or (at your option) any * later version. * * or (per the licensee's choosing) * * (b) the terms of the Eclipse Public License v1.0 as published by * the Eclipse Foundation. */ /* ------------------ * EdgeProvider.java * ------------------ * (C) Copyright 2015, by Wil Selwood. * * Original Author: Wil Selwood <wselwood@ijento.com> * */ package org.jgrapht.ext; import java.util.Map; /** * Defines a provider of edges of type E * @param <V> the type of vertex being linked. * @param <E> the type of edge being created. */ public interface EdgeProvider<V, E> { /** * Construct an edge * @param from the source vertex * @param to the target vertex * @param label the label of the edge. * @param attributes extra attributes for the edge. * @return the edge. */ E buildEdge(V from, V to, String label, Map<String, String> attributes); }
27.461538
75
0.621849
77a07c0fa0a403790ec1913e882fdc622f76d008
345
package com.x.edu.opencv; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class Activity18Morphology extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity18_morphology); } }
24.642857
61
0.768116
ac88f6f259ea1bbf40b3f8d2e0c44bb254b7a255
821
package edu.school.restaurantmanager.table; import java.awt.Color; // Цветовете, използвани при рисуването на масa public class TableColorPalette { // Масата public Color Top; // Столът Color Chair; // Сянката от масата на стола Color ChairShadow; // Цветовете, когато масите за свободни и заети static final TableColorPalette AVAILABLE = new TableColorPalette(); static { AVAILABLE.Top = new Color(129, 133, 143); AVAILABLE.Chair = new Color(113, 118, 124); AVAILABLE.ChairShadow = new Color(104, 109, 116); } static final TableColorPalette UNAVAILABLE = new TableColorPalette(); static { UNAVAILABLE.Top = new Color(56, 141, 133); UNAVAILABLE.Chair = new Color(56, 111, 120); UNAVAILABLE.ChairShadow = new Color(56, 116, 107); } }
24.878788
73
0.679659
d66b6837a64a79f97068cf4fef6cf491d09d3237
15,526
/* *AVISO LEGAL © Copyright *Este programa esta protegido por la ley de derechos de autor. *La reproduccion o distribucion ilicita de este programa o de cualquiera de *sus partes esta penado por la ley con severas sanciones civiles y penales, *y seran objeto de todas las sanciones legales que correspondan. *Su contenido no puede copiarse para fines comerciales o de otras, *ni puede mostrarse, incluso en una version modificada, en otros sitios Web. Solo esta permitido colocar hipervinculos al sitio web. */ package com.bydan.erp.tesoreria.presentation.web.jsf.sessionbean.report; import java.util.Set; import java.util.HashSet; import java.util.ArrayList; import java.util.Date; import java.io.Serializable; import com.bydan.framework.erp.util.Constantes; import com.bydan.erp.tesoreria.business.entity.*; @SuppressWarnings("unused") public class SaldosDiariosBancosSessionBean extends SaldosDiariosBancosSessionBeanAdditional { private static final long serialVersionUID = 1L; protected Boolean isPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos; protected Boolean isPermiteRecargarInformacion; protected String sNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos; protected Boolean isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos; protected Long lIdSaldosDiariosBancosActualForeignKey; protected Long lIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras; protected Boolean isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras; protected String sUltimaBusquedaSaldosDiariosBancos; protected String sServletGenerarHtmlReporte; protected Integer iNumeroPaginacion; protected Integer iNumeroPaginacionPagina; protected String sPathNavegacionActual=""; protected Boolean isPaginaPopup=false; protected String sStyleDivArbol=""; protected String sStyleDivContent=""; protected String sStyleDivOpcionesBanner=""; protected String sStyleDivExpandirColapsar=""; protected String sFuncionBusquedaRapida=""; Boolean isBusquedaDesdeForeignKeySesionEmpresa; Long lidEmpresaActual; Boolean isBusquedaDesdeForeignKeySesionEjercicio; Long lidEjercicioActual; private Long id; private Long id_empresa; private Long id_ejercicio; private Date fecha_desde; private Date fecha_hasta; protected Boolean conGuardarRelaciones=false; protected Boolean estaModoGuardarRelaciones=false; protected Boolean esGuardarRelacionado=false; protected Boolean estaModoBusqueda=false; protected Boolean noMantenimiento=false; protected SaldosDiariosBancosSessionBeanAdditional saldosdiariosbancosSessionBeanAdditional=null; public SaldosDiariosBancosSessionBeanAdditional getSaldosDiariosBancosSessionBeanAdditional() { return this.saldosdiariosbancosSessionBeanAdditional; } public void setSaldosDiariosBancosSessionBeanAdditional(SaldosDiariosBancosSessionBeanAdditional saldosdiariosbancosSessionBeanAdditional) { try { this.saldosdiariosbancosSessionBeanAdditional=saldosdiariosbancosSessionBeanAdditional; } catch(Exception e) { ; } } public SaldosDiariosBancosSessionBean () { this.inicializarSaldosDiariosBancosSessionBean(); } public void inicializarSaldosDiariosBancosSessionBean () { this.isPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos=false; this.isPermiteRecargarInformacion=true; this.sNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos=""; this.isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos=false; this.lIdSaldosDiariosBancosActualForeignKey=0L; this.lIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras=0L; this.isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras=false; this.sUltimaBusquedaSaldosDiariosBancos =""; this.sServletGenerarHtmlReporte=""; this.iNumeroPaginacion=10; this.iNumeroPaginacionPagina=0; this.sPathNavegacionActual=""; this.sFuncionBusquedaRapida=""; this.sStyleDivArbol="display:table-row;width:20%;height:800px;visibility:visible"; this.sStyleDivContent="height:600px;width:80%"; this.sStyleDivOpcionesBanner="display:table-row"; this.sStyleDivExpandirColapsar="display:table-row"; this.isPaginaPopup=false; this.estaModoGuardarRelaciones=true; this.conGuardarRelaciones=false; this.esGuardarRelacionado=false; this.estaModoBusqueda=false; this.noMantenimiento=false; isBusquedaDesdeForeignKeySesionEmpresa=false; lidEmpresaActual=0L; isBusquedaDesdeForeignKeySesionEjercicio=false; lidEjercicioActual=0L; this.id_empresa=-1L; this.id_ejercicio=-1L; this.fecha_desde=new Date(); this.fecha_hasta=new Date(); } public void setPaginaPopupVariables(Boolean isPopupVariables) { if(isPopupVariables) { if(!this.isPaginaPopup) { this.sStyleDivArbol="display:none;width:0px;height:0px;visibility:hidden"; this.sStyleDivContent="height:800px;width:100%";; this.sStyleDivOpcionesBanner="display:none"; this.sStyleDivExpandirColapsar="display:none"; this.isPaginaPopup=true; } } else { if(this.isPaginaPopup) { this.sStyleDivArbol="display:table-row;width:15%;height:600px;visibility:visible;overflow:auto;"; this.sStyleDivContent="height:600px;width:80%"; this.sStyleDivOpcionesBanner="display:table-row"; this.sStyleDivExpandirColapsar="display:table-row"; this.isPaginaPopup=false; } } } public Boolean getisPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos() { return this.isPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos; } public void setisPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos( Boolean isPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos) { this.isPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos= isPermiteNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos; } public Boolean getisPermiteRecargarInformacion() { return this.isPermiteRecargarInformacion; } public void setisPermiteRecargarInformacion( Boolean isPermiteRecargarInformacion) { this.isPermiteRecargarInformacion=isPermiteRecargarInformacion; } public String getsNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos() { return this.sNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos; } public void setsNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos(String sNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos) { this.sNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos = sNombrePaginaNavegacionHaciaForeignKeyDesdeSaldosDiariosBancos; } public Boolean getisBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos() { return isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos; } public void setisBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos( Boolean isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos) { this.isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos= isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancos; } public Long getlIdSaldosDiariosBancosActualForeignKey() { return lIdSaldosDiariosBancosActualForeignKey; } public void setlIdSaldosDiariosBancosActualForeignKey( Long lIdSaldosDiariosBancosActualForeignKey) { this.lIdSaldosDiariosBancosActualForeignKey = lIdSaldosDiariosBancosActualForeignKey; } public Long getlIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras() { return lIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras; } public void setlIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras( Long lIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras) { this.lIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras = lIdSaldosDiariosBancosActualForeignKeyParaPosibleAtras; } public Boolean getisBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras() { return isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras; } public void setisBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras( Boolean isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras) { this.isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras = isBusquedaDesdeForeignKeySesionForeignKeySaldosDiariosBancosParaPosibleAtras; } public String getsUltimaBusquedaSaldosDiariosBancos() { return sUltimaBusquedaSaldosDiariosBancos; } public void setsUltimaBusquedaSaldosDiariosBancos(String sUltimaBusquedaSaldosDiariosBancos) { this.sUltimaBusquedaSaldosDiariosBancos = sUltimaBusquedaSaldosDiariosBancos; } public String getsServletGenerarHtmlReporte() { return sServletGenerarHtmlReporte; } public void setsServletGenerarHtmlReporte(String sServletGenerarHtmlReporte) { this.sServletGenerarHtmlReporte = sServletGenerarHtmlReporte; } public Integer getiNumeroPaginacion() { return iNumeroPaginacion; } public void setiNumeroPaginacion(Integer iNumeroPaginacion) { this.iNumeroPaginacion= iNumeroPaginacion; } public Integer getiNumeroPaginacionPagina() { return iNumeroPaginacionPagina; } public void setiNumeroPaginacionPagina(Integer iNumeroPaginacionPagina) { this.iNumeroPaginacionPagina= iNumeroPaginacionPagina; } public String getsPathNavegacionActual() { return this.sPathNavegacionActual; } public void setsPathNavegacionActual(String sPathNavegacionActual) { this.sPathNavegacionActual = sPathNavegacionActual; } public Boolean getisPaginaPopup() { return this.isPaginaPopup; } public void setisPaginaPopup(Boolean isPaginaPopup) { this.isPaginaPopup = isPaginaPopup; } public String getsStyleDivArbol() { return this.sStyleDivArbol; } public void setsStyleDivArbol(String sStyleDivArbol) { this.sStyleDivArbol = sStyleDivArbol; } public String getsStyleDivContent() { return this.sStyleDivContent; } public void setsStyleDivContent(String sStyleDivContent) { this.sStyleDivContent = sStyleDivContent; } public String getsStyleDivOpcionesBanner() { return this.sStyleDivOpcionesBanner; } public void setsStyleDivOpcionesBanner(String sStyleDivOpcionesBanner) { this.sStyleDivOpcionesBanner = sStyleDivOpcionesBanner; } public String getsStyleDivExpandirColapsar() { return this.sStyleDivExpandirColapsar; } public void setsStyleDivExpandirColapsar(String sStyleDivExpandirColapsar) { this.sStyleDivExpandirColapsar = sStyleDivExpandirColapsar; } public String getsFuncionBusquedaRapida() { return this.sFuncionBusquedaRapida; } public void setsFuncionBusquedaRapida(String sFuncionBusquedaRapida) { this.sFuncionBusquedaRapida = sFuncionBusquedaRapida; } public Boolean getConGuardarRelaciones() { return this.conGuardarRelaciones; } public void setConGuardarRelaciones(Boolean conGuardarRelaciones) { this.conGuardarRelaciones = conGuardarRelaciones; } public Boolean getEstaModoGuardarRelaciones() { return this.estaModoGuardarRelaciones; } public void setEstaModoGuardarRelaciones(Boolean estaModoGuardarRelaciones) { this.estaModoGuardarRelaciones = estaModoGuardarRelaciones; } public Boolean getEsGuardarRelacionado() { return this.esGuardarRelacionado; } public void setEsGuardarRelacionado(Boolean esGuardarRelacionado) { this.esGuardarRelacionado = esGuardarRelacionado; } public Boolean getEstaModoBusqueda() { return this.estaModoBusqueda; } public void setEstaModoBusqueda(Boolean estaModoBusqueda) { this.estaModoBusqueda = estaModoBusqueda; } public Boolean getNoMantenimiento() { return this.noMantenimiento; } public void setNoMantenimiento(Boolean noMantenimiento) { this.noMantenimiento = noMantenimiento; } public Long getid() { return this.id; } public Long getid_empresa() { return this.id_empresa; } public Long getid_ejercicio() { return this.id_ejercicio; } public Date getfecha_desde() { return this.fecha_desde; } public Date getfecha_hasta() { return this.fecha_hasta; } public void setid(Long newid)throws Exception { try { if(this.id!=newid) { if(newid==null) { //newid=0L; if(Constantes.ISDEVELOPING) { System.out.println("SaldosDiariosBancos:Valor nulo no permitido en columna id"); } } this.id=newid; } } catch(Exception e) { throw e; } } public void setid_empresa(Long newid_empresa)throws Exception { try { if(this.id_empresa!=newid_empresa) { if(newid_empresa==null) { //newid_empresa=-1L; if(Constantes.ISDEVELOPING) { System.out.println("SaldosDiariosBancos:Valor nulo no permitido en columna id_empresa"); } } this.id_empresa=newid_empresa; } } catch(Exception e) { throw e; } } public void setid_ejercicio(Long newid_ejercicio)throws Exception { try { if(this.id_ejercicio!=newid_ejercicio) { if(newid_ejercicio==null) { //newid_ejercicio=-1L; if(Constantes.ISDEVELOPING) { System.out.println("SaldosDiariosBancos:Valor nulo no permitido en columna id_ejercicio"); } } this.id_ejercicio=newid_ejercicio; } } catch(Exception e) { throw e; } } public void setfecha_desde(Date newfecha_desde)throws Exception { try { if(this.fecha_desde!=newfecha_desde) { if(newfecha_desde==null) { //newfecha_desde=new Date(); if(Constantes.ISDEVELOPING) { System.out.println("SaldosDiariosBancos:Valor nulo no permitido en columna fecha_desde"); } } this.fecha_desde=newfecha_desde; } } catch(Exception e) { throw e; } } public void setfecha_hasta(Date newfecha_hasta)throws Exception { try { if(this.fecha_hasta!=newfecha_hasta) { if(newfecha_hasta==null) { //newfecha_hasta=new Date(); if(Constantes.ISDEVELOPING) { System.out.println("SaldosDiariosBancos:Valor nulo no permitido en columna fecha_hasta"); } } this.fecha_hasta=newfecha_hasta; } } catch(Exception e) { throw e; } } public Boolean getisBusquedaDesdeForeignKeySesionEmpresa() { return isBusquedaDesdeForeignKeySesionEmpresa; } public void setisBusquedaDesdeForeignKeySesionEmpresa( Boolean isBusquedaDesdeForeignKeySesionEmpresa) { this.isBusquedaDesdeForeignKeySesionEmpresa = isBusquedaDesdeForeignKeySesionEmpresa; } public Long getlidEmpresaActual() { return lidEmpresaActual; } public void setlidEmpresaActual(Long lidEmpresaActual) { this.lidEmpresaActual = lidEmpresaActual; } public Boolean getisBusquedaDesdeForeignKeySesionEjercicio() { return isBusquedaDesdeForeignKeySesionEjercicio; } public void setisBusquedaDesdeForeignKeySesionEjercicio( Boolean isBusquedaDesdeForeignKeySesionEjercicio) { this.isBusquedaDesdeForeignKeySesionEjercicio = isBusquedaDesdeForeignKeySesionEjercicio; } public Long getlidEjercicioActual() { return lidEjercicioActual; } public void setlidEjercicioActual(Long lidEjercicioActual) { this.lidEjercicioActual = lidEjercicioActual; } }
30.744554
164
0.779789
214d3a0f722c03972fdd5c9d258ac8759b0b0395
5,341
package ru.kontur.vostok.hercules.health; import ru.kontur.vostok.hercules.util.CollectionUtil; import ru.kontur.vostok.hercules.util.metrics.GraphiteMetricsUtil; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; import java.lang.management.OperatingSystemMXBean; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; /** * CommonMetrics - set of common metrics * * @author Kirill Sulim */ public final class CommonMetrics { private CommonMetrics() { /* static class */ } public static void registerCommonMetrics(MetricsCollector metricsCollector) { registerMemoryMetrics(metricsCollector); registerSystemMetrics(metricsCollector); registerGarbageCollectionMetrics(metricsCollector); registerThreadsMetrics(metricsCollector); } public static void registerCommonMetrics(MetricsCollector metricsCollector, String ... patterns) { registerMemoryMetrics(metricsCollector); registerSystemMetrics(metricsCollector); registerGarbageCollectionMetrics(metricsCollector); registerThreadsMetrics(metricsCollector, patterns); } public static void registerMemoryMetrics(MetricsCollector metricsCollector) { final Runtime runtime = Runtime.getRuntime(); metricsCollector.gauge("memory.totalMemoryBytes", runtime::totalMemory); metricsCollector.gauge("memory.freeMemoryBytes", runtime::freeMemory); metricsCollector.gauge("memory.usedMemoryBytes", () -> runtime.totalMemory() - runtime.freeMemory()); metricsCollector.gauge("memory.maxMemoryBytes", runtime::maxMemory); metricsCollector.gauge("memory.totalFreeMemoryBytes", () -> runtime.maxMemory() - runtime.totalMemory() + runtime.freeMemory()); final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); if (Objects.nonNull(memoryMXBean)) { metricsCollector.gauge("memory.heapMaxBytes", () -> memoryMXBean.getHeapMemoryUsage().getMax()); metricsCollector.gauge("memory.heapUsedBytes", () -> memoryMXBean.getHeapMemoryUsage().getUsed()); metricsCollector.gauge("memory.nonHeapMaxBytes", () -> memoryMXBean.getNonHeapMemoryUsage().getMax()); metricsCollector.gauge("memory.nonHeapUsedBytes", () -> memoryMXBean.getNonHeapMemoryUsage().getUsed()); } } public static void registerSystemMetrics(MetricsCollector metricsCollector) { final OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); if (Objects.nonNull(operatingSystemMXBean)) { metricsCollector.gauge("os.loadAverage", operatingSystemMXBean::getSystemLoadAverage); } } public static void registerGarbageCollectionMetrics(MetricsCollector metricsCollector) { for (GarbageCollectorMXBean garbageCollectorMXBean : CollectionUtil.nullAsEmpty(ManagementFactory.getGarbageCollectorMXBeans())) { String collectorName = garbageCollectorMXBean.getName(); metricsCollector.gauge("gc." + collectorName + ".collectionCount", garbageCollectorMXBean::getCollectionCount); metricsCollector.gauge("gc." + collectorName + ".collectionTimeMs", garbageCollectorMXBean::getCollectionTime); } } public static void registerThreadsMetrics(MetricsCollector metricsCollector, String ... patterns) { final List<Pattern> compiledPatterns = Arrays.stream(patterns).map(Pattern::compile).collect(Collectors.toList()); final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); if (Objects.nonNull(threadMXBean)) { for (Thread.State state : Thread.State.values()) { metricsCollector.gauge( "threads.states." + state.name() + ".count", () -> getThreadCount(threadMXBean, state) ); for (Pattern pattern : compiledPatterns) { final String patternMetricName = GraphiteMetricsUtil.sanitizeMetricName(pattern.pattern()); metricsCollector.gauge( "threads.pattern." + patternMetricName + ".state." + state.name() + ".count", () -> getThreadCount(threadMXBean, pattern, state) ); } } } } private static long getThreadCount(ThreadMXBean threadMXBean, Thread.State state) { return getThreadsInfo(threadMXBean) .filter(ti -> ti.getThreadState().equals(state)) .count(); } private static long getThreadCount(ThreadMXBean threadMXBean, Pattern pattern, Thread.State state) { return getThreadsInfo(threadMXBean) .filter(ti -> pattern.matcher(ti.getThreadName()).matches() && ti.getThreadState().equals(state)) .count(); } private static Stream<ThreadInfo> getThreadsInfo(ThreadMXBean threadMXBean) { return Arrays.stream(threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds())); } }
46.850877
138
0.699494
692e082bf32553acfbe764d44431affe243d758a
11,280
package lcom.sourceModel; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; import lcom.utils.models.Vertex; import org.eclipse.jdt.core.dom.*; import lcom.visitors.DirectAceessFieldVisitor; import lcom.visitors.InstanceOfVisitor; public class SM_Method extends SM_SourceItem implements Vertex { private boolean abstractMethod; private boolean finalMethod; private boolean staticMethod; private boolean isConstructor; private SM_Type parentType; private MethodDeclaration methodDeclaration; private List<SM_Method> calledMethodsList = new ArrayList<>(); private List<SM_Parameter> parameterList = new ArrayList<>(); private List<SM_LocalVar> localVarList = new ArrayList<>(); private List<MethodInvocation> calledMethods = new ArrayList<>(); private List<SM_Type> referencedTypeList = new ArrayList<>(); private List<SimpleName> namesInMethod = new ArrayList<>(); private List<FieldAccess> thisAccessesInMethod = new ArrayList<>(); private List<SM_Field> directFieldAccesses = new ArrayList<>(); private List<SM_Field> superClassFieldAccesses = new ArrayList<>(); private List<Type> typesInInstanceOf = new ArrayList<>(); private List<SM_Type> smTypesInInstanceOf = new ArrayList<>(); private List<SM_Type> smTypesInNewStatements = new ArrayList<>(); private List<Type> newStatementTypes; private boolean isOverridden; public SM_Method(MethodDeclaration methodDeclaration, SM_Type typeObj) { name = methodDeclaration.getName().toString(); this.parentType = typeObj; this.methodDeclaration = methodDeclaration; setMethodInfo(methodDeclaration); setAccessModifier(methodDeclaration.getModifiers()); } private void setMethodInfo(MethodDeclaration method) { int modifiers = method.getModifiers(); if (Modifier.isAbstract(modifiers)) abstractMethod = true; if (Modifier.isFinal(modifiers)) finalMethod = true; if (Modifier.isStatic(modifiers)) staticMethod = true; if (method.isConstructor()) isConstructor = true; setMethodOverridden(); } public boolean isAbstract() { return this.abstractMethod; } public boolean isStatic() { return this.staticMethod; } public boolean isFinal() { return this.finalMethod; } public boolean isConstructor() { return this.isConstructor; } public SM_Type getParentType() { return parentType; } List<SM_Parameter> getParameterList() { return parameterList; } public List<SM_LocalVar> getLocalVarList() { return localVarList; } public List<SM_Method> getCalledMethods() { return calledMethodsList; } private void parseParameters() { for (SM_Parameter param : parameterList) { param.parse(); } } private void parseLocalVar() { for (SM_LocalVar var : localVarList) { var.parse(); } } @Override public void parse() { populateMethodInvocations(); populateParameters(); populateLocalVars(); populateFieldAccess(); populateInstanceOf(); populateNewStatement(); } private void populateNewStatement() { NewStatementVisitor newStatementVisitor = new NewStatementVisitor(methodDeclaration); methodDeclaration.accept(newStatementVisitor); newStatementTypes = newStatementVisitor.getTypeList(); } private void populateInstanceOf() { InstanceOfVisitor instanceOfVisitor = new InstanceOfVisitor(); methodDeclaration.accept(instanceOfVisitor); List<Type> instanceOfTypes = instanceOfVisitor.getTypesInInstanceOf(); if (instanceOfTypes.size() > 0) { typesInInstanceOf.addAll(instanceOfTypes); } } private void populateFieldAccess() { DirectAceessFieldVisitor directAceessFieldVisitor = new DirectAceessFieldVisitor(); methodDeclaration.accept(directAceessFieldVisitor); List<SimpleName> names = directAceessFieldVisitor.getNames(); List<FieldAccess> thisAccesses = directAceessFieldVisitor.getThisAccesses(); if (names.size() > 0) { namesInMethod.addAll(names); } if (thisAccesses.size() > 0) { thisAccessesInMethod.addAll(thisAccesses); } } private void populateLocalVars() { LocalVarVisitor localVarVisitor = new LocalVarVisitor(this); methodDeclaration.accept(localVarVisitor); List<SM_LocalVar> lList = localVarVisitor.getLocalVarList(); if (lList.size() > 0) { localVarList.addAll(lList); } parseLocalVar(); } private void populateParameters() { List<SingleVariableDeclaration> variableList = methodDeclaration.parameters(); for (SingleVariableDeclaration var : variableList) { VariableVisitor parameterVisitor = new VariableVisitor(this); // methodDeclaration.accept(parameterVisitor); var.accept(parameterVisitor); List<SM_Parameter> pList = parameterVisitor.getParameterList(); if (pList.size() > 0) { parameterList.addAll(pList); } parseParameters(); } } private void populateMethodInvocations() { MethodInvVisitor invVisitor = new MethodInvVisitor(methodDeclaration); methodDeclaration.accept(invVisitor); List<MethodInvocation> invList = invVisitor.getCalledMethods(); if (invList.size() > 0) { calledMethods.addAll(invList); } } @Override public void resolve() { for (SM_Parameter param : parameterList) { param.resolve(); } for (SM_LocalVar localVar : localVarList) { localVar.resolve(); } calledMethodsList = (new Resolver()).inferCalledMethods(calledMethods, parentType); resolveNewInstanceTypes(); setReferencedTypes(); setDirectFieldAccesses(); setSMTypesInInstanceOf(); } private void resolveNewInstanceTypes() { Resolver resolver = new Resolver(); for (Type type : newStatementTypes) { SM_Type smType = resolver.resolveType(type, parentType.getParentPkg().getParentProject()); if (smType != null && !smTypesInNewStatements.contains(smType)) { smTypesInNewStatements.add(smType); } } } private void setReferencedTypes() { for (SM_Parameter param : parameterList) { if (!param.isPrimitiveType()) { addunique(param.getType()); } } for (SM_LocalVar localVar : localVarList) { if (!localVar.isPrimitiveType()) { addunique(localVar.getType()); } } for (SM_Method methodCall : calledMethodsList) { if (methodCall.isStatic()) { addunique(methodCall.getParentType()); } } for (SM_Type type : smTypesInNewStatements) { addunique(type); } } private void setDirectFieldAccesses() { for (FieldAccess thisAccess : thisAccessesInMethod) { SM_Field sameField = getFieldWithSameName(thisAccess.getName().toString()); if (sameField != null) { if (!directFieldAccesses.contains(sameField)) { directFieldAccesses.add(sameField); } } SM_Field field = getFieldFromSuperClass(thisAccess.getName().toString()); if (field != null) { if (!superClassFieldAccesses.contains(field)) { superClassFieldAccesses.add(field); } } } for (SimpleName name : namesInMethod) { if (!existsAsNameInLocalVars(name.toString())) { SM_Field sameField = getFieldWithSameName(name.toString()); if (sameField != null) { if (!directFieldAccesses.contains(sameField)) { directFieldAccesses.add(sameField); } } SM_Field field = getFieldFromSuperClass(name.toString()); if (field != null) { if (!superClassFieldAccesses.contains(field)) { superClassFieldAccesses.add(field); } } } } } private SM_Field getFieldFromSuperClass(String fieldName) { if (parentType.getSuperTypes().isEmpty()) return null; for (SM_Type type : parentType.getSuperTypes()) for (SM_Field field : type.getFieldList()) { if (fieldName.equals(field.getName())) { return field; } } return null; } private boolean existsAsNameInLocalVars(String name) { for (SM_LocalVar localVar : localVarList) { if (name.equals(localVar.getName())) { return true; } } return false; } private SM_Field getFieldWithSameName(String name) { for (SM_Field field : parentType.getFieldList()) { if (name.equals(field.getName())) { return field; } } return null; } private void setSMTypesInInstanceOf() { Resolver resolver = new Resolver(); for (Type type : typesInInstanceOf) { SM_Type smType = resolver.resolveType(type, parentType.getParentPkg().getParentProject()); if (smType != null && !smTypesInInstanceOf.contains(smType)) { smTypesInInstanceOf.add(smType); } } } private void addunique(SM_Type variableType) { if (!referencedTypeList.contains(variableType)) referencedTypeList.add(variableType); } List<SM_Type> getReferencedTypeList() { return referencedTypeList; } public List<SM_Field> getDirectFieldAccesses() { return directFieldAccesses; } public List<SM_Field> getNonStaticFieldAccesses() { List<SM_Field> fields = new ArrayList<>(); for (SM_Field field : directFieldAccesses) if (!field.isStatic()) fields.add(field); return fields; } private void setMethodOverridden() { MarkerAnnotationVisitor markerAnnotationVisitor = new MarkerAnnotationVisitor(); methodDeclaration.accept(markerAnnotationVisitor); isOverridden = markerAnnotationVisitor.isOverridden(); } public boolean isOverridden() { return isOverridden; } public List<SM_Field> getFieldAccessesFromSuperClass() { return superClassFieldAccesses; } }
34.601227
103
0.602039
1fc036166baaa3d2d5b3e5f877663728232b73d3
365
package abstractFactory; public class Shop { IFactory factoryCategory; public Shop(IFactory category) { this.factoryCategory = category; } public void createPackage() { ICostume costume = this.factoryCategory.createCostume(); IWeapon weapon = this.factoryCategory.createWeapon(); costume.protection(); weapon.power(); } }
19.210526
59
0.69863
ddc46c7db21ae154cfdcd20a8e78833b30bd4ae8
1,037
package com.example.android.miwok; /** * Created by sreejith on 12/2/17. */ public class word { private String en_number; private String mal_number; private int audio_number; private int image_number; //class constructor 1 public word(String en, String mal, int audio_id, int image_id) { en_number = en; mal_number = mal; audio_number = audio_id; image_number = image_id; } //class constructor 2 public word(String en, String mal, int audio_id) { en_number = en; mal_number = mal; audio_number = audio_id; } // method to return malayalam number public String getMal_number() { return mal_number; } // method to return english number public String getEng_number() { return en_number; } // method to return audio file public int getaudio() { return audio_number; } // method to return image file public int getimage() { return image_number; } }
18.517857
68
0.616201
992d49a3d1830e621c54bfd34723e98d52030223
5,192
/* * Copyright (c) 2021 Moataz Abdelnasser * * 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: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * 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.github.mizosoft.methanol.adapter.jackson; import static com.github.mizosoft.methanol.adapter.jackson.JacksonAdapterFactory.createDecoder; import static com.github.mizosoft.methanol.testutils.Verification.verifyThat; import static java.nio.charset.StandardCharsets.UTF_16; import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.github.mizosoft.methanol.TypeRef; import com.github.mizosoft.methanol.testutils.TestException; import java.io.UncheckedIOException; import java.util.List; import org.junit.jupiter.api.Test; class JacksonDeferredDecoderTest { @Test void deserialize() { verifyThat(createDecoder()) .converting(Point.class) .withDeferredBody("{\"x\":1, \"y\":2}") .succeedsWith(new Point(1, 2)); } @Test void deserializeWithUtf16() { verifyThat(createDecoder()) .converting(Point.class) .withMediaType("application/json; charset=utf-16") .withDeferredBody("{\"x\":1, \"y\":2}", UTF_16) .succeedsWith(new Point(1, 2)); } @Test void deserializeWithCustomDeserializer() { var mapper = new JsonMapper() .registerModule( new SimpleModule().addDeserializer(Point.class, new CompactPointDeserializer())); verifyThat(createDecoder(mapper)) .converting(Point.class) .withDeferredBody("[1, 2]") .succeedsWith(new Point(1, 2)); } @Test void deserializeWithGenerics() { verifyThat(createDecoder()) .converting(new TypeRef<List<Point>>() {}) .withDeferredBody("[{\"x\":1, \"y\":2}, {\"x\":3, \"y\":4}]") .succeedsWith(List.of(new Point(1, 2), new Point(3, 4))); } @Test void deserializeWithGenericsAndCustomDeserializer() { var mapper = new JsonMapper() .registerModule( new SimpleModule().addDeserializer(Point.class, new CompactPointDeserializer())); verifyThat(createDecoder(mapper)) .converting(new TypeRef<List<Point>>() {}) .withDeferredBody("[[1, 2], [3, 4]]") .succeedsWith(List.of(new Point(1, 2), new Point(3, 4))); } @Test void deserializeWithLenientMapper() { var mapper = new ObjectMapper() .enable(Feature.ALLOW_COMMENTS) .enable(Feature.ALLOW_SINGLE_QUOTES) .enable(Feature.ALLOW_UNQUOTED_FIELD_NAMES); verifyThat(createDecoder(mapper)) .converting(Point.class) .withDeferredBody( "{\n" + " x: '1',\n" + " y: '2' // This is a comment \n" + "}") .succeedsWith(new Point(1, 2)); } /** Test that the used parser has access to the underlying ObjectMapper. */ @Test void deserializeWithCustomDeserializerThatNeedsParserCodec() { var mapper = new ObjectMapper() .registerModule( new SimpleModule().addDeserializer(Point.class, new PointTreeNodeDeserializer())); verifyThat(createDecoder(mapper)) .converting(Point.class) .withDeferredBody("{\"x\":1, \"y\":2}") .succeedsWith(new Point(1, 2)); } @Test void deserializeBadJson() { verifyThat(createDecoder()) .converting(Point.class) .withDeferredBody("{x:\"1\", y:\"2\"") // Missing enclosing bracket .failsWith(UncheckedIOException.class) // IOExceptions are rethrown as UncheckedIOExceptions .withCauseInstanceOf(JsonProcessingException.class); } @Test void deserializeWithError() { // Upstream errors cause the stream used by the supplier to throw // an IOException with the error as its cause. The IOException is // rethrown as an UncheckedIOException. verifyThat(createDecoder()) .converting(Point.class) .withDeferredFailure(new TestException()) .failsWith(UncheckedIOException.class) .havingCause() .withCauseInstanceOf(TestException.class); } }
37.623188
100
0.693374
b1f6996f4cd4ca05db5964140f3bac9dcbe375f9
94
package com.google.common.cache; public interface Weigher<K, V> { int weigh(K k, V v); }
15.666667
32
0.670213
93ad4da0bec78a319c348e685aa7244abda66307
32,586
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.flowable.cmmn.test.runtime; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import org.flowable.cmmn.api.runtime.CaseInstance; import org.flowable.cmmn.api.runtime.PlanItemDefinitionType; import org.flowable.cmmn.api.runtime.PlanItemInstance; import org.flowable.cmmn.api.runtime.PlanItemInstanceState; import org.flowable.cmmn.api.runtime.UserEventListenerInstance; import org.flowable.cmmn.engine.test.CmmnDeployment; import org.flowable.cmmn.engine.test.FlowableCmmnTestCase; import org.flowable.task.api.Task; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * @author Joram Barrez */ public class PlanItemInstanceQueryTest extends FlowableCmmnTestCase { protected String deploymentId; protected String caseDefinitionId; @Before public void deployCaseDefinition() { this.deploymentId = cmmnRepositoryService.createDeployment() .addClasspathResource("org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.testPlanItemInstanceQuery.cmmn") .deploy() .getId(); caseDefinitionId = cmmnRepositoryService.createCaseDefinitionQuery() .deploymentId(deploymentId) .singleResult() .getId(); } @After public void deleteDeployment() { cmmnRepositoryService.deleteDeployment(deploymentId, true); } @Test public void testByCaseDefinitionId() { startInstances(5); assertEquals(20, cmmnRuntimeService.createPlanItemInstanceQuery().list().size()); } @Test public void testByCaseInstanceId() { List<String> caseInstanceIds = startInstances(3); for (String caseInstanceId : caseInstanceIds) { assertEquals(4, cmmnRuntimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstanceId).list().size()); } } @Test public void testByStageInstanceId() { startInstances(1); PlanItemInstance planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemDefinitionType(PlanItemDefinitionType.STAGE) .planItemInstanceName("Stage one") .singleResult(); assertEquals(2, cmmnRuntimeService.createPlanItemInstanceQuery().stageInstanceId(planItemInstance.getId()).count()); } @Test public void testByPlanItemInstanceId() { startInstances(1); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery().list(); for (PlanItemInstance planItemInstance : planItemInstances) { assertEquals(1L, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceId(planItemInstance.getId()).count()); } } @Test public void testByElementId() { startInstances(4); assertEquals(4, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceElementId("planItem3").list().size()); } @Test public void testByName() { startInstances(9); assertEquals(9, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("B").list().size()); } @Test public void testByState() { startInstances(1); assertEquals(2, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceState(PlanItemInstanceState.ACTIVE).list().size()); assertEquals(2, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateActive().list().size()); assertEquals(1, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceState(PlanItemInstanceState.AVAILABLE).list().size()); assertEquals(1, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateAvailable().list().size()); assertEquals(1, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceState(PlanItemInstanceState.ENABLED).list().size()); assertEquals(1, cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateEnabled().list().size()); } @Test public void testByPlanItemDefinitionType() { startInstances(3); assertEquals(6, cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK).list().size()); assertEquals(6, cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.STAGE).list().size()); } @Test public void testByPlanItemDefinitionTypes() { startInstances(2); assertEquals(8, cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionTypes(Arrays.asList(PlanItemDefinitionType.STAGE, PlanItemDefinitionType.HUMAN_TASK)).list().size()); } @Test public void testByStateEnabled() { startInstances(4); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceStateEnabled() .list(); assertThat(planItemInstances) .hasSize(4) .extracting(PlanItemInstance::getName).containsOnly("B"); } @Test public void testByStateDisabled() { startInstances(5); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceStateEnabled() .list(); cmmnRuntimeService.disablePlanItemInstance(planItemInstances.get(0).getId()); cmmnRuntimeService.disablePlanItemInstance(planItemInstances.get(1).getId()); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateDisabled().list()) .hasSize(2) .extracting(PlanItemInstance::getName).containsOnly("B"); } @Test public void testByStateAvailable() { startInstances(3); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceStateAvailable() .orderByName().asc() .list(); assertThat(planItemInstances) .hasSize(3) .extracting(PlanItemInstance::getName).containsOnly("Stage two"); } @Test public void testByStateActive() { startInstances(2); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceStateActive() .orderByName().asc() .list(); assertThat(planItemInstances) .hasSize(4) .extracting(PlanItemInstance::getName).containsExactly("A", "A", "Stage one", "Stage one"); } @Test public void testByStateAndType() { startInstances(3); assertEquals(3, cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceState(PlanItemInstanceState.ACTIVE) .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .list().size()); assertEquals(3, cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceState(PlanItemInstanceState.ENABLED) .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .list().size()); } @Test public void testByStateCompleted() { startInstances(4); List<Task> tasks = cmmnTaskService.createTaskQuery().list(); cmmnTaskService.complete(tasks.get(0).getId()); cmmnTaskService.complete(tasks.get(1).getId()); cmmnTaskService.complete(tasks.get(3).getId()); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceStateCompleted() .ended() .list(); assertThat(planItemInstances) .hasSize(3) .extracting(PlanItemInstance::getName).containsOnly("A"); // includeEnded should also return the same result assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateCompleted().includeEnded().list()).hasSize(3); // Without ended, should only return runtime plan item instances assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateCompleted().list()).hasSize(0); } @Test @CmmnDeployment public void testByStateTerminated() { CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("testQueryByStateTerminated").start(); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .ended() .planItemInstanceStateTerminated() .list(); assertThat(planItemInstances).hasSize(0); // Completing the user event will terminate A/C/Stage for c UserEventListenerInstance userEventListenerInstance = cmmnRuntimeService.createUserEventListenerInstanceQuery() .caseInstanceId(caseInstance.getId()) .singleResult(); cmmnRuntimeService.completeUserEventListenerInstance(userEventListenerInstance.getId()); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .ended() .planItemInstanceStateTerminated() .orderByName().asc() .list(); assertThat(planItemInstances) .extracting(PlanItemInstance::getName) .containsExactly("A", "C", "The Stage"); } @Test public void testIncludeEnded() { startInstances(11); List<Task> tasks = cmmnTaskService.createTaskQuery().list(); cmmnTaskService.complete(tasks.get(0).getId()); cmmnTaskService.complete(tasks.get(1).getId()); cmmnTaskService.complete(tasks.get(2).getId()); cmmnTaskService.complete(tasks.get(3).getId()); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("A").list(); assertThat(planItemInstances).hasSize(7); // 11 - 4 (runtime only) planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("A").includeEnded().list(); assertThat(planItemInstances).hasSize(11); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("A").ended().list(); assertThat(planItemInstances).hasSize(4); } @Test public void testCreatedBefore() { Date now = new Date(); setClockTo(now); startInstances(3); setClockTo(new Date(now.getTime() + 20000)); startInstances(4); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceCreatedBefore(new Date(now.getTime() + 10000)) .list(); assertThat(planItemInstances).hasSize(3); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceCreatedBefore(new Date(now.getTime() + 30000)) .list(); assertThat(planItemInstances).hasSize(7); } @Test public void testCreatedAfter() { Date now = new Date(); setClockTo(now); startInstances(2); setClockTo(new Date(now.getTime() + 20000)); startInstances(8); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceCreatedAfter(new Date(now.getTime() - 10000)) .list(); assertThat(planItemInstances).hasSize(10); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceCreatedAfter(new Date(now.getTime() + 10000)) .list(); assertThat(planItemInstances).hasSize(8); } @Test public void testLastAvailableBeforeAndAfter() { Date now = new Date(); setClockTo(now); startInstances(3); setClockTo(new Date(now.getTime() + 20000)); startInstances(5); List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceLastAvailableAfter(new Date(now.getTime() - 10000)) .list(); assertThat(planItemInstances).hasSize(8); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceLastAvailableBefore(new Date(now.getTime() - 10000)) .list(); assertThat(planItemInstances).hasSize(0); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceLastAvailableAfter(new Date(now.getTime() + 10000)) .list(); assertThat(planItemInstances).hasSize(5); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("A") .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) .planItemInstanceLastAvailableBefore(new Date(now.getTime() + 10000)) .list(); assertThat(planItemInstances).hasSize(3); } @Test public void testLastEnabledBeforeAndAfter() { Date now = new Date(); setClockTo(now); startInstances(2); setClockTo(now.getTime() + 10000); startInstances(3); // Before List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceLastEnabledBefore(new Date(now.getTime() + 30000)).list(); assertThat(planItemInstances).hasSize(5); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceLastEnabledBefore(new Date(now.getTime() + 5000)).list(); assertThat(planItemInstances).hasSize(2); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceLastEnabledBefore(new Date(now.getTime() - 1000)).list(); assertThat(planItemInstances).hasSize(0); // After planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceLastEnabledAfter(new Date(now.getTime() - 5000)).list(); assertThat(planItemInstances).hasSize(5); planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceLastEnabledAfter(new Date(now.getTime() + 250000)).list(); assertThat(planItemInstances).hasSize(0); } @Test public void testLastDisabledBeforeAndAfter() { Date now = new Date(); setClockTo(now); startInstances(3); String planItemInstanceId = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("B").planItemInstanceStateEnabled().listPage(0, 1).get(0).getId(); cmmnRuntimeService.disablePlanItemInstance(planItemInstanceId); setClockTo(now.getTime() + 10000); cmmnRuntimeService.disablePlanItemInstance(cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("B").planItemInstanceStateEnabled().listPage(0, 1).get(0).getId()); // Before assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledBefore(new Date(now.getTime() + 20000)).list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledBefore(new Date(now.getTime() + 5000)).list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledBefore(new Date(now.getTime() - 5000)).list()).hasSize(0); // After assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledAfter(new Date(now.getTime())).list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledAfter(new Date(now.getTime() + 5000)).list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledAfter(new Date(now.getTime() + 11000)).list()).hasSize(0); // Re-enable and disable PlanItemInstance planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceId(planItemInstanceId).singleResult(); Date lastEnabledTime = planItemInstance.getLastEnabledTime(); assertThat(lastEnabledTime).isNotNull(); setClockTo(now.getTime() + 30000); cmmnRuntimeService.enablePlanItemInstance(planItemInstanceId); cmmnRuntimeService.disablePlanItemInstance(planItemInstanceId); planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceId(planItemInstanceId).singleResult(); assertThat(planItemInstance.getLastEnabledTime()).isNotEqualTo(lastEnabledTime); // Recheck queries assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledBefore(new Date(now.getTime() + 20000)).list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledBefore(new Date(now.getTime() + 5000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledAfter(new Date(now.getTime())).list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledAfter(new Date(now.getTime() + 15000)).list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastDisabledAfter(new Date(now.getTime() + 35000)).list()).hasSize(0); } @Test public void testLastStartedBeforeAndAfter() { Date now = new Date(); setClockTo(now); startInstances(4); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedAfter(new Date(now.getTime() - 1000)).list()).hasSize(8); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedAfter(new Date(now.getTime() + 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedBefore(new Date(now.getTime() + 1000)).list()).hasSize(8); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedBefore(new Date(now.getTime() - 1000)).list()).hasSize(0); // Starting an enabled planitem setClockTo(now.getTime() + 10000); cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("B").listPage(0, 2) .forEach(p -> cmmnRuntimeService.startPlanItemInstance(p.getId())); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedAfter(new Date(now.getTime() - 1000)).list()).hasSize(10); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedAfter(new Date(now.getTime() + 5000)).list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedAfter(new Date(now.getTime() + 15000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedBefore(new Date(now.getTime() + 1000)).list()).hasSize(8); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedBefore(new Date(now.getTime() + 15000)).list()).hasSize(10); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceLastStartedBefore(new Date(now.getTime() - 1000)).list()).hasSize(0); } @Test public void testCompletedBeforeAndAfter() { startInstances(5); Date now = new Date(); setClockTo(now); List<Task> tasks = cmmnTaskService.createTaskQuery().listPage(0, 2); setClockTo(now.getTime() + 10000); cmmnTaskService.complete(tasks.get(0).getId()); setClockTo(now.getTime() + 20000); cmmnTaskService.complete(tasks.get(1).getId()); // Completed assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedBefore(new Date(now.getTime() + 30000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedBefore(new Date(now.getTime() + 30000)).includeEnded().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedBefore(new Date(now.getTime() + 15000)).includeEnded().list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedAfter(new Date(now.getTime())).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedAfter(new Date(now.getTime())).includeEnded().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedAfter(new Date(now.getTime())).ended().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceCompletedAfter(new Date(now.getTime() + 15000)).includeEnded().list()).hasSize(1); // Same queries, but with endedBefore/After assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedBefore(new Date(now.getTime() + 30000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedBefore(new Date(now.getTime() + 30000)).includeEnded().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedBefore(new Date(now.getTime() + 15000)).includeEnded().list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedAfter(new Date(now.getTime())).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedAfter(new Date(now.getTime())).includeEnded().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedAfter(new Date(now.getTime())).ended().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceEndedAfter(new Date(now.getTime() + 15000)).includeEnded().list()).hasSize(1); } @Test public void testLastOccurredBeforeAndAfter() { Date now = new Date(); setClockTo(now); startInstances(2); cmmnRuntimeService.completeStagePlanItemInstance(cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("Stage one").listPage(0, 1).get(0).getId(), true); setClockTo(now.getTime() + 10000); cmmnRuntimeService.completeStagePlanItemInstance(cmmnRuntimeService.createPlanItemInstanceQuery() .planItemInstanceName("Stage one").listPage(0, 1).get(0).getId(), true); // Occurred (milestone) assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredAfter(new Date(now.getTime() - 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredAfter(new Date(now.getTime() - 1000)).includeEnded().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredAfter(new Date(now.getTime() + 1000)).includeEnded().list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredAfter(new Date(now.getTime() + 15000)).includeEnded().list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredBefore(new Date(now.getTime() + 20000)).includeEnded().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredBefore(new Date(now.getTime() + 5000)).includeEnded().list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceOccurredBefore(new Date(now.getTime() - 1000)).includeEnded().list()).hasSize(0); } @Test @CmmnDeployment public void testExitBeforeAndAfter() { Date now = new Date(); setClockTo(now); cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testQueryByStateTerminated").start(); UserEventListenerInstance userEventListenerInstance = cmmnRuntimeService.createUserEventListenerInstanceQuery().singleResult(); cmmnRuntimeService.completeUserEventListenerInstance(userEventListenerInstance.getId()); setClockTo(now.getTime() + 10000); cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testQueryByStateTerminated").start(); userEventListenerInstance = cmmnRuntimeService.createUserEventListenerInstanceQuery().singleResult(); cmmnRuntimeService.completeUserEventListenerInstance(userEventListenerInstance.getId()); // Terminated before/after assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceExitAfter(new Date(now.getTime() - 1000)).list()).hasSize(6); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceExitAfter(new Date(now.getTime() + 1000)).list()).hasSize(3); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceExitAfter(new Date(now.getTime() + 20000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceExitBefore(new Date(now.getTime() - 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceExitBefore(new Date(now.getTime() + 1000)).list()).hasSize(3); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceExitBefore(new Date(now.getTime() + 20000)).list()).hasSize(6); // Ended before/after assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedAfter(new Date(now.getTime() - 1000)).list()).hasSize(8); // + 2 for user event listener assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedAfter(new Date(now.getTime() + 1000)).list()).hasSize(4); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedAfter(new Date(now.getTime() + 20000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedBefore(new Date(now.getTime() - 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedBefore(new Date(now.getTime() + 1000)).list()).hasSize(4); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedBefore(new Date(now.getTime() + 20000)).list()).hasSize(8); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded() .planItemDefinitionType(PlanItemDefinitionType.USER_EVENT_LISTENER) .planItemInstanceEndedAfter(new Date(now.getTime() - 1000)).list()).hasSize(2); } @Test @CmmnDeployment public void testTerminateBeforeAndAfter() { Date now = new Date(); setClockTo(now); cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testTerminate").start(); PlanItemInstance stagePlanItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery() .planItemDefinitionType(PlanItemDefinitionType.STAGE) .planItemInstanceName("The Stage") .singleResult(); cmmnRuntimeService.terminatePlanItemInstance(stagePlanItemInstance.getId()); assertThat(cmmnTaskService.createTaskQuery().taskName("D").singleResult()).isNotNull(); // Terminated assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceTerminatedBefore(new Date(now.getTime() + 1000)).list()).hasSize(2); // 2 -> stage and C assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceTerminatedBefore(new Date(now.getTime() - 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceTerminatedAfter(new Date(now.getTime() + 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceTerminatedAfter(new Date(now.getTime() - 1000)).list()).hasSize(2); // Ended assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedBefore(new Date(now.getTime() + 1000)).list()).hasSize(2); // 2 -> stage and C assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedBefore(new Date(now.getTime() - 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedAfter(new Date(now.getTime() + 1000)).list()).hasSize(0); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().includeEnded().planItemInstanceEndedAfter(new Date(now.getTime() - 1000)).list()).hasSize(2); } @Test @CmmnDeployment public void testWaitRepetitionOfNestedStages() { CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() .caseDefinitionKey("testWaitRepetitionOfNestedStages") .variable("stage1", false) .variable("stage11", false) .variable("stage12", false) .start(); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().list()) .extracting(PlanItemInstance::getPlanItemDefinitionId, PlanItemInstance::getState) .containsExactlyInAnyOrder( tuple("oneexpandedstage1", "available"), tuple("oneexpandedstage2", "available") ); cmmnRuntimeService.createChangePlanItemStateBuilder() .caseInstanceId(caseInstance.getId()) .activatePlanItemDefinitionIds(Arrays.asList("oneexpandedstage4")) .changeState(); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().list()) .extracting(PlanItemInstance::getPlanItemDefinitionId, PlanItemInstance::getState) .containsExactlyInAnyOrder( tuple("oneexpandedstage1", "active"), tuple("oneexpandedstage1", "wait_repetition"), tuple("oneexpandedstage2", "available"), tuple("oneexpandedstage6", "available"), tuple("oneexpandedstage4", "active"), tuple("oneexpandedstage4", "wait_repetition"), // FIXME: this plan item instance is missing tuple("oneeventlistener1", "available"), tuple("onehumantask1", "available") ); } private List<String> startInstances(int numberOfInstances) { List<String> caseInstanceIds = new ArrayList<>(); for (int i = 0; i < numberOfInstances; i++) { caseInstanceIds.add(cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testPlanItemInstanceQuery").start().getId()); } return caseInstanceIds; } }
51.806041
192
0.718008
5dd601b90277482341e0d42f94bd2e11aa42d9ea
13,039
// Generated from io/streamthoughts/kafka/connect/filepulse/expression/parser/antlr4/ScELLexer.g4 by ANTLR 4.7.1 package io.streamthoughts.kafka.connect.filepulse.expression.parser.antlr4; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) public class ScELLexer extends Lexer { static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int Literal=1, StringLiteral=2, BooleanLiteral=3, NullLiteral=4, IntegerLiteral=5, DOT=6, LPAREN=7, RPAREN=8, COMMA=9, LBRACE=10, RBRACE=11, UNDER_SCORE=12, NUMBER=13, FLOAT=14, WS=15, QUOTE=16, LineStrText=17, LineStrEscapedChar=18, LineSubstExprStart=19, PropertyExprStart=20, Letter=21, LetterOrDigit=22, Identifier=23, LineSubstExprEnd=24, Substr_WS=25; public static final int PropertyExpression=1, SubstitutionExpression=2; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; public static String[] modeNames = { "DEFAULT_MODE", "PropertyExpression", "SubstitutionExpression" }; public static final String[] ruleNames = { "Literal", "StringLiteral", "EscapeSeq", "EscapedIdentifier", "EscapeSequence", "BooleanLiteral", "NullLiteral", "T", "F", "IntegerLiteral", "DecimalNumeral", "Digits", "Digit", "NonZeroDigit", "DigitsAndUnderscores", "DigitOrUnderscore", "HexDigit", "Underscores", "UniCharacterLiteral", "DOT", "LPAREN", "RPAREN", "COMMA", "LBRACE", "RBRACE", "UNDER_SCORE", "NUMBER", "FLOAT", "WS", "QUOTE", "LineStrText", "LineStrEscapedChar", "LineSubstExprStart", "PropertyExprStart", "Letter", "LetterOrDigit", "Identifier", "Prop_DOT", "LineSubstExprEnd", "Substr_LinePropertyExprStart", "Substr_Literal", "Substr_Identifier", "Substr_COMMA", "Substr_DOT", "Substr_LPAREN", "Substr_RPAREN", "Substr_WS" }; private static final String[] _LITERAL_NAMES = { null, null, null, null, "'null'", null, "'.'", "'('", "')'", "','", "'{'", "'}'", "'_'", null, null, null, "'''", null, null, "'{{'", "'$'", null, null, null, "'}}'" }; private static final String[] _SYMBOLIC_NAMES = { null, "Literal", "StringLiteral", "BooleanLiteral", "NullLiteral", "IntegerLiteral", "DOT", "LPAREN", "RPAREN", "COMMA", "LBRACE", "RBRACE", "UNDER_SCORE", "NUMBER", "FLOAT", "WS", "QUOTE", "LineStrText", "LineStrEscapedChar", "LineSubstExprStart", "PropertyExprStart", "Letter", "LetterOrDigit", "Identifier", "LineSubstExprEnd", "Substr_WS" }; public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); /** * @deprecated Use {@link #VOCABULARY} instead. */ @Deprecated public static final String[] tokenNames; static { tokenNames = new String[_SYMBOLIC_NAMES.length]; for (int i = 0; i < tokenNames.length; i++) { tokenNames[i] = VOCABULARY.getLiteralName(i); if (tokenNames[i] == null) { tokenNames[i] = VOCABULARY.getSymbolicName(i); } if (tokenNames[i] == null) { tokenNames[i] = "<INVALID>"; } } } @Override @Deprecated public String[] getTokenNames() { return tokenNames; } @Override public Vocabulary getVocabulary() { return VOCABULARY; } public ScELLexer(CharStream input) { super(input); _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); } @Override public String getGrammarFileName() { return "ScELLexer.g4"; } @Override public String[] getRuleNames() { return ruleNames; } @Override public String getSerializedATN() { return _serializedATN; } @Override public String[] getChannelNames() { return channelNames; } @Override public String[] getModeNames() { return modeNames; } @Override public ATN getATN() { return _ATN; } public static final String _serializedATN = "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\33\u0149\b\1\b\1"+ "\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4"+ "\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t"+ "\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t"+ "\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t"+ "\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4"+ "*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\3\2\3\2\3\2\3\2\5\2h\n\2"+ "\3\3\3\3\3\3\6\3m\n\3\r\3\16\3n\3\3\3\3\3\4\3\4\5\4u\n\4\3\5\3\5\3\5\3"+ "\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7\u0088\n\7\3"+ "\b\3\b\3\b\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f\5\f\u0098\n\f"+ "\3\f\3\f\3\f\5\f\u009d\n\f\5\f\u009f\n\f\3\r\3\r\5\r\u00a3\n\r\3\r\5\r"+ "\u00a6\n\r\3\16\3\16\5\16\u00aa\n\16\3\17\3\17\3\20\6\20\u00af\n\20\r"+ "\20\16\20\u00b0\3\21\3\21\5\21\u00b5\n\21\3\22\3\22\3\23\6\23\u00ba\n"+ "\23\r\23\16\23\u00bb\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\26"+ "\3\26\3\27\3\27\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\34\6\34\u00d4"+ "\n\34\r\34\16\34\u00d5\3\34\3\34\7\34\u00da\n\34\f\34\16\34\u00dd\13\34"+ "\3\35\7\35\u00e0\n\35\f\35\16\35\u00e3\13\35\3\35\3\35\6\35\u00e7\n\35"+ "\r\35\16\35\u00e8\3\35\3\35\6\35\u00ed\n\35\r\35\16\35\u00ee\7\35\u00f1"+ "\n\35\f\35\16\35\u00f4\13\35\3\36\6\36\u00f7\n\36\r\36\16\36\u00f8\3\36"+ "\3\36\3\37\3\37\3\37\3\37\3 \6 \u0102\n \r \16 \u0103\3 \5 \u0107\n \3"+ "!\3!\3!\5!\u010c\n!\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3$\3$\3%\3%\3&\3&"+ "\6&\u011d\n&\r&\16&\u011e\3\'\3\'\3\'\3\'\3(\3(\3(\3(\3(\3)\3)\3)\3)\3"+ "*\3*\3*\3*\3+\3+\3+\3+\3,\3,\3,\3,\3-\3-\3-\3-\3.\3.\3.\3.\3/\3/\3/\3"+ "/\3\60\3\60\3\60\3\60\3n\2\61\5\3\7\4\t\2\13\2\r\2\17\5\21\6\23\2\25\2"+ "\27\7\31\2\33\2\35\2\37\2!\2#\2%\2\'\2)\2+\b-\t/\n\61\13\63\f\65\r\67"+ "\169\17;\20=\21?\22A\23C\24E\25G\26I\27K\30M\31O\2Q\32S\2U\2W\2Y\2[\2"+ "]\2_\2a\33\5\2\3\4\r\n\2$$&&))^^ddppttvv\n\2$$))^^ddhhppttvv\4\2VVvv\4"+ "\2HHhh\3\2\63;\5\2\62;CHch\4\2GGgg\5\2\13\f\16\17\"\"\5\2&&^^}}\5\2C\\"+ "aac|\7\2//\62;C\\aac|\2\u0153\2\5\3\2\2\2\2\7\3\2\2\2\2\17\3\2\2\2\2\21"+ "\3\2\2\2\2\27\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2"+ "\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2"+ "\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\3I\3\2\2\2\3K"+ "\3\2\2\2\3M\3\2\2\2\3O\3\2\2\2\4Q\3\2\2\2\4S\3\2\2\2\4U\3\2\2\2\4W\3\2"+ "\2\2\4Y\3\2\2\2\4[\3\2\2\2\4]\3\2\2\2\4_\3\2\2\2\4a\3\2\2\2\5g\3\2\2\2"+ "\7i\3\2\2\2\tt\3\2\2\2\13v\3\2\2\2\ry\3\2\2\2\17\u0087\3\2\2\2\21\u0089"+ "\3\2\2\2\23\u008e\3\2\2\2\25\u0090\3\2\2\2\27\u0092\3\2\2\2\31\u009e\3"+ "\2\2\2\33\u00a0\3\2\2\2\35\u00a9\3\2\2\2\37\u00ab\3\2\2\2!\u00ae\3\2\2"+ "\2#\u00b4\3\2\2\2%\u00b6\3\2\2\2\'\u00b9\3\2\2\2)\u00bd\3\2\2\2+\u00c4"+ "\3\2\2\2-\u00c6\3\2\2\2/\u00c8\3\2\2\2\61\u00ca\3\2\2\2\63\u00cc\3\2\2"+ "\2\65\u00ce\3\2\2\2\67\u00d0\3\2\2\29\u00d3\3\2\2\2;\u00e1\3\2\2\2=\u00f6"+ "\3\2\2\2?\u00fc\3\2\2\2A\u0106\3\2\2\2C\u010b\3\2\2\2E\u010d\3\2\2\2G"+ "\u0112\3\2\2\2I\u0116\3\2\2\2K\u0118\3\2\2\2M\u011a\3\2\2\2O\u0120\3\2"+ "\2\2Q\u0124\3\2\2\2S\u0129\3\2\2\2U\u012d\3\2\2\2W\u0131\3\2\2\2Y\u0135"+ "\3\2\2\2[\u0139\3\2\2\2]\u013d\3\2\2\2_\u0141\3\2\2\2a\u0145\3\2\2\2c"+ "h\5\7\3\2dh\5\21\b\2eh\5\27\13\2fh\5\17\7\2gc\3\2\2\2gd\3\2\2\2ge\3\2"+ "\2\2gf\3\2\2\2h\6\3\2\2\2il\7)\2\2jm\5\t\4\2km\13\2\2\2lj\3\2\2\2lk\3"+ "\2\2\2mn\3\2\2\2no\3\2\2\2nl\3\2\2\2op\3\2\2\2pq\7)\2\2q\b\3\2\2\2ru\5"+ ")\24\2su\5\13\5\2tr\3\2\2\2ts\3\2\2\2u\n\3\2\2\2vw\7^\2\2wx\t\2\2\2x\f"+ "\3\2\2\2yz\7^\2\2z{\t\3\2\2{\16\3\2\2\2|}\5\23\t\2}~\7t\2\2~\177\7w\2"+ "\2\177\u0080\7g\2\2\u0080\u0088\3\2\2\2\u0081\u0082\5\25\n\2\u0082\u0083"+ "\7c\2\2\u0083\u0084\7n\2\2\u0084\u0085\7u\2\2\u0085\u0086\7g\2\2\u0086"+ "\u0088\3\2\2\2\u0087|\3\2\2\2\u0087\u0081\3\2\2\2\u0088\20\3\2\2\2\u0089"+ "\u008a\7p\2\2\u008a\u008b\7w\2\2\u008b\u008c\7n\2\2\u008c\u008d\7n\2\2"+ "\u008d\22\3\2\2\2\u008e\u008f\t\4\2\2\u008f\24\3\2\2\2\u0090\u0091\t\5"+ "\2\2\u0091\26\3\2\2\2\u0092\u0093\5\31\f\2\u0093\30\3\2\2\2\u0094\u009f"+ "\7\62\2\2\u0095\u009c\5\37\17\2\u0096\u0098\5\33\r\2\u0097\u0096\3\2\2"+ "\2\u0097\u0098\3\2\2\2\u0098\u009d\3\2\2\2\u0099\u009a\5\'\23\2\u009a"+ "\u009b\5\33\r\2\u009b\u009d\3\2\2\2\u009c\u0097\3\2\2\2\u009c\u0099\3"+ "\2\2\2\u009d\u009f\3\2\2\2\u009e\u0094\3\2\2\2\u009e\u0095\3\2\2\2\u009f"+ "\32\3\2\2\2\u00a0\u00a5\5\35\16\2\u00a1\u00a3\5!\20\2\u00a2\u00a1\3\2"+ "\2\2\u00a2\u00a3\3\2\2\2\u00a3\u00a4\3\2\2\2\u00a4\u00a6\5\35\16\2\u00a5"+ "\u00a2\3\2\2\2\u00a5\u00a6\3\2\2\2\u00a6\34\3\2\2\2\u00a7\u00aa\7\62\2"+ "\2\u00a8\u00aa\5\37\17\2\u00a9\u00a7\3\2\2\2\u00a9\u00a8\3\2\2\2\u00aa"+ "\36\3\2\2\2\u00ab\u00ac\t\6\2\2\u00ac \3\2\2\2\u00ad\u00af\5#\21\2\u00ae"+ "\u00ad\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0\u00ae\3\2\2\2\u00b0\u00b1\3\2"+ "\2\2\u00b1\"\3\2\2\2\u00b2\u00b5\5\35\16\2\u00b3\u00b5\5\67\33\2\u00b4"+ "\u00b2\3\2\2\2\u00b4\u00b3\3\2\2\2\u00b5$\3\2\2\2\u00b6\u00b7\t\7\2\2"+ "\u00b7&\3\2\2\2\u00b8\u00ba\5\67\33\2\u00b9\u00b8\3\2\2\2\u00ba\u00bb"+ "\3\2\2\2\u00bb\u00b9\3\2\2\2\u00bb\u00bc\3\2\2\2\u00bc(\3\2\2\2\u00bd"+ "\u00be\7^\2\2\u00be\u00bf\7w\2\2\u00bf\u00c0\5%\22\2\u00c0\u00c1\5%\22"+ "\2\u00c1\u00c2\5%\22\2\u00c2\u00c3\5%\22\2\u00c3*\3\2\2\2\u00c4\u00c5"+ "\7\60\2\2\u00c5,\3\2\2\2\u00c6\u00c7\7*\2\2\u00c7.\3\2\2\2\u00c8\u00c9"+ "\7+\2\2\u00c9\60\3\2\2\2\u00ca\u00cb\7.\2\2\u00cb\62\3\2\2\2\u00cc\u00cd"+ "\7}\2\2\u00cd\64\3\2\2\2\u00ce\u00cf\7\177\2\2\u00cf\66\3\2\2\2\u00d0"+ "\u00d1\7a\2\2\u00d18\3\2\2\2\u00d2\u00d4\4\62;\2\u00d3\u00d2\3\2\2\2\u00d4"+ "\u00d5\3\2\2\2\u00d5\u00d3\3\2\2\2\u00d5\u00d6\3\2\2\2\u00d6\u00db\3\2"+ "\2\2\u00d7\u00d8\t\b\2\2\u00d8\u00da\59\34\2\u00d9\u00d7\3\2\2\2\u00da"+ "\u00dd\3\2\2\2\u00db\u00d9\3\2\2\2\u00db\u00dc\3\2\2\2\u00dc:\3\2\2\2"+ "\u00dd\u00db\3\2\2\2\u00de\u00e0\4\62;\2\u00df\u00de\3\2\2\2\u00e0\u00e3"+ "\3\2\2\2\u00e1\u00df\3\2\2\2\u00e1\u00e2\3\2\2\2\u00e2\u00e4\3\2\2\2\u00e3"+ "\u00e1\3\2\2\2\u00e4\u00e6\7\60\2\2\u00e5\u00e7\4\62;\2\u00e6\u00e5\3"+ "\2\2\2\u00e7\u00e8\3\2\2\2\u00e8\u00e6\3\2\2\2\u00e8\u00e9\3\2\2\2\u00e9"+ "\u00f2\3\2\2\2\u00ea\u00ec\t\b\2\2\u00eb\u00ed\4\62;\2\u00ec\u00eb\3\2"+ "\2\2\u00ed\u00ee\3\2\2\2\u00ee\u00ec\3\2\2\2\u00ee\u00ef\3\2\2\2\u00ef"+ "\u00f1\3\2\2\2\u00f0\u00ea\3\2\2\2\u00f1\u00f4\3\2\2\2\u00f2\u00f0\3\2"+ "\2\2\u00f2\u00f3\3\2\2\2\u00f3<\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f5\u00f7"+ "\t\t\2\2\u00f6\u00f5\3\2\2\2\u00f7\u00f8\3\2\2\2\u00f8\u00f6\3\2\2\2\u00f8"+ "\u00f9\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00fb\b\36\2\2\u00fb>\3\2\2\2"+ "\u00fc\u00fd\7)\2\2\u00fd\u00fe\3\2\2\2\u00fe\u00ff\b\37\2\2\u00ff@\3"+ "\2\2\2\u0100\u0102\n\n\2\2\u0101\u0100\3\2\2\2\u0102\u0103\3\2\2\2\u0103"+ "\u0101\3\2\2\2\u0103\u0104\3\2\2\2\u0104\u0107\3\2\2\2\u0105\u0107\5\63"+ "\31\2\u0106\u0101\3\2\2\2\u0106\u0105\3\2\2\2\u0107B\3\2\2\2\u0108\u0109"+ "\7^\2\2\u0109\u010c\13\2\2\2\u010a\u010c\5)\24\2\u010b\u0108\3\2\2\2\u010b"+ "\u010a\3\2\2\2\u010cD\3\2\2\2\u010d\u010e\7}\2\2\u010e\u010f\7}\2\2\u010f"+ "\u0110\3\2\2\2\u0110\u0111\b\"\3\2\u0111F\3\2\2\2\u0112\u0113\7&\2\2\u0113"+ "\u0114\3\2\2\2\u0114\u0115\b#\4\2\u0115H\3\2\2\2\u0116\u0117\t\13\2\2"+ "\u0117J\3\2\2\2\u0118\u0119\t\f\2\2\u0119L\3\2\2\2\u011a\u011c\5I$\2\u011b"+ "\u011d\5K%\2\u011c\u011b\3\2\2\2\u011d\u011e\3\2\2\2\u011e\u011c\3\2\2"+ "\2\u011e\u011f\3\2\2\2\u011fN\3\2\2\2\u0120\u0121\5+\25\2\u0121\u0122"+ "\3\2\2\2\u0122\u0123\b\'\5\2\u0123P\3\2\2\2\u0124\u0125\7\177\2\2\u0125"+ "\u0126\7\177\2\2\u0126\u0127\3\2\2\2\u0127\u0128\b(\6\2\u0128R\3\2\2\2"+ "\u0129\u012a\5G#\2\u012a\u012b\3\2\2\2\u012b\u012c\b)\7\2\u012cT\3\2\2"+ "\2\u012d\u012e\5\5\2\2\u012e\u012f\3\2\2\2\u012f\u0130\b*\b\2\u0130V\3"+ "\2\2\2\u0131\u0132\5M&\2\u0132\u0133\3\2\2\2\u0133\u0134\b+\t\2\u0134"+ "X\3\2\2\2\u0135\u0136\5\61\30\2\u0136\u0137\3\2\2\2\u0137\u0138\b,\n\2"+ "\u0138Z\3\2\2\2\u0139\u013a\5+\25\2\u013a\u013b\3\2\2\2\u013b\u013c\b"+ "-\5\2\u013c\\\3\2\2\2\u013d\u013e\5-\26\2\u013e\u013f\3\2\2\2\u013f\u0140"+ "\b.\13\2\u0140^\3\2\2\2\u0141\u0142\5/\27\2\u0142\u0143\3\2\2\2\u0143"+ "\u0144\b/\f\2\u0144`\3\2\2\2\u0145\u0146\5=\36\2\u0146\u0147\3\2\2\2\u0147"+ "\u0148\b\60\2\2\u0148b\3\2\2\2\36\2\3\4glnt\u0087\u0097\u009c\u009e\u00a2"+ "\u00a5\u00a9\u00b0\u00b4\u00bb\u00d5\u00db\u00e1\u00e8\u00ee\u00f2\u00f8"+ "\u0103\u0106\u010b\u011e\r\b\2\2\7\4\2\7\3\2\t\b\2\6\2\2\t\26\2\t\3\2"+ "\t\31\2\t\13\2\t\t\2\t\n\2"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); } } }
54.785714
112
0.632487
22935fe2c1c4a5f7af208835d9f441aba639656f
221,256
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package android.support.v7.widget.helper; import android.animation.Animator; import android.animation.ValueAnimator; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Rect; import android.support.v4.view.GestureDetectorCompat; import android.support.v4.view.ViewCompat; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.*; import android.view.animation.Interpolator; import java.util.ArrayList; import java.util.List; // Referenced classes of package android.support.v7.widget.helper: // ItemTouchUIUtil public class ItemTouchHelper extends android.support.v7.widget.RecyclerView.ItemDecoration implements android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener { public static abstract class Callback { public static int convertToRelativeDirection(int i, int j) { int k = i & 0xc0c0c; // 0 0:iload_0 // 1 1:ldc1 #14 <Int 0xc0c0c> // 2 3:iand // 3 4:istore_2 if(k == 0) //* 4 5:iload_2 //* 5 6:ifne 11 return i; // 6 9:iload_0 // 7 10:ireturn i &= ~k; // 8 11:iload_0 // 9 12:iload_2 // 10 13:iconst_m1 // 11 14:ixor // 12 15:iand // 13 16:istore_0 if(j == 0) //* 14 17:iload_1 //* 15 18:ifne 27 return i | k << 2; // 16 21:iload_0 // 17 22:iload_2 // 18 23:iconst_2 // 19 24:ishl // 20 25:ior // 21 26:ireturn else return i | k << 1 & 0xfff3f3f3 | (k << 1 & 0xc0c0c) << 2; // 22 27:iload_0 // 23 28:iload_2 // 24 29:iconst_1 // 25 30:ishl // 26 31:ldc1 #60 <Int 0xfff3f3f3> // 27 33:iand // 28 34:ior // 29 35:iload_2 // 30 36:iconst_1 // 31 37:ishl // 32 38:ldc1 #14 <Int 0xc0c0c> // 33 40:iand // 34 41:iconst_2 // 35 42:ishl // 36 43:ior // 37 44:ireturn } public static ItemTouchUIUtil getDefaultUIUtil() { return sUICallback; // 0 0:getstatic #50 <Field ItemTouchUIUtil sUICallback> // 1 3:areturn } private int getMaxDragScroll(RecyclerView recyclerview) { if(mCachedMaxScrollSpeed == -1) //* 0 0:aload_0 //* 1 1:getfield #57 <Field int mCachedMaxScrollSpeed> //* 2 4:iconst_m1 //* 3 5:icmpne 22 mCachedMaxScrollSpeed = recyclerview.getResources().getDimensionPixelSize(android.support.v7.recyclerview.R.dimen.item_touch_helper_max_drag_scroll_per_frame); // 4 8:aload_0 // 5 9:aload_1 // 6 10:invokevirtual #70 <Method Resources RecyclerView.getResources()> // 7 13:getstatic #75 <Field int android.support.v7.recyclerview.R$dimen.item_touch_helper_max_drag_scroll_per_frame> // 8 16:invokevirtual #81 <Method int Resources.getDimensionPixelSize(int)> // 9 19:putfield #57 <Field int mCachedMaxScrollSpeed> return mCachedMaxScrollSpeed; // 10 22:aload_0 // 11 23:getfield #57 <Field int mCachedMaxScrollSpeed> // 12 26:ireturn } public static int makeFlag(int i, int j) { return j << i * 8; // 0 0:iload_1 // 1 1:iload_0 // 2 2:bipush 8 // 3 4:imul // 4 5:ishl // 5 6:ireturn } public static int makeMovementFlags(int i, int j) { return makeFlag(0, j | i) | makeFlag(1, j) | makeFlag(2, i); // 0 0:iconst_0 // 1 1:iload_1 // 2 2:iload_0 // 3 3:ior // 4 4:invokestatic #85 <Method int makeFlag(int, int)> // 5 7:iconst_1 // 6 8:iload_1 // 7 9:invokestatic #85 <Method int makeFlag(int, int)> // 8 12:ior // 9 13:iconst_2 // 10 14:iload_0 // 11 15:invokestatic #85 <Method int makeFlag(int, int)> // 12 18:ior // 13 19:ireturn } public boolean canDropOver(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, android.support.v7.widget.RecyclerView.ViewHolder viewholder1) { return true; // 0 0:iconst_1 // 1 1:ireturn } public android.support.v7.widget.RecyclerView.ViewHolder chooseDropTarget(android.support.v7.widget.RecyclerView.ViewHolder viewholder, List list, int i, int j) { int j2 = viewholder.itemView.getWidth(); // 0 0:aload_1 // 1 1:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 2 4:invokevirtual #101 <Method int View.getWidth()> // 3 7:istore 9 int k2 = viewholder.itemView.getHeight(); // 4 9:aload_1 // 5 10:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 6 13:invokevirtual #104 <Method int View.getHeight()> // 7 16:istore 10 android.support.v7.widget.RecyclerView.ViewHolder viewholder3 = null; // 8 18:aconst_null // 9 19:astore 16 int l = -1; // 10 21:iconst_m1 // 11 22:istore 6 int l2 = i - viewholder.itemView.getLeft(); // 12 24:iload_3 // 13 25:aload_1 // 14 26:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 15 29:invokevirtual #107 <Method int View.getLeft()> // 16 32:isub // 17 33:istore 11 int i3 = j - viewholder.itemView.getTop(); // 18 35:iload 4 // 19 37:aload_1 // 20 38:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 21 41:invokevirtual #110 <Method int View.getTop()> // 22 44:isub // 23 45:istore 12 int j3 = list.size(); // 24 47:aload_2 // 25 48:invokeinterface #115 <Method int List.size()> // 26 53:istore 13 for(int i1 = 0; i1 < j3; i1++) //* 27 55:iconst_0 //* 28 56:istore 7 //* 29 58:iload 7 //* 30 60:iload 13 //* 31 62:icmpge 471 { android.support.v7.widget.RecyclerView.ViewHolder viewholder1 = (android.support.v7.widget.RecyclerView.ViewHolder)list.get(i1); // 32 65:aload_2 // 33 66:iload 7 // 34 68:invokeinterface #119 <Method Object List.get(int)> // 35 73:checkcast #91 <Class android.support.v7.widget.RecyclerView$ViewHolder> // 36 76:astore 14 android.support.v7.widget.RecyclerView.ViewHolder viewholder2 = viewholder3; // 37 78:aload 16 // 38 80:astore 15 int k = l; // 39 82:iload 6 // 40 84:istore 5 if(l2 > 0) //* 41 86:iload 11 //* 42 88:ifle 175 { int j1 = viewholder1.itemView.getRight() - (i + j2); // 43 91:aload 14 // 44 93:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 45 96:invokevirtual #122 <Method int View.getRight()> // 46 99:iload_3 // 47 100:iload 9 // 48 102:iadd // 49 103:isub // 50 104:istore 8 viewholder2 = viewholder3; // 51 106:aload 16 // 52 108:astore 15 k = l; // 53 110:iload 6 // 54 112:istore 5 if(j1 < 0) //* 55 114:iload 8 //* 56 116:ifge 175 { viewholder2 = viewholder3; // 57 119:aload 16 // 58 121:astore 15 k = l; // 59 123:iload 6 // 60 125:istore 5 if(viewholder1.itemView.getRight() > viewholder.itemView.getRight()) //* 61 127:aload 14 //* 62 129:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 63 132:invokevirtual #122 <Method int View.getRight()> //* 64 135:aload_1 //* 65 136:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 66 139:invokevirtual #122 <Method int View.getRight()> //* 67 142:icmple 175 { j1 = Math.abs(j1); // 68 145:iload 8 // 69 147:invokestatic #127 <Method int Math.abs(int)> // 70 150:istore 8 viewholder2 = viewholder3; // 71 152:aload 16 // 72 154:astore 15 k = l; // 73 156:iload 6 // 74 158:istore 5 if(j1 > l) //* 75 160:iload 8 //* 76 162:iload 6 //* 77 164:icmple 175 { k = j1; // 78 167:iload 8 // 79 169:istore 5 viewholder2 = viewholder1; // 80 171:aload 14 // 81 173:astore 15 } } } } viewholder3 = viewholder2; // 82 175:aload 15 // 83 177:astore 16 l = k; // 84 179:iload 5 // 85 181:istore 6 if(l2 < 0) //* 86 183:iload 11 //* 87 185:ifge 269 { int k1 = viewholder1.itemView.getLeft() - i; // 88 188:aload 14 // 89 190:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 90 193:invokevirtual #107 <Method int View.getLeft()> // 91 196:iload_3 // 92 197:isub // 93 198:istore 8 viewholder3 = viewholder2; // 94 200:aload 15 // 95 202:astore 16 l = k; // 96 204:iload 5 // 97 206:istore 6 if(k1 > 0) //* 98 208:iload 8 //* 99 210:ifle 269 { viewholder3 = viewholder2; // 100 213:aload 15 // 101 215:astore 16 l = k; // 102 217:iload 5 // 103 219:istore 6 if(viewholder1.itemView.getLeft() < viewholder.itemView.getLeft()) //* 104 221:aload 14 //* 105 223:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 106 226:invokevirtual #107 <Method int View.getLeft()> //* 107 229:aload_1 //* 108 230:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 109 233:invokevirtual #107 <Method int View.getLeft()> //* 110 236:icmpge 269 { k1 = Math.abs(k1); // 111 239:iload 8 // 112 241:invokestatic #127 <Method int Math.abs(int)> // 113 244:istore 8 viewholder3 = viewholder2; // 114 246:aload 15 // 115 248:astore 16 l = k; // 116 250:iload 5 // 117 252:istore 6 if(k1 > k) //* 118 254:iload 8 //* 119 256:iload 5 //* 120 258:icmple 269 { l = k1; // 121 261:iload 8 // 122 263:istore 6 viewholder3 = viewholder1; // 123 265:aload 14 // 124 267:astore 16 } } } } viewholder2 = viewholder3; // 125 269:aload 16 // 126 271:astore 15 k = l; // 127 273:iload 6 // 128 275:istore 5 if(i3 < 0) //* 129 277:iload 12 //* 130 279:ifge 364 { int l1 = viewholder1.itemView.getTop() - j; // 131 282:aload 14 // 132 284:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 133 287:invokevirtual #110 <Method int View.getTop()> // 134 290:iload 4 // 135 292:isub // 136 293:istore 8 viewholder2 = viewholder3; // 137 295:aload 16 // 138 297:astore 15 k = l; // 139 299:iload 6 // 140 301:istore 5 if(l1 > 0) //* 141 303:iload 8 //* 142 305:ifle 364 { viewholder2 = viewholder3; // 143 308:aload 16 // 144 310:astore 15 k = l; // 145 312:iload 6 // 146 314:istore 5 if(viewholder1.itemView.getTop() < viewholder.itemView.getTop()) //* 147 316:aload 14 //* 148 318:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 149 321:invokevirtual #110 <Method int View.getTop()> //* 150 324:aload_1 //* 151 325:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 152 328:invokevirtual #110 <Method int View.getTop()> //* 153 331:icmpge 364 { l1 = Math.abs(l1); // 154 334:iload 8 // 155 336:invokestatic #127 <Method int Math.abs(int)> // 156 339:istore 8 viewholder2 = viewholder3; // 157 341:aload 16 // 158 343:astore 15 k = l; // 159 345:iload 6 // 160 347:istore 5 if(l1 > l) //* 161 349:iload 8 //* 162 351:iload 6 //* 163 353:icmple 364 { k = l1; // 164 356:iload 8 // 165 358:istore 5 viewholder2 = viewholder1; // 166 360:aload 14 // 167 362:astore 15 } } } } viewholder3 = viewholder2; // 168 364:aload 15 // 169 366:astore 16 l = k; // 170 368:iload 5 // 171 370:istore 6 if(i3 <= 0) continue; // 172 372:iload 12 // 173 374:ifle 462 int i2 = viewholder1.itemView.getBottom() - (j + k2); // 174 377:aload 14 // 175 379:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 176 382:invokevirtual #130 <Method int View.getBottom()> // 177 385:iload 4 // 178 387:iload 10 // 179 389:iadd // 180 390:isub // 181 391:istore 8 viewholder3 = viewholder2; // 182 393:aload 15 // 183 395:astore 16 l = k; // 184 397:iload 5 // 185 399:istore 6 if(i2 >= 0) continue; // 186 401:iload 8 // 187 403:ifge 462 viewholder3 = viewholder2; // 188 406:aload 15 // 189 408:astore 16 l = k; // 190 410:iload 5 // 191 412:istore 6 if(viewholder1.itemView.getBottom() <= viewholder.itemView.getBottom()) continue; // 192 414:aload 14 // 193 416:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 194 419:invokevirtual #130 <Method int View.getBottom()> // 195 422:aload_1 // 196 423:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 197 426:invokevirtual #130 <Method int View.getBottom()> // 198 429:icmple 462 i2 = Math.abs(i2); // 199 432:iload 8 // 200 434:invokestatic #127 <Method int Math.abs(int)> // 201 437:istore 8 viewholder3 = viewholder2; // 202 439:aload 15 // 203 441:astore 16 l = k; // 204 443:iload 5 // 205 445:istore 6 if(i2 > k) //* 206 447:iload 8 //* 207 449:iload 5 //* 208 451:icmple 462 { l = i2; // 209 454:iload 8 // 210 456:istore 6 viewholder3 = viewholder1; // 211 458:aload 14 // 212 460:astore 16 } } // 213 462:iload 7 // 214 464:iconst_1 // 215 465:iadd // 216 466:istore 7 //* 217 468:goto 58 return viewholder3; // 218 471:aload 16 // 219 473:areturn } public void clearView(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { sUICallback.clearView(viewholder.itemView); // 0 0:getstatic #50 <Field ItemTouchUIUtil sUICallback> // 1 3:aload_2 // 2 4:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 3 7:invokeinterface #139 <Method void ItemTouchUIUtil.clearView(View)> // 4 12:return } public int convertToAbsoluteDirection(int i, int j) { int k = i & 0x303030; // 0 0:iload_1 // 1 1:ldc1 #24 <Int 0x303030> // 2 3:iand // 3 4:istore_3 if(k == 0) //* 4 5:iload_3 //* 5 6:ifne 11 return i; // 6 9:iload_1 // 7 10:ireturn i &= ~k; // 8 11:iload_1 // 9 12:iload_3 // 10 13:iconst_m1 // 11 14:ixor // 12 15:iand // 13 16:istore_1 if(j == 0) //* 14 17:iload_2 //* 15 18:ifne 27 return i | k >> 2; // 16 21:iload_1 // 17 22:iload_3 // 18 23:iconst_2 // 19 24:ishr // 20 25:ior // 21 26:ireturn else return i | k >> 1 & 0xffcfcfcf | (k >> 1 & 0x303030) >> 2; // 22 27:iload_1 // 23 28:iload_3 // 24 29:iconst_1 // 25 30:ishr // 26 31:ldc1 #141 <Int 0xffcfcfcf> // 27 33:iand // 28 34:ior // 29 35:iload_3 // 30 36:iconst_1 // 31 37:ishr // 32 38:ldc1 #24 <Int 0x303030> // 33 40:iand // 34 41:iconst_2 // 35 42:ishr // 36 43:ior // 37 44:ireturn } final int getAbsoluteMovementFlags(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return convertToAbsoluteDirection(getMovementFlags(recyclerview, viewholder), ViewCompat.getLayoutDirection(((View) (recyclerview)))); // 0 0:aload_0 // 1 1:aload_0 // 2 2:aload_1 // 3 3:aload_2 // 4 4:invokevirtual #146 <Method int getMovementFlags(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 5 7:aload_1 // 6 8:invokestatic #152 <Method int ViewCompat.getLayoutDirection(View)> // 7 11:invokevirtual #154 <Method int convertToAbsoluteDirection(int, int)> // 8 14:ireturn } public long getAnimationDuration(RecyclerView recyclerview, int i, float f, float f1) { recyclerview = ((RecyclerView) (recyclerview.getItemAnimator())); // 0 0:aload_1 // 1 1:invokevirtual #160 <Method android.support.v7.widget.RecyclerView$ItemAnimator RecyclerView.getItemAnimator()> // 2 4:astore_1 if(recyclerview == null) //* 3 5:aload_1 //* 4 6:ifnonnull 23 return i != 8 ? 250L : 200L; // 5 9:iload_2 // 6 10:bipush 8 // 7 12:icmpne 19 // 8 15:ldc2w #161 <Long 200L> // 9 18:lreturn // 10 19:ldc2w #163 <Long 250L> // 11 22:lreturn if(i == 8) //* 12 23:iload_2 //* 13 24:bipush 8 //* 14 26:icmpne 34 return ((android.support.v7.widget.RecyclerView.ItemAnimator) (recyclerview)).getMoveDuration(); // 15 29:aload_1 // 16 30:invokevirtual #170 <Method long android.support.v7.widget.RecyclerView$ItemAnimator.getMoveDuration()> // 17 33:lreturn else return ((android.support.v7.widget.RecyclerView.ItemAnimator) (recyclerview)).getRemoveDuration(); // 18 34:aload_1 // 19 35:invokevirtual #173 <Method long android.support.v7.widget.RecyclerView$ItemAnimator.getRemoveDuration()> // 20 38:lreturn } public int getBoundingBoxMargin() { return 0; // 0 0:iconst_0 // 1 1:ireturn } public float getMoveThreshold(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return 0.5F; // 0 0:ldc1 #177 <Float 0.5F> // 1 2:freturn } public abstract int getMovementFlags(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder); public float getSwipeEscapeVelocity(float f) { return f; // 0 0:fload_1 // 1 1:freturn } public float getSwipeThreshold(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return 0.5F; // 0 0:ldc1 #177 <Float 0.5F> // 1 2:freturn } public float getSwipeVelocityThreshold(float f) { return f; // 0 0:fload_1 // 1 1:freturn } boolean hasDragFlag(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return (0xff0000 & getAbsoluteMovementFlags(recyclerview, viewholder)) != 0; // 0 0:ldc1 #184 <Int 0xff0000> // 1 2:aload_0 // 2 3:aload_1 // 3 4:aload_2 // 4 5:invokevirtual #186 <Method int getAbsoluteMovementFlags(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 5 8:iand // 6 9:ifeq 14 // 7 12:iconst_1 // 8 13:ireturn // 9 14:iconst_0 // 10 15:ireturn } boolean hasSwipeFlag(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return (0xff00 & getAbsoluteMovementFlags(recyclerview, viewholder)) != 0; // 0 0:ldc1 #188 <Int 65280> // 1 2:aload_0 // 2 3:aload_1 // 3 4:aload_2 // 4 5:invokevirtual #186 <Method int getAbsoluteMovementFlags(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 5 8:iand // 6 9:ifeq 14 // 7 12:iconst_1 // 8 13:ireturn // 9 14:iconst_0 // 10 15:ireturn } public int interpolateOutOfBoundsScroll(RecyclerView recyclerview, int i, int j, int k, long l) { k = getMaxDragScroll(recyclerview); // 0 0:aload_0 // 1 1:aload_1 // 2 2:invokespecial #192 <Method int getMaxDragScroll(RecyclerView)> // 3 5:istore 4 int i1 = Math.abs(j); // 4 7:iload_3 // 5 8:invokestatic #127 <Method int Math.abs(int)> // 6 11:istore 8 int j1 = (int)Math.signum(j); // 7 13:iload_3 // 8 14:i2f // 9 15:invokestatic #195 <Method float Math.signum(float)> // 10 18:f2i // 11 19:istore 9 float f = Math.min(1.0F, (1.0F * (float)i1) / (float)i); // 12 21:fconst_1 // 13 22:fconst_1 // 14 23:iload 8 // 15 25:i2f // 16 26:fmul // 17 27:iload_2 // 18 28:i2f // 19 29:fdiv // 20 30:invokestatic #199 <Method float Math.min(float, float)> // 21 33:fstore 7 i = (int)((float)(j1 * k) * sDragViewScrollCapInterpolator.getInterpolation(f)); // 22 35:iload 9 // 23 37:iload 4 // 24 39:imul // 25 40:i2f // 26 41:getstatic #40 <Field Interpolator sDragViewScrollCapInterpolator> // 27 44:fload 7 // 28 46:invokeinterface #204 <Method float Interpolator.getInterpolation(float)> // 29 51:fmul // 30 52:f2i // 31 53:istore_2 if(l > 2000L) //* 32 54:lload 5 //* 33 56:ldc2w #21 <Long 2000L> //* 34 59:lcmp //* 35 60:ifle 91 f = 1.0F; // 36 63:fconst_1 // 37 64:fstore 7 else //* 38 66:iload_2 //* 39 67:i2f //* 40 68:getstatic #37 <Field Interpolator sDragScrollInterpolator> //* 41 71:fload 7 //* 42 73:invokeinterface #204 <Method float Interpolator.getInterpolation(float)> //* 43 78:fmul //* 44 79:f2i //* 45 80:istore_2 //* 46 81:iload_2 //* 47 82:ifne 104 //* 48 85:iload_3 //* 49 86:ifle 102 //* 50 89:iconst_1 //* 51 90:ireturn f = (float)l / 2000F; // 52 91:lload 5 // 53 93:l2f // 54 94:ldc1 #205 <Float 2000F> // 55 96:fdiv // 56 97:fstore 7 i = (int)((float)i * sDragScrollInterpolator.getInterpolation(f)); if(i == 0) return j <= 0 ? -1 : 1; // 57 99:goto 66 // 58 102:iconst_m1 // 59 103:ireturn else return i; // 60 104:iload_2 // 61 105:ireturn } public boolean isItemViewSwipeEnabled() { return true; // 0 0:iconst_1 // 1 1:ireturn } public boolean isLongPressDragEnabled() { return true; // 0 0:iconst_1 // 1 1:ireturn } public void onChildDraw(Canvas canvas, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, float f, float f1, int i, boolean flag) { sUICallback.onDraw(canvas, recyclerview, viewholder.itemView, f, f1, i, flag); // 0 0:getstatic #50 <Field ItemTouchUIUtil sUICallback> // 1 3:aload_1 // 2 4:aload_2 // 3 5:aload_3 // 4 6:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 5 9:fload 4 // 6 11:fload 5 // 7 13:iload 6 // 8 15:iload 7 // 9 17:invokeinterface #214 <Method void ItemTouchUIUtil.onDraw(Canvas, RecyclerView, View, float, float, int, boolean)> // 10 22:return } public void onChildDrawOver(Canvas canvas, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, float f, float f1, int i, boolean flag) { sUICallback.onDrawOver(canvas, recyclerview, viewholder.itemView, f, f1, i, flag); // 0 0:getstatic #50 <Field ItemTouchUIUtil sUICallback> // 1 3:aload_1 // 2 4:aload_2 // 3 5:aload_3 // 4 6:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 5 9:fload 4 // 6 11:fload 5 // 7 13:iload 6 // 8 15:iload 7 // 9 17:invokeinterface #218 <Method void ItemTouchUIUtil.onDrawOver(Canvas, RecyclerView, View, float, float, int, boolean)> // 10 22:return } void onDraw(Canvas canvas, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, List list, int i, float f, float f1) { int l = list.size(); // 0 0:aload 4 // 1 2:invokeinterface #115 <Method int List.size()> // 2 7:istore 9 for(int j = 0; j < l; j++) //* 3 9:iconst_0 //* 4 10:istore 8 //* 5 12:iload 8 //* 6 14:iload 9 //* 7 16:icmpge 86 { RecoverAnimation recoveranimation = (RecoverAnimation)list.get(j); // 8 19:aload 4 // 9 21:iload 8 // 10 23:invokeinterface #119 <Method Object List.get(int)> // 11 28:checkcast #221 <Class ItemTouchHelper$RecoverAnimation> // 12 31:astore 11 recoveranimation.update(); // 13 33:aload 11 // 14 35:invokevirtual #224 <Method void ItemTouchHelper$RecoverAnimation.update()> int i1 = canvas.save(); // 15 38:aload_1 // 16 39:invokevirtual #229 <Method int Canvas.save()> // 17 42:istore 10 onChildDraw(canvas, recyclerview, recoveranimation.mViewHolder, recoveranimation.mX, recoveranimation.mY, recoveranimation.mActionState, false); // 18 44:aload_0 // 19 45:aload_1 // 20 46:aload_2 // 21 47:aload 11 // 22 49:getfield #233 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 23 52:aload 11 // 24 54:getfield #237 <Field float ItemTouchHelper$RecoverAnimation.mX> // 25 57:aload 11 // 26 59:getfield #240 <Field float ItemTouchHelper$RecoverAnimation.mY> // 27 62:aload 11 // 28 64:getfield #243 <Field int ItemTouchHelper$RecoverAnimation.mActionState> // 29 67:iconst_0 // 30 68:invokevirtual #245 <Method void onChildDraw(Canvas, RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, float, float, int, boolean)> canvas.restoreToCount(i1); // 31 71:aload_1 // 32 72:iload 10 // 33 74:invokevirtual #249 <Method void Canvas.restoreToCount(int)> } // 34 77:iload 8 // 35 79:iconst_1 // 36 80:iadd // 37 81:istore 8 //* 38 83:goto 12 if(viewholder != null) //* 39 86:aload_3 //* 40 87:ifnull 116 { int k = canvas.save(); // 41 90:aload_1 // 42 91:invokevirtual #229 <Method int Canvas.save()> // 43 94:istore 8 onChildDraw(canvas, recyclerview, viewholder, f, f1, i, true); // 44 96:aload_0 // 45 97:aload_1 // 46 98:aload_2 // 47 99:aload_3 // 48 100:fload 6 // 49 102:fload 7 // 50 104:iload 5 // 51 106:iconst_1 // 52 107:invokevirtual #245 <Method void onChildDraw(Canvas, RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, float, float, int, boolean)> canvas.restoreToCount(k); // 53 110:aload_1 // 54 111:iload 8 // 55 113:invokevirtual #249 <Method void Canvas.restoreToCount(int)> } // 56 116:return } void onDrawOver(Canvas canvas, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, List list, int i, float f, float f1) { int l = list.size(); // 0 0:aload 4 // 1 2:invokeinterface #115 <Method int List.size()> // 2 7:istore 9 for(int j = 0; j < l; j++) //* 3 9:iconst_0 //* 4 10:istore 8 //* 5 12:iload 8 //* 6 14:iload 9 //* 7 16:icmpge 81 { RecoverAnimation recoveranimation = (RecoverAnimation)list.get(j); // 8 19:aload 4 // 9 21:iload 8 // 10 23:invokeinterface #119 <Method Object List.get(int)> // 11 28:checkcast #221 <Class ItemTouchHelper$RecoverAnimation> // 12 31:astore 11 int i1 = canvas.save(); // 13 33:aload_1 // 14 34:invokevirtual #229 <Method int Canvas.save()> // 15 37:istore 10 onChildDrawOver(canvas, recyclerview, recoveranimation.mViewHolder, recoveranimation.mX, recoveranimation.mY, recoveranimation.mActionState, false); // 16 39:aload_0 // 17 40:aload_1 // 18 41:aload_2 // 19 42:aload 11 // 20 44:getfield #233 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 21 47:aload 11 // 22 49:getfield #237 <Field float ItemTouchHelper$RecoverAnimation.mX> // 23 52:aload 11 // 24 54:getfield #240 <Field float ItemTouchHelper$RecoverAnimation.mY> // 25 57:aload 11 // 26 59:getfield #243 <Field int ItemTouchHelper$RecoverAnimation.mActionState> // 27 62:iconst_0 // 28 63:invokevirtual #252 <Method void onChildDrawOver(Canvas, RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, float, float, int, boolean)> canvas.restoreToCount(i1); // 29 66:aload_1 // 30 67:iload 10 // 31 69:invokevirtual #249 <Method void Canvas.restoreToCount(int)> } // 32 72:iload 8 // 33 74:iconst_1 // 34 75:iadd // 35 76:istore 8 //* 36 78:goto 12 if(viewholder != null) //* 37 81:aload_3 //* 38 82:ifnull 111 { int k = canvas.save(); // 39 85:aload_1 // 40 86:invokevirtual #229 <Method int Canvas.save()> // 41 89:istore 8 onChildDrawOver(canvas, recyclerview, viewholder, f, f1, i, true); // 42 91:aload_0 // 43 92:aload_1 // 44 93:aload_2 // 45 94:aload_3 // 46 95:fload 6 // 47 97:fload 7 // 48 99:iload 5 // 49 101:iconst_1 // 50 102:invokevirtual #252 <Method void onChildDrawOver(Canvas, RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, float, float, int, boolean)> canvas.restoreToCount(k); // 51 105:aload_1 // 52 106:iload 8 // 53 108:invokevirtual #249 <Method void Canvas.restoreToCount(int)> } boolean flag = false; // 54 111:iconst_0 // 55 112:istore 8 i = l - 1; // 56 114:iload 9 // 57 116:iconst_1 // 58 117:isub // 59 118:istore 5 while(i >= 0) //* 60 120:iload 5 //* 61 122:iflt 184 { canvas = ((Canvas) ((RecoverAnimation)list.get(i))); // 62 125:aload 4 // 63 127:iload 5 // 64 129:invokeinterface #119 <Method Object List.get(int)> // 65 134:checkcast #221 <Class ItemTouchHelper$RecoverAnimation> // 66 137:astore_1 if(((RecoverAnimation) (canvas)).mEnded && !((RecoverAnimation) (canvas)).mIsPendingCleanup) //* 67 138:aload_1 //* 68 139:getfield #256 <Field boolean ItemTouchHelper$RecoverAnimation.mEnded> //* 69 142:ifeq 171 //* 70 145:aload_1 //* 71 146:getfield #259 <Field boolean ItemTouchHelper$RecoverAnimation.mIsPendingCleanup> //* 72 149:ifne 171 list.remove(i); // 73 152:aload 4 // 74 154:iload 5 // 75 156:invokeinterface #262 <Method Object List.remove(int)> // 76 161:pop else //* 77 162:iload 5 //* 78 164:iconst_1 //* 79 165:isub //* 80 166:istore 5 //* 81 168:goto 120 if(!((RecoverAnimation) (canvas)).mEnded) //* 82 171:aload_1 //* 83 172:getfield #256 <Field boolean ItemTouchHelper$RecoverAnimation.mEnded> //* 84 175:ifne 162 flag = true; // 85 178:iconst_1 // 86 179:istore 8 i--; } //* 87 181:goto 162 if(flag) //* 88 184:iload 8 //* 89 186:ifeq 193 recyclerview.invalidate(); // 90 189:aload_2 // 91 190:invokevirtual #265 <Method void RecyclerView.invalidate()> // 92 193:return } public abstract boolean onMove(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, android.support.v7.widget.RecyclerView.ViewHolder viewholder1); public void onMoved(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i, android.support.v7.widget.RecyclerView.ViewHolder viewholder1, int j, int k, int l) { android.support.v7.widget.RecyclerView.LayoutManager layoutmanager = recyclerview.getLayoutManager(); // 0 0:aload_1 // 1 1:invokevirtual #272 <Method android.support.v7.widget.RecyclerView$LayoutManager RecyclerView.getLayoutManager()> // 2 4:astore 8 if(layoutmanager instanceof ViewDropHandler) //* 3 6:aload 8 //* 4 8:instanceof #274 <Class ItemTouchHelper$ViewDropHandler> //* 5 11:ifeq 38 { ((ViewDropHandler)layoutmanager).prepareForDrop(viewholder.itemView, viewholder1.itemView, k, l); // 6 14:aload 8 // 7 16:checkcast #274 <Class ItemTouchHelper$ViewDropHandler> // 8 19:aload_2 // 9 20:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 10 23:aload 4 // 11 25:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 12 28:iload 6 // 13 30:iload 7 // 14 32:invokeinterface #278 <Method void ItemTouchHelper$ViewDropHandler.prepareForDrop(View, View, int, int)> } else //* 15 37:return { if(layoutmanager.canScrollHorizontally()) //* 16 38:aload 8 //* 17 40:invokevirtual #283 <Method boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollHorizontally()> //* 18 43:ifeq 97 { if(layoutmanager.getDecoratedLeft(viewholder1.itemView) <= recyclerview.getPaddingLeft()) //* 19 46:aload 8 //* 20 48:aload 4 //* 21 50:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 22 53:invokevirtual #286 <Method int android.support.v7.widget.RecyclerView$LayoutManager.getDecoratedLeft(View)> //* 23 56:aload_1 //* 24 57:invokevirtual #289 <Method int RecyclerView.getPaddingLeft()> //* 25 60:icmpgt 69 recyclerview.scrollToPosition(j); // 26 63:aload_1 // 27 64:iload 5 // 28 66:invokevirtual #292 <Method void RecyclerView.scrollToPosition(int)> if(layoutmanager.getDecoratedRight(viewholder1.itemView) >= recyclerview.getWidth() - recyclerview.getPaddingRight()) //* 29 69:aload 8 //* 30 71:aload 4 //* 31 73:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 32 76:invokevirtual #295 <Method int android.support.v7.widget.RecyclerView$LayoutManager.getDecoratedRight(View)> //* 33 79:aload_1 //* 34 80:invokevirtual #296 <Method int RecyclerView.getWidth()> //* 35 83:aload_1 //* 36 84:invokevirtual #299 <Method int RecyclerView.getPaddingRight()> //* 37 87:isub //* 38 88:icmplt 97 recyclerview.scrollToPosition(j); // 39 91:aload_1 // 40 92:iload 5 // 41 94:invokevirtual #292 <Method void RecyclerView.scrollToPosition(int)> } if(layoutmanager.canScrollVertically()) //* 42 97:aload 8 //* 43 99:invokevirtual #302 <Method boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollVertically()> //* 44 102:ifeq 37 { if(layoutmanager.getDecoratedTop(viewholder1.itemView) <= recyclerview.getPaddingTop()) //* 45 105:aload 8 //* 46 107:aload 4 //* 47 109:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 48 112:invokevirtual #305 <Method int android.support.v7.widget.RecyclerView$LayoutManager.getDecoratedTop(View)> //* 49 115:aload_1 //* 50 116:invokevirtual #308 <Method int RecyclerView.getPaddingTop()> //* 51 119:icmpgt 128 recyclerview.scrollToPosition(j); // 52 122:aload_1 // 53 123:iload 5 // 54 125:invokevirtual #292 <Method void RecyclerView.scrollToPosition(int)> if(layoutmanager.getDecoratedBottom(viewholder1.itemView) >= recyclerview.getHeight() - recyclerview.getPaddingBottom()) //* 55 128:aload 8 //* 56 130:aload 4 //* 57 132:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 58 135:invokevirtual #311 <Method int android.support.v7.widget.RecyclerView$LayoutManager.getDecoratedBottom(View)> //* 59 138:aload_1 //* 60 139:invokevirtual #312 <Method int RecyclerView.getHeight()> //* 61 142:aload_1 //* 62 143:invokevirtual #315 <Method int RecyclerView.getPaddingBottom()> //* 63 146:isub //* 64 147:icmplt 37 { recyclerview.scrollToPosition(j); // 65 150:aload_1 // 66 151:iload 5 // 67 153:invokevirtual #292 <Method void RecyclerView.scrollToPosition(int)> return; // 68 156:return } } } } public void onSelectedChanged(android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i) { if(viewholder != null) //* 0 0:aload_1 //* 1 1:ifnull 16 sUICallback.onSelected(viewholder.itemView); // 2 4:getstatic #50 <Field ItemTouchUIUtil sUICallback> // 3 7:aload_1 // 4 8:getfield #95 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 5 11:invokeinterface #320 <Method void ItemTouchUIUtil.onSelected(View)> // 6 16:return } public abstract void onSwiped(android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i); private static final int ABS_HORIZONTAL_DIR_FLAGS = 0xc0c0c; public static final int DEFAULT_DRAG_ANIMATION_DURATION = 200; public static final int DEFAULT_SWIPE_ANIMATION_DURATION = 250; private static final long DRAG_SCROLL_ACCELERATION_LIMIT_TIME_MS = 2000L; static final int RELATIVE_DIR_FLAGS = 0x303030; private static final Interpolator sDragScrollInterpolator = new Interpolator() { public float getInterpolation(float f) { return f * f * f * f * f; // 0 0:fload_1 // 1 1:fload_1 // 2 2:fmul // 3 3:fload_1 // 4 4:fmul // 5 5:fload_1 // 6 6:fmul // 7 7:fload_1 // 8 8:fmul // 9 9:freturn } } ; private static final Interpolator sDragViewScrollCapInterpolator = new Interpolator() { public float getInterpolation(float f) { f--; // 0 0:fload_1 // 1 1:fconst_1 // 2 2:fsub // 3 3:fstore_1 return f * f * f * f * f + 1.0F; // 4 4:fload_1 // 5 5:fload_1 // 6 6:fmul // 7 7:fload_1 // 8 8:fmul // 9 9:fload_1 // 10 10:fmul // 11 11:fload_1 // 12 12:fmul // 13 13:fconst_1 // 14 14:fadd // 15 15:freturn } } ; private static final ItemTouchUIUtil sUICallback; private int mCachedMaxScrollSpeed; static { // 0 0:new #9 <Class ItemTouchHelper$Callback$1> // 1 3:dup // 2 4:invokespecial #35 <Method void ItemTouchHelper$Callback$1()> // 3 7:putstatic #37 <Field Interpolator sDragScrollInterpolator> // 4 10:new #11 <Class ItemTouchHelper$Callback$2> // 5 13:dup // 6 14:invokespecial #38 <Method void ItemTouchHelper$Callback$2()> // 7 17:putstatic #40 <Field Interpolator sDragViewScrollCapInterpolator> if(android.os.Build.VERSION.SDK_INT >= 21) //* 8 20:getstatic #45 <Field int android.os.Build$VERSION.SDK_INT> //* 9 23:bipush 21 //* 10 25:icmplt 39 sUICallback = ((ItemTouchUIUtil) (new ItemTouchUIUtilImpl.Api21Impl())); // 11 28:new #47 <Class ItemTouchUIUtilImpl$Api21Impl> // 12 31:dup // 13 32:invokespecial #48 <Method void ItemTouchUIUtilImpl$Api21Impl()> // 14 35:putstatic #50 <Field ItemTouchUIUtil sUICallback> // 15 38:return else sUICallback = ((ItemTouchUIUtil) (new ItemTouchUIUtilImpl.BaseImpl())); // 16 39:new #52 <Class ItemTouchUIUtilImpl$BaseImpl> // 17 42:dup // 18 43:invokespecial #53 <Method void ItemTouchUIUtilImpl$BaseImpl()> // 19 46:putstatic #50 <Field ItemTouchUIUtil sUICallback> //* 20 49:return } public Callback() { // 0 0:aload_0 // 1 1:invokespecial #55 <Method void Object()> mCachedMaxScrollSpeed = -1; // 2 4:aload_0 // 3 5:iconst_m1 // 4 6:putfield #57 <Field int mCachedMaxScrollSpeed> // 5 9:return } } private class ItemTouchHelperGestureListener extends android.view.GestureDetector.SimpleOnGestureListener { public boolean onDown(MotionEvent motionevent) { return true; // 0 0:iconst_1 // 1 1:ireturn } public void onLongPress(MotionEvent motionevent) { Object obj; obj = ((Object) (findChildView(motionevent))); // 0 0:aload_0 // 1 1:getfield #13 <Field ItemTouchHelper this$0> // 2 4:aload_1 // 3 5:invokevirtual #25 <Method View ItemTouchHelper.findChildView(MotionEvent)> // 4 8:astore 5 if(obj != null) //* 5 10:aload 5 //* 6 12:ifnull 56 { obj = ((Object) (mRecyclerView.getChildViewHolder(((View) (obj))))); // 7 15:aload_0 // 8 16:getfield #13 <Field ItemTouchHelper this$0> // 9 19:getfield #29 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 10 22:aload 5 // 11 24:invokevirtual #35 <Method android.support.v7.widget.RecyclerView$ViewHolder RecyclerView.getChildViewHolder(View)> // 12 27:astore 5 break MISSING_BLOCK_LABEL_29; } //* 13 29:aload 5 //* 14 31:ifnull 56 //* 15 34:aload_0 //* 16 35:getfield #13 <Field ItemTouchHelper this$0> //* 17 38:getfield #39 <Field ItemTouchHelper$Callback ItemTouchHelper.mCallback> //* 18 41:aload_0 //* 19 42:getfield #13 <Field ItemTouchHelper this$0> //* 20 45:getfield #29 <Field RecyclerView ItemTouchHelper.mRecyclerView> //* 21 48:aload 5 //* 22 50:invokevirtual #45 <Method boolean ItemTouchHelper$Callback.hasDragFlag(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> //* 23 53:ifne 57 _L1: return; // 24 56:return if(obj != null && mCallback.hasDragFlag(mRecyclerView, ((android.support.v7.widget.RecyclerView.ViewHolder) (obj))) && motionevent.getPointerId(0) == mActivePointerId) //* 25 57:aload_1 //* 26 58:iconst_0 //* 27 59:invokevirtual #51 <Method int MotionEvent.getPointerId(int)> //* 28 62:aload_0 //* 29 63:getfield #13 <Field ItemTouchHelper this$0> //* 30 66:getfield #55 <Field int ItemTouchHelper.mActivePointerId> //* 31 69:icmpne 56 { int i = motionevent.findPointerIndex(mActivePointerId); // 32 72:aload_1 // 33 73:aload_0 // 34 74:getfield #13 <Field ItemTouchHelper this$0> // 35 77:getfield #55 <Field int ItemTouchHelper.mActivePointerId> // 36 80:invokevirtual #58 <Method int MotionEvent.findPointerIndex(int)> // 37 83:istore 4 float f = motionevent.getX(i); // 38 85:aload_1 // 39 86:iload 4 // 40 88:invokevirtual #62 <Method float MotionEvent.getX(int)> // 41 91:fstore_2 float f1 = motionevent.getY(i); // 42 92:aload_1 // 43 93:iload 4 // 44 95:invokevirtual #65 <Method float MotionEvent.getY(int)> // 45 98:fstore_3 mInitialTouchX = f; // 46 99:aload_0 // 47 100:getfield #13 <Field ItemTouchHelper this$0> // 48 103:fload_2 // 49 104:putfield #69 <Field float ItemTouchHelper.mInitialTouchX> mInitialTouchY = f1; // 50 107:aload_0 // 51 108:getfield #13 <Field ItemTouchHelper this$0> // 52 111:fload_3 // 53 112:putfield #72 <Field float ItemTouchHelper.mInitialTouchY> motionevent = ((MotionEvent) (ItemTouchHelper.this)); // 54 115:aload_0 // 55 116:getfield #13 <Field ItemTouchHelper this$0> // 56 119:astore_1 mDy = 0.0F; // 57 120:aload_0 // 58 121:getfield #13 <Field ItemTouchHelper this$0> // 59 124:fconst_0 // 60 125:putfield #75 <Field float ItemTouchHelper.mDy> motionevent.mDx = 0.0F; // 61 128:aload_1 // 62 129:fconst_0 // 63 130:putfield #78 <Field float ItemTouchHelper.mDx> if(mCallback.isLongPressDragEnabled()) //* 64 133:aload_0 //* 65 134:getfield #13 <Field ItemTouchHelper this$0> //* 66 137:getfield #39 <Field ItemTouchHelper$Callback ItemTouchHelper.mCallback> //* 67 140:invokevirtual #82 <Method boolean ItemTouchHelper$Callback.isLongPressDragEnabled()> //* 68 143:ifeq 56 { select(((android.support.v7.widget.RecyclerView.ViewHolder) (obj)), 2); // 69 146:aload_0 // 70 147:getfield #13 <Field ItemTouchHelper this$0> // 71 150:aload 5 // 72 152:iconst_2 // 73 153:invokevirtual #86 <Method void ItemTouchHelper.select(android.support.v7.widget.RecyclerView$ViewHolder, int)> return; // 74 156:return } } goto _L1 } final ItemTouchHelper this$0; ItemTouchHelperGestureListener() { this$0 = ItemTouchHelper.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #13 <Field ItemTouchHelper this$0> super(); // 3 5:aload_0 // 4 6:invokespecial #16 <Method void android.view.GestureDetector$SimpleOnGestureListener()> // 5 9:return } } private static class RecoverAnimation implements android.animation.Animator.AnimatorListener { public void cancel() { mValueAnimator.cancel(); // 0 0:aload_0 // 1 1:getfield #61 <Field ValueAnimator mValueAnimator> // 2 4:invokevirtual #90 <Method void ValueAnimator.cancel()> // 3 7:return } public void onAnimationCancel(Animator animator) { setFraction(1.0F); // 0 0:aload_0 // 1 1:fconst_1 // 2 2:invokevirtual #86 <Method void setFraction(float)> // 3 5:return } public void onAnimationEnd(Animator animator) { if(!mEnded) //* 0 0:aload_0 //* 1 1:getfield #39 <Field boolean mEnded> //* 2 4:ifne 15 mViewHolder.setIsRecyclable(true); // 3 7:aload_0 // 4 8:getfield #45 <Field android.support.v7.widget.RecyclerView$ViewHolder mViewHolder> // 5 11:iconst_1 // 6 12:invokevirtual #97 <Method void android.support.v7.widget.RecyclerView$ViewHolder.setIsRecyclable(boolean)> mEnded = true; // 7 15:aload_0 // 8 16:iconst_1 // 9 17:putfield #39 <Field boolean mEnded> // 10 20:return } public void onAnimationRepeat(Animator animator) { // 0 0:return } public void onAnimationStart(Animator animator) { // 0 0:return } public void setDuration(long l) { mValueAnimator.setDuration(l); // 0 0:aload_0 // 1 1:getfield #61 <Field ValueAnimator mValueAnimator> // 2 4:lload_1 // 3 5:invokevirtual #104 <Method ValueAnimator ValueAnimator.setDuration(long)> // 4 8:pop // 5 9:return } public void setFraction(float f) { mFraction = f; // 0 0:aload_0 // 1 1:fload_1 // 2 2:putfield #106 <Field float mFraction> // 3 5:return } public void start() { mViewHolder.setIsRecyclable(false); // 0 0:aload_0 // 1 1:getfield #45 <Field android.support.v7.widget.RecyclerView$ViewHolder mViewHolder> // 2 4:iconst_0 // 3 5:invokevirtual #97 <Method void android.support.v7.widget.RecyclerView$ViewHolder.setIsRecyclable(boolean)> mValueAnimator.start(); // 4 8:aload_0 // 5 9:getfield #61 <Field ValueAnimator mValueAnimator> // 6 12:invokevirtual #109 <Method void ValueAnimator.start()> // 7 15:return } public void update() { if(mStartDx == mTargetX) //* 0 0:aload_0 //* 1 1:getfield #47 <Field float mStartDx> //* 2 4:aload_0 //* 3 5:getfield #51 <Field float mTargetX> //* 4 8:fcmpl //* 5 9:ifne 53 mX = mViewHolder.itemView.getTranslationX(); // 6 12:aload_0 // 7 13:aload_0 // 8 14:getfield #45 <Field android.support.v7.widget.RecyclerView$ViewHolder mViewHolder> // 9 17:getfield #74 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 10 20:invokevirtual #116 <Method float View.getTranslationX()> // 11 23:putfield #118 <Field float mX> else //* 12 26:aload_0 //* 13 27:getfield #49 <Field float mStartDy> //* 14 30:aload_0 //* 15 31:getfield #53 <Field float mTargetY> //* 16 34:fcmpl //* 17 35:ifne 79 //* 18 38:aload_0 //* 19 39:aload_0 //* 20 40:getfield #45 <Field android.support.v7.widget.RecyclerView$ViewHolder mViewHolder> //* 21 43:getfield #74 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 22 46:invokevirtual #121 <Method float View.getTranslationY()> //* 23 49:putfield #123 <Field float mY> //* 24 52:return mX = mStartDx + mFraction * (mTargetX - mStartDx); // 25 53:aload_0 // 26 54:aload_0 // 27 55:getfield #47 <Field float mStartDx> // 28 58:aload_0 // 29 59:getfield #106 <Field float mFraction> // 30 62:aload_0 // 31 63:getfield #51 <Field float mTargetX> // 32 66:aload_0 // 33 67:getfield #47 <Field float mStartDx> // 34 70:fsub // 35 71:fmul // 36 72:fadd // 37 73:putfield #118 <Field float mX> if(mStartDy == mTargetY) { mY = mViewHolder.itemView.getTranslationY(); return; } else //* 38 76:goto 26 { mY = mStartDy + mFraction * (mTargetY - mStartDy); // 39 79:aload_0 // 40 80:aload_0 // 41 81:getfield #49 <Field float mStartDy> // 42 84:aload_0 // 43 85:getfield #106 <Field float mFraction> // 44 88:aload_0 // 45 89:getfield #53 <Field float mTargetY> // 46 92:aload_0 // 47 93:getfield #49 <Field float mStartDy> // 48 96:fsub // 49 97:fmul // 50 98:fadd // 51 99:putfield #123 <Field float mY> return; // 52 102:return } } final int mActionState; final int mAnimationType; boolean mEnded; private float mFraction; public boolean mIsPendingCleanup; boolean mOverridden; final float mStartDx; final float mStartDy; final float mTargetX; final float mTargetY; private final ValueAnimator mValueAnimator = ValueAnimator.ofFloat(new float[] { 0.0F, 1.0F }); final android.support.v7.widget.RecyclerView.ViewHolder mViewHolder; float mX; float mY; RecoverAnimation(android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i, int j, float f, float f1, float f2, float f3) { // 0 0:aload_0 // 1 1:invokespecial #35 <Method void Object()> mOverridden = false; // 2 4:aload_0 // 3 5:iconst_0 // 4 6:putfield #37 <Field boolean mOverridden> mEnded = false; // 5 9:aload_0 // 6 10:iconst_0 // 7 11:putfield #39 <Field boolean mEnded> mActionState = j; // 8 14:aload_0 // 9 15:iload_3 // 10 16:putfield #41 <Field int mActionState> mAnimationType = i; // 11 19:aload_0 // 12 20:iload_2 // 13 21:putfield #43 <Field int mAnimationType> mViewHolder = viewholder; // 14 24:aload_0 // 15 25:aload_1 // 16 26:putfield #45 <Field android.support.v7.widget.RecyclerView$ViewHolder mViewHolder> mStartDx = f; // 17 29:aload_0 // 18 30:fload 4 // 19 32:putfield #47 <Field float mStartDx> mStartDy = f1; // 20 35:aload_0 // 21 36:fload 5 // 22 38:putfield #49 <Field float mStartDy> mTargetX = f2; // 23 41:aload_0 // 24 42:fload 6 // 25 44:putfield #51 <Field float mTargetX> mTargetY = f3; // 26 47:aload_0 // 27 48:fload 7 // 28 50:putfield #53 <Field float mTargetY> // 29 53:aload_0 // 30 54:iconst_2 // 31 55:newarray float[] // 32 57:dup // 33 58:iconst_0 // 34 59:fconst_0 // 35 60:fastore // 36 61:dup // 37 62:iconst_1 // 38 63:fconst_1 // 39 64:fastore // 40 65:invokestatic #59 <Method ValueAnimator ValueAnimator.ofFloat(float[])> // 41 68:putfield #61 <Field ValueAnimator mValueAnimator> mValueAnimator.addUpdateListener(new _cls1()); // 42 71:aload_0 // 43 72:getfield #61 <Field ValueAnimator mValueAnimator> // 44 75:new #11 <Class ItemTouchHelper$RecoverAnimation$1> // 45 78:dup // 46 79:aload_0 // 47 80:invokespecial #64 <Method void ItemTouchHelper$RecoverAnimation$1(ItemTouchHelper$RecoverAnimation)> // 48 83:invokevirtual #68 <Method void ValueAnimator.addUpdateListener(android.animation.ValueAnimator$AnimatorUpdateListener)> mValueAnimator.setTarget(((Object) (viewholder.itemView))); // 49 86:aload_0 // 50 87:getfield #61 <Field ValueAnimator mValueAnimator> // 51 90:aload_1 // 52 91:getfield #74 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 53 94:invokevirtual #78 <Method void ValueAnimator.setTarget(Object)> mValueAnimator.addListener(((android.animation.Animator.AnimatorListener) (this))); // 54 97:aload_0 // 55 98:getfield #61 <Field ValueAnimator mValueAnimator> // 56 101:aload_0 // 57 102:invokevirtual #82 <Method void ValueAnimator.addListener(android.animation.Animator$AnimatorListener)> setFraction(0.0F); // 58 105:aload_0 // 59 106:fconst_0 // 60 107:invokevirtual #86 <Method void setFraction(float)> // 61 110:return } } public static abstract class SimpleCallback extends Callback { public int getDragDirs(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return mDefaultDragDirs; // 0 0:aload_0 // 1 1:getfield #19 <Field int mDefaultDragDirs> // 2 4:ireturn } public int getMovementFlags(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return makeMovementFlags(getDragDirs(recyclerview, viewholder), getSwipeDirs(recyclerview, viewholder)); // 0 0:aload_0 // 1 1:aload_1 // 2 2:aload_2 // 3 3:invokevirtual #25 <Method int getDragDirs(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 4 6:aload_0 // 5 7:aload_1 // 6 8:aload_2 // 7 9:invokevirtual #28 <Method int getSwipeDirs(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 8 12:invokestatic #32 <Method int makeMovementFlags(int, int)> // 9 15:ireturn } public int getSwipeDirs(RecyclerView recyclerview, android.support.v7.widget.RecyclerView.ViewHolder viewholder) { return mDefaultSwipeDirs; // 0 0:aload_0 // 1 1:getfield #17 <Field int mDefaultSwipeDirs> // 2 4:ireturn } public void setDefaultDragDirs(int i) { mDefaultDragDirs = i; // 0 0:aload_0 // 1 1:iload_1 // 2 2:putfield #19 <Field int mDefaultDragDirs> // 3 5:return } public void setDefaultSwipeDirs(int i) { mDefaultSwipeDirs = i; // 0 0:aload_0 // 1 1:iload_1 // 2 2:putfield #17 <Field int mDefaultSwipeDirs> // 3 5:return } private int mDefaultDragDirs; private int mDefaultSwipeDirs; public SimpleCallback(int i, int j) { // 0 0:aload_0 // 1 1:invokespecial #15 <Method void ItemTouchHelper$Callback()> mDefaultSwipeDirs = j; // 2 4:aload_0 // 3 5:iload_2 // 4 6:putfield #17 <Field int mDefaultSwipeDirs> mDefaultDragDirs = i; // 5 9:aload_0 // 6 10:iload_1 // 7 11:putfield #19 <Field int mDefaultDragDirs> // 8 14:return } } public static interface ViewDropHandler { public abstract void prepareForDrop(View view, View view1, int i, int j); } public ItemTouchHelper(Callback callback) { // 0 0:aload_0 // 1 1:invokespecial #126 <Method void android.support.v7.widget.RecyclerView$ItemDecoration()> // 2 4:aload_0 // 3 5:new #128 <Class ArrayList> // 4 8:dup // 5 9:invokespecial #129 <Method void ArrayList()> // 6 12:putfield #131 <Field List mPendingCleanup> // 7 15:aload_0 // 8 16:iconst_2 // 9 17:newarray float[] // 10 19:putfield #133 <Field float[] mTmpPosition> mSelected = null; // 11 22:aload_0 // 12 23:aconst_null // 13 24:putfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> mActivePointerId = -1; // 14 27:aload_0 // 15 28:iconst_m1 // 16 29:putfield #137 <Field int mActivePointerId> mActionState = 0; // 17 32:aload_0 // 18 33:iconst_0 // 19 34:putfield #139 <Field int mActionState> mRecoverAnimations = ((List) (new ArrayList())); // 20 37:aload_0 // 21 38:new #128 <Class ArrayList> // 22 41:dup // 23 42:invokespecial #129 <Method void ArrayList()> // 24 45:putfield #141 <Field List mRecoverAnimations> // 25 48:aload_0 // 26 49:new #8 <Class ItemTouchHelper$1> // 27 52:dup // 28 53:aload_0 // 29 54:invokespecial #144 <Method void ItemTouchHelper$1(ItemTouchHelper)> // 30 57:putfield #146 <Field Runnable mScrollRunnable> mChildDrawingOrderCallback = null; // 31 60:aload_0 // 32 61:aconst_null // 33 62:putfield #148 <Field android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback mChildDrawingOrderCallback> mOverdrawChild = null; // 34 65:aload_0 // 35 66:aconst_null // 36 67:putfield #150 <Field View mOverdrawChild> mOverdrawChildPosition = -1; // 37 70:aload_0 // 38 71:iconst_m1 // 39 72:putfield #152 <Field int mOverdrawChildPosition> // 40 75:aload_0 // 41 76:new #10 <Class ItemTouchHelper$2> // 42 79:dup // 43 80:aload_0 // 44 81:invokespecial #153 <Method void ItemTouchHelper$2(ItemTouchHelper)> // 45 84:putfield #155 <Field android.support.v7.widget.RecyclerView$OnItemTouchListener mOnItemTouchListener> mCallback = callback; // 46 87:aload_0 // 47 88:aload_1 // 48 89:putfield #157 <Field ItemTouchHelper$Callback mCallback> // 49 92:return } private void addChildDrawingOrderCallback() { if(android.os.Build.VERSION.SDK_INT >= 21) //* 0 0:getstatic #164 <Field int android.os.Build$VERSION.SDK_INT> //* 1 3:bipush 21 //* 2 5:icmplt 9 return; // 3 8:return if(mChildDrawingOrderCallback == null) //* 4 9:aload_0 //* 5 10:getfield #148 <Field android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback mChildDrawingOrderCallback> //* 6 13:ifnonnull 28 mChildDrawingOrderCallback = new android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback() { public int onGetChildDrawingOrder(int i, int j) { if(mOverdrawChild != null) //* 0 0:aload_0 //* 1 1:getfield #17 <Field ItemTouchHelper this$0> //* 2 4:getfield #26 <Field View ItemTouchHelper.mOverdrawChild> //* 3 7:ifnonnull 12 //* 4 10:iload_2 //* 5 11:ireturn { int l = mOverdrawChildPosition; // 6 12:aload_0 // 7 13:getfield #17 <Field ItemTouchHelper this$0> // 8 16:getfield #30 <Field int ItemTouchHelper.mOverdrawChildPosition> // 9 19:istore 4 int k = l; // 10 21:iload 4 // 11 23:istore_3 if(l == -1) //* 12 24:iload 4 //* 13 26:iconst_m1 //* 14 27:icmpne 56 { k = mRecyclerView.indexOfChild(mOverdrawChild); // 15 30:aload_0 // 16 31:getfield #17 <Field ItemTouchHelper this$0> // 17 34:getfield #34 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 18 37:aload_0 // 19 38:getfield #17 <Field ItemTouchHelper this$0> // 20 41:getfield #26 <Field View ItemTouchHelper.mOverdrawChild> // 21 44:invokevirtual #40 <Method int RecyclerView.indexOfChild(View)> // 22 47:istore_3 mOverdrawChildPosition = k; // 23 48:aload_0 // 24 49:getfield #17 <Field ItemTouchHelper this$0> // 25 52:iload_3 // 26 53:putfield #30 <Field int ItemTouchHelper.mOverdrawChildPosition> } if(j == i - 1) //* 27 56:iload_2 //* 28 57:iload_1 //* 29 58:iconst_1 //* 30 59:isub //* 31 60:icmpne 65 return k; // 32 63:iload_3 // 33 64:ireturn if(j >= k) //* 34 65:iload_2 //* 35 66:iload_3 //* 36 67:icmplt 10 return j + 1; // 37 70:iload_2 // 38 71:iconst_1 // 39 72:iadd // 40 73:ireturn } return j; } final ItemTouchHelper this$0; { this$0 = ItemTouchHelper.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #17 <Field ItemTouchHelper this$0> super(); // 3 5:aload_0 // 4 6:invokespecial #19 <Method void Object()> // 5 9:return } } ; // 7 16:aload_0 // 8 17:new #16 <Class ItemTouchHelper$5> // 9 20:dup // 10 21:aload_0 // 11 22:invokespecial #165 <Method void ItemTouchHelper$5(ItemTouchHelper)> // 12 25:putfield #148 <Field android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback mChildDrawingOrderCallback> mRecyclerView.setChildDrawingOrderCallback(mChildDrawingOrderCallback); // 13 28:aload_0 // 14 29:getfield #167 <Field RecyclerView mRecyclerView> // 15 32:aload_0 // 16 33:getfield #148 <Field android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback mChildDrawingOrderCallback> // 17 36:invokevirtual #173 <Method void RecyclerView.setChildDrawingOrderCallback(android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback)> // 18 39:return } private int checkHorizontalSwipe(android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i) { if((i & 0xc) != 0) //* 0 0:iload_2 //* 1 1:bipush 12 //* 2 3:iand //* 3 4:ifeq 199 { byte byte0; if(mDx > 0.0F) //* 4 7:aload_0 //* 5 8:getfield #177 <Field float mDx> //* 6 11:fconst_0 //* 7 12:fcmpl //* 8 13:ifle 143 byte0 = 8; // 9 16:bipush 8 // 10 18:istore 5 else //* 11 20:aload_0 //* 12 21:getfield #179 <Field VelocityTracker mVelocityTracker> //* 13 24:ifnull 155 //* 14 27:aload_0 //* 15 28:getfield #137 <Field int mActivePointerId> //* 16 31:iconst_m1 //* 17 32:icmple 155 //* 18 35:aload_0 //* 19 36:getfield #179 <Field VelocityTracker mVelocityTracker> //* 20 39:sipush 1000 //* 21 42:aload_0 //* 22 43:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 23 46:aload_0 //* 24 47:getfield #181 <Field float mMaxSwipeVelocity> //* 25 50:invokevirtual #185 <Method float ItemTouchHelper$Callback.getSwipeVelocityThreshold(float)> //* 26 53:invokevirtual #191 <Method void VelocityTracker.computeCurrentVelocity(int, float)> //* 27 56:aload_0 //* 28 57:getfield #179 <Field VelocityTracker mVelocityTracker> //* 29 60:aload_0 //* 30 61:getfield #137 <Field int mActivePointerId> //* 31 64:invokevirtual #195 <Method float VelocityTracker.getXVelocity(int)> //* 32 67:fstore 4 //* 33 69:aload_0 //* 34 70:getfield #179 <Field VelocityTracker mVelocityTracker> //* 35 73:aload_0 //* 36 74:getfield #137 <Field int mActivePointerId> //* 37 77:invokevirtual #198 <Method float VelocityTracker.getYVelocity(int)> //* 38 80:fstore_3 //* 39 81:fload 4 //* 40 83:fconst_0 //* 41 84:fcmpl //* 42 85:ifle 149 //* 43 88:bipush 8 //* 44 90:istore 6 //* 45 92:fload 4 //* 46 94:invokestatic #203 <Method float Math.abs(float)> //* 47 97:fstore 4 //* 48 99:iload 6 //* 49 101:iload_2 //* 50 102:iand //* 51 103:ifeq 155 //* 52 106:iload 5 //* 53 108:iload 6 //* 54 110:icmpne 155 //* 55 113:fload 4 //* 56 115:aload_0 //* 57 116:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 58 119:aload_0 //* 59 120:getfield #205 <Field float mSwipeEscapeVelocity> //* 60 123:invokevirtual #208 <Method float ItemTouchHelper$Callback.getSwipeEscapeVelocity(float)> //* 61 126:fcmpl //* 62 127:iflt 155 //* 63 130:fload 4 //* 64 132:fload_3 //* 65 133:invokestatic #203 <Method float Math.abs(float)> //* 66 136:fcmpl //* 67 137:ifle 155 //* 68 140:iload 6 //* 69 142:ireturn byte0 = 4; // 70 143:iconst_4 // 71 144:istore 5 if(mVelocityTracker != null && mActivePointerId > -1) { mVelocityTracker.computeCurrentVelocity(1000, mCallback.getSwipeVelocityThreshold(mMaxSwipeVelocity)); float f2 = mVelocityTracker.getXVelocity(mActivePointerId); float f = mVelocityTracker.getYVelocity(mActivePointerId); byte byte1; if(f2 > 0.0F) byte1 = 8; else //* 72 146:goto 20 byte1 = 4; // 73 149:iconst_4 // 74 150:istore 6 f2 = Math.abs(f2); if((byte1 & i) != 0 && byte0 == byte1 && f2 >= mCallback.getSwipeEscapeVelocity(mSwipeEscapeVelocity) && f2 > Math.abs(f)) return ((int) (byte1)); } //* 75 152:goto 92 float f1 = mRecyclerView.getWidth(); // 76 155:aload_0 // 77 156:getfield #167 <Field RecyclerView mRecyclerView> // 78 159:invokevirtual #212 <Method int RecyclerView.getWidth()> // 79 162:i2f // 80 163:fstore_3 float f3 = mCallback.getSwipeThreshold(viewholder); // 81 164:aload_0 // 82 165:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 83 168:aload_1 // 84 169:invokevirtual #216 <Method float ItemTouchHelper$Callback.getSwipeThreshold(android.support.v7.widget.RecyclerView$ViewHolder)> // 85 172:fstore 4 if((i & byte0) != 0 && Math.abs(mDx) > f1 * f3) //* 86 174:iload_2 //* 87 175:iload 5 //* 88 177:iand //* 89 178:ifeq 199 //* 90 181:aload_0 //* 91 182:getfield #177 <Field float mDx> //* 92 185:invokestatic #203 <Method float Math.abs(float)> //* 93 188:fload_3 //* 94 189:fload 4 //* 95 191:fmul //* 96 192:fcmpl //* 97 193:ifle 199 return ((int) (byte0)); // 98 196:iload 5 // 99 198:ireturn } return 0; // 100 199:iconst_0 // 101 200:ireturn } private int checkVerticalSwipe(android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i) { if((i & 3) != 0) //* 0 0:iload_2 //* 1 1:iconst_3 //* 2 2:iand //* 3 3:ifeq 196 { byte byte0; if(mDy > 0.0F) //* 4 6:aload_0 //* 5 7:getfield #219 <Field float mDy> //* 6 10:fconst_0 //* 7 11:fcmpl //* 8 12:ifle 140 byte0 = 2; // 9 15:iconst_2 // 10 16:istore 5 else //* 11 18:aload_0 //* 12 19:getfield #179 <Field VelocityTracker mVelocityTracker> //* 13 22:ifnull 152 //* 14 25:aload_0 //* 15 26:getfield #137 <Field int mActivePointerId> //* 16 29:iconst_m1 //* 17 30:icmple 152 //* 18 33:aload_0 //* 19 34:getfield #179 <Field VelocityTracker mVelocityTracker> //* 20 37:sipush 1000 //* 21 40:aload_0 //* 22 41:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 23 44:aload_0 //* 24 45:getfield #181 <Field float mMaxSwipeVelocity> //* 25 48:invokevirtual #185 <Method float ItemTouchHelper$Callback.getSwipeVelocityThreshold(float)> //* 26 51:invokevirtual #191 <Method void VelocityTracker.computeCurrentVelocity(int, float)> //* 27 54:aload_0 //* 28 55:getfield #179 <Field VelocityTracker mVelocityTracker> //* 29 58:aload_0 //* 30 59:getfield #137 <Field int mActivePointerId> //* 31 62:invokevirtual #195 <Method float VelocityTracker.getXVelocity(int)> //* 32 65:fstore_3 //* 33 66:aload_0 //* 34 67:getfield #179 <Field VelocityTracker mVelocityTracker> //* 35 70:aload_0 //* 36 71:getfield #137 <Field int mActivePointerId> //* 37 74:invokevirtual #198 <Method float VelocityTracker.getYVelocity(int)> //* 38 77:fstore 4 //* 39 79:fload 4 //* 40 81:fconst_0 //* 41 82:fcmpl //* 42 83:ifle 146 //* 43 86:iconst_2 //* 44 87:istore 6 //* 45 89:fload 4 //* 46 91:invokestatic #203 <Method float Math.abs(float)> //* 47 94:fstore 4 //* 48 96:iload 6 //* 49 98:iload_2 //* 50 99:iand //* 51 100:ifeq 152 //* 52 103:iload 6 //* 53 105:iload 5 //* 54 107:icmpne 152 //* 55 110:fload 4 //* 56 112:aload_0 //* 57 113:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 58 116:aload_0 //* 59 117:getfield #205 <Field float mSwipeEscapeVelocity> //* 60 120:invokevirtual #208 <Method float ItemTouchHelper$Callback.getSwipeEscapeVelocity(float)> //* 61 123:fcmpl //* 62 124:iflt 152 //* 63 127:fload 4 //* 64 129:fload_3 //* 65 130:invokestatic #203 <Method float Math.abs(float)> //* 66 133:fcmpl //* 67 134:ifle 152 //* 68 137:iload 6 //* 69 139:ireturn byte0 = 1; // 70 140:iconst_1 // 71 141:istore 5 if(mVelocityTracker != null && mActivePointerId > -1) { mVelocityTracker.computeCurrentVelocity(1000, mCallback.getSwipeVelocityThreshold(mMaxSwipeVelocity)); float f = mVelocityTracker.getXVelocity(mActivePointerId); float f2 = mVelocityTracker.getYVelocity(mActivePointerId); byte byte1; if(f2 > 0.0F) byte1 = 2; else //* 72 143:goto 18 byte1 = 1; // 73 146:iconst_1 // 74 147:istore 6 f2 = Math.abs(f2); if((byte1 & i) != 0 && byte1 == byte0 && f2 >= mCallback.getSwipeEscapeVelocity(mSwipeEscapeVelocity) && f2 > Math.abs(f)) return ((int) (byte1)); } //* 75 149:goto 89 float f1 = mRecyclerView.getHeight(); // 76 152:aload_0 // 77 153:getfield #167 <Field RecyclerView mRecyclerView> // 78 156:invokevirtual #222 <Method int RecyclerView.getHeight()> // 79 159:i2f // 80 160:fstore_3 float f3 = mCallback.getSwipeThreshold(viewholder); // 81 161:aload_0 // 82 162:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 83 165:aload_1 // 84 166:invokevirtual #216 <Method float ItemTouchHelper$Callback.getSwipeThreshold(android.support.v7.widget.RecyclerView$ViewHolder)> // 85 169:fstore 4 if((i & byte0) != 0 && Math.abs(mDy) > f1 * f3) //* 86 171:iload_2 //* 87 172:iload 5 //* 88 174:iand //* 89 175:ifeq 196 //* 90 178:aload_0 //* 91 179:getfield #219 <Field float mDy> //* 92 182:invokestatic #203 <Method float Math.abs(float)> //* 93 185:fload_3 //* 94 186:fload 4 //* 95 188:fmul //* 96 189:fcmpl //* 97 190:ifle 196 return ((int) (byte0)); // 98 193:iload 5 // 99 195:ireturn } return 0; // 100 196:iconst_0 // 101 197:ireturn } private void destroyCallbacks() { mRecyclerView.removeItemDecoration(((android.support.v7.widget.RecyclerView.ItemDecoration) (this))); // 0 0:aload_0 // 1 1:getfield #167 <Field RecyclerView mRecyclerView> // 2 4:aload_0 // 3 5:invokevirtual #227 <Method void RecyclerView.removeItemDecoration(android.support.v7.widget.RecyclerView$ItemDecoration)> mRecyclerView.removeOnItemTouchListener(mOnItemTouchListener); // 4 8:aload_0 // 5 9:getfield #167 <Field RecyclerView mRecyclerView> // 6 12:aload_0 // 7 13:getfield #155 <Field android.support.v7.widget.RecyclerView$OnItemTouchListener mOnItemTouchListener> // 8 16:invokevirtual #231 <Method void RecyclerView.removeOnItemTouchListener(android.support.v7.widget.RecyclerView$OnItemTouchListener)> mRecyclerView.removeOnChildAttachStateChangeListener(((android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener) (this))); // 9 19:aload_0 // 10 20:getfield #167 <Field RecyclerView mRecyclerView> // 11 23:aload_0 // 12 24:invokevirtual #235 <Method void RecyclerView.removeOnChildAttachStateChangeListener(android.support.v7.widget.RecyclerView$OnChildAttachStateChangeListener)> for(int i = mRecoverAnimations.size() - 1; i >= 0; i--) //* 13 27:aload_0 //* 14 28:getfield #141 <Field List mRecoverAnimations> //* 15 31:invokeinterface #240 <Method int List.size()> //* 16 36:iconst_1 //* 17 37:isub //* 18 38:istore_1 //* 19 39:iload_1 //* 20 40:iflt 79 { RecoverAnimation recoveranimation = (RecoverAnimation)mRecoverAnimations.get(0); // 21 43:aload_0 // 22 44:getfield #141 <Field List mRecoverAnimations> // 23 47:iconst_0 // 24 48:invokeinterface #244 <Method Object List.get(int)> // 25 53:checkcast #28 <Class ItemTouchHelper$RecoverAnimation> // 26 56:astore_2 mCallback.clearView(mRecyclerView, recoveranimation.mViewHolder); // 27 57:aload_0 // 28 58:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 29 61:aload_0 // 30 62:getfield #167 <Field RecyclerView mRecyclerView> // 31 65:aload_2 // 32 66:getfield #247 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 33 69:invokevirtual #251 <Method void ItemTouchHelper$Callback.clearView(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> } // 34 72:iload_1 // 35 73:iconst_1 // 36 74:isub // 37 75:istore_1 //* 38 76:goto 39 mRecoverAnimations.clear(); // 39 79:aload_0 // 40 80:getfield #141 <Field List mRecoverAnimations> // 41 83:invokeinterface #254 <Method void List.clear()> mOverdrawChild = null; // 42 88:aload_0 // 43 89:aconst_null // 44 90:putfield #150 <Field View mOverdrawChild> mOverdrawChildPosition = -1; // 45 93:aload_0 // 46 94:iconst_m1 // 47 95:putfield #152 <Field int mOverdrawChildPosition> releaseVelocityTracker(); // 48 98:aload_0 // 49 99:invokespecial #257 <Method void releaseVelocityTracker()> // 50 102:return } private List findSwapTargets(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { int i1; int j1; int k1; int l1; int i2; int j2; View view; int i; int k2; android.support.v7.widget.RecyclerView.LayoutManager layoutmanager; if(mSwapTargets == null) //* 0 0:aload_0 //* 1 1:getfield #261 <Field List mSwapTargets> //* 2 4:ifnonnull 167 { mSwapTargets = ((List) (new ArrayList())); // 3 7:aload_0 // 4 8:new #128 <Class ArrayList> // 5 11:dup // 6 12:invokespecial #129 <Method void ArrayList()> // 7 15:putfield #261 <Field List mSwapTargets> mDistances = ((List) (new ArrayList())); // 8 18:aload_0 // 9 19:new #128 <Class ArrayList> // 10 22:dup // 11 23:invokespecial #129 <Method void ArrayList()> // 12 26:putfield #263 <Field List mDistances> } else //* 13 29:aload_0 //* 14 30:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 15 33:invokevirtual #266 <Method int ItemTouchHelper$Callback.getBoundingBoxMargin()> //* 16 36:istore_2 //* 17 37:aload_0 //* 18 38:getfield #268 <Field float mSelectedStartX> //* 19 41:aload_0 //* 20 42:getfield #177 <Field float mDx> //* 21 45:fadd //* 22 46:invokestatic #272 <Method int Math.round(float)> //* 23 49:iload_2 //* 24 50:isub //* 25 51:istore 5 //* 26 53:aload_0 //* 27 54:getfield #274 <Field float mSelectedStartY> //* 28 57:aload_0 //* 29 58:getfield #219 <Field float mDy> //* 30 61:fadd //* 31 62:invokestatic #272 <Method int Math.round(float)> //* 32 65:iload_2 //* 33 66:isub //* 34 67:istore 6 //* 35 69:aload_1 //* 36 70:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 37 73:invokevirtual #282 <Method int View.getWidth()> //* 38 76:iload 5 //* 39 78:iadd //* 40 79:iload_2 //* 41 80:iconst_2 //* 42 81:imul //* 43 82:iadd //* 44 83:istore 7 //* 45 85:aload_1 //* 46 86:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 47 89:invokevirtual #283 <Method int View.getHeight()> //* 48 92:iload 6 //* 49 94:iadd //* 50 95:iload_2 //* 51 96:iconst_2 //* 52 97:imul //* 53 98:iadd //* 54 99:istore 8 //* 55 101:iload 5 //* 56 103:iload 7 //* 57 105:iadd //* 58 106:iconst_2 //* 59 107:idiv //* 60 108:istore 9 //* 61 110:iload 6 //* 62 112:iload 8 //* 63 114:iadd //* 64 115:iconst_2 //* 65 116:idiv //* 66 117:istore 10 //* 67 119:aload_0 //* 68 120:getfield #167 <Field RecyclerView mRecyclerView> //* 69 123:invokevirtual #287 <Method android.support.v7.widget.RecyclerView$LayoutManager RecyclerView.getLayoutManager()> //* 70 126:astore 14 //* 71 128:aload 14 //* 72 130:invokevirtual #292 <Method int android.support.v7.widget.RecyclerView$LayoutManager.getChildCount()> //* 73 133:istore 11 //* 74 135:iconst_0 //* 75 136:istore_2 //* 76 137:iload_2 //* 77 138:iload 11 //* 78 140:icmpge 399 //* 79 143:aload 14 //* 80 145:iload_2 //* 81 146:invokevirtual #296 <Method View android.support.v7.widget.RecyclerView$LayoutManager.getChildAt(int)> //* 82 149:astore 15 //* 83 151:aload 15 //* 84 153:aload_1 //* 85 154:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 86 157:if_acmpne 188 //* 87 160:iload_2 //* 88 161:iconst_1 //* 89 162:iadd //* 90 163:istore_2 //* 91 164:goto 137 { mSwapTargets.clear(); // 92 167:aload_0 // 93 168:getfield #261 <Field List mSwapTargets> // 94 171:invokeinterface #254 <Method void List.clear()> mDistances.clear(); // 95 176:aload_0 // 96 177:getfield #263 <Field List mDistances> // 97 180:invokeinterface #254 <Method void List.clear()> } i = mCallback.getBoundingBoxMargin(); i1 = Math.round(mSelectedStartX + mDx) - i; j1 = Math.round(mSelectedStartY + mDy) - i; k1 = viewholder.itemView.getWidth() + i1 + i * 2; l1 = viewholder.itemView.getHeight() + j1 + i * 2; i2 = (i1 + k1) / 2; j2 = (j1 + l1) / 2; layoutmanager = mRecyclerView.getLayoutManager(); k2 = layoutmanager.getChildCount(); i = 0; if(i >= k2) break; /* Loop/switch isn't completed */ view = layoutmanager.getChildAt(i); if(view != viewholder.itemView && view.getBottom() >= j1 && view.getTop() <= l1 && view.getRight() >= i1 && view.getLeft() <= k1) //* 98 185:goto 29 //* 99 188:aload 15 //* 100 190:invokevirtual #299 <Method int View.getBottom()> //* 101 193:iload 6 //* 102 195:icmplt 160 //* 103 198:aload 15 //* 104 200:invokevirtual #302 <Method int View.getTop()> //* 105 203:iload 8 //* 106 205:icmpgt 160 //* 107 208:aload 15 //* 108 210:invokevirtual #305 <Method int View.getRight()> //* 109 213:iload 5 //* 110 215:icmplt 160 //* 111 218:aload 15 //* 112 220:invokevirtual #308 <Method int View.getLeft()> //* 113 223:iload 7 //* 114 225:icmpgt 160 { android.support.v7.widget.RecyclerView.ViewHolder viewholder1 = mRecyclerView.getChildViewHolder(view); // 115 228:aload_0 // 116 229:getfield #167 <Field RecyclerView mRecyclerView> // 117 232:aload 15 // 118 234:invokevirtual #312 <Method android.support.v7.widget.RecyclerView$ViewHolder RecyclerView.getChildViewHolder(View)> // 119 237:astore 16 if(mCallback.canDropOver(mRecyclerView, mSelected, viewholder1)) //* 120 239:aload_0 //* 121 240:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 122 243:aload_0 //* 123 244:getfield #167 <Field RecyclerView mRecyclerView> //* 124 247:aload_0 //* 125 248:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 126 251:aload 16 //* 127 253:invokevirtual #316 <Method boolean ItemTouchHelper$Callback.canDropOver(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, android.support.v7.widget.RecyclerView$ViewHolder)> //* 128 256:ifeq 160 { int j = Math.abs(i2 - (view.getLeft() + view.getRight()) / 2); // 129 259:iload 9 // 130 261:aload 15 // 131 263:invokevirtual #308 <Method int View.getLeft()> // 132 266:aload 15 // 133 268:invokevirtual #305 <Method int View.getRight()> // 134 271:iadd // 135 272:iconst_2 // 136 273:idiv // 137 274:isub // 138 275:invokestatic #319 <Method int Math.abs(int)> // 139 278:istore_3 int l = Math.abs(j2 - (view.getTop() + view.getBottom()) / 2); // 140 279:iload 10 // 141 281:aload 15 // 142 283:invokevirtual #302 <Method int View.getTop()> // 143 286:aload 15 // 144 288:invokevirtual #299 <Method int View.getBottom()> // 145 291:iadd // 146 292:iconst_2 // 147 293:idiv // 148 294:isub // 149 295:invokestatic #319 <Method int Math.abs(int)> // 150 298:istore 4 int l2 = j * j + l * l; // 151 300:iload_3 // 152 301:iload_3 // 153 302:imul // 154 303:iload 4 // 155 305:iload 4 // 156 307:imul // 157 308:iadd // 158 309:istore 12 l = 0; // 159 311:iconst_0 // 160 312:istore 4 int i3 = mSwapTargets.size(); // 161 314:aload_0 // 162 315:getfield #261 <Field List mSwapTargets> // 163 318:invokeinterface #240 <Method int List.size()> // 164 323:istore 13 for(int k = 0; k < i3 && l2 > ((Integer)mDistances.get(k)).intValue(); k++) //* 165 325:iconst_0 //* 166 326:istore_3 //* 167 327:iload_3 //* 168 328:iload 13 //* 169 330:icmpge 367 //* 170 333:iload 12 //* 171 335:aload_0 //* 172 336:getfield #263 <Field List mDistances> //* 173 339:iload_3 //* 174 340:invokeinterface #244 <Method Object List.get(int)> //* 175 345:checkcast #321 <Class Integer> //* 176 348:invokevirtual #324 <Method int Integer.intValue()> //* 177 351:icmple 367 l++; // 178 354:iload 4 // 179 356:iconst_1 // 180 357:iadd // 181 358:istore 4 // 182 360:iload_3 // 183 361:iconst_1 // 184 362:iadd // 185 363:istore_3 //* 186 364:goto 327 mSwapTargets.add(l, ((Object) (viewholder1))); // 187 367:aload_0 // 188 368:getfield #261 <Field List mSwapTargets> // 189 371:iload 4 // 190 373:aload 16 // 191 375:invokeinterface #328 <Method void List.add(int, Object)> mDistances.add(l, ((Object) (Integer.valueOf(l2)))); // 192 380:aload_0 // 193 381:getfield #263 <Field List mDistances> // 194 384:iload 4 // 195 386:iload 12 // 196 388:invokestatic #332 <Method Integer Integer.valueOf(int)> // 197 391:invokeinterface #328 <Method void List.add(int, Object)> } } i++; if(true) goto _L2; else goto _L1 _L2: break MISSING_BLOCK_LABEL_137; //* 198 396:goto 160 _L1: return mSwapTargets; // 199 399:aload_0 // 200 400:getfield #261 <Field List mSwapTargets> // 201 403:areturn } private android.support.v7.widget.RecyclerView.ViewHolder findSwipedView(MotionEvent motionevent) { android.support.v7.widget.RecyclerView.LayoutManager layoutmanager = mRecyclerView.getLayoutManager(); // 0 0:aload_0 // 1 1:getfield #167 <Field RecyclerView mRecyclerView> // 2 4:invokevirtual #287 <Method android.support.v7.widget.RecyclerView$LayoutManager RecyclerView.getLayoutManager()> // 3 7:astore 7 if(mActivePointerId != -1) //* 4 9:aload_0 //* 5 10:getfield #137 <Field int mActivePointerId> //* 6 13:iconst_m1 //* 7 14:icmpne 19 //* 8 17:aconst_null //* 9 18:areturn { int i = motionevent.findPointerIndex(mActivePointerId); // 10 19:aload_1 // 11 20:aload_0 // 12 21:getfield #137 <Field int mActivePointerId> // 13 24:invokevirtual #341 <Method int MotionEvent.findPointerIndex(int)> // 14 27:istore 6 float f2 = motionevent.getX(i); // 15 29:aload_1 // 16 30:iload 6 // 17 32:invokevirtual #344 <Method float MotionEvent.getX(int)> // 18 35:fstore 4 float f3 = mInitialTouchX; // 19 37:aload_0 // 20 38:getfield #346 <Field float mInitialTouchX> // 21 41:fstore 5 float f = motionevent.getY(i); // 22 43:aload_1 // 23 44:iload 6 // 24 46:invokevirtual #349 <Method float MotionEvent.getY(int)> // 25 49:fstore_2 float f1 = mInitialTouchY; // 26 50:aload_0 // 27 51:getfield #351 <Field float mInitialTouchY> // 28 54:fstore_3 f2 = Math.abs(f2 - f3); // 29 55:fload 4 // 30 57:fload 5 // 31 59:fsub // 32 60:invokestatic #203 <Method float Math.abs(float)> // 33 63:fstore 4 f = Math.abs(f - f1); // 34 65:fload_2 // 35 66:fload_3 // 36 67:fsub // 37 68:invokestatic #203 <Method float Math.abs(float)> // 38 71:fstore_2 if((f2 >= (float)mSlop || f >= (float)mSlop) && (f2 <= f || !layoutmanager.canScrollHorizontally()) && (f <= f2 || !layoutmanager.canScrollVertically())) //* 39 72:fload 4 //* 40 74:aload_0 //* 41 75:getfield #353 <Field int mSlop> //* 42 78:i2f //* 43 79:fcmpg //* 44 80:ifge 93 //* 45 83:fload_2 //* 46 84:aload_0 //* 47 85:getfield #353 <Field int mSlop> //* 48 88:i2f //* 49 89:fcmpg //* 50 90:iflt 17 //* 51 93:fload 4 //* 52 95:fload_2 //* 53 96:fcmpl //* 54 97:ifle 108 //* 55 100:aload 7 //* 56 102:invokevirtual #357 <Method boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollHorizontally()> //* 57 105:ifne 17 //* 58 108:fload_2 //* 59 109:fload 4 //* 60 111:fcmpl //* 61 112:ifle 123 //* 62 115:aload 7 //* 63 117:invokevirtual #360 <Method boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollVertically()> //* 64 120:ifne 17 { motionevent = ((MotionEvent) (findChildView(motionevent))); // 65 123:aload_0 // 66 124:aload_1 // 67 125:invokevirtual #364 <Method View findChildView(MotionEvent)> // 68 128:astore_1 if(motionevent != null) //* 69 129:aload_1 //* 70 130:ifnull 17 return mRecyclerView.getChildViewHolder(((View) (motionevent))); // 71 133:aload_0 // 72 134:getfield #167 <Field RecyclerView mRecyclerView> // 73 137:aload_1 // 74 138:invokevirtual #312 <Method android.support.v7.widget.RecyclerView$ViewHolder RecyclerView.getChildViewHolder(View)> // 75 141:areturn } } return null; } private void getSelectedDxDy(float af[]) { if((mSelectedFlags & 0xc) != 0) //* 0 0:aload_0 //* 1 1:getfield #368 <Field int mSelectedFlags> //* 2 4:bipush 12 //* 3 6:iand //* 4 7:ifeq 68 af[0] = (mSelectedStartX + mDx) - (float)mSelected.itemView.getLeft(); // 5 10:aload_1 // 6 11:iconst_0 // 7 12:aload_0 // 8 13:getfield #268 <Field float mSelectedStartX> // 9 16:aload_0 // 10 17:getfield #177 <Field float mDx> // 11 20:fadd // 12 21:aload_0 // 13 22:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 14 25:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 15 28:invokevirtual #308 <Method int View.getLeft()> // 16 31:i2f // 17 32:fsub // 18 33:fastore else //* 19 34:aload_0 //* 20 35:getfield #368 <Field int mSelectedFlags> //* 21 38:iconst_3 //* 22 39:iand //* 23 40:ifeq 84 //* 24 43:aload_1 //* 25 44:iconst_1 //* 26 45:aload_0 //* 27 46:getfield #274 <Field float mSelectedStartY> //* 28 49:aload_0 //* 29 50:getfield #219 <Field float mDy> //* 30 53:fadd //* 31 54:aload_0 //* 32 55:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 33 58:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 34 61:invokevirtual #302 <Method int View.getTop()> //* 35 64:i2f //* 36 65:fsub //* 37 66:fastore //* 38 67:return af[0] = mSelected.itemView.getTranslationX(); // 39 68:aload_1 // 40 69:iconst_0 // 41 70:aload_0 // 42 71:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 43 74:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 44 77:invokevirtual #372 <Method float View.getTranslationX()> // 45 80:fastore if((mSelectedFlags & 3) != 0) { af[1] = (mSelectedStartY + mDy) - (float)mSelected.itemView.getTop(); return; } else //* 46 81:goto 34 { af[1] = mSelected.itemView.getTranslationY(); // 47 84:aload_1 // 48 85:iconst_1 // 49 86:aload_0 // 50 87:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 51 90:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 52 93:invokevirtual #375 <Method float View.getTranslationY()> // 53 96:fastore return; // 54 97:return } } private static boolean hitTest(View view, float f, float f1, float f2, float f3) { return f >= f2 && f <= (float)view.getWidth() + f2 && f1 >= f3 && f1 <= (float)view.getHeight() + f3; // 0 0:fload_1 // 1 1:fload_3 // 2 2:fcmpl // 3 3:iflt 40 // 4 6:fload_1 // 5 7:aload_0 // 6 8:invokevirtual #282 <Method int View.getWidth()> // 7 11:i2f // 8 12:fload_3 // 9 13:fadd // 10 14:fcmpg // 11 15:ifgt 40 // 12 18:fload_2 // 13 19:fload 4 // 14 21:fcmpl // 15 22:iflt 40 // 16 25:fload_2 // 17 26:aload_0 // 18 27:invokevirtual #283 <Method int View.getHeight()> // 19 30:i2f // 20 31:fload 4 // 21 33:fadd // 22 34:fcmpg // 23 35:ifgt 40 // 24 38:iconst_1 // 25 39:ireturn // 26 40:iconst_0 // 27 41:ireturn } private void initGestureDetector() { if(mGestureDetector != null) //* 0 0:aload_0 //* 1 1:getfield #380 <Field GestureDetectorCompat mGestureDetector> //* 2 4:ifnull 8 { return; // 3 7:return } else { mGestureDetector = new GestureDetectorCompat(mRecyclerView.getContext(), ((android.view.GestureDetector.OnGestureListener) (new ItemTouchHelperGestureListener()))); // 4 8:aload_0 // 5 9:new #382 <Class GestureDetectorCompat> // 6 12:dup // 7 13:aload_0 // 8 14:getfield #167 <Field RecyclerView mRecyclerView> // 9 17:invokevirtual #386 <Method android.content.Context RecyclerView.getContext()> // 10 20:new #25 <Class ItemTouchHelper$ItemTouchHelperGestureListener> // 11 23:dup // 12 24:aload_0 // 13 25:invokespecial #387 <Method void ItemTouchHelper$ItemTouchHelperGestureListener(ItemTouchHelper)> // 14 28:invokespecial #390 <Method void GestureDetectorCompat(android.content.Context, android.view.GestureDetector$OnGestureListener)> // 15 31:putfield #380 <Field GestureDetectorCompat mGestureDetector> return; // 16 34:return } } private void releaseVelocityTracker() { if(mVelocityTracker != null) //* 0 0:aload_0 //* 1 1:getfield #179 <Field VelocityTracker mVelocityTracker> //* 2 4:ifnull 19 { mVelocityTracker.recycle(); // 3 7:aload_0 // 4 8:getfield #179 <Field VelocityTracker mVelocityTracker> // 5 11:invokevirtual #393 <Method void VelocityTracker.recycle()> mVelocityTracker = null; // 6 14:aload_0 // 7 15:aconst_null // 8 16:putfield #179 <Field VelocityTracker mVelocityTracker> } // 9 19:return } private void setupCallbacks() { mSlop = ViewConfiguration.get(mRecyclerView.getContext()).getScaledTouchSlop(); // 0 0:aload_0 // 1 1:aload_0 // 2 2:getfield #167 <Field RecyclerView mRecyclerView> // 3 5:invokevirtual #386 <Method android.content.Context RecyclerView.getContext()> // 4 8:invokestatic #399 <Method ViewConfiguration ViewConfiguration.get(android.content.Context)> // 5 11:invokevirtual #402 <Method int ViewConfiguration.getScaledTouchSlop()> // 6 14:putfield #353 <Field int mSlop> mRecyclerView.addItemDecoration(((android.support.v7.widget.RecyclerView.ItemDecoration) (this))); // 7 17:aload_0 // 8 18:getfield #167 <Field RecyclerView mRecyclerView> // 9 21:aload_0 // 10 22:invokevirtual #405 <Method void RecyclerView.addItemDecoration(android.support.v7.widget.RecyclerView$ItemDecoration)> mRecyclerView.addOnItemTouchListener(mOnItemTouchListener); // 11 25:aload_0 // 12 26:getfield #167 <Field RecyclerView mRecyclerView> // 13 29:aload_0 // 14 30:getfield #155 <Field android.support.v7.widget.RecyclerView$OnItemTouchListener mOnItemTouchListener> // 15 33:invokevirtual #408 <Method void RecyclerView.addOnItemTouchListener(android.support.v7.widget.RecyclerView$OnItemTouchListener)> mRecyclerView.addOnChildAttachStateChangeListener(((android.support.v7.widget.RecyclerView.OnChildAttachStateChangeListener) (this))); // 16 36:aload_0 // 17 37:getfield #167 <Field RecyclerView mRecyclerView> // 18 40:aload_0 // 19 41:invokevirtual #411 <Method void RecyclerView.addOnChildAttachStateChangeListener(android.support.v7.widget.RecyclerView$OnChildAttachStateChangeListener)> initGestureDetector(); // 20 44:aload_0 // 21 45:invokespecial #413 <Method void initGestureDetector()> // 22 48:return } private int swipeIfNecessary(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { if(mActionState != 2) goto _L2; else goto _L1 // 0 0:aload_0 // 1 1:getfield #139 <Field int mActionState> // 2 4:iconst_2 // 3 5:icmpne 12 _L1: int i = 0; // 4 8:iconst_0 // 5 9:istore_2 _L8: return i; // 6 10:iload_2 // 7 11:ireturn _L2: int l; int i1; i = mCallback.getMovementFlags(mRecyclerView, viewholder); // 8 12:aload_0 // 9 13:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 10 16:aload_0 // 11 17:getfield #167 <Field RecyclerView mRecyclerView> // 12 20:aload_1 // 13 21:invokevirtual #419 <Method int ItemTouchHelper$Callback.getMovementFlags(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 14 24:istore_2 l = (mCallback.convertToAbsoluteDirection(i, ViewCompat.getLayoutDirection(((View) (mRecyclerView)))) & 0xff00) >> 8; // 15 25:aload_0 // 16 26:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 17 29:iload_2 // 18 30:aload_0 // 19 31:getfield #167 <Field RecyclerView mRecyclerView> // 20 34:invokestatic #425 <Method int ViewCompat.getLayoutDirection(View)> // 21 37:invokevirtual #429 <Method int ItemTouchHelper$Callback.convertToAbsoluteDirection(int, int)> // 22 40:ldc1 #44 <Int 65280> // 23 42:iand // 24 43:bipush 8 // 25 45:ishr // 26 46:istore 4 if(l == 0) //* 27 48:iload 4 //* 28 50:ifne 55 return 0; // 29 53:iconst_0 // 30 54:ireturn i1 = (i & 0xff00) >> 8; // 31 55:iload_2 // 32 56:ldc1 #44 <Int 65280> // 33 58:iand // 34 59:bipush 8 // 35 61:ishr // 36 62:istore 5 if(Math.abs(mDx) <= Math.abs(mDy)) goto _L4; else goto _L3 // 37 64:aload_0 // 38 65:getfield #177 <Field float mDx> // 39 68:invokestatic #203 <Method float Math.abs(float)> // 40 71:aload_0 // 41 72:getfield #219 <Field float mDy> // 42 75:invokestatic #203 <Method float Math.abs(float)> // 43 78:fcmpl // 44 79:ifle 131 _L3: int j = checkHorizontalSwipe(viewholder, l); // 45 82:aload_0 // 46 83:aload_1 // 47 84:iload 4 // 48 86:invokespecial #431 <Method int checkHorizontalSwipe(android.support.v7.widget.RecyclerView$ViewHolder, int)> // 49 89:istore_3 if(j > 0) //* 50 90:iload_3 //* 51 91:ifle 115 { i = j; // 52 94:iload_3 // 53 95:istore_2 if((i1 & j) == 0) //* 54 96:iload 5 //* 55 98:iload_3 //* 56 99:iand //* 57 100:ifne 10 return Callback.convertToRelativeDirection(j, ViewCompat.getLayoutDirection(((View) (mRecyclerView)))); // 58 103:iload_3 // 59 104:aload_0 // 60 105:getfield #167 <Field RecyclerView mRecyclerView> // 61 108:invokestatic #425 <Method int ViewCompat.getLayoutDirection(View)> // 62 111:invokestatic #434 <Method int ItemTouchHelper$Callback.convertToRelativeDirection(int, int)> // 63 114:ireturn continue; /* Loop/switch isn't completed */ } j = checkVerticalSwipe(viewholder, l); // 64 115:aload_0 // 65 116:aload_1 // 66 117:iload 4 // 67 119:invokespecial #436 <Method int checkVerticalSwipe(android.support.v7.widget.RecyclerView$ViewHolder, int)> // 68 122:istore_3 i = j; // 69 123:iload_3 // 70 124:istore_2 if(j > 0) continue; /* Loop/switch isn't completed */ // 71 125:iload_3 // 72 126:ifgt 10 _L6: return 0; // 73 129:iconst_0 // 74 130:ireturn _L4: int k; k = checkVerticalSwipe(viewholder, l); // 75 131:aload_0 // 76 132:aload_1 // 77 133:iload 4 // 78 135:invokespecial #436 <Method int checkVerticalSwipe(android.support.v7.widget.RecyclerView$ViewHolder, int)> // 79 138:istore_3 i = k; // 80 139:iload_3 // 81 140:istore_2 if(k > 0) continue; /* Loop/switch isn't completed */ // 82 141:iload_3 // 83 142:ifgt 10 k = checkHorizontalSwipe(viewholder, l); // 84 145:aload_0 // 85 146:aload_1 // 86 147:iload 4 // 87 149:invokespecial #431 <Method int checkHorizontalSwipe(android.support.v7.widget.RecyclerView$ViewHolder, int)> // 88 152:istore_3 if(k <= 0) goto _L6; else goto _L5 // 89 153:iload_3 // 90 154:ifle 129 _L5: i = k; // 91 157:iload_3 // 92 158:istore_2 if((i1 & k) == 0) //* 93 159:iload 5 //* 94 161:iload_3 //* 95 162:iand //* 96 163:ifne 10 return Callback.convertToRelativeDirection(k, ViewCompat.getLayoutDirection(((View) (mRecyclerView)))); // 97 166:iload_3 // 98 167:aload_0 // 99 168:getfield #167 <Field RecyclerView mRecyclerView> // 100 171:invokestatic #425 <Method int ViewCompat.getLayoutDirection(View)> // 101 174:invokestatic #434 <Method int ItemTouchHelper$Callback.convertToRelativeDirection(int, int)> // 102 177:ireturn if(true) goto _L8; else goto _L7 _L7: } public void attachToRecyclerView(RecyclerView recyclerview) { if(mRecyclerView != recyclerview) //* 0 0:aload_0 //* 1 1:getfield #167 <Field RecyclerView mRecyclerView> //* 2 4:aload_1 //* 3 5:if_acmpne 9 //* 4 8:return { if(mRecyclerView != null) //* 5 9:aload_0 //* 6 10:getfield #167 <Field RecyclerView mRecyclerView> //* 7 13:ifnull 20 destroyCallbacks(); // 8 16:aload_0 // 9 17:invokespecial #441 <Method void destroyCallbacks()> mRecyclerView = recyclerview; // 10 20:aload_0 // 11 21:aload_1 // 12 22:putfield #167 <Field RecyclerView mRecyclerView> if(mRecyclerView != null) //* 13 25:aload_0 //* 14 26:getfield #167 <Field RecyclerView mRecyclerView> //* 15 29:ifnull 8 { recyclerview = ((RecyclerView) (recyclerview.getResources())); // 16 32:aload_1 // 17 33:invokevirtual #445 <Method Resources RecyclerView.getResources()> // 18 36:astore_1 mSwipeEscapeVelocity = ((Resources) (recyclerview)).getDimension(android.support.v7.recyclerview.R.dimen.item_touch_helper_swipe_escape_velocity); // 19 37:aload_0 // 20 38:aload_1 // 21 39:getstatic #450 <Field int android.support.v7.recyclerview.R$dimen.item_touch_helper_swipe_escape_velocity> // 22 42:invokevirtual #455 <Method float Resources.getDimension(int)> // 23 45:putfield #205 <Field float mSwipeEscapeVelocity> mMaxSwipeVelocity = ((Resources) (recyclerview)).getDimension(android.support.v7.recyclerview.R.dimen.item_touch_helper_swipe_escape_max_velocity); // 24 48:aload_0 // 25 49:aload_1 // 26 50:getstatic #458 <Field int android.support.v7.recyclerview.R$dimen.item_touch_helper_swipe_escape_max_velocity> // 27 53:invokevirtual #455 <Method float Resources.getDimension(int)> // 28 56:putfield #181 <Field float mMaxSwipeVelocity> setupCallbacks(); // 29 59:aload_0 // 30 60:invokespecial #460 <Method void setupCallbacks()> return; // 31 63:return } } } boolean checkSelectForSwipe(int i, MotionEvent motionevent, int j) { if(mSelected != null || i != 2 || mActionState == 2 || !mCallback.isItemViewSwipeEnabled()) //* 0 0:aload_0 //* 1 1:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 2 4:ifnonnull 30 //* 3 7:iload_1 //* 4 8:iconst_2 //* 5 9:icmpne 30 //* 6 12:aload_0 //* 7 13:getfield #139 <Field int mActionState> //* 8 16:iconst_2 //* 9 17:icmpeq 30 //* 10 20:aload_0 //* 11 21:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 12 24:invokevirtual #466 <Method boolean ItemTouchHelper$Callback.isItemViewSwipeEnabled()> //* 13 27:ifne 32 return false; // 14 30:iconst_0 // 15 31:ireturn if(mRecyclerView.getScrollState() == 1) //* 16 32:aload_0 //* 17 33:getfield #167 <Field RecyclerView mRecyclerView> //* 18 36:invokevirtual #469 <Method int RecyclerView.getScrollState()> //* 19 39:iconst_1 //* 20 40:icmpne 45 return false; // 21 43:iconst_0 // 22 44:ireturn android.support.v7.widget.RecyclerView.ViewHolder viewholder = findSwipedView(motionevent); // 23 45:aload_0 // 24 46:aload_2 // 25 47:invokespecial #471 <Method android.support.v7.widget.RecyclerView$ViewHolder findSwipedView(MotionEvent)> // 26 50:astore 8 if(viewholder == null) //* 27 52:aload 8 //* 28 54:ifnonnull 59 return false; // 29 57:iconst_0 // 30 58:ireturn i = (0xff00 & mCallback.getAbsoluteMovementFlags(mRecyclerView, viewholder)) >> 8; // 31 59:ldc1 #44 <Int 65280> // 32 61:aload_0 // 33 62:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 34 65:aload_0 // 35 66:getfield #167 <Field RecyclerView mRecyclerView> // 36 69:aload 8 // 37 71:invokevirtual #474 <Method int ItemTouchHelper$Callback.getAbsoluteMovementFlags(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> // 38 74:iand // 39 75:bipush 8 // 40 77:ishr // 41 78:istore_1 if(i == 0) //* 42 79:iload_1 //* 43 80:ifne 85 return false; // 44 83:iconst_0 // 45 84:ireturn float f = motionevent.getX(j); // 46 85:aload_2 // 47 86:iload_3 // 48 87:invokevirtual #344 <Method float MotionEvent.getX(int)> // 49 90:fstore 4 float f1 = motionevent.getY(j); // 50 92:aload_2 // 51 93:iload_3 // 52 94:invokevirtual #349 <Method float MotionEvent.getY(int)> // 53 97:fstore 5 f -= mInitialTouchX; // 54 99:fload 4 // 55 101:aload_0 // 56 102:getfield #346 <Field float mInitialTouchX> // 57 105:fsub // 58 106:fstore 4 f1 -= mInitialTouchY; // 59 108:fload 5 // 60 110:aload_0 // 61 111:getfield #351 <Field float mInitialTouchY> // 62 114:fsub // 63 115:fstore 5 float f2 = Math.abs(f); // 64 117:fload 4 // 65 119:invokestatic #203 <Method float Math.abs(float)> // 66 122:fstore 6 float f3 = Math.abs(f1); // 67 124:fload 5 // 68 126:invokestatic #203 <Method float Math.abs(float)> // 69 129:fstore 7 if(f2 < (float)mSlop && f3 < (float)mSlop) //* 70 131:fload 6 //* 71 133:aload_0 //* 72 134:getfield #353 <Field int mSlop> //* 73 137:i2f //* 74 138:fcmpg //* 75 139:ifge 155 //* 76 142:fload 7 //* 77 144:aload_0 //* 78 145:getfield #353 <Field int mSlop> //* 79 148:i2f //* 80 149:fcmpg //* 81 150:ifge 155 return false; // 82 153:iconst_0 // 83 154:ireturn if(f2 > f3) //* 84 155:fload 6 //* 85 157:fload 7 //* 86 159:fcmpl //* 87 160:ifle 194 { if(f < 0.0F && (i & 4) == 0) //* 88 163:fload 4 //* 89 165:fconst_0 //* 90 166:fcmpg //* 91 167:ifge 178 //* 92 170:iload_1 //* 93 171:iconst_4 //* 94 172:iand //* 95 173:ifne 178 return false; // 96 176:iconst_0 // 97 177:ireturn if(f > 0.0F && (i & 8) == 0) //* 98 178:fload 4 //* 99 180:fconst_0 //* 100 181:fcmpl //* 101 182:ifle 224 //* 102 185:iload_1 //* 103 186:bipush 8 //* 104 188:iand //* 105 189:ifne 224 return false; // 106 192:iconst_0 // 107 193:ireturn } else { if(f1 < 0.0F && (i & 1) == 0) //* 108 194:fload 5 //* 109 196:fconst_0 //* 110 197:fcmpg //* 111 198:ifge 209 //* 112 201:iload_1 //* 113 202:iconst_1 //* 114 203:iand //* 115 204:ifne 209 return false; // 116 207:iconst_0 // 117 208:ireturn if(f1 > 0.0F && (i & 2) == 0) //* 118 209:fload 5 //* 119 211:fconst_0 //* 120 212:fcmpl //* 121 213:ifle 224 //* 122 216:iload_1 //* 123 217:iconst_2 //* 124 218:iand //* 125 219:ifne 224 return false; // 126 222:iconst_0 // 127 223:ireturn } mDy = 0.0F; // 128 224:aload_0 // 129 225:fconst_0 // 130 226:putfield #219 <Field float mDy> mDx = 0.0F; // 131 229:aload_0 // 132 230:fconst_0 // 133 231:putfield #177 <Field float mDx> mActivePointerId = motionevent.getPointerId(0); // 134 234:aload_0 // 135 235:aload_2 // 136 236:iconst_0 // 137 237:invokevirtual #477 <Method int MotionEvent.getPointerId(int)> // 138 240:putfield #137 <Field int mActivePointerId> select(viewholder, 1); // 139 243:aload_0 // 140 244:aload 8 // 141 246:iconst_1 // 142 247:invokevirtual #481 <Method void select(android.support.v7.widget.RecyclerView$ViewHolder, int)> return true; // 143 250:iconst_1 // 144 251:ireturn } int endRecoverAnimation(android.support.v7.widget.RecyclerView.ViewHolder viewholder, boolean flag) { for(int i = mRecoverAnimations.size() - 1; i >= 0; i--) //* 0 0:aload_0 //* 1 1:getfield #141 <Field List mRecoverAnimations> //* 2 4:invokeinterface #240 <Method int List.size()> //* 3 9:iconst_1 //* 4 10:isub //* 5 11:istore_3 //* 6 12:iload_3 //* 7 13:iflt 89 { RecoverAnimation recoveranimation = (RecoverAnimation)mRecoverAnimations.get(i); // 8 16:aload_0 // 9 17:getfield #141 <Field List mRecoverAnimations> // 10 20:iload_3 // 11 21:invokeinterface #244 <Method Object List.get(int)> // 12 26:checkcast #28 <Class ItemTouchHelper$RecoverAnimation> // 13 29:astore 4 if(recoveranimation.mViewHolder == viewholder) //* 14 31:aload 4 //* 15 33:getfield #247 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> //* 16 36:aload_1 //* 17 37:if_acmpne 82 { recoveranimation.mOverridden = recoveranimation.mOverridden | flag; // 18 40:aload 4 // 19 42:aload 4 // 20 44:getfield #486 <Field boolean ItemTouchHelper$RecoverAnimation.mOverridden> // 21 47:iload_2 // 22 48:ior // 23 49:putfield #486 <Field boolean ItemTouchHelper$RecoverAnimation.mOverridden> if(!recoveranimation.mEnded) //* 24 52:aload 4 //* 25 54:getfield #489 <Field boolean ItemTouchHelper$RecoverAnimation.mEnded> //* 26 57:ifne 65 recoveranimation.cancel(); // 27 60:aload 4 // 28 62:invokevirtual #492 <Method void ItemTouchHelper$RecoverAnimation.cancel()> mRecoverAnimations.remove(i); // 29 65:aload_0 // 30 66:getfield #141 <Field List mRecoverAnimations> // 31 69:iload_3 // 32 70:invokeinterface #495 <Method Object List.remove(int)> // 33 75:pop return recoveranimation.mAnimationType; // 34 76:aload 4 // 35 78:getfield #498 <Field int ItemTouchHelper$RecoverAnimation.mAnimationType> // 36 81:ireturn } } // 37 82:iload_3 // 38 83:iconst_1 // 39 84:isub // 40 85:istore_3 //* 41 86:goto 12 return 0; // 42 89:iconst_0 // 43 90:ireturn } RecoverAnimation findAnimation(MotionEvent motionevent) { if(!mRecoverAnimations.isEmpty()) goto _L2; else goto _L1 // 0 0:aload_0 // 1 1:getfield #141 <Field List mRecoverAnimations> // 2 4:invokeinterface #503 <Method boolean List.isEmpty()> // 3 9:ifeq 16 _L1: motionevent = null; // 4 12:aconst_null // 5 13:astore_1 _L4: return ((RecoverAnimation) (motionevent)); // 6 14:aload_1 // 7 15:areturn _L2: View view = findChildView(motionevent); // 8 16:aload_0 // 9 17:aload_1 // 10 18:invokevirtual #364 <Method View findChildView(MotionEvent)> // 11 21:astore 4 int i = mRecoverAnimations.size() - 1; // 12 23:aload_0 // 13 24:getfield #141 <Field List mRecoverAnimations> // 14 27:invokeinterface #240 <Method int List.size()> // 15 32:iconst_1 // 16 33:isub // 17 34:istore_2 label0: do { label1: { if(i < 0) break label1; // 18 35:iload_2 // 19 36:iflt 74 RecoverAnimation recoveranimation = (RecoverAnimation)mRecoverAnimations.get(i); // 20 39:aload_0 // 21 40:getfield #141 <Field List mRecoverAnimations> // 22 43:iload_2 // 23 44:invokeinterface #244 <Method Object List.get(int)> // 24 49:checkcast #28 <Class ItemTouchHelper$RecoverAnimation> // 25 52:astore_3 motionevent = ((MotionEvent) (recoveranimation)); // 26 53:aload_3 // 27 54:astore_1 if(recoveranimation.mViewHolder.itemView == view) break label0; // 28 55:aload_3 // 29 56:getfield #247 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 30 59:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 31 62:aload 4 // 32 64:if_acmpeq 14 i--; // 33 67:iload_2 // 34 68:iconst_1 // 35 69:isub // 36 70:istore_2 } } while(true); // 37 71:goto 35 if(true) goto _L4; else goto _L3 _L3: return null; // 38 74:aconst_null // 39 75:areturn } View findChildView(MotionEvent motionevent) { float f = motionevent.getX(); // 0 0:aload_1 // 1 1:invokevirtual #505 <Method float MotionEvent.getX()> // 2 4:fstore_2 float f1 = motionevent.getY(); // 3 5:aload_1 // 4 6:invokevirtual #507 <Method float MotionEvent.getY()> // 5 9:fstore_3 if(mSelected != null) //* 6 10:aload_0 //* 7 11:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 8 14:ifnull 54 { motionevent = ((MotionEvent) (mSelected.itemView)); // 9 17:aload_0 // 10 18:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 11 21:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 12 24:astore_1 if(hitTest(((View) (motionevent)), f, f1, mSelectedStartX + mDx, mSelectedStartY + mDy)) //* 13 25:aload_1 //* 14 26:fload_2 //* 15 27:fload_3 //* 16 28:aload_0 //* 17 29:getfield #268 <Field float mSelectedStartX> //* 18 32:aload_0 //* 19 33:getfield #177 <Field float mDx> //* 20 36:fadd //* 21 37:aload_0 //* 22 38:getfield #274 <Field float mSelectedStartY> //* 23 41:aload_0 //* 24 42:getfield #219 <Field float mDy> //* 25 45:fadd //* 26 46:invokestatic #509 <Method boolean hitTest(View, float, float, float, float)> //* 27 49:ifeq 54 return ((View) (motionevent)); // 28 52:aload_1 // 29 53:areturn } for(int i = mRecoverAnimations.size() - 1; i >= 0; i--) //* 30 54:aload_0 //* 31 55:getfield #141 <Field List mRecoverAnimations> //* 32 58:invokeinterface #240 <Method int List.size()> //* 33 63:iconst_1 //* 34 64:isub //* 35 65:istore 4 //* 36 67:iload 4 //* 37 69:iflt 126 { motionevent = ((MotionEvent) ((RecoverAnimation)mRecoverAnimations.get(i))); // 38 72:aload_0 // 39 73:getfield #141 <Field List mRecoverAnimations> // 40 76:iload 4 // 41 78:invokeinterface #244 <Method Object List.get(int)> // 42 83:checkcast #28 <Class ItemTouchHelper$RecoverAnimation> // 43 86:astore_1 View view = ((RecoverAnimation) (motionevent)).mViewHolder.itemView; // 44 87:aload_1 // 45 88:getfield #247 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 46 91:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 47 94:astore 5 if(hitTest(view, f, f1, ((RecoverAnimation) (motionevent)).mX, ((RecoverAnimation) (motionevent)).mY)) //* 48 96:aload 5 //* 49 98:fload_2 //* 50 99:fload_3 //* 51 100:aload_1 //* 52 101:getfield #512 <Field float ItemTouchHelper$RecoverAnimation.mX> //* 53 104:aload_1 //* 54 105:getfield #515 <Field float ItemTouchHelper$RecoverAnimation.mY> //* 55 108:invokestatic #509 <Method boolean hitTest(View, float, float, float, float)> //* 56 111:ifeq 117 return view; // 57 114:aload 5 // 58 116:areturn } // 59 117:iload 4 // 60 119:iconst_1 // 61 120:isub // 62 121:istore 4 //* 63 123:goto 67 return mRecyclerView.findChildViewUnder(f, f1); // 64 126:aload_0 // 65 127:getfield #167 <Field RecyclerView mRecyclerView> // 66 130:fload_2 // 67 131:fload_3 // 68 132:invokevirtual #519 <Method View RecyclerView.findChildViewUnder(float, float)> // 69 135:areturn } public void getItemOffsets(Rect rect, View view, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.State state) { rect.setEmpty(); // 0 0:aload_1 // 1 1:invokevirtual #526 <Method void Rect.setEmpty()> // 2 4:return } boolean hasRunningRecoverAnim() { int j = mRecoverAnimations.size(); // 0 0:aload_0 // 1 1:getfield #141 <Field List mRecoverAnimations> // 2 4:invokeinterface #240 <Method int List.size()> // 3 9:istore_2 for(int i = 0; i < j; i++) //* 4 10:iconst_0 //* 5 11:istore_1 //* 6 12:iload_1 //* 7 13:iload_2 //* 8 14:icmpge 45 if(!((RecoverAnimation)mRecoverAnimations.get(i)).mEnded) //* 9 17:aload_0 //* 10 18:getfield #141 <Field List mRecoverAnimations> //* 11 21:iload_1 //* 12 22:invokeinterface #244 <Method Object List.get(int)> //* 13 27:checkcast #28 <Class ItemTouchHelper$RecoverAnimation> //* 14 30:getfield #489 <Field boolean ItemTouchHelper$RecoverAnimation.mEnded> //* 15 33:ifne 38 return true; // 16 36:iconst_1 // 17 37:ireturn // 18 38:iload_1 // 19 39:iconst_1 // 20 40:iadd // 21 41:istore_1 //* 22 42:goto 12 return false; // 23 45:iconst_0 // 24 46:ireturn } void moveIfNecessary(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { if(!mRecyclerView.isLayoutRequested() && mActionState == 2) //* 0 0:aload_0 //* 1 1:getfield #167 <Field RecyclerView mRecyclerView> //* 2 4:invokevirtual #532 <Method boolean RecyclerView.isLayoutRequested()> //* 3 7:ifeq 11 //* 4 10:return //* 5 11:aload_0 //* 6 12:getfield #139 <Field int mActionState> //* 7 15:iconst_2 //* 8 16:icmpne 10 { float f = mCallback.getMoveThreshold(viewholder); // 9 19:aload_0 // 10 20:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 11 23:aload_1 // 12 24:invokevirtual #535 <Method float ItemTouchHelper$Callback.getMoveThreshold(android.support.v7.widget.RecyclerView$ViewHolder)> // 13 27:fstore_2 int i = (int)(mSelectedStartX + mDx); // 14 28:aload_0 // 15 29:getfield #268 <Field float mSelectedStartX> // 16 32:aload_0 // 17 33:getfield #177 <Field float mDx> // 18 36:fadd // 19 37:f2i // 20 38:istore_3 int j = (int)(mSelectedStartY + mDy); // 21 39:aload_0 // 22 40:getfield #274 <Field float mSelectedStartY> // 23 43:aload_0 // 24 44:getfield #219 <Field float mDy> // 25 47:fadd // 26 48:f2i // 27 49:istore 4 if((float)Math.abs(j - viewholder.itemView.getTop()) >= (float)viewholder.itemView.getHeight() * f || (float)Math.abs(i - viewholder.itemView.getLeft()) >= (float)viewholder.itemView.getWidth() * f) //* 28 51:iload 4 //* 29 53:aload_1 //* 30 54:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 31 57:invokevirtual #302 <Method int View.getTop()> //* 32 60:isub //* 33 61:invokestatic #319 <Method int Math.abs(int)> //* 34 64:i2f //* 35 65:aload_1 //* 36 66:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 37 69:invokevirtual #283 <Method int View.getHeight()> //* 38 72:i2f //* 39 73:fload_2 //* 40 74:fmul //* 41 75:fcmpg //* 42 76:ifge 106 //* 43 79:iload_3 //* 44 80:aload_1 //* 45 81:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 46 84:invokevirtual #308 <Method int View.getLeft()> //* 47 87:isub //* 48 88:invokestatic #319 <Method int Math.abs(int)> //* 49 91:i2f //* 50 92:aload_1 //* 51 93:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 52 96:invokevirtual #282 <Method int View.getWidth()> //* 53 99:i2f //* 54 100:fload_2 //* 55 101:fmul //* 56 102:fcmpg //* 57 103:iflt 10 { Object obj = ((Object) (findSwapTargets(viewholder))); // 58 106:aload_0 // 59 107:aload_1 // 60 108:invokespecial #537 <Method List findSwapTargets(android.support.v7.widget.RecyclerView$ViewHolder)> // 61 111:astore 7 if(((List) (obj)).size() != 0) //* 62 113:aload 7 //* 63 115:invokeinterface #240 <Method int List.size()> //* 64 120:ifeq 10 { obj = ((Object) (mCallback.chooseDropTarget(viewholder, ((List) (obj)), i, j))); // 65 123:aload_0 // 66 124:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 67 127:aload_1 // 68 128:aload 7 // 69 130:iload_3 // 70 131:iload 4 // 71 133:invokevirtual #541 <Method android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$Callback.chooseDropTarget(android.support.v7.widget.RecyclerView$ViewHolder, List, int, int)> // 72 136:astore 7 if(obj == null) //* 73 138:aload 7 //* 74 140:ifnonnull 162 { mSwapTargets.clear(); // 75 143:aload_0 // 76 144:getfield #261 <Field List mSwapTargets> // 77 147:invokeinterface #254 <Method void List.clear()> mDistances.clear(); // 78 152:aload_0 // 79 153:getfield #263 <Field List mDistances> // 80 156:invokeinterface #254 <Method void List.clear()> return; // 81 161:return } int k = ((android.support.v7.widget.RecyclerView.ViewHolder) (obj)).getAdapterPosition(); // 82 162:aload 7 // 83 164:invokevirtual #544 <Method int android.support.v7.widget.RecyclerView$ViewHolder.getAdapterPosition()> // 84 167:istore 5 int l = viewholder.getAdapterPosition(); // 85 169:aload_1 // 86 170:invokevirtual #544 <Method int android.support.v7.widget.RecyclerView$ViewHolder.getAdapterPosition()> // 87 173:istore 6 if(mCallback.onMove(mRecyclerView, viewholder, ((android.support.v7.widget.RecyclerView.ViewHolder) (obj)))) //* 88 175:aload_0 //* 89 176:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 90 179:aload_0 //* 91 180:getfield #167 <Field RecyclerView mRecyclerView> //* 92 183:aload_1 //* 93 184:aload 7 //* 94 186:invokevirtual #547 <Method boolean ItemTouchHelper$Callback.onMove(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, android.support.v7.widget.RecyclerView$ViewHolder)> //* 95 189:ifeq 10 { mCallback.onMoved(mRecyclerView, viewholder, l, ((android.support.v7.widget.RecyclerView.ViewHolder) (obj)), k, i, j); // 96 192:aload_0 // 97 193:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 98 196:aload_0 // 99 197:getfield #167 <Field RecyclerView mRecyclerView> // 100 200:aload_1 // 101 201:iload 6 // 102 203:aload 7 // 103 205:iload 5 // 104 207:iload_3 // 105 208:iload 4 // 106 210:invokevirtual #551 <Method void ItemTouchHelper$Callback.onMoved(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, int, android.support.v7.widget.RecyclerView$ViewHolder, int, int, int)> return; // 107 213:return } } } } } void obtainVelocityTracker() { if(mVelocityTracker != null) //* 0 0:aload_0 //* 1 1:getfield #179 <Field VelocityTracker mVelocityTracker> //* 2 4:ifnull 14 mVelocityTracker.recycle(); // 3 7:aload_0 // 4 8:getfield #179 <Field VelocityTracker mVelocityTracker> // 5 11:invokevirtual #393 <Method void VelocityTracker.recycle()> mVelocityTracker = VelocityTracker.obtain(); // 6 14:aload_0 // 7 15:invokestatic #556 <Method VelocityTracker VelocityTracker.obtain()> // 8 18:putfield #179 <Field VelocityTracker mVelocityTracker> // 9 21:return } public void onChildViewAttachedToWindow(View view) { // 0 0:return } public void onChildViewDetachedFromWindow(View view) { removeChildDrawingOrderCallbackIfNecessary(view); // 0 0:aload_0 // 1 1:aload_1 // 2 2:invokevirtual #562 <Method void removeChildDrawingOrderCallbackIfNecessary(View)> view = ((View) (mRecyclerView.getChildViewHolder(view))); // 3 5:aload_0 // 4 6:getfield #167 <Field RecyclerView mRecyclerView> // 5 9:aload_1 // 6 10:invokevirtual #312 <Method android.support.v7.widget.RecyclerView$ViewHolder RecyclerView.getChildViewHolder(View)> // 7 13:astore_1 if(view != null) //* 8 14:aload_1 //* 9 15:ifnonnull 19 //* 10 18:return { if(mSelected != null && view == mSelected) //* 11 19:aload_0 //* 12 20:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 13 23:ifnull 41 //* 14 26:aload_1 //* 15 27:aload_0 //* 16 28:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 17 31:if_acmpne 41 { select(((android.support.v7.widget.RecyclerView.ViewHolder) (null)), 0); // 18 34:aload_0 // 19 35:aconst_null // 20 36:iconst_0 // 21 37:invokevirtual #481 <Method void select(android.support.v7.widget.RecyclerView$ViewHolder, int)> return; // 22 40:return } endRecoverAnimation(((android.support.v7.widget.RecyclerView.ViewHolder) (view)), false); // 23 41:aload_0 // 24 42:aload_1 // 25 43:iconst_0 // 26 44:invokevirtual #564 <Method int endRecoverAnimation(android.support.v7.widget.RecyclerView$ViewHolder, boolean)> // 27 47:pop if(mPendingCleanup.remove(((Object) (((android.support.v7.widget.RecyclerView.ViewHolder) (view)).itemView)))) //* 28 48:aload_0 //* 29 49:getfield #131 <Field List mPendingCleanup> //* 30 52:aload_1 //* 31 53:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 32 56:invokeinterface #567 <Method boolean List.remove(Object)> //* 33 61:ifeq 18 { mCallback.clearView(mRecyclerView, ((android.support.v7.widget.RecyclerView.ViewHolder) (view))); // 34 64:aload_0 // 35 65:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 36 68:aload_0 // 37 69:getfield #167 <Field RecyclerView mRecyclerView> // 38 72:aload_1 // 39 73:invokevirtual #251 <Method void ItemTouchHelper$Callback.clearView(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> return; // 40 76:return } } } public void onDraw(Canvas canvas, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.State state) { mOverdrawChildPosition = -1; // 0 0:aload_0 // 1 1:iconst_m1 // 2 2:putfield #152 <Field int mOverdrawChildPosition> float f = 0.0F; // 3 5:fconst_0 // 4 6:fstore 4 float f1 = 0.0F; // 5 8:fconst_0 // 6 9:fstore 5 if(mSelected != null) //* 7 11:aload_0 //* 8 12:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 9 15:ifnull 42 { getSelectedDxDy(mTmpPosition); // 10 18:aload_0 // 11 19:aload_0 // 12 20:getfield #133 <Field float[] mTmpPosition> // 13 23:invokespecial #571 <Method void getSelectedDxDy(float[])> f = mTmpPosition[0]; // 14 26:aload_0 // 15 27:getfield #133 <Field float[] mTmpPosition> // 16 30:iconst_0 // 17 31:faload // 18 32:fstore 4 f1 = mTmpPosition[1]; // 19 34:aload_0 // 20 35:getfield #133 <Field float[] mTmpPosition> // 21 38:iconst_1 // 22 39:faload // 23 40:fstore 5 } mCallback.onDraw(canvas, recyclerview, mSelected, mRecoverAnimations, mActionState, f, f1); // 24 42:aload_0 // 25 43:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 26 46:aload_1 // 27 47:aload_2 // 28 48:aload_0 // 29 49:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 30 52:aload_0 // 31 53:getfield #141 <Field List mRecoverAnimations> // 32 56:aload_0 // 33 57:getfield #139 <Field int mActionState> // 34 60:fload 4 // 35 62:fload 5 // 36 64:invokevirtual #574 <Method void ItemTouchHelper$Callback.onDraw(Canvas, RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, List, int, float, float)> // 37 67:return } public void onDrawOver(Canvas canvas, RecyclerView recyclerview, android.support.v7.widget.RecyclerView.State state) { float f = 0.0F; // 0 0:fconst_0 // 1 1:fstore 4 float f1 = 0.0F; // 2 3:fconst_0 // 3 4:fstore 5 if(mSelected != null) //* 4 6:aload_0 //* 5 7:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 6 10:ifnull 37 { getSelectedDxDy(mTmpPosition); // 7 13:aload_0 // 8 14:aload_0 // 9 15:getfield #133 <Field float[] mTmpPosition> // 10 18:invokespecial #571 <Method void getSelectedDxDy(float[])> f = mTmpPosition[0]; // 11 21:aload_0 // 12 22:getfield #133 <Field float[] mTmpPosition> // 13 25:iconst_0 // 14 26:faload // 15 27:fstore 4 f1 = mTmpPosition[1]; // 16 29:aload_0 // 17 30:getfield #133 <Field float[] mTmpPosition> // 18 33:iconst_1 // 19 34:faload // 20 35:fstore 5 } mCallback.onDrawOver(canvas, recyclerview, mSelected, mRecoverAnimations, mActionState, f, f1); // 21 37:aload_0 // 22 38:getfield #157 <Field ItemTouchHelper$Callback mCallback> // 23 41:aload_1 // 24 42:aload_2 // 25 43:aload_0 // 26 44:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 27 47:aload_0 // 28 48:getfield #141 <Field List mRecoverAnimations> // 29 51:aload_0 // 30 52:getfield #139 <Field int mActionState> // 31 55:fload 4 // 32 57:fload 5 // 33 59:invokevirtual #577 <Method void ItemTouchHelper$Callback.onDrawOver(Canvas, RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder, List, int, float, float)> // 34 62:return } void postDispatchSwipe(final RecoverAnimation anim, final int swipeDir) { mRecyclerView.post(new Runnable() { public void run() { label0: { if(mRecyclerView != null && mRecyclerView.isAttachedToWindow() && !anim.mOverridden && anim.mViewHolder.getAdapterPosition() != -1) //* 0 0:aload_0 //* 1 1:getfield #21 <Field ItemTouchHelper this$0> //* 2 4:getfield #34 <Field RecyclerView ItemTouchHelper.mRecyclerView> //* 3 7:ifnull 101 //* 4 10:aload_0 //* 5 11:getfield #21 <Field ItemTouchHelper this$0> //* 6 14:getfield #34 <Field RecyclerView ItemTouchHelper.mRecyclerView> //* 7 17:invokevirtual #40 <Method boolean RecyclerView.isAttachedToWindow()> //* 8 20:ifeq 101 //* 9 23:aload_0 //* 10 24:getfield #23 <Field ItemTouchHelper$RecoverAnimation val$anim> //* 11 27:getfield #46 <Field boolean ItemTouchHelper$RecoverAnimation.mOverridden> //* 12 30:ifne 101 //* 13 33:aload_0 //* 14 34:getfield #23 <Field ItemTouchHelper$RecoverAnimation val$anim> //* 15 37:getfield #50 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> //* 16 40:invokevirtual #56 <Method int android.support.v7.widget.RecyclerView$ViewHolder.getAdapterPosition()> //* 17 43:iconst_m1 //* 18 44:icmpeq 101 { android.support.v7.widget.RecyclerView.ItemAnimator itemanimator = mRecyclerView.getItemAnimator(); // 19 47:aload_0 // 20 48:getfield #21 <Field ItemTouchHelper this$0> // 21 51:getfield #34 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 22 54:invokevirtual #60 <Method android.support.v7.widget.RecyclerView$ItemAnimator RecyclerView.getItemAnimator()> // 23 57:astore_1 if(itemanimator != null && itemanimator.isRunning(((android.support.v7.widget.RecyclerView.ItemAnimator.ItemAnimatorFinishedListener) (null))) || hasRunningRecoverAnim()) break label0; // 24 58:aload_1 // 25 59:ifnull 70 // 26 62:aload_1 // 27 63:aconst_null // 28 64:invokevirtual #66 <Method boolean android.support.v7.widget.RecyclerView$ItemAnimator.isRunning(android.support.v7.widget.RecyclerView$ItemAnimator$ItemAnimatorFinishedListener)> // 29 67:ifne 102 // 30 70:aload_0 // 31 71:getfield #21 <Field ItemTouchHelper this$0> // 32 74:invokevirtual #69 <Method boolean ItemTouchHelper.hasRunningRecoverAnim()> // 33 77:ifne 102 mCallback.onSwiped(anim.mViewHolder, swipeDir); // 34 80:aload_0 // 35 81:getfield #21 <Field ItemTouchHelper this$0> // 36 84:getfield #73 <Field ItemTouchHelper$Callback ItemTouchHelper.mCallback> // 37 87:aload_0 // 38 88:getfield #23 <Field ItemTouchHelper$RecoverAnimation val$anim> // 39 91:getfield #50 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 40 94:aload_0 // 41 95:getfield #25 <Field int val$swipeDir> // 42 98:invokevirtual #79 <Method void ItemTouchHelper$Callback.onSwiped(android.support.v7.widget.RecyclerView$ViewHolder, int)> } return; // 43 101:return } mRecyclerView.post(((Runnable) (this))); // 44 102:aload_0 // 45 103:getfield #21 <Field ItemTouchHelper this$0> // 46 106:getfield #34 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 47 109:aload_0 // 48 110:invokevirtual #83 <Method boolean RecyclerView.post(Runnable)> // 49 113:pop // 50 114:return } final ItemTouchHelper this$0; final RecoverAnimation val$anim; final int val$swipeDir; { this$0 = ItemTouchHelper.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #21 <Field ItemTouchHelper this$0> anim = recoveranimation; // 3 5:aload_0 // 4 6:aload_2 // 5 7:putfield #23 <Field ItemTouchHelper$RecoverAnimation val$anim> swipeDir = i; // 6 10:aload_0 // 7 11:iload_3 // 8 12:putfield #25 <Field int val$swipeDir> super(); // 9 15:aload_0 // 10 16:invokespecial #28 <Method void Object()> // 11 19:return } } ); // 0 0:aload_0 // 1 1:getfield #167 <Field RecyclerView mRecyclerView> // 2 4:new #14 <Class ItemTouchHelper$4> // 3 7:dup // 4 8:aload_0 // 5 9:aload_1 // 6 10:iload_2 // 7 11:invokespecial #582 <Method void ItemTouchHelper$4(ItemTouchHelper, ItemTouchHelper$RecoverAnimation, int)> // 8 14:invokevirtual #586 <Method boolean RecyclerView.post(Runnable)> // 9 17:pop // 10 18:return } void removeChildDrawingOrderCallbackIfNecessary(View view) { if(view == mOverdrawChild) //* 0 0:aload_1 //* 1 1:aload_0 //* 2 2:getfield #150 <Field View mOverdrawChild> //* 3 5:if_acmpne 28 { mOverdrawChild = null; // 4 8:aload_0 // 5 9:aconst_null // 6 10:putfield #150 <Field View mOverdrawChild> if(mChildDrawingOrderCallback != null) //* 7 13:aload_0 //* 8 14:getfield #148 <Field android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback mChildDrawingOrderCallback> //* 9 17:ifnull 28 mRecyclerView.setChildDrawingOrderCallback(((android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback) (null))); // 10 20:aload_0 // 11 21:getfield #167 <Field RecyclerView mRecyclerView> // 12 24:aconst_null // 13 25:invokevirtual #173 <Method void RecyclerView.setChildDrawingOrderCallback(android.support.v7.widget.RecyclerView$ChildDrawingOrderCallback)> } // 14 28:return } boolean scrollIfNecessary() { if(mSelected == null) //* 0 0:aload_0 //* 1 1:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 2 4:ifnonnull 16 { mDragScrollStartTimeInMs = 0x0L; // 3 7:aload_0 // 4 8:ldc2w #588 <Long 0x0L> // 5 11:putfield #591 <Field long mDragScrollStartTimeInMs> return false; // 6 14:iconst_0 // 7 15:ireturn } long l2 = System.currentTimeMillis(); // 8 16:invokestatic #597 <Method long System.currentTimeMillis()> // 9 19:lstore 7 int i; int j; int k; int l; long l1; android.support.v7.widget.RecyclerView.LayoutManager layoutmanager; if(mDragScrollStartTimeInMs == 0x0L) //* 10 21:aload_0 //* 11 22:getfield #591 <Field long mDragScrollStartTimeInMs> //* 12 25:ldc2w #588 <Long 0x0L> //* 13 28:lcmp //* 14 29:ifne 302 l1 = 0L; // 15 32:lconst_0 // 16 33:lstore 5 else //* 17 35:aload_0 //* 18 36:getfield #167 <Field RecyclerView mRecyclerView> //* 19 39:invokevirtual #287 <Method android.support.v7.widget.RecyclerView$LayoutManager RecyclerView.getLayoutManager()> //* 20 42:astore 9 //* 21 44:aload_0 //* 22 45:getfield #599 <Field Rect mTmpRect> //* 23 48:ifnonnull 62 //* 24 51:aload_0 //* 25 52:new #523 <Class Rect> //* 26 55:dup //* 27 56:invokespecial #600 <Method void Rect()> //* 28 59:putfield #599 <Field Rect mTmpRect> //* 29 62:iconst_0 //* 30 63:istore_2 //* 31 64:iconst_0 //* 32 65:istore_3 //* 33 66:aload 9 //* 34 68:aload_0 //* 35 69:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 36 72:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 37 75:aload_0 //* 38 76:getfield #599 <Field Rect mTmpRect> //* 39 79:invokevirtual #604 <Method void android.support.v7.widget.RecyclerView$LayoutManager.calculateItemDecorationsForChild(View, Rect)> //* 40 82:iload_2 //* 41 83:istore_1 //* 42 84:aload 9 //* 43 86:invokevirtual #357 <Method boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollHorizontally()> //* 44 89:ifeq 136 //* 45 92:aload_0 //* 46 93:getfield #268 <Field float mSelectedStartX> //* 47 96:aload_0 //* 48 97:getfield #177 <Field float mDx> //* 49 100:fadd //* 50 101:f2i //* 51 102:istore 4 //* 52 104:iload 4 //* 53 106:aload_0 //* 54 107:getfield #599 <Field Rect mTmpRect> //* 55 110:getfield #607 <Field int Rect.left> //* 56 113:isub //* 57 114:aload_0 //* 58 115:getfield #167 <Field RecyclerView mRecyclerView> //* 59 118:invokevirtual #610 <Method int RecyclerView.getPaddingLeft()> //* 60 121:isub //* 61 122:istore_1 //* 62 123:aload_0 //* 63 124:getfield #177 <Field float mDx> //* 64 127:fconst_0 //* 65 128:fcmpg //* 66 129:ifge 314 //* 67 132:iload_1 //* 68 133:ifge 314 //* 69 136:iload_3 //* 70 137:istore_2 //* 71 138:aload 9 //* 72 140:invokevirtual #360 <Method boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollVertically()> //* 73 143:ifeq 190 //* 74 146:aload_0 //* 75 147:getfield #274 <Field float mSelectedStartY> //* 76 150:aload_0 //* 77 151:getfield #219 <Field float mDy> //* 78 154:fadd //* 79 155:f2i //* 80 156:istore 4 //* 81 158:iload 4 //* 82 160:aload_0 //* 83 161:getfield #599 <Field Rect mTmpRect> //* 84 164:getfield #613 <Field int Rect.top> //* 85 167:isub //* 86 168:aload_0 //* 87 169:getfield #167 <Field RecyclerView mRecyclerView> //* 88 172:invokevirtual #616 <Method int RecyclerView.getPaddingTop()> //* 89 175:isub //* 90 176:istore_2 //* 91 177:aload_0 //* 92 178:getfield #219 <Field float mDy> //* 93 181:fconst_0 //* 94 182:fcmpg //* 95 183:ifge 377 //* 96 186:iload_2 //* 97 187:ifge 377 //* 98 190:iload_1 //* 99 191:istore_3 //* 100 192:iload_1 //* 101 193:ifeq 228 //* 102 196:aload_0 //* 103 197:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 104 200:aload_0 //* 105 201:getfield #167 <Field RecyclerView mRecyclerView> //* 106 204:aload_0 //* 107 205:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 108 208:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 109 211:invokevirtual #282 <Method int View.getWidth()> //* 110 214:iload_1 //* 111 215:aload_0 //* 112 216:getfield #167 <Field RecyclerView mRecyclerView> //* 113 219:invokevirtual #212 <Method int RecyclerView.getWidth()> //* 114 222:lload 5 //* 115 224:invokevirtual #620 <Method int ItemTouchHelper$Callback.interpolateOutOfBoundsScroll(RecyclerView, int, int, int, long)> //* 116 227:istore_3 //* 117 228:iload_2 //* 118 229:istore_1 //* 119 230:iload_2 //* 120 231:ifeq 266 //* 121 234:aload_0 //* 122 235:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 123 238:aload_0 //* 124 239:getfield #167 <Field RecyclerView mRecyclerView> //* 125 242:aload_0 //* 126 243:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 127 246:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 128 249:invokevirtual #283 <Method int View.getHeight()> //* 129 252:iload_2 //* 130 253:aload_0 //* 131 254:getfield #167 <Field RecyclerView mRecyclerView> //* 132 257:invokevirtual #222 <Method int RecyclerView.getHeight()> //* 133 260:lload 5 //* 134 262:invokevirtual #620 <Method int ItemTouchHelper$Callback.interpolateOutOfBoundsScroll(RecyclerView, int, int, int, long)> //* 135 265:istore_1 //* 136 266:iload_3 //* 137 267:ifne 274 //* 138 270:iload_1 //* 139 271:ifeq 440 //* 140 274:aload_0 //* 141 275:getfield #591 <Field long mDragScrollStartTimeInMs> //* 142 278:ldc2w #588 <Long 0x0L> //* 143 281:lcmp //* 144 282:ifne 291 //* 145 285:aload_0 //* 146 286:lload 7 //* 147 288:putfield #591 <Field long mDragScrollStartTimeInMs> //* 148 291:aload_0 //* 149 292:getfield #167 <Field RecyclerView mRecyclerView> //* 150 295:iload_3 //* 151 296:iload_1 //* 152 297:invokevirtual #624 <Method void RecyclerView.scrollBy(int, int)> //* 153 300:iconst_1 //* 154 301:ireturn l1 = l2 - mDragScrollStartTimeInMs; // 155 302:lload 7 // 156 304:aload_0 // 157 305:getfield #591 <Field long mDragScrollStartTimeInMs> // 158 308:lsub // 159 309:lstore 5 layoutmanager = mRecyclerView.getLayoutManager(); if(mTmpRect == null) mTmpRect = new Rect(); j = 0; k = 0; layoutmanager.calculateItemDecorationsForChild(mSelected.itemView, mTmpRect); i = j; if(layoutmanager.canScrollHorizontally()) { l = (int)(mSelectedStartX + mDx); i = l - mTmpRect.left - mRecyclerView.getPaddingLeft(); if(mDx >= 0.0F || i >= 0) //* 160 311:goto 35 { i = j; // 161 314:iload_2 // 162 315:istore_1 if(mDx > 0.0F) //* 163 316:aload_0 //* 164 317:getfield #177 <Field float mDx> //* 165 320:fconst_0 //* 166 321:fcmpl //* 167 322:ifle 136 { l = (mSelected.itemView.getWidth() + l + mTmpRect.right) - (mRecyclerView.getWidth() - mRecyclerView.getPaddingRight()); // 168 325:aload_0 // 169 326:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 170 329:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 171 332:invokevirtual #282 <Method int View.getWidth()> // 172 335:iload 4 // 173 337:iadd // 174 338:aload_0 // 175 339:getfield #599 <Field Rect mTmpRect> // 176 342:getfield #627 <Field int Rect.right> // 177 345:iadd // 178 346:aload_0 // 179 347:getfield #167 <Field RecyclerView mRecyclerView> // 180 350:invokevirtual #212 <Method int RecyclerView.getWidth()> // 181 353:aload_0 // 182 354:getfield #167 <Field RecyclerView mRecyclerView> // 183 357:invokevirtual #630 <Method int RecyclerView.getPaddingRight()> // 184 360:isub // 185 361:isub // 186 362:istore 4 i = j; // 187 364:iload_2 // 188 365:istore_1 if(l > 0) //* 189 366:iload 4 //* 190 368:ifle 136 i = l; // 191 371:iload 4 // 192 373:istore_1 } } } j = k; if(layoutmanager.canScrollVertically()) { l = (int)(mSelectedStartY + mDy); j = l - mTmpRect.top - mRecyclerView.getPaddingTop(); if(mDy >= 0.0F || j >= 0) //* 193 374:goto 136 { j = k; // 194 377:iload_3 // 195 378:istore_2 if(mDy > 0.0F) //* 196 379:aload_0 //* 197 380:getfield #219 <Field float mDy> //* 198 383:fconst_0 //* 199 384:fcmpl //* 200 385:ifle 190 { l = (mSelected.itemView.getHeight() + l + mTmpRect.bottom) - (mRecyclerView.getHeight() - mRecyclerView.getPaddingBottom()); // 201 388:aload_0 // 202 389:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 203 392:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 204 395:invokevirtual #283 <Method int View.getHeight()> // 205 398:iload 4 // 206 400:iadd // 207 401:aload_0 // 208 402:getfield #599 <Field Rect mTmpRect> // 209 405:getfield #633 <Field int Rect.bottom> // 210 408:iadd // 211 409:aload_0 // 212 410:getfield #167 <Field RecyclerView mRecyclerView> // 213 413:invokevirtual #222 <Method int RecyclerView.getHeight()> // 214 416:aload_0 // 215 417:getfield #167 <Field RecyclerView mRecyclerView> // 216 420:invokevirtual #636 <Method int RecyclerView.getPaddingBottom()> // 217 423:isub // 218 424:isub // 219 425:istore 4 j = k; // 220 427:iload_3 // 221 428:istore_2 if(l > 0) //* 222 429:iload 4 //* 223 431:ifle 190 j = l; // 224 434:iload 4 // 225 436:istore_2 } } } k = i; if(i != 0) k = mCallback.interpolateOutOfBoundsScroll(mRecyclerView, mSelected.itemView.getWidth(), i, mRecyclerView.getWidth(), l1); i = j; if(j != 0) i = mCallback.interpolateOutOfBoundsScroll(mRecyclerView, mSelected.itemView.getHeight(), j, mRecyclerView.getHeight(), l1); if(k != 0 || i != 0) { if(mDragScrollStartTimeInMs == 0x0L) mDragScrollStartTimeInMs = l2; mRecyclerView.scrollBy(k, i); return true; } else //* 226 437:goto 190 { mDragScrollStartTimeInMs = 0x0L; // 227 440:aload_0 // 228 441:ldc2w #588 <Long 0x0L> // 229 444:putfield #591 <Field long mDragScrollStartTimeInMs> return false; // 230 447:iconst_0 // 231 448:ireturn } } void select(android.support.v7.widget.RecyclerView.ViewHolder viewholder, int i) { final int final_i; int j; int k; if(viewholder == mSelected && i == mActionState) //* 0 0:aload_1 //* 1 1:aload_0 //* 2 2:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 3 5:if_acmpne 17 //* 4 8:iload_2 //* 5 9:aload_0 //* 6 10:getfield #139 <Field int mActionState> //* 7 13:icmpne 17 return; // 8 16:return mDragScrollStartTimeInMs = 0x0L; // 9 17:aload_0 // 10 18:ldc2w #588 <Long 0x0L> // 11 21:putfield #591 <Field long mDragScrollStartTimeInMs> k = mActionState; // 12 24:aload_0 // 13 25:getfield #139 <Field int mActionState> // 14 28:istore 9 endRecoverAnimation(viewholder, true); // 15 30:aload_0 // 16 31:aload_1 // 17 32:iconst_1 // 18 33:invokevirtual #564 <Method int endRecoverAnimation(android.support.v7.widget.RecyclerView$ViewHolder, boolean)> // 19 36:pop mActionState = i; // 20 37:aload_0 // 21 38:iload_2 // 22 39:putfield #139 <Field int mActionState> if(i == 2) //* 23 42:iload_2 //* 24 43:iconst_2 //* 25 44:icmpne 59 { mOverdrawChild = viewholder.itemView; // 26 47:aload_0 // 27 48:aload_1 // 28 49:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 29 52:putfield #150 <Field View mOverdrawChild> addChildDrawingOrderCallback(); // 30 55:aload_0 // 31 56:invokespecial #638 <Method void addChildDrawingOrderCallback()> } final_i = 0; // 32 59:iconst_0 // 33 60:istore 7 j = 0; // 34 62:iconst_0 // 35 63:istore 8 if(mSelected == null) goto _L2; else goto _L1 // 36 65:aload_0 // 37 66:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 38 69:ifnull 282 _L1: float f; float f1; final Object final_viewholder; final_viewholder = ((Object) (mSelected)); // 39 72:aload_0 // 40 73:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> // 41 76:astore 11 if(((android.support.v7.widget.RecyclerView.ViewHolder) (final_viewholder)).itemView.getParent() == null) break MISSING_BLOCK_LABEL_510; // 42 78:aload 11 // 43 80:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 44 83:invokevirtual #642 <Method ViewParent View.getParent()> // 45 86:ifnull 510 float f2; float f3; if(k == 2) //* 46 89:iload 9 //* 47 91:iconst_2 //* 48 92:icmpne 436 j = 0; // 49 95:iconst_0 // 50 96:istore 8 else //* 51 98:aload_0 //* 52 99:invokespecial #257 <Method void releaseVelocityTracker()> //* 53 102:iload 8 //* 54 104:lookupswitch 6: default 164 // 1: 470 // 2: 470 // 4: 447 // 8: 447 // 16: 447 // 32: 447 //* 55 164:fconst_0 //* 56 165:fstore_3 //* 57 166:fconst_0 //* 58 167:fstore 4 //* 59 169:iload 9 //* 60 171:iconst_2 //* 61 172:icmpne 493 //* 62 175:bipush 8 //* 63 177:istore 7 //* 64 179:aload_0 //* 65 180:aload_0 //* 66 181:getfield #133 <Field float[] mTmpPosition> //* 67 184:invokespecial #571 <Method void getSelectedDxDy(float[])> //* 68 187:aload_0 //* 69 188:getfield #133 <Field float[] mTmpPosition> //* 70 191:iconst_0 //* 71 192:faload //* 72 193:fstore 5 //* 73 195:aload_0 //* 74 196:getfield #133 <Field float[] mTmpPosition> //* 75 199:iconst_1 //* 76 200:faload //* 77 201:fstore 6 //* 78 203:new #12 <Class ItemTouchHelper$3> //* 79 206:dup //* 80 207:aload_0 //* 81 208:aload 11 //* 82 210:iload 7 //* 83 212:iload 9 //* 84 214:fload 5 //* 85 216:fload 6 //* 86 218:fload_3 //* 87 219:fload 4 //* 88 221:iload 8 //* 89 223:aload 11 //* 90 225:invokespecial #645 <Method void ItemTouchHelper$3(ItemTouchHelper, android.support.v7.widget.RecyclerView$ViewHolder, int, int, float, float, float, float, int, android.support.v7.widget.RecyclerView$ViewHolder)> //* 91 228:astore 11 //* 92 230:aload 11 //* 93 232:aload_0 //* 94 233:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 95 236:aload_0 //* 96 237:getfield #167 <Field RecyclerView mRecyclerView> //* 97 240:iload 7 //* 98 242:fload_3 //* 99 243:fload 5 //* 100 245:fsub //* 101 246:fload 4 //* 102 248:fload 6 //* 103 250:fsub //* 104 251:invokevirtual #649 <Method long ItemTouchHelper$Callback.getAnimationDuration(RecyclerView, int, float, float)> //* 105 254:invokevirtual #653 <Method void ItemTouchHelper$RecoverAnimation.setDuration(long)> //* 106 257:aload_0 //* 107 258:getfield #141 <Field List mRecoverAnimations> //* 108 261:aload 11 //* 109 263:invokeinterface #655 <Method boolean List.add(Object)> //* 110 268:pop //* 111 269:aload 11 //* 112 271:invokevirtual #658 <Method void ItemTouchHelper$RecoverAnimation.start()> //* 113 274:iconst_1 //* 114 275:istore 7 //* 115 277:aload_0 //* 116 278:aconst_null //* 117 279:putfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 118 282:aload_1 //* 119 283:ifnull 368 //* 120 286:aload_0 //* 121 287:aload_0 //* 122 288:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 123 291:aload_0 //* 124 292:getfield #167 <Field RecyclerView mRecyclerView> //* 125 295:aload_1 //* 126 296:invokevirtual #474 <Method int ItemTouchHelper$Callback.getAbsoluteMovementFlags(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> //* 127 299:iconst_1 //* 128 300:iload_2 //* 129 301:bipush 8 //* 130 303:imul //* 131 304:bipush 8 //* 132 306:iadd //* 133 307:ishl //* 134 308:iconst_1 //* 135 309:isub //* 136 310:iand //* 137 311:aload_0 //* 138 312:getfield #139 <Field int mActionState> //* 139 315:bipush 8 //* 140 317:imul //* 141 318:ishr //* 142 319:putfield #368 <Field int mSelectedFlags> //* 143 322:aload_0 //* 144 323:aload_1 //* 145 324:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 146 327:invokevirtual #308 <Method int View.getLeft()> //* 147 330:i2f //* 148 331:putfield #268 <Field float mSelectedStartX> //* 149 334:aload_0 //* 150 335:aload_1 //* 151 336:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 152 339:invokevirtual #302 <Method int View.getTop()> //* 153 342:i2f //* 154 343:putfield #274 <Field float mSelectedStartY> //* 155 346:aload_0 //* 156 347:aload_1 //* 157 348:putfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 158 351:iload_2 //* 159 352:iconst_2 //* 160 353:icmpne 368 //* 161 356:aload_0 //* 162 357:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 163 360:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 164 363:iconst_0 //* 165 364:invokevirtual #662 <Method boolean View.performHapticFeedback(int)> //* 166 367:pop //* 167 368:aload_0 //* 168 369:getfield #167 <Field RecyclerView mRecyclerView> //* 169 372:invokevirtual #663 <Method ViewParent RecyclerView.getParent()> //* 170 375:astore_1 //* 171 376:aload_1 //* 172 377:ifnull 398 //* 173 380:aload_0 //* 174 381:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 175 384:ifnull 539 //* 176 387:iconst_1 //* 177 388:istore 10 //* 178 390:aload_1 //* 179 391:iload 10 //* 180 393:invokeinterface #669 <Method void ViewParent.requestDisallowInterceptTouchEvent(boolean)> //* 181 398:iload 7 //* 182 400:ifne 413 //* 183 403:aload_0 //* 184 404:getfield #167 <Field RecyclerView mRecyclerView> //* 185 407:invokevirtual #287 <Method android.support.v7.widget.RecyclerView$LayoutManager RecyclerView.getLayoutManager()> //* 186 410:invokevirtual #672 <Method void android.support.v7.widget.RecyclerView$LayoutManager.requestSimpleAnimationsInNextLayout()> //* 187 413:aload_0 //* 188 414:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 189 417:aload_0 //* 190 418:getfield #135 <Field android.support.v7.widget.RecyclerView$ViewHolder mSelected> //* 191 421:aload_0 //* 192 422:getfield #139 <Field int mActionState> //* 193 425:invokevirtual #675 <Method void ItemTouchHelper$Callback.onSelectedChanged(android.support.v7.widget.RecyclerView$ViewHolder, int)> //* 194 428:aload_0 //* 195 429:getfield #167 <Field RecyclerView mRecyclerView> //* 196 432:invokevirtual #678 <Method void RecyclerView.invalidate()> //* 197 435:return j = swipeIfNecessary(((android.support.v7.widget.RecyclerView.ViewHolder) (final_viewholder))); // 198 436:aload_0 // 199 437:aload 11 // 200 439:invokespecial #680 <Method int swipeIfNecessary(android.support.v7.widget.RecyclerView$ViewHolder)> // 201 442:istore 8 releaseVelocityTracker(); j; JVM INSTR lookupswitch 6: default 164 // 1: 470 // 2: 470 // 4: 447 // 8: 447 // 16: 447 // 32: 447; goto _L3 _L4 _L4 _L5 _L5 _L5 _L5 _L3: f = 0.0F; f1 = 0.0F; _L6: if(k == 2) final_i = 8; else //* 202 444:goto 98 //* 203 447:fconst_0 //* 204 448:fstore 4 //* 205 450:aload_0 //* 206 451:getfield #177 <Field float mDx> //* 207 454:invokestatic #683 <Method float Math.signum(float)> //* 208 457:aload_0 //* 209 458:getfield #167 <Field RecyclerView mRecyclerView> //* 210 461:invokevirtual #212 <Method int RecyclerView.getWidth()> //* 211 464:i2f //* 212 465:fmul //* 213 466:fstore_3 //* 214 467:goto 169 //* 215 470:fconst_0 //* 216 471:fstore_3 //* 217 472:aload_0 //* 218 473:getfield #219 <Field float mDy> //* 219 476:invokestatic #683 <Method float Math.signum(float)> //* 220 479:aload_0 //* 221 480:getfield #167 <Field RecyclerView mRecyclerView> //* 222 483:invokevirtual #222 <Method int RecyclerView.getHeight()> //* 223 486:i2f //* 224 487:fmul //* 225 488:fstore 4 //* 226 490:goto 169 if(j > 0) //* 227 493:iload 8 //* 228 495:ifle 504 final_i = 2; // 229 498:iconst_2 // 230 499:istore 7 else //* 231 501:goto 179 final_i = 4; // 232 504:iconst_4 // 233 505:istore 7 getSelectedDxDy(mTmpPosition); f2 = mTmpPosition[0]; f3 = mTmpPosition[1]; final_viewholder = ((Object) (new RecoverAnimation(k, f2, f3, f, f1, j, ((android.support.v7.widget.RecyclerView.ViewHolder) (final_viewholder))) { public void onAnimationEnd(Animator animator) { super.onAnimationEnd(animator); // 0 0:aload_0 // 1 1:aload_1 // 2 2:invokespecial #31 <Method void ItemTouchHelper$RecoverAnimation.onAnimationEnd(Animator)> if(!mOverridden) goto _L2; else goto _L1 // 3 5:aload_0 // 4 6:getfield #35 <Field boolean mOverridden> // 5 9:ifeq 13 _L1: return; // 6 12:return _L2: if(swipeDir > 0) break; /* Loop/switch isn't completed */ // 7 13:aload_0 // 8 14:getfield #21 <Field int val$swipeDir> // 9 17:ifgt 73 mCallback.clearView(mRecyclerView, prevSelected); // 10 20:aload_0 // 11 21:getfield #19 <Field ItemTouchHelper this$0> // 12 24:getfield #39 <Field ItemTouchHelper$Callback ItemTouchHelper.mCallback> // 13 27:aload_0 // 14 28:getfield #19 <Field ItemTouchHelper this$0> // 15 31:getfield #43 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 16 34:aload_0 // 17 35:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder val$prevSelected> // 18 38:invokevirtual #49 <Method void ItemTouchHelper$Callback.clearView(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> _L4: if(mOverdrawChild == prevSelected.itemView) //* 19 41:aload_0 //* 20 42:getfield #19 <Field ItemTouchHelper this$0> //* 21 45:getfield #53 <Field View ItemTouchHelper.mOverdrawChild> //* 22 48:aload_0 //* 23 49:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder val$prevSelected> //* 24 52:getfield #58 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 25 55:if_acmpne 12 { removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView); // 26 58:aload_0 // 27 59:getfield #19 <Field ItemTouchHelper this$0> // 28 62:aload_0 // 29 63:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder val$prevSelected> // 30 66:getfield #58 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 31 69:invokevirtual #62 <Method void ItemTouchHelper.removeChildDrawingOrderCallbackIfNecessary(View)> return; // 32 72:return } if(true) goto _L1; else goto _L3 _L3: mPendingCleanup.add(((Object) (prevSelected.itemView))); // 33 73:aload_0 // 34 74:getfield #19 <Field ItemTouchHelper this$0> // 35 77:getfield #66 <Field List ItemTouchHelper.mPendingCleanup> // 36 80:aload_0 // 37 81:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder val$prevSelected> // 38 84:getfield #58 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> // 39 87:invokeinterface #72 <Method boolean List.add(Object)> // 40 92:pop mIsPendingCleanup = true; // 41 93:aload_0 // 42 94:iconst_1 // 43 95:putfield #75 <Field boolean mIsPendingCleanup> if(swipeDir > 0) //* 44 98:aload_0 //* 45 99:getfield #21 <Field int val$swipeDir> //* 46 102:ifle 41 postDispatchSwipe(((RecoverAnimation) (this)), swipeDir); // 47 105:aload_0 // 48 106:getfield #19 <Field ItemTouchHelper this$0> // 49 109:aload_0 // 50 110:aload_0 // 51 111:getfield #21 <Field int val$swipeDir> // 52 114:invokevirtual #79 <Method void ItemTouchHelper.postDispatchSwipe(ItemTouchHelper$RecoverAnimation, int)> goto _L4 if(true) goto _L1; else goto _L5 _L5: //* 53 117:goto 41 } final ItemTouchHelper this$0; final android.support.v7.widget.RecyclerView.ViewHolder val$prevSelected; final int val$swipeDir; { this$0 = ItemTouchHelper.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #19 <Field ItemTouchHelper this$0> swipeDir = k; // 3 5:aload_0 // 4 6:iload 9 // 5 8:putfield #21 <Field int val$swipeDir> prevSelected = viewholder1; // 6 11:aload_0 // 7 12:aload 10 // 8 14:putfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder val$prevSelected> super(final_viewholder, final_i, j, f, f1, f2, f3); // 9 17:aload_0 // 10 18:aload_2 // 11 19:iload_3 // 12 20:iload 4 // 13 22:fload 5 // 14 24:fload 6 // 15 26:fload 7 // 16 28:fload 8 // 17 30:invokespecial #26 <Method void ItemTouchHelper$RecoverAnimation(android.support.v7.widget.RecyclerView$ViewHolder, int, int, float, float, float, float)> // 18 33:return } } )); ((RecoverAnimation) (final_viewholder)).setDuration(mCallback.getAnimationDuration(mRecyclerView, final_i, f - f2, f1 - f3)); mRecoverAnimations.add(final_viewholder); ((RecoverAnimation) (final_viewholder)).start(); final_i = 1; _L7: mSelected = null; _L2: if(viewholder != null) { mSelectedFlags = (mCallback.getAbsoluteMovementFlags(mRecyclerView, viewholder) & (1 << i * 8 + 8) - 1) >> mActionState * 8; mSelectedStartX = viewholder.itemView.getLeft(); mSelectedStartY = viewholder.itemView.getTop(); mSelected = viewholder; if(i == 2) mSelected.itemView.performHapticFeedback(0); } viewholder = ((android.support.v7.widget.RecyclerView.ViewHolder) (mRecyclerView.getParent())); if(viewholder != null) { boolean flag; if(mSelected != null) flag = true; else //* 234 507:goto 179 //* 235 510:aload_0 //* 236 511:aload 11 //* 237 513:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 238 516:invokevirtual #562 <Method void removeChildDrawingOrderCallbackIfNecessary(View)> //* 239 519:aload_0 //* 240 520:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 241 523:aload_0 //* 242 524:getfield #167 <Field RecyclerView mRecyclerView> //* 243 527:aload 11 //* 244 529:invokevirtual #251 <Method void ItemTouchHelper$Callback.clearView(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> //* 245 532:iload 8 //* 246 534:istore 7 //* 247 536:goto 277 flag = false; // 248 539:iconst_0 // 249 540:istore 10 ((ViewParent) (viewholder)).requestDisallowInterceptTouchEvent(flag); } if(final_i == 0) mRecyclerView.getLayoutManager().requestSimpleAnimationsInNextLayout(); mCallback.onSelectedChanged(mSelected, mActionState); mRecyclerView.invalidate(); return; _L5: f1 = 0.0F; f = Math.signum(mDx) * (float)mRecyclerView.getWidth(); goto _L6 _L4: f = 0.0F; f1 = Math.signum(mDy) * (float)mRecyclerView.getHeight(); goto _L6 removeChildDrawingOrderCallbackIfNecessary(((android.support.v7.widget.RecyclerView.ViewHolder) (final_viewholder)).itemView); mCallback.clearView(mRecyclerView, ((android.support.v7.widget.RecyclerView.ViewHolder) (final_viewholder))); final_i = j; goto _L7 //* 250 542:goto 390 } public void startDrag(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { if(!mCallback.hasDragFlag(mRecyclerView, viewholder)) //* 0 0:aload_0 //* 1 1:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 2 4:aload_0 //* 3 5:getfield #167 <Field RecyclerView mRecyclerView> //* 4 8:aload_1 //* 5 9:invokevirtual #688 <Method boolean ItemTouchHelper$Callback.hasDragFlag(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> //* 6 12:ifne 25 { Log.e("ItemTouchHelper", "Start drag has been called but dragging is not enabled"); // 7 15:ldc1 #73 <String "ItemTouchHelper"> // 8 17:ldc2 #690 <String "Start drag has been called but dragging is not enabled"> // 9 20:invokestatic #696 <Method int Log.e(String, String)> // 10 23:pop return; // 11 24:return } if(viewholder.itemView.getParent() != mRecyclerView) //* 12 25:aload_1 //* 13 26:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 14 29:invokevirtual #642 <Method ViewParent View.getParent()> //* 15 32:aload_0 //* 16 33:getfield #167 <Field RecyclerView mRecyclerView> //* 17 36:if_acmpeq 49 { Log.e("ItemTouchHelper", "Start drag has been called with a view holder which is not a child of the RecyclerView which is controlled by this ItemTouchHelper."); // 18 39:ldc1 #73 <String "ItemTouchHelper"> // 19 41:ldc2 #698 <String "Start drag has been called with a view holder which is not a child of the RecyclerView which is controlled by this ItemTouchHelper."> // 20 44:invokestatic #696 <Method int Log.e(String, String)> // 21 47:pop return; // 22 48:return } else { obtainVelocityTracker(); // 23 49:aload_0 // 24 50:invokevirtual #700 <Method void obtainVelocityTracker()> mDy = 0.0F; // 25 53:aload_0 // 26 54:fconst_0 // 27 55:putfield #219 <Field float mDy> mDx = 0.0F; // 28 58:aload_0 // 29 59:fconst_0 // 30 60:putfield #177 <Field float mDx> select(viewholder, 2); // 31 63:aload_0 // 32 64:aload_1 // 33 65:iconst_2 // 34 66:invokevirtual #481 <Method void select(android.support.v7.widget.RecyclerView$ViewHolder, int)> return; // 35 69:return } } public void startSwipe(android.support.v7.widget.RecyclerView.ViewHolder viewholder) { if(!mCallback.hasSwipeFlag(mRecyclerView, viewholder)) //* 0 0:aload_0 //* 1 1:getfield #157 <Field ItemTouchHelper$Callback mCallback> //* 2 4:aload_0 //* 3 5:getfield #167 <Field RecyclerView mRecyclerView> //* 4 8:aload_1 //* 5 9:invokevirtual #704 <Method boolean ItemTouchHelper$Callback.hasSwipeFlag(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> //* 6 12:ifne 25 { Log.e("ItemTouchHelper", "Start swipe has been called but swiping is not enabled"); // 7 15:ldc1 #73 <String "ItemTouchHelper"> // 8 17:ldc2 #706 <String "Start swipe has been called but swiping is not enabled"> // 9 20:invokestatic #696 <Method int Log.e(String, String)> // 10 23:pop return; // 11 24:return } if(viewholder.itemView.getParent() != mRecyclerView) //* 12 25:aload_1 //* 13 26:getfield #279 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 14 29:invokevirtual #642 <Method ViewParent View.getParent()> //* 15 32:aload_0 //* 16 33:getfield #167 <Field RecyclerView mRecyclerView> //* 17 36:if_acmpeq 49 { Log.e("ItemTouchHelper", "Start swipe has been called with a view holder which is not a child of the RecyclerView controlled by this ItemTouchHelper."); // 18 39:ldc1 #73 <String "ItemTouchHelper"> // 19 41:ldc2 #708 <String "Start swipe has been called with a view holder which is not a child of the RecyclerView controlled by this ItemTouchHelper."> // 20 44:invokestatic #696 <Method int Log.e(String, String)> // 21 47:pop return; // 22 48:return } else { obtainVelocityTracker(); // 23 49:aload_0 // 24 50:invokevirtual #700 <Method void obtainVelocityTracker()> mDy = 0.0F; // 25 53:aload_0 // 26 54:fconst_0 // 27 55:putfield #219 <Field float mDy> mDx = 0.0F; // 28 58:aload_0 // 29 59:fconst_0 // 30 60:putfield #177 <Field float mDx> select(viewholder, 1); // 31 63:aload_0 // 32 64:aload_1 // 33 65:iconst_1 // 34 66:invokevirtual #481 <Method void select(android.support.v7.widget.RecyclerView$ViewHolder, int)> return; // 35 69:return } } void updateDxDy(MotionEvent motionevent, int i, int j) { float f = motionevent.getX(j); // 0 0:aload_1 // 1 1:iload_3 // 2 2:invokevirtual #344 <Method float MotionEvent.getX(int)> // 3 5:fstore 4 float f1 = motionevent.getY(j); // 4 7:aload_1 // 5 8:iload_3 // 6 9:invokevirtual #349 <Method float MotionEvent.getY(int)> // 7 12:fstore 5 mDx = f - mInitialTouchX; // 8 14:aload_0 // 9 15:fload 4 // 10 17:aload_0 // 11 18:getfield #346 <Field float mInitialTouchX> // 12 21:fsub // 13 22:putfield #177 <Field float mDx> mDy = f1 - mInitialTouchY; // 14 25:aload_0 // 15 26:fload 5 // 16 28:aload_0 // 17 29:getfield #351 <Field float mInitialTouchY> // 18 32:fsub // 19 33:putfield #219 <Field float mDy> if((i & 4) == 0) //* 20 36:iload_2 //* 21 37:iconst_4 //* 22 38:iand //* 23 39:ifne 54 mDx = Math.max(0.0F, mDx); // 24 42:aload_0 // 25 43:fconst_0 // 26 44:aload_0 // 27 45:getfield #177 <Field float mDx> // 28 48:invokestatic #714 <Method float Math.max(float, float)> // 29 51:putfield #177 <Field float mDx> if((i & 8) == 0) //* 30 54:iload_2 //* 31 55:bipush 8 //* 32 57:iand //* 33 58:ifne 73 mDx = Math.min(0.0F, mDx); // 34 61:aload_0 // 35 62:fconst_0 // 36 63:aload_0 // 37 64:getfield #177 <Field float mDx> // 38 67:invokestatic #717 <Method float Math.min(float, float)> // 39 70:putfield #177 <Field float mDx> if((i & 1) == 0) //* 40 73:iload_2 //* 41 74:iconst_1 //* 42 75:iand //* 43 76:ifne 91 mDy = Math.max(0.0F, mDy); // 44 79:aload_0 // 45 80:fconst_0 // 46 81:aload_0 // 47 82:getfield #219 <Field float mDy> // 48 85:invokestatic #714 <Method float Math.max(float, float)> // 49 88:putfield #219 <Field float mDy> if((i & 2) == 0) //* 50 91:iload_2 //* 51 92:iconst_2 //* 52 93:iand //* 53 94:ifne 109 mDy = Math.min(0.0F, mDy); // 54 97:aload_0 // 55 98:fconst_0 // 56 99:aload_0 // 57 100:getfield #219 <Field float mDy> // 58 103:invokestatic #717 <Method float Math.min(float, float)> // 59 106:putfield #219 <Field float mDy> // 60 109:return } static final int ACTION_MODE_DRAG_MASK = 0xff0000; private static final int ACTION_MODE_IDLE_MASK = 255; static final int ACTION_MODE_SWIPE_MASK = 65280; public static final int ACTION_STATE_DRAG = 2; public static final int ACTION_STATE_IDLE = 0; public static final int ACTION_STATE_SWIPE = 1; static final int ACTIVE_POINTER_ID_NONE = -1; public static final int ANIMATION_TYPE_DRAG = 8; public static final int ANIMATION_TYPE_SWIPE_CANCEL = 4; public static final int ANIMATION_TYPE_SWIPE_SUCCESS = 2; static final boolean DEBUG = false; static final int DIRECTION_FLAG_COUNT = 8; public static final int DOWN = 2; public static final int END = 32; public static final int LEFT = 4; private static final int PIXELS_PER_SECOND = 1000; public static final int RIGHT = 8; public static final int START = 16; static final String TAG = "ItemTouchHelper"; public static final int UP = 1; int mActionState; int mActivePointerId; Callback mCallback; private android.support.v7.widget.RecyclerView.ChildDrawingOrderCallback mChildDrawingOrderCallback; private List mDistances; private long mDragScrollStartTimeInMs; float mDx; float mDy; GestureDetectorCompat mGestureDetector; float mInitialTouchX; float mInitialTouchY; float mMaxSwipeVelocity; private final android.support.v7.widget.RecyclerView.OnItemTouchListener mOnItemTouchListener = new android.support.v7.widget.RecyclerView.OnItemTouchListener() { public boolean onInterceptTouchEvent(RecyclerView recyclerview, MotionEvent motionevent) { mGestureDetector.onTouchEvent(motionevent); // 0 0:aload_0 // 1 1:getfield #14 <Field ItemTouchHelper this$0> // 2 4:getfield #24 <Field GestureDetectorCompat ItemTouchHelper.mGestureDetector> // 3 7:aload_2 // 4 8:invokevirtual #30 <Method boolean GestureDetectorCompat.onTouchEvent(MotionEvent)> // 5 11:pop int i = motionevent.getActionMasked(); // 6 12:aload_2 // 7 13:invokevirtual #36 <Method int MotionEvent.getActionMasked()> // 8 16:istore_3 if(i == 0) //* 9 17:iload_3 //* 10 18:ifne 247 { mActivePointerId = motionevent.getPointerId(0); // 11 21:aload_0 // 12 22:getfield #14 <Field ItemTouchHelper this$0> // 13 25:aload_2 // 14 26:iconst_0 // 15 27:invokevirtual #40 <Method int MotionEvent.getPointerId(int)> // 16 30:putfield #44 <Field int ItemTouchHelper.mActivePointerId> mInitialTouchX = motionevent.getX(); // 17 33:aload_0 // 18 34:getfield #14 <Field ItemTouchHelper this$0> // 19 37:aload_2 // 20 38:invokevirtual #48 <Method float MotionEvent.getX()> // 21 41:putfield #52 <Field float ItemTouchHelper.mInitialTouchX> mInitialTouchY = motionevent.getY(); // 22 44:aload_0 // 23 45:getfield #14 <Field ItemTouchHelper this$0> // 24 48:aload_2 // 25 49:invokevirtual #55 <Method float MotionEvent.getY()> // 26 52:putfield #58 <Field float ItemTouchHelper.mInitialTouchY> obtainVelocityTracker(); // 27 55:aload_0 // 28 56:getfield #14 <Field ItemTouchHelper this$0> // 29 59:invokevirtual #61 <Method void ItemTouchHelper.obtainVelocityTracker()> if(mSelected == null) //* 30 62:aload_0 //* 31 63:getfield #14 <Field ItemTouchHelper this$0> //* 32 66:getfield #65 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper.mSelected> //* 33 69:ifnonnull 214 { recyclerview = ((RecyclerView) (findAnimation(motionevent))); // 34 72:aload_0 // 35 73:getfield #14 <Field ItemTouchHelper this$0> // 36 76:aload_2 // 37 77:invokevirtual #69 <Method ItemTouchHelper$RecoverAnimation ItemTouchHelper.findAnimation(MotionEvent)> // 38 80:astore_1 if(recyclerview != null) //* 39 81:aload_1 //* 40 82:ifnull 214 { ItemTouchHelper itemtouchhelper = ItemTouchHelper.this; // 41 85:aload_0 // 42 86:getfield #14 <Field ItemTouchHelper this$0> // 43 89:astore 5 itemtouchhelper.mInitialTouchX = itemtouchhelper.mInitialTouchX - ((RecoverAnimation) (recyclerview)).mX; // 44 91:aload 5 // 45 93:aload 5 // 46 95:getfield #52 <Field float ItemTouchHelper.mInitialTouchX> // 47 98:aload_1 // 48 99:getfield #74 <Field float ItemTouchHelper$RecoverAnimation.mX> // 49 102:fsub // 50 103:putfield #52 <Field float ItemTouchHelper.mInitialTouchX> itemtouchhelper = ItemTouchHelper.this; // 51 106:aload_0 // 52 107:getfield #14 <Field ItemTouchHelper this$0> // 53 110:astore 5 itemtouchhelper.mInitialTouchY = itemtouchhelper.mInitialTouchY - ((RecoverAnimation) (recyclerview)).mY; // 54 112:aload 5 // 55 114:aload 5 // 56 116:getfield #58 <Field float ItemTouchHelper.mInitialTouchY> // 57 119:aload_1 // 58 120:getfield #77 <Field float ItemTouchHelper$RecoverAnimation.mY> // 59 123:fsub // 60 124:putfield #58 <Field float ItemTouchHelper.mInitialTouchY> endRecoverAnimation(((RecoverAnimation) (recyclerview)).mViewHolder, true); // 61 127:aload_0 // 62 128:getfield #14 <Field ItemTouchHelper this$0> // 63 131:aload_1 // 64 132:getfield #80 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 65 135:iconst_1 // 66 136:invokevirtual #84 <Method int ItemTouchHelper.endRecoverAnimation(android.support.v7.widget.RecyclerView$ViewHolder, boolean)> // 67 139:pop if(mPendingCleanup.remove(((Object) (((RecoverAnimation) (recyclerview)).mViewHolder.itemView)))) //* 68 140:aload_0 //* 69 141:getfield #14 <Field ItemTouchHelper this$0> //* 70 144:getfield #88 <Field List ItemTouchHelper.mPendingCleanup> //* 71 147:aload_1 //* 72 148:getfield #80 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> //* 73 151:getfield #94 <Field View android.support.v7.widget.RecyclerView$ViewHolder.itemView> //* 74 154:invokeinterface #100 <Method boolean List.remove(Object)> //* 75 159:ifeq 183 mCallback.clearView(mRecyclerView, ((RecoverAnimation) (recyclerview)).mViewHolder); // 76 162:aload_0 // 77 163:getfield #14 <Field ItemTouchHelper this$0> // 78 166:getfield #104 <Field ItemTouchHelper$Callback ItemTouchHelper.mCallback> // 79 169:aload_0 // 80 170:getfield #14 <Field ItemTouchHelper this$0> // 81 173:getfield #108 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 82 176:aload_1 // 83 177:getfield #80 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 84 180:invokevirtual #114 <Method void ItemTouchHelper$Callback.clearView(RecyclerView, android.support.v7.widget.RecyclerView$ViewHolder)> select(((RecoverAnimation) (recyclerview)).mViewHolder, ((RecoverAnimation) (recyclerview)).mActionState); // 85 183:aload_0 // 86 184:getfield #14 <Field ItemTouchHelper this$0> // 87 187:aload_1 // 88 188:getfield #80 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper$RecoverAnimation.mViewHolder> // 89 191:aload_1 // 90 192:getfield #117 <Field int ItemTouchHelper$RecoverAnimation.mActionState> // 91 195:invokevirtual #121 <Method void ItemTouchHelper.select(android.support.v7.widget.RecyclerView$ViewHolder, int)> updateDxDy(motionevent, mSelectedFlags, 0); // 92 198:aload_0 // 93 199:getfield #14 <Field ItemTouchHelper this$0> // 94 202:aload_2 // 95 203:aload_0 // 96 204:getfield #14 <Field ItemTouchHelper this$0> // 97 207:getfield #124 <Field int ItemTouchHelper.mSelectedFlags> // 98 210:iconst_0 // 99 211:invokevirtual #128 <Method void ItemTouchHelper.updateDxDy(MotionEvent, int, int)> } } } else //* 100 214:aload_0 //* 101 215:getfield #14 <Field ItemTouchHelper this$0> //* 102 218:getfield #132 <Field VelocityTracker ItemTouchHelper.mVelocityTracker> //* 103 221:ifnull 235 //* 104 224:aload_0 //* 105 225:getfield #14 <Field ItemTouchHelper this$0> //* 106 228:getfield #132 <Field VelocityTracker ItemTouchHelper.mVelocityTracker> //* 107 231:aload_2 //* 108 232:invokevirtual #138 <Method void VelocityTracker.addMovement(MotionEvent)> //* 109 235:aload_0 //* 110 236:getfield #14 <Field ItemTouchHelper this$0> //* 111 239:getfield #65 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper.mSelected> //* 112 242:ifnull 321 //* 113 245:iconst_1 //* 114 246:ireturn if(i == 3 || i == 1) //* 115 247:iload_3 //* 116 248:iconst_3 //* 117 249:icmpeq 257 //* 118 252:iload_3 //* 119 253:iconst_1 //* 120 254:icmpne 277 { mActivePointerId = -1; // 121 257:aload_0 // 122 258:getfield #14 <Field ItemTouchHelper this$0> // 123 261:iconst_m1 // 124 262:putfield #44 <Field int ItemTouchHelper.mActivePointerId> select(((android.support.v7.widget.RecyclerView.ViewHolder) (null)), 0); // 125 265:aload_0 // 126 266:getfield #14 <Field ItemTouchHelper this$0> // 127 269:aconst_null // 128 270:iconst_0 // 129 271:invokevirtual #121 <Method void ItemTouchHelper.select(android.support.v7.widget.RecyclerView$ViewHolder, int)> } else //* 130 274:goto 214 if(mActivePointerId != -1) //* 131 277:aload_0 //* 132 278:getfield #14 <Field ItemTouchHelper this$0> //* 133 281:getfield #44 <Field int ItemTouchHelper.mActivePointerId> //* 134 284:iconst_m1 //* 135 285:icmpeq 214 { int j = motionevent.findPointerIndex(mActivePointerId); // 136 288:aload_2 // 137 289:aload_0 // 138 290:getfield #14 <Field ItemTouchHelper this$0> // 139 293:getfield #44 <Field int ItemTouchHelper.mActivePointerId> // 140 296:invokevirtual #141 <Method int MotionEvent.findPointerIndex(int)> // 141 299:istore 4 if(j >= 0) //* 142 301:iload 4 //* 143 303:iflt 214 checkSelectForSwipe(i, motionevent, j); // 144 306:aload_0 // 145 307:getfield #14 <Field ItemTouchHelper this$0> // 146 310:iload_3 // 147 311:aload_2 // 148 312:iload 4 // 149 314:invokevirtual #145 <Method boolean ItemTouchHelper.checkSelectForSwipe(int, MotionEvent, int)> // 150 317:pop } if(mVelocityTracker != null) mVelocityTracker.addMovement(motionevent); return mSelected != null; // 151 318:goto 214 // 152 321:iconst_0 // 153 322:ireturn } public void onRequestDisallowInterceptTouchEvent(boolean flag) { if(!flag) //* 0 0:iload_1 //* 1 1:ifne 5 { return; // 2 4:return } else { select(((android.support.v7.widget.RecyclerView.ViewHolder) (null)), 0); // 3 5:aload_0 // 4 6:getfield #14 <Field ItemTouchHelper this$0> // 5 9:aconst_null // 6 10:iconst_0 // 7 11:invokevirtual #121 <Method void ItemTouchHelper.select(android.support.v7.widget.RecyclerView$ViewHolder, int)> return; // 8 14:return } } public void onTouchEvent(RecyclerView recyclerview, MotionEvent motionevent) { int i; i = 0; // 0 0:iconst_0 // 1 1:istore_3 mGestureDetector.onTouchEvent(motionevent); // 2 2:aload_0 // 3 3:getfield #14 <Field ItemTouchHelper this$0> // 4 6:getfield #24 <Field GestureDetectorCompat ItemTouchHelper.mGestureDetector> // 5 9:aload_2 // 6 10:invokevirtual #30 <Method boolean GestureDetectorCompat.onTouchEvent(MotionEvent)> // 7 13:pop if(mVelocityTracker != null) //* 8 14:aload_0 //* 9 15:getfield #14 <Field ItemTouchHelper this$0> //* 10 18:getfield #132 <Field VelocityTracker ItemTouchHelper.mVelocityTracker> //* 11 21:ifnull 35 mVelocityTracker.addMovement(motionevent); // 12 24:aload_0 // 13 25:getfield #14 <Field ItemTouchHelper this$0> // 14 28:getfield #132 <Field VelocityTracker ItemTouchHelper.mVelocityTracker> // 15 31:aload_2 // 16 32:invokevirtual #138 <Method void VelocityTracker.addMovement(MotionEvent)> if(mActivePointerId != -1) goto _L2; else goto _L1 // 17 35:aload_0 // 18 36:getfield #14 <Field ItemTouchHelper this$0> // 19 39:getfield #44 <Field int ItemTouchHelper.mActivePointerId> // 20 42:iconst_m1 // 21 43:icmpne 47 _L1: return; // 22 46:return _L2: int j; int k; j = motionevent.getActionMasked(); // 23 47:aload_2 // 24 48:invokevirtual #36 <Method int MotionEvent.getActionMasked()> // 25 51:istore 4 k = motionevent.findPointerIndex(mActivePointerId); // 26 53:aload_2 // 27 54:aload_0 // 28 55:getfield #14 <Field ItemTouchHelper this$0> // 29 58:getfield #44 <Field int ItemTouchHelper.mActivePointerId> // 30 61:invokevirtual #141 <Method int MotionEvent.findPointerIndex(int)> // 31 64:istore 5 if(k >= 0) //* 32 66:iload 5 //* 33 68:iflt 84 checkSelectForSwipe(j, motionevent, k); // 34 71:aload_0 // 35 72:getfield #14 <Field ItemTouchHelper this$0> // 36 75:iload 4 // 37 77:aload_2 // 38 78:iload 5 // 39 80:invokevirtual #145 <Method boolean ItemTouchHelper.checkSelectForSwipe(int, MotionEvent, int)> // 40 83:pop recyclerview = ((RecyclerView) (mSelected)); // 41 84:aload_0 // 42 85:getfield #14 <Field ItemTouchHelper this$0> // 43 88:getfield #65 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper.mSelected> // 44 91:astore_1 if(recyclerview == null) goto _L1; else goto _L3 // 45 92:aload_1 // 46 93:ifnull 46 _L3: j; // 47 96:iload 4 JVM INSTR tableswitch 1 6: default 136 // 1 137 // 2 155 // 3 226 // 4 136 // 5 136 // 6 249; // 48 98:tableswitch 1 6: default 136 // 1 137 // 2 155 // 3 226 // 4 136 // 5 136 // 6 249 goto _L4 _L5 _L6 _L7 _L4 _L4 _L8 _L4: return; // 49 136:return _L5: select(((android.support.v7.widget.RecyclerView.ViewHolder) (null)), 0); // 50 137:aload_0 // 51 138:getfield #14 <Field ItemTouchHelper this$0> // 52 141:aconst_null // 53 142:iconst_0 // 54 143:invokevirtual #121 <Method void ItemTouchHelper.select(android.support.v7.widget.RecyclerView$ViewHolder, int)> mActivePointerId = -1; // 55 146:aload_0 // 56 147:getfield #14 <Field ItemTouchHelper this$0> // 57 150:iconst_m1 // 58 151:putfield #44 <Field int ItemTouchHelper.mActivePointerId> return; // 59 154:return _L6: if(k >= 0) //* 60 155:iload 5 //* 61 157:iflt 46 { updateDxDy(motionevent, mSelectedFlags, k); // 62 160:aload_0 // 63 161:getfield #14 <Field ItemTouchHelper this$0> // 64 164:aload_2 // 65 165:aload_0 // 66 166:getfield #14 <Field ItemTouchHelper this$0> // 67 169:getfield #124 <Field int ItemTouchHelper.mSelectedFlags> // 68 172:iload 5 // 69 174:invokevirtual #128 <Method void ItemTouchHelper.updateDxDy(MotionEvent, int, int)> moveIfNecessary(((android.support.v7.widget.RecyclerView.ViewHolder) (recyclerview))); // 70 177:aload_0 // 71 178:getfield #14 <Field ItemTouchHelper this$0> // 72 181:aload_1 // 73 182:invokevirtual #152 <Method void ItemTouchHelper.moveIfNecessary(android.support.v7.widget.RecyclerView$ViewHolder)> mRecyclerView.removeCallbacks(mScrollRunnable); // 74 185:aload_0 // 75 186:getfield #14 <Field ItemTouchHelper this$0> // 76 189:getfield #108 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 77 192:aload_0 // 78 193:getfield #14 <Field ItemTouchHelper this$0> // 79 196:getfield #156 <Field Runnable ItemTouchHelper.mScrollRunnable> // 80 199:invokevirtual #162 <Method boolean RecyclerView.removeCallbacks(Runnable)> // 81 202:pop mScrollRunnable.run(); // 82 203:aload_0 // 83 204:getfield #14 <Field ItemTouchHelper this$0> // 84 207:getfield #156 <Field Runnable ItemTouchHelper.mScrollRunnable> // 85 210:invokeinterface #167 <Method void Runnable.run()> mRecyclerView.invalidate(); // 86 215:aload_0 // 87 216:getfield #14 <Field ItemTouchHelper this$0> // 88 219:getfield #108 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 89 222:invokevirtual #170 <Method void RecyclerView.invalidate()> return; // 90 225:return } break; /* Loop/switch isn't completed */ _L7: if(mVelocityTracker != null) //* 91 226:aload_0 //* 92 227:getfield #14 <Field ItemTouchHelper this$0> //* 93 230:getfield #132 <Field VelocityTracker ItemTouchHelper.mVelocityTracker> //* 94 233:ifnull 137 mVelocityTracker.clear(); // 95 236:aload_0 // 96 237:getfield #14 <Field ItemTouchHelper this$0> // 97 240:getfield #132 <Field VelocityTracker ItemTouchHelper.mVelocityTracker> // 98 243:invokevirtual #173 <Method void VelocityTracker.clear()> if(true) goto _L5; else goto _L9 // 99 246:goto 137 _L9: break; /* Loop/switch isn't completed */ _L8: j = motionevent.getActionIndex(); // 100 249:aload_2 // 101 250:invokevirtual #176 <Method int MotionEvent.getActionIndex()> // 102 253:istore 4 continue; /* Loop/switch isn't completed */ if(true) goto _L1; else goto _L10 _L10: if(motionevent.getPointerId(j) != mActivePointerId) goto _L1; else goto _L11 // 103 255:aload_2 // 104 256:iload 4 // 105 258:invokevirtual #40 <Method int MotionEvent.getPointerId(int)> // 106 261:aload_0 // 107 262:getfield #14 <Field ItemTouchHelper this$0> // 108 265:getfield #44 <Field int ItemTouchHelper.mActivePointerId> // 109 268:icmpne 46 _L11: if(j == 0) //* 110 271:iload 4 //* 111 273:ifne 278 i = 1; // 112 276:iconst_1 // 113 277:istore_3 mActivePointerId = motionevent.getPointerId(i); // 114 278:aload_0 // 115 279:getfield #14 <Field ItemTouchHelper this$0> // 116 282:aload_2 // 117 283:iload_3 // 118 284:invokevirtual #40 <Method int MotionEvent.getPointerId(int)> // 119 287:putfield #44 <Field int ItemTouchHelper.mActivePointerId> updateDxDy(motionevent, mSelectedFlags, j); // 120 290:aload_0 // 121 291:getfield #14 <Field ItemTouchHelper this$0> // 122 294:aload_2 // 123 295:aload_0 // 124 296:getfield #14 <Field ItemTouchHelper this$0> // 125 299:getfield #124 <Field int ItemTouchHelper.mSelectedFlags> // 126 302:iload 4 // 127 304:invokevirtual #128 <Method void ItemTouchHelper.updateDxDy(MotionEvent, int, int)> return; // 128 307:return } final ItemTouchHelper this$0; { this$0 = ItemTouchHelper.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #14 <Field ItemTouchHelper this$0> super(); // 3 5:aload_0 // 4 6:invokespecial #17 <Method void Object()> // 5 9:return } } ; View mOverdrawChild; int mOverdrawChildPosition; final List mPendingCleanup = new ArrayList(); List mRecoverAnimations; RecyclerView mRecyclerView; final Runnable mScrollRunnable = new Runnable() { public void run() { if(mSelected != null && scrollIfNecessary()) //* 0 0:aload_0 //* 1 1:getfield #14 <Field ItemTouchHelper this$0> //* 2 4:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper.mSelected> //* 3 7:ifnull 73 //* 4 10:aload_0 //* 5 11:getfield #14 <Field ItemTouchHelper this$0> //* 6 14:invokevirtual #27 <Method boolean ItemTouchHelper.scrollIfNecessary()> //* 7 17:ifeq 73 { if(mSelected != null) //* 8 20:aload_0 //* 9 21:getfield #14 <Field ItemTouchHelper this$0> //* 10 24:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper.mSelected> //* 11 27:ifnull 44 moveIfNecessary(mSelected); // 12 30:aload_0 // 13 31:getfield #14 <Field ItemTouchHelper this$0> // 14 34:aload_0 // 15 35:getfield #14 <Field ItemTouchHelper this$0> // 16 38:getfield #23 <Field android.support.v7.widget.RecyclerView$ViewHolder ItemTouchHelper.mSelected> // 17 41:invokevirtual #31 <Method void ItemTouchHelper.moveIfNecessary(android.support.v7.widget.RecyclerView$ViewHolder)> mRecyclerView.removeCallbacks(mScrollRunnable); // 18 44:aload_0 // 19 45:getfield #14 <Field ItemTouchHelper this$0> // 20 48:getfield #35 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 21 51:aload_0 // 22 52:getfield #14 <Field ItemTouchHelper this$0> // 23 55:getfield #39 <Field Runnable ItemTouchHelper.mScrollRunnable> // 24 58:invokevirtual #45 <Method boolean RecyclerView.removeCallbacks(Runnable)> // 25 61:pop ViewCompat.postOnAnimation(((View) (mRecyclerView)), ((Runnable) (this))); // 26 62:aload_0 // 27 63:getfield #14 <Field ItemTouchHelper this$0> // 28 66:getfield #35 <Field RecyclerView ItemTouchHelper.mRecyclerView> // 29 69:aload_0 // 30 70:invokestatic #51 <Method void ViewCompat.postOnAnimation(View, Runnable)> } // 31 73:return } final ItemTouchHelper this$0; { this$0 = ItemTouchHelper.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #14 <Field ItemTouchHelper this$0> super(); // 3 5:aload_0 // 4 6:invokespecial #17 <Method void Object()> // 5 9:return } } ; android.support.v7.widget.RecyclerView.ViewHolder mSelected; int mSelectedFlags; float mSelectedStartX; float mSelectedStartY; private int mSlop; private List mSwapTargets; float mSwipeEscapeVelocity; private final float mTmpPosition[] = new float[2]; private Rect mTmpRect; VelocityTracker mVelocityTracker; // Unreferenced inner class android/support/v7/widget/helper/ItemTouchHelper$RecoverAnimation$1 /* anonymous class */ class RecoverAnimation._cls1 implements android.animation.ValueAnimator.AnimatorUpdateListener { public void onAnimationUpdate(ValueAnimator valueanimator) { setFraction(valueanimator.getAnimatedFraction()); // 0 0:aload_0 // 1 1:getfield #19 <Field ItemTouchHelper$RecoverAnimation this$0> // 2 4:aload_1 // 3 5:invokevirtual #31 <Method float ValueAnimator.getAnimatedFraction()> // 4 8:invokevirtual #35 <Method void ItemTouchHelper$RecoverAnimation.setFraction(float)> // 5 11:return } final RecoverAnimation this$0; { this$0 = RecoverAnimation.this; // 0 0:aload_0 // 1 1:aload_1 // 2 2:putfield #19 <Field ItemTouchHelper$RecoverAnimation this$0> super(); // 3 5:aload_0 // 4 6:invokespecial #22 <Method void Object()> // 5 9:return } } }
41.387205
228
0.555013
629118111a8508ab5c00eda997c21443b60b1a2a
8,369
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class Wejście { public static void parseInput(String nazwaPliku) throws FileNotFoundException { File plik = new File(nazwaPliku); Scanner scanner = new Scanner(plik); ArrayList<Partia> partie = new ArrayList<>(); ArrayList<OkrągWyborczy> okręgi = new ArrayList<>(); ArrayList<Działanie> działania = new ArrayList<>(); int liczbaOkręgów, liczbaPartii, liczbaDziałań, liczbaCech; liczbaOkręgów = scanner.nextInt(); liczbaPartii = scanner.nextInt(); liczbaDziałań = scanner.nextInt(); liczbaCech = scanner.nextInt(); int liczbaScalonychOkręgów = scanner.nextInt(); String pary = scanner.nextLine(); int index = 2; int pozycjaPrzecinka = 2; String nazwyPartii[] = new String[liczbaPartii]; int budżetyPartii[] = new int[liczbaPartii]; int scaloneOkręgi[] = new int[liczbaScalonychOkręgów]; System.out.println(pary); //Wczytywanie par do scalenia for(int i = 0; i < liczbaScalonychOkręgów; i++) { while(pary.charAt(pozycjaPrzecinka) != ',') pozycjaPrzecinka++; scaloneOkręgi[i] = Integer.parseInt(pary.substring(index, pozycjaPrzecinka)); System.out.println(scaloneOkręgi[i]); index += (6 + pozycjaPrzecinka - index - 1); // Przesuwamy indeks o 6 pozycji + szerokość liczby dla liczb wielucyfrowych pozycjaPrzecinka++; } //Wczytywanie nazw partii for(int i = 0; i < liczbaPartii; i++) { nazwyPartii[i] = scanner.next(); } //Wczytywanie budżetów partii for(int i = 0; i < liczbaPartii; i++) { budżetyPartii[i] = scanner.nextInt(); } //Wczytywanie strategii partii for(int i = 0; i < liczbaPartii; i++) { Partia partia; switch(scanner.next()) { case "R": partia = new PartiaRozmachowa(nazwyPartii[i], budżetyPartii[i]); partie.add(partia); break; case "S": partia = new PartiaSkromna(nazwyPartii[i], budżetyPartii[i]); partie.add(partia); break; case "Z": partia = new PartiaZachłanna(nazwyPartii[i], budżetyPartii[i]); partie.add(partia); break; case "W": partia = new PartiaLeniwa(nazwyPartii[i], budżetyPartii[i]); partie.add(partia); break; } } //Wczytywanie liczb wyborców partii for(int i = 0; i < liczbaOkręgów; i++) { OkrągWyborczy okrąg = new OkrągWyborczy(i + 1, scanner.nextInt()); okręgi.add(okrąg); } //Wczytywanie kandydatów for(int i = 0; i < liczbaOkręgów; i++) { OkrągWyborczy okrąg = okręgi.get(i); int liczbaKandydatów = okrąg.getLiczbaWyborców() / 10; for(int j = 0; j < liczbaPartii; j++) { for(int k = 0; k < liczbaKandydatów; k++) { String imię = scanner.next(); String nazwisko = scanner.next(); int numerOkręgu = scanner.nextInt(); String nazwaPartii = scanner.next(); int numerKandydata = scanner.nextInt(); int[] cechy = new int[liczbaCech]; for(int l = 0; l < liczbaCech; l++) { cechy[l] = scanner.nextInt(); } Kandydat kandydat = new Kandydat(imię, nazwisko, nazwaPartii, numerOkręgu, numerKandydata, cechy); okrąg.dodajKandydata(kandydat); } } } //Wczytywanie wyborców for(int i = 0; i < liczbaOkręgów; i++) { OkrągWyborczy okrąg = okręgi.get(i); int liczbaWyborców = okrąg.getLiczbaWyborców(); for(int j = 0; j < liczbaWyborców; j++) { String imię = scanner.next(); String nazwisko = scanner.next(); int numerOkręgu = scanner.nextInt(); int typWyborcy = scanner.nextInt(); String nazwaPartii; int numerKandydata; Wyborca wyborca; int numerCechy; int[] wagiCech = new int[liczbaCech]; switch(typWyborcy) { case 1: nazwaPartii = scanner.next(); wyborca = new WyborcaŻelaznyPartyjny(imię, nazwisko, numerOkręgu, nazwaPartii); okrąg.dodajWyborce(wyborca); break; case 2: nazwaPartii = scanner.next(); numerKandydata = scanner.nextInt(); wyborca = new WyborcaŻelaznyKandydata(imię, nazwisko, numerOkręgu, nazwaPartii, numerKandydata); okrąg.dodajWyborce(wyborca); break; case 3: numerCechy = scanner.nextInt(); wyborca = new WyborcaMinimalizującyJednocechowy(imię, nazwisko, numerOkręgu, numerCechy); okrąg.dodajWyborce(wyborca); break; case 4: numerCechy = scanner.nextInt(); wyborca = new WyborcaMaksymalizującyJednocechowy(imię, nazwisko, numerOkręgu, numerCechy); okrąg.dodajWyborce(wyborca); break; case 5: for(int k = 0; k < liczbaCech; k++) { wagiCech[k] = scanner.nextInt(); } wyborca = new WyborcaWszechstronny(imię, nazwisko, numerOkręgu, wagiCech); okrąg.dodajWyborce(wyborca); break; case 6: numerCechy = scanner.nextInt(); nazwaPartii = scanner.next(); wyborca = new WyborcaMinimalizującyJednocechowyPartyjny(imię, nazwisko, numerOkręgu, numerCechy, nazwaPartii); okrąg.dodajWyborce(wyborca); break; case 7: numerCechy = scanner.nextInt(); nazwaPartii = scanner.next(); wyborca = new WyborcaMaksymalizującyJednocechowyPartyjny(imię, nazwisko, numerOkręgu, numerCechy, nazwaPartii); okrąg.dodajWyborce(wyborca); break; case 8: for(int k = 0; k < liczbaCech; k++) { wagiCech[k] = scanner.nextInt(); } nazwaPartii = scanner.next(); wyborca = new WyborcaWszechstronnyPartyjny(imię, nazwisko, numerOkręgu, wagiCech, nazwaPartii); okrąg.dodajWyborce(wyborca); break; } } } //Wczytywanie działań for(int i = 0; i < liczbaDziałań; i++) { ArrayList<Integer> zmianyCech = new ArrayList<>(); for(int j = 0; j < liczbaCech; j++) { zmianyCech.add(scanner.nextInt()); } Działanie działanie = new Działanie(zmianyCech); działania.add(działanie); } //Scalenie okręgów i ustawianie tych o większym numerze na null for(int i = 0; i < liczbaScalonychOkręgów; i++) { OkrągWyborczy okrąg1 = okręgi.get(scaloneOkręgi[i] - 1); okrąg1.scal(okręgi.get(scaloneOkręgi[i])); okręgi.set(scaloneOkręgi[i], null); } Wybory wybory = new Wybory(partie, okręgi, działania); wybory.wykonaj(); } }
40.043062
135
0.492293
9002868726e6942cde052fe63d764dfcdb394775
1,287
/* * Copyright 2018-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package dev.miku.r2dbc.mysql.codec; import dev.miku.r2dbc.mysql.message.FieldValue; import dev.miku.r2dbc.mysql.message.ParameterValue; import dev.miku.r2dbc.mysql.util.ConnectionContext; import reactor.util.annotation.Nullable; import java.lang.reflect.Type; /** * Codec for some specific types. */ interface Codec<R, V extends FieldValue, T extends Type> { @Nullable R decode(V value, FieldInformation info, T target, boolean binary, ConnectionContext context); boolean canDecode(FieldValue value, FieldInformation info, Type target); boolean canEncode(Object value); ParameterValue encode(Object value, ConnectionContext context); }
32.175
98
0.756799
e6ec07c2c07e5bb03338ee5fcb390872e8093cb8
555
package methods; import java.util.Scanner; public class NxNMatrix { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int input = Integer.parseInt(scanner.nextLine()); printMatrix(input); } private static void printMatrix(int input) { for (int col = 0; col < input; col++) { for (int row = 1; row < input; row++) { System.out.print(input + " "); } System.out.println(input); } } }
21.346154
58
0.520721
fb17a87355c90e11cdf1da7226e91f928b1fc19c
2,089
/* * This file was automatically generated by EvoSuite * Sat Dec 07 15:41:17 GMT 2019 */ package View.ViewModel; import org.junit.Test; import static org.junit.Assert.*; import View.ViewModel.TimeInterval; import java.time.LocalDateTime; import java.time.ZoneOffset; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.mock.java.time.MockLocalDateTime; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = false, useJEE = true) public class TimeInterval_ESTest extends TimeInterval_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { ZoneOffset zoneOffset0 = ZoneOffset.ofTotalSeconds(1); LocalDateTime localDateTime0 = MockLocalDateTime.ofEpochSecond(2550L, 1, zoneOffset0); TimeInterval timeInterval0 = new TimeInterval(localDateTime0, localDateTime0); LocalDateTime localDateTime1 = timeInterval0.getInicio(); assertSame(localDateTime0, localDateTime1); } @Test(timeout = 4000) public void test1() throws Throwable { ZoneOffset zoneOffset0 = ZoneOffset.ofTotalSeconds(1); LocalDateTime localDateTime0 = MockLocalDateTime.ofEpochSecond(2550L, 1, zoneOffset0); TimeInterval timeInterval0 = new TimeInterval(localDateTime0, localDateTime0); LocalDateTime localDateTime1 = timeInterval0.getFim(); assertSame(localDateTime0, localDateTime1); } @Test(timeout = 4000) public void test2() throws Throwable { TimeInterval timeInterval0 = new TimeInterval((LocalDateTime) null, (LocalDateTime) null); LocalDateTime localDateTime0 = timeInterval0.getInicio(); assertNull(localDateTime0); } @Test(timeout = 4000) public void test3() throws Throwable { TimeInterval timeInterval0 = new TimeInterval((LocalDateTime) null, (LocalDateTime) null); LocalDateTime localDateTime0 = timeInterval0.getFim(); assertNull(localDateTime0); } }
39.415094
177
0.762087
5d0808aa88ec6b38c84c49aabad55d53ef842461
3,633
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.crnk.servlet; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import io.crnk.core.boot.CrnkBoot; import io.crnk.core.boot.CrnkProperties; import io.crnk.core.engine.dispatcher.RequestDispatcher; import io.crnk.core.engine.http.HttpHeaders; import io.crnk.core.engine.http.HttpRequestContextProvider; import io.crnk.core.engine.http.HttpStatus; import io.crnk.core.engine.internal.http.HttpRequestContextBaseAdapter; import io.crnk.core.engine.internal.http.JsonApiRequestProcessor; import io.crnk.servlet.internal.ServletModule; import io.crnk.servlet.internal.ServletPropertiesProvider; import io.crnk.servlet.internal.ServletRequestContext; /** * Abstract base servlet class to integrate with Crnk-core. * <p> * Child class can override {@link #initCrnk(CrnkBoot)} method and make use of CrnkBoot for further customizations. * </p> */ public class CrnkServlet extends HttpServlet { protected final transient CrnkBoot boot = new CrnkBoot(); private boolean acceptPlainJson; private String defaultCharacterEncoding = HttpHeaders.DEFAULT_CHARSET; @Override public void init() throws ServletException { boot.setPropertiesProvider(new ServletPropertiesProvider(getServletConfig())); acceptPlainJson = !Boolean.parseBoolean(boot.getPropertiesProvider().getProperty(CrnkProperties.REJECT_PLAIN_JSON)); HttpRequestContextProvider provider = boot.getModuleRegistry().getHttpRequestContextProvider(); boot.addModule(new ServletModule(provider)); initCrnk(boot); boot.boot(); } public String getDefaultCharacterEncoding() { return defaultCharacterEncoding; } public void setDefaultCharacterEncoding(String defaultCharacterEncoding) { this.defaultCharacterEncoding = defaultCharacterEncoding; } protected void initCrnk(CrnkBoot boot) { // nothing to do here } @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext servletContext = getServletContext(); ServletRequestContext context = new ServletRequestContext(servletContext, request, response, boot.getWebPathPrefix(), defaultCharacterEncoding); RequestDispatcher requestDispatcher = boot.getRequestDispatcher(); requestDispatcher.process(context); if (!context.checkAbort()) { HttpRequestContextBaseAdapter requestContext = new HttpRequestContextBaseAdapter(context); boolean jsonApiRequest = JsonApiRequestProcessor.isJsonApiRequest(requestContext, acceptPlainJson); response.setStatus(jsonApiRequest ? HttpStatus.NOT_FOUND_404 : HttpStatus.UNSUPPORTED_MEDIA_TYPE_415); } } public CrnkBoot getBoot() { return boot; } }
38.648936
146
0.803193
82dd1149260ece1f0b954caebdad8250014e7918
368
package person.pluto; import java.security.Key; import java.util.Base64; import person.pluto.natcross2.utils.AESUtil; public class TestMain { public static void main(String[] args) throws Exception { Key createKey = AESUtil.createKey(128); System.out.println(Base64.getEncoder().encodeToString(createKey.getEncoded())); } }
23
88
0.69837
690821b1e0bd3aacb7df28adedc46adcd51a062a
792
package io.choerodon.devops.domain.application.convertor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import io.choerodon.core.convertor.ConvertorI; import io.choerodon.devops.api.dto.AuthorDTO; import io.choerodon.devops.infra.dataobject.gitlab.AuthorDO; @Component public class AuthorConvertor implements ConvertorI<Object, AuthorDO, AuthorDTO> { @Override public AuthorDTO doToDto(AuthorDO dataObject) { AuthorDTO authorDTO = new AuthorDTO(); BeanUtils.copyProperties(dataObject, authorDTO); return authorDTO; } @Override public AuthorDO dtoToDo(AuthorDTO dto) { AuthorDO authorDO = new AuthorDO(); BeanUtils.copyProperties(dto, authorDO); return authorDO; } }
27.310345
81
0.744949
9a0a53f1d7b328340eabd280a207bf07e0aa3fa6
756
package com.ltud.food.Dialog; import android.app.Dialog; import android.content.Context; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import androidx.annotation.NonNull; import com.ltud.food.R; public class CustomProgressDialog extends Dialog { public CustomProgressDialog(@NonNull Context context) { super(context); WindowManager.LayoutParams params = getWindow().getAttributes(); params.gravity = Gravity.CENTER_HORIZONTAL; getWindow().setAttributes(params); getWindow().setBackgroundDrawableResource(android.R.color.transparent); setCancelable(false); setContentView(R.layout.progress_bar_layout); } }
28
79
0.752646
3ee91a6ff915facd0a8fac3be63c060b799d79f0
4,652
/* * Copyright 2011 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.drools.guvnor.client.widgets.wizards; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.Widget; import org.drools.guvnor.client.GuvnorEventBus; import org.drools.guvnor.client.explorer.ClientFactory; import org.uberfire.client.annotations.*; import org.uberfire.shared.mvp.PlaceRequest; import javax.enterprise.context.Dependent; import javax.inject.Inject; /** * The generic "Wizard" container, providing a left-hand side list of Page * titles, buttons to navigate the Wizard pages and a mechanism to display * different pages of the Wizard. */ @Dependent @WorkbenchScreen(identifier = "wizardPopup") public class WizardActivity implements WizardActivityView.Presenter, WizardPageStatusChangeEvent.Handler, WizardPageSelectedEvent.Handler { private WizardActivityView view; private Wizard wizard; private WizardContext context; private final GuvnorEventBus eventBus; private final ClientFactory clientFactory; @Inject public WizardActivity(ClientFactory clientFactory, GuvnorEventBus eventBus) { this.clientFactory = clientFactory; this.eventBus = eventBus; } @OnStart public void init(final PlaceRequest place) { //The context of this Wizard instance this.context = clientFactory.makeContext(place.getParameters()); //The generic view view = clientFactory.getNavigationViewFactory().getWizardView(context); //The specific "page factory" for a particular Wizard wizard = clientFactory.getWizardFactory().getWizard(context, this); view.setPresenter(this); } public void onStatusChange(WizardPageStatusChangeEvent event) { //The event might not have been raised by a page belonging to this Wizard instance if (event.getSource() != context) { return; } //Update the status of each belonging to this Wizard for (WizardPage wp : wizard.getPages()) { int index = wizard.getPages().indexOf(wp); view.setPageCompletionState(index, wp.isComplete()); } //Update the status of this Wizard view.setCompletionStatus(wizard.isComplete()); } public void onPageSelected(WizardPageSelectedEvent event) { if (event.getSource() != context) { return; } WizardPage page = event.getSelectedPage(); int index = wizard.getPages().indexOf(page); view.selectPage(index); } @WorkbenchPartTitle public String getTitle() { return wizard.getTitle(); } @WorkbenchPartView public IsWidget asWidget() { //Wire-up the events eventBus.addHandler(WizardPageStatusChangeEvent.TYPE, this); eventBus.addHandler(WizardPageSelectedEvent.TYPE, this); //Go, Go gadget Wizard view.setTitle(wizard.getTitle()); view.setPreferredHeight(wizard.getPreferredHeight()); view.setPreferredWidth(wizard.getPreferredWidth()); view.setPageTitles(wizard.getPages()); return view; } @OnReveal public void onReveal() { view.selectPage(0); } public void pageSelected(int pageNumber) { Widget w = wizard.getPageWidget(pageNumber); view.setBodyWidget(w); } public void complete() { wizard.complete(); } public void showSavingIndicator() { view.showSavingIndicator(); } public void hideSavingIndicator() { view.hideSavingIndicator(); } public void showDuplicateAssetNameError() { view.showDuplicateAssetNameError(); } public void showUnspecifiedCheckinError() { view.showUnspecifiedCheckinError(); } public void showCheckinError(String message) { view.showCheckinError(message); } public void hide() { view.hide(); } }
28.89441
90
0.670894
baf3fb9c2c9d11a343e3f786b4b1927741492ff8
8,015
package com.octo.android.robospice.sample.core; import java.util.Collections; import java.util.HashMap; import java.util.Locale; import java.util.Map; import roboguice.util.temp.Ln; import android.annotation.TargetApi; import android.app.Notification; import android.app.PendingIntent; import android.content.Intent; import android.os.Build; import android.support.v4.app.NotificationCompat; import com.octo.android.robospice.notification.SpiceServiceListenerNotificationService; import com.octo.android.robospice.request.CachedSpiceRequest; import com.octo.android.robospice.request.listener.RequestProgress; import com.octo.android.robospice.request.listener.RequestStatus; import com.octo.android.robospice.request.listener.SpiceServiceListener.RequestProcessingContext; import com.octo.android.robospice.sample.core.monitor.R; public class SampleMonitorService extends SpiceServiceListenerNotificationService { private static final int NOTIFICATION_ID_PROCESSED = 7000; private Map<Integer, NotificationCompat.Builder> mapRequestToNotificationBuilder = Collections.synchronizedMap(new HashMap<Integer, NotificationCompat.Builder>()); @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public Notification onCreateForegroundNotification() { NotificationCompat.Builder builder = new NotificationCompat.Builder(this)// .setContentTitle("RoboSpice monitor")// .setAutoCancel(true)// .setSmallIcon(android.R.drawable.ic_menu_camera); Notification notification = builder.getNotification(); if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN ) { notification.priority = Notification.PRIORITY_MIN; } return notification; } @Override public SpiceNotification onCreateNotificationForServiceStopped() { String message = "Service stopped"; NotificationCompat.Builder builder = new NotificationCompat.Builder(this)// .setContentTitle(getSpiceServiceClass().getSimpleName())// .setContentText(message)// .setAutoCancel(true)// .setSmallIcon(R.drawable.ic_launcher_robospice); return new SpiceNotification(DEFAULT_ROBOSPICE_NOTIFICATION_ID, builder.getNotification()); } @Override public SpiceNotification onCreateNotificationForRequestSucceeded(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d success", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message); } @Override public SpiceNotification onCreateNotificationForRequestCancelled(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d in canceled", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message); } @Override public SpiceNotification onCreateNotificationForRequestFailed(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d failure", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message); } @Override public SpiceNotification onCreateNotificationForRequestProgressUpdate(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d in progress", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message, requestProcessingContext.getRequestProgress()); } @Override public SpiceNotification onCreateNotificationForRequestAdded(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d added", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message); } @Override public SpiceNotification onCreateNotificationForRequestAggregated(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d aggregated", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message); } @Override public SpiceNotification onCreateNotificationForRequestNotFound(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d notfound", hashCode); Ln.d(message); return updateCustomSpiceNotification(hashCode, cachedSpiceRequest, message); } @Override public SpiceNotification onCreateNotificationForRequestProcessed(CachedSpiceRequest<?> cachedSpiceRequest, RequestProcessingContext requestProcessingContext) { int hashCode = cachedSpiceRequest.getRequestCacheKey().hashCode(); String message = String.format(Locale.US, "Request %d processed", hashCode); Ln.d(message); return updateCustomSpiceNotification(NOTIFICATION_ID_PROCESSED, cachedSpiceRequest, message); } private SpiceNotification createCustomSpiceNotification(int id, CachedSpiceRequest<?> cachedSpiceRequest, String text) { Ln.d("Create notification " + id); Intent intent = new Intent(SampleMonitorService.this, SampleSpiceActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(SampleMonitorService.this, 06, intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(this)// .setContentTitle(getSpiceServiceClass().getSimpleName())// .setContentIntent(pendingIntent)// .setContentText(text)// .setAutoCancel(true)// .setSmallIcon(R.drawable.ic_launcher_robospice); mapRequestToNotificationBuilder.put(cachedSpiceRequest.hashCode(), builder); return new SpiceNotification(id, builder.getNotification()); } private SpiceNotification updateCustomSpiceNotification(int id, CachedSpiceRequest<?> cachedSpiceRequest, String text, RequestProgress progress) { String progressMessage = text; if( progress.getStatus() == RequestStatus.LOADING_FROM_NETWORK) { progressMessage += String.format(Locale.US,"(%02d%%)", (int)(100*progress.getProgress())); } return updateCustomSpiceNotification(id, cachedSpiceRequest, progressMessage); } private SpiceNotification updateCustomSpiceNotification(int id, CachedSpiceRequest<?> cachedSpiceRequest, String text) { NotificationCompat.Builder builder = mapRequestToNotificationBuilder.get(cachedSpiceRequest.hashCode()); if( builder == null ) { createCustomSpiceNotification(id, cachedSpiceRequest, text); builder = mapRequestToNotificationBuilder.get(cachedSpiceRequest.hashCode()); } else { builder.setContentText(text); Ln.d("Updated notification " + id); } return new SpiceNotification(id, builder.getNotification()); } }
51.050955
168
0.75471
ce76ea61653a166f5ea4663acae8ed6b0c8b6c00
6,300
package com.codahale.metrics.sigar; import java.util.ArrayList; import java.util.List; import org.hyperic.sigar.CpuInfo; import org.hyperic.sigar.CpuPerc; import org.hyperic.sigar.Sigar; import org.hyperic.sigar.SigarException; import com.codahale.metrics.Gauge; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.RatioGauge; public class CpuMetrics extends AbstractSigarMetric { private static final long HACK_DELAY_MILLIS = 1000; private final CpuInfo info; public static final class CpuTime { private final double user; private final double sys; private final double nice; private final double waiting; private final double idle; private final double irq; public CpuTime( // double user, double sys, // double nice, double waiting, // double idle, double irq) { this.user = user; this.sys = sys; this.nice = nice; this.waiting = waiting; this.idle = idle; this.irq = irq; } public static CpuTime fromSigarBean(CpuPerc cp) { return new CpuTime( // cp.getUser(), cp.getSys(), // cp.getNice(), cp.getWait(), // cp.getIdle(), cp.getIrq()); } public double user() { return user; } public double sys() { return sys; } public double nice() { return nice; } public double waiting() { return waiting; } public double idle() { return idle; } public double irq() { return irq; } } public void registerGauges(MetricRegistry registry) { registerTotalCores(registry); registerPhysicalCpus(registry); registerCpuTimeUserPercent(registry); registerCpuTimeSysPercent(registry); } public void registerTotalCores(MetricRegistry registry) { registerTotalCores(registry, MetricRegistry.name(getClass(), "total-cores")); } public void registerTotalCores(MetricRegistry registry, String name) { registry.register(name, new Gauge<Integer>() { public Integer getValue() { return totalCoreCount(); } }); } public void registerPhysicalCpus(MetricRegistry registry) { registerPhysicalCpus(registry, MetricRegistry.name(getClass(), "physical-cpus")); } public void registerPhysicalCpus(MetricRegistry registry, String name) { registry.register(name, new Gauge<Integer>() { public Integer getValue() { return physicalCpuCount(); } }); } public void registerCpuTimeUserPercent(MetricRegistry registry) { registerCpuTimeUserPercent(registry, MetricRegistry.name(getClass(), "cpu-time-user-percent")); } public void registerCpuTimeUserPercent(MetricRegistry registry, String name) { registry.register(name, new RatioGauge() { @Override protected Ratio getRatio() { return Ratio.of(getNumerator(), 1.0); } private double getNumerator() { List<CpuTime> cpus = cpus(); double userTime = 0.0; for (CpuTime cpu : cpus) { userTime += cpu.user(); } return userTime; } }); } public void registerCpuTimeSysPercent(MetricRegistry registry) { registerCpuTimeSysPercent(registry, MetricRegistry.name(getClass(), "cpu-time-sys-percent")); } public void registerCpuTimeSysPercent(MetricRegistry registry, String name) { registry.register(name, new RatioGauge() { @Override protected Ratio getRatio() { return Ratio.of(getNumerator(), 1.0); } private double getNumerator() { List<CpuTime> cpus = cpus(); double userTime = 0.0; for (CpuTime cpu : cpus) { userTime += cpu.sys(); } return userTime; } }); } protected CpuMetrics(Sigar sigar) { super(sigar); info = cpuInfo(); } public int totalCoreCount() { if (info == null) { return -1; } return info.getTotalCores(); } public int physicalCpuCount() { if (info == null) { return -1; } return info.getTotalSockets(); } public List<CpuTime> cpus() { List<CpuTime> result = new ArrayList<CpuTime>(); CpuPerc[] cpus = cpuPercList(); if (cpus == null) { return result; } if (Double.isNaN(cpus[0].getIdle())) { /* * XXX: Hacky workaround for strange Sigar behaviour. * If you call sigar.getCpuPerfList() too often(?), * it returns a steaming pile of NaNs. * * See suspicious code here: * https://github.com/hyperic/sigar/blob/master/bindings/java/src/org/hyperic/sigar/Sigar.java#L345-348 * */ try { Thread.sleep(HACK_DELAY_MILLIS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return result; } cpus = cpuPercList(); if (cpus == null) { return result; } } for (CpuPerc cp : cpus) { result.add(CpuTime.fromSigarBean(cp)); } return result; } private CpuInfo cpuInfo() { try { CpuInfo[] infos = sigar.getCpuInfoList(); if (infos == null || infos.length == 0) { return null; } return infos[0]; } catch (SigarException e) { // give up return null; } } private CpuPerc[] cpuPercList() { CpuPerc[] cpus = null; try { cpus = sigar.getCpuPercList(); } catch (SigarException e) { // give up } if (cpus == null || cpus.length == 0) { return null; } return cpus; } }
29.85782
115
0.543492
5dc54ac61cd7a22b8b56fb44ad22bdb94efa7bae
320
package system.db.dao.vo; /** * * @author wangchunzi */ public class CID { public final Class c; public final String id; public CID(Class c, String id) { this.c = c; this.id = id; } public CID(Class c) { this.c = c; this.id = null; } }
14.545455
37
0.48125
76c5f34aa1445fcd6b2c119adca01561bb8ff61b
9,900
/* * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.opentelemetry.auto.instrumentation.netty.v3_8; import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed; import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.implementsInterface; import static net.bytebuddy.matcher.ElementMatchers.isMethod; import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith; import static net.bytebuddy.matcher.ElementMatchers.named; import static net.bytebuddy.matcher.ElementMatchers.takesArgument; import com.google.auto.service.AutoService; import io.opentelemetry.auto.bootstrap.CallDepthThreadLocalMap; import io.opentelemetry.auto.bootstrap.ContextStore; import io.opentelemetry.auto.bootstrap.InstrumentationContext; import io.opentelemetry.auto.instrumentation.netty.v3_8.client.HttpClientRequestTracingHandler; import io.opentelemetry.auto.instrumentation.netty.v3_8.client.HttpClientResponseTracingHandler; import io.opentelemetry.auto.instrumentation.netty.v3_8.client.HttpClientTracingHandler; import io.opentelemetry.auto.instrumentation.netty.v3_8.server.HttpServerRequestTracingHandler; import io.opentelemetry.auto.instrumentation.netty.v3_8.server.HttpServerResponseTracingHandler; import io.opentelemetry.auto.instrumentation.netty.v3_8.server.HttpServerTracingHandler; import io.opentelemetry.auto.tooling.Instrumenter; import java.util.Collections; import java.util.HashMap; import java.util.Map; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandler; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.http.HttpClientCodec; import org.jboss.netty.handler.codec.http.HttpRequestDecoder; import org.jboss.netty.handler.codec.http.HttpRequestEncoder; import org.jboss.netty.handler.codec.http.HttpResponseDecoder; import org.jboss.netty.handler.codec.http.HttpResponseEncoder; import org.jboss.netty.handler.codec.http.HttpServerCodec; @AutoService(Instrumenter.class) public class NettyChannelPipelineInstrumentation extends Instrumenter.Default { static final String INSTRUMENTATION_NAME = "netty"; static final String[] ADDITIONAL_INSTRUMENTATION_NAMES = {"netty-3.8"}; public NettyChannelPipelineInstrumentation() { super(INSTRUMENTATION_NAME, ADDITIONAL_INSTRUMENTATION_NAMES); } @Override public ElementMatcher<ClassLoader> classLoaderMatcher() { // Optimization for expensive typeMatcher. return hasClassesNamed("org.jboss.netty.channel.ChannelPipeline"); } @Override public ElementMatcher<TypeDescription> typeMatcher() { return implementsInterface(named("org.jboss.netty.channel.ChannelPipeline")); } @Override public String[] helperClassNames() { return new String[] { packageName + ".AbstractNettyAdvice", packageName + ".ChannelTraceContext", packageName + ".ChannelTraceContext$Factory", NettyChannelPipelineInstrumentation.class.getName() + "$ChannelPipelineAdviceUtil", // Util packageName + ".util.CombinedSimpleChannelHandler", // client helpers packageName + ".client.NettyHttpClientDecorator", packageName + ".client.NettyResponseInjectAdapter", packageName + ".client.HttpClientRequestTracingHandler", packageName + ".client.HttpClientResponseTracingHandler", packageName + ".client.HttpClientTracingHandler", // server helpers packageName + ".server.NettyHttpServerDecorator", packageName + ".server.NettyRequestExtractAdapter", packageName + ".server.HttpServerRequestTracingHandler", packageName + ".server.HttpServerResponseTracingHandler", packageName + ".server.HttpServerTracingHandler" }; } @Override public Map<? extends ElementMatcher<? super MethodDescription>, String> transformers() { final Map<ElementMatcher<? super MethodDescription>, String> transformers = new HashMap<>(); transformers.put( isMethod() .and(nameStartsWith("add")) .and(takesArgument(1, named("org.jboss.netty.channel.ChannelHandler"))), NettyChannelPipelineInstrumentation.class.getName() + "$ChannelPipelineAdd2ArgsAdvice"); transformers.put( isMethod() .and(nameStartsWith("add")) .and(takesArgument(2, named("org.jboss.netty.channel.ChannelHandler"))), NettyChannelPipelineInstrumentation.class.getName() + "$ChannelPipelineAdd3ArgsAdvice"); return transformers; } @Override public Map<String, String> contextStore() { return Collections.singletonMap( "org.jboss.netty.channel.Channel", ChannelTraceContext.class.getName()); } /** * When certain handlers are added to the pipeline, we want to add our corresponding tracing * handlers. If those handlers are later removed, we may want to remove our handlers. That is not * currently implemented. */ public static class ChannelPipelineAdviceUtil { public static void wrapHandler( final ContextStore<Channel, ChannelTraceContext> contextStore, final ChannelPipeline pipeline, final ChannelHandler handler) { try { // Server pipeline handlers if (handler instanceof HttpServerCodec) { pipeline.addLast( HttpServerTracingHandler.class.getName(), new HttpServerTracingHandler(contextStore)); } else if (handler instanceof HttpRequestDecoder) { pipeline.addLast( HttpServerRequestTracingHandler.class.getName(), new HttpServerRequestTracingHandler(contextStore)); } else if (handler instanceof HttpResponseEncoder) { pipeline.addLast( HttpServerResponseTracingHandler.class.getName(), new HttpServerResponseTracingHandler(contextStore)); } else // Client pipeline handlers if (handler instanceof HttpClientCodec) { pipeline.addLast( HttpClientTracingHandler.class.getName(), new HttpClientTracingHandler(contextStore)); } else if (handler instanceof HttpRequestEncoder) { pipeline.addLast( HttpClientRequestTracingHandler.class.getName(), new HttpClientRequestTracingHandler(contextStore)); } else if (handler instanceof HttpResponseDecoder) { pipeline.addLast( HttpClientResponseTracingHandler.class.getName(), new HttpClientResponseTracingHandler(contextStore)); } } finally { CallDepthThreadLocalMap.reset(ChannelPipeline.class); } } } public static class ChannelPipelineAdd2ArgsAdvice extends AbstractNettyAdvice { @Advice.OnMethodEnter public static int checkDepth( @Advice.This final ChannelPipeline pipeline, @Advice.Argument(1) final ChannelHandler handler) { // Pipelines are created once as a factory and then copied multiple times using the same add // methods as we are hooking. If our handler has already been added we need to remove it so we // don't end up with duplicates (this throws an exception) if (pipeline.get(handler.getClass().getName()) != null) { pipeline.remove(handler.getClass().getName()); } return CallDepthThreadLocalMap.incrementCallDepth(ChannelPipeline.class); } @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void addHandler( @Advice.Enter final int depth, @Advice.This final ChannelPipeline pipeline, @Advice.Argument(1) final ChannelHandler handler) { if (depth > 0) { return; } final ContextStore<Channel, ChannelTraceContext> contextStore = InstrumentationContext.get(Channel.class, ChannelTraceContext.class); ChannelPipelineAdviceUtil.wrapHandler(contextStore, pipeline, handler); } } public static class ChannelPipelineAdd3ArgsAdvice extends AbstractNettyAdvice { @Advice.OnMethodEnter public static int checkDepth( @Advice.This final ChannelPipeline pipeline, @Advice.Argument(2) final ChannelHandler handler) { // Pipelines are created once as a factory and then copied multiple times using the same add // methods as we are hooking. If our handler has already been added we need to remove it so we // don't end up with duplicates (this throws an exception) if (pipeline.get(handler.getClass().getName()) != null) { pipeline.remove(handler.getClass().getName()); } return CallDepthThreadLocalMap.incrementCallDepth(ChannelPipeline.class); } @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) public static void addHandler( @Advice.Enter final int depth, @Advice.This final ChannelPipeline pipeline, @Advice.Argument(2) final ChannelHandler handler) { if (depth > 0) { return; } final ContextStore<Channel, ChannelTraceContext> contextStore = InstrumentationContext.get(Channel.class, ChannelTraceContext.class); ChannelPipelineAdviceUtil.wrapHandler(contextStore, pipeline, handler); } } }
44.394619
103
0.742222
e2291b59335a1d624825e3ab9483450e223fde84
342
package com.gzs.learn.algorithm.dp; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * 背包问题dp数组条目 */ @Data @NoArgsConstructor @AllArgsConstructor public class KnapsackItem { // 当前节点 private BagItem bagItem; // 前置节点 private KnapsackItem prev; // 当前dp值 private int total; }
16.285714
35
0.725146
0150e196fea9f73842816a731d3c13eb502a43e7
542
package com.github.junitrunner; import org.junit.runner.Description; public abstract class Task { protected Description description; private boolean ignored; public final Description describe() { if (description == null) { description = createDescription(); } return description; } public abstract Description createDescription(); public boolean isIgnored() { return ignored; } public void ignore() { ignored = true; } }
20.074074
53
0.607011
9dbc77c636df0779cbde6df13092ec3441d8de5a
10,202
/* * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package git4idea; import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.intellij.dvcs.test.MockVcsHelper; import com.intellij.dvcs.test.MockVirtualFile; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.FilePathImpl; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.LocalChangeList; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vfs.newvfs.impl.NullVirtualFile; import com.intellij.testFramework.vcs.MockChangeListManager; import com.intellij.testFramework.vcs.MockContentRevision; import cucumber.annotation.en.And; import cucumber.annotation.en.Given; import cucumber.annotation.en.Then; import cucumber.annotation.en.When; import git4idea.cherrypick.GitCherryPicker; import git4idea.config.GitVersionSpecialty; import git4idea.history.browser.GitHeavyCommit; import git4idea.history.browser.SHAHash; import git4idea.history.wholeTree.AbstractHash; import java.util.*; import static com.intellij.dvcs.test.Executor.echo; import static git4idea.GitCucumberWorld.*; import static git4idea.test.GitExecutor.git; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; import static org.junit.Assert.assertFalse; /** * @author Kirill Likhodedov */ public class GitCherryPickStepdefs { @Given("^(enabled|disabled) auto-commit in the settings$") public void auto_commit_in_the_settings(String state) { boolean enabled = state.equals("enabled"); myPlatformFacade.getSettings(myProject).setAutoCommitOnCherryPick(enabled); } @When("^I cherry-pick the commit (\\w+)$") public void I_cherry_pick_the_commit(String hash) { cherryPick(hash); } @When("^I cherry-pick commits (.+) and (\\w+)$") public void I_cherry_pick_commits(String severalCommits, String hash2) throws Throwable { String[] hashes = severalCommits.split(","); String[] allHashes = new String[hashes.length + 1]; for (int i = 0; i < allHashes.length - 1; i++) { allHashes[i] = hashes[i].trim(); } allHashes[allHashes.length - 1] = hash2; cherryPick(allHashes); } @When("^I cherry-pick the commit (\\w+) and( don't)? resolve conflicts$") public void I_cherry_pick_the_commit_and_resolve_conflicts(String hash, String negation) throws Throwable { if (negation == null) { resolveConflictsInFuture(); } cherryPick(hash); } private static void resolveConflictsInFuture() { myVcsHelper.registerHandler(new MockVcsHelper.MergeHandler() { @Override public void showMergeDialog() { git("add -u ."); } }); } private static void commitInFuture(final int times) { myVcsHelper.registerHandler(new MockVcsHelper.CommitHandler() { private int myCommitRequests; @Override public boolean commit(String commitMessage) { if (myCommitRequests >= times) { return false; } myCommitRequests++; git(String.format("commit -am '%s'", commitMessage)); return true; } }); } private static void commitInFuture() { commitInFuture(Integer.MAX_VALUE); } @When("^I cherry-pick the commit (.+), resolve conflicts and( don't)? commit$") public void I_cherry_pick_the_commit_resolve_conflicts_and_commit(String hash, String negation) throws Throwable { resolveConflictsInFuture(); if (negation == null) { commitInFuture(); } cherryPick(hash); } @When("^I cherry-pick the commit (\\w+) and( don't)? commit$") public void I_cherry_pick_the_commit_hash_and_commit(String hash, String negation) throws Throwable { if (negation == null) { commitInFuture(); } cherryPick(hash); } @When("^I cherry-pick commits (.+) and commit both of them$") public void I_cherry_pick_commits_and_commit_both_of_them(String listOfHashes) throws Throwable { commitInFuture(); cherryPick(GeneralStepdefs.splitByComma(listOfHashes)); } @When("^I cherry-pick commits (.+), but commit only the first one$") public void I_cherry_pick_commits_but_commit_only_the_first_one(String listOfHashes) throws Throwable { commitInFuture(1); cherryPick(GeneralStepdefs.splitByComma(listOfHashes)); } @Then("^the last commit is$") public void the_last_commit_is(String message) throws Throwable { git_log_should_return(1, message); } @Then("^the last commit is (.+)$") public void the_last_commit_is_hash(String hash) throws Throwable { assertEquals("The last commit hash doesn't match", virtualCommits.replaceVirtualHashes(hash), git("log -1 --pretty=%h")); } @Then("^`git log -(\\d+)` should return$") public void git_log_should_return(int commitNum, String messages) throws Throwable { List<String> expectedMessages = Arrays.asList(messages.split("-----")); final String RECORD_SEPARATOR = "@"; boolean fullBody = GitVersionSpecialty.STARTED_USING_RAW_BODY_IN_FORMAT.existsIn(myVcs.getVersion()); String data= fullBody ? "%B" : "%s%b"; String output = git("log -%s --pretty=%s%s", String.valueOf(commitNum), data, RECORD_SEPARATOR); List<String> actualMessages = Arrays.asList(output.split(RECORD_SEPARATOR)); for (int i = 0; i < expectedMessages.size(); i++) { String expectedMessage = StringUtil.convertLineSeparators(expectedMessages.get(i).trim()); String actualMessage = StringUtil.convertLineSeparators(actualMessages.get(i).trim()); if (!fullBody) { // the subject (%s) somehow contains both "fix #1" and "cherry-picked from <hash>" in a single line // which is probably Git misbehavior, so let's compare without taking line breaks and spaces into consideration expectedMessage = expectedMessage.replace("\n", "").replace(" ", ""); actualMessage = actualMessage.replace("\n", "").replace(" ", ""); } expectedMessage = virtualCommits.replaceVirtualHashes(expectedMessage); assertEquals("Commit doesn't match", expectedMessage, trimHash(actualMessage)); } } @And("^no new changelists are created$") public void no_new_changelists_are_created() { assertOnlyDefaultChangelist(); } @Given("^(.+) is locally modified:$") public void is_locally_modified(String filename, String content) { echo(filename, content); } String trimHash(String commitMessage) { return commitMessage.replaceAll("([a-fA-F0-9]{7})[a-fA-F0-9]{33}", "$1"); } @Then("^nothing is committed$") public void nothing_is_committed() throws Throwable { working_tree_is_dirty(); } @And("^working tree is dirty$") public void working_tree_is_dirty() throws Throwable { assertFalse("Working tree is unexpectedly clean", git("diff").trim().isEmpty() && git("diff --cached").trim().isEmpty()); } @Then("^merge dialog should be shown$") public void merge_dialog_should_be_shown() throws Throwable { assertTrue("Merge dialog was not shown", myVcsHelper.mergeDialogWasShown()); } @Then("^commit dialog should be shown$") public void commit_dialog_should_be_shown() throws Throwable { assertTrue("Commit dialog was not shown", myVcsHelper.commitDialogWasShown()); } @Then("^active changelist is '(.+)'$") public void active_changelist_is(String name) throws Throwable { assertActiveChangeList(virtualCommits.replaceVirtualHashes(name)); } private static void assertOnlyDefaultChangelist() { String DEFAULT = MockChangeListManager.DEFAULT_CHANGE_LIST_NAME; assertChangeLists(Collections.singleton(DEFAULT), DEFAULT); } private static void assertChangeLists(Collection<String> changeLists, String activeChangelist) { List<LocalChangeList> lists = myChangeListManager.getChangeLists(); Collection<String> listNames = Collections2.transform(lists, new Function<LocalChangeList, String>() { @Override public String apply(LocalChangeList input) { return input.getName(); } }); assertEquals("Change lists are different", new ArrayList<String>(changeLists), new ArrayList<String>(listNames)); assertActiveChangeList(activeChangelist); } private static void assertActiveChangeList(String name) { assertEquals("Wrong active changelist", name, myChangeListManager.getDefaultChangeList().getName()); } private static void cherryPick(List<String> virtualHashes) { List<GitHeavyCommit> commits = new ArrayList<GitHeavyCommit>(); for (String virtualHash : virtualHashes) { commits.add(createMockCommit(virtualHash)); } new GitCherryPicker(myProject, myGit, myPlatformFacade, mySettings.isAutoCommitOnCherryPick()) .cherryPick(Collections.singletonMap(myRepository, commits)); } private static void cherryPick(String... virtualHashes) { cherryPick(Arrays.asList(virtualHashes)); } private static GitHeavyCommit createMockCommit(String virtualHash) { CommitDetails realCommit = virtualCommits.getRealCommit(virtualHash); return mockCommit(realCommit.getHash(), realCommit.getMessage()); } private static GitHeavyCommit mockCommit(String hash, String message) { AbstractHash ahash = AbstractHash.create(hash); List<Change> changes = new ArrayList<Change>(); changes.add(new Change(null, new MockContentRevision(new FilePathImpl(new MockVirtualFile("name")), VcsRevisionNumber.NULL))); return new GitHeavyCommit(NullVirtualFile.INSTANCE, ahash, SHAHash.emulate(ahash), "John Smith", null, null, message, message, null, null, null, null, null, null, null, changes, 0); } }
38.353383
130
0.727602
17bc57d67b13960ef0e37d87cec48a04b04d62c5
1,261
package name.legkodymov.order.management.controller; import name.legkodymov.order.management.model.Product; import name.legkodymov.order.management.service.ProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class ProductController { private static final String PRODUCT_PATH = "/product"; private final ProductService productService; @Autowired public ProductController(ProductService productService) { this.productService = productService; } @GetMapping(value = PRODUCT_PATH) public List<Product> getAllProducts() { return productService.getAllProducts(); } @GetMapping(value = PRODUCT_PATH + "/{id}") public Product getProduct(@PathVariable Long id) { return productService.getProduct(id); } @PostMapping(value = PRODUCT_PATH) public Product createProduct(@RequestBody Product product) { return productService.createProduct(product); } @PostMapping(value = PRODUCT_PATH + "/{id}") public Product updateProduct(@PathVariable Long id, @RequestBody Product product) { return productService.updateProduct(id, product); } }
30.756098
87
0.740682
3b7e6c1e23ee56ccb3d20f096998c2a35dc2bd27
2,037
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ivory.repliation; import org.apache.hadoop.fs.Path; import org.apache.hadoop.tools.DistCpOptions; import org.apache.ivory.replication.FeedReplicator; import org.testng.Assert; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; public class FeedReplicatorTest { @Test public void testArguments() throws Exception { /* * <arg>-update</arg> * <arg>-blocking</arg><arg>true</arg> <arg>-maxMaps</arg><arg>20</arg> * <arg>-sourcePaths</arg><arg>${distcpSourcePaths}</arg> * <arg>-targetPath</arg><arg>${distcpTargetPaths}</arg> */ FeedReplicator replicator = new FeedReplicator(); DistCpOptions options = replicator.getDistCpOptions(new String[] { "true", "-maxMaps", "5", "-sourcePaths", "hdfs://localhost:8020/tmp/", "-targetPath", "hdfs://localhost1:8020/tmp/","-bandwidth","1" }); List<Path> srcPaths = new ArrayList<Path>(); srcPaths.add(new Path("hdfs://localhost:8020/tmp/")); Assert.assertEquals(options.getSourcePaths(), srcPaths); Assert.assertEquals(options.getTargetPath(), new Path("hdfs://localhost1:8020/tmp/")); } }
40.74
115
0.692685
2c363f48d5ac3772276c32434b833cb3322f7516
1,033
package com.simonalong.butterfly.worker.zookeeper; import com.simonalong.butterfly.sequence.ButterflyConfig; import com.simonalong.butterfly.sequence.WorkerLoader; import com.simonalong.butterfly.sequence.spi.WorkerIdHandler; /** * @author shizi * @since 2020/4/25 10:03 AM */ public class ZkWorkerLoader implements WorkerLoader { private ZookeeperClient zkClient; @Override public boolean acceptConfig(ButterflyConfig butterflyConfig) { if (null == butterflyConfig) { return false; } if (!(butterflyConfig instanceof ZkButterflyConfig)) { return false; } ZkButterflyConfig zkConfig = (ZkButterflyConfig) butterflyConfig; String host = zkConfig.getHost(); zkClient = ZookeeperClient.getInstance(); zkClient.connect(host); return true; } @Override public WorkerIdHandler loadIdHandler(String namespace, ButterflyConfig butterflyConfig) { return new ZkWorkerIdHandler(namespace, zkClient); } }
28.694444
93
0.704743
a2bc11cc5d313d6d9e60f1e40cdefed56dc8a7ee
863
package assil.algorithms.dijkstra; /** * c * @author Alan da Silva Ferreira * * Classe copiada e adaptada a partir do exemplo: * http://www.vogella.com/tutorials/JavaAlgorithmsDijkstra/article.html * push test * @param <V> */ public class Edge<V extends Vertex> { private final String id; private final V source; private final V destination; private final int weight; public Edge(String id, V source, V destination, int weight) { this.id = id; this.source = source; this.destination = destination; this.weight = weight; } public String getId() { return id; } public V getDestination() { return destination; } public V getSource() { return source; } public int getWeight() { return weight; } @Override public String toString() { return source + " " + destination; } }
19.177778
72
0.653534
23a345c64b86beb8f746df3f9cd514cfa1a399fc
133
package com.imaidd.citypicker.style.citypickerview.widget; public interface CanShow { void hide(); boolean isShow(); }
16.625
58
0.706767
e1ce5fa566905a4bf0bc28eb7a716d63fd207816
5,823
package wolfboyft.magicalmages.init; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; import wolfboyft.magicalmages.MagicalMages; import wolfboyft.magicalmages.Reference; import wolfboyft.magicalmages.entity.projectile.actual.ExcaliburBeam; import wolfboyft.magicalmages.entity.projectile.actual.Kunai; import wolfboyft.magicalmages.entity.projectile.actual.MagicKunai; import wolfboyft.magicalmages.entity.projectile.actual.MagicShuriken; import wolfboyft.magicalmages.entity.projectile.actual.Shuriken; import wolfboyft.magicalmages.entity.projectile.actual.WitherBolt; import wolfboyft.magicalmages.items.AdvancedSword; import wolfboyft.magicalmages.items.Staves; import wolfboyft.magicalmages.items.ThrowableWeapon; import wolfboyft.magicalmages.misc.EnumArmour; public class MageItems { public static final Item staffWither = new Staves("staffWither", 1024, 7, false, WitherBolt.class); public static final Item witherBone = new Item().setUnlocalizedName("witherBone") .setCreativeTab(MagicalMages.tabModMM); public static final Item witherRib = new Item().setUnlocalizedName("witherRib") .setCreativeTab(MagicalMages.tabModMM); public static final Item shuriken = new ThrowableWeapon("shuriken", 5, Shuriken.class); public static final Item kunai = new ThrowableWeapon("kunai", 4, Kunai.class); public static final Item magicShuriken = new ThrowableWeapon("magicShuriken", 20, MagicShuriken.class); public static final Item magicKunai = new ThrowableWeapon("magicKunai", 16, MagicKunai.class); public static Item witherHelmet; public static Item witherChest; public static Item witherLegs; public static Item witherBoots; public static Item ninjaHelmet; public static Item ninjaChest; public static Item ninjaLegs; public static Item ninjaBoots; public static ToolMaterial god = EnumHelper.addToolMaterial("GodMaterial", 100, -1, 5, 50, 5245); public static final Item excalibur = new AdvancedSword(god, "excalibur", ExcaliburBeam.class, true, true); public static void init() { int HEAD = Armours.HEAD; int BODY = Armours.BODY; int LEGS = Armours.LEGS; int BOOTS = Armours.BOOTS; witherHelmet = new Armours(EnumArmour.WITHER, HEAD); witherChest = new Armours(EnumArmour.WITHER, BODY); witherLegs = new Armours(EnumArmour.WITHER, LEGS); witherBoots = new Armours(EnumArmour.WITHER, BOOTS); ninjaHelmet = new Armours(EnumArmour.NINJA, HEAD); ninjaChest = new Armours(EnumArmour.NINJA, BODY); ninjaLegs = new Armours(EnumArmour.NINJA, LEGS); ninjaBoots = new Armours(EnumArmour.NINJA, BOOTS); } public static void register() { GameRegistry.registerItem(witherBone, witherBone.getUnlocalizedName().substring(5)); GameRegistry.registerItem(witherRib, witherRib.getUnlocalizedName().substring(5)); GameRegistry.addRecipe(new ItemStack(staffWither, 1), "CBC", " A ", " D ", 'A', witherBone, 'B', Items.nether_star, 'C', witherRib, 'D', new ItemStack(Items.skull, 1, 1)); GameRegistry.addRecipe(new ItemStack(shuriken, 16), "A A", " B ", "A A", 'A', Items.flint, 'B', Items.iron_ingot); GameRegistry.addRecipe(new ItemStack(kunai, 16), " A", "CA ", "BC ", 'A', Items.flint, 'B', Items.stick, 'C', Items.string); GameRegistry.addRecipe(new ItemStack(magicKunai, 8), "ACA", "CBC", "ACA", 'A', Items.iron_ingot, 'B', kunai, 'C', Items.gold_nugget); GameRegistry.addRecipe(new ItemStack(magicShuriken, 8), "ACA", "CBC", "ACA", 'A', Items.iron_ingot, 'B', shuriken, 'C', Items.gold_nugget); GameRegistry.addRecipe(new ItemStack(witherHelmet, 1), "AAA", "ABA", 'A', witherBone, 'B', Items.nether_star); GameRegistry.addRecipe(new ItemStack(witherChest, 1), "ABA", "AAA", "AAA", 'A', witherBone, 'B', Items.nether_star); GameRegistry.addRecipe(new ItemStack(witherLegs, 1), "AAA", "ABA", "A A", 'A', witherBone, 'B', Items.nether_star); GameRegistry.addRecipe(new ItemStack(witherBoots, 1), "ABA", "A A", 'A', witherBone, 'B', Items.nether_star); GameRegistry.addRecipe(new ItemStack(excalibur, 1), "DED", "BAB", "DCD", 'A', Blocks.dragon_egg, 'B', Items.nether_star, 'C', Items.stick, 'D', new ItemStack(Items.golden_apple, 6, 1), 'E', staffWither); GameRegistry.addRecipe(new ItemStack(ninjaHelmet), "BAB", "ACA", 'A', Blocks.wool, 'B', Items.leather, 'C', Items.gold_nugget); GameRegistry.addRecipe(new ItemStack(ninjaChest), "BCB", "AAA", "AAA", 'A', Blocks.wool, 'B', Items.leather, 'C', Items.gold_nugget); GameRegistry.addRecipe(new ItemStack(ninjaLegs), "ABA", "ACA", "B B", 'A', Blocks.wool, 'B', Items.leather, 'C', Items.gold_nugget); GameRegistry.addRecipe(new ItemStack(ninjaBoots), "ACA", "B B", 'A', Blocks.wool, 'B', Items.leather, 'C', Items.gold_nugget); } public static void registerRenders() { registerRender(staffWither); registerRender(witherBone); registerRender(witherRib); registerRender(shuriken); registerRender(kunai); registerRender(magicShuriken); registerRender(magicKunai); registerRender(witherHelmet); registerRender(witherChest); registerRender(witherLegs); registerRender(witherBoots); registerRender(ninjaHelmet); registerRender(ninjaChest); registerRender(ninjaLegs); registerRender(ninjaBoots); registerRender(excalibur); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation( Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } }
49.347458
114
0.752877
f88c9db76704aaa677b20e9bb6d32ded09ff27de
3,827
/* * Copyright 2013 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.overlord.rtgov.ui.client.local.pages.situations; import javax.enterprise.context.Dependent; import javax.inject.Inject; import org.jboss.errai.ui.nav.client.local.TransitionAnchorFactory; import org.overlord.rtgov.ui.client.local.ClientMessages; import org.overlord.rtgov.ui.client.local.pages.SituationDetailsPage; import org.overlord.rtgov.ui.client.model.SituationEventBean; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.InlineLabel; /** * Widget used to show a single event in the situation event watcher panel. * @author eric.wittmann@redhat.com */ @Dependent public class SituationWatcherEvent extends FlowPanel implements HasValue<SituationEventBean> { @Inject protected TransitionAnchorFactory<SituationDetailsPage> toDetailsPageLinkFactory; /** * Constructor. */ public SituationWatcherEvent() { setStyleName("sitwatch-event"); //$NON-NLS-1$ } /** * @see com.google.gwt.event.logical.shared.HasValueChangeHandlers#addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) */ @Override public HandlerRegistration addValueChangeHandler(ValueChangeHandler<SituationEventBean> handler) { return addHandler(handler, ValueChangeEvent.getType()); } /** * @see com.google.gwt.user.client.ui.HasValue#getValue() */ @Override public SituationEventBean getValue() { return null; } /** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object) */ @Override public void setValue(SituationEventBean value) { setValue(value, false); } /** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) * * <div class="sitwatch-event"> * <div class="icon icon-severity-critical"></div> * <a class="title" href="#">Rate Limit Exceeded</a> * <span class="timestamp">9:16 AM</span> * <span class="subject">{urn:namespace}ImportantService|VeryImportantOperation</span> * </div> */ @Override public void setValue(SituationEventBean value, boolean fireEvents) { clear(); FlowPanel icon = new FlowPanel(); icon.setStyleName("icon"); //$NON-NLS-1$ icon.addStyleName("icon-severity-" + value.getSeverity()); //$NON-NLS-1$ Anchor type = toDetailsPageLinkFactory.get("id", value.getSituationId()); //$NON-NLS-1$ type.setText(value.getType()); type.setStyleName("title"); //$NON-NLS-1$ InlineLabel timestamp = new InlineLabel(ClientMessages.getTimeFormat().format(value.getTimestamp())); timestamp.setStyleName("timestamp"); //$NON-NLS-1$ InlineLabel subject = new InlineLabel(value.getSubject()); subject.setStyleName("subject"); //$NON-NLS-1$ add(icon); add(type); add(timestamp); add(subject); } }
36.103774
148
0.697936
5c3c7ef2b7130073e1fb15f536f59bef70e48f94
2,549
package ee.ttu.itx8530.fullprofile.vpn.tap; import java.net.NetworkInterface; import java.net.SocketException; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.Random; import java.util.stream.Collectors; import org.apache.log4j.Logger; /** * From <a>https://community.openvpn.net/openvpn/wiki/HOWTO# * Editingtheserverconfigurationfile</a>: "If you are using Windows, each * OpenVPN configuration needs to have its own TAP-Windows adapter." * * @author Kasutaja * */ public class TapAdapterManager { private Logger logger = Logger.getLogger(this.getClass()); private ArrayList<TapAdapter> adapters = new ArrayList<>(); private String displayName = "TAP-Windows Adapter V9"; public TapAdapterManager() { initialize(); } private void initialize() { adapters = queryTapAdapters(); } public ArrayList<TapAdapter> queryTapAdapters() { ArrayList<TapAdapter> adapters = new ArrayList<>(); Enumeration<NetworkInterface> nets; try { nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(nets)) { // discard others if (netint.getDisplayName().contains(displayName) && netint.getInetAddresses().hasMoreElements() && netint.getHardwareAddress() != null) { adapters.add(parseTapAdapter(netint)); } } } catch (SocketException e) { logger.error("Exception was thrown when querying TAP adapters", e); } return adapters; } private TapAdapter parseTapAdapter(NetworkInterface netint) throws SocketException { return new TapAdapter(netint); } public TapAdapter getFirstUnusedAdapter(boolean randomize) throws NoUnusedTapAdaptersException { // �kki peaks olema limit(2) List<TapAdapter> unusedAdapter = adapters.stream().filter(p -> !p.isUsed()).collect(Collectors.toList()); if (unusedAdapter.isEmpty()) throw new NoUnusedTapAdaptersException(); if (unusedAdapter.size() > 1 && randomize) { Collections.shuffle(unusedAdapter, new Random(System.nanoTime())); } return unusedAdapter.get(0); } public int getTapAdapterCount() { return adapters.size(); } public boolean hasUnused() { return adapters.stream().anyMatch(p -> !p.isUsed()); } }
31.8625
113
0.651236
9522042c8847fccaef97baf6f73ad01a73f268bb
1,796
/* * Copyright 2021 Whilein * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package te4j.filter.impl; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.NonNull; import org.jetbrains.annotations.NotNull; import te4j.filter.Filter; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; /** * @author whilein */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class Hex implements Filter { private static final char[] HEX = "0123456789ABCDEF".toCharArray(); public static @NonNull Filter create() { return new Hex(); } @Override public @NotNull String getName() { return "hex"; } @Override public Type getWrappedType(@NonNull Type type) { return type == String.class || type == byte[].class ? String.class : null; } public static String process(String value) { return process(value.getBytes(StandardCharsets.UTF_8)); } public static String process(byte[] value) { StringBuilder result = new StringBuilder(value.length * 2); for (byte b : value) { result.append(HEX[(b >> 4) & 0xF]); result.append(HEX[b & 0xF]); } return result.toString(); } }
28.0625
82
0.671492
1ff12c9f6e6894b5ac5621ec1d13191fe47a90d2
8,050
package com.stewhouse.gresturlconnection; import android.os.AsyncTask; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.HashMap; import javax.net.ssl.HttpsURLConnection; /** * Created by Gomguk on 16. 7. 8.. */ public class GRESTURLConnection extends AsyncTask<HashMap, Object, String> { public interface GRESTURLConnectionListener { void onPostExecute(String result); } private final static String CONNECTION_PARAM_URL = "url"; private final static String CONNECTION_PARAM_PARAMS = "params"; private final static String CONNECTION_PARAM_TIMEOUT = "timeout"; private final static String CONNECTION_PARAM_REQUEST_TYPE = "request_type"; private final static String CONNECTION_PARAM_HEADERS = "headers"; private final static String CONNECTION_PARAM_REQUEST_BODY = "request_body"; private final static String CONNECTION_PARAM_REQUEST_BODY_TYPE = "request_body_type"; public enum SchemeType { HTTP, HTTPS } public enum RequestType { GET, POST, PUT, DELETE } private GRESTURLConnectionListener mListener = null; public void setListener(GRESTURLConnectionListener listener) { mListener = listener; } public void execute(String url, HashMap<String, String> params, int timeOut, RequestType requestType, HashMap<String, String> headers, String requestBody, String requestBodyType) { HashMap<String, Object> connectionParams = new HashMap<>(); connectionParams.put(CONNECTION_PARAM_URL, url); connectionParams.put(CONNECTION_PARAM_PARAMS, params); connectionParams.put(CONNECTION_PARAM_TIMEOUT, timeOut); connectionParams.put(CONNECTION_PARAM_REQUEST_TYPE, requestType); connectionParams.put(CONNECTION_PARAM_HEADERS, headers); connectionParams.put(CONNECTION_PARAM_REQUEST_BODY, requestBody); connectionParams.put(CONNECTION_PARAM_REQUEST_BODY_TYPE, requestBodyType); this.execute(connectionParams); } @Override protected String doInBackground(HashMap... params) { try { if (mListener != null) { HashMap<String, Object> requestParams = (HashMap<String, Object>) params[0]; String urlStr = (String) requestParams.get(CONNECTION_PARAM_URL); if (requestParams.get(CONNECTION_PARAM_PARAMS) != null) { urlStr = setParams((HashMap<String, String>) requestParams.get(CONNECTION_PARAM_PARAMS), urlStr); } int timeOut = (int) requestParams.get(CONNECTION_PARAM_TIMEOUT); if (timeOut < 0) throw GException.makeGException(GException.ErrorType.TIMEOUT_VALUE_INVALID); RequestType requestType = (RequestType) requestParams.get(CONNECTION_PARAM_REQUEST_TYPE); if (requestType == null) throw GException.makeGException(GException.ErrorType.REQUEST_TYPE_NOT_SUPPORTED); URL url = new URL(urlStr); URLConnection conn = url.openConnection(); StringBuilder stringBuilder = new StringBuilder(); // Set Integrated parameters. conn.setConnectTimeout(timeOut); if (requestParams.get(CONNECTION_PARAM_HEADERS) != null) { setRequestHeader(conn, (HashMap<String, String>) requestParams.get(CONNECTION_PARAM_HEADERS)); } if (requestParams.get(CONNECTION_PARAM_REQUEST_BODY) != null && requestParams.get(CONNECTION_PARAM_REQUEST_BODY_TYPE) != null) { String requestBody = (String) requestParams.get(CONNECTION_PARAM_REQUEST_BODY); String requestBodyType = (String) requestParams.get(CONNECTION_PARAM_REQUEST_BODY_TYPE); if (requestBodyType != null) { conn.addRequestProperty("content_type", requestBodyType); } conn.setDoOutput(true); OutputStream outputStream = conn.getOutputStream(); outputStream.write(requestBody.getBytes("UTF-8")); outputStream.close(); } // Set parameters which is classified by whether the connection is HTTP or HTTPS. SchemeType schemeType = checkScheme(urlStr); if (schemeType == null) throw GException.makeGException(GException.ErrorType.SCHEME_NOT_SUPPORTED); if (schemeType.equals(SchemeType.HTTP)) { HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setRequestMethod(requestType.toString()); if (httpConn.getResponseCode() == HttpsURLConnection.HTTP_OK) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConn.getInputStream())); String result; while (true) { result = bufferedReader.readLine(); if (result == null) { break; } stringBuilder.append(result).append("\n"); } bufferedReader.close(); httpConn.disconnect(); } else { throw GException.makeGException(GException.ErrorType.RESPONSE_CODE_ERROR); } } else if (schemeType.equals(SchemeType.HTTPS)) { HttpsURLConnection httpsConn = (HttpsURLConnection) conn; httpsConn.setRequestMethod(requestType.toString()); if (httpsConn.getResponseCode() == HttpsURLConnection.HTTP_OK) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpsConn.getInputStream())); String result; while (true) { result = bufferedReader.readLine(); if (result == null) { break; } stringBuilder.append(result).append("\n"); } bufferedReader.close(); httpsConn.disconnect(); } else { throw GException.makeGException(GException.ErrorType.RESPONSE_CODE_ERROR); } } return stringBuilder.toString(); } else { throw GException.makeGException(GException.ErrorType.LISTENER_NULL_POINTER); } } catch (Throwable e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); mListener.onPostExecute(result); } private SchemeType checkScheme(String url) { if (url.startsWith("http:")) { return SchemeType.HTTP; } else if (url.startsWith("https:")) { return SchemeType.HTTPS; } return null; } private String setParams(HashMap<String, String> params, String url) { StringBuilder stringBuilder = new StringBuilder(url); stringBuilder.append("?"); for (String key : params.keySet()) { stringBuilder.append(key).append("=").append(params.get(key)).append("&"); } stringBuilder.delete(stringBuilder.length() - 1, stringBuilder.length()); return stringBuilder.toString(); } private void setRequestHeader(URLConnection conn, HashMap<String, String> headers) { for (String key : headers.keySet()) { conn.addRequestProperty(key, headers.get(key)); } } }
39.655172
184
0.601366
112c73c5e9ac9ab2b1d6907c5b04da780f68f298
3,007
/* * Class: EmotionSaveFile * * Version: 1.0 * * Date: October 3rd, 2018 * * Description: * Class that handles all interactions with the android file system, both reading and writing * the record data. * Rationale: * This class allows others to not have to deal with the actual method in which records are * saved. As a result it separates concerns so that a new saving system could be implemented * and the rest of the model wouldn't need any changes so long as the methods functioned the * same as they did before. * Outstanding Issues: * The cost of saving or loading all records as the only option seems high, preferably in the * future better saving wherein individual records could be saved would be the goal */ package com.example.gobran.gobran_feelsbook; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; public class EmotionSaveFile { // The data for the where reading and writing data should be done to private static final String RECORD_FILENAME = "emotionSaveFile.sav"; private File appFilePath; public EmotionSaveFile(File path) { this.appFilePath = path; } // Reads the emotion records saved at the location and returns an ArrayList of them @SuppressWarnings("unchecked") public ArrayList<EmotionRecord> readEmotionRecords() { ArrayList<EmotionRecord> emotionRecords = null; // Attempts to read any present emotion records file, reads it as the entire arrayList // being saved as a serializable ArrayList so that only one object must be read try { FileInputStream fis = new FileInputStream(new File(appFilePath, RECORD_FILENAME)); ObjectInputStream ois = new ObjectInputStream(fis); emotionRecords = (ArrayList<EmotionRecord>) ois.readObject(); ois.close(); fis.close(); } catch (FileNotFoundException e) { emotionRecords = new ArrayList<EmotionRecord>(); } catch(Exception e) { throw new RuntimeException("Error reading records"); } return emotionRecords; } // Writes the emotion records provided over any records stored already in the file public void writeEmotionRecords(ArrayList<EmotionRecord> emotionRecords) { // Attempts to write the ArrayList as a single serializable object in the file so that // it can easily be retrieved at a later date. try { FileOutputStream fos = new FileOutputStream(new File(appFilePath,RECORD_FILENAME)); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(emotionRecords); oos.close(); fos.close(); } catch(Exception e) { throw new RuntimeException("Error writing records"); } } }
36.228916
98
0.688726
897e693bd3c30e651475658527ca9fd9d0083c94
1,507
package speech.types ; import com4j.*; /** */ public enum DISPID_SpeechObjectToken implements ComEnum { /** * <p> * The value of this constant is 1 * </p> */ DISPID_SOTId(1), /** * <p> * The value of this constant is 2 * </p> */ DISPID_SOTDataKey(2), /** * <p> * The value of this constant is 3 * </p> */ DISPID_SOTCategory(3), /** * <p> * The value of this constant is 4 * </p> */ DISPID_SOTGetDescription(4), /** * <p> * The value of this constant is 5 * </p> */ DISPID_SOTSetId(5), /** * <p> * The value of this constant is 6 * </p> */ DISPID_SOTGetAttribute(6), /** * <p> * The value of this constant is 7 * </p> */ DISPID_SOTCreateInstance(7), /** * <p> * The value of this constant is 8 * </p> */ DISPID_SOTRemove(8), /** * <p> * The value of this constant is 9 * </p> */ DISPID_SOTGetStorageFileName(9), /** * <p> * The value of this constant is 10 * </p> */ DISPID_SOTRemoveStorageFileName(10), /** * <p> * The value of this constant is 11 * </p> */ DISPID_SOTIsUISupported(11), /** * <p> * The value of this constant is 12 * </p> */ DISPID_SOTDisplayUI(12), /** * <p> * The value of this constant is 13 * </p> */ DISPID_SOTMatchesAttributes(13), ; private final int value; DISPID_SpeechObjectToken(int value) { this.value=value; } public int comEnumValue() { return value; } }
16.380435
59
0.548109
dce530791550b2a44fae67080a514ee04e14fa49
1,855
/** * Copyright Ambud Sharma * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.srotya.sidewinder.ingesters.statsd; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import java.io.IOException; import java.nio.charset.Charset; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import com.srotya.sidewinder.core.rpc.Point; import com.srotya.sidewinder.core.storage.StorageEngine; import io.netty.buffer.Unpooled; import io.netty.channel.embedded.EmbeddedChannel; import io.netty.handler.codec.string.StringDecoder; @RunWith(MockitoJUnitRunner.class) public class TestStatsdDecoder { @Mock private StorageEngine engine; @Test public void testStatsdParse() throws IOException { EmbeddedChannel ch = new EmbeddedChannel(new StringDecoder(), new StatdsDecoder("test", engine, null)); ch.writeInbound(Unpooled.copiedBuffer("http.server_ngnix.latency:1121|ms", Charset.defaultCharset())); ch.readInbound(); verify(engine, times(1)).writeDataPointWithLock(any(Point.class), anyBoolean()); // MiscUtils.buildDataPoint("test", "http", "latency", tags, // System.currentTimeMillis(), 1121), false); ch.close(); } }
33.125
105
0.771429
f80617e57ed6898fd47184c3c8aab68bfea7b3c6
2,381
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.edas.transform.v20170801; import java.util.ArrayList; import java.util.List; import com.aliyuncs.edas.model.v20170801.QuerySlsLogStoreListResponse; import com.aliyuncs.edas.model.v20170801.QuerySlsLogStoreListResponse.SlsLog; import com.aliyuncs.transform.UnmarshallerContext; public class QuerySlsLogStoreListResponseUnmarshaller { public static QuerySlsLogStoreListResponse unmarshall(QuerySlsLogStoreListResponse querySlsLogStoreListResponse, UnmarshallerContext _ctx) { querySlsLogStoreListResponse.setRequestId(_ctx.stringValue("QuerySlsLogStoreListResponse.RequestId")); querySlsLogStoreListResponse.setTotalSize(_ctx.integerValue("QuerySlsLogStoreListResponse.TotalSize")); querySlsLogStoreListResponse.setCode(_ctx.integerValue("QuerySlsLogStoreListResponse.Code")); querySlsLogStoreListResponse.setMessage(_ctx.stringValue("QuerySlsLogStoreListResponse.Message")); List<SlsLog> result = new ArrayList<SlsLog>(); for (int i = 0; i < _ctx.lengthValue("QuerySlsLogStoreListResponse.Result.Length"); i++) { SlsLog slsLog = new SlsLog(); slsLog.setLogstore(_ctx.stringValue("QuerySlsLogStoreListResponse.Result["+ i +"].Logstore")); slsLog.setProject(_ctx.stringValue("QuerySlsLogStoreListResponse.Result["+ i +"].Project")); slsLog.setLink(_ctx.stringValue("QuerySlsLogStoreListResponse.Result["+ i +"].Link")); slsLog.setConsumerSide(_ctx.stringValue("QuerySlsLogStoreListResponse.Result["+ i +"].ConsumerSide")); slsLog.setCreateTime(_ctx.stringValue("QuerySlsLogStoreListResponse.Result["+ i +"].CreateTime")); slsLog.setSource(_ctx.stringValue("QuerySlsLogStoreListResponse.Result["+ i +"].Source")); result.add(slsLog); } querySlsLogStoreListResponse.setResult(result); return querySlsLogStoreListResponse; } }
47.62
141
0.785384
95f94397be8c7093f9cfb75f45f211b491ce0faa
1,022
package sonar.calculator.mod.common.entities; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import javax.annotation.Nonnull; public class EntityGrenade extends EntityThrowable { public EntityGrenade(World world) { super(world); } public EntityGrenade(World world, EntityLivingBase player) { super(world, player); } public EntityGrenade(World world, double x, double y, double z) { super(world, x, y, z); } @Override protected void onImpact(@Nonnull RayTraceResult result) { if (!this.world.isRemote) { setDead(); this.world.createExplosion(null, this.posX, this.posY, this.posZ, 5.0F, true); } else { for (int i = 0; i < 10; i++) { this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX, this.posY, this.posZ, 0.8999999761581421D, 0.8999999761581421D, 0.8999999761581421D); } } } }
27.621622
150
0.740705
a6e6a986dd25d824e99bec2ae1d6637c8812cebc
563
package org.ebookdroid.fb2droid.codec; import android.graphics.RectF; public abstract class AbstractFB2LineElement implements FB2LineElement { public final int height; public float width; public AbstractFB2LineElement(final float width, final int height) { this.height = height; this.width = width; } public AbstractFB2LineElement(final RectF rect) { this(rect.width(), (int) rect.height()); } @Override public void publishToDocument(final FB2Document doc) { doc.publishElement(this); } }
23.458333
72
0.692718
63a8c0ec2d5f0e993ce28c25a028fe5eb9d600d2
426
package com.gsnathan.pdfviewer; import androidx.room.Dao; import androidx.room.Insert; import androidx.room.OnConflictStrategy; import androidx.room.Query; @Dao public interface SavedLocationDao { @Query("SELECT pageNumber FROM SavedLocation WHERE hash = :hash") Integer findSavedPage(String hash); @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(SavedLocation saveLocations); }
26.625
70
0.758216
eac259f6ad571d0702a7a7eada65918e0438c5b1
2,929
package com.wabradshaw.palettest.visualisation; import com.wabradshaw.palettest.analysis.PaletteDistribution; import com.wabradshaw.palettest.analysis.Palettester; import com.wabradshaw.palettest.analysis.Tone; import com.wabradshaw.palettest.palettes.StandardPalettes; import com.wabradshaw.palettest.utils.ImageFileUtils; import org.junit.jupiter.api.Test; import java.awt.Color; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import static com.wabradshaw.palettest.assertions.AssertDimensions.assertDimensions; import static org.junit.jupiter.api.Assertions.assertEquals; /** * A set of tests for the {@link DistributionPainter} class. */ public class DistributionPainterTest { /** * Tests that using paintTones will return an image of the correct size. */ @Test public void testPaintTones_Size(){ DistributionPainter visualiser = new DistributionPainter(); BufferedImage result = visualiser.paintTones(new ArrayList<>(), 10, 20); assertDimensions(result, 10, 20); } /** * Tests that using paintTones on a simple image returns an image with the same color palette. */ @Test public void testPaintTones_Simple(){ Palettester tester = new Palettester(); BufferedImage original = ImageFileUtils.loadImageResource("/sampleImages/geometric/redBlueQuarter.png"); PaletteDistribution originalDistribution = tester.analysePalette(StandardPalettes.JAVA_COLORS, original); DistributionPainter visualiser = new DistributionPainter(); BufferedImage result = visualiser.paintTones(originalDistribution.byCount(), 10, 10); PaletteDistribution newDistribution = tester.analysePalette(StandardPalettes.JAVA_COLORS, result); assertEquals(originalDistribution, newDistribution); } /** * Tests that using paintTones on an image with a custom palette returns an image with the same color palette. */ @Test public void testPaintTones_Map(){ Palettester tester = new Palettester(); List<Tone> palette = new ArrayList<>(); palette.add(new Tone("Dark Purple", new Color(97,55,138))); palette.add(new Tone("Light Purple", new Color(122,61,182))); palette.add(new Tone("White", Color.WHITE)); BufferedImage original = ImageFileUtils.loadImageResource("/sampleImages/maps/Barcelona.png"); PaletteDistribution originalDistribution = new Palettester().analysePalette(palette, original); DistributionPainter visualiser = new DistributionPainter(); BufferedImage result = visualiser.paintTones(originalDistribution.byCount(), 1200, 1280); PaletteDistribution newDistribution = tester.analysePalette(palette, result); assertEquals(originalDistribution, newDistribution); } }
38.038961
115
0.719358
11d7ce28a7def4cd78f0667cd355127515308cee
373
package algorithm; import datastructure.MDP; import datastructure.Policy; import datastructure.Utility; import javax.rmi.CORBA.Util; public class PolicyIteration { private PolicyEvaluation evaluation; public PolicyIteration(PolicyEvaluation eval) { this.evaluation = eval; } public Policy iteratePolicy(MDP mdp) { return null; } }
17.761905
51
0.726542
78fd286ef55a6f757e51542fe4c86bdb0101eb04
2,457
/** * */ package io.sinistral.proteus.server.security; import io.undertow.security.idm.Account; import io.undertow.security.idm.Credential; import io.undertow.security.idm.IdentityManager; import io.undertow.security.idm.PasswordCredential; import java.security.Principal; import java.util.Arrays; import java.util.Collections; import java.util.Map; import java.util.Set; /** * @author jbauer */ public class MapIdentityManager implements IdentityManager { private final Map<String, char[]> identities; public MapIdentityManager(final Map<String, char[]> identities) { this.identities = identities; } @Override public Account verify(Account account) { // An existing account so for testing assume still valid. return account; } @Override public Account verify(Credential credential) { // TODO Auto-generated method stub return null; } @Override public Account verify(String id, Credential credential) { Account account = getAccount(id); if ((account != null) && verifyCredential(account, credential)) { return account; } return null; } private boolean verifyCredential(Account account, Credential credential) { if (credential instanceof PasswordCredential) { char[] password = ((PasswordCredential) credential).getPassword(); char[] expectedPassword = identities.get(account.getPrincipal().getName()); return Arrays.equals(password, expectedPassword); } return false; } private Account getAccount(final String id) { if (identities.containsKey(id)) { return new UserAccount(id); } return null; } private class UserAccount implements Account { private static final long serialVersionUID = -8234851531206339721L; private final Principal principal; public UserAccount(String id) { principal = new Principal() { @Override public String getName() { return id; } }; } @Override public Principal getPrincipal() { return principal; } @Override public Set<String> getRoles() { return Collections.emptySet(); } } }
22.541284
87
0.606024
54f81dd4fecc894caabe2351181333f20f32bbd1
514
package org.mym.featuredshowcase.advanced.layoutdrawer; import android.content.Context; import android.graphics.Bitmap; public interface BitmapCreator { /** * Get the bitmap for display, create it if needed. * * @param context the context object for creating bitmap object. * @return Returns a bitmap for draw ; if null or already recycled, nothing was drawn. */ Bitmap getBitmapOrCreate(Context context); /** * Do the real bitmap recycle. */ void recycle(); }
27.052632
90
0.690661
e1758471110ec25dec61f50830eb531d8119bfe0
416
package com._7aske.grain.security.exception; public class CredentialsExpiredException extends GrainSecurityException { public CredentialsExpiredException() { } public CredentialsExpiredException(Throwable cause) { super(cause); } public CredentialsExpiredException(String message) { super(message); } public CredentialsExpiredException(String message, Throwable cause) { super(message, cause); } }
21.894737
73
0.793269
d30000073f46570a06bc9a77f9d4d0aedc43a887
487
package com.opdar.gulosity.serializable; import java.nio.ByteBuffer; /** * Created by 俊帆 on 2016/10/12. */ public class YearSerializable extends JavaSerializable<String> { public YearSerializable(int type) { super(type); } public String getValue(int meta, ByteBuffer buffer) { final int year = buffer.get(); if (year == 0) { return "0000"; } else { return String.valueOf((short) (year + 1900)); } } }
22.136364
64
0.595483
4e1ba5f339dacd65dcf95c04c2ec51a4594c14a1
6,578
package com.myrunning.leaderboard.web; /** * File: ListControlPointsController.java * Author: Joshua Forester * Date: 2009/08/20 * Description: Controller object for listing Control Points. **/ import java.util.List; import java.util.ArrayList; import javax.servlet.http.HttpServletRequest; import org.springframework.ui.ModelMap; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.beans.factory.annotation.Autowired; import com.bbn.openmap.LatLonPoint; import org.apache.log4j.Logger; import org.apache.log4j.MDC; import com.myrunning.leaderboard.global.Constants; import com.myrunning.leaderboard.model.Admin; import com.myrunning.leaderboard.model.Event; import com.myrunning.leaderboard.model.ControlPoint; import com.myrunning.leaderboard.model.Leaderboard; import com.myrunning.leaderboard.db.DataAccessFilter; import com.myrunning.leaderboard.db.dao.ifacedao.DataResourceDao; import com.myrunning.leaderboard.db.dao.ifacedao.EventDao; import com.myrunning.leaderboard.db.dao.ifacedao.ControlPointDao; import com.myrunning.leaderboard.services.ifacesvc.CourseService; @Controller public class ListControlPointsController extends NewLayoutController { static Logger logger = Logger.getLogger(ListControlPointsController.class); @Autowired private DataResourceDao dataResourceDao; @Autowired private EventDao eventDao; @Autowired private ControlPointDao controlPointDao; @Autowired private CourseService courseService; @RequestMapping(value = "/courses/{courseId}/cps", method = RequestMethod.GET) public String getCourseControlPoints(@PathVariable Long courseId, @RequestParam(value="order", required=false) String order, HttpServletRequest request, ModelMap model) { Event event = eventDao.getEventByCourseId(courseId); model.addAttribute("event", event); List<ControlPoint> controlPoints = controlPointDao.getControlPointsByCourseId(courseId, order); model.addAttribute("controlPoints", controlPoints); model.addAttribute("courseId", courseId); setMultiViewRenderObject(model, "controlPoints"); return decorateView(".listControlPoints_view", request); } @RequestMapping(value = "/courses/{courseId}/cps/gmap.htm", method = RequestMethod.GET) public String getCourseControlPointsMap(@PathVariable Long courseId, @RequestParam(value="center", required=false) String center, @RequestParam(value="order", required=false) String order, HttpServletRequest request, ModelMap model) { Leaderboard leaderboard = courseService.generateLeaderboard(courseId, false, true, true, false, true); model.addAttribute("leaderboard", leaderboard); model.addAttribute("course", leaderboard.getCourse()); model.addAttribute("courseId", courseId); Event event = eventDao.getEventByCourseId(courseId); model.addAttribute("event", event); // ignore center coordinate if not valid lat/long point if (center != null) { String latitude = center.substring(0, center.indexOf(",")); String longitude = center.substring(center.indexOf(",") + 1); LatLonPoint pt = null; try { pt = new LatLonPoint(Float.parseFloat(latitude), Float.parseFloat(longitude)); } catch (NumberFormatException nfe) { pt = null; } model.addAttribute("center", pt); } setMultiViewRenderObject(model, "leaderboard"); return decorateView(".listControlPointsGmap_dashboard", request); } @RequestMapping(value = "/cps/{controlPointId}", method = RequestMethod.GET) public String getControlPoint(@PathVariable Long controlPointId, HttpServletRequest request, ModelMap model) { ControlPoint controlPoint = controlPointDao.getControlPointById(controlPointId); List<ControlPoint> controlPoints = new ArrayList<ControlPoint>(); controlPoints.add(controlPoint); model.addAttribute("controlPoints", controlPoints); model.addAttribute("courseId", controlPoint.getCourseId()); Event event = eventDao.getEventByCourseId(controlPoint.getCourseId()); model.addAttribute("event", event); setMultiViewRenderObject(model, "controlPoints"); return decorateView(".listControlPoints_view", request); } @RequestMapping(value="/deleteControlPoint.htm", method=RequestMethod.GET) public String deleteControlPoint(@RequestParam(value="cp_id") Integer controlPointId, HttpServletRequest request, ModelMap model) { Admin admin = (Admin) request.getSession().getAttribute(Constants.ADMIN_SESSION_KEY); if (admin == null) { return Constants.OWNERSHIP_ERROR; } if (DataAccessFilter.filterDataResourceById(controlPointId, admin.getId()) == null) { return Constants.OWNERSHIP_ERROR; } ControlPoint controlPoint = controlPointDao.getControlPointById(controlPointId); model.addAttribute("controlPoint", controlPoint); Event event = eventDao.getEventByCourseId(controlPoint.getCourseId()); model.addAttribute("event", event); return decorateView(".deleteControlPointConfirm_view", request); } @RequestMapping(value="/deleteControlPointConfirmed.htm", method=RequestMethod.POST) public String deleteControlPointConfirmed(@ModelAttribute("controlPoint") ControlPoint controlPoint, BindingResult result, SessionStatus status, HttpServletRequest request, ModelMap model) { // validate controlPoint Admin admin = (Admin) request.getSession().getAttribute(Constants.ADMIN_SESSION_KEY); if (admin == null) { return Constants.OWNERSHIP_ERROR; } if (DataAccessFilter.filterDataResourceById(controlPoint, admin.getId()) == null) { return Constants.OWNERSHIP_ERROR; } controlPointDao.deleteControlPointById(controlPoint.getId()); dataResourceDao.deleteDataResourceById(controlPoint.getId()); Event event = eventDao.getEventByCourseId(controlPoint.getCourseId()); model.addAttribute("event", event); return decorateView(".deleteControlPointSuccess_dashboard", request); } }
38.923077
195
0.753268
522f4d624cc8ea628b5999ef58aa5730dd39f0a6
192
package br.com.anteros.sms.integration.sdk.comtele.models; public class SendContextMessageResource { public String Sender; public String Receivers; public String ContextRuleName; }
24
59
0.791667
31c8cba7b6ba808fba477c6a07de9ff88d4d0437
2,103
package donjinkrawler.observer; import donjinkrawler.Client; import donjinkrawler.Player; import krawlercommon.PlayerData; import krawlercommon.enemies.Enemy; import krawlercommon.enemies.big.BigChicken; import krawlercommon.enemies.small.SmallChicken; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.Mockito; public class ObserverTest { @Mock com.esotericsoftware.kryonet.Client client; @Mock PlayerData playerData; @Mock Client mockClient; public ObserverTest() { client = Mockito.mock(com.esotericsoftware.kryonet.Client.class); playerData = Mockito.mock(PlayerData.class); } @Test public void attachObserverTest() { Player player = new Player(playerData, client, mockClient); Enemy enemy = new SmallChicken(); player.attachObserver(enemy); Assertions.assertTrue(player.getObservers().contains(enemy)); } @Test public void detachObserverTest() { Player player = new Player(playerData, client, mockClient); Enemy enemy = new SmallChicken(); player.attachObserver(enemy); player.detachObserver(enemy); Assertions.assertFalse(player.getObservers().contains(enemy)); } @Test public void detachAllObserversTest() { Player player = new Player(playerData, client, mockClient); Enemy enemy1 = new SmallChicken(); Enemy enemy2 = new BigChicken(); player.attachObserver(enemy1); player.attachObserver(enemy2); player.detachAllObservers(); Assertions.assertEquals(0, player.getObservers().size()); } @Test @Disabled public void notifyObserversTest() { Player player = new Player(playerData, client, mockClient); Enemy enemy = new SmallChicken(); player.attachObserver(enemy); var initialEnemyStrategy = enemy.getInfo(); player.notifyObservers(); Assertions.assertNotSame(initialEnemyStrategy, enemy.getInfo()); } }
30.478261
73
0.695673
03505da302b9feff4b5395a31fabba251b4eceb8
3,524
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.tuscany.sca.core.invocation; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.LifeCycleListener; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.core.invocation.impl.JDKProxyFactory; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.invocation.MessageFactory; /** * Default implementation of a ProxyFactoryExtensionPoint. * * @version $Rev$ $Date$ */ public class DefaultProxyFactoryExtensionPoint implements ProxyFactoryExtensionPoint, LifeCycleListener { private InterfaceContractMapper interfaceContractMapper; private MessageFactory messageFactory; private ProxyFactory interfaceFactory; private ProxyFactory classFactory; public DefaultProxyFactoryExtensionPoint(ExtensionPointRegistry registry) { UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class); this.messageFactory = modelFactories.getFactory(MessageFactory.class); interfaceFactory = new JDKProxyFactory(registry, messageFactory, interfaceContractMapper); } // public DefaultProxyFactoryExtensionPoint(MessageFactory messageFactory, InterfaceContractMapper mapper) { // this.interfaceContractMapper = mapper; // this.messageFactory = messageFactory; // interfaceFactory = new JDKProxyFactory(null, messageFactory, mapper); // } public ProxyFactory getClassProxyFactory() { return classFactory; } public ProxyFactory getInterfaceProxyFactory() { return interfaceFactory; } public void setClassProxyFactory(ProxyFactory factory) { this.classFactory = factory; } public void setInterfaceProxyFactory(ProxyFactory factory) { this.interfaceFactory = factory; } public void start() { if (interfaceFactory instanceof LifeCycleListener) { ((LifeCycleListener)interfaceFactory).start(); } if (classFactory instanceof LifeCycleListener) { ((LifeCycleListener)classFactory).start(); } } public void stop() { if (interfaceFactory instanceof LifeCycleListener) { ((LifeCycleListener)interfaceFactory).stop(); } if (classFactory instanceof LifeCycleListener) { ((LifeCycleListener)classFactory).stop(); } } }
36.708333
115
0.740636
ac43ccfe57256eea93846f21b2b2c66ed4e9c458
9,631
package cloneproject.Instagram.domain.feed.controller; import cloneproject.Instagram.domain.feed.dto.PostUploadResponse; import cloneproject.Instagram.domain.feed.dto.PostDto; import cloneproject.Instagram.domain.feed.dto.PostResponse; import cloneproject.Instagram.domain.feed.dto.PostUploadRequest; import cloneproject.Instagram.domain.feed.service.PostService; import cloneproject.Instagram.domain.member.dto.LikeMembersDto; import cloneproject.Instagram.global.result.ResultResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; import static cloneproject.Instagram.global.result.ResultCode.*; import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE; import javax.validation.Valid; import javax.validation.constraints.NotBlank; @Api(tags = "게시물 API") @RestController @RequiredArgsConstructor @RequestMapping("/posts") public class PostController { private final PostService postService; @ApiOperation(value = "게시물 업로드", consumes = MULTIPART_FORM_DATA_VALUE) @ApiResponses({ @ApiResponse(code = 200, message = "F001 - 게시물 업로드에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G007 - 지원하지 않는 이미지 타입입니다.\n" + "G008 - 변환할 수 없는 파일입니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @PostMapping public ResponseEntity<ResultResponse> uploadPost(@Valid @ModelAttribute PostUploadRequest request) { final PostUploadResponse response = postService.upload(request); return ResponseEntity.ok(ResultResponse.of(CREATE_POST_SUCCESS, response)); } @ApiOperation(value = "게시물 목록 페이징 조회") @ApiResponses({ @ApiResponse(code = 200, message = "F003 - 게시물 목록 페이지 조회에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "page", value = "게시물 page", example = "1", required = true) @GetMapping public ResponseEntity<ResultResponse> getPostPage(@RequestParam int page) { final Page<PostDto> postPage = postService.getPostDtoPage(1, page); return ResponseEntity.ok(ResultResponse.of(FIND_POST_PAGE_SUCCESS, postPage)); } @ApiOperation(value = "최근 게시물 10개 조회") @ApiResponses({ @ApiResponse(code = 200, message = "F005 - 최근 게시물 10개 조회에 성공하였습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @GetMapping("/recent") public ResponseEntity<ResultResponse> getRecent10Posts() { final List<PostDto> postList = postService.getRecent10PostDtos(); return ResponseEntity.ok(ResultResponse.of(FIND_RECENT10POSTS_SUCCESS, postList)); } @ApiOperation(value = "게시물 삭제") @ApiResponses({ @ApiResponse(code = 200, message = "F002 - 게시물 삭제에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다.\n" + "F002 - 게시물 게시자만 삭제할 수 있습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true) @DeleteMapping public ResponseEntity<ResultResponse> deletePost(@RequestParam Long postId) { postService.delete(postId); return ResponseEntity.ok(ResultResponse.of(DELETE_POST_SUCCESS, null)); } @ApiOperation(value = "게시물 조회") @ApiResponses({ @ApiResponse(code = 200, message = "F004 - 게시물 조회에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다.\n"), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true) @GetMapping("/{postId}") public ResponseEntity<ResultResponse> getPost(@PathVariable Long postId) { final PostResponse response = postService.getPostResponse(postId); return ResponseEntity.ok(ResultResponse.of(FIND_POST_SUCCESS, response)); } @ApiOperation(value = "게시물 좋아요") @ApiResponses({ @ApiResponse(code = 200, message = "F006 - 게시물 좋아요에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다.\n" + "F004 - 해당 게시물에 이미 좋아요를 누른 회원입니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true) @PostMapping("/like") public ResponseEntity<ResultResponse> likePost(@RequestParam Long postId) { postService.likePost(postId); return ResponseEntity.ok(ResultResponse.of(LIKE_POST_SUCCESS)); } @ApiOperation(value = "게시물 좋아요 해제") @ApiResponses({ @ApiResponse(code = 200, message = "F007 - 게시물 좋아요 해제에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다.\n" + "F003 - 해당 게시물에 좋아요를 누르지 않은 회원입니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true) @DeleteMapping("/like") public ResponseEntity<ResultResponse> unlikePost(@RequestParam Long postId) { postService.unlikePost(postId); return ResponseEntity.ok(ResultResponse.of(UN_LIKE_POST_SUCCESS)); } @ApiOperation(value = "게시물 좋아요한 회원 목록 페이징 조회") @ApiResponses({ @ApiResponse(code = 200, message = "F014 - 게시물에 좋아요한 회원 목록 페이지 조회에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParams({ @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true), @ApiImplicitParam(name = "page", value = "페이지", example = "1", required = true), @ApiImplicitParam(name = "size", value = "페이지당 개수", example = "10", required = true) }) @GetMapping("/{postId}/likes") public ResponseEntity<ResultResponse> getMembersLikedPost( @PathVariable Long postId, @RequestParam int page, @RequestParam int size) { final Page<LikeMembersDto> response = postService.getPostLikeMembersDtoPage(postId, page, size); return ResponseEntity.ok(ResultResponse.of(GET_POST_LIKES_SUCCESS, response)); } @ApiOperation(value = "게시물 북마크") @ApiResponses({ @ApiResponse(code = 200, message = "F008 - 게시물 북마크에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다.\n" + "F006 - 이미 해당 게시물을 저장하였습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true) @PostMapping("/save") public ResponseEntity<ResultResponse> bookmarkPost(@RequestParam Long postId) { postService.bookmark(postId); return ResponseEntity.ok(ResultResponse.of(BOOKMARK_POST_SUCCESS)); } @ApiOperation(value = "게시물 북마크 해제") @ApiResponses({ @ApiResponse(code = 200, message = "F009 - 게시물 북마크 해제에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다.\n" + "F007 - 아직 해당 게시물을 저장하지 않았습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true) @DeleteMapping("/save") public ResponseEntity<ResultResponse> unBookmarkPost(@RequestParam Long postId) { postService.unBookmark(postId); return ResponseEntity.ok(ResultResponse.of(UN_BOOKMARK_POST_SUCCESS)); } @ApiOperation(value = "게시물 DM 공유") @ApiResponses({ @ApiResponse(code = 200, message = "F018 - 게시물 DM 공유에 성공하였습니다."), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다.\n" + "F001 - 존재하지 않는 게시물입니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParams({ @ApiImplicitParam(name = "postId", value = "게시물 PK", example = "1", required = true), @ApiImplicitParam(name = "usernames", value = "공유할 회원 usernames", required = true) }) @PostMapping("/share") public ResponseEntity<ResultResponse> sharePost(@RequestParam Long postId, @RequestParam List<String> usernames) { postService.sharePost(postId, usernames); return ResponseEntity.ok(ResultResponse.of(SHARE_POST_SUCCESS)); } @ApiOperation(value = "해시태그 게시물 목록 페이징 조회") @ApiResponses({ @ApiResponse(code = 200, message = "F019 - 해시태그 게시물 목록 페이징 조회 성공"), @ApiResponse(code = 400, message = "G003 - 유효하지 않은 입력입니다.\n" + "G004 - 입력 타입이 유효하지 않습니다."), @ApiResponse(code = 401, message = "M003 - 로그인이 필요한 화면입니다."), }) @ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "page", example = "1", required = true), @ApiImplicitParam(name = "size", value = "size", example = "10", required = true), @ApiImplicitParam(name = "hashtag", value = "hashtag", example = "#만두", required = true) }) @GetMapping("/hashtags") public ResponseEntity<ResultResponse> getHashtagPosts(@RequestParam int page, @RequestParam int size, @NotBlank(message = "hashtag는 필수입니다.") @RequestParam String hashtag) { final Page<PostDto> response = postService.getHashTagPosts(page, size, hashtag.substring(1)); return ResponseEntity.ok(ResultResponse.of(GET_HASHTAG_POSTS_SUCCESS, response)); } }
39.962656
115
0.712491
6d1abdee6e37c79148591859456f7595ab3d8579
2,963
package com.ecbpenguin.saml.client.utils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Base64; import java.util.List; import org.opensaml.saml.saml2.metadata.KeyDescriptor; import org.opensaml.saml.saml2.metadata.RoleDescriptor; import org.opensaml.security.credential.UsageType; import org.opensaml.xmlsec.signature.KeyInfo; import org.opensaml.xmlsec.signature.X509Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * * @author ecb_penguin * */ public class MetadataCertificateUtils { private static final Logger LOGGER = LoggerFactory.getLogger(MetadataCertificateUtils.class); /** * Extracts the X509 Certificate from a metadata file for various uses (e.g. signing, signature validation) * * @param roleDescriptor a Metadata descriptor (e.g. SPSSODescriptor, IDPSSODescriptor) * @return the signing X509Certificate */ public static X509Certificate getSigningX509Certifate(final RoleDescriptor roleDescriptor) { for (final KeyDescriptor kd : roleDescriptor.getKeyDescriptors()) { final UsageType usage = kd.getUse(); if (UsageType.SIGNING.equals(usage) || UsageType.UNSPECIFIED.equals(usage)) { return extractX509Certificate(kd); } } return null; } private static final X509Certificate extractX509Certificate(final KeyDescriptor keyDescriptor) { final KeyInfo keyInfo = keyDescriptor.getKeyInfo(); if (keyInfo == null) { return null; } final List<X509Data> x509Datas = keyInfo.getX509Datas(); if (x509Datas.size() == 0) { return null; } final X509Data x509Data = x509Datas.get(0); final List<org.opensaml.xmlsec.signature.X509Certificate> x509Certificates = x509Data.getX509Certificates(); if (x509Certificates.size() == 0) { return null; } final org.opensaml.xmlsec.signature.X509Certificate openSamlCert = x509Certificates.get(0); String lexicalXSDBase64Binary = openSamlCert.getValue(); lexicalXSDBase64Binary =lexicalXSDBase64Binary.replaceAll("(?:\\n|\\r)", ""); LOGGER.debug("Decoding certificate: {}", lexicalXSDBase64Binary.toCharArray()); byte[] decodedString = Base64.getDecoder().decode(new String(lexicalXSDBase64Binary).getBytes()); java.security.cert.X509Certificate cert = null; ByteArrayInputStream bais = null; try { bais = new ByteArrayInputStream(decodedString); CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); cert = (java.security.cert.X509Certificate) certFactory.generateCertificate(bais); } catch (final CertificateException e) { //thrown when ... throw new RuntimeException(e); } finally { if (bais != null ) { try { bais.close(); } catch (final IOException e) { //eat this, alert about possible memory leak. LOGGER.info("Memory leak", e); } } } return cert; } }
32.56044
110
0.750928
7492d5fc688ed22820a7a8639a3af5ba5dfd2543
1,797
package com.octopus.isp.actions.websocket; import com.octopus.utils.xml.XMLMakeup; import com.octopus.utils.xml.XMLObject; import com.octopus.utils.xml.auto.ResultCheck; import com.octopus.utils.xml.auto.XMLDoObject; import com.octopus.utils.xml.auto.XMLParameter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import javax.servlet.http.HttpSession; import javax.websocket.Endpoint; import javax.websocket.HandshakeResponse; import javax.websocket.server.HandshakeRequest; import javax.websocket.server.ServerApplicationConfig; import javax.websocket.server.ServerEndpointConfig; import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * 依赖于tomcate 7以上的websocket-api.jar * User: wfgao_000 * Date: 16-3-25 * Time: 下午9:41 */ public class WebSocketConfig extends ServerEndpointConfig.Configurator implements ServerApplicationConfig { transient static Log log = LogFactory.getLog(WebSocketConfig.class); public void modifyHandshake(ServerEndpointConfig config,HandshakeRequest request,HandshakeResponse response) { HttpSession httpSession = (HttpSession)request.getHttpSession(); config.getUserProperties().put("HttpSession",httpSession); } public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> set) { log.info("begin to register /websocket"); final ServerEndpointConfig b = ServerEndpointConfig.Builder.create(WebSocketAdapter.class, "/websocket").configurator(this).build(); return new HashSet<ServerEndpointConfig>() { { add(b); } }; } public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> set) { return Collections.emptySet(); } }
34.557692
140
0.752922
2366838cb7c9f4690a814cffce4e03b59ed2c97a
6,440
package com.deeal.activity; import com.deeal.fragment.Fragment_order_all; import com.deeal.fragment.Fragment_order_assess; import com.deeal.fragment.Fragment_order_receive; import com.deeal.fragment.Fragment_order_unpay; import com.deeal.fragment.Fragment_order_unship; import com.example.deeal.R; import android.annotation.SuppressLint; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.RelativeLayout; import android.widget.TextView; @SuppressLint("NewApi") public class MyOrderActivity extends FragmentActivity implements OnClickListener { private RelativeLayout myorder_tab1, myorder_tab2, myorder_tab3, myorder_tab4, myorder_tab5; private TextView tv_tab1, tv_tab2, tv_tab3, tv_tab4, tv_tab5; private ViewPager mViewPager; private myPagerAdapter adapter; private ImageButton bt_back; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_myorder); bt_back=(ImageButton) findViewById(R.id.btn_myorder_return); bt_back.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { finish(); } }); inititems(); setListeners(); } @SuppressLint("NewApi") private void inititems() { this.myorder_tab1 = (RelativeLayout) findViewById(R.id.myorder_tab1); this.myorder_tab2 = (RelativeLayout) findViewById(R.id.myorder_tab2); this.myorder_tab3 = (RelativeLayout) findViewById(R.id.myorder_tab3); this.myorder_tab4 = (RelativeLayout) findViewById(R.id.myorder_tab4); this.myorder_tab5 = (RelativeLayout) findViewById(R.id.myorder_tab5); this.tv_tab1 = (TextView) findViewById(R.id.tv_tab1); this.tv_tab2 = (TextView) findViewById(R.id.tv_tab2); this.tv_tab3 = (TextView) findViewById(R.id.tv_tab3); this.tv_tab4 = (TextView) findViewById(R.id.tv_tab4); this.tv_tab5 = (TextView) findViewById(R.id.tv_tab5); settab(); this.mViewPager = (ViewPager) findViewById(R.id.myorder_viewpager); adapter = new myPagerAdapter(getSupportFragmentManager()); mViewPager.setAdapter(adapter); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { // TODO Auto-generated method stub resettab(); switch (position) { case 0: tv_tab1.setBackground(getResources().getDrawable( R.drawable.tabselecor)); tv_tab1.setTextColor(Color.BLACK); break; case 1: tv_tab2.setBackground(getResources().getDrawable( R.drawable.tabselecor)); tv_tab2.setTextColor(Color.BLACK); break; case 2: tv_tab3.setBackground(getResources().getDrawable( R.drawable.tabselecor)); tv_tab3.setTextColor(Color.BLACK); break; case 3: tv_tab4.setBackground(getResources().getDrawable( R.drawable.tabselecor)); tv_tab4.setTextColor(Color.BLACK); break; case 4: tv_tab5.setBackground(getResources().getDrawable( R.drawable.tabselecor)); tv_tab5.setTextColor(Color.BLACK); break; } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); } public void resettab() { tv_tab1.setBackground(null); tv_tab2.setBackground(null); tv_tab3.setBackground(null); tv_tab4.setBackground(null); tv_tab5.setBackground(null); tv_tab1.setTextColor(Color.GRAY); tv_tab2.setTextColor(Color.GRAY); tv_tab3.setTextColor(Color.GRAY); tv_tab4.setTextColor(Color.GRAY); tv_tab5.setTextColor(Color.GRAY); } public void settab() { tv_tab1.setBackground(getResources().getDrawable( R.drawable.tabselecor)); tv_tab2.setBackground(null); tv_tab3.setBackground(null); tv_tab4.setBackground(null); tv_tab5.setBackground(null); tv_tab1.setTextColor(Color.BLACK); tv_tab2.setTextColor(Color.GRAY); tv_tab3.setTextColor(Color.GRAY); tv_tab4.setTextColor(Color.GRAY); tv_tab5.setTextColor(Color.GRAY); } public void setListeners() { myorder_tab1.setOnClickListener(this); myorder_tab2.setOnClickListener(this); myorder_tab3.setOnClickListener(this); myorder_tab4.setOnClickListener(this); myorder_tab5.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.myorder_tab1: mViewPager.setCurrentItem(0, true); break; case R.id.myorder_tab2: mViewPager.setCurrentItem(1,true); break; case R.id.myorder_tab3: mViewPager.setCurrentItem(2,true ); break; case R.id.myorder_tab4: mViewPager.setCurrentItem(3,true); break; case R.id.myorder_tab5: mViewPager.setCurrentItem(4,true); break; } } } class myPagerAdapter extends FragmentPagerAdapter { private Fragment fragment; private Fragment_order_all mFragment_order_all =new Fragment_order_all(); private Fragment_order_assess mFragment_order_assess =new Fragment_order_assess(); private Fragment_order_receive mFragment_order_receive = new Fragment_order_receive(); private Fragment_order_unpay mFragment_order_unpay =new Fragment_order_unpay(); private Fragment_order_unship mFragment_order_unship =new Fragment_order_unship(); public myPagerAdapter(android.support.v4.app.FragmentManager fragmentManager) { super(fragmentManager); // TODO Auto-generated constructor stub } @Override public Fragment getItem(int pageid) { // TODO Auto-generated method stub switch (pageid) { case 0: fragment = mFragment_order_all; break; case 1: fragment = mFragment_order_unpay; break; case 2: fragment = mFragment_order_unship; break; case 3: fragment = mFragment_order_receive; break; case 4: fragment = mFragment_order_assess; break; } return fragment; } @Override public int getCount() { // TODO Auto-generated method stub return 5; } }
26.833333
87
0.747981
981554f5464f5e0fecc602f96ace3fd6263fbeb9
1,564
package org.pentaho.pac.common.config; import java.io.Serializable; public class PdiConfig implements IPdiConfig, Serializable { String repositoryName; String repositoryType; String repositoryUserId; String repositoryPassword; String repositoryXmlFile; public PdiConfig() { } public PdiConfig(IPdiConfig pdiConfig) { setRepositoryName(pdiConfig.getRepositoryName()); setRepositoryPassword(pdiConfig.getRepositoryPassword()); setRepositoryType(pdiConfig.getRepositoryType()); setRepositoryUserId(pdiConfig.getRepositoryUserId()); setRepositoryXmlFile(pdiConfig.getRepositoryXmlFile()); } public String getRepositoryName() { return repositoryName; } public void setRepositoryName(String repositoryName) { this.repositoryName = repositoryName; } public String getRepositoryType() { return repositoryType; } public void setRepositoryType(String repositoryType) { this.repositoryType = repositoryType; } public String getRepositoryUserId() { return repositoryUserId; } public void setRepositoryUserId(String repositoryUserId) { this.repositoryUserId = repositoryUserId; } public String getRepositoryXmlFile() { return repositoryXmlFile; } public void setRepositoryXmlFile(String repositoryXmlFile) { this.repositoryXmlFile = repositoryXmlFile; } public String getRepositoryPassword() { return repositoryPassword; } public void setRepositoryPassword(String repositoryPassword) { this.repositoryPassword = repositoryPassword; } }
26.965517
64
0.762788
428afdfc7cdb4499dbee2c29805e0a616edfd0ff
1,084
package com.babylonhealth.lit.hl7_java.codes; import com.babylonhealth.lit.hl7.CARE_PLAN_ACTIVITY_KIND; public interface CarePlanActivityKind { public static final CARE_PLAN_ACTIVITY_KIND APPOINTMENT = CARE_PLAN_ACTIVITY_KIND.APPOINTMENT$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND COMMUNICATIONREQUEST = CARE_PLAN_ACTIVITY_KIND.COMMUNICATIONREQUEST$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND DEVICEREQUEST = CARE_PLAN_ACTIVITY_KIND.DEVICEREQUEST$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND MEDICATIONREQUEST = CARE_PLAN_ACTIVITY_KIND.MEDICATIONREQUEST$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND NUTRITIONORDER = CARE_PLAN_ACTIVITY_KIND.NUTRITIONORDER$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND SERVICEREQUEST = CARE_PLAN_ACTIVITY_KIND.SERVICEREQUEST$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND TASK = CARE_PLAN_ACTIVITY_KIND.TASK$.MODULE$; public static final CARE_PLAN_ACTIVITY_KIND VISIONPRESCRIPTION = CARE_PLAN_ACTIVITY_KIND.VISIONPRESCRIPTION$.MODULE$; }
49.272727
91
0.829336
7168dbb89a035e174a7750ee0944164d0faa923f
23,405
/* * Copyright (c) 2018. Service Prototyping Lab, ZHAW * All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * * * Author: Piyush Harsh, * URL: piyush-harsh.info * Email: piyush.harsh@zhaw.ch */ package ch.splab.cab.sentinel; import ch.splab.cab.sentinel.dao.*; import com.google.gson.Gson; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.apache.log4j.Logger; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.LinkedList; import java.util.UUID; //@RequestMapping("/v1") //@RequestMapping("/${published.api.version}") //using this breaks Spring jUnit test @RestController @RequestMapping("/v1") public class APIController { final static Logger logger = Logger.getLogger(APIController.class); @RequestMapping(value = {"/api/"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "getApis", notes = "List of all supported API calls") @ApiResponses({ @ApiResponse(code = 200, message = "ok") }) public @ResponseBody ResponseEntity getApis() { LinkedList<APIEndpoints> value = new LinkedList<>(); APIEndpoints value3 = new APIEndpoints(); value3.endpoint = "/v1/api/"; value3.method = "GET"; value3.description = "get list of all supported APIs"; value3.contentType = "application/json"; value.add(value3); APIEndpoints value1 = new APIEndpoints(); value1.endpoint = "/v1/api/user/"; //each space corresponds to an individual db and vectors in a space make for tables in a db value1.method = "POST"; value1.description = "add a new user "; value1.contentType = "application/json"; value.add(value1); APIEndpoints value2 = new APIEndpoints(); value2.endpoint = "/v1/api/user/{id}"; value2.method = "GET"; value2.description = "retrieve info about existing user"; value2.contentType = "application/json"; value.add(value2); APIEndpoints value4 = new APIEndpoints(); value4.endpoint = "/v1/api/space/"; value4.method = "POST"; value4.description = "register a new monitored space"; value4.contentType = "application/json"; value.add(value4); APIEndpoints value5 = new APIEndpoints(); value5.endpoint = "/v1/api/series/"; value5.method = "POST"; value5.description = "register a new series within a space"; value5.contentType = "application/json"; value.add(value5); APIEndpoints value6 = new APIEndpoints(); value6.endpoint = "/v1/api/key/{id}"; value6.method = "GET"; value6.description = "retrieve the api-key for an user"; value6.contentType = "application/json"; value.add(value6); APIEndpoints value7 = new APIEndpoints(); value7.endpoint = "/v1/api/endpoint"; value7.method = "GET"; value7.description = "retrieve the agent's connection endpoint parameters"; value7.contentType = "application/json"; value.add(value7); APIEndpoints value8 = new APIEndpoints(); value8.endpoint = "/v1/api/pingback/{id}"; value8.method = "GET"; value8.description = "retrieve the healthcheck/pingback object data"; value8.contentType = "application/json"; value.add(value8); APIEndpoints value9 = new APIEndpoints(); value9.endpoint = "/v1/api/pingback/"; value9.method = "POST"; value9.description = "registers a new healthcheck/pingback object"; value9.contentType = "application/json"; value.add(value9); Gson gson = new Gson(); String jsonInString = gson.toJson(value); return ResponseEntity.status(HttpStatus.OK).body(jsonInString); } @RequestMapping(value = {"/dashboard/"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "showDashboard", notes = "Displays statically displayed dashboard") @ApiResponses({ @ApiResponse(code = 200, message = "ok") }) public @ResponseBody ResponseEntity showDashboard() { String src = "http://" + AppConfiguration.getDashboardEndpoint() + "/dashboard/db/" + AppConfiguration.getDashboardTitle() + "?refresh=30s&orgId=1&theme=light"; String returnVal = "<html><head></head><body style=\"background-color:white;\">"; returnVal += "<script>\n" + " function resizeIframe(obj) {\n" + " obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';\n" + " }\n" + "</script>"; returnVal += "<div style=\"width:100%; background-color:black;\"><img src=\"http://elastest.io/images/intense/elastest-logo-light.png\" align=\"left\"></div>"; returnVal += "<br><br><br><br>"; returnVal += "<iframe onload=\"resizeIframe(this)\" width=\"99%\" height=\"90%\" style=\"border:none; display:block;\" src=\"" + src + "\">"; returnVal += "</iframe></body></html>"; return ResponseEntity.status(HttpStatus.OK).contentType(MediaType.TEXT_HTML).body(returnVal); } @RequestMapping(value = {"/dashboardsrc"}, method = RequestMethod.GET, produces = {"text/plain"}) @ApiOperation(value = "showDashboardIframeSrc", notes = "Produces iframe source link for static dashboard dashboard") @ApiResponses({ @ApiResponse(code = 200, message = "ok") }) public @ResponseBody ResponseEntity showDashboardIframeSrc() { String src = "http://" + AppConfiguration.getDashboardEndpoint() + "/dashboard/db/" + AppConfiguration.getDashboardTitle() + "?refresh=30s&orgId=1&theme=light"; return ResponseEntity.status(HttpStatus.OK).contentType(MediaType.TEXT_PLAIN).body(src); } @RequestMapping(value = {"/error"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "returnError", notes = "In case an api is not yet implemented") @ApiResponses({ @ApiResponse(code = 501, message = "this call is not supported") }) public @ResponseBody ResponseEntity returnError() { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body("this call is not supported yet. visit /v1/api/ to see supported calls"); } @RequestMapping(value={"/api/user/"}, method = RequestMethod.POST, produces = {"application/json"}) @ApiOperation(value = "createUser", notes = "Create new user account") @ApiResponses({ @ApiResponse(code = 401, message = "valid admin token required"), @ApiResponse(code = 400, message = "check data"), @ApiResponse(code = 409, message = "user account already exists"), @ApiResponse(code = 201, message = "created"), @ApiResponse(code = 500, message = "error in persisting user data, please contact system admin") }) public @ResponseBody ResponseEntity createUser(@RequestBody String reqBody, @RequestHeader(value = "x-auth-token") String adminKey) { Gson gson = new Gson(); UserDataInput incomingData = gson.fromJson(reqBody, UserDataInput.class); if((adminKey == null || adminKey.trim().length() == 0) || !(adminKey != null && adminKey.equalsIgnoreCase(AppConfiguration.getAdminToken()))) { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("valid admin token required"); } if(!incomingData.isValidData()) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("check data"); if(SqlDriver.isDuplicateUser(incomingData.login)) return ResponseEntity.status(HttpStatus.CONFLICT).body("user account already exists"); else { String apiKey = UUID.randomUUID().toString(); UserDataOutput outputData = new UserDataOutput(); outputData.apiKey = apiKey; outputData.login = incomingData.login; int id = SqlDriver.addUser(incomingData.login.trim(), incomingData.password.trim(), apiKey); if(id != -1) { outputData.id = id; outputData.accessUrl = "/api/user/" + id; return ResponseEntity.status(HttpStatus.CREATED).body(gson.toJson(outputData)); } else { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("error in persisting user data. please contact system admin"); } } } @RequestMapping(value={"/api/pingback/{pingid}"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "locatePingData", notes = "Retrieve ping history") @ApiResponses({ @ApiResponse(code = 401, message = "invalid api key"), @ApiResponse(code = 200, message = "ok") }) public @ResponseBody ResponseEntity locatePingData(@RequestHeader(value = "x-auth-apikey") String apiKey, @RequestHeader(value = "x-auth-login") String login, @PathVariable(value="pingid") String pingid) { Gson gson = new Gson(); int pingId = -1; try { pingId = Integer.parseInt(pingid); } catch(NumberFormatException nex) { //supplied value is not an id but a alpha return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("check url data"); } int userId = SqlDriver.getUserId(login); if(!SqlDriver.isValidApikey(userId, apiKey)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid api key"); //get corresponding ping object information. HealthCheckOutput response = SqlDriver.getPingData(pingId, userId); if(response != null) { response.id = pingId; response.accessUrl = "/api/pingback/" + pingId; response.callHistory = Application.eventsCache.getEventTraceHistory(response.pingURL, response.reportURL); return ResponseEntity.status(HttpStatus.OK).body(gson.toJson(response)); } else return ResponseEntity.status(HttpStatus.NO_CONTENT).body("no data found"); } @RequestMapping(value={"/api/user/{userid}"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "locateUserData", notes = "Retrieve user account information") @ApiResponses({ @ApiResponse(code = 401, message = "invalid api key"), @ApiResponse(code = 200, message = "ok") }) public @ResponseBody ResponseEntity locateUserData(@RequestHeader(value = "x-auth-apikey") String apiKey, @PathVariable(value="userid") String login) { Gson gson = new Gson(); int userId = -1; try { userId = Integer.parseInt(login); } catch(NumberFormatException nex) { //supplied value is not an id but a login userId = SqlDriver.getUserId(login); } if(!SqlDriver.isValidApikey(userId, apiKey)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid api key"); //get corresponding space and subspace information. UserDataOutput response = new UserDataOutput(); response.apiKey = apiKey; response.id = userId; response.accessUrl = "/api/user/" + userId; response.spaces = SqlDriver.getUserSpaces(userId).toArray(new SpaceOutput[SqlDriver.getUserSpaces(userId).size()]); return ResponseEntity.status(HttpStatus.OK).body(gson.toJson(response)); } @RequestMapping(value={"/api/key/{userid}"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "locateUserKey", notes = "Allows retrieval of api-key of a particular user") @ApiResponses({ @ApiResponse(code = 200, message = "ok"), @ApiResponse(code = 400, message = "no such user exists"), @ApiResponse(code = 401, message = "invalid password") }) public @ResponseBody ResponseEntity locateUserKey(@RequestHeader(value = "x-auth-password") String password, @PathVariable(value="userid") String login) { Gson gson = new Gson(); int userId = -1; try { userId = Integer.parseInt(login); } catch(NumberFormatException nex) { //supplied value is not an id but a login userId = SqlDriver.getUserId(login); } if(userId == -1) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("no such user exists"); if(!SqlDriver.isValidPassword(userId, password)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid password"); String apiKey = SqlDriver.getAPIKey(userId); UserDataOutput val = new UserDataOutput(); val.id = userId; val.accessUrl = "/api/user/" + userId; val.apiKey = apiKey; return ResponseEntity.status(HttpStatus.OK).body(gson.toJson(val)); } @RequestMapping(value={"/api/space/"}, method = RequestMethod.POST, produces = {"application/json"}) @ApiOperation(value = "createSpace", notes = "Creates a new monitoring space for an user") @ApiResponses({ @ApiResponse(code = 401, message = "invalid api key"), @ApiResponse(code = 400, message = "check data"), @ApiResponse(code = 409, message = "this space already exists for this user"), @ApiResponse(code = 201, message = "created"), @ApiResponse(code = 500, message = "error in creating space object. please contact system admin") }) public @ResponseBody ResponseEntity createSpace(@RequestBody String reqBody, @RequestHeader(value = "x-auth-login") String login, @RequestHeader(value = "x-auth-apikey") String apiKey) { Gson gson = new Gson(); SpaceInput incomingData = gson.fromJson(reqBody, SpaceInput.class); if(!incomingData.isValidData()) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("check data"); if(!SqlDriver.isValidApikey(login, apiKey)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid api key"); if(SqlDriver.isDuplicateSpace(login, incomingData.name)) return ResponseEntity.status(HttpStatus.CONFLICT).body("this space already exists for this user"); //TODO cross check with actual topics registered with Kafka. //now add this space to this user String topicName = "user-" + SqlDriver.getUserId(login) + "-" + incomingData.name; String qUserName = "user" + SqlDriver.getUserId(login) + incomingData.name; String qUserPass = HelperMethods.randomString(16); int spaceId = SqlDriver.addSpace(login, incomingData.name, qUserName, qUserPass); String[] kafkaTopics = KafkaClient.listTopics(); if(Arrays.asList(kafkaTopics).contains("user" + SqlDriver.getUserId(login) + "-" + incomingData.name)) { logger.info("This space " + incomingData.name + " for user: " + login + " is already with Kafka cluster."); } else { boolean status = KafkaClient.createTopic("user-" + SqlDriver.getUserId(login) + "-" + incomingData.name); if(status) logger.info("Topic registered with kafka cluster: " + "user-" + SqlDriver.getUserId(login) + "-" + incomingData.name); else logger.warn("Topic could not be registered with kafka cluster: " + "user" + SqlDriver.getUserId(login) + "-" + incomingData.name); } if(spaceId != -1) { SpaceOutput outputData = new SpaceOutput(); outputData.id = spaceId; outputData.accessUrl = "/api/space/" + spaceId; outputData.name = incomingData.name; outputData.topicName = topicName; outputData.dataDashboardPassword = qUserPass; //InfluxDBClient.addDB(outputData.topicName); //just in case this has not been created by kafka topic monitoring thread boolean status = InfluxDBClient.addUser(outputData.topicName, outputData.topicName, outputData.dataDashboardPassword); if(status) { outputData.dataDashboardUser = qUserName; outputData.dataDashboardUrl = "http://" + AppConfiguration.getStreamAccessUrl() + "/"; } else { outputData.dataDashboardPassword = null; logger.warn("Problem creating new user for this scape: " + outputData.topicName); } return ResponseEntity.status(HttpStatus.CREATED).body(gson.toJson(outputData)); } else return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("error in creating space object. please contact system admin"); } @RequestMapping(value={"/api/series/"}, method = RequestMethod.POST, produces = {"application/json"}) @ApiOperation(value = "createSeries", notes = "Creates a new monitoring series inside an existing space") @ApiResponses({ @ApiResponse(code = 401, message = "invalid api key"), @ApiResponse(code = 400, message = "check data"), @ApiResponse(code = 409, message = "this series already exists within the space"), @ApiResponse(code = 201, message = "created"), @ApiResponse(code = 500, message = "error in creating series object. please contact system admin") }) public @ResponseBody ResponseEntity createSeries(@RequestBody String reqBody, @RequestHeader(value = "x-auth-login") String login, @RequestHeader(value = "x-auth-apikey") String apiKey) { Gson gson = new Gson(); SeriesInput incomingData = gson.fromJson(reqBody, SeriesInput.class); if(!incomingData.isValidData()) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("check data"); if(!SqlDriver.isValidApikey(login, apiKey)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid api key"); if(SqlDriver.isDuplicateSeries(login, incomingData.name, incomingData.spaceName)) return ResponseEntity.status(HttpStatus.CONFLICT).body("this series already exists within the space"); //now add this series to this user within the space int spaceId = SqlDriver.getSpaceId(login, incomingData.spaceName); if(spaceId == -1) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("check data"); } int seriesId = SqlDriver.addSeries(incomingData.name, incomingData.msgSignature, spaceId); if(seriesId != -1) { SeriesOutput outputData = new SeriesOutput(); outputData.id = seriesId; outputData.accessUrl = "/api/series/" + seriesId; outputData.name = incomingData.name; return ResponseEntity.status(HttpStatus.CREATED).body(gson.toJson(outputData)); } else return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("error in creating series object. please contact system admin"); } @RequestMapping(value={"/api/pingback/"}, method = RequestMethod.POST, produces = {"application/json"}) @ApiOperation(value = "createPingBack", notes = "Creates a new health check run for a service by a user") @ApiResponses({ @ApiResponse(code = 401, message = "invalid api key"), @ApiResponse(code = 400, message = "check data"), @ApiResponse(code = 201, message = "created"), @ApiResponse(code = 500, message = "error in creating series object. please contact system admin") }) public @ResponseBody ResponseEntity createPingBack(@RequestBody String reqBody, @RequestHeader(value = "x-auth-login") String login, @RequestHeader(value = "x-auth-apikey") String apiKey) { Gson gson = new Gson(); HealthCheckInput incomingData = gson.fromJson(reqBody, HealthCheckInput.class); if(!incomingData.isValidData()) return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("check data"); if(!SqlDriver.isValidApikey(login, apiKey)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid api key"); //now add this ping to this user within the db int pingId = SqlDriver.addPingEntry(incomingData.pingURL,incomingData.reportURL,incomingData.periodicity,incomingData.toleranceFactor, incomingData.method, login); if(pingId != -1) { HealthCheckOutput outputData = new HealthCheckOutput(); outputData.id = pingId; outputData.accessUrl = "/api/pingback/" + pingId; outputData.pingURL = incomingData.pingURL; outputData.reportURL = incomingData.reportURL; outputData.periodicity = incomingData.periodicity; outputData.toleranceFactor = incomingData.toleranceFactor; outputData.method = incomingData.method; outputData.callHistory = Application.eventsCache.getEventTraceHistory(incomingData.pingURL, incomingData.reportURL); return ResponseEntity.status(HttpStatus.CREATED).body(gson.toJson(outputData)); } else return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("error in creating pingback object. please contact system admin"); } @RequestMapping(value={"/api/endpoint"}, method = RequestMethod.GET, produces = {"application/json"}) @ApiOperation(value = "getEndpointInfo", notes = "Get the endpoint to send data") @ApiResponses({ @ApiResponse(code = 401, message = "invalid api key"), @ApiResponse(code = 200, message = "ok") }) public @ResponseBody ResponseEntity getEndpointInfo(@RequestHeader(value = "x-auth-login") String login, @RequestHeader(value = "x-auth-apikey") String apiKey) { Gson gson = new Gson(); if (!SqlDriver.isValidApikey(login, apiKey)) return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("invalid api key"); //get config parameters EndpointInfo response = new EndpointInfo(); response.endpoint = AppConfiguration.getKafkaURL(); response.keySerializer = AppConfiguration.getKafkaKeySerializer(); response.valueSerializer = AppConfiguration.getKafkaValueSerializer(); return ResponseEntity.status(HttpStatus.OK).body(gson.toJson(response)); } }
49.904051
186
0.647853
dccf5be5a3103577a9f62cb1233ea83ea6c549be
2,695
package org.mikolamb.framework.sub.taskmachine.machine; import org.apache.commons.lang3.StringUtils; import org.mikolamb.framework.common.exception.MikoLambEventException; import org.mikolamb.framework.sub.taskmachine.container.MikoLambTaskMachineContainer; import org.mikolamb.framework.sub.taskmachine.machine.function.MikoLambTaskMachineExecute; import org.mikolamb.framework.sub.taskmachine.queue.MikoLambTaskQueueExecutor; import org.springframework.stereotype.Component; import org.w3c.dom.events.EventException; import java.util.Optional; import java.util.Set; import static org.mikolamb.framework.common.enums.MikoLambExceptionEnum.*; /** * @Author WangGang * @Description //TODO 任务机$ * Created by WangGang on 2019/4/19 0019 15:39 **/ @Component public class MikoLambTaskMachine<Model> implements MikoLambTaskMachineExecute<Model> { private Set<MikoLambTaskMachineContainer<Model>> containers; public MikoLambTaskMachine load(Set<MikoLambTaskMachineContainer<Model>> containers){ if(this.containers!=null){ if(this.containers.size()!=0){ this.containers.addAll(containers); }else { this.containers = containers; } }else { this.containers = containers; } return this; } private <Model>MikoLambTaskMachineContainer<Model> matchContainer(Model model,String taskKey){ if(StringUtils.isBlank(taskKey))throw new MikoLambEventException(ES00000057); Optional.ofNullable(model).orElseThrow(()->new MikoLambEventException(ES00000058)); Optional.ofNullable(containers).orElseThrow(()->new MikoLambEventException(ES00000059)); //找到执行器 MikoLambTaskMachineContainer modelMikoLambTaskMachineContainer = containers.stream().filter((e)->e.getTaskKey().equals(taskKey)).findFirst().orElseThrow(()->new MikoLambEventException(ES00000060)); return modelMikoLambTaskMachineContainer; } private <Model>MikoLambTaskQueueExecutor<Model> getExecutor(Model model, String taskKey){ MikoLambTaskMachineContainer<Model> mikoLambTaskMachineContainer = matchContainer(model,taskKey); MikoLambTaskQueueExecutor<Model> executor = mikoLambTaskMachineContainer.getMikoLambTaskQueueExecutor(); Optional.ofNullable(executor).orElseThrow(()->new MikoLambEventException(ES00000060)); return executor; } @Override public <Model> void blockPush(Model model, String taskKey) { getExecutor(model,taskKey).block().push(model); } @Override public <Model> void unBlockPush(Model model, String taskKey) { getExecutor(model,taskKey).unblock().push(model); } }
40.833333
205
0.743599
63ce9d53b40961ca4e9eeb4e94adbb0787cb6538
2,208
package it.unicam.dmr.doit.controller.progetto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import it.unicam.dmr.doit.controller.Utils; import it.unicam.dmr.doit.service.progetto.ProgettoService; import it.unicam.dmr.doit.service.progetto.ValutazioneService; import javassist.NotFoundException; /** * Questo controller ha la responsabilita' di: * <ul> * <li>La lista delle valutazioni relative ad un progetto;</li> * <li>L'ultima valutazione relativa ad un progetto;</li> * </ul> * * @author Damiano Cacchiarelli * @author Matteo Romagnoli * @author Roberto Cesetti */ @RestController @RequestMapping("/progetto/valutazione") @CrossOrigin(origins = "http://localhost:4200") public class ControllerValutazione { @Autowired private ValutazioneService valutazioneService; @Autowired private ProgettoService progettoService; @GetMapping("/{id}") public ResponseEntity<?> getValutazione(@PathVariable("id") int id) { try { return Utils.creaRisposta(valutazioneService.findById(id), HttpStatus.OK); } catch (NotFoundException e) { return Utils.creaMessaggio(e, HttpStatus.NOT_FOUND); } } @GetMapping("/{id_progetto}/all") public ResponseEntity<?> valutazioniProgetto(@PathVariable("id_progetto") int idProgetto) { try { return Utils.creaRisposta(progettoService.getAllValutazioni(idProgetto), HttpStatus.OK); } catch (NotFoundException e) { return Utils.creaMessaggio(e, HttpStatus.NOT_FOUND); } } @GetMapping("/{id_progetto}/last") public ResponseEntity<?> ultimaValutazioneProgetto(@PathVariable("id_progetto") int idProgetto) { try { return Utils.creaRisposta(progettoService.findById(idProgetto).getLastValutazione(), HttpStatus.OK); } catch (NotFoundException e) { return Utils.creaMessaggio(e, HttpStatus.NOT_FOUND); } } }
33.969231
103
0.782156
f95d2b6f1a1404c69265846b3caa553b3c8906bf
1,073
package demo.netty.pipeline.channel; import demo.netty.pipeline.util.AttributeMap; /** * 通道的顶层定义,表示一次请求事件的传递。 * * 通道具有的属性: * * 通道的作用: * * 入站请求的示例: * <pre> * Channel channel = new DefaultChannel(); * channel.invokeInbound(); * Object result = channelhannel.attr(AttributeKey.valueOf("result")).get(); * </pre> * * 出站请求的示例: * <pre> * Channel channel = new DefaultChannel(); * channel.invokeInbound(); * return channel.attr. * </pre> * * @author leishiguang * @since v1.0 */ public interface Channel extends AttributeMap { /** * 返回当前通道的 id * * @return String 通道id */ String id(); /** * 返回当前通道的配置信息 * * @return ChannelConfig 通道配置 */ ChannelConfig config(); /** * 获取当前通道的 pipeline * * @return ChannelPipeline 通道pipeline */ ChannelPipeline pipeline(); /** * 是否在运行中 * */ boolean isActive(); /** * 停止职责链处理 */ void stop(); /** * 获取当前通道存储的异常 */ Throwable throwable(); /** * 往通道中存储异常 * @param throwable */ void throwable(Throwable throwable); }
14.306667
78
0.59739
5eb947f9532cd560400797db43dbd46c313e538a
5,482
/******************************************************************************* * Copyright (c) 2017, 2021 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ * or the Apache License, Version 2.0 which accompanies this distribution and * is available at https://www.apache.org/licenses/LICENSE-2.0. * * This Source Code may also be made available under the following * Secondary Licenses when the conditions for such availability set * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU * General Public License, version 2 with the GNU Classpath * Exception [1] and GNU General Public License, version 2 with the * OpenJDK Assembly Exception [2]. * * [1] https://www.gnu.org/software/classpath/license.html * [2] http://openjdk.java.net/legal/assembly-exception.html * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception *******************************************************************************/ package java.lang.invoke; import java.lang.reflect.Method; import sun.invoke.util.Wrapper; /* * Stub class to compile OpenJDK j.l.i.MethodHandleImpl */ class LambdaForm { LambdaForm(String str, int num1, Name[] names, int num2) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(String str, int num, Name[] names) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(String str, int num, Name[] names, boolean flag) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, int c) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, int c, Kind d) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, int c, boolean d, MethodHandle e) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, int c, boolean d, MethodHandle e, Kind f) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, Kind c) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, boolean c) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(int a, Name[] b, boolean c, Kind d) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(Name[] a, Name[] b, Name c) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaForm(Name[] a, Name[] b, Name c, boolean d) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } static class NamedFunction { NamedFunction(MethodHandle mh) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } NamedFunction(MethodType mt) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } NamedFunction(MemberName mn, MethodHandle mh) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } NamedFunction(Method m) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } NamedFunction(MethodHandle a, MethodHandleImpl.Intrinsic b) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } NamedFunction(MemberName a, MethodHandle b, MethodHandleImpl.Intrinsic c) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } MethodHandle resolvedHandle() { throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } } enum BasicType { L_TYPE, I_TYPE, J_TYPE, F_TYPE, D_TYPE, V_TYPE; static BasicType basicType(Class<?> cls) { /* Wrapper.forPrimitiveType throws an IllegalArgumentException for * non-primitive types (L_TYPE). */ Wrapper wrapper = Wrapper.forPrimitiveType(cls); BasicType basicType = null; if (wrapper != null) { char basicTypeChar = wrapper.basicTypeChar(); if ((basicTypeChar == 'C') || (basicTypeChar == 'B') || (basicTypeChar == 'Z') || (basicTypeChar == 'I') || (basicTypeChar == 'S') ) { basicType = I_TYPE; } else if (basicTypeChar == 'J') { basicType = J_TYPE; } else if (basicTypeChar == 'F') { basicType = F_TYPE; } else if (basicTypeChar == 'D') { basicType = D_TYPE; } else if (basicTypeChar == 'V') { basicType = V_TYPE; } else { throw new InternalError("Unknown basic type char: " + basicTypeChar); } } return basicType; } } enum Kind { CONVERT, SPREAD, COLLECT, GUARD, GUARD_WITH_CATCH, LOOP, TRY_FINALLY } @interface Hidden { } static final class Name { Name(MethodHandle mh, Object... objs) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } Name(MethodType mt, Object... objs) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } Name(NamedFunction nf, Object... objs) { OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } Name withConstraint(Object obj) { throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } } static LambdaForm.Name[] arguments(int num, MethodType mt) { throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } static NamedFunction constantZero(BasicType bt) { throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } void compileToBytecode() { throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } LambdaFormEditor editor() { throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); } }
27.547739
135
0.702846
eab49b5ef0889d73b4f627f64fa4470b7341ed24
1,918
package com.application.fivnews.data.remote; import com.application.fivnews.data.NewspaperLookupDataSource; import com.application.fivnews.data.model.NewspaperInfo; import com.application.fivnews.data.remote.services.RetrofitServiceRx; import java.util.List; import javax.inject.Singleton; import io.reactivex.Observable; /** * Created by davide-syn on 4/24/18. */ @Singleton public class NewspaperLookupNetworkDataSource extends RetrofitDataSourceBase implements NewspaperLookupDataSource { // public Observable<Lyric> getLyrics(Context context, String owner, String repo) { // try { // InputStream inputStream = context.getAssets().open("sound_track_lyrics_response_200.json"); // int size = inputStream.available(); // byte[] buffer = new byte[size]; // inputStream.read(buffer); // inputStream.close(); // String json = new String(buffer, "UTF-8"); // // Lyric res = new GsonBuilder() // .registerTypeAdapter(Lyric.class, new RetrofitServiceRx.LyricsJsonDeserializer()) // .create() // .fromJson(json, Lyric.class); // return Observable.just(res); // // } catch (IOException e) { // e.printStackTrace(); // throw new UnsupportedOperationException("error on get data"); // } // } /** * * @param domain * @return */ public Observable<NewspaperInfo> getNewspaperInfo(String domain) { return new RetrofitServiceRx().getNewspaperLookupRetrofit() .findCompany(domain) .compose(handleRxErrorsTransformer()); } // /** // * TODO plese refactorize // */ // @Override // public void setLyrics(Lyric lyric, String trackId) { // } // @Override // public boolean hasLyrics(String trackId) { // return false; // } }
30.444444
115
0.627216
a3f7124e310c3446821b381088e71e21e598b26e
333
package com.roily.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.roily.entity.Department; import org.springframework.stereotype.Repository; /** * descripte: * * @author: RoilyFish * @date: 2022/3/10 */ @Repository public interface DepartmentMapper extends BaseMapper<Department> { }
20.8125
67
0.738739
53e24f750ae80e27d73582332283b669d64c3858
966
package eu.makeitapp.meetup.adapter; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import eu.makeitapp.meetup.R; /** * ${PROJECT} * <p/> * Created by Federico Oldrini (federico.oldrini@makeitapp.eu) on 03/04/2015. */ public class MTPMessageViewHolder extends RecyclerView.ViewHolder { public TextView messageTextView; public TextView senderTextView; public ImageView attachmentImageView; public CardView cardView; public MTPMessageViewHolder(View itemView) { super(itemView); messageTextView = (TextView) itemView.findViewById(R.id.tv__message); senderTextView = (TextView) itemView.findViewById(R.id.tv__sender); attachmentImageView = (ImageView) itemView.findViewById(R.id.iv__attachment); cardView = (CardView) itemView.findViewById(R.id.card_view); } }
30.1875
85
0.749482
6504e3c29e90c6c41eb6cb6ebcc296096cb9085c
965
package net.dongliu.apk.parser.struct; /** * android system file. * * @author dongiu */ public class AndroidConstants { public static final String RESOURCE_FILE = "resources.arsc"; public static final String MANIFEST_FILE = "AndroidManifest.xml"; public static final String DEX_FILE = "classes.dex"; public static final String RES_PREFIX = "res/"; public static final String ASSETS_PREFIX = "assets/"; public static final String LIB_PREFIX = "lib/"; public static final String META_PREFIX = "META-INF/"; public static final String ARCH_ARMEABI = ""; /** * the binary xml file used system attr id. */ public static final int ATTR_ID_START = 0x01010000; /** * start offset for system android.R.style */ public static final int SYS_STYLE_ID_START = 0x01030000; /** * end offset for system android.R.style */ public static final int SYS_STYLE_ID_END = 0x01031000; }
22.97619
69
0.678756
9a57458124db0bc04c4b09ba1e2da4ef51c2922e
481
package io.github.thinkframework.generator; import io.github.thinkframework.generator.boot.EnableGenerator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * 命令行运行类 * * @author hdhxby */ @EnableGenerator @SpringBootApplication public class GeneratorApplication { public static void main(String[] args) throws Exception { SpringApplication.run(GeneratorApplication.class, args); } }
24.05
68
0.790021
0cf4cff47ba89a97fc26f68705258ff50ad2c377
1,512
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.resources.v2018_02_01; import rx.Observable; import com.microsoft.azure.management.resources.v2018_02_01.DeploymentOperation; /** * Type representing DeploymentOperations. */ public interface DeploymentOperations { /** * Gets a deployments operation. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param deploymentName The name of the deployment. * @param operationId The ID of the operation to get. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ Observable<DeploymentOperation> getAsync(String resourceGroupName, String deploymentName, String operationId); /** * Gets all deployments operations for a deployment. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param deploymentName The name of the deployment with the operation to get. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ Observable<DeploymentOperation> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName); }
37.8
122
0.749339
99fd64581b66bc3d833d6aafd97b55e9c42d9c58
9,494
/* * Copyright 2018 Cosmo Software */ package org.webrtc.kite.config.paas; import io.cosmosoftware.kite.report.KiteLogger; import org.openqa.selenium.Platform; import org.webrtc.kite.Utils; import org.webrtc.kite.config.client.Client; import javax.json.Json; import javax.json.JsonObject; import javax.json.JsonReader; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.Authenticator; import java.net.HttpURLConnection; import java.net.PasswordAuthentication; import java.net.URL; import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; /** * The Class PaasHandler. */ public abstract class PaasHandler implements Callable<Object> { /** * The Constant logger. */ private static final KiteLogger logger = KiteLogger.getLogger(PaasHandler.class.getName()); /** * The client list. */ protected List<Client> clientList = new ArrayList<Client>(); /** * The paas. */ protected Paas paas; /** * The path to DB. */ private String pathToDB; /** * Instantiates a new paas handler. * * @param pathToDB the path to DB * @param paas the paas */ public PaasHandler(String pathToDB, Paas paas) { this.pathToDB = pathToDB; this.paas = paas; } /* * (non-Javadoc) * * @see java.util.concurrent.Callable#call() */ @Override public Object call() throws Exception { if (!this.isUpdatedInLast24h()) { logger.info("Fetching config for: " + this.paas); this.fetchConfig(); this.createAndFillTable(); } return ""; } /** * Check table exist. * * @param c the c * * @return true, if successful * @throws SQLException the SQL exception */ private boolean checkTableExist(Connection c) throws SQLException { String sql = "SELECT name FROM sqlite_master WHERE type = 'table' AND name = '" + this.paas.getType().name() + "';"; Statement s = null; ResultSet rs = null; try { s = c.createStatement(); rs = s.executeQuery(sql); if (rs.next()) return true; else return false; } finally { Utils.closeDBResources(s, rs); } } /** * Clear table. * * @param c the c * * @throws SQLException the SQL exception */ private void clearTable(Connection c) throws SQLException { String sql = "DELETE FROM " + this.paas.getType().name() + ";"; Statement s = null; try { s = c.createStatement(); s.executeUpdate(sql); } finally { Utils.closeDBResources(s, null); } } /** * Creates the and fill table. * * @throws SQLException the SQL exception */ private void createAndFillTable() throws SQLException { Connection c = null; try { c = this.getDatabaseConnection(); this.createTableIfNotExists(c); try { // begin transaction c.setAutoCommit(false); this.clearTable(c); this.insertValues(c); c.commit(); // end transaction } finally { try { c.rollback(); } catch (SQLException sqle) { logger.warn("SQLException while rolling back", sqle); } c.close(); } } finally { if (c != null) c.close(); } } /** * Creates the table if not exists. * * @param c the c * * @throws SQLException the SQL exception */ private void createTableIfNotExists(Connection c) throws SQLException { String sql = "CREATE TABLE IF NOT EXISTS " + this.paas.getType().name() + "(BROWSER TEXT NOT NULL, " + " VERSION TEXT, " + " PLATFORM TEXT, " + " PLATFORM_TYPE TEXT, " + " LAST_UPDATE INTEGER);"; Statement s = null; try { s = c.createStatement(); s.executeUpdate(sql); } finally { Utils.closeDBResources(s, null); } } /** * Fetch config. * * @throws IOException Signals that an I/O exception has occurred. */ public abstract void fetchConfig() throws IOException; /** * Gets the available config list. * * @param username the username * @param accesskey the accesskey * * @return the available config list * * @throws IOException Signals that an I/O exception has occurred. */ protected List<JsonObject> getAvailableConfigList(String username, String accesskey) throws IOException { URL myurl = new URL(this.paas.getType().restApiUrl()); JsonReader reader = null; List<JsonObject> availableConfigList = null; HttpURLConnection con = null; InputStream is = null; InputStreamReader isr = null; BufferedReader br = null; try { if (username != null && accesskey != null) Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, accesskey.toCharArray()); } }); con = (HttpURLConnection) myurl.openConnection(); is = con.getInputStream(); isr = new InputStreamReader(is); br = new BufferedReader(isr); reader = Json.createReader(br); availableConfigList = reader.readArray().getValuesAs(JsonObject.class); } finally { if (reader != null) reader.close(); if (br != null) try { br.close(); } catch (IOException ioe) { logger.warn(ioe.getClass().getSimpleName(), ioe); } if (isr != null) try { isr.close(); } catch (IOException ioe) { logger.warn(ioe.getClass().getSimpleName(), ioe); } if (is != null) try { is.close(); } catch (IOException ioe) { logger.warn(ioe.getClass().getSimpleName(), ioe); } if (con != null) con.disconnect(); } return availableConfigList; } /** * Gets the database connection. * * @return the database connection * @throws SQLException the SQL exception */ private Connection getDatabaseConnection() throws SQLException { return DriverManager.getConnection("jdbc:sqlite:" + pathToDB); } /** * Gets the paas. * * @return the paas */ public Paas getPaas() { return paas; } /** * Insert values. * * @param c the c * * @throws SQLException the SQL exception */ private void insertValues(Connection c) throws SQLException { String sql = "INSERT INTO " + this.paas.getType().name() + "(BROWSER, VERSION, PLATFORM, PLATFORM_TYPE, LAST_UPDATE) " + "VALUES " + "(?, ?, ?, ?, ?);"; PreparedStatement ps = null; try { ps = c.prepareStatement(sql); for (Client client : clientList) { ps.setString(1, client.getBrowserSpecs().getBrowserName()); ps.setString(2, client.getBrowserSpecs().getVersion()); ps.setString(3, client.getBrowserSpecs().getPlatform().name()); ps.setString(4, client.retrieveFamilyOrPlatform().name()); ps.setLong(5, System.currentTimeMillis()); ps.executeUpdate(); } } finally { Utils.closeDBResources(ps, null); } } /** * Checks if is updated in last 24 h. * * @return true, if is updated in last 24 h * @throws SQLException the SQL exception */ private boolean isUpdatedInLast24h() throws SQLException { Connection c = null; Statement s = null; ResultSet rs = null; try { c = this.getDatabaseConnection(); if (this.checkTableExist(c)) { String sql = "SELECT * FROM " + this.paas.getType().name() + " LIMIT 1;"; s = c.createStatement(); rs = s.executeQuery(sql); if (rs.next()) return (System.currentTimeMillis() - rs.getLong("LAST_UPDATE") < 86400000); else return false; } else return false; } finally { Utils.closeDBResources(s, rs); if (c != null) c.close(); } } /** * Search. * * @param client the client * * @return true, if successful * * @throws SQLException the SQL exception */ public boolean search(Client client) throws SQLException { boolean result = false; if (!client.isApp()) { String browserName = client.getBrowserSpecs().getBrowserName(); String version = client.getBrowserSpecs().getVersion().split("\\.")[0].trim(); Platform platform = client.getBrowserSpecs().getPlatform(); String sql = "SELECT * FROM " + this.paas.getType().name() + " WHERE BROWSER = '" + browserName + "'"; if (version != null && !version.isEmpty()) sql += " AND VERSION LIKE '" + version + "%'"; if (platform != Platform.ANY) { Platform family = platform.family(); if (family == null) sql += " AND PLATFORM_TYPE = '" + platform.name() + "'"; else sql += " AND PLATFORM = '" + platform.name() + "'"; } sql += ";"; Connection c = null; Statement s = null; ResultSet rs = null; try { c = this.getDatabaseConnection(); s = c.createStatement(); rs = s.executeQuery(sql); if (rs.next()) result = true; } finally { Utils.closeDBResources(s, rs); if (c != null) c.close(); } } return result; } }
26.010959
113
0.592163
9c14c9e8862e92cd7ce5eb9e03f12a08da8baeee
560
package backend.commands; import backend.BackendController; import backend.commands.abstracts.SimpleMapCommand; import backend.parser.Input; /** * @author nikita set the size of the pen. Supports unlimited parameters */ public class SetPenSizeCommand extends SimpleMapCommand { public SetPenSizeCommand(Input info, BackendController controller) { super(info, controller, 1); } @Override public double run(double argValue) { getBackendController().getFrontEndController().getDisplayController().setPenSize((int) argValue); return argValue; } }
25.454545
99
0.789286
fe8943504825f22c01f7e1b62bf45d70c1479ee4
213
import java.util.*; public class A5qno8 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); double d=sc.nextDouble(); double d1=Double.MIN_VALUE-d; System.out.println(d1); } }
19.363636
41
0.699531
a06253d02780a5a7a70376f9b5b8ad85752a5aea
2,042
/* * Copyright 2006 The Kuali Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.opensource.org/licenses/ecl2.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.ole.fp.businessobject; import java.sql.Date; import org.kuali.ole.sys.OLEConstants; /** * This helper class works in conjunction with the DepositWizardForm to help build the UI for the Deposit Wizard. */ public class DepositWizardHelper { private String selectedValue; private Date cashReceiptCreateDate; /** * Constructs a JournalVoucherAccountingLineHelper.java. */ public DepositWizardHelper() { selectedValue = OLEConstants.ParameterValues.NO; cashReceiptCreateDate = new Date(0); } /** * Gets the selectedValue attribute. * * @return Returns the selectedValue. */ public String getSelectedValue() { return selectedValue; } /** * Sets the selectedValue attribute value. * * @param selectedValue The selectedValue to set. */ public void setSelectedValue(String selectedValue) { this.selectedValue = selectedValue; } /** * @return current value of cashReceiptCreateDate. */ public Date getCashReceiptCreateDate() { return cashReceiptCreateDate; } /** * Sets the cashReceiptCreateDate attribute value. * * @param cashReceiptCreateDate The cashReceiptCreateDate to set. */ public void setCashReceiptCreateDate(Date cashReceiptCreateDate) { this.cashReceiptCreateDate = cashReceiptCreateDate; } }
28.760563
113
0.699314
e0b4ed1967b107f8c60ddb6d96d1f384ee7f8280
1,628
package com.aerse.mockfs; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; public class FailingByteChannelCallback implements ByteChannelCallback { private final int failAfterBytes; private int processedBytes = 0; public FailingByteChannelCallback(int failAfterBytes) { this.failAfterBytes = failAfterBytes; } @Override public int onRead(ReadableByteChannel channel, ByteBuffer dst) throws IOException { if (failAfterBytes <= processedBytes) { throw new IOException("controlled failure after " + failAfterBytes + " bytes"); } if (dst.remaining() < (failAfterBytes - processedBytes)) { int result = channel.read(dst); processedBytes += result; return result; } ByteBuffer smaller = dst.limit(dst.position() + (failAfterBytes - processedBytes)); int result = channel.read(smaller); processedBytes += result; return result; } @Override public int onWrite(WritableByteChannel channel, ByteBuffer dst) throws IOException { if (failAfterBytes <= processedBytes) { throw new IOException("controlled failure after " + failAfterBytes + " bytes"); } if (dst.remaining() < (failAfterBytes - processedBytes)) { int result = channel.write(dst); processedBytes += result; return result; } int previousLimit = dst.limit(); ByteBuffer smaller = dst.limit(dst.position() + (failAfterBytes - processedBytes)); int result = channel.write(smaller); processedBytes += result; //restore limit so next onWrite will be called dst.limit(previousLimit); return result; } }
30.148148
85
0.743857