query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
The motif pruning strategy applied.
public MotifPruner getMotifPruner() { return motifPruner; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void prune() {\n\n }", "@Override\n\tpublic void runPrune(PruneSetting pSetting) throws Exception {\n\n\t}", "@Test(timeout = 4000)\n public void test00() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n naiveBayesMultinomialText0.setPeriodicPruning((-1));\n naiveBayesMultinomialText0.pruneDictionary();\n assertEquals((-1), naiveBayesMultinomialText0.getPeriodicPruning());\n }", "public void pruneRules_greedy() {\n LOGGER.info(\"STARTED Postpruning\");\n AttributeValue defClass = getDefaultRuleClass();\n int defError = getDefaultRuleError(defClass);\n boolean removeTail=false;\n for (Iterator<ExtendRule> it = extendedRules.iterator(); it.hasNext();) {\n\n ExtendRule rule = it.next();\n rule.updateQuality();\n if (LOGGER.isLoggable(Level.FINE)) {\n LOGGER.log(Level.FINE, \"#Rule {0}\", rule.toString());\n }\n \n if (removeTail)\n {\n it.remove();\n }\n else if (rule.getAntecedentLength() == 0) {\n it.remove();\n } \n else if (rule.getRuleQuality().getA() == 0)\n {\n it.remove();\n }\n else\n {\n int supportingTransactions = rule.removeTransactionsCoveredByAntecedent(true);\n AttributeValue newDefClass = getDefaultRuleClass();\n int newDefError = getDefaultRuleError(newDefClass);\n if (defError<=newDefError)\n {\n //adding the current rule did not decrease the errors compared to a default rule\n it.remove();\n removeTail=true;\n }\n else{\n LOGGER.log(Level.FINE, \"{0} transactions, RULE {1} KEPT\", new Object[]{supportingTransactions, rule.getRID()});\n defClass = newDefClass;\n defError = newDefError;\n } \n }\n \n \n\n\n }\n LOGGER.fine(\"Creating new Extend rule within narrow rule procedure\");\n extendedRules.add(createNewDefaultRule(defClass));\n LOGGER.info(\"FINISHED Postpruning\");\n }", "public void prune(double belowThreshold) {\n \n for(T first : getFirstDimension()) {\n \n for(T second : getMatches(first)) {\n \n if(get(first, second)<belowThreshold) {\n set(first, second, 0.0);\n }\n \n }\n \n }\n \n }", "public boolean prune(Instances data) throws Exception {\n int i;\n double infoGain = computeInfoGain(data);\n\n // If critical value do not reach threshold\n if (infoGain < m_CF) {\n if (!m_isLeaf) {\n boolean pruneable = true;\n //Check child\n // Prune all subtrees.\n Instances[] datas = m_localModel.split(data);\n for (i = 0; i < m_sons.length; i++)\n pruneable = pruneable && son(i).prune(datas[i]);\n\n if (pruneable == true) {\n m_isLeaf = true;\n m_sons = null;\n return true;\n }\n }\n else return true;\n }\n return false;\n }", "@Test(timeout = 4000)\n public void test08() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n naiveBayesMultinomialText0.setPeriodicPruning((-1));\n int int0 = naiveBayesMultinomialText0.getPeriodicPruning();\n assertEquals((-1), int0);\n }", "@Override\n\tpublic void runPrune(String forumPath) throws Exception {\n\n\t}", "private static Thread pruneThread(Thread base, Thread prune)\r\n/* 71: */ {\r\n/* 72:84 */ if (prune.isEmpty()) {\r\n/* 73:84 */ return prune;\r\n/* 74: */ }\r\n/* 75:85 */ if (base.equals(prune)) {\r\n/* 76:86 */ return new Thread(prune);\r\n/* 77: */ }\r\n/* 78:88 */ if (base.contains(prune.get(prune.size() - 1))) {\r\n/* 79:89 */ return new Thread(prune);\r\n/* 80: */ }\r\n/* 81:91 */ Thread pruned = new Thread(prune);\r\n/* 82:92 */ pruned.remove(prune.get(prune.size() - 1));\r\n/* 83:93 */ return pruned;\r\n/* 84: */ }", "private static void prune(ArrayList<Morphism> candidates,\n\t\t\tAutomaton automaton) {\n\t\t// this is really inefficient!\n\t\t// at a minimum, we could avoid recomputing lessThan twice for each\n\t\t// candidate.\n\t\tMorphism least = candidates.get(0);\n\t\tfor (Morphism candidate : candidates) {\n\t\t\tif (lessThan(candidate, least, automaton)) {\n\t\t\t\tleast = candidate;\n\t\t\t}\n\t\t}\n\n\t\tint diff = 0;\n\t\tfor (int i = 0; i != candidates.size(); ++i) {\n\t\t\tMorphism candidate = candidates.get(i);\n\t\t\tif (lessThan(least, candidate, automaton)) {\n\t\t\t\tdiff = diff + 1;\n\t\t\t} else {\n\t\t\t\tcandidates.set(i - diff, candidate);\n\t\t\t}\n\t\t}\n\n\t\t// now actually remove those bypassed.\n\t\tint last = candidates.size();\n\t\twhile (diff > 0) {\n\t\t\tcandidates.remove(--last);\n\t\t\tdiff = diff - 1;\n\t\t}\n\t}", "@Override\n public List<IEpisode> prune(List<IEpisode> candidates, IObserver observer, \n SessionInfo session)\n {\n if (DEBUG) { \n System.out.println(\"NegativeStrengthThreshold: pruning episodes base on individual predictions\");\n System.out.println(\"NegativeStrengthThreshold: start count ->\" + candidates.size());\n } \n observer.setExtent( candidates.size() );\n observer.startup();\n IEventDataStream sequence = session.getSequence();\n for (ListIterator<IEpisode> li = candidates.listIterator(); li.hasNext(); ) \n {\n IEpisode episode = li.next();\n if (episode.size() == 1) return candidates;\n \n if (DEBUG)\n {\n System.out.println(episode.toString(sequence.getEventFactor()) + \n \" : \" + episode.getVoteString() + \" < \" + episode.getRequiredVoteString());\n }\n \n boolean flag = false;\n for(int index = 0; index < session.getSegIndexLen(); index++)\n {\n if (episode.getVotes(index) > episode.getRequiredVotes(index))\n {\n flag = true;\n break;\n }\n }\n if (flag)\n {\n li.remove();\n }\n if (observer.update(li.nextIndex())) break;\n }\n observer.shutdown();\n if (DEBUG) System.out.println(\"NegativeStrengthThreshold: final count ->\" + candidates.size());\n return candidates;\n }", "@Test(timeout = 4000)\n public void test07() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n naiveBayesMultinomialText0.setPeriodicPruning(1072);\n int int0 = naiveBayesMultinomialText0.getPeriodicPruning();\n assertEquals(1072, int0);\n }", "@Test(timeout = 4000)\n public void test63() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n naiveBayesMultinomialText0.setPeriodicPruning(4);\n StringKernel stringKernel0 = new StringKernel();\n naiveBayesMultinomialText0.m_minWordP = (double) 0;\n Capabilities capabilities0 = stringKernel0.getCapabilities();\n TestInstances testInstances0 = TestInstances.forCapabilities(capabilities0);\n Instances instances0 = testInstances0.generate();\n naiveBayesMultinomialText0.buildClassifier(instances0);\n assertEquals(4, naiveBayesMultinomialText0.getPeriodicPruning());\n }", "private void prune(Exemplar predictedExemplar, Instance newInst) throws Exception {\n\n /* remove the Exemplar */\n removeExemplar(predictedExemplar);\n\n /* look for the best nominal feature and the best numeric feature to cut */\n int numAttr = -1, nomAttr = -1;\n double smallestDelta = Double.POSITIVE_INFINITY, delta;\n int biggest_N_Nom = -1, biggest_N_Num = -1, n, m;\n for(int i = 0; i < m_Train.numAttributes(); i++){\n\n if(i == m_Train.classIndex())\n\tcontinue;\n\n /* numeric attribute */\n if(m_Train.attribute(i).isNumeric()){\n\n\t/* compute the distance 'delta' to the closest boundary */\n\tdouble norm = m_MaxArray[i] - m_MinArray[i];\n\tif(norm != 0){\n\t delta = Math.min((predictedExemplar.getMaxBorder(i) - newInst.value(i)), \n\t\t\t (newInst.value(i) - predictedExemplar.getMinBorder(i))) / norm;\n\t} else {\n\t delta = Double.POSITIVE_INFINITY;\n\t}\n\n\t/* compute the size of the biggest Exemplar which would be created */\n\tn = m = 0;\n\tEnumeration enu = predictedExemplar.enumerateInstances();\n\twhile(enu.hasMoreElements()){\n\t Instance ins = (Instance) enu.nextElement();\n\t if(ins.value(i) < newInst.value(i))\n\t n++;\n\t else if(ins.value(i) > newInst.value(i))\n\t m++;\n\t}\n\tn = Math.max(n, m);\n\n\tif(delta < smallestDelta){\n\t smallestDelta = delta;\n\t biggest_N_Num = n;\n\t numAttr = i;\n\t} else if(delta == smallestDelta && n > biggest_N_Num){\n\t biggest_N_Num = n;\n\t numAttr = i;\n\t}\n\n\t/* nominal attribute */\n } else {\n\n\t/* compute the size of the Exemplar which would be created */\n\tEnumeration enu = predictedExemplar.enumerateInstances();\n\tn = 0;\n\twhile(enu.hasMoreElements()){\n\t if(((Instance) enu.nextElement()).value(i) != newInst.value(i))\n\t n++;\n\t}\n\tif(n > biggest_N_Nom){\n\t biggest_N_Nom = n;\n\t nomAttr = i;\n\t} \n }\n }\n\n /* selection of the feature to cut between the best nominal and the best numeric */\n int attrToCut;\n if(numAttr == -1 && nomAttr == -1){\n attrToCut = 0;\n } else if (numAttr == -1){\n attrToCut = nomAttr;\n } else if(nomAttr == -1){\n attrToCut = numAttr;\n } else {\n if(biggest_N_Nom > biggest_N_Num)\n\tattrToCut = nomAttr;\n else\n\tattrToCut = numAttr;\n }\n\n /* split the Exemplar */\n Instance curInst;\n Exemplar a, b;\n a = new Exemplar(this, m_Train, 10, predictedExemplar.classValue());\n b = new Exemplar(this, m_Train, 10, predictedExemplar.classValue());\n LinkedList leftAlone = new LinkedList();\n Enumeration enu = predictedExemplar.enumerateInstances();\n if(m_Train.attribute(attrToCut).isNumeric()){\n while(enu.hasMoreElements()){\n\tcurInst = (Instance) enu.nextElement();\n\tif(curInst.value(attrToCut) > newInst.value(attrToCut)){\n\t a.generalise(curInst);\n\t} else if (curInst.value(attrToCut) < newInst.value(attrToCut)){\n\t b.generalise(curInst);\n\t} else if (notEqualFeatures(curInst, newInst)) {\n\t leftAlone.add(curInst);\n\t}\n }\n } else {\n while(enu.hasMoreElements()){\n\tcurInst = (Instance) enu.nextElement();\n\tif(curInst.value(attrToCut) != newInst.value(attrToCut)){\n\t a.generalise(curInst);\n\t} else if (notEqualFeatures(curInst, newInst)){\n\t leftAlone.add(curInst);\n\t}\n }\n }\n\t\n /* treat the left alone Instances */\n while(leftAlone.size() != 0){\n\n Instance alone = (Instance) leftAlone.removeFirst();\n a.preGeneralise(alone);\n if(!a.holds(newInst)){\n\ta.validateGeneralisation();\n\tcontinue;\n }\n a.cancelGeneralisation();\n b.preGeneralise(alone);\n if(!b.holds(newInst)){\n\tb.validateGeneralisation();\n\tcontinue;\n }\n b.cancelGeneralisation();\n Exemplar exem = new Exemplar(this, m_Train, 3, alone.classValue());\n exem.generalise(alone);\n initWeight(exem);\n addExemplar(exem);\n }\n\n /* add (or not) the new Exemplars */\n if(a.numInstances() != 0){\n initWeight(a);\n addExemplar(a);\n }\n if(b.numInstances() != 0){\n initWeight(b);\n addExemplar(b);\t \n }\n }", "@Override\n\tpublic long checkPrune(PruneSetting pSetting) throws Exception {\n\t\treturn 0;\n\t}", "public interface IPruner\r\n{\r\n\t/**\r\n\t * This is the function that is responsible for calling the pruning algorithm. The algorithm\r\n\t * will hierarchically traverse through the architectural elements and discover which elements\r\n\t * are not linked up to architecture and need to be \"pruned.\" All elements in the document\r\n\t * are cloned before pruning so that the original document is not altered. The result is a document\r\n * containing only the structures and types used in the architecture. Additionally, the pruner \r\n * removes any version graph whose internal nodes are not referenced by any type included in the \r\n * selected architecture.\r\n\t *\r\n\t * @param archURI \t\tThis is the URL of the xADL document that needs to be pruned\r\n\t * @param targetArchURI This is the URL of the new xADL document that will be created and store the pruned architecture\r\n\t * @param startingID \tThis is the ID of the element that the pruning algorithm should start from\r\n\t * @param isStructural \tIf this is true then the startingID is that of an archStruct, otherwise it is an\r\n\t *\t\t\t\t\t\t\tID to a type\r\n\t *\r\n\t * @throws InvalidURIException \t\t\tIf the provided URL to open an xArch document is invalid\r\n\t * @throws InvalidElementIDException \tIf the provided starting ID is invalid\r\n\t * @throws MissingElementException\t\tIf an expected element is missing\r\n\t * @throws MissingAttributeException\tIf an expected attribute on an element is missing\r\n\t * @throws BrokenLinkException\t\t\tIf a link between elements does not match up or exist\r\n\t */\t\r\n\tpublic void prune(String archURI, String targetArchURI, String startingID, boolean isStructural)\r\n\t\tthrows InvalidURIException, InvalidElementIDException, MissingElementException, \r\n\t\t\t\tMissingAttributeException, BrokenLinkException;\r\n}", "@Override\n protected Move makeDecision() {\n myTurn = index();\n /* block the nearest + most effective player (as in, people who arent blocked) */\n ArrayList<Move> pathMoves = new ArrayList<>();\n ArrayList<Move> playMoves = new ArrayList<>();\n ArrayList<Move> discardMoves = new ArrayList<>();\n Map<Integer, Card> destroyCards = new HashMap<Integer, Card>();\n Map<Integer, Card> repairCards = new HashMap<Integer, Card>();\n Map<Integer, Card> blockCards = new HashMap<Integer, Card>();\n Map<Integer, Card> pathCards = new HashMap<Integer, Card>();\n Set<Position> reachable = game().board().getReachable();\n canSee=false;\n canMove=false;\n canBlock=false;\n canRockfall=false;\n canRepair=false;\n int len = hand().size();\n for (int i = 0; i < len; ++i) {\n Card c = hand().get(i);\n if (c instanceof PathCard && !isSabotaged()) {\n pathCards.put(i,c);\n// pathMoves.addAll(generatePossiblePaths(i, (PathCard) c));\n canMove = true;\n }\n if (c instanceof PlayerActionCard) {\n// playMoves.addAll(generatePossiblePlayerActions(i, (PlayerActionCard) c));\n if(c.type()== Card.Type.BLOCK) {\n blockCards.put(i, c);\n canBlock=true;\n }\n else if(c.type()== Card.Type.REPAIR) {\n repairCards.put(i, c);\n canRepair=true;\n }\n }\n if (c.type() == Card.Type.MAP) {\n// playMoves.addAll(generatePossibleMap(i));\n mapIndex = i;\n canSee = true;\n }\n if (c.type() == Card.Type.ROCKFALL) {\n destroyCards.put(i,c);\n// playMoves.addAll(generatePossibleRockfall(i));\n canRockfall = true;\n }\n discardMoves.add(Move.NewDiscardMove(index(), i));\n }\n\n if(canSee) {\n //sum of all heuristics\n double sumGoal[] = new double[3];\n for (Position h : reachable) {\n sumGoal[0]+=(9-(8-h.x)+ 5-(4-h.y));\n sumGoal[1]+=(9-(8-h.x)+ 5-(2-h.y));\n sumGoal[2]+=(9-(8-h.x)+ 5-(-h.y));\n }\n //update goldProb\n for(int i=0; i<3; i++) {\n int seenSum=0;\n for(int j=0; j<numPlayers; j++) {\n if(j!=myTurn) {\n if(haveSeen.get(j)[i]==1) seenSum++;\n }\n }\n goldProb[i] = (i==1?0.5:1)*(1-haveSeen.get(myTurn)[i])*(mapRate*(seenSum/numPlayers)+(sumGoal[i]/10));\n }\n }\n\n// System.out.println(hand());\n// System.out.println(pathMoves);\n\n\n if (role() == Role.GOLD_MINER) {\n //Path\n if(canSee && !goldFound) {\n int selection=0;\n double maxProb=goldProb[0];\n for(int i=0; i<3; i++) {\n if(goldProb[i]>maxProb) {\n maxProb = goldProb[i];\n selection=i;\n }\n }\n Move look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n switch(selection) {\n case 0:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n break;\n case 1:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.MIDDLE);\n break;\n case 2:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.BOTTOM);\n break;\n }\n return look;\n }\n if(canMove) {\n int globalIndex = 0;\n double maxH = 0;\n double oldH;\n Position bp = new Position(0,0);\n boolean rotate = false;\n //Find best path to place;\n Board board = game().board().copy();\n oldH = getClosest(board);\n// System.out.print(getClosest(board)+\" : \");\n for( Map.Entry<Integer, Card> p : pathCards.entrySet()) {\n int index = p.getKey();\n Card path = p.getValue();\n ((PathCard)path).setRotated(false);\n Set<Position> placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n rotate=false;\n }\n }\n ((PathCard) path).setRotated(true);\n placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(simulated);\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n rotate=true;\n maxH = cH;\n }\n }\n }\n// System.out.println(oldH+\": \"+maxH+\" (\"+abs(maxH-oldH)+\")\");\n oldBoard = game().board().copy();\n if(maxH>0 && abs(maxH-oldH)>0.01)\n return Move.NewPathMove(index(), globalIndex, bp.x, bp.y, rotate);\n }\n //Unblock\n if(canRepair) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for(int i=0; i<numPlayers; i++) {\n //heal self\n if(i == myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n// System.out.println(Arrays.toString(game().playerAt(index()).sabotaged()));\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(index()).isRepairable(repair.effects())) {\n return Move.NewPlayerActionMove(index(),index, index());\n }\n }\n }\n else if(i!=myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n// System.out.println(Arrays.toString(game().playerAt(i).sabotaged()));\n if (game().playerAt(i).isRepairable(repair.effects())) {\n //calculate the should i repair? function\n double shouldIBlockMore = Probability[i]+(0.03*(numPlayers-i));\n if(blockMore<shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.75 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Block Enemy\n if(canBlock) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for (int i = 0; i < numPlayers; i++) {\n if (i != myTurn) {\n for (Map.Entry<Integer, Card> b : blockCards.entrySet()) {\n int index = b.getKey();\n PlayerActionCard block = (PlayerActionCard) b.getValue();\n if (game().playerAt(i).isSabotageable(block.effects()[0])) {\n //calculate the should i repair? function\n double shouldIBlockMore = (1 - Probability[i]) * ((1 - Probability[i]) + 0.2 * (numPlayers - i));\n if (blockMore < shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.6 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Fix (Rockfall)\n if(canRockfall) {\n int globalIndex = 0;\n double maxH = 0.0;\n Position bp = new Position(0,0);\n //Find best path to place;\n Board board = game().board().copy();\n for( Map.Entry<Integer, Card> d : destroyCards.entrySet()) {\n int index = d.getKey();\n Set<Position> destroyable = game().board().getDestroyable();\n for (Position h : destroyable) {\n Board simulated = board.simulateRemoveCardAt(h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0)\n return Move.NewRockfallMove(index(), globalIndex, bp.x, bp.y);\n }\n //See map\n\n //Conserve (Find the best card to discard)\n\n //calculate the heuristics and adjust accordingly,\n //choose between playing a card or discarding.\n } else if (role() == Role.SABOTEUR) {\n //See map\n if(canSee && !goldFound) {\n int selection=0;\n //specific for saboteurs\n double maxProb=goldProb[0];\n for(int i=0; i<3; i++) {\n if(goldProb[i]>maxProb) {\n maxProb = goldProb[i];\n selection=i;\n }\n }\n Move look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n switch(selection) {\n case 0:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n break;\n case 1:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.MIDDLE);\n break;\n case 2:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.BOTTOM);\n break;\n }\n return look;\n }\n //Path\n if(canMove) {\n int globalIndex = 0;\n double maxH = 0.0;\n Position bp = new Position(0,0);\n boolean rotate = false;\n //Find best path to place;\n Board board = game().board().copy();\n double oldH = getClosestSabotage(board);\n for( Map.Entry<Integer, Card> p : pathCards.entrySet()) {\n int index = p.getKey();\n Card path = p.getValue();\n ((PathCard)path).setRotated(false);\n Set<Position> placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n rotate=false;\n }\n }\n ((PathCard) path).setRotated(true);\n placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(simulated);\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n rotate=true;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0 && abs(maxH-oldH)>0.01)\n return Move.NewPathMove(index(), globalIndex, bp.x, bp.y, rotate);\n }\n //Unblock Friend\n if(canRepair) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for(int i=0; i<numPlayers; i++) {\n if(i == myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(myTurn).isRepairable(repair.effects())) {\n return Move.NewPlayerActionMove(index(),index, index());\n }\n }\n }\n else if(i!=myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(i).isRepairable(repair.effects())) {\n //calculate the should i repair? function\n double shouldIBlockMore = (1-Probability[i])+(0.03*(numPlayers-i));\n if(blockMore<shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.75 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Block Enemy\n if(canBlock) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for (int i = 0; i < numPlayers; i++) {\n if (i != myTurn) {\n for (Map.Entry<Integer, Card> b : blockCards.entrySet()) {\n int index = b.getKey();\n PlayerActionCard block = (PlayerActionCard) b.getValue();\n if (game().playerAt(i).isSabotageable(block.effects()[0])) {\n //calculate the should i repair? function\n double shouldIBlockMore = (Probability[i]) * ((Probability[i]) + 0.2 * (numPlayers - i));\n if (blockMore < shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.6 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Sabotage (Rockfall)\n if(canRockfall) {\n int globalIndex = 0;\n double maxH = 0;\n Position bp = new Position(0,0);\n //Find best path to place;\n Board board = game().board().copy();\n for( Map.Entry<Integer, Card> d : destroyCards.entrySet()) {\n int index = d.getKey();\n Set<Position> destroyable = game().board().getDestroyable();\n for (Position h : destroyable) {\n Board simulated = board.simulateRemoveCardAt(h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0)\n return Move.NewRockfallMove(index(), globalIndex, bp.x, bp.y);\n }\n //Conserve (Find the best card to discard\n\n //calculate the heuristics and adjust accordingly,\n //choose between playing a card or discarding.\n }\n return discardMoves.get(0);\n }", "public void atExitOfWorker(Worker w, Model model)\n {\n w.setDistLastPheroDrop(w.getPheromonePolicy().getDropDistance()+1);\n //remove all the pheromones that were detected and visited in the way towards\n w.removeAllDetectedPhero();\n w.removeAllVisitedPhero();\n\n model.findPheromones(w);\n w.setMoving(true);\n }", "@Test\r\n\tpublic void testDomainPruning() {\r\n\t}", "public static <T>void pruning(Individual<String, T> individual, GEMapper mapper, double pruningProbability) {\n\t\t\n\t\tStringBuilder genome = new StringBuilder(individual.getGenotype().value());\n\t\tpruning(genome, mapper, pruningProbability);\n\t\tindividual.getGenotype().setValue(genome.toString());\t\t\t\n\t\t\n\t}", "public void pruneRules_cbaLike() {\n LOGGER.info(\"STARTED Postpruning\");\n //HashMap<ExtendRule,Integer> ruleErrors = new HashMap();\n //HashMap<ExtendRule,AttributeValue> ruleDefClass = new HashMap();\n ArrayList<ExtendRule> rulesToRemove = new ArrayList(); \n int totalErrorsWithoutDefault = 0; \n AttributeValue defClassForLowestTotalErrorsRule = getDefaultRuleClass();\n int lowestTotalErrors = getDefaultRuleError(defClassForLowestTotalErrorsRule);;\n ExtendRule lowestTotalErrorsRule = null;\n // DETERMINE TOTAL ERROR AND DEFAULT CLASS ASSOCIATED WITH EACH RULE \n // REMOVE RULES MATCHING ZERO TRANSACTIONS AND OF ZERO LENGTH\n for (Iterator<ExtendRule> it = extendedRules.iterator(); it.hasNext();) {\n\n ExtendRule rule = it.next();\n rule.updateQuality();\n rule.setQualityInRuleList(rule.getRuleQuality());\n if (LOGGER.isLoggable(Level.FINE)) {\n LOGGER.log(Level.FINE, \"Processing rule {0}\", rule.toString());\n }\n\n if (rule.getAntecedentLength() == 0) {\n LOGGER.fine(\"Rule of length 0, MARKED FOR REMOVAL\");\n rulesToRemove.add(rule); //covered transactions should not be removed\n } \n else if (rule.getRuleQuality().getA() == 0)\n {\n LOGGER.fine(\"Rule classifying 0 instances correctly, MARKED FOR REMOVAL\");\n rulesToRemove.add(rule); //covered transactions should not be removed \n }\n else\n {\n rule.removeTransactionsCoveredByAntecedent(true); \n totalErrorsWithoutDefault = totalErrorsWithoutDefault + rule.getRuleQuality().getB();\n // since transactions matching the current rule have been removed, the default class and error can change\n AttributeValue newDefClass = getDefaultRuleClass();\n int newDefError = getDefaultRuleError(newDefClass);\n int totalErrorWithDefault = newDefError + totalErrorsWithoutDefault;\n if (totalErrorWithDefault < lowestTotalErrors)\n {\n lowestTotalErrors = totalErrorWithDefault;\n lowestTotalErrorsRule = rule;\n defClassForLowestTotalErrorsRule= newDefClass;\n } \n //ruleErrors.put(rule,totalErrorWithDefault );\n //ruleDefClass.put(rule, newDefClass); \n }\n \n }\n boolean removeTail;\n // now we know the errors associated with each rule not marked for removal, we can perform pruning\n if (lowestTotalErrorsRule == null)\n {\n // no rule improves error over a classifier composed of only default rule\n // remove all rules\n removeTail = true;\n }\n else \n {\n removeTail = false;\n }\n \n data.getDataTable().unhideAllTransactions();\n for (Iterator<ExtendRule> it = extendedRules.iterator(); it.hasNext();) {\n ExtendRule rule = it.next();\n if (rulesToRemove.contains(rule) || removeTail)\n {\n it.remove();\n continue;\n }\n if (rule.equals(lowestTotalErrorsRule))\n {\n removeTail = true;\n }\n rule.updateQuality(); \n }\n \n \n if (LOGGER.isLoggable(Level.FINE)) {\n LOGGER.fine(\"Creating new default rule within narrow rule procedure\");\n }\n \n \n extendedRules.add(createNewDefaultRule(defClassForLowestTotalErrorsRule));\n \n \n LOGGER.info(\"FINISHED Postpruning\");\n }", "protected synchronized void prune()\n {\n long ldtStart = Base.getSafeTimeMillis();\n int cCur = getUnits();\n int cMin = getLowUnits();\n if (cCur < cMin)\n {\n return;\n }\n\n int nType = getEvictionType();\n switch (nType)\n {\n default:\n case EVICTION_POLICY_HYBRID:\n {\n // sum the entries' units per priority\n int[] acUnits;\n while (true)\n {\n try\n {\n acUnits = new int[11];\n for (Iterator iter = entrySet().iterator(); iter.hasNext(); )\n {\n Entry entry = (Entry) iter.next();\n int cUnits = entry.getUnits();\n try\n {\n acUnits[entry.getPriority()] += cUnits;\n }\n catch (IndexOutOfBoundsException e)\n {\n acUnits[Math.max(0, Math.min(entry.getPriority(), 10))] += cUnits;\n }\n }\n break;\n }\n catch (ConcurrentModificationException e)\n {\n }\n }\n\n int cTotal = 0;\n int nPrunePriority = 0;\n while (nPrunePriority <= 10)\n {\n cTotal += acUnits[nPrunePriority];\n if (cTotal > cMin)\n {\n break;\n }\n ++nPrunePriority;\n }\n\n // build a list of entries to discard\n Entry entryDiscardHead = null;\n Entry entryDiscardTail = null;\n\n // determine the number at the cut-off priority that must be pruned\n int cAdditional = Math.max(0, cTotal - cMin);\n\n while (cCur > cMin)\n {\n try\n {\n for (Iterator iter = entrySet().iterator(); iter.hasNext() && cCur > cMin; )\n {\n Entry entry = (Entry) iter.next();\n int nPriority = entry.getPriority();\n if (nPriority >= nPrunePriority)\n {\n int cUnits = entry.getUnits();\n if (nPriority == nPrunePriority)\n {\n if (cAdditional <= 0)\n {\n continue;\n }\n cAdditional -= cUnits;\n }\n cCur -= cUnits;\n\n // remove the entry from the map\n super.removeEntryInternal(entry);\n\n // link the entry into the list of deferred\n // removals, but without changing its \"next\"\n // reference because the iterator that we are\n // using here is counting on that \"next\" ref\n if (entryDiscardHead == null)\n {\n entryDiscardHead = entry;\n }\n else\n {\n entryDiscardTail.setNext(entry);\n }\n entryDiscardTail = entry;\n }\n }\n\n // seal the end of the linked list of entries to discard\n if (entryDiscardTail != null)\n {\n entryDiscardTail.setNext(null);\n }\n break;\n }\n catch (ConcurrentModificationException e)\n {\n }\n }\n\n // process the list of deferred removals\n for (Entry entryDiscard = entryDiscardHead; entryDiscard != null; )\n {\n // unlink it altogether\n Entry entryNext = entryDiscard.getNext();\n entryDiscard.setNext(null);\n\n // discard it\n removeExpired(entryDiscard, false);\n\n entryDiscard = entryNext;\n }\n }\n break;\n\n case EVICTION_POLICY_LRU:\n case EVICTION_POLICY_LFU:\n {\n boolean fLRU = (nType == EVICTION_POLICY_LRU);\n SparseArray array;\n while (true)\n {\n try\n {\n array = new SparseArray();\n for (Iterator iter = entrySet().iterator(); iter.hasNext(); )\n {\n Entry entry = (Entry) iter.next();\n long lOrder = fLRU ? entry.getLastTouchMillis()\n : entry.getTouchCount();\n Object oPrev = array.set(lOrder, entry);\n if (oPrev != null)\n {\n // oops, more than one entry with the same order;\n // make a list of entries\n List list;\n if (oPrev instanceof List)\n {\n list = (List) oPrev;\n }\n else\n {\n list = new ArrayList();\n list.add((Entry) oPrev);\n }\n list.add(entry);\n array.set(lOrder, list);\n }\n }\n break;\n }\n catch (ConcurrentModificationException e)\n {\n }\n }\n\n for (Iterator iter = array.iterator();\n getUnits() > cMin && iter.hasNext(); )\n {\n Object o = iter.next();\n if (o instanceof Entry)\n {\n Entry entry = (Entry) o;\n removeExpired(entry, true);\n }\n else\n {\n List list = (List) o;\n for (Iterator iterList = list.iterator();\n getUnits() > cMin && iterList.hasNext(); )\n {\n Entry entry = (Entry) iterList.next();\n removeExpired(entry, true);\n }\n }\n }\n }\n break;\n\n case EVICTION_POLICY_EXTERNAL:\n getEvictionPolicy().requestEviction(cMin);\n break;\n }\n m_stats.registerCachePrune(ldtStart);\n }", "public void infect() {\n\n if (random.getRandom() <= getProbability()) {\n isInfected = true;\n isInfectedOnThisStep = true;\n }\n }", "public static void PaladinPruning(GatorDot2C myGator, ADAI2Dot myADAI) {\n\t\tHashMap<String, GatorDot2C.vertex> GatorBoxes = myGator.Boxes;\n\t\tHashSet<String> GatorActivity = new HashSet<String>();\n\t\tfor (Map.Entry<String, GatorDot2C.vertex> entry: GatorBoxes.entrySet()){\n\t\t\tString currentActivity = entry.getValue().act;\n\t\t\tif (!GatorActivity.contains(currentActivity)) {\n\t\t\t\tGatorActivity.add(currentActivity);\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(\"=============\");\n\t\t\n\t\tLinkedList<ADAI2Dot.PathTree> PaladinPaths = myADAI.graphPaths;\n\t\tSystem.out.println(PaladinPaths.size());\n\t\t\n\t\tIterator<ADAI2Dot.PathTree> iter = PaladinPaths.iterator();\n\t\twhile (iter.hasNext()){\n\t\t\tADAI2Dot.PathTree currentPath = iter.next();\n\t\t\tString srcAct = currentPath.src;\n\t\t\tString tgtAct = currentPath.tgt;\n\t\t\tif (!GatorActivity.contains(srcAct) || !GatorActivity.contains(tgtAct)) {\n\t\t\t\titer.remove();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"After Cleaning\");\n\t\tSystem.out.println(PaladinPaths.size());\n\t\tSystem.out.println(\"=============\");\n\t\t\n\t\t// Find edges only between different activities\n\t\tint number = 0;\n\t\titer = PaladinPaths.iterator();\n\t\twhile (iter.hasNext()){\n\t\t\tADAI2Dot.PathTree currentPath = iter.next();\n\t\t\tString srcAct = currentPath.src;\n\t\t\tString tgtAct = currentPath.tgt;\n\t\t\tif (!srcAct.equals(tgtAct)) {\n\t\t\t\tnumber ++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"current connected edges \" + number);\n\t\tSystem.out.println(\"=============\");\n\t\t\n\t\tHashMap<String, Integer> PaladinActivity = myADAI.Activities;\n\t\tIterator<Map.Entry<String, Integer>> iter2 = PaladinActivity.entrySet().iterator();\n\t\twhile (iter2.hasNext()){\n\t\t\tMap.Entry<String, Integer> entry = iter2.next();\n\t\t\tif (!GatorActivity.contains(entry.getKey())) {\n\t\t\t\titer2.remove();\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public void prune() {\n this.getTree().prune();\n }", "public static boolean canPrune() {\n\t\tboolean result = false;\n\t\tint projectedTotal = 0;\n\t\t\n\t\tint i = 0;\n\t\twhile(i<jobsChosen){\n\t\t\tprojectedTotal += board[i][currentCombo[i]];\n\t\t\ti++;\n\t\t}\n\t\twhile(i<numPeople){\n\t\t\tprojectedTotal += bestPossibleCombination[i];\n\t\t\ti++;\n\t\t}\n\t\tif(projectedTotal<bestTotal){//Cant be greater than current Best Total\n\t\t\tresult = true;\n\t\t}\n\t\treturn result;\n\t}", "@Override\n\tprotected TargetPruner createTargetPruner() {\n\t\treturn new IDL3TargetPruner();\n\t}", "public static void pruning(StringBuilder binaryGenome, GEMapper mapper, double pruningProbability) {\n\t\t\n\t\tGenotype<String> genotype = new Genotype<String>(binaryGenome.toString());\n\t\t\n\t\tif (MathUtil.flip(pruningProbability)) {\t\n\t\t\t\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\tmapper.getPhenotype(genotype);\n\t\t\t\t\n\t\t\t\tString usable = null;\n\t\t\t\tint codonSize = mapper.getCodonSize();\n\t\t\t\tint lastRunCodonIndex = mapper.lastRunCodonIndex();\n\t\t\t\tint lastRunWraps = mapper.lastRunWraps();\t\t\t\n\t\t\t\t// Calculate the number of codons in the genotype string\n\t\t\t\t// Note: It is possible the last codon to have less than codonSize bits\n\t\t\t\tint codonsNum = (int) Math.ceil((double) binaryGenome.length() / (double) codonSize);\n\t\t\t\t\n\t\t\t\tif (lastRunWraps > 0) // Genotype Wrapping occured which means that all codons where used\n\t\t\t\t\treturn;\n\t\t\t\tif (lastRunCodonIndex == codonsNum - 1) // Last codon of the genome was used\n\t\t\t\t\treturn;\n\t\t\t\t\n\t\t\t\t// Keep only the used codons\n\t\t\t\tusable = binaryGenome.substring(0, (lastRunCodonIndex + 1) * codonSize);\n\t\t\t\t\n\t\t\t\tbinaryGenome.delete(0, binaryGenome.length());\n\t\t\t\tbinaryGenome.append(usable);\n\t\t\t\t\n\t\t\t}\n\t\t\tcatch(InvalidPhenotypeException ipe) {\n\t\t\t\t//System.out.println(ipe.getMessage());\t\t\t\t\n\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t}", "private void unintelligentDecideMove() {\n\t\twander();\r\n\t}", "private void calculatePartialsPartialsPruning(int iNode1, int iNode2, int iNode3) {\n\t\t// prepare the stack\n\t\tm_nOperation[m_nTopOfStack] = OPERATION_PP;\n\t\tm_nNode1[m_nTopOfStack] = iNode1;\n\t\tm_nNode2[m_nTopOfStack] = iNode2;\n\t\tm_nNode3[m_nTopOfStack] = iNode3;\n\t\tm_nTopOfStack++;\n\t}", "@Test(timeout = 4000)\n public void test64() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n naiveBayesMultinomialText0.setPeriodicPruning(4);\n StringKernel stringKernel0 = new StringKernel();\n Capabilities capabilities0 = stringKernel0.getCapabilities();\n TestInstances testInstances0 = TestInstances.forCapabilities(capabilities0);\n Instances instances0 = testInstances0.generate();\n naiveBayesMultinomialText0.buildClassifier(instances0);\n assertEquals(4, naiveBayesMultinomialText0.getPeriodicPruning());\n }", "public void pruneDocuments(String pruner, float pruner_param) {\n\n // After pruning, make sure have max(RetrievalEnvironment.mCascade_K, |retained docs|)\n // documents!\n\n int[] mDocSet_tmp = new int[mDocSet.length];\n float[] accumulated_scores_tmp = new float[accumulated_scores.length];\n\n int retainSize = 0;\n\n if (pruner.equals(\"score\")) {\n float max_score = accumulated_scores[0];\n float min_score = accumulated_scores[accumulated_scores.length - 1];\n\n float score_threshold = (max_score - min_score) * pruner_param + min_score;\n\n for (int i = 0; i < accumulated_scores.length; i++) {\n if (score_threshold <= accumulated_scores[i]) {\n retainSize++;\n } else {\n break;\n }\n }\n } else if (pruner.equals(\"mean-max\")) {\n float max_score = accumulated_scores[0];\n float mean_score = 0;\n for (int j = 0; j < accumulated_scores.length; j++) {\n mean_score += accumulated_scores[j];\n }\n mean_score = mean_score / (float) accumulated_scores.length;\n float score_threshold = pruner_param * max_score + (1.0f - pruner_param) * mean_score;\n\n for (int i = 0; i < accumulated_scores.length; i++) {\n if (score_threshold <= accumulated_scores[i]) {\n retainSize++;\n } else {\n break;\n }\n }\n } else if (pruner.equals(\"rank\")) {\n // if pruner_param = 0.3 --> remove bottom 30% of the docs!\n retainSize = (int) ((1.0 - pruner_param) * ((double) (mDocSet.length)));\n } else if (pruner.equals(\"z-score\")) {\n // compute mean\n float avgScores = 0.0f;\n\n for (int i = 0; i < accumulated_scores.length; i++) {\n avgScores += accumulated_scores[i];\n }\n avgScores = avgScores / (float) accumulated_scores.length;\n\n // compute variance\n float variance = 0.0f;\n for (int i = 0; i < accumulated_scores.length; i++) {\n variance += (accumulated_scores[i] - avgScores) * (accumulated_scores[i] - avgScores);\n }\n float stddev = (float) Math.sqrt(variance);\n\n float[] z_scores = new float[accumulated_scores.length];\n for (int i = 0; i < z_scores.length; i++) {\n z_scores[i] = (accumulated_scores[i] - avgScores) / stddev;\n }\n } else {\n throw new RetrievalException(\"PruningFunction \" + pruner + \" is not supported!\");\n }\n\n if (retainSize < mK) {\n if (mDocSet.length >= mK) {\n retainSize = mK;\n } else if (mK != defaultNumDocs) {\n // When training the model, set the # output docs large on purpose so that output size =\n // retained docs size\n\n retainSize = mDocSet.length;\n }\n }\n\n if (retainSize > mDocSet.length) {\n retainSize = mDocSet.length;\n }\n\n for (int i = 0; i < retainSize; i++) {\n mDocSet_tmp[i] = mDocSet[i];\n accumulated_scores_tmp[i] = accumulated_scores[i];\n }\n mDocSet = new int[retainSize];\n accumulated_scores = new float[retainSize];\n\n for (int i = 0; i < retainSize; i++) {\n mDocSet[i] = mDocSet_tmp[i];\n accumulated_scores[i] = accumulated_scores_tmp[i];\n }\n\n }", "@Test(timeout = 4000)\n public void test25() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n naiveBayesMultinomialText0.setPeriodicPruning(1279);\n // Undeclared exception!\n try { \n naiveBayesMultinomialText0.pruneDictionary();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"weka.classifiers.bayes.NaiveBayesMultinomialText\", e);\n }\n }", "private static ArrayList<Result> pruneResults(ArrayList<Result> pruneThis, int limit){\n\t\tArrayList<Result> sortednodups = sortByScore(pruneThis);\n\t\tArrayList<Result> pruned = new ArrayList<Result>();\n\t\tfor (int i = 0; i<limit && i < pruneThis.size(); i++){\n\t\t\tpruned.add(sortednodups.get(i));\n\t\t}\n\t\treturn pruned; \n\t}", "public void makesNotHere(){this.piece.unAffect();}", "private Node prune(Node r) {\r\n if (r == null) return null;\r\n Op op = r.op();\r\n r.left(prune(r.left()));\r\n if (r.left() == null) r.ref(prune(r.ref()));\r\n else r.right(prune(r.right()));\r\n if (r.right() != null && r.right().op() == Temp) r.right(null);\r\n if (op == Temp) return r.left();\r\n return r;\r\n }", "@Override\n\tpublic void makeDecision() {\n\t\tDouble weightedFrontProximity;\n\t\tif (algorithmData.receiveMessageData != null && algorithmData.previousDistance != null) {\n\t\t\tdouble delay = (Time.getTime() - algorithmData.receiveMessageData.getStartTime()) / 100000000;\n\t\t\t//calculate the distance us and our predecessor have travelled since message received\n\t\t\talgorithmData.predictedPredecessorMovement = algorithmData.predecessorSpeed * delay\n\t\t\t\t\t+ 0.5 * algorithmData.predecessorAcceleration * delay * delay;\n\t\t\talgorithmData.predictedMovement = algorithmData.previousSpeed * delay\n\t\t\t\t\t+ 0.5 * algorithmData.previousAcceleration * delay * delay;\n\t\t\talgorithmData.predictedFrontProximity = algorithmData.predictedPredecessorMovement\n\t\t\t\t\t- algorithmData.predictedMovement + algorithmData.previousDistance;\n\n\t\t\talgorithmData.chosenSpeed = algorithmData.predecessorChosenSpeed;\n\t\t\talgorithmData.chosenTurnRate = algorithmData.predecessorTurnRate;\n\t\t} else {\n\t\t\t//no message received or no previous distance\n\t\t\talgorithmData.predictedFrontProximity = null;\n\t\t\talgorithmData.chosenSpeed = algorithmData.speed;\n\t\t\talgorithmData.chosenTurnRate = algorithmData.turnRate;\n\t\t}\n\t\tif (algorithmData.frontProximity != null && algorithmData.frontProximity > maxSensorDist) {\n\t\t\talgorithmData.frontProximity = null;\n\t\t}\n\t\tweightedFrontProximity = weightFrontProximity(algorithmData.predictedFrontProximity,\n\t\t\t\talgorithmData.frontProximity);\n\n\t\t// update previous state variables so that they are correct in next time period\n\t\talgorithmData.previousDistance = weightedFrontProximity;\n\t\talgorithmData.previousSpeed = algorithmData.speed;\n\t\talgorithmData.previousAcceleration = algorithmData.acceleration;\n\n\t\tif (weightedFrontProximity != null) {\n\t\t\tif (weightedFrontProximity < buffDist) {\n\t\t\t\tif (algorithmData.chosenAcceleration >= 0) {\n\t\t\t\t\talgorithmData.chosenAcceleration = algorithmData.chosenAcceleration * weightedFrontProximity / buffDist;\n\t\t\t\t} else {\n\t\t\t\t\t// if braking then divide by value so deceleration decreases if gap too small\n\t\t\t\t\talgorithmData.chosenAcceleration = algorithmData.chosenAcceleration / (weightedFrontProximity / buffDist);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (algorithmData.chosenAcceleration >= 0) {\n\t\t\t\t\talgorithmData.chosenAcceleration = algorithmData.chosenAcceleration\n\t\t\t\t\t\t\t* (0.75 + weightedFrontProximity / (4* buffDist));\n\t\t\t\t} else {\n\t\t\t\t\t// if braking then divide by value so deceleration decreases if gap too small\n\t\t\t\t\talgorithmData.chosenAcceleration = algorithmData.chosenAcceleration\n\t\t\t\t\t\t\t/ (0.75 + weightedFrontProximity / (4* buffDist));\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t//no messages received and proximity sensor not working\n\t\t\talgorithmData.chosenAcceleration = 0;\n\t\t}\n\n\n\t}", "void unsetProbables();", "private static Instances pruneRule(Instances data, Instances predOr, Instances itemsets) {\n\t\tInstances bestCopy = itemsets;\n\t\tInstances workingData = new Instances(predOr);\n\t\tdouble bestError = calcError(data, predOr);\n\t\tfor(int i = itemsets.numInstances() - 2; i > 0 ; i--){\n\t\t\tInstances itemsetCopy = new Instances(itemsets);\n\t\t\titemsetCopy.delete(i);\n\t\t\tapplyRules(itemsetCopy, workingData);\n\t\t\tdouble error = calcError(data, workingData);\n\t\t\tif( calcNewError(error) < bestError ){ \n\t\t\t\tbestError = calcNewError(error);\n\t\t\t\tbestCopy = itemsetCopy;\n\t\t\t}\n\t\t}\n\t\treturn bestCopy;\n\t}", "private void sweepChunk(Chunk chunk) {\n for (Entity entity : chunk.getEntities()) {\n\n // Constrain entities to be removed to limitable mobs, excluding villagers\n if (entity.isDead() || !EntityHelper.isLimitableMob(entity) || entity instanceof Villager) continue;\n\n // Exempt special mobs\n if (EntityHelper.isSpecialMob((LivingEntity) entity)) {\n if (plugin.getConfiguration().debug()) {\n plugin.getLogger().info(\"Special mob exempted from removal: \" + EntityHelper.getMobDescription(entity));\n }\n continue;\n }\n\n // Leave two of any farm animals\n if (EntityHelper.isBreedingPair(entity)) continue;\n\n // If relative ages are on, and the mob is targeting a player, don't remove it\n if (isTargetingPlayer(entity)) continue;\n\n // Remove mobs\n ConfiguredMob limits = plugin.getConfiguration().getLimits(entity);\n if (!entity.isDead() && adjustedAge(entity) > limits.getAge() && limits.getAge() > -1) {\n ((LivingEntity) entity).damage(1000); // Kill the entity and drop its items\n removed++;\n lastTargeted.remove(entity.getUniqueId());\n plugin.getLogBlock().logEntityRemoval(entity, 347);\n if (plugin.getConfiguration().debug()) {\n plugin.getLogger().info(\"Removed mob (age limit): \" + EntityHelper.getMobDescription(entity));\n }\n }\n\n }\n }", "public void doElimination() {\n IR ir;\n\tIR defCode;\n\tIR useCode;\n int i, j, countOperand;\n JavaVariable v1, v2;\n short shortOpcode;\n short shortOpcode2;\n boolean singleDefCondition;\n BitSet[] reachingDef = cfg.getReachingDef();\n\n Iterator it = cfg.iterator();\n\twhile(it.hasNext()) {\n ir = (IR) it.next();\n //System.out.println(ir);\n countOperand = ir.getNumOfOperands();\n if (ir.hasAttribute(IRAttribute.ELIMINATED)) {\n // Removed code can't remove other code\n continue; \n }\n // eliminate single def. single use. (aload)\n for (i = 0; i < countOperand; i++) {\n if (ir.getNumOfDefs(i) ==1 && ir.getShortOpcode() != OpcodeConst.opc_areturn) { // single def\n defCode = cfg.getIRAtBpc (ir.getDefOfOperand(i, 0));\n if (defCode.hasAttribute(IRAttribute.ELIMINATED)) {\n // Eliminated code can't remove other codes\n continue;\n } \n\t shortOpcode= defCode.getShortOpcode();\n if (shortOpcode == OpcodeConst.opc_aload ||\n (shortOpcode >= OpcodeConst.opc_aload_0 && shortOpcode <= OpcodeConst.opc_aload_3)) {\n singleDefCondition = false;\n for (j = 0; j < defCode.getNumOfUses(0); j++) {\n singleDefCondition = true;\n // if the def is the only def for every the uses it can reach\n useCode = cfg.getIRAtBpc(defCode.getUseOfTarget(0, j));\n if (useCode.getNumOfDefs(defCode.getTarget(0)) != 1) {\n singleDefCondition = false;\n break;\n }\n if (cfg.getIRAtBpc(useCode.getDefOfOperand(defCode.getTarget(0), 0)).compareTo(defCode) != 0) {\n singleDefCondition = false;\n break;\n }\n // For dup\n // The Reaching Def of the operand of the copy and the Reaching Def of the operand of the useCode\n // should be the same.\n int reachToCopyCode, reachToUseCode;\n reachToCopyCode = getUniqueReachOfVariable(reachingDef[defCode.getBpc()], defCode.getOperand(0));\n reachToUseCode = getUniqueReachOfVariable(reachingDef[useCode.getBpc()], defCode.getOperand(0));\n if (reachToCopyCode != reachToUseCode) {\n singleDefCondition = false;\n break;\n }\n }\n if (singleDefCondition == true) {\n for (j = 0; j < defCode.getNumOfUses(0); j++) {\n useCode = cfg.getIRAtBpc(defCode.getUseOfTarget(0, j));\n if (useCode.hasAttribute(IRAttribute.ELIMINATED) \n /*|| defCode.hasAttribute(IRAttribute.ELIMINATED)*/) {\n continue;\n }\n //System.out.println(\"useCode:\" + useCode + \" defCode:\" + defCode);\n //System.out.println(\"Try to change usecode's operand from \" + defCode.getTarget(0) +\n // \" to \" + defCode.getOperand(0));\n useCode.changeOperand(defCode.getTarget(0), defCode.getOperand(0));\n defCode.setAttribute(IRAttribute.ELIMINATED);\n defCode.addDebugInfoString(\"Eliminated by BPC:\" + ir.getBpc());\n }\n }\n }\n }\n }\n\n // elimination of single use. single def. (astore)\n if (ir.getNumOfTargets() == 1) {\n if (ir.getNumOfUses(0) == 1) {\n v1 = ir.getTarget(0);\n useCode = cfg.getIRAtBpc(ir.getUseOfTarget(0, 0));\n if (useCode.hasAttribute(IRAttribute.ELIMINATED)) {\n // Removed code can't remove other code\n continue; \n }\n countOperand = useCode.getNumOfOperands();\n for (i = 0; i < countOperand; i++) {\n v2 = useCode.getOperand(i);\n if ((v1.compareTo(v2) == 0) && (useCode.getNumOfDefs(i) == 1)) {\n\t //shortOpcode=CFG.makeShortVal((byte)0,useCode.getBytecode().getOpcode());\n shortOpcode = useCode.getShortOpcode();\n if (shortOpcode == OpcodeConst.opc_astore\n || (shortOpcode >= OpcodeConst.opc_astore_0 && shortOpcode <= OpcodeConst.opc_astore_3)) {\n //System.out.println(useCode + \" can be absorbed by \" + ir);\n // 1. substitute the target of bytecode for the target of astore.\n ir.changeTarget(0, useCode.getTarget(0));\n // 2. and remove the astore operation\n useCode.setAttribute(IRAttribute.ELIMINATED);\n useCode.addDebugInfoString(\"Eliminated by BPC:\" + ir.getBpc());\n }\n }\n }\n }\n } \n }\n\n }", "@Override\r\n\tprotected void afterStep() {\r\n\t\tif (pr_disappearing_potential > 0) {\r\n\t\t\tfor (V v : graph.getVertices()) {\r\n\t\t\t\tif (v instanceof TopicVertex) {\r\n\t\t\t\t\tsetOutputValue(v, getOutputValue(v) + (1 - alpha)\r\n\t\t\t\t\t\t\t* (pr_disappearing_potential * getVertexPrior(v)));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tpr_disappearing_potential = 0;\r\n\t\t}\r\n\t\t// not necessary for hits-hub\r\n\t\t// if (disappearing_potential.hub > 0) {\r\n\t\t// for (V v : graph.getVertices()) {\r\n\t\t// if (v instanceof TopicVertex) {\r\n\t\t// double new_hub = getOutputValue(v)\r\n\t\t// + (1 - alpha)\r\n\t\t// * (hitsCoeff * disappearing_potential.hub * getVertexPrior(v));\r\n\t\t// setOutputValue(v, new_hub);\r\n\t\t// } else if (v instanceof TopicCategoryVertex) {\r\n\t\t// // auth and hub of topic category\r\n\t\t// }\r\n\t\t// }\r\n\t\t// disappearing_potential.hub = 0;\r\n\t\t// }\r\n\t\t// if (disappearing_potential.authority > 0) {\r\n\t\t// for (V v : graph.getVertices()) {\r\n\t\t// if (v instanceof TopicCategoryVertex) {\r\n\t\t// double new_auth = getOutputValue(v)\r\n\t\t// + (1 - alpha)\r\n\t\t// * (hitsCoeff * disappearing_potential.authority * getVertexPrior(v));\r\n\t\t// setOutputValue(v, new_auth);\r\n\t\t// }\r\n\t\t// }\r\n\t\t// disappearing_potential.authority = 0;\r\n\t\t// }\r\n\r\n\t\tsuper.afterStep();\r\n\t}", "@SubL(source = \"cycl/inference/harness/inference-balanced-tactician-motivation.lisp\", position = 23525) \n public static final SubLObject balanced_strategy_problem_is_the_rest_of_a_removalP(SubLObject problem, SubLObject strategy) {\n {\n SubLObject set_contents_var = inference_datastructures_problem.problem_dependent_links(problem);\n SubLObject basis_object = set_contents.do_set_contents_basis_object(set_contents_var);\n SubLObject state = NIL;\n for (state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); (NIL == set_contents.do_set_contents_doneP(basis_object, state)); state = set_contents.do_set_contents_update_state(state)) {\n {\n SubLObject restriction_link = set_contents.do_set_contents_next(basis_object, state);\n if ((NIL != set_contents.do_set_contents_element_validP(state, restriction_link))) {\n if ((NIL != inference_datastructures_problem_link.problem_link_has_typeP(restriction_link, $kw9$RESTRICTION))) {\n {\n SubLObject non_focal_problem = inference_datastructures_problem_link.problem_link_supported_problem(restriction_link);\n SubLObject set_contents_var_13 = inference_datastructures_problem.problem_dependent_links(non_focal_problem);\n SubLObject basis_object_14 = set_contents.do_set_contents_basis_object(set_contents_var_13);\n SubLObject state_15 = NIL;\n for (state_15 = set_contents.do_set_contents_initial_state(basis_object_14, set_contents_var_13); (NIL == set_contents.do_set_contents_doneP(basis_object_14, state_15)); state_15 = set_contents.do_set_contents_update_state(state_15)) {\n {\n SubLObject join_ordered_link = set_contents.do_set_contents_next(basis_object_14, state_15);\n if ((NIL != set_contents.do_set_contents_element_validP(state_15, join_ordered_link))) {\n if ((NIL != inference_datastructures_problem_link.problem_link_has_typeP(join_ordered_link, $kw12$JOIN_ORDERED))) {\n if ((NIL != inference_worker_join_ordered.join_ordered_link_restricted_non_focal_linkP(join_ordered_link, restriction_link))) {\n if ((non_focal_problem == inference_worker_join_ordered.join_ordered_link_non_focal_problem(join_ordered_link))) {\n if (((NIL != inference_datastructures_problem_link.problem_link_openP(join_ordered_link))\n && (NIL != balanced_strategy_link_motivates_lookahead_problemP(strategy, join_ordered_link, $kw14$REMOVAL)))) {\n return T;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return NIL;\n }", "public void setTypeOfPruning(String typeOfPruning) {\n this.typeOfPruning = typeOfPruning;\n }", "public void DeriveFromProgramIterationBottomUp (boolean forIntersection, boolean online)\n\t{\n\t\tlevel++;\n\t\t//Reset();\n\t\t//long startTime = System.currentTimeMillis();\n\t\t//previouslyFoundRelevants.clear();\n\t\tSet<Atom> oldAtoms = new HashSet<Atom>(KeyMap.getInstance().Values());\n\t\t\n\t\tfor (int i = beginIdx; i < this.p.getRules().size(); i++)\n\t\t{\n\t\t\tRule rule = this.p.getRules().elementAt(i);\n\t\t\tif (false == forIntersection) \n\t\t\t{\n\t\t\t\tif (false == IsBodyEDB(rule) || true == this.addedInstAtomsInLastIteration.isEmpty()) //if body of rule relies on derived facts.\n\t\t\t\t{\n\t\t\t\t\tInstantiateAllRelevantsInRule(rule, forIntersection, online);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse if (rule.getDerivedInlevel() == level)\n\t\t\t{\n\t\t\t\tInstantiateAllRelevantsInRule(rule, forIntersection, online);\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\tbeginIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\t/*long end = System.currentTimeMillis();\n\t\tif ((end-startTime) > 100) \n\t\t{\n\t\t\tSystem.out.println(\"DeriveFromProgramIterationBottomUp:: time for iteration over all rules: \" + (end-startTime));\n\t\t\tSystem.out.println(\"DeriveFromProgramIterationBottomUp:: num of atoms added last iter = \" + this.addedInstAtomsInLastIteration.size());\n\t\t}*/\n\t\t\n\t\t//UpdateAddedAtomsMap ();\n\t\tif (true == online && false == this.treesWaiting.isEmpty()) \n\t\t{\n\t\t\tList<DerivationTree> list = new ArrayList<DerivationTree>(this.treesWaiting);\n\t\t\tCollections.sort(list);\n\t\t\tif (bestTreeThisStep == null)\n\t\t\t{\n\t\t\t\tfor (DerivationTree derivationTree : list) \n\t\t\t\t{\n\t\t\t\t\tif ( derivationTree.getDerivedFact().getName().contains(this.suffix) ) \n\t\t\t\t\t{\n\t\t\t\t\t\tthis.bestTreeThisStep = derivationTree;\n\t\t\t\t\t\tsuffix += \"_p_1\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tbestWeight = list.get(0).getWeight();\n\t\t\t//double worstWeight = list.get(list.size()-1).getWeight();\n\t\t\t/*for (DerivationTree tree : list)//this.treesThisStep.values()) \n\t\t\t{\n\t\t\t\tif (tree.getDerivedFact().toString().equals(\"dealsWith(Brazil,Botswana)\")) {\n\t\t\t\t\tSystem.out.println(\"dealsWith(Brazil,Botswana) tree weight: \" + tree.getWeight());\n\t\t\t\t}\n\t\t\t}\n\t\t\tint numTimes = 0;\n\t\t\tdouble brokeW = 0;*/\n\t\t\tstartTrees = 0;\n\t\t\tfor (DerivationTree tree : list)\n\t\t\t{\n\t\t\t\tif (tree.getWeight() >= bestWeight && false == tree.getDerivedFact().didFindTop1())\n\t\t\t\t{\n\t\t\t\t\ttree.getDerivedFact().setFoundTop1(true);\n\t\t\t\t\tthis.atomsForDbOnline.add(tree.getDerivedFact());\n\t\t\t\t\t//numTimes++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.startTrees = list.indexOf(tree);\n\t\t\t\t\t//brokeW = tree.getWeight();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//System.out.println(\"num of times got in cond: \" + numTimes + \" max weight: \" + bestWeight + \" break weight: \" + brokeW);\n\t\t\t//System.out.println(\"size of remaining list: \" + (list.size() - numTimes));\n\t\t\t//this.treesThisStep.subList(0, firstRemove).clear();\n\t\t\tif (0 == startTrees) this.treesWaiting = new HashSet<DerivationTree>();\n\t\t\telse this.treesWaiting = new HashSet<DerivationTree>(list.subList(startTrees, list.size()));\n\t\t}\n\t\t\n\t\tif (false == online) \n\t\t{\n\t\t\tthis.addedInstAtomsInLastIteration.addAll(KeyMap.getInstance().Values());// = new HashSet<Atom>(KeyMap.getInstance().Values());\n\t\t\tthis.addedInstAtomsInLastIteration.removeAll(oldAtoms);\n\t\t\t//System.out.println(\"derived this time: \" + this.addedInstAtomsInLastIteration.size());\n\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\tthis.addedInstAtomsInLastIteration = new HashSet<Atom>(this.atomsForDbOnline);\n\t\t\t//System.out.println(\"derived this time: \" + this.addedInstAtomsInLastIteration.size());\n\t\t}\n\t\t\n\t\tUpdateRelevants ();\n\t\t//System.out.println(\"atoms for DB size: \" + this.addedInstAtomsInLastIteration.size());\n\t}", "protected boolean isMovementNoisy() {\n/* 1861 */ return (!this.abilities.flying && (!this.onGround || !isDiscrete()));\n/* */ }", "public void hunt() {\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(cells[i].visited == false) {\n\t\t\t\t\n\t\t\t\tint currentIndex = i;\n\t\t\t\t\n\t\t\t\tArrayList<Integer> neighbors = setVisitedNeighbors(i);\n\t\t\t\tint nextIndex = getRandomVisitedNeighborIndex(neighbors);\n\t\t\t\t\t\t\t\t\n\t\t\t\tif(neighbors.size() != 0 ) {\n\t\t\t\t\tcells[currentIndex].visited = true;\n\t\t\t\t\t\n\t\t\t\t\tif(nextIndex == NOT_EXIST) {\n\t\t\t\t\t\tbreak; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//if there is NO not visited neighbors \n\t\t\t\t\t}\n\t\t\t\t\telse if(currentIndex - nextIndex == -1) {\n\t\t\t\t\t\tcells[currentIndex].border[EAST] = NO_WALL; \t\t\t\t\t\t\t//neighbor is right \n\t\t\t\t\t\tcells[nextIndex].border[WEST] = NO_WALL;\n\t\t\t\t\t}\n\t\t\t\t\telse if(currentIndex - nextIndex == width) {\n\t\t\t\t\t\tcells[currentIndex].border[NORTH] = NO_WALL;\t\t\t\t\t\t\t//neighbor is up\n\t\t\t\t\t\tcells[nextIndex].border[SOUTH] = NO_WALL;\n\t\t\t\t\t}\n\t\t\t\t\telse if(currentIndex - nextIndex == -width) {\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tcells[currentIndex].border[SOUTH] = NO_WALL;\t\t\t\t\t\t\t//neighbor is down\n\t\t\t\t\t\tcells[nextIndex].border[NORTH] = NO_WALL;\n\t\t\t\t\t}\n\t\t\t\t\telse if(currentIndex - nextIndex == 1) {\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tcells[currentIndex].border[WEST] = NO_WALL;\t\t\t\t\t\t\t\t//neighbor is left\n\t\t\t\t\t\tcells[nextIndex].border[EAST] = NO_WALL;\n\t\t\t\t\t}\n\t\t\t\t\tkill(nextIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private void evaluationLogic() {\n // setup for logic:\n // if distToClosestEstimate[i][0] is smaller than threshold, we have a Tp\n // if distToClosestEstimate[i][0] is larger than threshold, we have a Fn\n // all estimatedFeatures that are not assigned Tp are therefore Fp\n for (int i = 0; i < groundTruthInstant.size(); ++i) {\n if (distToClosestEstimate[i][0] < truePositiveThreshold) {\n ++truePositiveCount;\n int assignedEstimatedFeature = (int) distToClosestEstimate[i][1];\n assignedEstimatedFeatures[assignedEstimatedFeature] = true;\n } else\n ++falseNegativeCount;\n }\n for (int i = 0; i < estimatedInstant.size(); ++i)\n if (!assignedEstimatedFeatures[i])\n ++falsePositiveCount;\n }", "private static void postProcess() {\n Set<Transition> ts = petrinet.getTransitions();\n for(Transition t : ts) {\n List<Flow> outEdges = new ArrayList<Flow>(t.getPostsetEdges());\n List<Flow> inEdges = new ArrayList<Flow>(t.getPresetEdges());\n try {\n Flow f = petrinet.getFlow(t.getId(), \"void\");\n System.out.println(\"contain void!\");\n assert(f.getWeight() == 1);\n //if (outEdges.size() == 1) { // Delete the transition.\n f.setWeight(0);\n //}\n } catch (NoSuchEdgeException e) {}\n }\n }", "public void ruleOutPos(){\n for(int i=0;i<scores.length;i++) {\n for(int j=0;j<scores[i].length;j++) {\n scores[i][j][13] = 0;//0=pass, >0 is fail, set to pass initially\n\n //check Ns - bit crude - what to discount regions with high N\n double ns = (double) scores[i][j][14] / (double) pLens[j];\n if (ns >= minPb | ns >= minPm)//\n scores[i][j][13] += 4;\n\n //probe\n if (hasProbe){\n if (j == 1 | j == 4) {\n double perc = (double) scores[i][j][0] / (double) primers[j].length();\n if (perc >= minPb) {\n scores[i][j][12] = 1;//flag for failed % test\n scores[i][j][13] += 2;\n }\n }\n }\n //primer\n else {\n //if more than 2 mismatches in 1-4nt at 3'\n if(scores[i][j][11]>max14nt) {\n scores[i][j][13]+=1;\n }\n //use mLen (combined F and R length) initially to find initial candidates - filter later\n double perc=(double)scores[i][j][0]/(double)mLen;\n double percI=(double)scores[i][j][0]/(double)pLens[j];\n\n if(perc>=minPm | percI>=minPmI) {\n scores[i][j][12]=1;//flag for failed % test\n scores[i][j][13]+=2;\n }\n }\n }\n }//end of finding positions that prime loop\n }", "public void removeMissiles(){\n nunMissiles--;\n }", "private void calculateStatesPartialsPruning(int iNode1, int iNode2, int iNode3) {\n\t\t// prepare the stack\n\t\tm_nOperation[m_nTopOfStack] = OPERATION_SP;\n\t\tif (m_fPartials[m_iCurrentPartials[iNode1]][iNode1] != null && m_fPartials[m_iCurrentPartials[iNode2]][iNode2] != null) {\n\t\t\t// for handling ambiguities\n\t\t\tm_nOperation[m_nTopOfStack] = OPERATION_PP;\n\t\t}\n\t\tm_nNode1[m_nTopOfStack] = iNode1;\n\t\tm_nNode2[m_nTopOfStack] = iNode2;\n\t\tm_nNode3[m_nTopOfStack] = iNode3;\n\t\tm_nTopOfStack++;\n\t}", "public void applyPressureCorrection() {\n // Compute the pressure correction for the entire grid\n for (int i = 1; i < gridSizeX - 1; i++) {\n for (int j = 1; j < gridSizeY - 1; j++) {\n for (int k = 1; k < gridSizeZ - 1; k++) {\n if (!obstacle[i][j][k]) {\n applyPressureCorrection(i, j, k);\n }\n }\n }\n }\n }", "private void cellPredatorRules() {\r\n\t\tif (this.energy <= 0) { // Issue with energy\r\n\t\t\tthis.setNextState(new WaTorState(WaTorState.EMPTY_STATE));\r\n\t\t\tthis.setNextBlock(this.getBlock());\r\n\t\t\tthis.getBlock().setNextCell(this);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.energy--;\r\n\t\tint food = this.getBlock().getAdjacent(prey, \"2457\").size();\r\n\t\tif (food > 0) {\r\n\t\t\tif (!incrementAge(new WaTorState(WaTorState.WATOR_PREDATOR))) {\r\n\t\t\t\teat();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tcellPreyRules(new WaTorState(WaTorState.WATOR_PREDATOR));\r\n\t\t}\r\n\t}", "public void Poneymove() {\n for (int i = 0; i < this.getNumberPoney(); i++) {\n Poney P = this.getPoney()[i];\n if (P.getTour_realise() != this.getNumberRounds()) {\n P.setX(P.getX() + P.getSpeed());\n P.whileJumping();\n collision(i);\n if (P.getX() > 520) {\n P.setX(-220.0);\n P.setSpeed(0.3+(double)(Math.random()*(1-0.3)+1));\n P.setSpeedDecreased(false);\n P.setTour_realise(P.getTour_realise() + 1);\n if (ObstacleStatique.class.isInstance(getObstacle()[i]))\n getObstacle()[i].setX(0);\n P.modeNianOff();\n setChanged();\n notifyObserver(false, i, getPoney()[i].getPoneyColor(), getPoney()[i].getX(), getPoney()[i].getY());\n }\n } else {\n if (!getRank().contains(P.getPoneyColor()))\n getRank().add(P.getPoneyColor());\n }\n setChanged();\n notifyObserver(i, getPoney()[i].getX(), getPoney()[i].getY());\n }\n }", "private ArrayList<Integer> pruneIllegals(ArrayList<Integer> cm,\n ArrayList<Integer> config) {\n //Remove out of bound spots\n for (int i = 0; i < cm.size(); i++) {\n if(cm.get(i) < 0) {\n cm.remove(i);\n i--;\n } else if (cm.get(i) >= config.size()) {\n cm.remove(i);\n i--;\n }\n }\n //Remove points that have no person there\n boolean occupied;\n for (int i = 0; i < cm.size(); i++) {\n if (config.get(cm.get(i)) == '.') {\n cm.remove(i);\n i--;\n }\n }\n\n return cm;\n }", "@Override\n public void onVertexStateUpdated(VertexStateUpdate stateUpdate) {\n pruner.processVertex(stateUpdate.getVertexName());\n }", "@Override\n protected void flamemove ()\n {\n \n }", "protected abstract void calculatePartialsPartialsPruning(double[] partials1, double[] matrices1,\n double[] partials2, double[] matrices2,\n double[] partials3);", "public static void deleteifs (Map<SootMethod, Map<Unit, Boolean>> ifStmts){\r\n\t\tSet<SootMethod> m= ifStmts.keySet();\r\n\t\t//boolean j_Unit_Test = false;\r\n\t\tfor(SootMethod s1:m){\r\n\t\t Chain<Unit> units =s1.getActiveBody().getUnits();\r\n\t\t System.err.println(units);\r\n\t\t Body b=s1.getActiveBody();\r\n\t\t Map<Unit,Boolean> res=ifStmts.get(s1);\r\n\t\t\t for (Map.Entry<Unit,Boolean> entry : res.entrySet())\r\n\t\t\t {\r\n\t\t\t\t Boolean result=entry.getValue();\r\n\t\t\t\t Unit unit=entry.getKey();\r\n\t\t\t\t System.out.println(entry.getKey() + \"/\" + entry.getValue());\r\n\t\t\t\t if(result!=null)\r\n\t\t\t\t\t if (result == true) {\r\n\t\t\t\t\t\t// if condition of else always true, convert if to goto\r\n\t\t\t\t\t\tSystem.out.println(\"[Conditional Branch Folding] else condition is true, change statement into target \");\r\n\t\t\t\t\t\tStmt newStmt = Jimple.v().newGotoStmt(((IfStmt)unit).getTarget());\r\n\t\t\t\t\t\tSystem.out.println(\"[Conditional Branch Folding] Changing : \" + unit + \" into: \" + newStmt);\r\n\t\t\t\t\t\tunits.insertAfter(newStmt, unit);\r\n\t\t\t\t\t\tSystem.out.println(\"[Conditional Branch Folding] Removing statement : \" + unit);\r\n\t\t\t\t\t\tunits.remove(unit);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t// if condition of else is false remove both statement and target\r\n\t\t\t\t\t\tSystem.out.println(\"[Conditional Branch Folding] else condition is false, remove both target and statement\");\r\n\t\t\t\t\t\tunits.remove(unit);\r\n\t\t\t\t\t\t/* check if contain else or not, if statement s does not contain \"goto (branch)\" --> statement contains else\r\n\t\t\t\t\t\twe need to remove else block\r\n\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t//Removing the unreachable code in the procedure\r\n\t\tif(!j_Unit_Boolean) {\r\n\t\t\tUnreachableCodeEliminator.v().transform(b);\r\n\t\t}\r\n\t\t\r\n\t//\tSystem.out.println(\"reeee\");\r\n\t\t}\r\n\t\r\n\t}", "public static Operator killOperator(Actor self, Actor victim) {\n\n\t\t// Set conditions that must be true\n\t\tArrayList<ICondition> beTrue = new ArrayList<ICondition>();\n\t\tbeTrue.add(new LivesCondition(self));\n\t\tbeTrue.add(new LivesCondition(victim));\n\t\tbeTrue.add(new SamePlaceCondition(self, victim));\n\n\t\t// Set conditions that must be false\n\t\tArrayList<ICondition> beFalse = new ArrayList<ICondition>();\n\n\t\t// Set conditions that will be set true\n\t\tArrayList<ICondition> setTrue = new ArrayList<ICondition>();\n\t\tfor (Prop prop : victim.getProps()) {\n\t\t\tsetTrue.add(new IsAtLocationCondition(prop, victim.getLocation()));\n\t\t}\n\n\t\t// Set conditions that will be set false\n\t\tArrayList<ICondition> setFalse = new ArrayList<ICondition>();\n\t\tsetFalse.add(new LivesCondition(victim));\n\t\t\n\t\t// Add the corresponding action to the operator\n\t\tAction action = new Action(Action.ActionType.KILL, self, victim);\n\t\t\n\t\t// The weight for killing actions\n\t\tint weight = 1;\n\n\t\treturn new Operator(beTrue, beFalse, setTrue, setFalse, action, weight);\n\t}", "@Test(timeout = 4000)\n public void test84() throws Throwable {\n NaiveBayesMultinomialText naiveBayesMultinomialText0 = new NaiveBayesMultinomialText();\n String string0 = naiveBayesMultinomialText0.periodicPruningTipText();\n assertFalse(naiveBayesMultinomialText0.getNormalizeDocLength());\n assertEquals(\"How often (number of instances) to prune the dictionary of low frequency terms. 0 means don't prune. Setting a positive integer n means prune after every n instances\", string0);\n assertEquals(0, naiveBayesMultinomialText0.getPeriodicPruning());\n assertFalse(naiveBayesMultinomialText0.getUseWordFrequencies());\n assertEquals(1.0, naiveBayesMultinomialText0.getNorm(), 0.01);\n assertEquals(3.0, naiveBayesMultinomialText0.getMinWordFrequency(), 0.01);\n assertEquals(2.0, naiveBayesMultinomialText0.getLNorm(), 0.01);\n }", "public void classifyAndRepairUnsatisfiability() throws Exception{\n\t\n\t\t\n\t\tinit = Calendar.getInstance().getTimeInMillis();\n\t\t\n\n\t\t//Reason\n\t\tLogOutput.printAlways(\"\\nCLASSIFYING\");\n\t\t\n\t\t//Transform mappings 2 owl\n\t\tgetOWLAxioms4Mappings();\n\t\t\n\t\tsetUpReasoner(true);\t\t\n\t\tsetUpBlackBosExplanationManager();\n\t\t\n\t\t//Will be reused\n\t\tstrctReasoner = new StructuralReasonerExtended(reasoner_access.getOntology());\n\t\t\n\t\t//ONLY Statistics\n\t\t//LogOutput.printAlways(\"\\nSTATISTICS EXPLANATIONS (UNSAT: \" + reasoner_access.getUnsatisfiableClasses().size() + \").\");\n\t\t//repairUnsatisfiability(50);\n\t\t\n\t\t\n\t\tint it=0;\n\t\t\n\t\tLogOutput.printAlways(\"\\nREPAIR GREEDY ALGO:\");\n\t\t\n\t\twhile (reasoner_access.hasUnsatisfiableClasses()){\n\t\t\t\n\t\t\tLogOutput.printAlways(\"\\tUNSAT CLASSES iter \" + it + \": \" + reasoner_access.getUnsatisfiableClasses().size());\n\t\t\t\n\t\t\t//Split unsat and solve!!\n\t\t\tif (!repairUnsatisfiability())\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tapplyBestRepairPlan();\n\t\t\t\n\t\t\t//Clear previous structures\n\t\t\tclearStructures();\n\t\t\t\n\t\t\t//Trasnform mappings 2 owl\n\t\t\tgetOWLAxioms4Mappings();\n\t\t\t\n\t\t\t//Reason\n\t\t\t//setUpReasoner(false);\t\t\t\n\t\t\t//Any unsat\n\t\t\t//if (checkIfAnyUnsat()){ //classify and reinit blackbox\n\t\t\t//\treasoner_access.classifyOntology();\n\t\t\t//\tsetUpBlackBosExplanationManager();\n\t\t\t//}\n\t\t\t//else{ //We are done\n\t\t\t//\treasoner_access.getUnsatisfiableClasses().clear();\n\t\t\t//}\n\t\t\t\n\t\t\t//Reason\n\t\t\tLogOutput.printAlways(\"\\tCLASSIFYING\");\n\t\t\tsetUpReasoner(true);\n\t\t\tsetUpBlackBosExplanationManager();\n\t\t\t\n\t\t\tit++;\n\t\t\t\n\t\t}\n\t\t\n\t\tfin = Calendar.getInstance().getTimeInMillis();\n\t\t\n\t\tdouble time = (float)((double)fin-(double)init)/1000.0;\n\t\tLogOutput.printAlways(\"\\tTIME GREEDY Repair Algorithm (s): \" + time);\n\t\tLogOutput.printAlways(\"\\tUNSAT CLASSES after cleaning: \" + reasoner_access.getUnsatisfiableClasses().size());\n\t\t\n\t\t//We do not clean last reasoner\n\t\t//It is necessary for index\n\t\t\n\t}", "@SubL(source = \"cycl/inference/harness/inference-balanced-tactician-motivation.lisp\", position = 24008) \n public static final SubLObject balanced_strategy_problem_is_the_rest_of_an_early_removalP(SubLObject problem, SubLObject strategy) {\n {\n SubLObject set_contents_var = inference_datastructures_problem.problem_dependent_links(problem);\n SubLObject basis_object = set_contents.do_set_contents_basis_object(set_contents_var);\n SubLObject state = NIL;\n for (state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); (NIL == set_contents.do_set_contents_doneP(basis_object, state)); state = set_contents.do_set_contents_update_state(state)) {\n {\n SubLObject restriction_link = set_contents.do_set_contents_next(basis_object, state);\n if ((NIL != set_contents.do_set_contents_element_validP(state, restriction_link))) {\n if ((NIL != inference_datastructures_problem_link.problem_link_has_typeP(restriction_link, $kw9$RESTRICTION))) {\n {\n SubLObject non_focal_problem = inference_datastructures_problem_link.problem_link_supported_problem(restriction_link);\n SubLObject set_contents_var_16 = inference_datastructures_problem.problem_dependent_links(non_focal_problem);\n SubLObject basis_object_17 = set_contents.do_set_contents_basis_object(set_contents_var_16);\n SubLObject state_18 = NIL;\n for (state_18 = set_contents.do_set_contents_initial_state(basis_object_17, set_contents_var_16); (NIL == set_contents.do_set_contents_doneP(basis_object_17, state_18)); state_18 = set_contents.do_set_contents_update_state(state_18)) {\n {\n SubLObject join_ordered_link = set_contents.do_set_contents_next(basis_object_17, state_18);\n if ((NIL != set_contents.do_set_contents_element_validP(state_18, join_ordered_link))) {\n if ((NIL != inference_datastructures_problem_link.problem_link_has_typeP(join_ordered_link, $kw12$JOIN_ORDERED))) {\n if ((NIL != inference_worker_join_ordered.join_ordered_link_restricted_non_focal_linkP(join_ordered_link, restriction_link))) {\n if ((non_focal_problem == inference_worker_join_ordered.join_ordered_link_non_focal_problem(join_ordered_link))) {\n if ((NIL != balanced_strategy_chooses_to_propagate_new_root_motivation_to_restricted_non_focal_problemP(strategy, problem, join_ordered_link))) {\n return T;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return NIL;\n }", "public void NPSShot()\n\t{\n\t\t//can only occur if a friendly missile and \n\t\t//a NPS are spawned\n\t\tif(gameObj[2].size() > 0 && gameObj[4].size() > 0)\n\t\t{\n\t\t\tint nps = new Random().nextInt(gameObj[2].size());\n\t\t\tint mis = new Random().nextInt(gameObj[4].size());\n\t\t\tgameObj[2].remove(nps);\n\t\t\tgameObj[4].remove(mis);\n\t\t\tscore += 500;\n\t\t\tSystem.out.println(\"A player misile has struck a NPS! +500 points\");\n\t\t}else\n\t\t\tSystem.out.println(\"An NPS and a friendly missile are not spawned\");\n\t}", "private final void pruneParallelSkipEdges() {\n // TODO: IF THERE ARE MULTIPLE EDGES WITH THE SAME EDGE WEIGHT, WE ARBITRARILY PICK THE FIRST EDGE TO KEEP\n // THE ORDERING MAY BE DIFFERENT FROM BOTH SIDES OF THE EDGE, WHICH CAN LEAD TO A NONSYMMETRIC GRAPH\n // However, no issues have cropped up yet. Perhaps the ordering happens to be the same for both sides,\n // due to how the graph is constructed. This is not good to rely upon, however.\n Memory.initialise(maxSize, Float.POSITIVE_INFINITY, -1, false);\n \n int maxDegree = 0;\n for (int i=0;i<nNodes;++i) {\n maxDegree = Math.max(maxDegree, nSkipEdgess[i]);\n }\n \n int[] neighbourIndexes = new int[maxDegree];\n int[] lowestCostEdgeIndex = new int[maxDegree];\n float[] lowestCost = new float[maxDegree];\n int nUsed = 0;\n \n for (int i=0;i<nNodes;++i) {\n nUsed = 0;\n int degree = nSkipEdgess[i];\n int[] sEdges = outgoingSkipEdgess[i];\n float[] sWeights = outgoingSkipEdgeWeightss[i];\n \n for (int j=0;j<degree;++j) {\n int dest = sEdges[j];\n float weight = sWeights[j];\n \n int p = Memory.parent(dest);\n int index = -1;\n \n if (p == -1) {\n index = nUsed;\n ++nUsed;\n \n Memory.setParent(dest, index);\n neighbourIndexes[index] = dest;\n \n lowestCostEdgeIndex[index] = j;\n lowestCost[index] = weight;\n } else {\n index = p;\n if (weight < lowestCost[index]) {\n // Remove existing\n \n /* ________________________________\n * |______E__________C____________L_|\n * ________________________________\n * |______C__________L____________E_|\n * ^\n * |\n * nSkipEdges--\n */\n swapSkipEdges(i, lowestCostEdgeIndex[index], j);\n swapSkipEdges(i, j, degree-1);\n --j; --degree;\n \n // lowestCostEdgeIndex[index] happens to be the same as before.\n lowestCost[index] = weight;\n } else {\n // Remove this.\n \n /* ________________________________\n * |______E__________C____________L_|\n * ________________________________\n * |______E__________L____________C_|\n * ^\n * |\n * nSkipEdges--\n */\n swapSkipEdges(i, j, degree-1);\n --j; --degree;\n }\n }\n \n }\n nSkipEdgess[i] = degree;\n \n // Cleanup\n for (int j=0;j<nUsed;++j) {\n Memory.setParent(neighbourIndexes[j], -1); \n }\n }\n }", "void calculatePR( int iteration){\n\t\t\n\t\ttotal_nodes = inlinks.size();\n\t\tfor(String page : inlinks.keySet()){\n\t\t\tPageRank.put(page, (1/(double)(total_nodes)));\n\t\t\tinit_PageRank.put(page, (1/(double)(total_nodes)));\n\t\t}\n \n double ppx = 0.0;\n boolean cond = true;\n int itr =1;\n // while(iteration >0){ //Used for Graph page rank calculation; c\n while(cond){ \n \tSystem.out.println(\"Iteration\"+itr); \n double sinkPR = 0;\n for(String s: sink){\n \tsinkPR = sinkPR + (PageRank.get(s)); //calculate total sink PR\n }\n \n double entropy = 0.0;\n \n for(String s: PageRank.keySet()){\n \tdouble newPR;\n \tnewPR = (1.0 -d)/total_nodes;\n \tnewPR = newPR + (d*sinkPR)/total_nodes;\n \tSet<String> in = inlinks.get(s); //pages pointing to P\n \tif(in != null){\n \t\tfor(String s1 : in){\n \t\t\tnewPR = newPR + d* (PageRank.get(s1)/outlinks_count.get(s1)); \t\t \n \t\t}\n \t} \n \t\tnew_PageRank.put(s, newPR);\n \t\tentropy = entropy + (newPR*(Math.log(newPR)/Math.log(2))); //entroPy calculation\n \t}\n \n PageRank.putAll(new_PageRank);\n ppx = Math.pow(2,-1*entropy);\n System.out.println(\"perplexity : \"+ ppx);\n ppx_list.add(ppx);\n if(ppx_list.size()>5) \n \tcond= !check(4);\n \n itr++;\n \t\n //\t iteration --; //Used for page Rank Calculation of Graph\n } \n\t}", "@Override\n public void prune(long boundaryValue)\n {\n Iterator<MemorySegment> iterator = segments.iterator();\n while(iterator.hasNext())\n {\n MemorySegment segment = iterator.next();\n if(segment.lastVal() < boundaryValue)\n {\n iterator.remove();\n }\n }\n\n //Note: This maintains a currentSegment even if all segments have\n // been pruned.\n if(segments.size() == 0)\n {\n addSegment();\n }\n }", "protected void getProbabilitiesStayInJail() {\t\t\r\n\t\tboard().dice().forEachPossibleRoll((roll, size) -> {\t\t\t\r\n\t\t\t//if doubles, we're forced to leave jail (but our doubles are accounted for, we don't roll again)\r\n\t\t\tif (roll.isDoubles())\r\n\t\t\t\tboard().nextSpace(board().getSpace(justVisitingID), roll.getTotal()).updateProbAndRoll(1, (double) 1 / size, false);\r\n\t\t\telse\r\n\t\t\t\tboard().getSpace(this.ID() + 1).updateProbAndRoll(0, (double)1 / size, false);\r\n\t\t});\r\n\t}", "void removeDecisionSightDistance(int i);", "public void doOfflineComputation() {\n\t\toptimalPolicy = policyIteration();\n\n\t}", "public void run() {\n if(_dest!=null) {\n approachDest();\n return;\n }\n if(Rand.d100(_frequency)) {\n MSpace m = in.b.getEnvironment().getMSpace();\n if(!m.isOccupied()) {\n Logger.global.severe(in.b+\" has come unstuck\");\n return;\n }\n MSpace[] sur = m.surrounding();\n int i = Rand.om.nextInt(sur.length);\n for(int j=0;j<sur.length;j++) {\n if(sur[i]!=null&&sur[i].isWalkable()&&accept(sur[i])) {\n in.b.getEnvironment().face(sur[i]);\n MSpace sp = in.b.getEnvironment().getMSpace().move(in.b.getEnvironment().getFacing());\n if(sp!=null&&(in.b.isBlind()||!sp.isOccupied())) {\n _move.setBot(in.b);\n _move.perform();\n }\n break;\n }\n if(++i==sur.length) {\n i = 0;\n }\n }\n }\n else if(_dest==null&&Rand.d100(_travel)) {\n _dest = findNewSpace();\n //System.err.println(in.b+\" DEST: \"+_dest);\n }\n }", "@Override UpodCondition getConditionTest(UpodProgram pgm) {\n return null;\n }", "public void run() {\n Set<Philosopher> disabledPhils = new HashSet<Philosopher>();\r\n // True if last philosopher who tried to eat succeed\r\n boolean wasAttemptSuccessful = false;\r\n final long startTime = System.currentTimeMillis();\r\n while (System.currentTimeMillis() - startTime < runningTime) {\r\n if (wasAttemptSuccessful || hungryPhils.isEmpty()) {\r\n hungryPhils.addAll(disabledPhils);\r\n disabledPhils.clear();\r\n }\r\n Philosopher philBeingServed = null;\r\n try {\r\n philBeingServed = hungryPhils.take(); // get phil with the highest priority\r\n disabledPhils.add(philBeingServed);\r\n if (forks.get(philBeingServed.id).attempt(1)) { // Could use tryLock instead\r\n if (FireStarter.isDebugEnabled) {\r\n System.out.println(\"[\" + philBeingServed.id + \"] took left fork\");\r\n }\r\n if (forks.get(philBeingServed.id + 1).attempt(Math.round(Math.random() *\r\n (MAX_ATTEMPT_TIME + 1)))) {\r\n if (FireStarter.isDebugEnabled) {\r\n System.out.println(\"[\" + philBeingServed.id + \"] took right fork\");\r\n }\r\n philBeingServed.giveMeal();\r\n disabledPhils.remove(philBeingServed);\r\n wasAttemptSuccessful = true;\r\n } else {\r\n wasAttemptSuccessful = false;\r\n forks.get(philBeingServed.id).release();\r\n if (FireStarter.isDebugEnabled) {\r\n System.out.println(\"[\" + philBeingServed.id + \"] put left fork\");\r\n }\r\n }\r\n } else {\r\n wasAttemptSuccessful = false;\r\n }\r\n } catch (InterruptedException e) {\r\n if (philBeingServed != null) {\r\n forks.get(philBeingServed.id).release();\r\n forks.get(philBeingServed.id + 1).release();\r\n }\r\n e.printStackTrace();\r\n }\r\n if (FireStarter.isDebugEnabled) {\r\n System.out.printf(\"\\n\\n\"); // Kinda delimiter\r\n FireStarter.isDebugEnabled = false; // Stop producing messages from philosophers\r\n }\r\n }\r\n }", "private static void determineFinalRanks(Fold fold, ParametersManager params) {\n for (int currRank = fold.getNumInst(); currRank >= 1; currRank--) {\n Instance instSmallestWeight = fold.getInstSmallestWeight(); // selects the next less important instance\n\n instSmallestWeight.setRank(currRank); // ranks the instance by its order of elimination\n instSmallestWeight.setWeight(Double.POSITIVE_INFINITY); // the instance will be disregarded from now\n\n // removes the traces of the ranked instance out of the other instances\n fold.clearInstTraces(instSmallestWeight);\n\n /* For instances with rank value smaller than the number of neighbors, the relative position in the ranking\n is irrelevant (and, by construction, impossible to determine). Therefore, only the first steps of the\n ranking are performed for these instances. */\n if (currRank <= params.getNumNeighbors()) continue;\n\n // updates the distances matrix, setting the distance to or from the ranked instance to infinite\n fold.updateDistMatrix(instSmallestWeight.getId());\n\n // updates the weights of instances that had the eliminated instance among its nearest neighbors\n InstanceWeighting.updateAssociatesWeights(fold, instSmallestWeight, params);\n }\n }", "public void cleanProposition();", "public void randomWalk(String paraFilename, int paraNumRounds, int paraK, int paraN, double paraDC, double paraCutThreshold,\r\n\t\t\tdouble percent) {\r\n\r\n\t\t// Step 1. Read data\r\n\t\tCompressedMatrix tempMatrix = new CompressedMatrix(paraFilename, paraDC, paraN);\r\n\t\tSystem.out.println(\"The original matrix is: \" + tempMatrix);\r\n\t\tCompressedMatrix tempMultiplexion, tempCombinedTransitionMatrix;\r\n\t\t\r\n\t\t// Step 2. Run a number of rounds to obtain new matrices\r\n\t\tfor (int i = 0; i < paraNumRounds; i++) {\r\n\t\t\t// Step 2.1 Compute probability matrix\r\n\t\t\tCompressedMatrix tempProbabilityMatrix = tempMatrix.computeTransitionProbabilities();\r\n\t\t\tSystem.out.println(\"\\r\\nThe probability matrix is:\" + tempProbabilityMatrix);\r\n\t\t\t// Make a copy\r\n\t\t\ttempMultiplexion = new CompressedMatrix(tempProbabilityMatrix);\r\n\r\n\t\t\t// Step 2.2 Multiply and add\r\n\t\t\t// Reinitialize\r\n\t\t\ttempCombinedTransitionMatrix = new CompressedMatrix(tempProbabilityMatrix);\r\n\t\t\t// paraK step\r\n\t\t\tfor (int j = 2; j <= paraK; j++) {\r\n\t\t\t\tSystem.out.println(\"j = \" + j);\r\n\t\t\t\ttempMultiplexion = CompressedMatrix.multiply(tempMultiplexion, tempProbabilityMatrix);\r\n\t\t\t\ttempCombinedTransitionMatrix = CompressedMatrix.add(tempCombinedTransitionMatrix, tempMultiplexion);\r\n\t\t\t} // Of for j\r\n\t\t\tSystem.out.println(\"Find the error!\" + tempMatrix);\r\n\r\n\t\t\t// Step 2.3 Distance between adjacent nodes\r\n\t\t\tfor (int j = 0; j < tempMatrix.matrix.length; j++) {\r\n\t\t\t\tTriple tempCurrentTriple = tempMatrix.matrix[j].next;\r\n\t\t\t\twhile (tempCurrentTriple != null) {\r\n\t\t\t\t\t// Update the weight\r\n\t\t\t\t\ttempCurrentTriple.weight = tempCombinedTransitionMatrix.neighborhoodSimilarity(j,\r\n\t\t\t\t\t\t\ttempCurrentTriple.column, paraK);\r\n\r\n\t\t\t\t\ttempCurrentTriple = tempCurrentTriple.next;\r\n\t\t\t\t} // Of while\r\n\t\t\t} // Of for j\r\n\t\t} // Of for i\r\n\r\n\t\tSystem.out.println(\"The new matrix is:\" + tempMatrix);\r\n\r\n\t\t// Step 3. Depth-first clustering and output\r\n\r\n\t\tpredictedLabels = new int[tempMatrix.matrix.length];\r\n\t\talreadyClassified = new boolean[tempMatrix.matrix.length];\r\n\t\tSystem.out.println(\"predictedLabelspredictedLabels\" + predictedLabels.length);\r\n\t\tfor (int i = 0; i < predictedLabels.length; i++) {\r\n\t\t\tpredictedLabels[i] = -1;\r\n\t\t} // of for i\r\n\t\tparaTeach = (int) (tempMatrix.matrix.length * percent);\r\n\t\tnumTeach = 0;\r\n\t\tint numPredict = 0;\r\n\t\tint numVote = 0;\r\n\t\tint num = 0;\r\n\t\twhile (true) {\r\n\r\n\t\t\tclusterNumbers = tempMatrix.depthFirstClustering(paraCutThreshold);\r\n\t\t\tcomputeBlockInformation(clusterNumbers);\r\n\t\t\tSystem.out.println(\"The block length :\" + blockInformation.length);\r\n\t\t\tboolean[] tempBlockProcessed = new boolean[blockInformation.length];\r\n\t\t\tint tempUnProcessedBlocks = 0;\r\n\t\t\tfor (int i = 0; i < blockInformation.length; i++) {\r\n\t\t\t\ttempBlockProcessed[i] = true;\r\n\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\tif (!alreadyClassified[blockInformation[i][j]]) {\r\n\t\t\t\t\t\ttempBlockProcessed[i] = false;\r\n\t\t\t\t\t\ttempUnProcessedBlocks++;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t} // of if\r\n\t\t\t\t} // of for j\r\n\t\t\t} // of for i\r\n\t\t\tif (tempUnProcessedBlocks == 0) {\r\n\t\t\t\tbreak;\r\n\t\t\t} // of if\r\n\r\n\t\t\tfor (int i = 0; i < blockInformation.length; i++) {\r\n\t\t\t\t// Step 2.3.1\r\n\t\t\t\tif (tempBlockProcessed[i]) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} // of if\r\n\r\n\t\t\t\tif (blockInformation[i].length < paraTeachEachBlock) {\r\n\r\n\t\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\t\tif (!alreadyClassified[blockInformation[i][j]]) {\r\n\t\t\t\t\t\t\tif (numTeach >= paraTeach) {\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t\t\tpredictedLabels[blockInformation[i][j]] = tempMatrix.reallable[blockInformation[i][j]];\r\n\t\t\t\t\t\t\talreadyClassified[blockInformation[i][j]] = true;\r\n\t\t\t\t\t\t\tnumTeach++;\r\n\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t} // of for j\r\n\t\t\t\t\t\r\n\t\t\t\t} // of if\r\n\r\n\t\t\t\t//sort the density\r\n\t\t\t\tdouble[] tempBlockDensity = new double[blockInformation[i].length];\r\n\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\ttempBlockDensity[j] = tempMatrix.density[blockInformation[i][j]];\r\n\t\t\t\t} // of for j\r\n\t\t\t\t\r\n\t\t\t\tint[] ordDensity = new int[blockInformation[i].length];\r\n\t\t\t\tordDensity = mergeSort.mergeSortToIndices(tempBlockDensity);\r\n\r\n\t\t\t\tint[] tempnewblockinfamation = new int[blockInformation[i].length];\r\n\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\ttempnewblockinfamation[ordDensity[j]] = blockInformation[i][j];\r\n\t\t\t\t} // of for j\r\n\r\n\t\t\t\tint tempNumTeach = 0;\r\n\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\r\n\t\t\t\t\tif (!alreadyClassified[tempnewblockinfamation[j]]) {\r\n\t\t\t\t\t\tif (numTeach >= paraTeach) {\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t\tif (tempNumTeach >= paraTeachEachBlock) {\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t\tpredictedLabels[tempnewblockinfamation[j]] = tempMatrix.reallable[tempnewblockinfamation[j]];\r\n\t\t\t\t\t\talreadyClassified[tempnewblockinfamation[j]] = true;\r\n\t\t\t\t\t\tnumTeach++;\r\n\t\t\t\t\t\ttempNumTeach++;\r\n\t\t\t\t\t\tSystem.out.println(\"numTeach first = \" + numTeach);\r\n\t\t\t\t\t} // of if\r\n\t\t\t\t} // of for j\r\n\t\t\t} // of for i\r\n\t\t\tboolean tempPure = true;\r\n\t\t\tfor (int i = 0; i < blockInformation.length; i++) {\r\n\t\t\t\tif (tempBlockProcessed[i]) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} // of if\r\n\r\n\t\t\t\tboolean tempFirstLable = true;\r\n\r\n\t\t\t\tint tempCurrentInstance;\r\n\t\t\t\tint tempLable = 0;\r\n\r\n\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\ttempCurrentInstance = blockInformation[i][j];\r\n\t\t\t\t\tif (alreadyClassified[tempCurrentInstance]) {\r\n\r\n\t\t\t\t\t\tif (tempFirstLable) {\r\n\t\t\t\t\t\t\ttempLable = predictedLabels[tempCurrentInstance];\r\n\t\t\t\t\t\t\ttempFirstLable = false;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (tempLable != predictedLabels[tempCurrentInstance]) {\r\n\t\t\t\t\t\t\t\ttempPure = false;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t} // of if\r\n\t\t\t\t} // of for j\r\n\r\n\t\t\t\tif (tempPure) {\r\n\r\n\t\t\t\t\tint ClassifiedNum = 0;\r\n\t\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\t\tif (alreadyClassified[blockInformation[i][j]]) {\r\n\r\n\t\t\t\t\t\t\tClassifiedNum++;\r\n\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t} // of for\r\n\t\t\t\t\tif (ClassifiedNum >= blockInformation[i].length / 2.0) {\r\n\t\t\t\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\t\t\t\tif (!alreadyClassified[blockInformation[i][j]]) {\r\n\t\t\t\t\t\t\t\tpredictedLabels[blockInformation[i][j]] = tempLable;\r\n\t\t\t\t\t\t\t\talreadyClassified[blockInformation[i][j]] = true;\r\n\t\t\t\t\t\t\t\tnumPredict++;\r\n\t\t\t\t\t\t\t} // of if\r\n\t\t\t\t\t\t} // of for j\r\n\t\t\t\t\t}\r\n\t\t\t\t} // of if\r\n\t\t\t} // of for i\r\n\t\t\tif (numTeach >= paraTeach) {\r\n\t\t\t\tbreak;\r\n\t\t\t} // of if\r\n\t\t\tparaCutThreshold *= 2;\r\n\t\t\tnum += 1;\r\n\t\t} // of while\r\n\r\n\t\tSystem.out.println(\"vote beginning\");\r\n\t\t// vote\r\n\t\tint max = getMax(predictedLabels);\r\n\t\tint[][] vote = new int[blockInformation.length][max + 1];\r\n\t\tint voteIndex = -1;\r\n\r\n\t\tfor (int i = 0; i < blockInformation.length; i++) {\r\n\r\n\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\r\n\t\t\t\tfor (int k = 0; k <= max; k++) {\r\n\r\n\t\t\t\t\tif (predictedLabels[blockInformation[i][j]] == k) {\r\n\t\t\t\t\t\tvote[i][k]++;\r\n\t\t\t\t\t} // of if\r\n\t\t\t\t} // of for k\r\n\t\t\t} // of for j\r\n\r\n\t\t\tvoteIndex = getMaxIndex(vote[i]);\r\n\t\t\tfor (int j = 0; j < blockInformation[i].length; j++) {\r\n\t\t\t\tif (predictedLabels[blockInformation[i][j]] == -1) {\r\n\t\t\t\t\tpredictedLabels[blockInformation[i][j]] = voteIndex;\r\n\t\t\t\t\tnumVote++;\r\n\t\t\t\t} // of if\r\n\t\t\t} // of for j\r\n\t\t} // of for i\r\n\t\tSystem.out.println(\"predictedLabels\" + Arrays.toString(predictedLabels));\r\n\t\tgetPredictionAccuracy(predictedLabels, tempMatrix.reallable);\r\n\t\t// Step 3'. Width-first clustering and output\r\n\t\t// try {\r\n\t\t// tempMatrix.widthFirstClustering(paraCutThreshold);\r\n\t\t// } catch (Exception ee) {\r\n\t\t// System.out.println(\"Error occurred in random walk: \" + ee);\r\n\t\t// }//Of try\r\n\r\n\t\t//\r\n\t}", "public void plan()\n {\n turnRight();\n while(isFrontClear())\n {\n while(isBrainHere()) {\n takeBrain();\n }\n move();\n }\n \n if (isBrainHere()) {\n takeBrain();\n }\n \n turnRight();\n if (!isFrontClear()) {\n turnAround();\n }\n \n goCenter();\n \n turnAround();\n move();\n win();\n }", "@Test\n public void testAdaptivePruningWithBadBubble() {\n final int goodMultiplicity = 1000;\n final int variantMultiplicity = 50;\n final int badMultiplicity = 5;\n\n final SeqVertex source = new SeqVertex(\"source\");\n final SeqVertex sink = new SeqVertex(\"sink\");\n final SeqVertex A = new SeqVertex(\"A\");\n final SeqVertex B = new SeqVertex(\"B\");\n final SeqVertex C = new SeqVertex(\"C\");\n final SeqVertex D = new SeqVertex(\"D\");\n final SeqVertex E = new SeqVertex(\"E\");\n final SeqVertex F = new SeqVertex(\"F\");\n final SeqVertex G = new SeqVertex(\"G\");\n final SeqVertex H = new SeqVertex(\"H\");\n\n\n for (boolean variantPresent : new boolean[] {false, true}) {\n final SeqGraph graph = new SeqGraph(20);\n\n graph.addVertices(source, A, B, C, D, E, F, G, sink);\n graph.addEdges(() -> new BaseEdge(true, goodMultiplicity), source, A, B, C, sink);\n graph.addEdges(() -> new BaseEdge(false, badMultiplicity), A, D);\n graph.addEdges(() -> new BaseEdge(false, badMultiplicity), D, F, E);\n graph.addEdges(() -> new BaseEdge(false, badMultiplicity), D, G, E);\n graph.addEdges(() -> new BaseEdge(false, badMultiplicity), E, C);\n\n if (variantPresent) {\n graph.addVertices(H);\n graph.addEdges(() -> new BaseEdge(false, variantMultiplicity), A, H, C);\n }\n\n final ChainPruner<SeqVertex, BaseEdge> pruner = new AdaptiveChainPruner<>(0.01, ReadThreadingAssemblerArgumentCollection.DEFAULT_PRUNING_LOG_ODDS_THRESHOLD,\n ReadThreadingAssemblerArgumentCollection.DEFAULT_PRUNING_SEEDING_LOG_ODDS_THRESHOLD, 50);\n pruner.pruneLowWeightChains(graph);\n\n Assert.assertFalse(graph.containsVertex(D));\n if (variantPresent) {\n Assert.assertTrue(graph.containsVertex(H));\n }\n }\n }", "public void solve() {\n\t\tArrayList<Piece> pieceListBySize = new ArrayList<Piece>(pieceList);\n\t\tCollections.sort(pieceListBySize);\t// This is done since the order\n\t\t\t\t\t\t\t\t\t\t\t// of piece placements does not matter.\n\t\t\t\t\t\t\t\t\t\t\t// Placing larger pieces down first lets\n\t\t\t\t\t\t\t\t\t\t\t// pruning occur sooner.\n\t\t\n\t\t/**\n\t\t * Calculates number of resets needed for a game board.\n\t\t * A \"reset\" refers to a tile that goes from the solved state to\n\t\t * an unsolved state and back to the solved state.\n\t\t * \n\t\t * This is the calculation used for pruning.\n\t\t */\n\t\t\n\t\tArrayList<Integer> areaLeft = new ArrayList<Integer>();\n\t\tareaLeft.add(0);\n\t\tint totalArea = 0;\n\t\tfor (int i = pieceListBySize.size() - 1; i >= 0; i--) {\n\t\t\ttotalArea += pieceListBySize.get(i).numberOfFlips;\n\t\t\tareaLeft.add(0, totalArea);\n\t\t}\n\t\tint totalResets = (totalArea - gameBoard.flipsNeeded) / (gameBoard.goal + 1);\n\t\tSystem.out.println(\"Total Resets: \" + totalResets);\n\t\t\n\t\t/* \n\t\tint highRow = 0;\n\t\tint highCol = 0;\n\t\tint[][] maxDim = new int[2][pieceListBySize.size()];\n\t\tfor (int i = pieceListBySize.size() - 1; i >= 0; i--) {\n\t\t\tif (highRow < pieceListBySize.get(i).rows)\n\t\t\t\thighRow = pieceListBySize.get(i).rows;\n\t\t\t\n\t\t\tif (highCol < pieceListBySize.get(i).cols)\n\t\t\t\thighCol = pieceListBySize.get(i).cols;\n\t\t\t\n\t\t\tmaxDim[0][i] = highRow;\n\t\t\tmaxDim[1][i] = highCol;\n\t\t}\n\t\t*/\n\t\t\n\t\tlong startTime = System.currentTimeMillis();\n\t\t\n\t\tNode<GameBoard> currentNode = new Node<GameBoard>(gameBoard);\n\t\tStack<Node<GameBoard>> stack = new Stack<Node<GameBoard>>();\n\t\tstack.push(currentNode);\n\t\t\n\t\twhile (!stack.isEmpty()) {\n\t\t\tnodeCount++;\n\t\t\t\n\t\t\tNode<GameBoard> node = stack.pop();\n\t\t\tGameBoard current = node.getElement();\n\t\t\tint depth = node.getDepth();\n\t\t\t\n\t\t\t// Checks to see if we reach a solved state.\n\t\t\t// If so, re-order the pieces then print out the solution.\n\t\t\tif (depth == pieceListBySize.size() && current.isSolved()) {\n\t\t\t\tArrayList<Point> moves = new ArrayList<Point>();\n\t\t\t\t\n\t\t\t\twhile (node.parent != null) {\n\t\t\t\t\tint index = node.level - 1;\n\t\t\t\t\tint sequence = pieceList.indexOf(pieceListBySize.get(index));\n\t\t\t\t\tPoint p = new Point(current.moveRow, current.moveCol, sequence);\n\t\t\t\t\tmoves.add(p);\n\t\t\t\t\t\n\t\t\t\t\tnode = node.parent;\n\t\t\t\t\tcurrent = node.getElement();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tCollections.sort(moves);\n\t\t\t\tfor (Point p : moves) {\n\t\t\t\t\tSystem.out.println(p);\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"Nodes opened: \" + nodeCount);\n\t\t\t\tlong endTime = System.currentTimeMillis();\n\t\t\t\tSystem.out.println(\"Elapsed Time: \" + ((endTime - startTime) / 1000) + \" secs.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tPiece currentPiece = pieceListBySize.get(depth);\n\t\t\tint pieceRows = currentPiece.rows;\n\t\t\tint pieceCols = currentPiece.cols;\n\t\t\t\n\t\t\tPriorityQueue<Node<GameBoard>> pQueue = new PriorityQueue<Node<GameBoard>>();\n\t\t\t\n\t\t\t// Place piece in every possible position in the board\n\t\t\tfor (int i = 0; i <= current.rows - pieceRows; i++) {\n\t\t\t\tfor (int j = 0; j <= current.cols - pieceCols; j++) {\n\t\t\t\t\tGameBoard g = current.place(currentPiece, i, j);\n\t\t\t\t\t\n\t\t\t\t\tif (totalResets - g.resets < 0)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\n\t\t\t\t\t// Put in the temporary priority queue\n\t\t\t\t\tpQueue.add(new Node<GameBoard>(g, node));\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Remove from priority queue 1 at a time and put into stack.\n\t\t\t// The reason this is done is so that boards with the highest reset\n\t\t\t// count can be chosen over ones with fewer resets.\n\t\t\twhile (!pQueue.isEmpty()) {\n\t\t\t\tNode<GameBoard> n = pQueue.remove();\n\t\t\t\tstack.push(n);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t}", "public static int run_with_pruning(State curr_state, char player) {\n\r\n\t\tint alpha = Integer.MIN_VALUE;\r\n\t\tint beta = Integer.MAX_VALUE;\r\n\t\tint result = 0;\r\n\t\t//If player is '1', run max pruning, else run min pruning\r\n\t\tif(player == '1'){\r\n\t\t\tresult = max_value_with_pruning(curr_state, alpha, beta);\r\n\t\t}\r\n\t\telse if(player == '2'){\r\n\t\t\tresult = min_value_with_pruning(curr_state, alpha, beta);\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}", "public void hardMode(Boolean hitResult) throws LocationHitException{\r\n\t\tint x = 0, y = 0;\r\n\t\tint mostProbable;\r\n\r\n\t\tif (minMax == 0) {\r\n\t\t\tmostProbable = 1;\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tminMax = 1;\r\n\t\t} else {\r\n\t\t\tmostProbable = 1000;\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tminMax = 0;\r\n\t\t}\r\n\r\n\t\tif (!hitResult && direction.isEmpty()) {\r\n\t\t\tboolean newHit = false;\r\n\t\t\twhile (!newHit) {\r\n\t\t\t\tif (Player.userGrid[x][y] == 2 || Player.userGrid[x][y] == 3) {\r\n\t\t\t\t\tprobabilityGrid[x][y] = -1;\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else\r\n\t\t\t\t\tnewHit = true;\r\n\t\t\t}\r\n\t\t} else if (direction.isEmpty()) {\r\n\t\t\thitFound.add(hitX + \";\" + hitY);\r\n\t\t\tcounter++;\r\n\t\t\tif ((hitX + 1) < 9) {\r\n\t\t\t\tx = hitX + 1;\r\n\t\t\t\ty = hitY;\r\n\t\t\t\tdirection = \"HorizontalFront\";\r\n\t\t\t} else {\r\n\t\t\t\tx = hitX - 1;\r\n\t\t\t\ty = hitY;\r\n\t\t\t\tdirection = \"HorizontalBack\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (direction.equals(\"HorizontalFront\")) {\r\n\t\t\t\tint tempX = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\tint tempY = Integer.parseInt(hitFound.get(0).split(\";\")[1]);\r\n\t\t\t\tif (hitResult && (hitX + 1 < 9)) {\r\n\t\t\t\t\tcounter++;\r\n\t\t\t\t\tx = hitX + 1;\r\n\t\t\t\t\ty = hitY;\r\n\t\t\t\t} else if (tempX > 0) {\r\n\t\t\t\t\tx = tempX - 1;\r\n\t\t\t\t\ty = tempY;\r\n\t\t\t\t\tdirection = \"HorizontalBack\";\r\n\t\t\t\t} else if ((Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1 < 11)) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1;\r\n\t\t\t\t\tdirection = \"VerticalFront\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) - 1;\r\n\t\t\t\t\tdirection = \"VerticalBack\";\r\n\t\t\t\t}\r\n\t\t\t} else if (direction.equals(\"HorizontalBack\")) {\r\n\t\t\t\tif (hitResult && (hitX > 0)) {\r\n\t\t\t\t\tcounter++;\r\n\t\t\t\t\tx = hitX - 1;\r\n\t\t\t\t\ty = hitY;\r\n\t\t\t\t} else if (Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1 < 11 && counter < 2) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) + 1;\r\n\t\t\t\t\tdirection = \"VerticalFront\";\r\n\t\t\t\t} else if (counter < 2) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) - 1;\r\n\t\t\t\t\tdirection = \"VerticalBack\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdirection = \"\";\r\n\t\t\t\t\thitFound.clear();\r\n\t\t\t\t\tcounter = 0;\r\n\t\t\t\t}\r\n\t\t\t} else if (direction.equals(\"VerticalFront\") && counter < 2) {\r\n\t\t\t\tif (hitResult && (hitY + 1 < 11)) {\r\n\t\t\t\t\tx = hitX;\r\n\t\t\t\t\ty = hitY + 1;\r\n\t\t\t\t} else if (Integer.parseInt(hitFound.get(0).split(\";\")[1]) > 0) {\r\n\t\t\t\t\tx = Integer.parseInt(hitFound.get(0).split(\";\")[0]);\r\n\t\t\t\t\ty = Integer.parseInt(hitFound.get(0).split(\";\")[1]) - 1;\r\n\t\t\t\t\tdirection = \"VerticalBack\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdirection = \"\";\r\n\t\t\t\t\thitFound.clear();\r\n\t\t\t\t\tcounter = 0;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (hitResult && (hitY > 0) && counter < 2) {\r\n\t\t\t\t\tx = hitX;\r\n\t\t\t\t\ty = hitY - 1;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (minMax == 0) {\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] > mostProbable) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 1;\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\t\t\t\tif (probabilityGrid[i][j] < mostProbable && probabilityGrid[i][j] > 0) {\r\n\t\t\t\t\t\t\t\t\tmostProbable = probabilityGrid[i][j];\r\n\t\t\t\t\t\t\t\t\tx = i;\r\n\t\t\t\t\t\t\t\t\ty = j;\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tminMax = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdirection = \"\";\r\n\t\t\t\t\thitFound.clear();\r\n\t\t\t\t\tcounter = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprobabilityGrid[x][y] = -1;\r\n\t\thitX = x;\r\n\t\thitY = y;\r\n\r\n\t\tint hitCoord[] = { x, y };\r\n\t\tsetCoords(hitCoord);\r\n\r\n\t\tif (Player.userGrid[x][y] == 1) {\r\n\t\t\t// change the grid value from 1 to 2 to signify hit\r\n\t\t\tPlayer.userGrid[x][y] = 2;\r\n\t\t\tString coordx = Integer.toString(x);\r\n\t\t\tString coordy = Integer.toString(y);\r\n\t\t\tif(!time1) {\r\n\t\t\t\ttimea=java.lang.System.currentTimeMillis();\r\n\t\t\t\ttime1=!time1;\r\n\t\t\t}else if(!time2) {\r\n\t\t\t\ttimeb=java.lang.System.currentTimeMillis();\r\n\t\t\t\t\ttime2=!time2;\r\n\t\t\t}else {\r\n\t\t\t\tdouble t=timeb-timea;\r\n\t\t\t\tif(t<3000) {\r\n\t\t\t\t\tsetScore(20);\r\n\t\t\t\t}\r\n\t\t\t\ttime1=false;\r\n\t\t\t\ttime2=false;\r\n\t\t\t\ttimea=0;\r\n\t\t\t\ttimeb=0;\r\n\t\t\t\t\r\n\t\t\t}//if time between consecutive hit is less than 3 seconds ,then bonus score\r\n\t\t\tsetScore(10);\r\n\t\t\tPlayer.coordinatesHit.add(coordx + \",\" + coordy);\r\n\t\t\tsetReply(\"It's a Hit!!!!!\");\r\n\t\t} else if (Player.userGrid[x][y] == 0) {\r\n\t\t\tPlayer.userGrid[x][y] = 3;\r\n\t\t\tsetScore(-1);\r\n\t\t\tsetReply(\"It's a miss!!!!!\");\r\n\t\t} else if (Player.userGrid[x][y] == 2 || Player.userGrid[x][y] == 3) {\r\n\t\t\tsetReply(\"The location has been hit earlier\");\r\n\t\t\t//throw new LocationHitException(\"The location has been hit earlier\");\r\n\r\n\t\t}\r\n\r\n\t}", "private int removeDeadOperations(MethodContext mctx)\n\t{\n\t\tint count = 0;\n\t\tfor (ConstantMethodParameter cmp : parameters.values())\n\t\t{\n\t\t\tif (cmp.invalid)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!cmp.methods.contains(mctx.getMethod()))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only annotate garbage value of last param\n\t\t\tif (cmp.paramIndex + 1 == mctx.getMethod().getDescriptor().size())\n\t\t\t{\n\t\t\t\tannotateObfuscatedSignature(cmp);\n\t\t\t}\n\n\t\t\tfor (Instruction ins : cmp.operations) // comparisons\n\t\t\t{\n\t\t\t\tif (ins.getInstructions() == null || ins.getInstructions().getCode().getMethod() != mctx.getMethod())\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tInstructionContext ctx = mctx.getInstructonContexts(ins).toArray(new InstructionContext[0])[0];\n\t\t\t\tboolean branch = cmp.result; // branch that is always taken\n\n\t\t\t\tif (ins.getInstructions() == null)\n\t\t\t\t{\n\t\t\t\t\tcontinue; // ins already removed?\n\t\t\t\t}\n\t\t\t\tInstructions instructions = ins.getInstructions();\n\n\t\t\t\t// remove the if\n\t\t\t\tif (ctx.getInstruction() instanceof If)\n\t\t\t\t{\n\t\t\t\t\tctx.removeStack(1);\n\t\t\t\t}\n\t\t\t\tctx.removeStack(0);\n\n\t\t\t\tint idx = instructions.getInstructions().indexOf(ins);\n\t\t\t\tif (idx == -1)\n\t\t\t\t{\n\t\t\t\t\tcontinue; // already removed?\n\t\t\t\t}\n\t\t\t\t++count;\n\n\t\t\t\tInstruction to;\n\t\t\t\tif (branch)\n\t\t\t\t{\n\t\t\t\t\tJumpingInstruction jumpIns = (JumpingInstruction) ins;\n\t\t\t\t\tassert jumpIns.getJumps().size() == 1;\n\t\t\t\t\tto = jumpIns.getJumps().get(0);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// just go to next instruction\n\t\t\t\t\tto = instructions.getInstructions().get(idx + 1);\n\t\t\t\t}\n\t\t\t\tassert to.getInstructions() == instructions;\n\t\t\t\tassert ins != to;\n\t\t\t\tassert instructions.getInstructions().contains(to);\n\n\t\t\t\tinstructions.remove(ins);\n\n\t\t\t\tassert instructions.getInstructions().contains(to);\n\n\t\t\t\tif (branch)\n\t\t\t\t{\n\t\t\t\t\tGoto gotoins = new Goto(instructions, instructions.createLabelFor(to));\n\n\t\t\t\t\t// insert goto\n\t\t\t\t\tinstructions.getInstructions().add(idx, gotoins);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}", "public void postSpeciation() {\n\t\tif (speciesTarget > 0) {\r\n\t\t\tadjustThreshold();\r\n\t\t}\r\n\r\n\t\t// remove dead species\r\n\t\tfor (int i = 0; i < speciesList.size(); i++) {\r\n\r\n\t\t\tspeciesList.get(i).updateBestFitness();\r\n\r\n\t\t\tif ((speciesList.get(i).size() < 1) || (speciesList.get(i).isStagnant())) {\r\n\t\t\t\tspeciesList.remove(i);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Override\n public void run() {\n List<File> files = getContents(TOP_LEVEL + \" and \" + NOT_TRASHED + \" and \" + FOLDER + \" and \" + NOT_SPREADSHEET);\n \n prune(targetDir, files);\n processLanguages(files);\n }", "void think() {\n //get the output of the neural network\n decision = brain.output(vision);\n\n if (decision[0] > 0.8) {//output 0 is boosting\n boosting = true;\n } else {\n boosting = false;\n }\n if (decision[1] > 0.8) {//output 1 is turn left\n spin = -0.08f;\n } else {//cant turn right and left at the same time\n if (decision[2] > 0.8) {//output 2 is turn right\n spin = 0.08f;\n } else {//if neither then dont turn\n spin = 0;\n }\n }\n //shooting\n if (decision[3] > 0.8) {//output 3 is shooting\n shoot();\n }\n }", "public Field.Fieldelements placeShotComputer() {\r\n int sizeX = this.fieldUser.getSizeX();\r\n int sizeY = this.fieldUser.getSizeY();\r\n \r\n // probability that a field contains a ship (not in percent, 1000 is best)\r\n double[][] probability = new double[sizeX][sizeY];\r\n double sumProbability = 0;\r\n \r\n for (int posX = 0; posX < sizeX; posX++) {\r\n for (int posY = 0; posY < sizeY; posY++) {\r\n // set probability for each field to 1\r\n probability[sizeX][sizeY] = 1.;\r\n \r\n // check neighbouring fields for hits and set probability to 1000\r\n if (Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX, posY - 1) ||\r\n Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX, posY + 1) ||\r\n Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX - 1, posY) ||\r\n Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX + 1, posY)) {\r\n probability[posX][posY] = 1000;\r\n }\r\n \r\n // 0 points if all fields above and below are SUNK or SHOT\r\n if ((Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX, posY - 1) || Field.Fieldelements.WATER == fieldUser.getFieldStatus(posX, posY - 1)) &&\r\n (Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX, posY + 1) || Field.Fieldelements.WATER == fieldUser.getFieldStatus(posX, posY + 1)) &&\r\n (Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX - 1, posY) || Field.Fieldelements.WATER == fieldUser.getFieldStatus(posX - 1, posY)) &&\r\n (Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX + 1, posY) || Field.Fieldelements.WATER == fieldUser.getFieldStatus(posX + 1, posY))\r\n ) {\r\n probability[posX][posY] = 0;\r\n }\r\n \r\n // 0 points if a neighbouring field is SUNK\r\n if (Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX - 1, posY - 1) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX - 1, posY) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX - 1, posY + 1) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX, posY - 1) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX, posY + 1) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX + 1, posY - 1) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX + 1, posY) ||\r\n Field.Fieldelements.SUNK == fieldUser.getFieldStatus(posX + 1, posY + 1)\r\n ) {\r\n probability[posX][posY] = 0;\r\n }\r\n \r\n // 0 points if top right, top left, bottom right or bottom left is HIT\r\n if (Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX - 1, posY - 1) ||\r\n Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX - 1, posY + 1) ||\r\n Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX + 1, posY - 1) ||\r\n Field.Fieldelements.HIT == fieldUser.getFieldStatus(posX + 1, posY + 1)\r\n ) {\r\n probability[posX][posY] = 0;\r\n }\r\n \r\n // 0 points if a shot has already been placed\r\n if (Field.Fieldelements.WATER != fieldUser.getFieldStatus(posX, posY) &&\r\n Field.Fieldelements.SHIP != fieldUser.getFieldStatus(posX, posY)) {\r\n probability[posX][posY] = 0;\r\n }\r\n }\r\n }\r\n \r\n // calculate sum of all points\r\n // TODO check if probability must be smaller numbers\r\n for (int posX = 0; posX < sizeX; sizeX++) {\r\n for (int posY = 0; posY < sizeY; posY++) {\r\n sumProbability += probability[posX][posY];\r\n }\r\n }\r\n \r\n // random element\r\n Random random = new Random();\r\n sumProbability = random.nextInt((int) --sumProbability);\r\n sumProbability++; // must at least be 1\r\n int posY = -1;\r\n int posX = -1;\r\n while (posY < sizeY - 1 && sumProbability >= 0) {\r\n posY++;\r\n posX = -1;\r\n while (posX < sizeX && sumProbability >= 0) {\r\n posX++;\r\n sumProbability = sumProbability - probability[posX][posY];\r\n }\r\n }\r\n return fieldUser.shoot(posX, posY);\r\n }", "public void VaciarPila() {\r\n while (!PilaVacia()) {\r\n EliminarNodo();\r\n }\r\n }", "@Override\n protected void updateEliminations() {\n\n }", "public void probabiltDistribution() {\r\n\t\tfor (int k = 0; k < 1000; k++) {\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\trandomGrid[i][j] = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdeployComputerShips();\r\n\t\t\tfor (int i = 0; i < 9; i++) {\r\n\t\t\t\tfor (int j = 0; j < 11; j++) {\r\n\t\t\t\t\tprobabilityGrid[i][j] = probabilityGrid[i][j] + randomGrid[i][j];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private void condenseSteam() {\n if (getPressure()> Constants.ATMOSPHERIC_PRESSURE) {\n double boilingPoint = Water.getBoilingTemperature(getPressure());\n if (boilingPoint > steam.getTemperature()) { // remove steam such that it equalizes to the boiling point\n double newSteamPressure = Math.max(Water.getBoilingPressure(steam.getTemperature()), Constants.ATMOSPHERIC_PRESSURE);\n \n\n int newQuantity = steam.getParticlesAtState(newSteamPressure, getCompressibleVolume());\n int deltaQuantity = steam.getParticleNr() - newQuantity;\n if (deltaQuantity < 0) {\n System.out.println(\"BAD\");\n }\n steam.remove(deltaQuantity);\n getWater().add(new Water(steam.getTemperature(), deltaQuantity));\n }\n } \n }", "private void pump_water() {\n\t\t\r\n\t}", "protected boolean removeDecisionNode(boolean computeUtilitiesTable) throws IOException {\n\n Node terminalValueNode;\n Node candidateToReduce;\n Node candidateToRemove;\n Node decisionToRemove;\n String operation;\n int i;\n NodeList children;\n Node valueNodeToReduce = null;\n NodeList decisionsID;\n boolean removed = false;\n Node nodeUtil = null;\n PotentialTable utilitiesTable;\n PotentialTable policyTable;\n ArrayList<String> barrens;\n\n // Obtain the value node \n\n terminalValueNode = ((IDWithSVNodes) diag).getTerminalValueNode();\n\n //List of chance nodes in the diagram\n decisionsID = diag.getNodesOfKind(Node.DECISION);\n\n for (i = 0; (i < decisionsID.size()) && removed == false; i++) {\n\n candidateToRemove = decisionsID.elementAt(i);\n\n if (isRemovableDecision(candidateToRemove)) {\n decisionToRemove = candidateToRemove;\n\n\n children = decisionToRemove.getChildrenNodes();\n //Reduce value nodes if it's necessary\n\n if (children.size() > 1) {\n //We have to reduce\n candidateToReduce = getCandidateValueNodeToReduceForDecisionNode(decisionToRemove);\n //reachableParents = getReachableParents(nodeToRemove,candidateToReduce);\n valueNodeToReduce = obtainValueNodeToReduce(decisionToRemove, candidateToReduce);\n ReductionAndEvalID.reduceNode(\n (IDWithSVNodes) diag,\n valueNodeToReduce);\n nodeUtil = valueNodeToReduce;\n operation = \"Reduce: \" + nodeUtil.getName() + \" to eliminate: \" + decisionToRemove.getName();\n statistics.addOperation(operation);\n System.out.println(operation);\n } else {\n //The chance has only one child (utility)\n nodeUtil = children.elementAt(0);\n }\n\n String auxName = candidateToRemove.getName();\n operation = \"Decision node removal: \" + auxName;\n statistics.addOperation(operation);\n System.out.println(operation);\n\n//\t\t\t\tAdd the name of the node to 'orderOfElimination'\n ((PropagationStatisticsID) statistics).addNameToOrderOfElimination(auxName);\n\n\n if (computeUtilitiesTable) {\n //Save the potential with the decision function\n //Table with the utilities\n utilitiesTable = (PotentialTable) ((IDWithSVNodes) diag).getTotalUtility(terminalValueNode).sendVarToEnd(decisionToRemove);\n results.add(utilitiesTable);\n // Store the explanation with the importance of each variable\n // of the decision table\n //statistics.setExplanation(decisionToRemove.getName(),utilitiesTable);\n }\n\n\n\n //Table with the utilities to obtain the policy\n policyTable = (PotentialTable) (diag.getRelation(nodeUtil).getValues().sendVarToEnd(decisionToRemove));\n resultsForPolicies.add(policyTable);\n\n\n\n // The relation of the utility node is modified. In this \n // case the parents of the node to remove wont be parents \n // of the utility node \n modifyUtilityRelation(nodeUtil, decisionToRemove, false);\n\n\n // Maximize the utility \n maximizeUtility(nodeUtil, decisionToRemove, null);\n\n // The node is deleted \n diag.removeNodeOnly(decisionToRemove);\n\n //Remove barren nodes\n barrens = ((IDWithSVNodes) diag).removeBarrenNodesAndReturnThem();\n\n for (String auxBarren : barrens) {\n //Add the name of the node to 'orderOfElimination'\n ((PropagationStatisticsID) statistics).addNameToOrderOfElimination(auxBarren);\n }\n//\t\t\t\t\t\n\n//\t\t\t\t\t To store the size\n\n statistics.addSize(diag.calculateSizeOfPotentials());\n\n\n statistics.addTime(crono.getTime());\n\n indexOperation++;\n diag.save(\"debug-operation-\" + indexOperation + \".elv\");\n\n // Set removed \n removed = true;\n\n //}//if\n }//if\n }//for\n return removed;\n\n }", "public void preprocess() {\n }", "public void preprocess() {\n }", "public void preprocess() {\n }", "public void preprocess() {\n }", "@Override\n public void action() {\n while (turn.getPlayer().getFightDecision() == null){\n ;\n }\n FightDecision decision = turn.getPlayer().getFightDecision();\n if (decision== FightDecision.IGNORE){\n turn.getPlayer().setFightDecision(null);\n turn.setPhase(new MovePhase(y));\n }else{\n turn.getPlayer().setFightDecision(null);\n turn.setPhase(new FightPhase());\n }\n }", "@Test\n\tpublic void testIfForbriddenSelfKillAdvanced(){\n\t\tboard.commitMove(new Point(2,1), 1);\n\t\tboard.commitMove(new Point(3,1), 1);\n\t\tboard.commitMove(new Point(4,2), 1);\n\t\tboard.commitMove(new Point(3,3), 1);\n\t\tboard.commitMove(new Point(3,4), 1);\n\t\tboard.commitMove(new Point(2,5), 1);\n\t\tboard.commitMove(new Point(1,4), 1);\n\t\tboard.commitMove(new Point(1,3), 1);\n\t\tboard.commitMove(new Point(1,2), 1);\n\t\t\n\t\tboard.commitMove(new Point(2,4), 0);\n\t\tboard.commitMove(new Point(2,3), 0);\n\t\tassertEquals(0, board.commitMove(new Point(2,2), 0));\n\t\tassertNotEquals(0,board.commitMove(new Point(3,2), 0));\n//\t\tboard.printBoard();\n\t}", "@Override\n public Point determineCoup() {\n while(!aEteJoueParInterface) {}\n aEteJoueParInterface = false;\n return p;\n }" ]
[ "0.6869899", "0.59413606", "0.55753887", "0.5512774", "0.5496382", "0.5408638", "0.536954", "0.5359434", "0.5324772", "0.52956486", "0.5287292", "0.5278272", "0.5270038", "0.5240987", "0.519617", "0.51649344", "0.51206475", "0.51169497", "0.5102904", "0.50979924", "0.5095148", "0.5092918", "0.50910807", "0.5078088", "0.50661796", "0.50517136", "0.5051186", "0.503165", "0.5010053", "0.4990666", "0.4983132", "0.49729833", "0.49677113", "0.49194884", "0.48935437", "0.48877203", "0.4856898", "0.48439023", "0.48160812", "0.4813973", "0.48071486", "0.48036504", "0.47999424", "0.47973406", "0.4797263", "0.47906", "0.47854993", "0.47803837", "0.47728905", "0.47603098", "0.47346073", "0.4732178", "0.47309983", "0.4718411", "0.470812", "0.4702665", "0.47014797", "0.4699565", "0.46941975", "0.46912014", "0.46686193", "0.46612835", "0.4657069", "0.46480826", "0.46448624", "0.46374545", "0.46373126", "0.46352953", "0.4630014", "0.46299276", "0.46275738", "0.46174398", "0.46135518", "0.4612894", "0.46128", "0.4612636", "0.46115258", "0.46084222", "0.45987874", "0.45976222", "0.45864394", "0.4566418", "0.455437", "0.45510286", "0.4550524", "0.4539927", "0.45387974", "0.45387664", "0.45325515", "0.45320237", "0.45304024", "0.45254478", "0.45241606", "0.4521951", "0.4521951", "0.4521951", "0.4521951", "0.45185018", "0.45182723", "0.4518101" ]
0.6062665
1
fields here. private int count;
public FindMinimumInRotatedSortedArray() { // Initialization here. // this.count = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void count() {\n\t\t\n\t}", "public long count() {\n/* 154 */ return this.count;\n/* */ }", "public int count() {\n return this.count;\n }", "@Override\r\n\t\tpublic int count() {\n\t\t\treturn 0;\r\n\t\t}", "public synchronized int getCount()\n\t{\n\t\treturn count;\n\t}", "public int count() {\r\n return count;\r\n }", "public void setCount(int count)\r\n {\r\n this.count = count;\r\n }", "@Override\npublic long count() {\n\treturn super.count();\n}", "public void setCount(int count)\n {\n this.count = count;\n }", "public int get_count();", "public void setCount(int count)\r\n\t{\r\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int count() {\n\t\treturn 0;\n\t}", "public void setCount(int count) {\r\n this.count = count;\r\n }", "public int count() {\n return count;\n }", "public long getCount()\n\t{\n\t\treturn count;\n\t}", "public long count() ;", "public int count() {\n\t\treturn count;\n\t}", "public void addCount()\n {\n \tcount++;\n }", "@Override\r\n\tpublic long count() {\n\t\treturn 0;\r\n\t}", "public void setCount(int count) {\n this.count = count;\n }", "public void setCount(int count) {\n this.count = count;\n }", "public void setCount(int count) {\n this.count = count;\n }", "public void setCount(int count) {\n this.count = count;\n }", "public void setCount(int count) {\n this.count = count;\n }", "public void setCount(int count){\n\t\tthis.count = count;\n\t}", "@Override\r\n\tpublic void iterateCount() {\n\t\t\r\n\t}", "public long getCount() {\n return count_;\n }", "public int size() { return count; }", "public long getCount() {\r\n return count;\r\n }", "@Override\n\tpublic int count() {\n\t\treturn 4;\n\t}", "public void setCount(Integer count) {\r\n this.count = count;\r\n }", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "@Override\n\tpublic long count() {\n\t\treturn 0;\n\t}", "public int currentCount () {\n return count;\n }", "@Override\n public long count();", "public long count() { return count.get(); }", "public void setCount(Integer count) {\n this.count = count;\n }", "public void setCount(Integer count) {\n this.count = count;\n }", "public void setCount(Integer count) {\n this.count = count;\n }", "public void setCount(Integer count) {\n this.count = count;\n }", "public void setCount(Integer count) {\n this.count = count;\n }", "public void setCount(Integer count) {\n this.count = count;\n }", "public long getCount() {\n return count;\n }", "public long getCount() {\n return count;\n }", "public Integer getCount() {\n return count;\n }", "public synchronized int getCount(){\n return count;\n }", "public int size(){\n return count;\n }", "public void setCount(int count) {\n\t\tthis.count = count;\n\t}", "public long count() {\n return this.count;\n }", "public int size() \n { \n return count; \n }", "public long getCount() {\n return count_;\n }", "private Count() {}", "private Count() {}", "public abstract long count();", "public static int getCount() {\r\n\t\treturn count;\r\n\t}", "public static int getCount() {\r\n\t\treturn count;\r\n\t}", "public static int getCount() {\r\n\t\treturn count;\r\n\t}", "public Integer getCount() {\n\t\treturn count;\n\t}", "public Integer getCount() {\n\t\treturn count;\n\t}", "public Integer getCount() {\n return count;\n }", "public Integer getCount() {\n return count;\n }", "public Integer getCount() {\n return count;\n }", "public Integer getCount() {\n return count;\n }", "public Integer getCount() {\n return count;\n }", "public Integer getCount() {\n return count;\n }", "public int count() {\n\treturn 1;\n}", "public long count() {\n\t\treturn 0;\n\t}", "public long count() {\n\t\treturn 0;\n\t}", "public abstract int count();", "public abstract int count();", "public void setCount(Integer count) {\n\t\tthis.count = count;\n\t}", "public void incrementCount() {\n count++;\n }", "public int count();", "public int count();", "public int count();", "public int count();", "public int getCount() {\n return count_;\n }", "public void setCount(final int count)\n {\n this.count = count;\n }", "public int getCount() {\r\n\t\treturn count;\r\n\t}", "public int getCount() {\r\n\t\treturn count;\r\n\t}", "public void setCount(int value) {\n this.count = value;\n }", "public void setCount(int value) {\n this.count = value;\n }", "public void setCount(int value) {\n this.count = value;\n }", "public Long getCount() {\n return count;\n }", "@Override\n public int size() {\n return count;\n }", "@Override\n public int size() {\n return count;\n }", "public void setCount(int count) {\n\t\t\tthis.count = count;\n\t\t}", "public long getCount() {\n return count.get();\n }", "public void setCount(final int count) {\n this.count = count;\n }", "@Override\n public long count() {\n return super.doCountAll();\n }", "@Override\n public long count() {\n return super.doCountAll();\n }", "@Override\n public long count() {\n return super.doCountAll();\n }" ]
[ "0.7894261", "0.7699838", "0.7552244", "0.7545388", "0.7514239", "0.7458779", "0.74391687", "0.7428631", "0.7420237", "0.7407515", "0.7395986", "0.739406", "0.739406", "0.739406", "0.739406", "0.739199", "0.73872274", "0.73630995", "0.73516124", "0.73498595", "0.7346029", "0.7340338", "0.73233753", "0.73233753", "0.73233753", "0.73233753", "0.73233753", "0.73178524", "0.7304591", "0.7302405", "0.7296188", "0.72645104", "0.72605157", "0.7250649", "0.7235077", "0.7235077", "0.7235077", "0.7235077", "0.7235077", "0.7235077", "0.7235077", "0.7235077", "0.7220834", "0.71987355", "0.7192424", "0.7188257", "0.7188257", "0.7188257", "0.7188257", "0.7188257", "0.7188257", "0.71857685", "0.71857685", "0.71853715", "0.7168857", "0.71667475", "0.7157905", "0.71544963", "0.7151464", "0.7136474", "0.7124559", "0.7124559", "0.7105457", "0.708782", "0.708782", "0.708782", "0.70855564", "0.70855564", "0.70774263", "0.70774263", "0.70774263", "0.70774263", "0.70774263", "0.70774263", "0.7060313", "0.70590633", "0.70590633", "0.7059047", "0.7059047", "0.70587754", "0.7038304", "0.7031996", "0.7031996", "0.7031996", "0.7031996", "0.70224595", "0.7018108", "0.7008481", "0.7008481", "0.6981613", "0.6981613", "0.6981613", "0.6965508", "0.69467753", "0.69467753", "0.693435", "0.6930798", "0.6919771", "0.69166404", "0.69166404", "0.69166404" ]
0.0
-1
Binary Search. When I cut the array in half, if I can detect which subarray the target lies in, I can use Binary Search. In this problem, the target is the valley. The valley lies in the left subarray when nums[mid] is less than nums[0]. Find the valley using two adjacent elements, and the smaller is the minimum. The valley is either on the left subarray or right subarray when I cut the array in half. O(logN) time, O(1) space. Author: godayaldivya + kei Date : August 10, 2019
public int findMin(int[] nums) { // corner if (nums.length == 1) { return nums[0]; } // Not rotated. if (nums[0] < nums[nums.length - 1]) { return nums[0]; } // Binary Search. int left = 0; int right = nums.length - 1; // int right = nums.length; // NG! (R = M version) while (left <= right) { // while (left < right) { // NG! (R = M version) int mid = left + (right - left) / 2; // Find the valley. // nums[mid + 1] could cause array index out of bound when nums[mid] is the last // element. // However, for this problem, when nums[mid] is the second to the last, it // returns and // nums[mid] never reaches to the last element. // R = M version is NG because nums[mid] skips the second to the last and hits // the last // element depending on the case, in which case, nums[mid + 1] causes array // index out of bound. if (nums[mid] > nums[mid + 1]) { return nums[mid + 1]; } // Assert nums[mid] < nums[mid + 1] (no duplicates) // nums[mid - 1] could cause array index out of bound when the target is the // first element or // the second element. // However, for this problem, the code above returns when mid is equal to 0. // To be exact, when you use R = M - 1 version, mid is approaching index 0 as // the following: // 1. 2 -> 0 -> 1 // 2. 3 -> 1 -> 0 // ex) 1. [ 5, 1, 2, 3, 4 ], 2. [ 6, 1, 2, 3, 4, 5] // For case 1, the code above returns when mid is equal to 0, and nums[-1] never // occurs. // For case 2, the code below returns when mid is equal to 1, and nums[-1] never // occurs. // // Be careful! // Not rotated array can cause nums[-1] here for both of the two cases above // because // the code above does not return when mid is equal to 0, which causes index out // of bound here. // So, eliminate this case in advance. if (nums[mid - 1] > nums[mid]) { return nums[mid]; } // If the mid does not hit the valley, then keep searching. // I don't know why nums[mid] > nums[0] is ok in the LeetCode solution yet. // (No need to explore any further) if (nums[mid] > nums[left]) { // The min is in the right subarray. left = mid + 1; } else { // The min is in the left subarray. right = mid - 1; // right = mid; // NG! (R = M version) } } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int binarySearchLeft(int[] nums, int target) {\n \tint low=0;\n int high=nums.length-1;\n\n while(low<=high){\n int mid=low+(high-low)/2;\n if (nums[mid]==target){\n if(mid==0||nums[mid-1]<nums[mid]){\n return mid;\n }\n else{\n high=mid-1;\n }\n }\n else if(nums[mid]>target){\n high=mid-1;\n }\n else{\n low=mid+1;\n }\n \n }\n\t\treturn -1;\n\t}", "public int binarySearch(int[] nums, int target, int left, int right) {\n int res = left - 1;\n while (left <= right) {\n int mid = left + (right - left) / 2;\n if (nums[mid] <= target) {\n right = mid - 1;\n } else {\n res = mid;\n left = mid + 1;\n }\n }\n return res;\n }", "private int binarySearch(int[] nums, int target, int low, int high) {\n while (low <= high) {\n int mid = low + (high - low) / 2; // find mid\n\n if (nums[mid] == target) { // if number found\n if (mid == low || nums[mid] > nums[mid - 1]) // check if it is the first occurence\n return mid; // if it is return mid\n else\n high = mid - 1; // decrease high to reach the index\n } else if (nums[mid] > target) // if the value in num is greater\n high = mid - 1; // decrease high\n else\n low = mid + 1; // else increase low\n\n }\n\n return -1; // number not found\n }", "public int binarySearch(int[] nums, int target) {\n // write your code here\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] == target) {\n end = mid;\n }\n else if (nums[mid] < target) {\n start = mid;\n }\n else {\n end = mid;\n }\n }\n if (nums[start] == target) return start;\n if (nums[end] == target) return end;\n return -1;\n }", "public int search(int[] nums, int target) {\n int left = 0;\n int right = nums.length - 1;\n while (left < right) {\n int mid = (left + right) / 2;\n if (nums[mid] > nums[right]) {\n left = mid + 1;\n } else {\n right = mid;\n }\n }\n int pivot = left;\n left = 0;\n right = nums.length - 1;\n while (left <= right) {\n int mid = (left + right) / 2;\n int realmid = (mid + pivot) % nums.length;\n if (nums[realmid] == target) {\n return realmid;\n } else if (nums[realmid] < target) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n return -1;\n }", "private static int binary_Search(int[] arr, int target) {\n\n\t\tint low = 0;\n\t\tint high = arr.length - 1;\n\n\t\twhile (low <= high) {\n\n\t\t\tint mid = low + (high - low) / 2;\n\t\t\tSystem.out.println(\"low = \" + low + \" mid = \" + mid + \" high =\" + high);\n\t\t\tif (arr[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\tif (arr[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\n\t\t\t} else {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\n\t\t\t// System.out.println(\"low = \" + low + \" high =\" + high);\n\t\t}\n\t\treturn -1;\n\t}", "private int findLowerBound(int[] nums, int target) {\n int left = 0, right = nums.length;\n while (left < right) {\n int mid = (right - left) / 2 + left;\n if (nums[mid] >= target) right = mid;\n else left = mid + 1;\n }\n return (left < nums.length && nums[left] == target) ? left : -1;\n }", "public int search(int[] nums, int target) {\n if (null == nums || nums.length == 0) {\n return -1;\n }\n int start = 0;\n int end = nums.length - 1;\n while (start <= end) {\n int mid = (start + end) / 2;\n if (nums[mid] == target)\n return mid;\n if (nums[start] <= nums[mid]) {\n if (target < nums[mid] && target >= nums[start])\n end = mid - 1;\n else\n start = mid + 1;\n }\n if (nums[mid] <= nums[end]) {\n if (target > nums[mid] && target <= nums[end])\n start = mid + 1;\n else\n end = mid - 1;\n }\n }\n return -1;\n }", "private int binarySearch(int[] array, int left, int right, int target) {\n\t\tif (left > right) {\n\t\t\treturn -1;\n\t\t}\n\t\twhile (left <= right) {\n\t\t\tint mid = left + (right - left) / 2;\n\t\t\tif (array[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t} else if (array[mid] < target) {\n\t\t\t\tleft = mid + 1;\n\t\t\t} else {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "static int binarySearch(int arr[], int start, int end, int target ){\n if(start>end){\n return -1;\n }\n int mid = start+(end-start)/2;\n \n if(arr[mid] == target && (mid==0 || arr[mid-1]!=target)){\n return mid;\n }\n if(arr[mid] == target){\n return mid;\n }\n if(arr[mid]>=target && arr[mid]>arr[start]){\n return binarySearch(arr,start,mid-1,target);\n }\n // else if(arr[mid]<arr[start] && arr[mid]<target){\n // return binarySearch(arr,mid+1,end,target);\n // }\n return binarySearch(arr,mid+1,end,target);\n }", "public static int search(int[] nums, int target) {\n\n int length = nums.length;\n int i = 0;\n int j = length - 1;\n if (length == 0) return -1;\n\n while (true) {\n int index = (i + j) / 2;\n\n int value = nums[index];\n if (value == target) return index;\n\n //Using the invariant that either i - mid OR mid-j has\n //to be sorted at any point of the computation\n if (nums[j] >= value) {\n if (target > value && target <= nums[j]) i = index;\n else if (target > value && target > nums[j]) j = index;\n else j = index;\n }\n else {\n if (target < value && target >= nums[i]) j = index;\n else if (target < value && target < nums[i]) i = index;\n else i = index;\n }\n\n if (i + 1 == j) {\n if (nums[i] == target) return i;\n if (nums[j] == target) return j;\n return -1;\n }\n\n if (i == j || i >= length || j >= length) return -1;\n }\n\n }", "public int findMinOptimization(int[] nums) {\n // write your code here\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n int target = nums[end];\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] <= target) {\n end = mid;\n }\n else {\n start = mid;\n }\n }\n if (nums[start] <= nums[end]) return nums[start];\n return nums[end];\n }", "public static int search(int[] nums, int target) {\n int low=0;\n int high=nums.length-1;\n int middle=(high+low)>>1;\n\n for(int i=0;i<nums.length;i++){\n int num = nums[middle];\n if(target>num){\n low=middle+1;\n middle=(high+low)>>1;\n }else if(target<num){\n high=middle-1;\n middle=(high+low)>>1;\n } else{\n return middle;\n }\n\n }\n\n return -1;\n }", "private static int binarySearch(int[] arr, int low, int high, int target) {\n\n\t\tif (low <= high) {\n\n\t\t\tint mid = low + (high - low) / 2;\n\n\t\t\tif (arr[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t}\n\n\t\t\tif (arr[mid] < target) {\n\t\t\t\treturn binarySearch(arr, mid + 1, high, target);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(arr, low, mid - 1, target);\n\t\t\t}\n\n\t\t}\n\n\t\treturn -1;\n\t}", "static int BinarySearch(int[] arr, int target, int start, int end) {\n boolean isAsc = arr[start] < arr[end];\n\n while(start <= end) {\n // find the middle element\n// int mid = (start + end) / 2; // might be possible that (start + end) exceeds the range of int in java\n int mid = start + (end - start) / 2;\n\n if (arr[mid] == target) {\n return mid;\n }\n\n if (isAsc) {\n if (target < arr[mid]) {\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n } else {\n if (target > arr[mid]) {\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n }\n }\n return -1;\n }", "public static int binarySearch2(int[] numbers, int target) {\n int min = 0;\n int max = numbers.length - 1;\n \n int mid = -1;\n while (min <= max) {\n mid = (max + min) / 2;\n if (numbers[mid] == target) {\n return mid; // found it!\n } else if (numbers[mid] < target) {\n min = mid + 1; // too small\n } else { // numbers[mid] > target\n max = mid - 1; // too large\n }\n mid = (max + min) / 2;\n }\n \n return -min - 1; // not found\n }", "int binarySearch(int[] arr, int low, int high, int key){\n while(low <= high){\n int mid = (low + high) / 2;\n if (key < arr[mid])\n high = mid - 1;\n else if (key > arr[mid])\n low = mid + 1;\n else\n return mid;\n }\n return -1;\n }", "public int find(int[] nums, int target, int start, int end){\n int middle = (start + end) / 2;\n\n while (start <= end){\n middle = (start + end) >> 1;\n if(nums[middle] == target){\n return middle;\n }\n else if(nums[middle] > target){\n end = middle - 1;\n }\n else {\n start = middle + 1;\n }\n }\n return -1;\n }", "private int binarySearchRecursive(int[] array,int target,int left,int right) {\n if (left > right)\n return -1;\n\n int middle = (left + right) / 2;\n\n if (array[middle] == target)\n return middle;\n\n if (array[middle] < target)\n return binarySearchRecursive(array,target,middle+1,right);\n\n return binarySearchRecursive(array, target,left,middle-1);\n }", "public int binarySearchRotated(int [] nums) {\n\t\tint n = nums.length;\n\t\tint low = 0;\n\t\tint high = n -1;\n\t\twhile(low <= high) {\n\t\t\tif(nums[low] <= nums[high]) return low;\n\t\t\tint mid = (low + high) >> 1;\n\t\t\tint next = (mid + 1) % n;\n\t\t\tint prev = (mid - 1) % n;\n\t\t\tif(nums[mid] <= nums[next] && nums[mid] <= nums[prev]) return mid;\n\t\t\telse if(nums[mid] <= nums[high]) high = mid-1;\n\t\t\telse if(nums[mid] >= nums[low]) low = mid+1;\n\t\t}\n\t\t\n\t\treturn -1;\n\t\t\n\t}", "public static int binarySearch(int[] arr, int target){\n\t\tint start = 0;\n\t\tint end = arr.length - 1;\n\n\t\twhile (start <= end){\n\t\t\tint mid = (end + start) / 2;\n\t\t\tif(arr[mid] == target){\n\t\t\t\treturn mid;\n\t\t\t} else if(target < arr[mid]){\n\t\t\t\tend = mid - 1;\n\t\t\t} else if(target > arr[mid]){\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}", "static int binarySearchHelp(int[] array, int searched) {\n\t\tint mid = array.length / 2;\r\n\t\tint first = 0;\r\n\t\tint last = array.length - 1;\r\n\r\n\t\twhile (array[mid] != searched && first <= last) {\r\n\t\t\tmid = (first + last) / 2;\r\n\t\t\tif (searched == array[mid]) {\r\n\t\t\t\treturn mid;\r\n\t\t\t}\r\n\t\t\tif (searched < array[mid]) {\r\n\t\t\t\tlast = mid - 1;\r\n\r\n\t\t\t}\r\n\t\t\tif (searched > array[mid]) {\r\n\t\t\t\tfirst = mid + 1;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}", "abstract int binSearch(int[] array, int num, int left, int right);", "private int binarySearch(int[] array, int min, int max, int target){\r\n\r\n //because there is often not an answer that is equal to our target,\r\n //this algorithm is deisgned to find the element that it would go after in the array\r\n //because sometimes that is smaller than anything in the list it could bisect at a value that is not ideal.\r\n //however the final check handles 4 possible answers so this is not really an issue.\r\n if(target >= array[max]) return max;\r\n else if(target < array[min]) return min;\r\n if(min + 1 == max) return min;\r\n\r\n int midPoint = (min + max) / 2;\r\n\r\n if(target > array[midPoint]){\r\n return binarySearch(array, midPoint, max, target);\r\n }else return binarySearch(array, min, midPoint, target);\r\n }", "public int searchInNearlySortedArrayUtil(int[] nums, int low, int high, int target) {\n\n if (low > high)\n return -1;\n\n int mid = low + (high - low) / 2;\n\n if (nums[mid] == target) {\n return mid;\n }\n\n if (mid - 1 >= low && nums[mid - 1] == target) {\n return mid - 1;\n }\n\n if (mid + 1 <= high && nums[mid + 1] == target) {\n return mid + 1;\n }\n\n if (target < nums[mid]) {\n return searchInNearlySortedArrayUtil(nums, low, mid - 2, target);\n } else {\n return searchInNearlySortedArrayUtil(nums, mid + 2, high, target);\n }\n }", "public static int binarySearch(int[] numbers, int target) {\n int min = 0;\n int max = numbers.length - 1;\n \n while (min <= max) {\n int mid = (max + min) / 2;\n if (numbers[mid] == target) {\n return mid; // found it!\n } else if (numbers[mid] < target) {\n min = mid + 1; // too small\n } else { // numbers[mid] > target\n max = mid - 1; // too large\n }\n }\n \n return -1; // not found\n }", "public int binarySearchIterative(int[] array,int target) {\n var left = 0;\n var right = array.length -1;\n while (left <= right) {\n int middle = (left + right) / 2;\n if (array[middle] == target)\n return middle;\n if (array[middle] < target)\n left = middle + 1;\n else\n right = middle - 1;\n }\n return -1;\n }", "private static int binarySearchRecursively(int[] sortedArray, int input, int first, int last) {\n int mid = (first + last) / 2;\n\n if (last < first) {\n return -1;\n }\n if (input == sortedArray[mid]) {\n return mid;\n } else if (input < sortedArray[mid]) {\n return binarySearchRecursively(sortedArray, input, last, mid - 1);\n } else {\n return binarySearchRecursively(sortedArray, input, mid + 1, last);\n }\n }", "public List<Integer> largestDivisibleSubset_binarySearch(int[] nums) {\n\t\tint n = nums.length, maxIdx = 0;\n\t\tList<Integer> ans = new LinkedList<>();\n\t\tif (n == 0)\n\t\t\treturn ans;\n\t\tArrays.sort(nums);\n\t\tint[] lens = new int[n], prevs = new int[n];\n\t\tArrays.fill(prevs, -1);\n\t\tfor (int i = 0; nums[i] <= nums[n - 1] / 2; ++i) {\n\t\t\tfor (int j = i + 1, f = 2; nums[i] <= nums[n - 1] / f; f = (nums[j] + nums[i] - 1) / nums[i]) {\n\t\t\t\tint idx = Arrays.binarySearch(nums, j, n, f * nums[i]);\n\t\t\t\tif (idx > 0 && lens[idx] <= lens[i]) {\n\t\t\t\t\tprevs[idx] = i;\n\t\t\t\t\tlens[idx] = lens[i] + 1;\n\t\t\t\t\tif (lens[idx] > lens[maxIdx])\n\t\t\t\t\t\tmaxIdx = idx;\n\t\t\t\t}\n\t\t\t\tj = idx >= 0 ? idx + 1 : -(idx + 1);\n\t\t\t\tif (j >= n)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (int i = maxIdx; i >= 0; i = prevs[i])\n\t\t\tans.add(0, nums[i]);\n\t\treturn ans;\n }", "static int findFirstPosition(int[] nums, int target,int left,int right){\n while(left<=right){\n int mid=left+(right-left)/2;\n\n //If the target found\n if(nums[mid]==target){\n //if this is the first target from left\n if(mid==0 ||nums[mid-1]<nums[mid])\n return mid;\n else{\n //there are more targets available at left\n right=mid-1;\n }\n }\n if(target<nums[mid]){\n right=mid-1;\n }else if(target>nums[mid]){\n left=mid+1;\n }\n\n }\n return -1;\n }", "public static int binarySearch(int[] num, int target) {\n\t\tint left = 0;\n\t\tint right = num.length - 1;\n\t\twhile (left <= right) {\n\t\t\tint middle = (left+right)/2;\n\t\t\tif (num[middle] == target) {\n\t\t\t\treturn middle;\n\t\t\t} else if (num[middle] < target) {\n\t\t\t\tleft = middle + 1;\n\t\t\t} else {\n\t\t\t\tright = middle - 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "private int findMin(int[] nums) {\n if (nums == null || nums.length == 0) return -1;\n int left = 0;\n int right = nums.length - 1;\n while (left < right) {\n int mid = left + (right - left) / 2;\n if (nums[mid] >= nums[left] && nums[mid] > nums[right]) {\n left = mid + 1;\n } else if (nums[mid] == nums[right]) {\n while (mid < right && nums[mid] == nums[right]) {\n right--;\n }\n } else {\n right = mid;\n }\n }\n return nums[left];\n }", "int binarySearchWithRecursion(int[] arr, int low, int high, int key){\n if (high < low)\n return -1;\n int mid = (low + high) / 2;\n if (key == arr[mid])\n return mid;\n if (key > arr[mid])\n return binarySearchWithRecursion(arr,(mid + 1), high, key);\n return binarySearchWithRecursion(arr, low, (mid - 1), key);\n }", "private static int binarySearchMine(int[] data, int target, int low, int high) {\n while (low <= high) {\n int median = (low + high) / 2;\n int current = data[median];\n if (current == target) {\n return median;\n } else if (target < current) {\n return binarySearchMine(data, target, low, median - 1);\n } else {\n return binarySearchMine(data, target, median + 1, high);\n }\n }\n return -1;\n }", "private int minFind(int[] nums, int lo, int hi){\n if (lo+1 >= hi) return Math.min(nums[lo], nums[hi]);\n // sorted. we return the minimum element.\n // to tell it is sorted or not, we need nums[lo] less than nums[hi], they cannot be equal.\n if (nums[lo] < nums[hi]) return nums[lo];\n // unsorted\n int mid = lo + (hi-lo)/2;\n // avoid overflow\n\n return Math.min(minFind(nums, lo, mid-1), minFind(nums, mid, hi));\n }", "public int search(int[] A, int target) {\n // write your code here\n if (A == null || A.length == 0) return -1;\n int start = 0, end = A.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (A[mid] == target) return mid;\n if (A[mid] < A[start]) {\n if (target <= A[end] && target > A[mid]){\n start = mid;\n }\n else {\n end = mid;\n }\n }\n else {\n if (target >= A[start] && target < A[mid]) {\n end = mid;\n }\n else {\n start = mid;\n }\n }\n }\n if (A[start] == target) return start;\n if (A[end] == target) return end;\n return -1;\n }", "public static int findMin(int[] nums) {\n\n int lo =0;\n int n = nums.length;\n int hi = n-1;\n int min = nums[lo];\n while(lo<hi){\n while(lo <hi && lo <n-2 && nums[lo]==nums[lo+1] ){\n lo = lo+1;\n }\n while(lo<hi && hi >=1 && nums[hi]== nums[hi-1]){\n hi = hi-1;\n }\n int mid = lo +(hi-lo)/2;\n if(mid-1>=0 && mid+1<=n-1 && nums[mid]<nums[mid-1]&& nums[mid]>nums[mid+1]){\n return nums[mid];\n }\n if(nums[mid]<nums[hi]){\n hi = mid;\n } else {\n lo = mid+1;\n }\n\n\n }\n return nums[lo];\n }", "public Integer binSearch(Integer target, Integer[] data, Integer left, Integer right) {\n if (right - left == 1) {\n if (data[left] == target) return left;\n if (data[right] == target) return right;\n }\n if (right - left == 0) {\n if (data[left] == target) return left;\n }\n Integer midpt = (right + left) / 2 ;\n if (target == data[midpt]) return midpt ;\n if (target > data[midpt] ) return binSearch(target, data, midpt, right) ;\n if (target < data[midpt] ) return binSearch(target, data, left, midpt) ;\n\n return -1;\n }", "public int searchCyc(int[] nums) {\n int lo = 0;\n int hi = nums.length - 1;\n\n while (lo < hi) {\n int mid = (lo + hi) / 2;\n if (nums[mid] > nums[hi]) {\n lo = mid + 1;\n } else { //\n hi = mid;\n }\n }\n\n //Loop ends when left == right\n return lo;\n}", "public boolean search(int[] nums, int target) {\n if (nums == null || nums.length == 0) return false;\n int l = 0;\n int r = nums.length - 1;\n int m;\n while (l <= r) {\n m = (l + r) / 2; \n if (nums[m] == target) return true;\n int low, high;\n if (nums[m] >=nums[l]) {\n if(nums[m] == nums[l]){\n l++;\n }\n else{\n if (nums[l] <= target && target < nums[m]) {\n r = m - 1;\n }\n else {\n l = m + 1;\n }\n }\n }\n else {\n if (nums[m] == nums[r]){\n r--;\n } \n else{\n if (nums[m] < target && target <= nums[r]) {\n l = m + 1;\n }\n else {\n r = m - 1;\n }\n }\n }\n }\n return false;\n }", "public static int[] binaryearch(int[] nums, int left, int right, int target) {\n int[] indexs = {-1, -1};\n if (left > right) {\n return indexs;\n }\n int middle = (right - left) / 2 + left;\n if (nums[middle] == target) {\n int[] results = new int[]{middle, middle};\n if (middle > left && nums[middle - 1] == nums[middle]) {\n //左侧还有\n int[] indexs2 = binaryearch(nums, left, middle - 1, target);\n if (indexs2[0] != -1) {\n results[0] = indexs2[0];\n }\n }\n if (middle < right && nums[middle + 1] == nums[middle]) {\n // //右侧还有\n int[] indexs2 = binaryearch(nums, middle + 1, right, target);\n if (indexs2[1] != -1) {\n results[1] = indexs2[1];\n }\n }\n return results;\n } else if (nums[middle] < target) {\n indexs = binaryearch(nums, middle + 1, right, target);\n\n } else {\n indexs = binaryearch(nums, left, middle - 1, target);\n }\n return indexs;\n\n }", "private static int search(int[] nums, int target, int start, int end)\r\n\t{\n\t\tif (end == start)\r\n\t\t\treturn nums[start] == target ? start : -1;\r\n\t\t\r\n\t\tif(end - start == 1)\r\n\t\t{\r\n\t\t\tif(nums[start] == target)\r\n\t\t\t\treturn start;\r\n\t\t\tif(nums[end] == target)\r\n\t\t\t\treturn end;\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\t\r\n\t\t// If there are more than two elements\r\n\t\tint mid = (start + end) / 2;\r\n\t\tif (nums[mid] == target)\r\n\t\t\treturn mid;\r\n\t\telse if (nums[mid] > target)\r\n\t\t\treturn search(nums, target, start, mid - 1);\r\n\t\telse\r\n\t\t\treturn search(nums, target, mid + 1, end);\r\n\t}", "private static boolean binarySearch(int[] data, int target, int low, int high) {\n if (low > high) {\n return false;\n } else {\n int mid = (low + high) / 2;\n if (target == data[mid]) {\n return true;\n } else if (target < data[mid]) {\n return binarySearch(data, target, low, mid - 1);\n } else {\n return binarySearch(data, target, mid + 1, high);\n }\n }\n }", "public static int binarySearchWithTheClosestNum(int[] num, int target) {\n\t\tint left = 0;\n\t\tint right = num.length - 1;\n\t\twhile (left <= right) {\n\t\t\tint middle = (left+right)/2;\n\t\t\tif (num[middle] == target) {\n\t\t\t\treturn middle;\n\t\t\t} else if (num[middle] < target) {\n\t\t\t\tleft = middle + 1;\n\t\t\t} else {\n\t\t\t\tright = middle - 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// when we reach here, means target is not in the array, so we need to find the closet element from num[left] or num[right]\n\t\t// notice that, right is smailler than left now, according to the while condition, if it breaks, left > right\n\t\treturn Math.abs(target - num[left]) > Math.abs(target - num[right]) ? right : left;\n\t}", "public static int binSearchRotatedIter(int src[], int lo, int hi, int target){\n\n while(lo<=hi){\n int mid = lo + (hi-lo)/2;\n if(src[mid]==target) return mid;\n //if bottom half is sorted\n if(src[lo]<=src[mid]){\n \n if(src[lo]<=target && target<src[mid]){\n hi=mid-1;\n }else{\n lo=mid+1;\n }\n }\n //if upper half is sorted\n else{\n if(src[mid]<target && target<=src[hi]){\n lo=mid+1;\n }else{\n hi=mid-1;\n }\n }\n }\n return -1;\n}", "private int findUpperBound(int[] nums, int target) {\n int left = 0, right = nums.length;\n while (left < right) {\n int mid = (right - left) / 2 + left;\n if (nums[mid] > target) right = mid;\n else left = mid + 1;\n }\n return (left > 0 && nums[left - 1] == target) ? left - 1 : -1;\n }", "public int[] searchRange(int[] nums, int target) {\n int[] result = { -1, -1 };\n if (nums == null) {\n return result;\n }\n\n int left = 0;\n int right = nums.length - 1;\n\n // search for left bound.\n int start = 0;\n int end = nums.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] < target) {\n start = mid;\n } else {\n end = mid;\n }\n }\n\n if (nums[start] == target) {\n left = start;\n } else {\n left = start + 1;\n }\n\n // search for right bound.\n end = nums.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] > target) {\n end = mid;\n } else {\n start = mid;\n }\n }\n\n if (nums[end] == target) {\n right = end;\n } else {\n right = end - 1;\n }\n\n if (left > right) {\n return result;\n } else {\n result[0] = left;\n result[1] = right;\n return result;\n }\n }", "public static int RecurviveBinarysearch(int[] intArray, int low, int high , int target )\n {\n int mid;\n\n if ( low > high)\n {\n return -1;\n }\n else\n {\n mid = (high + low)/2;\n\n if(intArray[mid] < target)\n return RecurviveBinarysearch(intArray , mid+1 , high , target);\n else if ( intArray[mid] > target)\n return RecurviveBinarysearch(intArray, low, mid-1, target);\n \n return mid; \n }\n }", "public int findPosition(int[] nums, int target) {\n // write your code here\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n while (start <= end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] == target) return mid;\n if (nums[mid] < target)\n start = mid + 1;\n else\n end = mid - 1;\n }\n return -1;\n }", "private static boolean checkHalfway(int[] arr, int searchValue, int begin, int end) {\r\n\t\treturn searchValue < arr[(begin+end+1)/2];\r\n\t}", "public int findMinR2(int[] nums) {\n\t\tif (nums.length == 1) {\n\t\t\treturn nums[0];\n\t\t}\n\n\t\tif (nums[0] < nums[nums.length - 1]) {\n\t\t\treturn nums[0];\n\t\t}\n\n\t\t// Binary Search. R=M-1 ver.\n\t\tint left = 0;\n\t\tint right = nums.length - 1;\n\t\twhile (left <= right) {\n\t\t\tint mid = left + (right - left) / 2;\n\n\t\t\t// Check if the nums[mid] is the minimum.\n\t\t\t// If the elem to the left of the mid elem is bigger than mid elem,\n\t\t\t// then mid elem is the minimum.\n\t\t\t// Be careful if the mid is 0.\n\t\t\t// The reason we need the second condition is because with the R=M-1 version of\n\t\t\t// binary search, the mid can move like index 2 => 0 => 1. In that case,\n\t\t\t// we check index 0 before index 1. If the elem at index 1 is the minimum,\n\t\t\t// then we need,\n\t\t\t// 'nums[mid] < nums[mid + 1]'\n\t\t\t// to continue when the mid is equal to 0.\n\t\t\tif ((mid != 0 && nums[mid - 1] > nums[mid]) || //\n\t\t\t\t\t(mid == 0 && nums[mid] < nums[mid + 1])) {\n\t\t\t\treturn nums[mid];\n\t\t\t}\n\n\t\t\tif (nums[mid] < nums[right]) {\n\t\t\t\tright = mid - 1;\n\t\t\t} else {\n\t\t\t\tleft = mid + 1;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}", "public int binarySearchLoop(int key) {\n int first = 0;\n int last = length - 1;\n int mid = length / 2;\n //only on sorted array\n //first , mid = half(floor), last;\n //is mid the key\n //is mid < or > from the key\n //if key is bigger, then we go right, the new first is mid+1, new mid is (mid+last)/2, and last is the same until the end of the GOING searching right\n //if key is smaller then we go left, the new last is mid-1, new mid is (first + mid)/2, and first is the same until the end of GOING searching left\n\n while (first <= last) {\n if (key == arr[mid]) return mid;\n\n else if (key < arr[mid]) {\n last = mid - 1;\n mid = (first + mid) / 2;\n } else {\n first = mid + 1;\n mid = (first + last) / 2;\n }\n }\n return -1;\n }", "public int[] searchRange(int[] A, int target) {\n int ans[] = new int[2], len = A.length, low = 0, high = len - 1, mid;\n ans[0] = -1;\n ans[1] = -1;\n while (low <= high) {\n mid = low + (high - low) / 2;\n if (A[mid] == target) {\n int left[] = searchRange(Arrays.copyOfRange(A, low, mid), target);\n int right[] = searchRange(Arrays.copyOfRange(A, mid + 1, high + 1), target);\n ans[0] = left[0] == -1 ? mid : low + left[0];\n ans[1] = right[1] == -1 ? mid : mid + 1 + right[1];\n break;\n } else if (A[mid] > target) {\n high = mid - 1;\n } else {\n low = mid + 1;\n }\n }\n return ans;\n }", "public int helper(int[] A, int target, int left, int right){\n if(left>=right){\n \n if(A[left]<target) return left+1;\n else return left;\n \n }\n \n int mid= left+(right-left)/2; \n if(target==A[mid]) return mid;\n else if (target>A[mid]) return helper(A,target, mid+1, right);\n else return helper(A,target,left, mid-1);\n \n }", "public int[] searchRange(int[] nums, int target, int i, int j) {\n int[] res = new int[]{-1, -1};\n while (i <= j) {\n int mid = (i + j) / 2;\n if (nums[mid] == target) {\n int[] left = searchRange(nums, target, i, mid-1), right = searchRange(nums, target, mid+1, j);\n if (left[0] == -1)\n res[0] = mid;\n else\n res[0] = left[0];\n\n if (right[0] == -1)\n res[1] = mid;\n else\n res[1] = right[1];\n return res;\n } else if (nums[mid] < target) {\n i = mid + 1;\n } else {\n j = mid - 1;\n }\n }\n// System.out.println(Arrays.toString(res));\n return res;\n }", "static int Floor(int[] arr, int target){\r\n int start = 0;\r\n int end = arr.length - 1;\r\n\r\n while(start <= end){\r\n //Find the middle element\r\n int mid = start + (end - start) / 2;\r\n if (target < arr[mid]){\r\n end = mid - 1;\r\n }else if (target > arr[mid]){\r\n start = mid + 1;\r\n }else {\r\n return mid;\r\n }\r\n }\r\n return start;\r\n }", "public int findMin(int[] nums) {\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] < nums[start]) {\n end = mid;\n }\n else if (nums[mid] < nums[end]) {\n end = mid;\n }\n else {\n start = mid;\n }\n }\n if (nums[start] < nums[end]) return nums[start];\n return nums[end];\n }", "private int searchR(Searching[] array, int start, int half, int end, int value) {\n if (value > array[end].getValue() || value < array[start].getValue()) {\n return -1;\n }\n int a = end - start;\n int b = array[end].getValue() - array[start].getValue();\n int c = value - array[start].getValue();\n int d = (c * a) / b;\n int slide = d + start;\n if (slide > end || slide < start) {\n return -1;\n }\n if (array[slide].getValue() == value) {\n return slide;\n }\n if (value < array[slide].getValue()) {\n end = slide;\n return searchR(array, start, half, end, value);\n } else {\n start = slide;\n return searchR(array, start, half, end, value);\n }\n }", "public int binarySearchAlgo(int a[], int low, int high, int x) {\n\t\tint mid = (low + high) / 2;\n\t\t// If mid is x simply return the value\n\t\tif (a[mid] == x) {\n\t\t\treturn mid;\n\t\t}\n\t\t// If we didn't find any element simply return -1\n\t\tif (low == high) {\n\t\t\treturn -1;\n\t\t}\n\t\t// If mid element value is less then x go search higher(right) indices\n\t\tif (a[mid] < x) {\n\t\t\treturn binarySearchAlgo(a, mid + 1, high, x);\n\t\t}\n\t\t// If mid element value is less then x go search lower(left) indices\n\t\telse /* if (a[mid] > x) */ {\n\t\t\treturn binarySearchAlgo(a, low, mid - 1, x);\n\t\t}\n\n\t}", "public static double findMedianSortedArraysBinary(int[] nums1, int[] nums2) {\n int m = nums1.length;\n int n = nums2.length;\n if (n == 0) {\n return getMedian(nums1);\n }\n if (m == 0) {\n return getMedian(nums2);\n }\n if (m > n) {\n // Make sure the first array is the shorter one\n return findMedianSortedArraysBinary(nums2, nums1);\n }\n // Init the start curser with the first and the last point of the shorter array\n int start = 0;\n int end = m;\n\n // Loop until start and end met\n while (start <= end) {\n // The `nums1` index will be the center between `start` and `end`\n int i = (start + end) / 2;\n // The `nums2` index will be the complement of `i` from the total length\n // m+n+1(the amount of gaps)\n int j = (m + n + 1) / 2 - i;\n if (j > 0 && i < m && nums1[i] < nums2[j - 1]) {\n // If the left max of `nums2` is still larger than right min of `nums1`\n // we move start curser to the right position of the middle\n start = i + 1;\n\n } else if (i > 0 && j < n && nums2[j] < nums1[i - 1]) {\n // If the left max of `nums1` is still larger than right min of `nums2`\n // we move end curser to the left position of the middle\n end = i - 1;\n } else {\n // find the max value of left\n int maxLeft = 0;\n if (i == 0) {\n // if i-1 out of index\n maxLeft = nums2[j - 1];\n } else if (j == 0) {\n // if j-1 out of index\n maxLeft = nums1[i - 1];\n } else {\n maxLeft = Math.max(nums1[i - 1], nums2[j - 1]);\n }\n if ((m + n) % 2 == 1) {\n // If total length is odd\n // The max value of left is the median\n return maxLeft;\n }\n // find the min value of right\n int minRight = 0;\n if (i == m) {\n // If i out of index\n minRight = nums2[j];\n } else if (j == n) {\n // If j out of index\n minRight = nums1[i];\n } else {\n minRight = Math.min(nums1[i], nums2[j]);\n }\n // If total length is even\n return (maxLeft + minRight) / 2.0;\n }\n }\n // If no answer found, we give the answer of 0.0\n return 0.0;\n }", "public int findMin2(int[] arr) {\n\t\tint left = 0;\n\t\t// We use arr[right] as binary search condition later. right = arr.length would\n\t\t// be out of bound.\n\t\tint right = arr.length - 1;\n\t\tint mid = 0;\n\n\t\t// while (left < right) causes a problem that the last element cannot be\n\t\t// reached when R=len-1 used.\n\t\twhile (left <= right) {\n\t\t\tmid = left + (right - left) / 2;\n\n\t\t\t// There is one element.\n\t\t\t// Since R=M is used, this is needed to avoid infinite loop.\n\t\t\tif (left == right) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (arr[mid] > arr[right]) {\n\t\t\t\t// Search on the right.\n\t\t\t\tleft = mid + 1;\n\t\t\t} else {\n\t\t\t\t// Search on the left.\n\t\t\t\t// R=M because that mid can be the minimum and\n\t\t\t\t// infinite loop that is caused by R=M and while (left <= right) is avoided\n\t\t\t\t// since there is a return when left == right.\n\t\t\t\tright = mid;\n\t\t\t}\n\t\t}\n\n\t\t// Return the last one.\n\t\treturn arr[left];\n\t}", "private static boolean binarySearch(int[] arr, int num, int start, int end) {\n\t\tif(arr==null || arr.length==0){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tint mid;\r\n\t\t\r\n\t\twhile(start<=end){\r\n\t\t\t\r\n\t\t\tmid= start+ (end-start)/2;\r\n\t\t\t\r\n\t\t\tif(arr[mid]==num){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse if(num < arr[mid]){\r\n\t\t\t\tend=mid-1;\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tstart=mid+1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "static int binarySearch(int[] array, int start, int end, int value) {\r\n\t\tif(end>=start) {\r\n\t\t\tint mid = (start+end)/2;\r\n\t\t\tif(array[mid]==value)\r\n\t\t\t\treturn mid;\r\n if(array[mid]>value)\r\n \treturn binarySearch(array, start, mid-1, value);\r\n return binarySearch(array, mid+1, end, value);\r\n\t\t}\r\n return -1;\r\n\t}", "public static int binSearch(int[] a, int first, int last, int key)\n\t{\t\n\t\tif(first <= last)\n\t\t{\n\t\t\tint mid = (first + last) / 2; //Divides the beginning of the array and the length of the array into 2\n\t\t\t\n\t\t\tif (a[mid] == key)\n\t\t\t{\n\t\t\t\treturn mid; \n\t\t\t}\n\t\t\t\n\t\t\telse if (a[mid] > key) //IF THE INDEX(WHICH IS THE MID) OF ARRAY A IS GREATER THAN THE KEY\n\t\t\t{\n\t\t\t\treturn last = mid - 1; //RETURNS THE LENGTH OF THE ARRAY WHICH IS THE DECREMENTED MID\n\t\t\t}\n\t\t\t\n\t\t\telse //IF THE INDEX(WHICH IS THE MID) OF ARRAY A IS LESS THAN THE KEY\n\t\t\t{\n\t\t\t\treturn first = mid + 1; //RETURNS THE FIRST = INCREMENTED MID\t\t\n\t\t\t}\n\t\t}\n\t\treturn -1;\t\n\t}", "private int binarySearch(T element) {\n int start = 0, end = sortedArray.size(), mid = 0;\n while (start < end) {\n mid = (end + start) / 2;\n int cmp = sortedArray.get(mid).compareTo(element);\n if (cmp == 0) {\n start = end = mid;\n }\n else if (cmp < 0) {\n start = mid + 1;\n }\n else {\n end = mid;\n }\n }\n return start;\n }", "public static int searchInsert(int[] nums, int target) {\n if(target< nums[0])\n return 0;\n if(target>nums[nums.length-1])\n return nums.length;\n int l=0, mid, h=nums.length-1;\n while(l<nums.length && h<nums.length && l<=h) {\n mid = l+(h-l)/2;\n if(nums[mid]==target)\n return mid;\n else if(target<nums[mid])\n h=mid-1;\n else if(target>nums[mid])\n l=mid+1;\n }\n if(nums[l]>target)\n return l;\n else\n return l+1;\n }", "public int minSubArrayLen(int s, int[] nums) {\n int min = Integer.MAX_VALUE;\n int left = 0;\n int right = 0;\n int sum = 0;\n boolean found = false;\n while(right < nums.length) {\n sum += nums[right];\n right++;\n \n while(sum - nums[left] >= s) {\n sum -= nums[left];\n left++;\n }\n if(sum >= s) {\n found = true;\n min = Math.min(min, right - left);\n }\n \n }\n\n return found ? min : 0;\n }", "private static int search(int[] arr, int findMe, int left, int right) {\n\t\tif (left > right) {\n\t\t\treturn FAILURE;\n\t\t}\n\t\tint mid = (left + right) / 2;\n\t\tif (findMe == arr[mid]) {\n\t\t\treturn mid;\n\t\t}\n\t\telse if (findMe < arr[mid]) {\n\t\t\treturn search(arr, findMe, left, mid - 1);\n\t\t}\n\t\telse {\n\t\t\treturn search(arr, findMe, mid + 1, right);\n\t\t}\n\t}", "public int[] searchRange(int[] A, int target) {\n // write your code here\n if (A == null || A.length == 0) return new int[] {-1, -1};\n int left = 0, right = A.length - 1;\n while (left + 1 < right) {\n int mid = left + (right - left) / 2;\n if (A[mid] >= target) {\n right = mid;\n }\n else{\n left = mid;\n }\n }\n int leftBound = -1, rightBound = -1;\n if (A[left] == target)\n leftBound = left;\n else if (A[right] == target)\n leftBound = right;\n\n left = 0;\n right = A.length - 1;\n while (left + 1 < right) {\n int mid = left + (right - left) / 2;\n if (A[mid] <= target) {\n left = mid;\n }\n else {\n right = mid;\n }\n }\n if (A[right] == target) rightBound = right;\n else if (A[left] == target) rightBound = left;\n return new int[] {leftBound, rightBound};\n }", "private static int first(int arr[], int low, int high, int x, int n)\n {\n if(high >= low){\n \n /*mid = low+high/2*/\n int mid = low + (high-low) / 2;\n\n //Wen we found the X at the MID\n if( (mid==0 || x > arr[mid-1]) && arr[mid] == x)\n return mid;\n\n //WEn the x is greater than mid go to right ie mid+1\n if( x > arr[mid])\n return first(arr, (mid+1), high, x, n);\n\n //Else case wen x is small go left ie mid-1\n return first(arr, low, (mid-1), x, n);\n\n }\n\n //Wen not found ie high <= low\n return -1;\n }", "public static int floorSearch(int[] arr, int low, int high, int x) {\n\t\tif(low==high){\n\t\t\tif(x>=arr[low])\n\t\t\t\treturn arr[low];\n\t\t\telse\n\t\t\t\treturn -1;\n\t\t}\n\t\tif(low<high){\n\t\t\tint mid=(low+high)/2;\n\t\t\tif(arr[mid]==x)\n\t\t\t\treturn arr[mid];\n\t\t\tif((mid+1<=high) && (x>arr[mid] && x<arr[mid+1])){\n\t\t\t\treturn arr[mid];\n\t\t\t}\n\t\t\tif(mid-1>=low && x>arr[mid-1] && x<arr[mid]){\n\t\t\t\treturn arr[mid-1];\n\t\t\t}\n\t\t\tif(x>arr[mid])\n\t\t\t\treturn floorSearch(arr,mid+1,high,x);\n\t\t\telse\n\t\t\t\treturn floorSearch(arr,low,mid-1,x);\n\t\t}\n\t\treturn -1;\n\t}", "int binarySearch(int arr[], int x)\n {\n int l = 0, r = arr.length - 1;\n while (l <= r) {\n int m = l + (r - l) / 2;\n\n // Check if x is present at mid\n if (arr[m] == x)\n return m;\n\n // If x greater, ignore left half\n if (arr[m] < x)\n l = m + 1;\n\n // If x is smaller, ignore right half\n else\n r = m - 1;\n }\n\n // if we reach here, then element was\n // not present\n return -1;\n }", "public static int binarySearch(int[] ary, int target, int start, int end){\r\n\t\t//get the middle index\r\n\t\tint middle = (end-start)/2 + start;\r\n\t\tint result = 0;\r\n\t\t\r\n\t\t//Some end cases (error, out of scope, etc)\r\n\t\tif(end-start<0||target<ary[0]||target>ary[ary.length-1])\r\n\t\t\t\r\n\t\t\t//If element is not in the array display \r\n\t\t\treturn -1;\r\n\r\n\r\n\t\t//Recursive case 1: If target is less than, the next search occurs within start and middle-1\r\n\r\n\t\tif (target < ary[middle]) {\r\n\t\t\tresult = binarySearch(ary, target, start, middle-1 );\r\n\t\t}\r\n\t\t\r\n\t\t//Recursive case 2: If target is greater than, the next search occurs within middle+1 and end \r\n\t\telse if(target > ary[middle]) {\r\n\t\t\tresult = binarySearch(ary, target, middle+1, end);\r\n\t\t\r\n\t\t//End cases: If target is equal, done.\r\n\t\t}\r\n\t\telse if (target == ary[middle]) {\r\n\t\t\tresult = middle;\r\n\t\t}\r\n\r\n\t\t//Return results\r\n\t\treturn result;\r\n\t}", "public int findUnsortedSubarray(int[] nums) {\n int leftIndex = Integer.MAX_VALUE;\n int rightIndex = Integer.MIN_VALUE;\n for(int i = 1; i < nums.length; i++) {\n if(nums[i] < nums[i - 1]) {\n leftIndex = Math.min(leftIndex, nums[i - 1]);\n }\n }\n\n for(int i = nums.length - 2; i >= 0; i--) {\n if(nums[i] > nums[i + 1]) {\n rightIndex = Math.max(rightIndex, nums[i]);\n }\n }\n int left;\n int right;\n for(left = 0; left < nums.length; left++) {\n if(leftIndex < nums[left]) {\n break;\n }\n }\n for(right = nums.length - 1; right >= 0; right--) {\n if(rightIndex > nums[right]) {\n break;\n }\n }\n return (right - 1) < 0 ? 0: (right - 1 + 1);\n }", "public static int binarySearch(int[] array, int value, int start, int end){\n if(start <= end){\n int mid = (start+end)/2;\n if (array[mid] == value) return mid;\n else if(array[mid] < value) start = mid+1;\n else end = mid-1;\n return binarySearch(array, value, start, end);\n }\n return -1;\n }", "public boolean search(int[] nums, int target) {\n\t\tint head = 0, tail = nums.length - 1;\n\t\twhile (head <= tail){\n\t\t\tint mid = (head + tail) / 2;\n\t\t\tif (target == nums[mid]) return true;\n\t\t\tif (nums[mid] < nums[head]){\n\t\t\t\tif ((target > nums[mid]) && (target <= nums[tail])) head = mid + 1; else tail = mid - 1;\n\t\t\t} else if (nums[mid] > nums[tail]){\n\t\t\t\tif ((target < nums[mid]) && (target >= nums[head])) tail = mid - 1; else head = mid + 1;\n\t\t\t} else {\n\t\t\t\tif (nums[head] == nums[tail]){\n\t\t\t\t\thead ++;\n\t\t\t\t\ttail --;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (target < nums[mid]) tail = mid - 1; else head = mid + 1;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "static int findMin(int[] nums) {\r\n \r\n // **** sanity check(s) ****\r\n if (nums.length == 1)\r\n return nums[0];\r\n\r\n // **** initialization ****\r\n int left = 0;\r\n int right = nums.length - 1;\r\n\r\n // **** check if there is no rotation ****\r\n if (nums[right] > nums[left])\r\n return nums[left];\r\n\r\n // **** binary search approach ****\r\n while (left < right) {\r\n\r\n // **** compute mid point ****\r\n int mid = left + (right - left) / 2;\r\n\r\n // **** check if we found min ****\r\n if (nums[mid] > nums[mid + 1])\r\n return nums[mid + 1];\r\n\r\n if (nums[mid - 1] > nums[mid])\r\n return nums[mid];\r\n\r\n // **** decide which way to go ****\r\n if (nums[mid] > nums[0])\r\n left = mid + 1; // go right\r\n else\r\n right = mid - 1; // go left\r\n }\r\n\r\n // **** min not found (needed to keep the compiler happy) ****\r\n return 69696969;\r\n }", "public static int merge(Integer[] arr, Integer[] aux, int low, int mid, int high)\n {\n int k = low, i = low, j = mid + 1;\n int inversionCount = 0;\n\n // While there are elements in the left and right runs\n while (i <= mid && j <= high)\n {\n if (arr[i] <= arr[j]) {\n aux[k++] = arr[i++];\n }\n else {\n aux[k++] = arr[j++];\n inversionCount += (mid - i + 1); // NOTE\n }\n }\n\n // Copy remaining elements\n while (i <= mid)\n aux[k++] = arr[i++];\n\n // Don't need to copy second half\n\n // copy back to the original array to reflect sorted order\n for (i = low; i <= high; i++) {\n arr[i] = aux[i];\n }\n\n return inversionCount;\n }", "public static int binarySearch(int[] elements, int start, int end, int findMe) {\n if (start > end) {\n return -1;\n }\n Integer mid = (start + end) / 2;\n Integer midElement = elements[mid];\n //is mid the element we are looking?\n if (findMe == midElement) {\n return mid;\n }\n if (findMe < midElement) {\n //its in left half\n return binarySearch(elements, start, mid - 1, findMe);\n } else {\n //in right half of array\n return binarySearch(elements, mid + 1, end, findMe);\n }\n }", "private static int binary_search(int[] array, int num, int low, int high) {\n\t\t\n\t\treturn -1;\n\t}", "@Test\n\tpublic void testBinarySearch() {\n\t\tint[] arr0 = {0, 1, 2, 3, 4, 5};\n\t\tassertEquals(0, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 0));\n\t\tassertEquals(1, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 1));\n\t\tassertEquals(2, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 2));\n\t\tassertEquals(3, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 3));\n\t\t\n\t\tassertEquals(-1, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 99));\n\t\t\n\t\tint[] arr1 = {0, 43, 209, 388, 401, 599};\n\t\tassertEquals(2, _01_BinarySearch.binarySearch(arr1, 0, arr0.length - 1, 209));\n\t\tassertEquals(-1, _01_BinarySearch.binarySearch(arr1, 0, arr0.length - 1, 45));\n\t}", "public static int mergeSort(Integer[] arr, Integer[] aux, int low, int high)\n {\n // Base case\n if (high == low) { // if run size == 1\n return 0;\n }\n\n // find mid point\n int mid = (low + ((high - low) >> 1));\n int inversionCount = 0;\n\n // recursively split runs into two halves until run size == 1,\n // then merge them and return back up the call chain\n\n // split / merge left half\n inversionCount += mergeSort(arr, aux, low, mid);\n\n // split / merge right half\n inversionCount += mergeSort(arr, aux, mid + 1, high);\n\n // merge the two half runs\n inversionCount += merge(arr, aux, low, mid, high);\n\n return inversionCount;\n }", "private static int firstGreaterEqual(int[] A, int target) {\n int low = 0, high = A.length;\n while (low < high) {\n int mid = low + ((high - low) >> 1);\n //low <= mid < high\n if (A[mid] < target) {\n low = mid + 1;\n } else {\n //should not be mid-1 when A[mid]==target.\n //could be mid even if A[mid]>target because mid<high.\n high = mid;\n }\n }\n return low;\n }", "public int findDuplicate(int[] nums) {\n int low = 1, high = nums.length - 1;\n while (low < high) {\n int mid = low + (high - low) / 2;\n int cnt = 0;\n for (int n : nums) {\n if (n <= mid) {\n cnt++;\n }\n }\n if (cnt <= mid) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return low;\n\n }", "static int binarySearch(@NotNull int[] search, int find) {\n int start, end, midPt;\n start = 0;\n end = search.length - 1;\n\n while (start <= end) {\n midPt = (start + end) / 2;\n if (search[midPt] == find) {\n return midPt;\n } else if (search[midPt] < find) {\n start = midPt + 1;\n } else {\n end = midPt - 1;\n }\n }\n\n return -1;\n }", "public static boolean binarySearch(int target, int[] nums) {\n int floorIndex = -1;\n int ceilingIndex = nums.length;\n\n // if there isn't at least 1 index between floor and ceiling,\n // we've run out of guesses and the number must not be present\n while (floorIndex + 1 < ceilingIndex) {\n\n // find the index ~halfway between the floor and ceilingR\n // we use integer division, so we'll never get a \"half index\"\n int distance = ceilingIndex - floorIndex;\n int halfDistance = distance / 2;\n int guessIndex = floorIndex + halfDistance;\n\n int guessValue = nums[guessIndex];\n\n if (guessValue == target) {\n System.out.println(\"Number found:\" + target);\n return true;\n }\n\n if (guessValue > target) {\n\n // target is to the left, so move ceiling to the left\n ceilingIndex = guessIndex;\n\n } else {\n\n // target is to the right, so move floor to the right\n floorIndex = guessIndex;\n }\n }\n System.out.println(\"Number not found:\"+ target);\n return false;\n }", "public int binarySearchAlgo(int a[], int x) {\n\t\tint low = 0;\n\t\tint high = a.length - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (a[mid] == x) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\tif (x > a[mid]) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else /* if(a[mid] < x) */ {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public static Boolean binarySearch(int[] arr, int n){\r\n if(arr.length == 0) return false;\r\n if(arr.length == 1 && arr[0] != n) return false; \r\n if(arr.length == 1 && arr[0] == n) return true; \r\n int start = 0;\r\n int mid = arr.length/2;\r\n int end = arr.length;\r\n int pos = mid;\r\n while(arr[pos] != n){\r\n if(n > arr[pos]){\r\n start = mid;\r\n mid = (end-start)/2+start;\r\n } else if(n < arr[pos]){\r\n end = mid;\r\n mid = (end-start)/2+start;\r\n System.out.println(\"here \" + start+ \" \" + mid + \" \" + end + \" pos= \" + pos);\r\n }\r\n pos = mid;\r\n if(arr[pos] == n) return true;\r\n if(start+1 == end){\r\n System.out.println(start+ \" \" + mid + \" \" + end + \" pos= \" + pos);\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "private int binarySearch(String[] arr, int low, int high, String targetVal) {\n\t\twhile(low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tarr[mid] = arr[mid].toLowerCase();\n\t\t\ttargetVal = targetVal.toLowerCase();\n\t\t\tif (arr[mid].compareTo(targetVal) < 0) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else if (arr[mid].compareTo(targetVal) > 0) {\n\t\t\t\thigh = mid -1;\n\t\t\t} else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "private int insertIndex(int[] arr, int target) {\n int low = 0, high = arr.length - 1;\n if (target < arr[0]) {\n return -1;\n }\n if (target >= arr[arr.length - 1]) {\n return arr.length - 1;\n }\n while (low <= high) {\n int mid = low + (high - low) / 2;\n if (arr[mid] <= target && arr[mid + 1] > target) {\n // index found\n return mid;\n }\n if (arr[mid] <= target) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n return -1;\n }", "public static int BinarySearch(int[] arr,int data){\n int si = 0, ei = arr.length - 1;\n while(si <= ei){\n int mid = (si + ei) / 2;\n if(arr[mid] == data)\n return mid;\n else if(data < arr[mid]){\n ei = mid - 1;\n }else si = mid + 1;\n }\n\n return -1;\n }", "public int[] searchRange(int[] nums, int target) {\n final int len = null != nums ? nums.length : 0;\n if (len <= 0) {\n return new int[]{-1, -1};\n }\n \n int[] result = new int[2];\n int start = 0, end = len-1, idx = -1;\n int mid = 0;\n while (start <= end) {\n mid = start + ((end - start) >> 1);\n if (nums[mid] == target) {\n idx = mid;\n }\n if(nums[mid] >= target){\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n }\n result[0] = idx;\n \n //reset start and end value\n start = 0;\n end = len-1;\n idx = -1;\n while (start <= end) {\n mid = start + ((end - start) >> 1);\n if (nums[mid] == target) {\n idx = mid;\n }\n if(nums[mid] <= target){\n start = mid + 1;\n }else{\n end = mid - 1;\n }\n }\n result[1] = idx;\n return result;\n }", "public static void main(String[] args) {\n\n int[] arr = {45,63,78,92,110};\n int search = 110;\n\n\n boolean toggle = true;\n int start = 0;\n int end = arr.length - 1;\n\n while (toggle) {\n int mid = (start + end) / 2;\n if (arr[mid] == search) {\n System.out.println(mid);\n toggle = false;\n } else {\n if (arr[mid] < search) {\n start = mid + 1;\n } else {\n end = mid - 1;\n }\n }\n }\n\n }", "public int sortSearchHelper (int val, int low, int high, List<Integer> list) {\n \n // Binary search to find our element val in the insertion sorted array\n \n int mid = low + (high - low)/2;\n \n // Here, if binary search ends, means current mid is the value.\n \n if (low >= high) {\n \n list.add(mid, val);\n return mid;\n \n }\n \n // Check if given val is present on left or right side of mid value.\n \n if (val <= list.get(mid)) {\n \n return sortSearchHelper (val, low, mid, list);\n \n } else {\n \n return sortSearchHelper (val, mid + 1, high, list);\n \n }\n \n \n }", "public int[] searchRange(int[] A, int target) {\n int left = 0 ;\n int right = A.length - 1;\n int mid;\n int[] lr = new int[2];\n while(left <= right){\n \tmid = (left + right) /2 ;\n \tif(A[mid] == target){\n \t\tlr[0] = searchLeft(A,left,mid,target);\n \t\tlr[1] = searchRight(A,mid,right,target);\n \t\treturn lr;\n \t}\n \telse if (A[mid] < target){\n \t\tleft = mid + 1;\n \t}\n \telse{\n \t\tright = mid - 1;\n \t}\n }\n lr[0] = -1;\n lr[1] = -1;\n return lr;\n }", "protected int binarySearch(int x) {\n if (arr.length == 0) {\n return -1;\n }\n\n int left = 0;\n int right = count - 1;\n\n while (left <= right) {\n int mid = (right + left) >>> 1;\n int val = arr[mid];\n\n if (val < x) {\n left = mid + 1;\n } else if (val > x) {\n right = mid - 1;\n }\n else {\n return mid;\n }\n }\n\n return -1;\n }", "public static int binarySearch(int[] array, int low, int high, int item){\n\t\n\t\tif(high < low)\n\t\t\treturn -1;\n\t\tint middle = (low + high) /2;\n\t\tif(item == array[middle])\n\t\t\treturn middle;\n\t\tif(item < array[middle])\n\t\t\treturn binarySearch(array,low,(middle-1),item);\n\t\telse\n\t\t\treturn binarySearch(array,(middle+1),high,item);\n\t}", "public int[] searchRange(int[] A, int target) {\n int start = 0;\n int end = A.length - 1;\n int mid = 0;\n int[] res = {-1, -1};\n \n while (start < end) {\n mid = start + (end - start) / 2;\n if (A[mid] == target) {\n int s = mid;\n while (s >= start && A[s] == target) {\n s --;\n }\n int e = mid;\n //Note: here \"<= end\" instead of \"<\"\n while (e <= end && A[e] == target) {\n e ++;\n }\n res[0] = s + 1;\n res[1] = e - 1;\n return res;\n } else if (A[mid] < target) {\n start = mid + 1;\n } else {\n end = mid - 1;\n }\n }\n if (A[start] == target) {\n res[0] = start;\n res[1] = end;\n } \n \n return res;\n }", "public static int interpolationSearch(int[] nums, int val){\n\n int lo = 0, mid = 0, hi = nums.length - 1;\n int range = nums[hi] - nums[lo];\n int normmailized = (hi - lo);\n while(nums[lo] <= val && nums[hi] >= val){\n mid = lo + ((val - nums[lo]) * normmailized)/ range; // normalization\n if(nums[mid] < val){\n lo = mid + 1;\n } else if(nums[mid] > val){\n hi = mid - 1;\n } else return mid;\n }\n if(nums[lo] == val) return lo;\n return -1;\n }", "public void binarySearchForValue(int value){\n int lowIndex = 0;\n int highIndex = arraySize -1;\n\n while(lowIndex <= highIndex){\n int middleIndex = (lowIndex + highIndex)/2;\n\n if(theArray[middleIndex] < value){\n lowIndex = middleIndex + 1;\n } else if(theArray[middleIndex] > value) {\n highIndex = middleIndex -1;\n } else {\n System.out.println(\"Found a match for \" + value + \" at Index \" + middleIndex);\n // Exit the while loop.\n lowIndex = highIndex + 1;\n }\n\n printHorizontalArray(middleIndex, -1);\n }\n }" ]
[ "0.7705542", "0.76915205", "0.7571395", "0.7557479", "0.75391966", "0.7501055", "0.7381341", "0.73810154", "0.7364626", "0.7332463", "0.73146373", "0.73065645", "0.727435", "0.7272741", "0.7233954", "0.7218116", "0.71926045", "0.7143793", "0.7114417", "0.7094822", "0.70936555", "0.7060066", "0.70505553", "0.70434946", "0.7039937", "0.7037469", "0.70243984", "0.70023036", "0.6996529", "0.6996504", "0.698824", "0.6987567", "0.69322234", "0.6904055", "0.6891542", "0.68670857", "0.6863085", "0.6860634", "0.68565905", "0.68530357", "0.6845859", "0.6819706", "0.68157446", "0.6808057", "0.68011695", "0.67849326", "0.6782783", "0.6759239", "0.67520446", "0.6726286", "0.67162997", "0.67139685", "0.6708271", "0.66796523", "0.6660817", "0.6647758", "0.663572", "0.66232145", "0.6613237", "0.6605236", "0.6602759", "0.6600691", "0.65960634", "0.6582163", "0.6581509", "0.65519154", "0.65416247", "0.6539179", "0.6539126", "0.65363723", "0.65361184", "0.6531469", "0.6523298", "0.65212214", "0.64976615", "0.64914966", "0.6489838", "0.6480973", "0.6477932", "0.64763516", "0.6472071", "0.6471213", "0.6457984", "0.64550745", "0.64338046", "0.6429518", "0.6427763", "0.6421925", "0.64176154", "0.6410183", "0.64023286", "0.6401562", "0.6395864", "0.63927907", "0.6387869", "0.6384348", "0.6380068", "0.6371931", "0.63662857", "0.63632685" ]
0.7293289
12
Binary Search. The bottom one is the best. Author: SnowZheng + kei Date : September 24, 2020
public int findMin2(int[] arr) { int left = 0; // We use arr[right] as binary search condition later. right = arr.length would // be out of bound. int right = arr.length - 1; int mid = 0; // while (left < right) causes a problem that the last element cannot be // reached when R=len-1 used. while (left <= right) { mid = left + (right - left) / 2; // There is one element. // Since R=M is used, this is needed to avoid infinite loop. if (left == right) { break; } if (arr[mid] > arr[right]) { // Search on the right. left = mid + 1; } else { // Search on the left. // R=M because that mid can be the minimum and // infinite loop that is caused by R=M and while (left <= right) is avoided // since there is a return when left == right. right = mid; } } // Return the last one. return arr[left]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testBinarySearch() {\n\t\tint[] arr0 = {0, 1, 2, 3, 4, 5};\n\t\tassertEquals(0, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 0));\n\t\tassertEquals(1, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 1));\n\t\tassertEquals(2, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 2));\n\t\tassertEquals(3, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 3));\n\t\t\n\t\tassertEquals(-1, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 99));\n\t\t\n\t\tint[] arr1 = {0, 43, 209, 388, 401, 599};\n\t\tassertEquals(2, _01_BinarySearch.binarySearch(arr1, 0, arr0.length - 1, 209));\n\t\tassertEquals(-1, _01_BinarySearch.binarySearch(arr1, 0, arr0.length - 1, 45));\n\t}", "@Test\n\tpublic void testBinarySearch() {\n\t\tint[] numbers = {0, 1, 2, 3, 4, 5, 6};\n\t\tint r1 = _01_BinarySearch.binarySearch(numbers, 0, numbers.length - 1, 4);\n\t\tassertEquals(4, r1);\n\t\t\n\t\tint[] numbers2 = {2, 4, 7, 9, 14};\n\t\tint r2 = _01_BinarySearch.binarySearch(numbers2, 0, numbers2.length - 1, 8);\n\t\tassertEquals(-1, r2);\n\t\t\n\t\tint[] numbers3 = {3, 5, 10, 16, 25};\n\t\tint r3 = _01_BinarySearch.binarySearch(numbers3, 0, numbers3.length - 1, 25);\n\t\tassertEquals(4, r3);\n\t\t\n\t}", "static int binarySearchHelp(int[] array, int searched) {\n\t\tint mid = array.length / 2;\r\n\t\tint first = 0;\r\n\t\tint last = array.length - 1;\r\n\r\n\t\twhile (array[mid] != searched && first <= last) {\r\n\t\t\tmid = (first + last) / 2;\r\n\t\t\tif (searched == array[mid]) {\r\n\t\t\t\treturn mid;\r\n\t\t\t}\r\n\t\t\tif (searched < array[mid]) {\r\n\t\t\t\tlast = mid - 1;\r\n\r\n\t\t\t}\r\n\t\t\tif (searched > array[mid]) {\r\n\t\t\t\tfirst = mid + 1;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}", "abstract int binSearch(int[] array, int num, int left, int right);", "public Integer binSearch(Integer target, Integer[] data, Integer left, Integer right) {\n if (right - left == 1) {\n if (data[left] == target) return left;\n if (data[right] == target) return right;\n }\n if (right - left == 0) {\n if (data[left] == target) return left;\n }\n Integer midpt = (right + left) / 2 ;\n if (target == data[midpt]) return midpt ;\n if (target > data[midpt] ) return binSearch(target, data, midpt, right) ;\n if (target < data[midpt] ) return binSearch(target, data, left, midpt) ;\n\n return -1;\n }", "private static int binary_Search(int[] arr, int target) {\n\n\t\tint low = 0;\n\t\tint high = arr.length - 1;\n\n\t\twhile (low <= high) {\n\n\t\t\tint mid = low + (high - low) / 2;\n\t\t\tSystem.out.println(\"low = \" + low + \" mid = \" + mid + \" high =\" + high);\n\t\t\tif (arr[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\tif (arr[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\n\t\t\t} else {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\n\t\t\t// System.out.println(\"low = \" + low + \" high =\" + high);\n\t\t}\n\t\treturn -1;\n\t}", "int binarySearch(int[] arr, int low, int high, int key){\n while(low <= high){\n int mid = (low + high) / 2;\n if (key < arr[mid])\n high = mid - 1;\n else if (key > arr[mid])\n low = mid + 1;\n else\n return mid;\n }\n return -1;\n }", "private int binarySearchQ7(int first, int last, K key)\n {\n int index;\n \n if (first > last)\n index = first; \n else \n {\n int mid = first + (last - first) / 2;\n K midKey = dictionary[mid].getKey(); \n if (key.equals(midKey))\n index = mid; \n else if (key.compareTo(midKey) < 0)\n index = binarySearchQ7(first, mid - 1, key);\n else\n index = binarySearchQ7(mid + 1, last, key);\n } \n return index;\n }", "public static void useBinarySearch1() {\n int[] numbers = {-3, 2, 8, 12, 17, 29, 44, 58, 79};\n int index = Arrays.binarySearch(numbers, 29);\n System.out.println(\"29 is found at index \" + index);\n }", "protected int binarySearch(int x) {\n if (arr.length == 0) {\n return -1;\n }\n\n int left = 0;\n int right = count - 1;\n\n while (left <= right) {\n int mid = (right + left) >>> 1;\n int val = arr[mid];\n\n if (val < x) {\n left = mid + 1;\n } else if (val > x) {\n right = mid - 1;\n }\n else {\n return mid;\n }\n }\n\n return -1;\n }", "private static int binarySearchMine(int[] data, int target, int low, int high) {\n while (low <= high) {\n int median = (low + high) / 2;\n int current = data[median];\n if (current == target) {\n return median;\n } else if (target < current) {\n return binarySearchMine(data, target, low, median - 1);\n } else {\n return binarySearchMine(data, target, median + 1, high);\n }\n }\n return -1;\n }", "private static int bSearch(int[] elements, int key) {\n int left = 0, right = elements.length - 1, mid = 0;\n while (left <= right) {\n mid = (left + right) / 2;\n\n if (key < elements[mid]) {\n right = mid - 1;\n } else if (key == elements[mid]) {\n return mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\n }", "private int binarySearch(int[] array, int left, int right, int target) {\n\t\tif (left > right) {\n\t\t\treturn -1;\n\t\t}\n\t\twhile (left <= right) {\n\t\t\tint mid = left + (right - left) / 2;\n\t\t\tif (array[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t} else if (array[mid] < target) {\n\t\t\t\tleft = mid + 1;\n\t\t\t} else {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "private static int binary_search(int[] array, int num, int low, int high) {\n\t\t\n\t\treturn -1;\n\t}", "public void binarySearchForValue(int value){\n int lowIndex = 0;\n int highIndex = arraySize -1;\n\n while(lowIndex <= highIndex){\n int middleIndex = (lowIndex + highIndex)/2;\n\n if(theArray[middleIndex] < value){\n lowIndex = middleIndex + 1;\n } else if(theArray[middleIndex] > value) {\n highIndex = middleIndex -1;\n } else {\n System.out.println(\"Found a match for \" + value + \" at Index \" + middleIndex);\n // Exit the while loop.\n lowIndex = highIndex + 1;\n }\n\n printHorizontalArray(middleIndex, -1);\n }\n }", "public void binarySearchForValue(int value) {\n int lowIndex = 0;\n int highIndex = arraySize - 1;\n\n while (lowIndex <= highIndex) {\n int middleIndex = (highIndex + lowIndex) / 2;\n\n if (theArray[middleIndex] < value) {\n lowIndex = middleIndex + 1;\n } else if (theArray[middleIndex] > value) {\n highIndex = middleIndex - 1;\n } else {\n System.out.println(\"\\nFound a match for \" + value + \" at index \" + middleIndex);\n lowIndex = highIndex + 1;\n }\n\n printHorizontalArray(middleIndex, -1);\n }\n }", "public static int binSearch(int[] a, int first, int last, int key)\n\t{\t\n\t\tif(first <= last)\n\t\t{\n\t\t\tint mid = (first + last) / 2; //Divides the beginning of the array and the length of the array into 2\n\t\t\t\n\t\t\tif (a[mid] == key)\n\t\t\t{\n\t\t\t\treturn mid; \n\t\t\t}\n\t\t\t\n\t\t\telse if (a[mid] > key) //IF THE INDEX(WHICH IS THE MID) OF ARRAY A IS GREATER THAN THE KEY\n\t\t\t{\n\t\t\t\treturn last = mid - 1; //RETURNS THE LENGTH OF THE ARRAY WHICH IS THE DECREMENTED MID\n\t\t\t}\n\t\t\t\n\t\t\telse //IF THE INDEX(WHICH IS THE MID) OF ARRAY A IS LESS THAN THE KEY\n\t\t\t{\n\t\t\t\treturn first = mid + 1; //RETURNS THE FIRST = INCREMENTED MID\t\t\n\t\t\t}\n\t\t}\n\t\treturn -1;\t\n\t}", "private int binarySearch(int[] nums, int target, int low, int high) {\n while (low <= high) {\n int mid = low + (high - low) / 2; // find mid\n\n if (nums[mid] == target) { // if number found\n if (mid == low || nums[mid] > nums[mid - 1]) // check if it is the first occurence\n return mid; // if it is return mid\n else\n high = mid - 1; // decrease high to reach the index\n } else if (nums[mid] > target) // if the value in num is greater\n high = mid - 1; // decrease high\n else\n low = mid + 1; // else increase low\n\n }\n\n return -1; // number not found\n }", "private int binaryFind(K key) {\n int sortedCount = this.sortedCount.get();\n // if there are no sorted keys, or the first item is already larger than key -\n // return the head node for a regular linear search\n if ((sortedCount == 0) || comparator.compareKeyAndSerializedKey(key, readKey(FIRST_ITEM)) <= 0) {\n return HEAD_NODE;\n }\n\n // optimization: compare with last key to avoid binary search\n if (comparator.compareKeyAndSerializedKey(key, readKey((sortedCount - 1) * FIELDS + FIRST_ITEM)) > 0) {\n return (sortedCount - 1) * FIELDS + FIRST_ITEM;\n }\n\n int start = 0;\n int end = sortedCount;\n\n while (end - start > 1) {\n int curr = start + (end - start) / 2;\n\n if (comparator.compareKeyAndSerializedKey(key, readKey(curr * FIELDS + FIRST_ITEM)) <= 0) {\n end = curr;\n } else {\n start = curr;\n }\n }\n\n return start * FIELDS + FIRST_ITEM;\n }", "public static int binSearchRotatedIter(int src[], int lo, int hi, int target){\n\n while(lo<=hi){\n int mid = lo + (hi-lo)/2;\n if(src[mid]==target) return mid;\n //if bottom half is sorted\n if(src[lo]<=src[mid]){\n \n if(src[lo]<=target && target<src[mid]){\n hi=mid-1;\n }else{\n lo=mid+1;\n }\n }\n //if upper half is sorted\n else{\n if(src[mid]<target && target<=src[hi]){\n lo=mid+1;\n }else{\n hi=mid-1;\n }\n }\n }\n return -1;\n}", "private int binarySearch(T element) {\n int start = 0, end = sortedArray.size(), mid = 0;\n while (start < end) {\n mid = (end + start) / 2;\n int cmp = sortedArray.get(mid).compareTo(element);\n if (cmp == 0) {\n start = end = mid;\n }\n else if (cmp < 0) {\n start = mid + 1;\n }\n else {\n end = mid;\n }\n }\n return start;\n }", "public static void main(String args[])\n {\n BinarySerach ob = new BinarySerach();\n int arr[] = { 2, 5, 3, 1, 7, 4 };\n\n\n // Arrays.binarySearch(arr,5);\nArrays.sort(arr);\n System.out.println(Arrays.binarySearch(arr,5));\n Arrays.sort(arr);\n int n = arr.length;\n int x = 5;\n int result = ob.binarySearch(arr, x);\n if (result == -1)\n System.out.println(\"Element not present\");\n else\n System.out.println(\"Element found at \"\n + \"index \" + result);\n }", "static int binSearch(int []arr,int key) {\n\t\tint start=0;\n\t\tint end=arr.length-1;\n\t\tdo {\n\t\t\tint pc=(start+end)/2;\n\t\t\tif(arr[pc]==key) {\n\t\t\t\treturn pc;\n\t\t\t}else if(arr[pc]<key) {\n\t\t\t\tstart=pc+1;\n\t\t\t}else\n\t\t\t\tend=pc-1;\n\t\t}while(start<=end);\n\t\t\n\t\treturn -1;\n\t}", "public int binarySearch(int[] nums, int target, int left, int right) {\n int res = left - 1;\n while (left <= right) {\n int mid = left + (right - left) / 2;\n if (nums[mid] <= target) {\n right = mid - 1;\n } else {\n res = mid;\n left = mid + 1;\n }\n }\n return res;\n }", "private static int binarySearch(int[] arr, int low, int high, int target) {\n\n\t\tif (low <= high) {\n\n\t\t\tint mid = low + (high - low) / 2;\n\n\t\t\tif (arr[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t}\n\n\t\t\tif (arr[mid] < target) {\n\t\t\t\treturn binarySearch(arr, mid + 1, high, target);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(arr, low, mid - 1, target);\n\t\t\t}\n\n\t\t}\n\n\t\treturn -1;\n\t}", "private int binarySearchLeft(int[] nums, int target) {\n \tint low=0;\n int high=nums.length-1;\n\n while(low<=high){\n int mid=low+(high-low)/2;\n if (nums[mid]==target){\n if(mid==0||nums[mid-1]<nums[mid]){\n return mid;\n }\n else{\n high=mid-1;\n }\n }\n else if(nums[mid]>target){\n high=mid-1;\n }\n else{\n low=mid+1;\n }\n \n }\n\t\treturn -1;\n\t}", "public int binarySearch(int[] nums, int target) {\n // write your code here\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] == target) {\n end = mid;\n }\n else if (nums[mid] < target) {\n start = mid;\n }\n else {\n end = mid;\n }\n }\n if (nums[start] == target) return start;\n if (nums[end] == target) return end;\n return -1;\n }", "static int binarySearch(@NotNull int[] search, int find) {\n int start, end, midPt;\n start = 0;\n end = search.length - 1;\n\n while (start <= end) {\n midPt = (start + end) / 2;\n if (search[midPt] == find) {\n return midPt;\n } else if (search[midPt] < find) {\n start = midPt + 1;\n } else {\n end = midPt - 1;\n }\n }\n\n return -1;\n }", "int binarySearchWithRecursion(int[] arr, int low, int high, int key){\n if (high < low)\n return -1;\n int mid = (low + high) / 2;\n if (key == arr[mid])\n return mid;\n if (key > arr[mid])\n return binarySearchWithRecursion(arr,(mid + 1), high, key);\n return binarySearchWithRecursion(arr, low, (mid - 1), key);\n }", "@Test\n public void testBinarySearch() {\n System.out.println(\"binarySearch\");\n int[] index = {10, 11, 12, 13, 14};\n int key = 12;\n int begin = 0;\n int end = 5;\n int expResult = 2;\n int result = Utils.binarySearch(index, key, begin, end);\n assertEquals(expResult, result);\n }", "static Integer BinarySearchRec(Integer[] tablica, int value, int low, int high) {\n if (high < low) {\n return -1;\n }\n\n int mid = (low + high) / 2;\n\n if (tablica[mid] > value) {\n return BinarySearchRec(tablica, value, low, mid - 1);\n } else if (tablica[mid] < value) {\n return BinarySearchRec(tablica, value, mid + 1, high);\n } else {\n return mid;\n }\n }", "public int binarySearchAlgo(int a[], int x) {\n\t\tint low = 0;\n\t\tint high = a.length - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (a[mid] == x) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\tif (x > a[mid]) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else /* if(a[mid] < x) */ {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int binarySearch(int x) {\n\n int l = 0, h = length - 1, mid;\n while (l <= h) {\n mid = l + (h-l)/2;\n if (arr[mid] == x) return mid;\n else if (x < arr[mid]) h = mid - 1;\n else if (x > arr[mid]) l = mid + 1;\n }\n return -1;\n }", "public static int binarySearch(int[] list, int key) {\n int low = 0;\n int high = list.length - 1;\n \n while (high >= low) {\n int mid = (low + high) / 2;\n if (key < list[mid])\n high = mid - 1;\n else if (key == list[mid])\n return mid;\n else\n low = mid + 1;\n }\n return -1 - 1; // now high < low, key not found\n }", "public int binarySearch(Long[] keys,Long target){\n\t\tif(keys ==null || keys.length ==0){\n\t\t\treturn -1;\n\t\t}\n\t\tint l = 0;\n\t\tint r = keys.length-1;\n\t\twhile(l<r){\n\t\t\tint mid = l + (r-l)/2;\n\t\t\tif(keys[mid] == target)\n\t\t\t\treturn mid;\n\t\t\tif(keys[mid]<target)\n\t\t\t\tl = mid+1;\n\t\t\telse\n\t\t\t\tr = mid-1;\n\t\t}\n\t\treturn l;\n\t\t\n\t}", "public int binarySearchIterative(int[] array,int target) {\n var left = 0;\n var right = array.length -1;\n while (left <= right) {\n int middle = (left + right) / 2;\n if (array[middle] == target)\n return middle;\n if (array[middle] < target)\n left = middle + 1;\n else\n right = middle - 1;\n }\n return -1;\n }", "public int binarySearchLoop(int key) {\n int first = 0;\n int last = length - 1;\n int mid = length / 2;\n //only on sorted array\n //first , mid = half(floor), last;\n //is mid the key\n //is mid < or > from the key\n //if key is bigger, then we go right, the new first is mid+1, new mid is (mid+last)/2, and last is the same until the end of the GOING searching right\n //if key is smaller then we go left, the new last is mid-1, new mid is (first + mid)/2, and first is the same until the end of GOING searching left\n\n while (first <= last) {\n if (key == arr[mid]) return mid;\n\n else if (key < arr[mid]) {\n last = mid - 1;\n mid = (first + mid) / 2;\n } else {\n first = mid + 1;\n mid = (first + last) / 2;\n }\n }\n return -1;\n }", "public void binSearch(int current, int first, int last) {\r\n long average2 = 0, timeB = 0, stanDev = 0;\r\n System.out.println(\"\\nBINARY SEARCH\\n\");\r\n for (int i = 0; i < 10; i++) {\r\n long start = System.nanoTime();\r\n while (last >= first) {\r\n int mid = (last + first) / 2;//FINDS THE MID WAY POINT IN ORDER TO KEEP HALF-ING THE SEARCH RESULTS.\r\n if (A[mid] == current) {\r\n long stop = System.nanoTime();\r\n long timelength = (stop - start);\r\n timeB += timelength; // USED FOR GETTING AVERAGE. \r\n bin[k][i] = timelength;//USED FOR STORING THE TIME IT TOOK FOR EACH TEST, IT IS USED LATER ON TO DISPLAY IN THE CHART.\r\n binary[i] = timelength;//USED FOR FINDING STANDARD DEVIATION.\r\n System.out.println(\"The number: \" + current + \" was found in the array index: \" + A[mid]\r\n + \"\\nIt took: \" + timelength + \" nanoseconds.\");\r\n break;\r\n\r\n } else if (A[mid] < current) {\r\n first = mid + 1;\r\n } else {\r\n last = mid - 1;\r\n }\r\n }\r\n }\r\n average2 = (timeB / 10);\r\n linAvAndDev[h][0] = average2;\r\n for (int j = 0; j < 10; j++) {\r\n stanDev += Math.pow((binary[j] - average2), 2.0);\r\n }\r\n stanDev /= 10;\r\n stanDev = (long) Math.sqrt(stanDev);\r\n linAvAndDev[h][1] = stanDev;\r\n System.out.println(\"The Avearge time for the Binary Search was: \" + average2 + \" nanoseconds.\"\r\n + \"\\nThe Standard Deviation time for the Binary Search was: \" + stanDev + \" nanoseconds.\");\r\n h += 1;\r\n k += 1;\r\n }", "public int binarySearch(ArrayList<Integer> a, int val){\n int low = 0;\n int high = a.size() - 1;\n \n while(high - low > 3){\n int mid = (low + high)/2;\n if(a.get(mid) > val){\n high = mid - 1;\n }\n else{\n low = mid; \n }\n }\n int i;\n for(i=low; i<=high; ++i){\n if(a.get(i) > val)\n return i;\n }\n return i;\n }", "static int binarySearch(int[] array, int start, int end, int value) {\r\n\t\tif(end>=start) {\r\n\t\t\tint mid = (start+end)/2;\r\n\t\t\tif(array[mid]==value)\r\n\t\t\t\treturn mid;\r\n if(array[mid]>value)\r\n \treturn binarySearch(array, start, mid-1, value);\r\n return binarySearch(array, mid+1, end, value);\r\n\t\t}\r\n return -1;\r\n\t}", "public static int binaryFind(int []A, int s, int e, int key) {\n\tif(s>e) return -1;\n\tint mid = (s+e)/2;\n\tif(A[mid] == key) return mid;\n if(A[mid] < key) return binaryFind(A, mid+1, e, key);\n else return binaryFind(A, s, mid-1, key); //(A[mid] > key)\n }", "static int binarySearch(int[] paramArrayOfint, int paramInt1, int paramInt2) {\n }", "private int binarySearchByIndex(List<Span> spans, int index){\n int left = 0,right = spans.size() - 1,mid,row;\n int max = right;\n while(left <= right){\n mid = (left + right) / 2;\n if(mid < 0) return 0;\n if(mid > max) return max;\n row = spans.get(mid).startIndex;\n if(row == index) {\n return mid;\n }else if(row < index){\n left = mid + 1;\n }else{\n right = mid - 1;\n }\n }\n int result = Math.max(0,Math.min(left,max));\n while(result > 0) {\n if(spans.get(result).startIndex > index) {\n result--;\n }else{\n break;\n }\n }\n while(result < right) {\n if(getSpanEnd(result,spans) < index) {\n result++;\n }else{\n break;\n }\n }\n return result;\n }", "private static int binarySearchRecursively(int[] sortedArray, int input, int first, int last) {\n int mid = (first + last) / 2;\n\n if (last < first) {\n return -1;\n }\n if (input == sortedArray[mid]) {\n return mid;\n } else if (input < sortedArray[mid]) {\n return binarySearchRecursively(sortedArray, input, last, mid - 1);\n } else {\n return binarySearchRecursively(sortedArray, input, mid + 1, last);\n }\n }", "public int binarySearchAlgo(int a[], int low, int high, int x) {\n\t\tint mid = (low + high) / 2;\n\t\t// If mid is x simply return the value\n\t\tif (a[mid] == x) {\n\t\t\treturn mid;\n\t\t}\n\t\t// If we didn't find any element simply return -1\n\t\tif (low == high) {\n\t\t\treturn -1;\n\t\t}\n\t\t// If mid element value is less then x go search higher(right) indices\n\t\tif (a[mid] < x) {\n\t\t\treturn binarySearchAlgo(a, mid + 1, high, x);\n\t\t}\n\t\t// If mid element value is less then x go search lower(left) indices\n\t\telse /* if (a[mid] > x) */ {\n\t\t\treturn binarySearchAlgo(a, low, mid - 1, x);\n\t\t}\n\n\t}", "public int binarySearch(int[] numbers, int numToSearch){\n\n QuickSort quickSort = new QuickSort();\n quickSort.sort(numbers);\n\n //Above code is tightly coupled with either of the algo to be used, we can not manage using sort algo dynamically.\n\n\n // Login to search\n\n //Return the number found\n\n return 5; //returning any hypothetical number\n }", "private static boolean binarySearch(int[] data, int target, int low, int high) {\n if (low > high) {\n return false;\n } else {\n int mid = (low + high) / 2;\n if (target == data[mid]) {\n return true;\n } else if (target < data[mid]) {\n return binarySearch(data, target, low, mid - 1);\n } else {\n return binarySearch(data, target, mid + 1, high);\n }\n }\n }", "private int recFind(int searchKey, int lowerbound, int upperbound) {\n\t\tint curIn = (lowerbound + upperbound) / 2;\n\t\tif (arr[curIn] == searchKey)\n\t\t\treturn curIn;\n\t\telse if (lowerbound > upperbound)\n\t\t\treturn n;\n\t\telse {\n\t\t\tif (arr[curIn] < searchKey)\n\t\t\t\treturn recFind(searchKey, curIn + 1, upperbound);\n\t\t\telse\n\t\t\t\treturn recFind(searchKey, lowerbound, curIn - 1);\n\t\t}\n\t}", "private int binarySearchRecursive(int[] array,int target,int left,int right) {\n if (left > right)\n return -1;\n\n int middle = (left + right) / 2;\n\n if (array[middle] == target)\n return middle;\n\n if (array[middle] < target)\n return binarySearchRecursive(array,target,middle+1,right);\n\n return binarySearchRecursive(array, target,left,middle-1);\n }", "static int binarySearch(int arr[], int l, int r, int x) {\n if (r >= l) { \r\n int mid = l + (r - l) / 2; \r\n if (arr[mid] == x) \r\n return mid; \r\n \r\n if (arr[mid] > x) \r\n return binarySearch(arr, l, mid - 1, x); \r\n \r\n \r\n return binarySearch(arr, mid + 1, r, x); \r\n } \r\n \r\n \r\n return -1; \r\n }", "public static int binSearch(int[] a, int x) {\r\n int l = 0;\r\n int r = a.length;\r\n while (l != r) {\r\n // inv: l <= res <= r\r\n int m = (l + r) / 2;\r\n if (a[m] >= x) {\r\n r = m;\r\n }\r\n else {\r\n l = m + 1;\r\n }\r\n }\r\n return r;\r\n }", "static int binarySearch(int arr[], int start, int end, int target ){\n if(start>end){\n return -1;\n }\n int mid = start+(end-start)/2;\n \n if(arr[mid] == target && (mid==0 || arr[mid-1]!=target)){\n return mid;\n }\n if(arr[mid] == target){\n return mid;\n }\n if(arr[mid]>=target && arr[mid]>arr[start]){\n return binarySearch(arr,start,mid-1,target);\n }\n // else if(arr[mid]<arr[start] && arr[mid]<target){\n // return binarySearch(arr,mid+1,end,target);\n // }\n return binarySearch(arr,mid+1,end,target);\n }", "public int binarySearchRotated(int [] nums) {\n\t\tint n = nums.length;\n\t\tint low = 0;\n\t\tint high = n -1;\n\t\twhile(low <= high) {\n\t\t\tif(nums[low] <= nums[high]) return low;\n\t\t\tint mid = (low + high) >> 1;\n\t\t\tint next = (mid + 1) % n;\n\t\t\tint prev = (mid - 1) % n;\n\t\t\tif(nums[mid] <= nums[next] && nums[mid] <= nums[prev]) return mid;\n\t\t\telse if(nums[mid] <= nums[high]) high = mid-1;\n\t\t\telse if(nums[mid] >= nums[low]) low = mid+1;\n\t\t}\n\t\t\n\t\treturn -1;\n\t\t\n\t}", "private int binarySearch(List<Span> spans, int line) {\n int left = 0,right = spans.size() - 1,mid,row;\n int max = right;\n while(left <= right){\n mid = (left + right) / 2;\n if(mid < 0) return 0;\n if(mid > max) return max;\n row = spans.get(mid).getLine();\n if(row == line) {\n return mid;\n }else if(row < line){\n left = mid + 1;\n }else{\n right = mid - 1;\n }\n }\n return Math.max(0,Math.min(left,max));\n }", "public static int binarySearch2(int[] numbers, int target) {\n int min = 0;\n int max = numbers.length - 1;\n \n int mid = -1;\n while (min <= max) {\n mid = (max + min) / 2;\n if (numbers[mid] == target) {\n return mid; // found it!\n } else if (numbers[mid] < target) {\n min = mid + 1; // too small\n } else { // numbers[mid] > target\n max = mid - 1; // too large\n }\n mid = (max + min) / 2;\n }\n \n return -min - 1; // not found\n }", "int binarySearch(int arr[], int x)\n {\n int l = 0, r = arr.length - 1;\n while (l <= r) {\n int m = l + (r - l) / 2;\n\n // Check if x is present at mid\n if (arr[m] == x)\n return m;\n\n // If x greater, ignore left half\n if (arr[m] < x)\n l = m + 1;\n\n // If x is smaller, ignore right half\n else\n r = m - 1;\n }\n\n // if we reach here, then element was\n // not present\n return -1;\n }", "public static int binarySearch(java.util.List arg0, java.lang.Object arg1)\n { return 0; }", "public static int binarySearch(int[] num, int target) {\n\t\tint left = 0;\n\t\tint right = num.length - 1;\n\t\twhile (left <= right) {\n\t\t\tint middle = (left+right)/2;\n\t\t\tif (num[middle] == target) {\n\t\t\t\treturn middle;\n\t\t\t} else if (num[middle] < target) {\n\t\t\t\tleft = middle + 1;\n\t\t\t} else {\n\t\t\t\tright = middle - 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "public static Boolean binarySearch(int[] arr, int n){\r\n if(arr.length == 0) return false;\r\n if(arr.length == 1 && arr[0] != n) return false; \r\n if(arr.length == 1 && arr[0] == n) return true; \r\n int start = 0;\r\n int mid = arr.length/2;\r\n int end = arr.length;\r\n int pos = mid;\r\n while(arr[pos] != n){\r\n if(n > arr[pos]){\r\n start = mid;\r\n mid = (end-start)/2+start;\r\n } else if(n < arr[pos]){\r\n end = mid;\r\n mid = (end-start)/2+start;\r\n System.out.println(\"here \" + start+ \" \" + mid + \" \" + end + \" pos= \" + pos);\r\n }\r\n pos = mid;\r\n if(arr[pos] == n) return true;\r\n if(start+1 == end){\r\n System.out.println(start+ \" \" + mid + \" \" + end + \" pos= \" + pos);\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "public int binarySearch(String searchKey) {\r\n\t\tint low = 0;\r\n\t\tint high = size -1;\r\n\t\tint middle;\r\n\t\t\r\n\t\twhile (low <= high) {\r\n\t\t\tmiddle = (high + low)/2;\r\n\t\t\tif (searchKey.equalsIgnoreCase(list[middle].getStudentName())) {\r\n\t\t\t\treturn middle; // Element was found\r\n\t\t\t}\r\n\t\t\telse if (searchKey.compareToIgnoreCase(list[middle].getStudentName())<0) {\r\n\t\t\t\thigh = middle -1;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tlow = middle +1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1; // Element was not found\r\n\t}", "public static int BinarySearch(int[] arr,int data){\n int si = 0, ei = arr.length - 1;\n while(si <= ei){\n int mid = (si + ei) / 2;\n if(arr[mid] == data)\n return mid;\n else if(data < arr[mid]){\n ei = mid - 1;\n }else si = mid + 1;\n }\n\n return -1;\n }", "public static int binarySearchRec(int[] arr, int from, int to, int key) {\n\t\t\n\t\tif (from<=to) {\n\t\t\tint mid=from+(to-from)/2;\n\t\t\tif (arr[mid]<key) \t\treturn binarySearchRec(arr, ++mid, to, key);//upper\t\n\t\t\telse if (arr[mid]>key) \treturn binarySearchRec(arr, from, --mid, key); //lower\n\t\t\telse \t\t\t\t\treturn mid;//found\n\t\t}\n\t\telse {//not found\n\t\t\tint shouldBeIndex=from;\n\t\t\treturn -shouldBeIndex-1;\n\t\t}\n\t}", "private void BinarySearch(Node node, int index) {\n Node left, right;\n left = node.left;\n right = node.right;\n\n int leftIndex = (2 * index) + 1;\n int rightIndex = (2 * index) + 2;\n if (left != null) {\n ArrayTree[leftIndex] = left.key;\n BinarySearch(left, leftIndex);\n lastIndex = Math.max(leftIndex, lastIndex);\n } else {\n if (leftIndex < ArrayTree.length - 1) {\n ArrayTree[leftIndex] = 0;\n }\n }\n\n if (right != null) {\n ArrayTree[rightIndex] = right.key;\n BinarySearch(right, rightIndex);\n lastIndex = Math.max(rightIndex, lastIndex);\n } else {\n if (rightIndex < ArrayTree.length - 1) {\n ArrayTree[rightIndex] = 0;\n }\n }\n }", "public static int binarySearch(java.util.List arg0, java.lang.Object arg1, java.util.Comparator arg2)\n { return 0; }", "public static double binSearchT(int s, Integer[] a){\n Random rand = new Random();\n int searchVar;\n Stopwatch timer = new Stopwatch();\n Arrays.sort(a);\n for (int i = 0; i < s; i++){\n searchVar = (int)(rand.nextDouble()*a.length);\n Arrays.binarySearch(a, searchVar);\n }\n return timer.elapsedTime(); // the method returns the elapsed time\n }", "public static int binarySearch(int[] arr, int target){\n\t\tint start = 0;\n\t\tint end = arr.length - 1;\n\n\t\twhile (start <= end){\n\t\t\tint mid = (end + start) / 2;\n\t\t\tif(arr[mid] == target){\n\t\t\t\treturn mid;\n\t\t\t} else if(target < arr[mid]){\n\t\t\t\tend = mid - 1;\n\t\t\t} else if(target > arr[mid]){\n\t\t\t\tstart = mid + 1;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}", "@Test\n public void testBinarySearch() {\n int actualResult = binarySearch.BinarySearch(new int[]{2,4,5}, 5);\n // check if the value is correct\n assertEquals(5, actualResult);\n }", "private static boolean checkHalfway(int[] arr, int searchValue, int begin, int end) {\r\n\t\treturn searchValue < arr[(begin+end+1)/2];\r\n\t}", "private int binarySearch(int[] r6, int r7, boolean r8) {\n /*\n r5 = this;\n int r0 = r6.length\n int r0 = r0 + -1\n r1 = 0\n r2 = r0\n r0 = 0\n L_0x0006:\n if (r0 > r2) goto L_0x001d\n int r3 = r0 + r2\n int r3 = r3 / 2\n r4 = r6[r3]\n if (r7 != r4) goto L_0x0011\n return r3\n L_0x0011:\n r4 = r6[r3]\n if (r7 >= r4) goto L_0x0019\n int r3 = r3 + -1\n r2 = r3\n goto L_0x0006\n L_0x0019:\n int r3 = r3 + 1\n r0 = r3\n goto L_0x0006\n L_0x001d:\n if (r2 >= 0) goto L_0x0020\n return r1\n L_0x0020:\n if (r8 == 0) goto L_0x002a\n int r7 = r2 + 1\n int r6 = r6.length\n int r6 = r6 + -1\n if (r7 > r6) goto L_0x002a\n goto L_0x002b\n L_0x002a:\n r7 = r2\n L_0x002b:\n return r7\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.taobao.tao.util.TaobaoImageUrlStrategy.binarySearch(int[], int, boolean):int\");\n }", "static int binarySearch(long[] paramArrayOflong, int paramInt, long paramLong) {\n }", "private int findEntry(long msb, long lsb) {\n\n int lowIndex = 0;\n int highIndex = index.remaining() / 24 - 1;\n float lowValue = Long.MIN_VALUE;\n float highValue = Long.MAX_VALUE;\n float targetValue = msb;\n\n while (lowIndex <= highIndex) {\n int guessIndex = lowIndex + Math.round(\n (highIndex - lowIndex)\n * (targetValue - lowValue)\n / (highValue - lowValue));\n int position = index.position() + guessIndex * 24;\n long m = index.getLong(position);\n if (msb < m) {\n highIndex = guessIndex - 1;\n highValue = m;\n } else if (msb > m) {\n lowIndex = guessIndex + 1;\n lowValue = m;\n } else {\n // getting close...\n long l = index.getLong(position + 8);\n if (lsb < l) {\n highIndex = guessIndex - 1;\n highValue = m;\n } else if (lsb > l) {\n lowIndex = guessIndex + 1;\n lowValue = m;\n } else {\n // found it!\n return position;\n }\n }\n }\n\n // not found\n return -1;\n }", "@Test\r\n\tpublic void test08_binarySearch() {\r\n\t\tRecursiveMethods rm = new RecursiveMethods();\r\n\r\n\t\tint[] a7 = {};\r\n\t\tassertFalse(rm.binarySearch(a7, 5)); // Search 5 in a7 -> {} False\r\n\r\n\t\tint[] a8 = { 1, 2, 3, 4, 5 };\r\n\t\tassertTrue(rm.binarySearch(a8, 3)); // Search 3 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t// True\r\n\t\tassertTrue(rm.binarySearch(a8, 1)); // Search 1 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t// True\r\n\t\tassertTrue(rm.binarySearch(a8, 5)); // Search 5 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t// True\r\n\t\tassertFalse(rm.binarySearch(a8, 0)); // Search 0 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t\t// False\r\n\t\tassertFalse(rm.binarySearch(a8, 6)); // Search 6 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t\t// False\r\n\t}", "public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n System.out.println(\"Enter number of elements\");\n int i = sc.nextInt();\n int[] array = new int[i];\n\n\n System.out.println(\"Enter \" + i + \" integers\");\n\n for (int c = 0; c < i; c++) {\n array[c] = sc.nextInt();\n }\n\n System.out.println(\"Enter value to find\");\n int search = sc.nextInt();\n\n MyBinarySearch mbs = new MyBinarySearch();\n Arrays.sort(array);\n System.out.println(search + \" was found at index \" + mbs.binarySearch(array, search) + \" in array \" + Arrays.toString(array));\n\n\n// MyBinarySearch mbs = new MyBinarySearch();\n// int[] arr = {2, 4, 6, 8, 10, 12, 14, 16};\n// System.out.println(\"Key 14's position: \"+mbs.binarySearch(arr, 14));\n// int[] arr1 = {6,34,78,123,432,900};\n// System.out.println(\"Key 432's position: \"+mbs.binarySearch(arr1, 432));\n }", "private static int binarySearch0_BranchFreeUnrolledStatic16(int[] a, int key) {\n\t\tint low = 8;\n\t\tint midVal;\n\t\tint highMask;\n\n\t\tmidVal = a[low];\n\t\tlow += 4;\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 8 & highMask;\n\n\t\tmidVal = a[low];\n\t\tlow += 2;\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 4 & highMask;\n\n\t\tmidVal = a[low];\n\t\tlow += 1;\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 2 & highMask;\n\n\t\tmidVal = a[low];\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 1 & highMask;\n\n\t\treturn a[low] == key ? low : -(low + 1);\n\n\t}", "static int BinarySearch(int[] arr, int target, int start, int end) {\n boolean isAsc = arr[start] < arr[end];\n\n while(start <= end) {\n // find the middle element\n// int mid = (start + end) / 2; // might be possible that (start + end) exceeds the range of int in java\n int mid = start + (end - start) / 2;\n\n if (arr[mid] == target) {\n return mid;\n }\n\n if (isAsc) {\n if (target < arr[mid]) {\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n } else {\n if (target > arr[mid]) {\n end = mid - 1;\n } else {\n start = mid + 1;\n }\n }\n }\n return -1;\n }", "static void binarySearch(int mat[][], int i, int j_low, int j_high, int x){\n\t\t\n\t\twhile(j_low < j_high){\n\t\t\t\n\t\t}\n\t}", "public static void main(String[] args) {\n\n\t\tint[] arr = {1, 2, 5, 5, 5, 10, 20};\n\t\t\n\t\tint search = 5;\n\t\t\n\t\tint index = Arrays.binarySearch(arr, search);\n\t\t//System.out.println(index);\n\t\t\n\t\tif(index < 0) {\n\t\t\tint lowerBound = Math.abs(index) - 2;\n\t\t\tint upperBound = Math.abs(index) - 1;\n\t\t\t\n\t\t\tSystem.out.println(lowerBound + \" \" + upperBound);\n\t\t}\n\t\t\n\t}", "public static int binarySearch(int[] A, int x) {\n int low = 0;\n int high = A.length - 1;\n int mid = -1;\n while (low <= high) {\n mid = low + (high-low)/2;\n if (x >= A[mid]) {\n high = mid - 1;\n } else {\n low = mid + 1;\n }\n }\n if (mid >= 0 && x == A[mid]) {\n return mid;\n }\n return -1;\n }", "private static int binarySearch0(float[] a, int fromIndex, int toIndex,\n\t\t\tfloat key) {\n\t\tint low = fromIndex;\n\t\tint high = toIndex - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) >>> 1;\n\t\tfloat midVal = a[mid];\n\n\t\tint cmp;\n\t\tif (midVal < key) {\n\t\t\tcmp = -1; // Neither val is NaN, thisVal is smaller\n\t\t} else if (midVal > key) {\n\t\t\tcmp = 1; // Neither val is NaN, thisVal is larger\n\t\t} else {\n\t\t\tint midBits = Float.floatToIntBits(midVal);\n\t\t\tint keyBits = Float.floatToIntBits(key);\n\t\t\tcmp = (midBits == keyBits ? 0 : // Values are equal\n\t\t\t\t(midBits < keyBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)\n\t\t\t\t\t1)); // (0.0, -0.0) or (NaN, !NaN)\n\t\t}\n\n\t\tif (cmp < 0)\n\t\t\tlow = mid + 1;\n\t\telse if (cmp > 0)\n\t\t\thigh = mid - 1;\n\t\telse\n\t\t\treturn mid; // key found\n\t\t}\n\t\treturn -(low + 1); // key not found.\n\t}", "public static int binSearch(int[] a, int x, int l, int r) {\r\n if (l == r) {\r\n return r;\r\n }\r\n int m = (l + r) / 2;\r\n if (a[m] >= x) {\r\n return binSearch(a, x, l, m);\r\n }\r\n else {\r\n return binSearch(a, x, m + 1, r);\r\n }\r\n }", "private static int search(int[] arr, int findMe, int left, int right) {\n\t\tif (left > right) {\n\t\t\treturn FAILURE;\n\t\t}\n\t\tint mid = (left + right) / 2;\n\t\tif (findMe == arr[mid]) {\n\t\t\treturn mid;\n\t\t}\n\t\telse if (findMe < arr[mid]) {\n\t\t\treturn search(arr, findMe, left, mid - 1);\n\t\t}\n\t\telse {\n\t\t\treturn search(arr, findMe, mid + 1, right);\n\t\t}\n\t}", "public static int binary_search(int[] array, int n, int value)\n {\n int low = 0;\n while (low <= n) {\n int middle = (low + n) / 2;\n if (value == array[middle]) {\n return middle;\n }\n else if (value < array[middle]) {\n n = middle - 1;\n }\n else {\n low = middle + 1;\n }\n }\n return -1;\n \n }", "private int searchR(Searching[] array, int start, int half, int end, int value) {\n if (value > array[end].getValue() || value < array[start].getValue()) {\n return -1;\n }\n int a = end - start;\n int b = array[end].getValue() - array[start].getValue();\n int c = value - array[start].getValue();\n int d = (c * a) / b;\n int slide = d + start;\n if (slide > end || slide < start) {\n return -1;\n }\n if (array[slide].getValue() == value) {\n return slide;\n }\n if (value < array[slide].getValue()) {\n end = slide;\n return searchR(array, start, half, end, value);\n } else {\n start = slide;\n return searchR(array, start, half, end, value);\n }\n }", "public static int binarySearchIter(int[] arr, int from, int to, int key) {\n\t\t\n\t\tint shouldBeIndex;\n\t\twhile (from<=to){\n\t\t\tint mid=from+(to-from)/2;\n\t\t\tif (arr[mid]<key) from=mid+1;//upper\n\t\t\telse if (arr[mid]>key) to=mid-1;//lower\n\t\t\telse return mid;//found\n\t\t}\n\t\t//not found\n\t\tshouldBeIndex=from;\n\t\treturn -shouldBeIndex-1;\n\t}", "public static int binarySearch(int[] numbers, int target) {\n int min = 0;\n int max = numbers.length - 1;\n \n while (min <= max) {\n int mid = (max + min) / 2;\n if (numbers[mid] == target) {\n return mid; // found it!\n } else if (numbers[mid] < target) {\n min = mid + 1; // too small\n } else { // numbers[mid] > target\n max = mid - 1; // too large\n }\n }\n \n return -1; // not found\n }", "private static int binarySearch0(double[] a, int fromIndex, int toIndex,\n\t\t\tdouble key) {\n\t\tint low = fromIndex;\n\t\tint high = toIndex - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) >>> 1;\n\t\t\t\tdouble midVal = a[mid];\n\n\t\t\t\tint cmp;\n\t\t\t\tif (midVal < key) {\n\t\t\t\t\tcmp = -1; // Neither val is NaN, thisVal is smaller\n\t\t\t\t} else if (midVal > key) {\n\t\t\t\t\tcmp = 1; // Neither val is NaN, thisVal is larger\n\t\t\t\t} else {\n\t\t\t\t\tlong midBits = Double.doubleToLongBits(midVal);\n\t\t\t\t\tlong keyBits = Double.doubleToLongBits(key);\n\t\t\t\t\tcmp = (midBits == keyBits ? 0 : // Values are equal\n\t\t\t\t\t\t(midBits < keyBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)\n\t\t\t\t\t\t\t1)); // (0.0, -0.0) or (NaN, !NaN)\n\t\t\t\t}\n\n\t\t\t\tif (cmp < 0)\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\telse if (cmp > 0)\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\telse\n\t\t\t\t\treturn mid; // key found\n\t\t}\n\t\treturn -(low + 1); // key not found.\n\t}", "public int binarySearch(int[] nums, int searchFor) {\n\t\tint[] sortedNo = this.sortAlgo.sort(nums);\n\t\treturn 3;\n\t}", "private int binarySearch(int[] array, int min, int max, int target){\r\n\r\n //because there is often not an answer that is equal to our target,\r\n //this algorithm is deisgned to find the element that it would go after in the array\r\n //because sometimes that is smaller than anything in the list it could bisect at a value that is not ideal.\r\n //however the final check handles 4 possible answers so this is not really an issue.\r\n if(target >= array[max]) return max;\r\n else if(target < array[min]) return min;\r\n if(min + 1 == max) return min;\r\n\r\n int midPoint = (min + max) / 2;\r\n\r\n if(target > array[midPoint]){\r\n return binarySearch(array, midPoint, max, target);\r\n }else return binarySearch(array, min, midPoint, target);\r\n }", "public static int binarySearch(int[] elements, int start, int end, int findMe) {\n if (start > end) {\n return -1;\n }\n Integer mid = (start + end) / 2;\n Integer midElement = elements[mid];\n //is mid the element we are looking?\n if (findMe == midElement) {\n return mid;\n }\n if (findMe < midElement) {\n //its in left half\n return binarySearch(elements, start, mid - 1, findMe);\n } else {\n //in right half of array\n return binarySearch(elements, mid + 1, end, findMe);\n }\n }", "private int binarySearch(String[] arr, int low, int high, String targetVal) {\n\t\twhile(low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tarr[mid] = arr[mid].toLowerCase();\n\t\t\ttargetVal = targetVal.toLowerCase();\n\t\t\tif (arr[mid].compareTo(targetVal) < 0) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else if (arr[mid].compareTo(targetVal) > 0) {\n\t\t\t\thigh = mid -1;\n\t\t\t} else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "public static int search(int[] nums, int target) {\n int low=0;\n int high=nums.length-1;\n int middle=(high+low)>>1;\n\n for(int i=0;i<nums.length;i++){\n int num = nums[middle];\n if(target>num){\n low=middle+1;\n middle=(high+low)>>1;\n }else if(target<num){\n high=middle-1;\n middle=(high+low)>>1;\n } else{\n return middle;\n }\n\n }\n\n return -1;\n }", "public boolean find(int key){\r\n int BB = 0,BA = nElemen-1;\r\n boolean search = true;\r\n while(search){\r\n int mid = (BA+BB)/2;\r\n if(arr[mid]==key){\r\n search = false;\r\n return true;\r\n }else if (BB>BA){\r\n break;\r\n }else{\r\n if(arr[mid]<key){\r\n BB = mid + 1;\r\n }else{\r\n BA = mid - 1;\r\n }\r\n }\r\n }\r\n return false;\r\n }", "public static void main(String[] args) {\n\n List<Integer> integers = new ArrayList<>();\n for (int i = 0; i < 49; i++) {\n integers.add(i);\n }\n int i = Collections.binarySearch(integers, 20);\n System.out.println(i);\n System.out.println(integers.get(i));\n\n }", "static int BinarySerach_upperValue(ArrayList<Integer> list , int value){ \r\n\t\t\r\n\t\tint mid,l,r;\r\n\t\t\r\n\t\tl = 0;\r\n\t\tr = list.size()-1;\r\n\t\t\r\n\t\tif(value>=list.get(r))\r\n\t\t\treturn r;\r\n\t\tif(value<=list.get(l))\r\n\t\t\treturn l;\r\n\t\t\r\n\t\tmid = (l+r)/2;\r\n\t\t\r\n\t\twhile(l<r){\r\n\t\t\t\r\n\t\t\tmid = (l+r)/2;\r\n\t\t\t\r\n\t\t\tif(list.get(mid)==value)\r\n\t\t\t\treturn mid;\r\n\t\t\t\r\n\t\t\tif(mid+1<list.size() && list.get(mid)<value && list.get(mid+1)>=value)\r\n\t\t\t\treturn mid+1;\r\n\t\t\tif(mid-1>0 && list.get(mid-1)<value && list.get(mid)>=value)\r\n\t\t\t\treturn mid;\r\n\t\t\tif(list.get(mid)<value)\r\n\t\t\t\tl = mid+1;\r\n\t\t\telse\r\n\t\t\t\tr = mid-1;\r\n\t\t}\r\n\t\t\t\r\n\t\treturn -1;\r\n\t}", "public int search(int[] A, int target) {\n // write your code here\n if (A == null || A.length == 0) return -1;\n int start = 0, end = A.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (A[mid] == target) return mid;\n if (A[mid] < A[start]) {\n if (target <= A[end] && target > A[mid]){\n start = mid;\n }\n else {\n end = mid;\n }\n }\n else {\n if (target >= A[start] && target < A[mid]) {\n end = mid;\n }\n else {\n start = mid;\n }\n }\n }\n if (A[start] == target) return start;\n if (A[end] == target) return end;\n return -1;\n }", "private Integer serialSearch() {\n int currentIndex = startIndex;\n for (int i = start; i < end; i++) {\n if (this.searchIndex == currentIndex) {\n return currentIndex;\n }\n currentIndex++;\n }\n return 0;\n }", "public int searchCyc(int[] nums) {\n int lo = 0;\n int hi = nums.length - 1;\n\n while (lo < hi) {\n int mid = (lo + hi) / 2;\n if (nums[mid] > nums[hi]) {\n lo = mid + 1;\n } else { //\n hi = mid;\n }\n }\n\n //Loop ends when left == right\n return lo;\n}", "public int sortSearchHelper (int val, int low, int high, List<Integer> list) {\n \n // Binary search to find our element val in the insertion sorted array\n \n int mid = low + (high - low)/2;\n \n // Here, if binary search ends, means current mid is the value.\n \n if (low >= high) {\n \n list.add(mid, val);\n return mid;\n \n }\n \n // Check if given val is present on left or right side of mid value.\n \n if (val <= list.get(mid)) {\n \n return sortSearchHelper (val, low, mid, list);\n \n } else {\n \n return sortSearchHelper (val, mid + 1, high, list);\n \n }\n \n \n }", "public static int binarySearch(int[] array, int value, int start, int end){\n if(start <= end){\n int mid = (start+end)/2;\n if (array[mid] == value) return mid;\n else if(array[mid] < value) start = mid+1;\n else end = mid-1;\n return binarySearch(array, value, start, end);\n }\n return -1;\n }", "@Override\r\n\t\r\n\t\r\n\t\r\n\tpublic int[] locate(int target) {\r\n\t\tint low = 0; \r\n\t\tint high = length()- 1;\r\n\t\t\r\n\t\twhile ( low <= high) {\r\n\t\t\tint mid = ((low + high)/2);\r\n\t\t\tint value = inspect(mid,0);\r\n\t\t\t\t\t\r\n\t\t\tif ( value == target) {\r\n\t\t\t\treturn new int[] {mid,0};\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\telse if (value < target) {\r\n\t\t\t\tlow = mid +1;\r\n\t\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\thigh = mid -1;\r\n\t\t}\r\n\t\t\r\n\t}\r\n\t\treturn binarySearch(high, target);\r\n\t}", "protected int search(double value) {\n int n = sequence.size();\n int left = 0, right = n - 1, index = 0;\n while (left != right) {\n index = (right - left) / 2 + left;\n if (value >= sequence.get(index == left ? index + 1 : index)) {\n left = index == left ? index + 1 : index;\n } else {\n right = index;\n }\n }\n while (left > 0 && value == sequence.get(left - 1)) {\n left -= 1;\n }\n return left;\n }" ]
[ "0.77108264", "0.7588049", "0.7465974", "0.74396825", "0.7398156", "0.7394533", "0.7311154", "0.7306878", "0.72949886", "0.72733676", "0.7244144", "0.7229248", "0.7152077", "0.71504825", "0.7125717", "0.7117731", "0.7103296", "0.70929545", "0.7075864", "0.70637095", "0.7055598", "0.7053391", "0.7037867", "0.7023732", "0.70106083", "0.70098394", "0.70043683", "0.7002249", "0.7002151", "0.69938743", "0.6991086", "0.69736725", "0.6972881", "0.69701785", "0.6964357", "0.695702", "0.6948249", "0.6922901", "0.69114107", "0.6890653", "0.6888892", "0.6877561", "0.68749017", "0.68644", "0.6826593", "0.6826285", "0.6820864", "0.6816124", "0.6792218", "0.67900455", "0.67868567", "0.6780325", "0.67716724", "0.67709833", "0.6770295", "0.6763941", "0.676281", "0.6757269", "0.6745892", "0.6729273", "0.6721071", "0.6721018", "0.6714204", "0.6710783", "0.6683808", "0.6682925", "0.6674928", "0.66720337", "0.66664124", "0.6661701", "0.66591257", "0.6657535", "0.6646563", "0.6640006", "0.6633799", "0.6631051", "0.6615597", "0.66079396", "0.66045874", "0.6599673", "0.6590665", "0.65900606", "0.6581596", "0.6577597", "0.65684783", "0.6552064", "0.6551798", "0.6543147", "0.6536031", "0.6535163", "0.65347075", "0.65222234", "0.6517586", "0.6498266", "0.6492739", "0.6486525", "0.64820963", "0.64761233", "0.6470566", "0.64689153", "0.6459129" ]
0.0
-1
Binary Search. Author: petrichory + kei Date : September 24, 2020
public int findMin3(int[] nums) { int lo = 0, hi = nums.length - 1; if (nums[hi] > nums[lo]) { return nums[lo]; } while (hi - lo > 1) { int mid = lo + (hi - lo) / 2; if (nums[mid] < nums[lo]) { hi = mid; } else { lo = mid; } } return Math.min(nums[lo], nums[hi]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testBinarySearch() {\n\t\tint[] arr0 = {0, 1, 2, 3, 4, 5};\n\t\tassertEquals(0, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 0));\n\t\tassertEquals(1, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 1));\n\t\tassertEquals(2, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 2));\n\t\tassertEquals(3, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 3));\n\t\t\n\t\tassertEquals(-1, _01_BinarySearch.binarySearch(arr0, 0, arr0.length - 1, 99));\n\t\t\n\t\tint[] arr1 = {0, 43, 209, 388, 401, 599};\n\t\tassertEquals(2, _01_BinarySearch.binarySearch(arr1, 0, arr0.length - 1, 209));\n\t\tassertEquals(-1, _01_BinarySearch.binarySearch(arr1, 0, arr0.length - 1, 45));\n\t}", "abstract int binSearch(int[] array, int num, int left, int right);", "@Test\n\tpublic void testBinarySearch() {\n\t\tint[] numbers = {0, 1, 2, 3, 4, 5, 6};\n\t\tint r1 = _01_BinarySearch.binarySearch(numbers, 0, numbers.length - 1, 4);\n\t\tassertEquals(4, r1);\n\t\t\n\t\tint[] numbers2 = {2, 4, 7, 9, 14};\n\t\tint r2 = _01_BinarySearch.binarySearch(numbers2, 0, numbers2.length - 1, 8);\n\t\tassertEquals(-1, r2);\n\t\t\n\t\tint[] numbers3 = {3, 5, 10, 16, 25};\n\t\tint r3 = _01_BinarySearch.binarySearch(numbers3, 0, numbers3.length - 1, 25);\n\t\tassertEquals(4, r3);\n\t\t\n\t}", "public static void useBinarySearch1() {\n int[] numbers = {-3, 2, 8, 12, 17, 29, 44, 58, 79};\n int index = Arrays.binarySearch(numbers, 29);\n System.out.println(\"29 is found at index \" + index);\n }", "public static void main(String args[])\n {\n BinarySerach ob = new BinarySerach();\n int arr[] = { 2, 5, 3, 1, 7, 4 };\n\n\n // Arrays.binarySearch(arr,5);\nArrays.sort(arr);\n System.out.println(Arrays.binarySearch(arr,5));\n Arrays.sort(arr);\n int n = arr.length;\n int x = 5;\n int result = ob.binarySearch(arr, x);\n if (result == -1)\n System.out.println(\"Element not present\");\n else\n System.out.println(\"Element found at \"\n + \"index \" + result);\n }", "public Integer binSearch(Integer target, Integer[] data, Integer left, Integer right) {\n if (right - left == 1) {\n if (data[left] == target) return left;\n if (data[right] == target) return right;\n }\n if (right - left == 0) {\n if (data[left] == target) return left;\n }\n Integer midpt = (right + left) / 2 ;\n if (target == data[midpt]) return midpt ;\n if (target > data[midpt] ) return binSearch(target, data, midpt, right) ;\n if (target < data[midpt] ) return binSearch(target, data, left, midpt) ;\n\n return -1;\n }", "@Test\n public void testBinarySearch() {\n System.out.println(\"binarySearch\");\n int[] index = {10, 11, 12, 13, 14};\n int key = 12;\n int begin = 0;\n int end = 5;\n int expResult = 2;\n int result = Utils.binarySearch(index, key, begin, end);\n assertEquals(expResult, result);\n }", "int binarySearch(int[] arr, int low, int high, int key){\n while(low <= high){\n int mid = (low + high) / 2;\n if (key < arr[mid])\n high = mid - 1;\n else if (key > arr[mid])\n low = mid + 1;\n else\n return mid;\n }\n return -1;\n }", "static int binarySearch(int[] paramArrayOfint, int paramInt1, int paramInt2) {\n }", "protected int binarySearch(int x) {\n if (arr.length == 0) {\n return -1;\n }\n\n int left = 0;\n int right = count - 1;\n\n while (left <= right) {\n int mid = (right + left) >>> 1;\n int val = arr[mid];\n\n if (val < x) {\n left = mid + 1;\n } else if (val > x) {\n right = mid - 1;\n }\n else {\n return mid;\n }\n }\n\n return -1;\n }", "public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n System.out.println(\"Enter number of elements\");\n int i = sc.nextInt();\n int[] array = new int[i];\n\n\n System.out.println(\"Enter \" + i + \" integers\");\n\n for (int c = 0; c < i; c++) {\n array[c] = sc.nextInt();\n }\n\n System.out.println(\"Enter value to find\");\n int search = sc.nextInt();\n\n MyBinarySearch mbs = new MyBinarySearch();\n Arrays.sort(array);\n System.out.println(search + \" was found at index \" + mbs.binarySearch(array, search) + \" in array \" + Arrays.toString(array));\n\n\n// MyBinarySearch mbs = new MyBinarySearch();\n// int[] arr = {2, 4, 6, 8, 10, 12, 14, 16};\n// System.out.println(\"Key 14's position: \"+mbs.binarySearch(arr, 14));\n// int[] arr1 = {6,34,78,123,432,900};\n// System.out.println(\"Key 432's position: \"+mbs.binarySearch(arr1, 432));\n }", "static int binarySearchHelp(int[] array, int searched) {\n\t\tint mid = array.length / 2;\r\n\t\tint first = 0;\r\n\t\tint last = array.length - 1;\r\n\r\n\t\twhile (array[mid] != searched && first <= last) {\r\n\t\t\tmid = (first + last) / 2;\r\n\t\t\tif (searched == array[mid]) {\r\n\t\t\t\treturn mid;\r\n\t\t\t}\r\n\t\t\tif (searched < array[mid]) {\r\n\t\t\t\tlast = mid - 1;\r\n\r\n\t\t\t}\r\n\t\t\tif (searched > array[mid]) {\r\n\t\t\t\tfirst = mid + 1;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}", "private static int binary_Search(int[] arr, int target) {\n\n\t\tint low = 0;\n\t\tint high = arr.length - 1;\n\n\t\twhile (low <= high) {\n\n\t\t\tint mid = low + (high - low) / 2;\n\t\t\tSystem.out.println(\"low = \" + low + \" mid = \" + mid + \" high =\" + high);\n\t\t\tif (arr[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\tif (arr[mid] < target) {\n\t\t\t\tlow = mid + 1;\n\n\t\t\t} else {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\n\t\t\t// System.out.println(\"low = \" + low + \" high =\" + high);\n\t\t}\n\t\treturn -1;\n\t}", "private static int bSearch(int[] elements, int key) {\n int left = 0, right = elements.length - 1, mid = 0;\n while (left <= right) {\n mid = (left + right) / 2;\n\n if (key < elements[mid]) {\n right = mid - 1;\n } else if (key == elements[mid]) {\n return mid;\n } else {\n left = mid + 1;\n }\n }\n return -1;\n }", "private static int binary_search(int[] array, int num, int low, int high) {\n\t\t\n\t\treturn -1;\n\t}", "public static int binarySearch(java.util.List arg0, java.lang.Object arg1)\n { return 0; }", "public void binSearch(int current, int first, int last) {\r\n long average2 = 0, timeB = 0, stanDev = 0;\r\n System.out.println(\"\\nBINARY SEARCH\\n\");\r\n for (int i = 0; i < 10; i++) {\r\n long start = System.nanoTime();\r\n while (last >= first) {\r\n int mid = (last + first) / 2;//FINDS THE MID WAY POINT IN ORDER TO KEEP HALF-ING THE SEARCH RESULTS.\r\n if (A[mid] == current) {\r\n long stop = System.nanoTime();\r\n long timelength = (stop - start);\r\n timeB += timelength; // USED FOR GETTING AVERAGE. \r\n bin[k][i] = timelength;//USED FOR STORING THE TIME IT TOOK FOR EACH TEST, IT IS USED LATER ON TO DISPLAY IN THE CHART.\r\n binary[i] = timelength;//USED FOR FINDING STANDARD DEVIATION.\r\n System.out.println(\"The number: \" + current + \" was found in the array index: \" + A[mid]\r\n + \"\\nIt took: \" + timelength + \" nanoseconds.\");\r\n break;\r\n\r\n } else if (A[mid] < current) {\r\n first = mid + 1;\r\n } else {\r\n last = mid - 1;\r\n }\r\n }\r\n }\r\n average2 = (timeB / 10);\r\n linAvAndDev[h][0] = average2;\r\n for (int j = 0; j < 10; j++) {\r\n stanDev += Math.pow((binary[j] - average2), 2.0);\r\n }\r\n stanDev /= 10;\r\n stanDev = (long) Math.sqrt(stanDev);\r\n linAvAndDev[h][1] = stanDev;\r\n System.out.println(\"The Avearge time for the Binary Search was: \" + average2 + \" nanoseconds.\"\r\n + \"\\nThe Standard Deviation time for the Binary Search was: \" + stanDev + \" nanoseconds.\");\r\n h += 1;\r\n k += 1;\r\n }", "@Test\n public void testBinarySearch() {\n int actualResult = binarySearch.BinarySearch(new int[]{2,4,5}, 5);\n // check if the value is correct\n assertEquals(5, actualResult);\n }", "public static int binSearch(int[] a, int first, int last, int key)\n\t{\t\n\t\tif(first <= last)\n\t\t{\n\t\t\tint mid = (first + last) / 2; //Divides the beginning of the array and the length of the array into 2\n\t\t\t\n\t\t\tif (a[mid] == key)\n\t\t\t{\n\t\t\t\treturn mid; \n\t\t\t}\n\t\t\t\n\t\t\telse if (a[mid] > key) //IF THE INDEX(WHICH IS THE MID) OF ARRAY A IS GREATER THAN THE KEY\n\t\t\t{\n\t\t\t\treturn last = mid - 1; //RETURNS THE LENGTH OF THE ARRAY WHICH IS THE DECREMENTED MID\n\t\t\t}\n\t\t\t\n\t\t\telse //IF THE INDEX(WHICH IS THE MID) OF ARRAY A IS LESS THAN THE KEY\n\t\t\t{\n\t\t\t\treturn first = mid + 1; //RETURNS THE FIRST = INCREMENTED MID\t\t\n\t\t\t}\n\t\t}\n\t\treturn -1;\t\n\t}", "public void binarySearchForValue(int value){\n int lowIndex = 0;\n int highIndex = arraySize -1;\n\n while(lowIndex <= highIndex){\n int middleIndex = (lowIndex + highIndex)/2;\n\n if(theArray[middleIndex] < value){\n lowIndex = middleIndex + 1;\n } else if(theArray[middleIndex] > value) {\n highIndex = middleIndex -1;\n } else {\n System.out.println(\"Found a match for \" + value + \" at Index \" + middleIndex);\n // Exit the while loop.\n lowIndex = highIndex + 1;\n }\n\n printHorizontalArray(middleIndex, -1);\n }\n }", "public void binarySearchForValue(int value) {\n int lowIndex = 0;\n int highIndex = arraySize - 1;\n\n while (lowIndex <= highIndex) {\n int middleIndex = (highIndex + lowIndex) / 2;\n\n if (theArray[middleIndex] < value) {\n lowIndex = middleIndex + 1;\n } else if (theArray[middleIndex] > value) {\n highIndex = middleIndex - 1;\n } else {\n System.out.println(\"\\nFound a match for \" + value + \" at index \" + middleIndex);\n lowIndex = highIndex + 1;\n }\n\n printHorizontalArray(middleIndex, -1);\n }\n }", "public static int binSearch(int[] a, int x) {\r\n int l = 0;\r\n int r = a.length;\r\n while (l != r) {\r\n // inv: l <= res <= r\r\n int m = (l + r) / 2;\r\n if (a[m] >= x) {\r\n r = m;\r\n }\r\n else {\r\n l = m + 1;\r\n }\r\n }\r\n return r;\r\n }", "static int binSearch(int []arr,int key) {\n\t\tint start=0;\n\t\tint end=arr.length-1;\n\t\tdo {\n\t\t\tint pc=(start+end)/2;\n\t\t\tif(arr[pc]==key) {\n\t\t\t\treturn pc;\n\t\t\t}else if(arr[pc]<key) {\n\t\t\t\tstart=pc+1;\n\t\t\t}else\n\t\t\t\tend=pc-1;\n\t\t}while(start<=end);\n\t\t\n\t\treturn -1;\n\t}", "private int binarySearch(T element) {\n int start = 0, end = sortedArray.size(), mid = 0;\n while (start < end) {\n mid = (end + start) / 2;\n int cmp = sortedArray.get(mid).compareTo(element);\n if (cmp == 0) {\n start = end = mid;\n }\n else if (cmp < 0) {\n start = mid + 1;\n }\n else {\n end = mid;\n }\n }\n return start;\n }", "private int binarySearch(int[] array, int left, int right, int target) {\n\t\tif (left > right) {\n\t\t\treturn -1;\n\t\t}\n\t\twhile (left <= right) {\n\t\t\tint mid = left + (right - left) / 2;\n\t\t\tif (array[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t} else if (array[mid] < target) {\n\t\t\t\tleft = mid + 1;\n\t\t\t} else {\n\t\t\t\tright = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "private void BinarySearch(Node node, int index) {\n Node left, right;\n left = node.left;\n right = node.right;\n\n int leftIndex = (2 * index) + 1;\n int rightIndex = (2 * index) + 2;\n if (left != null) {\n ArrayTree[leftIndex] = left.key;\n BinarySearch(left, leftIndex);\n lastIndex = Math.max(leftIndex, lastIndex);\n } else {\n if (leftIndex < ArrayTree.length - 1) {\n ArrayTree[leftIndex] = 0;\n }\n }\n\n if (right != null) {\n ArrayTree[rightIndex] = right.key;\n BinarySearch(right, rightIndex);\n lastIndex = Math.max(rightIndex, lastIndex);\n } else {\n if (rightIndex < ArrayTree.length - 1) {\n ArrayTree[rightIndex] = 0;\n }\n }\n }", "static int binarySearch(long[] paramArrayOflong, int paramInt, long paramLong) {\n }", "public static double binSearchT(int s, Integer[] a){\n Random rand = new Random();\n int searchVar;\n Stopwatch timer = new Stopwatch();\n Arrays.sort(a);\n for (int i = 0; i < s; i++){\n searchVar = (int)(rand.nextDouble()*a.length);\n Arrays.binarySearch(a, searchVar);\n }\n return timer.elapsedTime(); // the method returns the elapsed time\n }", "static void binarySearch(int mat[][], int i, int j_low, int j_high, int x){\n\t\t\n\t\twhile(j_low < j_high){\n\t\t\t\n\t\t}\n\t}", "private int binarySearchQ7(int first, int last, K key)\n {\n int index;\n \n if (first > last)\n index = first; \n else \n {\n int mid = first + (last - first) / 2;\n K midKey = dictionary[mid].getKey(); \n if (key.equals(midKey))\n index = mid; \n else if (key.compareTo(midKey) < 0)\n index = binarySearchQ7(first, mid - 1, key);\n else\n index = binarySearchQ7(mid + 1, last, key);\n } \n return index;\n }", "public static int binarySearch(java.util.List arg0, java.lang.Object arg1, java.util.Comparator arg2)\n { return 0; }", "public int binarySearch(int x) {\n\n int l = 0, h = length - 1, mid;\n while (l <= h) {\n mid = l + (h-l)/2;\n if (arr[mid] == x) return mid;\n else if (x < arr[mid]) h = mid - 1;\n else if (x > arr[mid]) l = mid + 1;\n }\n return -1;\n }", "public static void binarySearchFromFile() throws IOException\n\t{\n\t\tint elementFound=0;\n\t\tFile file = new File(\"/home/bridgeit/Desktop/program.txt\");\n\t\t\n\t\tif (file.createNewFile()){\n System.out.println(\"File is created!\");\n }else{\n System.out.println(\"File already exists.\");\n }\n\t\t\n\t\t//Write Content\n FileWriter writer = new FileWriter(file);\n writer.write(\"THIS,IS,MY,FIRST,FILE\");\n writer.close();\n int length = (int) file.length();\n \n //read the contents\n FileReader fr = new FileReader(\"/home/bridgeit/Desktop/program.txt\");\n BufferedReader br = new BufferedReader(fr);\n \n //splitting the contents\n String string = null;\n String[] splitted = new String[length];\n while ((string = br.readLine()) != null) \n {\n splitted = string.split(\",\");\n for(String display:splitted)\n {\n System.out.print(\" \"+display);\n }\n }\n System.out.println();\n \n \n //sorting of elements\n Arrays.sort(splitted);\n System.out.println(\"sorted elements are \");\n for(String display:splitted)\n {\n System.out.print(\" \"+display);\n }\n System.out.println();\n \n \n //to search the element using binary search\n System.out.println(\"enter a word to search\");\n String search = scanner.next();\n \n int min = 0;\n\t\tint max = splitted.length - 1;\n\t\tint mid = (min + max) /2;\n\t\t\n\t\tif((search.compareTo(splitted[max])<=0) && (search.compareTo(splitted[min])>=0))\n\t\t{\n\t\t\twhile(elementFound != 1)\n\t\t\t{\n\t\t\t\tif(search.compareTo(splitted[mid])==0)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"element found at \"+mid);\n\t\t\t\t\telementFound = 1;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if(search.compareTo(splitted[mid]) < 0)\n\t\t\t\t{\n\t\t\t\t\tmax = mid-1;\n\t\t\t\t\tmid = (min+max)/2;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmin = mid +1;\n\t\t\t\t\tmid = (min+max)/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\tSystem.out.println(search + \" is not present in the list.\\n\");\n\t\t}\n\t}", "public int binarySearchLoop(int key) {\n int first = 0;\n int last = length - 1;\n int mid = length / 2;\n //only on sorted array\n //first , mid = half(floor), last;\n //is mid the key\n //is mid < or > from the key\n //if key is bigger, then we go right, the new first is mid+1, new mid is (mid+last)/2, and last is the same until the end of the GOING searching right\n //if key is smaller then we go left, the new last is mid-1, new mid is (first + mid)/2, and first is the same until the end of GOING searching left\n\n while (first <= last) {\n if (key == arr[mid]) return mid;\n\n else if (key < arr[mid]) {\n last = mid - 1;\n mid = (first + mid) / 2;\n } else {\n first = mid + 1;\n mid = (first + last) / 2;\n }\n }\n return -1;\n }", "public static int binSearchRotatedIter(int src[], int lo, int hi, int target){\n\n while(lo<=hi){\n int mid = lo + (hi-lo)/2;\n if(src[mid]==target) return mid;\n //if bottom half is sorted\n if(src[lo]<=src[mid]){\n \n if(src[lo]<=target && target<src[mid]){\n hi=mid-1;\n }else{\n lo=mid+1;\n }\n }\n //if upper half is sorted\n else{\n if(src[mid]<target && target<=src[hi]){\n lo=mid+1;\n }else{\n hi=mid-1;\n }\n }\n }\n return -1;\n}", "public int binarySearch(int[] nums, int target, int left, int right) {\n int res = left - 1;\n while (left <= right) {\n int mid = left + (right - left) / 2;\n if (nums[mid] <= target) {\n right = mid - 1;\n } else {\n res = mid;\n left = mid + 1;\n }\n }\n return res;\n }", "private static int binarySearchMine(int[] data, int target, int low, int high) {\n while (low <= high) {\n int median = (low + high) / 2;\n int current = data[median];\n if (current == target) {\n return median;\n } else if (target < current) {\n return binarySearchMine(data, target, low, median - 1);\n } else {\n return binarySearchMine(data, target, median + 1, high);\n }\n }\n return -1;\n }", "public int binarySearch(int[] numbers, int numToSearch){\n\n QuickSort quickSort = new QuickSort();\n quickSort.sort(numbers);\n\n //Above code is tightly coupled with either of the algo to be used, we can not manage using sort algo dynamically.\n\n\n // Login to search\n\n //Return the number found\n\n return 5; //returning any hypothetical number\n }", "static Integer BinarySearchRec(Integer[] tablica, int value, int low, int high) {\n if (high < low) {\n return -1;\n }\n\n int mid = (low + high) / 2;\n\n if (tablica[mid] > value) {\n return BinarySearchRec(tablica, value, low, mid - 1);\n } else if (tablica[mid] < value) {\n return BinarySearchRec(tablica, value, mid + 1, high);\n } else {\n return mid;\n }\n }", "public int binarySearchAlgo(int a[], int x) {\n\t\tint low = 0;\n\t\tint high = a.length - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tif (a[mid] == x) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\tif (x > a[mid]) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else /* if(a[mid] < x) */ {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int binarySearch(String searchKey) {\r\n\t\tint low = 0;\r\n\t\tint high = size -1;\r\n\t\tint middle;\r\n\t\t\r\n\t\twhile (low <= high) {\r\n\t\t\tmiddle = (high + low)/2;\r\n\t\t\tif (searchKey.equalsIgnoreCase(list[middle].getStudentName())) {\r\n\t\t\t\treturn middle; // Element was found\r\n\t\t\t}\r\n\t\t\telse if (searchKey.compareToIgnoreCase(list[middle].getStudentName())<0) {\r\n\t\t\t\thigh = middle -1;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tlow = middle +1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1; // Element was not found\r\n\t}", "public int binarySearch(Long[] keys,Long target){\n\t\tif(keys ==null || keys.length ==0){\n\t\t\treturn -1;\n\t\t}\n\t\tint l = 0;\n\t\tint r = keys.length-1;\n\t\twhile(l<r){\n\t\t\tint mid = l + (r-l)/2;\n\t\t\tif(keys[mid] == target)\n\t\t\t\treturn mid;\n\t\t\tif(keys[mid]<target)\n\t\t\t\tl = mid+1;\n\t\t\telse\n\t\t\t\tr = mid-1;\n\t\t}\n\t\treturn l;\n\t\t\n\t}", "@Test\r\n\tpublic void test08_binarySearch() {\r\n\t\tRecursiveMethods rm = new RecursiveMethods();\r\n\r\n\t\tint[] a7 = {};\r\n\t\tassertFalse(rm.binarySearch(a7, 5)); // Search 5 in a7 -> {} False\r\n\r\n\t\tint[] a8 = { 1, 2, 3, 4, 5 };\r\n\t\tassertTrue(rm.binarySearch(a8, 3)); // Search 3 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t// True\r\n\t\tassertTrue(rm.binarySearch(a8, 1)); // Search 1 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t// True\r\n\t\tassertTrue(rm.binarySearch(a8, 5)); // Search 5 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t// True\r\n\t\tassertFalse(rm.binarySearch(a8, 0)); // Search 0 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t\t// False\r\n\t\tassertFalse(rm.binarySearch(a8, 6)); // Search 6 in a8 -> {1,2,3,4,5} ->\r\n\t\t\t\t\t\t\t\t\t\t\t\t// False\r\n\t}", "int binarySearch(int arr[], int x)\n {\n int l = 0, r = arr.length - 1;\n while (l <= r) {\n int m = l + (r - l) / 2;\n\n // Check if x is present at mid\n if (arr[m] == x)\n return m;\n\n // If x greater, ignore left half\n if (arr[m] < x)\n l = m + 1;\n\n // If x is smaller, ignore right half\n else\n r = m - 1;\n }\n\n // if we reach here, then element was\n // not present\n return -1;\n }", "static int binarySearch(@NotNull int[] search, int find) {\n int start, end, midPt;\n start = 0;\n end = search.length - 1;\n\n while (start <= end) {\n midPt = (start + end) / 2;\n if (search[midPt] == find) {\n return midPt;\n } else if (search[midPt] < find) {\n start = midPt + 1;\n } else {\n end = midPt - 1;\n }\n }\n\n return -1;\n }", "public int binarySearchAlgo(int a[], int low, int high, int x) {\n\t\tint mid = (low + high) / 2;\n\t\t// If mid is x simply return the value\n\t\tif (a[mid] == x) {\n\t\t\treturn mid;\n\t\t}\n\t\t// If we didn't find any element simply return -1\n\t\tif (low == high) {\n\t\t\treturn -1;\n\t\t}\n\t\t// If mid element value is less then x go search higher(right) indices\n\t\tif (a[mid] < x) {\n\t\t\treturn binarySearchAlgo(a, mid + 1, high, x);\n\t\t}\n\t\t// If mid element value is less then x go search lower(left) indices\n\t\telse /* if (a[mid] > x) */ {\n\t\t\treturn binarySearchAlgo(a, low, mid - 1, x);\n\t\t}\n\n\t}", "private int binarySearch(int[] nums, int target, int low, int high) {\n while (low <= high) {\n int mid = low + (high - low) / 2; // find mid\n\n if (nums[mid] == target) { // if number found\n if (mid == low || nums[mid] > nums[mid - 1]) // check if it is the first occurence\n return mid; // if it is return mid\n else\n high = mid - 1; // decrease high to reach the index\n } else if (nums[mid] > target) // if the value in num is greater\n high = mid - 1; // decrease high\n else\n low = mid + 1; // else increase low\n\n }\n\n return -1; // number not found\n }", "public static void main( String args[] )\n{\n Scanner input = new Scanner( System.in );\n \n int searchInt; // search key\n int position; // location of search key in array\n\n // create array and output it\n BinaryArray searchArray = new BinaryArray( 15 );\n System.out.println( searchArray );\n\n // get input from user\n System.out.print( \n \"Please enter an integer value (-1 to quit): \" );\n searchInt = input.nextInt(); // read an int from user\n System.out.println();\n\n // repeatedly input an integer; -1 terminates the program\n while ( searchInt != -1 )\n {\n // use binary search to try to find integer\n position = searchArray.binarySearch( searchInt );\n\n // return value of -1 indicates integer was not found\n if ( position == -1 )\n System.out.println( \"The integer \" + searchInt + \n \" was not found.\\n\" );\n else\n System.out.println( \"The integer \" + searchInt + \n \" was found in position \" + position + \".\\n\" );\n\n // get input from user\n System.out.print( \n \"Please enter an integer value (-1 to quit): \" );\n searchInt = input.nextInt(); // read an int from user\n System.out.println();\n } // end while\n}", "public int binarySearch(int[] nums, int target) {\n // write your code here\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] == target) {\n end = mid;\n }\n else if (nums[mid] < target) {\n start = mid;\n }\n else {\n end = mid;\n }\n }\n if (nums[start] == target) return start;\n if (nums[end] == target) return end;\n return -1;\n }", "static int binarySearch(int arr[], int l, int r, int x) {\n if (r >= l) { \r\n int mid = l + (r - l) / 2; \r\n if (arr[mid] == x) \r\n return mid; \r\n \r\n if (arr[mid] > x) \r\n return binarySearch(arr, l, mid - 1, x); \r\n \r\n \r\n return binarySearch(arr, mid + 1, r, x); \r\n } \r\n \r\n \r\n return -1; \r\n }", "public static Boolean binarySearch(int[] arr, int n){\r\n if(arr.length == 0) return false;\r\n if(arr.length == 1 && arr[0] != n) return false; \r\n if(arr.length == 1 && arr[0] == n) return true; \r\n int start = 0;\r\n int mid = arr.length/2;\r\n int end = arr.length;\r\n int pos = mid;\r\n while(arr[pos] != n){\r\n if(n > arr[pos]){\r\n start = mid;\r\n mid = (end-start)/2+start;\r\n } else if(n < arr[pos]){\r\n end = mid;\r\n mid = (end-start)/2+start;\r\n System.out.println(\"here \" + start+ \" \" + mid + \" \" + end + \" pos= \" + pos);\r\n }\r\n pos = mid;\r\n if(arr[pos] == n) return true;\r\n if(start+1 == end){\r\n System.out.println(start+ \" \" + mid + \" \" + end + \" pos= \" + pos);\r\n return false;\r\n }\r\n }\r\n return true;\r\n}", "public static int binarySearch(int[] list, int key) {\n int low = 0;\n int high = list.length - 1;\n \n while (high >= low) {\n int mid = (low + high) / 2;\n if (key < list[mid])\n high = mid - 1;\n else if (key == list[mid])\n return mid;\n else\n low = mid + 1;\n }\n return -1 - 1; // now high < low, key not found\n }", "static double binarySearchForBuckets (double[] splits, double feature, boolean keepInvalid) { throw new RuntimeException(); }", "int binarySearchWithRecursion(int[] arr, int low, int high, int key){\n if (high < low)\n return -1;\n int mid = (low + high) / 2;\n if (key == arr[mid])\n return mid;\n if (key > arr[mid])\n return binarySearchWithRecursion(arr,(mid + 1), high, key);\n return binarySearchWithRecursion(arr, low, (mid - 1), key);\n }", "public static int binSearch(int[] a, int x, int l, int r) {\r\n if (l == r) {\r\n return r;\r\n }\r\n int m = (l + r) / 2;\r\n if (a[m] >= x) {\r\n return binSearch(a, x, l, m);\r\n }\r\n else {\r\n return binSearch(a, x, m + 1, r);\r\n }\r\n }", "private static boolean binarySearch(int[] data, int target, int low, int high) {\n if (low > high) {\n return false;\n } else {\n int mid = (low + high) / 2;\n if (target == data[mid]) {\n return true;\n } else if (target < data[mid]) {\n return binarySearch(data, target, low, mid - 1);\n } else {\n return binarySearch(data, target, mid + 1, high);\n }\n }\n }", "private static int binarySearch(int[] arr, int low, int high, int target) {\n\n\t\tif (low <= high) {\n\n\t\t\tint mid = low + (high - low) / 2;\n\n\t\t\tif (arr[mid] == target) {\n\t\t\t\treturn mid;\n\t\t\t}\n\n\t\t\tif (arr[mid] < target) {\n\t\t\t\treturn binarySearch(arr, mid + 1, high, target);\n\t\t\t} else {\n\t\t\t\treturn binarySearch(arr, low, mid - 1, target);\n\t\t\t}\n\n\t\t}\n\n\t\treturn -1;\n\t}", "private int binarySearch(List<Span> spans, int line) {\n int left = 0,right = spans.size() - 1,mid,row;\n int max = right;\n while(left <= right){\n mid = (left + right) / 2;\n if(mid < 0) return 0;\n if(mid > max) return max;\n row = spans.get(mid).getLine();\n if(row == line) {\n return mid;\n }else if(row < line){\n left = mid + 1;\n }else{\n right = mid - 1;\n }\n }\n return Math.max(0,Math.min(left,max));\n }", "private int binaryFind(K key) {\n int sortedCount = this.sortedCount.get();\n // if there are no sorted keys, or the first item is already larger than key -\n // return the head node for a regular linear search\n if ((sortedCount == 0) || comparator.compareKeyAndSerializedKey(key, readKey(FIRST_ITEM)) <= 0) {\n return HEAD_NODE;\n }\n\n // optimization: compare with last key to avoid binary search\n if (comparator.compareKeyAndSerializedKey(key, readKey((sortedCount - 1) * FIELDS + FIRST_ITEM)) > 0) {\n return (sortedCount - 1) * FIELDS + FIRST_ITEM;\n }\n\n int start = 0;\n int end = sortedCount;\n\n while (end - start > 1) {\n int curr = start + (end - start) / 2;\n\n if (comparator.compareKeyAndSerializedKey(key, readKey(curr * FIELDS + FIRST_ITEM)) <= 0) {\n end = curr;\n } else {\n start = curr;\n }\n }\n\n return start * FIELDS + FIRST_ITEM;\n }", "public static void main(String[] args) {\n\n List<Integer> integers = new ArrayList<>();\n for (int i = 0; i < 49; i++) {\n integers.add(i);\n }\n int i = Collections.binarySearch(integers, 20);\n System.out.println(i);\n System.out.println(integers.get(i));\n\n }", "public static int binaryFind(int []A, int s, int e, int key) {\n\tif(s>e) return -1;\n\tint mid = (s+e)/2;\n\tif(A[mid] == key) return mid;\n if(A[mid] < key) return binaryFind(A, mid+1, e, key);\n else return binaryFind(A, s, mid-1, key); //(A[mid] > key)\n }", "public static int binarySearchRec(int[] arr, int from, int to, int key) {\n\t\t\n\t\tif (from<=to) {\n\t\t\tint mid=from+(to-from)/2;\n\t\t\tif (arr[mid]<key) \t\treturn binarySearchRec(arr, ++mid, to, key);//upper\t\n\t\t\telse if (arr[mid]>key) \treturn binarySearchRec(arr, from, --mid, key); //lower\n\t\t\telse \t\t\t\t\treturn mid;//found\n\t\t}\n\t\telse {//not found\n\t\t\tint shouldBeIndex=from;\n\t\t\treturn -shouldBeIndex-1;\n\t\t}\n\t}", "public int binarySearch(ArrayList<Integer> a, int val){\n int low = 0;\n int high = a.size() - 1;\n \n while(high - low > 3){\n int mid = (low + high)/2;\n if(a.get(mid) > val){\n high = mid - 1;\n }\n else{\n low = mid; \n }\n }\n int i;\n for(i=low; i<=high; ++i){\n if(a.get(i) > val)\n return i;\n }\n return i;\n }", "public int binarySearchIterative(int[] array,int target) {\n var left = 0;\n var right = array.length -1;\n while (left <= right) {\n int middle = (left + right) / 2;\n if (array[middle] == target)\n return middle;\n if (array[middle] < target)\n left = middle + 1;\n else\n right = middle - 1;\n }\n return -1;\n }", "private int binarySearchByIndex(List<Span> spans, int index){\n int left = 0,right = spans.size() - 1,mid,row;\n int max = right;\n while(left <= right){\n mid = (left + right) / 2;\n if(mid < 0) return 0;\n if(mid > max) return max;\n row = spans.get(mid).startIndex;\n if(row == index) {\n return mid;\n }else if(row < index){\n left = mid + 1;\n }else{\n right = mid - 1;\n }\n }\n int result = Math.max(0,Math.min(left,max));\n while(result > 0) {\n if(spans.get(result).startIndex > index) {\n result--;\n }else{\n break;\n }\n }\n while(result < right) {\n if(getSpanEnd(result,spans) < index) {\n result++;\n }else{\n break;\n }\n }\n return result;\n }", "private int binarySearchLeft(int[] nums, int target) {\n \tint low=0;\n int high=nums.length-1;\n\n while(low<=high){\n int mid=low+(high-low)/2;\n if (nums[mid]==target){\n if(mid==0||nums[mid-1]<nums[mid]){\n return mid;\n }\n else{\n high=mid-1;\n }\n }\n else if(nums[mid]>target){\n high=mid-1;\n }\n else{\n low=mid+1;\n }\n \n }\n\t\treturn -1;\n\t}", "static boolean binarySearch(int[] a, int x)\n {\n //TODO: implement this method\n \tboolean contained = false;\n \tint lo = 0;\n \tint hi = a.length - 1;\n \t\n \twhile (lo <= hi && !contained)\n \t{\n \t\tint mid = lo + (hi - lo)/2;\n \t\tif (a[mid] > x)\n \t\thi = mid - 1;\n \telse if (a[mid] < x)\n \t\tlo = mid + 1;\n \telse contained = true;\n \t}\n \t\n \treturn contained;\n }", "private static int binarySearchRecursively(int[] sortedArray, int input, int first, int last) {\n int mid = (first + last) / 2;\n\n if (last < first) {\n return -1;\n }\n if (input == sortedArray[mid]) {\n return mid;\n } else if (input < sortedArray[mid]) {\n return binarySearchRecursively(sortedArray, input, last, mid - 1);\n } else {\n return binarySearchRecursively(sortedArray, input, mid + 1, last);\n }\n }", "public static int binarySearchIter(int[] arr, int from, int to, int key) {\n\t\t\n\t\tint shouldBeIndex;\n\t\twhile (from<=to){\n\t\t\tint mid=from+(to-from)/2;\n\t\t\tif (arr[mid]<key) from=mid+1;//upper\n\t\t\telse if (arr[mid]>key) to=mid-1;//lower\n\t\t\telse return mid;//found\n\t\t}\n\t\t//not found\n\t\tshouldBeIndex=from;\n\t\treturn -shouldBeIndex-1;\n\t}", "public int nameBinarySearch (String name) {\n\t\t//sorting records by first name alphabetical order\n\t\tthis.nameQuickSort(this.getList(), 0, getSize()-1);\n\t\tint low = 0;\n\t\tint high = this.size-1;\n\t\tint middle;\n\n\t\twhile (low<=high) { \n\t\t\tmiddle = (low+high)/2;\n\t\t\tif (name.compareToIgnoreCase(list[middle].getName()) == 0) { //check if name found\n\t\t\t\treturn middle; //return index\n\t\t\t}\n\t\t\tif (name.compareToIgnoreCase(list[middle].getName()) <0) { //check if name to find is in the lower half\n\t\t\t\thigh = middle-1; //move the high to one lower than the middle\n\t\t\t}\n\t\t\telse { //if it is in higher part of the list\n\t\t\t\tlow = middle+1; //move the low to one higher than the middle\n\t\t\t}\n\t\t}\n\t\t//not found\n\t\treturn -1;\n\t}", "public static int BinarySearch(int[] arr,int data){\n int si = 0, ei = arr.length - 1;\n while(si <= ei){\n int mid = (si + ei) / 2;\n if(arr[mid] == data)\n return mid;\n else if(data < arr[mid]){\n ei = mid - 1;\n }else si = mid + 1;\n }\n\n return -1;\n }", "private int binarySearch(int[] r6, int r7, boolean r8) {\n /*\n r5 = this;\n int r0 = r6.length\n int r0 = r0 + -1\n r1 = 0\n r2 = r0\n r0 = 0\n L_0x0006:\n if (r0 > r2) goto L_0x001d\n int r3 = r0 + r2\n int r3 = r3 / 2\n r4 = r6[r3]\n if (r7 != r4) goto L_0x0011\n return r3\n L_0x0011:\n r4 = r6[r3]\n if (r7 >= r4) goto L_0x0019\n int r3 = r3 + -1\n r2 = r3\n goto L_0x0006\n L_0x0019:\n int r3 = r3 + 1\n r0 = r3\n goto L_0x0006\n L_0x001d:\n if (r2 >= 0) goto L_0x0020\n return r1\n L_0x0020:\n if (r8 == 0) goto L_0x002a\n int r7 = r2 + 1\n int r6 = r6.length\n int r6 = r6 + -1\n if (r7 > r6) goto L_0x002a\n goto L_0x002b\n L_0x002a:\n r7 = r2\n L_0x002b:\n return r7\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.taobao.tao.util.TaobaoImageUrlStrategy.binarySearch(int[], int, boolean):int\");\n }", "private int LinearSearchAfterBinary(String filename, ArrayList<Integer> matchingPositions, String wordToBeSearched, int linesToSkip, boolean reverseFile)\n {\n try\n {\n //Try to open the index file using a Scanner\n Scanner indexFileFileScanner = new Scanner(new File(filename + \".ndx\"));\n\n //Counter for the data page accesses\n int dataPageCounter = 0;\n\n //Flag for the search process status\n boolean searchStatus = true;\n\n //Counter of the word matching\n int wordOccurrences = matchingPositions.size();\n\n //Check whether to search the top or the bottom part of the file\n if(reverseFile)\n {\n //Create an ArrayList object to store the part of the file to continue the search\n ArrayList<String> fileLines = new ArrayList<>();\n\n //Get the necessary lines from the file\n for(int index = 0; index < linesToSkip; index++)\n {\n fileLines.add(indexFileFileScanner.nextLine());\n }\n\n //If the word to be searched length is valid, scan every data page in the ArrayList, in reverse order\n while(fileLines.size() != dataPageCounter && searchStatus)\n {\n //Fetch the data page into the ByteBuffer\n ByteBuffer bytePageBuffer = ByteBuffer.wrap(StringToByteArrayTranslator(fileLines.get(fileLines.size() - dataPageCounter - 1), SizeConstants.getBufferSize()));\n\n //Search for the word to be searched in the data page\n searchStatus = LinearSearchBytePage(wordToBeSearched,bytePageBuffer.array(), matchingPositions);\n\n //Count the data page access\n dataPageCounter++;\n\n //Check if there no more occurrences of the word to be searched\n if(!matchingPositions.isEmpty())\n {\n //If there are continue the search\n if(wordOccurrences != matchingPositions.size())\n {\n wordOccurrences = matchingPositions.size();\n }\n else\n {\n //Stop the search\n searchStatus = false;\n }\n }\n }\n }\n else\n {\n //Skip lines of the file\n SkipLines(indexFileFileScanner, linesToSkip);\n\n //If the word to be searched length is valid, scan every data page in the file\n while(indexFileFileScanner.hasNext() && searchStatus)\n {\n //Fetch the data page into the ByteBuffer\n ByteBuffer bytePageBuffer = ByteBuffer.wrap(StringToByteArrayTranslator(indexFileFileScanner.nextLine(), SizeConstants.getBufferSize()));\n\n //Search for the word to be searched in the data page\n searchStatus = LinearSearchBytePage(wordToBeSearched,bytePageBuffer.array(), matchingPositions);\n\n //Count the data page access\n dataPageCounter++;\n\n //Check if there no more occurrences of the word to be searched\n if(!matchingPositions.isEmpty())\n {\n //If there are continue the search\n if(wordOccurrences != matchingPositions.size())\n {\n wordOccurrences = matchingPositions.size();\n }\n else\n {\n //Stop the search\n searchStatus = false;\n }\n }\n }\n }\n\n //Close the FileScanner\n indexFileFileScanner.close();\n\n //Return the number of data page accesses\n return dataPageCounter;\n }\n catch (FileNotFoundException e)\n {\n //Catch the FileNotFoundException and inform the user\n System.out.println(\"File: \" + this.Filename + \" cannot be opened.\");\n e.printStackTrace();\n return 0;\n }\n }", "public int binarySearch(RandomAccessFile Din, String id) throws IOException \n {\n int Low = 0;\n int NUM_RECORDS = Integer.parseInt(getNumberOfRecords(\"normal\"));;\n int High = NUM_RECORDS-1;\n int Middle = 0;\n String MiddleId;\n String record = \"\";\n boolean Found = false;\n\n \n while (!Found && (High >= Low)) \n {\n Middle = (High+Low) / 2;\n record = getRecord(\"normal\", Din, Middle+1);\n MiddleId = record.substring(5,45);\n MiddleId = MiddleId.trim();\n int result = MiddleId.compareTo(id);\n\n if (result == 0) {\n // ids match\n return Middle;\n } \n else if (result < 0) {\n Low = Middle + 1;\n }\n else {\n High = Middle - 1;\n }\n }\n\n if (Low > High) {\n record = getRecord(\"normal\", Din, Middle);\n // if (record != \"\") {\n MiddleId = record.substring(5, 45).trim().toUpperCase();\n if (MiddleId.compareTo(id) == 0) {\n return Middle;\n }\n // }\n }\n\n return -1;\n }", "public static void main(String[] args){\n int s = 80;\n int n = (int) Math.pow(10, 7);\n Integer[] a = new Integer[n];\n Random rand = new Random();\n for (int i = 0; i < n; i++){\n a[i] = (int) (n*rand.nextDouble());\n }\n double binTime = binSearchT(s, a);\n double linTime = linSearchT(s, a);\n System.out.println(\"binTime: \"+ binTime);\n System.out.println(\"linTime: \"+ linTime);\n\n }", "public static int binarySearch(int[] A, int x) {\n int low = 0;\n int high = A.length - 1;\n int mid = -1;\n while (low <= high) {\n mid = low + (high-low)/2;\n if (x >= A[mid]) {\n high = mid - 1;\n } else {\n low = mid + 1;\n }\n }\n if (mid >= 0 && x == A[mid]) {\n return mid;\n }\n return -1;\n }", "private static int binarySearch0(float[] a, int fromIndex, int toIndex,\n\t\t\tfloat key) {\n\t\tint low = fromIndex;\n\t\tint high = toIndex - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) >>> 1;\n\t\tfloat midVal = a[mid];\n\n\t\tint cmp;\n\t\tif (midVal < key) {\n\t\t\tcmp = -1; // Neither val is NaN, thisVal is smaller\n\t\t} else if (midVal > key) {\n\t\t\tcmp = 1; // Neither val is NaN, thisVal is larger\n\t\t} else {\n\t\t\tint midBits = Float.floatToIntBits(midVal);\n\t\t\tint keyBits = Float.floatToIntBits(key);\n\t\t\tcmp = (midBits == keyBits ? 0 : // Values are equal\n\t\t\t\t(midBits < keyBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)\n\t\t\t\t\t1)); // (0.0, -0.0) or (NaN, !NaN)\n\t\t}\n\n\t\tif (cmp < 0)\n\t\t\tlow = mid + 1;\n\t\telse if (cmp > 0)\n\t\t\thigh = mid - 1;\n\t\telse\n\t\t\treturn mid; // key found\n\t\t}\n\t\treturn -(low + 1); // key not found.\n\t}", "public static void main(String[] args) {\n\n\t\tint[] arr = {1, 2, 5, 5, 5, 10, 20};\n\t\t\n\t\tint search = 5;\n\t\t\n\t\tint index = Arrays.binarySearch(arr, search);\n\t\t//System.out.println(index);\n\t\t\n\t\tif(index < 0) {\n\t\t\tint lowerBound = Math.abs(index) - 2;\n\t\t\tint upperBound = Math.abs(index) - 1;\n\t\t\t\n\t\t\tSystem.out.println(lowerBound + \" \" + upperBound);\n\t\t}\n\t\t\n\t}", "public int binarySearch(int[] nums, int searchFor) {\n\t\tint[] sortedNo = this.sortAlgo.sort(nums);\n\t\treturn 3;\n\t}", "public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int elem = scanner.nextInt();\n ArrayList<Integer> list = new ArrayList<>();\n while (scanner.hasNextInt()) {\n list.add(scanner.nextInt());\n }\n int[] array = new int[list.size()];\n for (int i = 0; i < array.length; i++) {\n array[i] = list.get(i);\n }\n System.out.println(binarySearch(array,elem));\n }", "static int binarySearch(int[] array, int start, int end, int value) {\r\n\t\tif(end>=start) {\r\n\t\t\tint mid = (start+end)/2;\r\n\t\t\tif(array[mid]==value)\r\n\t\t\t\treturn mid;\r\n if(array[mid]>value)\r\n \treturn binarySearch(array, start, mid-1, value);\r\n return binarySearch(array, mid+1, end, value);\r\n\t\t}\r\n return -1;\r\n\t}", "private int binarySearchRecursive(int[] array,int target,int left,int right) {\n if (left > right)\n return -1;\n\n int middle = (left + right) / 2;\n\n if (array[middle] == target)\n return middle;\n\n if (array[middle] < target)\n return binarySearchRecursive(array,target,middle+1,right);\n\n return binarySearchRecursive(array, target,left,middle-1);\n }", "public int BinarySearch(Object[] a, int size, Object key) {\n int start = 0;\n int end = size - 1;\n while (start < end) {\n int mid = (start + size) / 2;\n if (key.equals(a[mid])) {\n return mid;\n } else if (((Comparable) key).compareTo(a[mid]) > 0) {\n start = mid + 1;\n } else {\n end = mid - 1;\n }\n }\n return -1;\n }", "public static int binary( String[] arr,String x)\n{\n\t int l = 0, r = arr.length - 1;\n\t int re=0;\n while (l <= r)\n { \n int m = l + (r - l) / 2;\n int res = x.compareTo(arr[m]); \n if (res == 0)\n {\n re=m;\n break;\n }\n else if(res > 0) \n {\n l = m + 1;\n }\n else\n r = m - 1; \n } \n return re; \n}", "private int binarySearchReference(String searchForThisWord2, String[] x)\n\t{\n\t\tint wordCounter = Arrays.binarySearch(x, searchForThisWord2);\t//creates an int called wordCounter that will look throu\n\t\twordCounter = wordCounter > 0 ? wordCounter : 1;\t//Gives properties to wordCounter. The first element (a) will be represented as 1\n\t\tSystem.out.println(\"The word \" + searchForThisWord2 + \"'s position in the English Dictionary is \" + wordCounter);\t//print statement\n\t\treturn wordCounter;\t//return the method\n\t}", "private static boolean binarySearch(String exWord) {\n\t\tint bot = 0;\n\t\tint top = DaleChallWords.getDaleChall().length;\t\n\t\tint mid;\n\t\twhile(bot <= top) {\n\t\t\tmid = (top + bot)/2;\n\t\t\tif(Concurrency.levenshtein(DaleChallWords.getDaleChall()[mid], exWord) > 2) {\n\t\t\t\tif(exWord.compareToIgnoreCase(DaleChallWords.getDaleChall()[mid]) < 0) {\n\t\t\t\t\t\ttop = mid -1;\n\t\t\t\t}\n\t\t\t\telse if(exWord.compareToIgnoreCase(DaleChallWords.getDaleChall()[mid]) > 0) { \n\t\t\t\t\tbot = mid +1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public static int[] binaryearch(int[] nums, int left, int right, int target) {\n int[] indexs = {-1, -1};\n if (left > right) {\n return indexs;\n }\n int middle = (right - left) / 2 + left;\n if (nums[middle] == target) {\n int[] results = new int[]{middle, middle};\n if (middle > left && nums[middle - 1] == nums[middle]) {\n //左侧还有\n int[] indexs2 = binaryearch(nums, left, middle - 1, target);\n if (indexs2[0] != -1) {\n results[0] = indexs2[0];\n }\n }\n if (middle < right && nums[middle + 1] == nums[middle]) {\n // //右侧还有\n int[] indexs2 = binaryearch(nums, middle + 1, right, target);\n if (indexs2[1] != -1) {\n results[1] = indexs2[1];\n }\n }\n return results;\n } else if (nums[middle] < target) {\n indexs = binaryearch(nums, middle + 1, right, target);\n\n } else {\n indexs = binaryearch(nums, left, middle - 1, target);\n }\n return indexs;\n\n }", "private static int binarySearch0_BranchFreeUnrolledStatic16(int[] a, int key) {\n\t\tint low = 8;\n\t\tint midVal;\n\t\tint highMask;\n\n\t\tmidVal = a[low];\n\t\tlow += 4;\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 8 & highMask;\n\n\t\tmidVal = a[low];\n\t\tlow += 2;\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 4 & highMask;\n\n\t\tmidVal = a[low];\n\t\tlow += 1;\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 2 & highMask;\n\n\t\tmidVal = a[low];\n\t\thighMask = (int) (((long) key - midVal) >> 63);\n\t\tlow -= 1 & highMask;\n\n\t\treturn a[low] == key ? low : -(low + 1);\n\n\t}", "private static int binarySearch0(double[] a, int fromIndex, int toIndex,\n\t\t\tdouble key) {\n\t\tint low = fromIndex;\n\t\tint high = toIndex - 1;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) >>> 1;\n\t\t\t\tdouble midVal = a[mid];\n\n\t\t\t\tint cmp;\n\t\t\t\tif (midVal < key) {\n\t\t\t\t\tcmp = -1; // Neither val is NaN, thisVal is smaller\n\t\t\t\t} else if (midVal > key) {\n\t\t\t\t\tcmp = 1; // Neither val is NaN, thisVal is larger\n\t\t\t\t} else {\n\t\t\t\t\tlong midBits = Double.doubleToLongBits(midVal);\n\t\t\t\t\tlong keyBits = Double.doubleToLongBits(key);\n\t\t\t\t\tcmp = (midBits == keyBits ? 0 : // Values are equal\n\t\t\t\t\t\t(midBits < keyBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)\n\t\t\t\t\t\t\t1)); // (0.0, -0.0) or (NaN, !NaN)\n\t\t\t\t}\n\n\t\t\t\tif (cmp < 0)\n\t\t\t\t\tlow = mid + 1;\n\t\t\t\telse if (cmp > 0)\n\t\t\t\t\thigh = mid - 1;\n\t\t\t\telse\n\t\t\t\t\treturn mid; // key found\n\t\t}\n\t\treturn -(low + 1); // key not found.\n\t}", "public static void main(String...args){\n\t\tint[] whitelist = new int[10];\n\t\tfor(int i=0; i<10; i++){\n\t\t\twhitelist[i] = new Random().nextInt(1000);\t\t\t\n\t\t}\n\t\t\n\t\t//sort the list\n\t\tArrays.sort(whitelist);\n\t\tfor(int i=0; i<10; i++){\n\t\t\tSystem.out.print(whitelist[i]+\", \");\n\t\t}\n\t\t\n\t\tint key = new Random().nextInt(1000);\n\t\tint res = binarySearch(key, whitelist);\n\t\tSystem.out.println(\"\\n二分搜索数字\" + key + \",得:\" + res);\n\t}", "private int binarySearch(String[] arr, int low, int high, String targetVal) {\n\t\twhile(low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\tarr[mid] = arr[mid].toLowerCase();\n\t\t\ttargetVal = targetVal.toLowerCase();\n\t\t\tif (arr[mid].compareTo(targetVal) < 0) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else if (arr[mid].compareTo(targetVal) > 0) {\n\t\t\t\thigh = mid -1;\n\t\t\t} else {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "public static int binary_search(int[] array, int n, int value)\n {\n int low = 0;\n while (low <= n) {\n int middle = (low + n) / 2;\n if (value == array[middle]) {\n return middle;\n }\n else if (value < array[middle]) {\n n = middle - 1;\n }\n else {\n low = middle + 1;\n }\n }\n return -1;\n \n }", "void compareSearch();", "private int recFind(int searchKey, int lowerbound, int upperbound) {\n\t\tint curIn = (lowerbound + upperbound) / 2;\n\t\tif (arr[curIn] == searchKey)\n\t\t\treturn curIn;\n\t\telse if (lowerbound > upperbound)\n\t\t\treturn n;\n\t\telse {\n\t\t\tif (arr[curIn] < searchKey)\n\t\t\t\treturn recFind(searchKey, curIn + 1, upperbound);\n\t\t\telse\n\t\t\t\treturn recFind(searchKey, lowerbound, curIn - 1);\n\t\t}\n\t}", "static int binarySearch(int arr[], int start, int end, int target ){\n if(start>end){\n return -1;\n }\n int mid = start+(end-start)/2;\n \n if(arr[mid] == target && (mid==0 || arr[mid-1]!=target)){\n return mid;\n }\n if(arr[mid] == target){\n return mid;\n }\n if(arr[mid]>=target && arr[mid]>arr[start]){\n return binarySearch(arr,start,mid-1,target);\n }\n // else if(arr[mid]<arr[start] && arr[mid]<target){\n // return binarySearch(arr,mid+1,end,target);\n // }\n return binarySearch(arr,mid+1,end,target);\n }", "private static boolean binarySearch(int[] arr, int num, int start, int end) {\n\t\tif(arr==null || arr.length==0){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tint mid;\r\n\t\t\r\n\t\twhile(start<=end){\r\n\t\t\t\r\n\t\t\tmid= start+ (end-start)/2;\r\n\t\t\t\r\n\t\t\tif(arr[mid]==num){\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse if(num < arr[mid]){\r\n\t\t\t\tend=mid-1;\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tstart=mid+1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public static void main(String[] args) {\n\t\tint a[] = { 2, 3, 5, 6, 9, 10 };\n\t\tBinarySearch bs = new BinarySearch();\n\t\tint indexOne = bs.binarySearchAlgo(a, 0, a.length - 1, 11);\n\t\tSystem.out.println(indexOne);\n\n\t\tint indexTwo = bs.binarySearchAlgo(a, 11);\n\t\tSystem.out.println(indexTwo);\n\n\t\tint array[] = { 0, 3, 10, 10, 10, 10, 20, 25, 26 };\n\t\tint firstOccurrence = bs.firstOccurrence(array, 10);\n\t\tint lastOccurrence = bs.lastOccurrence(array, 10);\n\t\tSystem.out.println(\"First Occurrence \" + firstOccurrence + \" Last Occurrence \" + lastOccurrence);\n\n\t\tint count = bs.countDuplicateNo(array, 10);\n\t\tSystem.out.println(\"Duplicate No \" + count);\n\n\t\tint arratTwo[] = { 11, 20, 25, 30, 40, 45, 10 };\n\t\tint countRotation = bs.countRotation(arratTwo);\n\t\tSystem.out.println(\"count rotation \" + countRotation);\n\t\t\n\t\tint arrayThree[]={8,9,10,11,12,3,4,5};\n\t\tint index = bs.findElement(arrayThree,9);\n\t\tSystem.out.println(\"Element found at \"+index);\n\t}", "private static void binarySearch(int[] sortedArray, int input) {\n int first = 0;\n int last = sortedArray.length-1;\n boolean result=false;\n while (first <= last) {\n int mid = (first + last) / 2;\n if (sortedArray[mid] < input) {\n first = mid + 1;\n } else if (sortedArray[mid] > input) {\n last = mid - 1;\n } else if (sortedArray[mid] == input) {\n result=true;\n break;\n }\n }\n String result2 = \"{\";\n for(int i=-0; i< sortedArray.length;i++) {\n result2 = result2+sortedArray[i]+\",\";\n }\n result2 =result2.substring(0,result2.length()-1);\n result2 = result2+\"}\";\n if(result) {\n System.out.println(\"The input \" + input + \" was found in the array \"+result2+\".\");\n } else {\n System.out.println(\"The input \" + input + \" was not found in the array \"+result2+\".\");\n }\n }", "public static int binarySearch(int[] num, int target) {\n\t\tint left = 0;\n\t\tint right = num.length - 1;\n\t\twhile (left <= right) {\n\t\t\tint middle = (left+right)/2;\n\t\t\tif (num[middle] == target) {\n\t\t\t\treturn middle;\n\t\t\t} else if (num[middle] < target) {\n\t\t\t\tleft = middle + 1;\n\t\t\t} else {\n\t\t\t\tright = middle - 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n\t}", "public static void main(String[] args) {\n\t\tint[] array = new int[] {1,2,3,4,5,6,7,8,9};\n\t\tbinary_search(array,4);\n\t}", "public int binarySearchString(String[] s,int start,int end,String search){\r\n\t\tstart=0;\r\n\t\tend=s.length;\r\n\t\twhile(start<end){\r\n\t\t\tint mid=(start+end)/2;\r\n\t\t\tif(search.compareTo(s[mid])<0){\r\n\t\t\t\tend=mid;\r\n\t\t\t}else if(search.compareTo(s[mid])>0){\r\n\t\t\t\tstart=mid+1;\r\n\t\t\t}else{\r\n\t\t\t\treturn mid;\r\n\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn -1;\r\n\t}" ]
[ "0.77759665", "0.7644754", "0.75296074", "0.7335581", "0.73179084", "0.72217363", "0.7172971", "0.71062285", "0.7098309", "0.70637417", "0.70568836", "0.70483917", "0.70383847", "0.70250845", "0.70237374", "0.7021635", "0.7011161", "0.7000248", "0.69797295", "0.69699794", "0.6925009", "0.69237953", "0.6903546", "0.6903203", "0.689993", "0.68967575", "0.6888322", "0.6875027", "0.6869758", "0.6869332", "0.68542904", "0.68409497", "0.681161", "0.68009645", "0.67943424", "0.67888546", "0.6774961", "0.6774667", "0.67668575", "0.6756566", "0.6755873", "0.67286557", "0.67273086", "0.67069316", "0.6703404", "0.6700197", "0.6697899", "0.6695357", "0.66775984", "0.66775554", "0.66737837", "0.66701734", "0.66560245", "0.6655804", "0.6637614", "0.66219676", "0.66202796", "0.6620151", "0.6618948", "0.66161025", "0.6615476", "0.66046417", "0.65993965", "0.659324", "0.65507585", "0.6546394", "0.654189", "0.65391105", "0.65357846", "0.6520053", "0.65125966", "0.65113443", "0.65095115", "0.65087163", "0.65040123", "0.6498863", "0.6497185", "0.6497145", "0.6494041", "0.64850575", "0.6465259", "0.6461906", "0.64610094", "0.6454293", "0.64505863", "0.64479697", "0.6440871", "0.6434034", "0.6433147", "0.64295083", "0.6421372", "0.6416069", "0.63822985", "0.6378104", "0.63715863", "0.63642615", "0.6359089", "0.634361", "0.6338075", "0.6324418", "0.6324053" ]
0.0
-1
Review, this is the best.
public int findMinR2(int[] nums) { if (nums.length == 1) { return nums[0]; } if (nums[0] < nums[nums.length - 1]) { return nums[0]; } // Binary Search. R=M-1 ver. int left = 0; int right = nums.length - 1; while (left <= right) { int mid = left + (right - left) / 2; // Check if the nums[mid] is the minimum. // If the elem to the left of the mid elem is bigger than mid elem, // then mid elem is the minimum. // Be careful if the mid is 0. // The reason we need the second condition is because with the R=M-1 version of // binary search, the mid can move like index 2 => 0 => 1. In that case, // we check index 0 before index 1. If the elem at index 1 is the minimum, // then we need, // 'nums[mid] < nums[mid + 1]' // to continue when the mid is equal to 0. if ((mid != 0 && nums[mid - 1] > nums[mid]) || // (mid == 0 && nums[mid] < nums[mid + 1])) { return nums[mid]; } if (nums[mid] < nums[right]) { right = mid - 1; } else { left = mid + 1; } } return -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "public void smell() {\n\t\t\n\t}", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "public void method_4270() {}", "private stendhal() {\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "protected boolean func_70814_o() { return true; }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "private void kk12() {\n\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\n\tprotected void interr() {\n\t}", "public void mo38117a() {\n }", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "protected void mo6255a() {\n }", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "private void poetries() {\n\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "private void m50366E() {\n }", "public static void listing5_14() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "public void mo4359a() {\n }", "private Rekenhulp()\n\t{\n\t}", "private void getStatus() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public void verliesLeven() {\r\n\t\t\r\n\t}", "private static void cajas() {\n\t\t\n\t}", "protected OpinionFinding() {/* intentionally empty block */}", "@Override\r\n\tprotected void doF6() {\n\t\t\r\n\t}", "private void level7() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public final void mo91715d() {\n }", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "public void mo21792Q() {\n }", "public void redibujarAlgoformers() {\n\t\t\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\r\n \tpublic void process() {\n \t\t\r\n \t}", "public void mo21877s() {\n }", "@Override\n\tpublic void einkaufen() {\n\t}", "public void mo12930a() {\n }", "public void mo21793R() {\n }", "@Override\n protected void prot() {\n }", "private void strin() {\n\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "protected void additionalProcessing() {\n\t}", "@Override\r\n\tprotected void doF8() {\n\t\t\r\n\t}", "protected boolean func_70041_e_() { return false; }", "public void mo21795T() {\n }", "public void Tyre() {\n\t\t\r\n\t}", "public boolean method_218() {\r\n return false;\r\n }", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "public void mo9848a() {\n }", "@SuppressWarnings(\"unused\")\n\tprivate void version() {\n\n\t}", "public void mo21785J() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "public boolean method_216() {\r\n return false;\r\n }", "public boolean method_4088() {\n return false;\n }", "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "public boolean method_2453() {\r\n return false;\r\n }", "protected void method_2665() {\r\n super.method_2427(awt.field_4171);\r\n this.method_2440(true);\r\n this.method_2521(class_872.field_4244);\r\n }", "@Override\r\n\tprotected void prepare()\r\n\t{\r\n\r\n\t}", "@Override\n\tpublic int mettreAJour() {\n\t\treturn 0;\n\t}", "public void mo12628c() {\n }", "private FlyWithWings(){\n\t\t\n\t}", "public void m23075a() {\n }", "private void m50367F() {\n }", "public static void listing5_16() {\n }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public void mo21794S() {\n }", "protected MetadataUGWD() {/* intentionally empty block */}", "public boolean method_4093() {\n return false;\n }", "public void mo21779D() {\n }", "public boolean method_210() {\r\n return false;\r\n }", "private void offer() {\n\t\t\t\n\t\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "public abstract void mo70713b();", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }" ]
[ "0.6751156", "0.6724452", "0.6676678", "0.6465268", "0.6423609", "0.63078564", "0.63014656", "0.62876195", "0.6267803", "0.6267803", "0.6225906", "0.6192129", "0.61537987", "0.6136526", "0.612664", "0.6100976", "0.60959023", "0.6090814", "0.60868543", "0.6062777", "0.606201", "0.6017802", "0.6016041", "0.5998061", "0.5995087", "0.59840554", "0.5983687", "0.5969838", "0.5965272", "0.59466934", "0.59459525", "0.592945", "0.5869609", "0.579867", "0.5796336", "0.5791237", "0.5790872", "0.578323", "0.57751757", "0.5770813", "0.57669836", "0.5740847", "0.5740847", "0.5740847", "0.5740847", "0.5740847", "0.5740847", "0.5740847", "0.5734695", "0.5733196", "0.5732976", "0.571012", "0.5707873", "0.57074827", "0.5706177", "0.56980896", "0.5693791", "0.56884456", "0.56866324", "0.5680682", "0.56785023", "0.5678495", "0.5676658", "0.5672041", "0.5665391", "0.56550646", "0.56529266", "0.56511635", "0.5644137", "0.56434447", "0.56413865", "0.56352246", "0.5632325", "0.56307876", "0.5628964", "0.5628774", "0.5628512", "0.56275785", "0.5627536", "0.56244653", "0.5622793", "0.5622185", "0.5616488", "0.5614992", "0.5611294", "0.5607933", "0.56036663", "0.56036663", "0.5600284", "0.55968535", "0.5592728", "0.558829", "0.5588063", "0.5587889", "0.5581764", "0.55710036", "0.55709934", "0.55709934", "0.55702865", "0.5567034", "0.5567034" ]
0.0
-1
Stores result when all orderings are possible.
public static void main(String[] args) { long[] fact = new long[MAXDOMINOES+1]; fact[0] = 1; for (int i=1; i<=MAXDOMINOES; i++) fact[i] = (fact[i-1]*i)%MOD; Scanner stdin = new Scanner(System.in); int numCases = stdin.nextInt(); // Process each case. for (int loop=0; loop<numCases; loop++) { // Read in this case. n = stdin.nextInt(); list = new int[n][2]; for (int i=0; i<n; i++) for (int j=0; j<2; j++) list[i][j] = stdin.nextInt(); // Special case - if all the dominoes are the same, all orderings work. if (same(list)) { System.out.println(fact[n]); continue; } // dp[mask][last][orientation] will store the number of permutations using the dominoes indicated by // mask, with the last domino last facing in the direction dictated by orientation. If orientation is 0, // this is the original input orientation, if it is 1, it's flipped. long[][][] dp = new long[1<<n][n][2]; // Always 1 way to place one domino in a fixed orientation. for (int i=0; i<n; i++) { dp[1<<i][i][0] = 1; dp[1<<i][i][1] = 1; } // Outer DP loop, solve all problem instances for each subset of dominoes. for (int mask=3; mask<(1<<n); mask++) { // Now, try each domino as the last domino in mask. for (int last=0; last<n; last++) { // Not a valid state. if ((mask&(1<<last)) == 0) continue; int prevmask = mask - (1<<last); for (int i=0; i<n; i++) { if ((prevmask&(1<<i)) == 0) continue; // Both i and last are in regular orientation. if (list[i][1] == list[last][0]) dp[mask][last][0] = (dp[mask][last][0]+dp[prevmask][i][0])%MOD; // Here i is flipped and last is regular. else if (list[i][0] == list[last][0]) dp[mask][last][0] = (dp[mask][last][0]+dp[prevmask][i][1])%MOD; // i is regular but last is flipped. if (list[i][1] == list[last][1]) dp[mask][last][1] = (dp[mask][last][1]+dp[prevmask][i][0])%MOD; // Both i and last are flipped. else if (list[i][0] == list[last][1]) dp[mask][last][1] = (dp[mask][last][1]+dp[prevmask][i][1])%MOD; } } // end last loop } // end mask loop // Sum up result - all ways to place all dominoes over all possible last dominoes in either orientation. // Since we screened out our special case, no over-counting will occur here. long res = 0L; for (int last=0; last<n; last++) { res = (res + dp[(1<<n)-1][last][0])%MOD; if (list[last][0] != list[last][1]) res = (res + dp[(1<<n)-1][last][1])%MOD; } System.out.println(res); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String processOrder() {\n notifyAllObservers();\n\n return getOrderReport();\n }", "public void makeComplete(Order order) {}", "public void saveOrder() {\n setVisibility();\n Order order = checkInputFromUser();\n if (order == null){return;}\n if(orderToLoad != null) DBSOperations.remove(connection,orderToLoad);\n DBSOperations.add(connection, order);\n }", "@Override\n public void execute() {\n modelFacade.getFoodItems().addAll(modelFacade.fetchMatchingFoodItemResults(sb.toString()));\n }", "@SuppressWarnings(\"unchecked\")\n @Override\n protected void publishResults(CharSequence constraint, FilterResults results) {\n items = (ArrayList<WorkOrder>)results.values;\n notifyDataSetChanged();\n\n }", "@Override\n\tpublic void confirmOrders() {\n\t\t\n\t}", "@Override\n\tpublic void confirmOrders() {\n\t\t\n\t}", "@Override\n\tpublic void confirmOrders() {\n\t\t\n\t}", "private void validOrderResult() {\n TreeNode currentTreeNode = treeLeaf;\n TreeNode orderTreeNode = null;\n while (!(currentTreeNode instanceof SourceTreeNode)) {\n if (currentTreeNode instanceof OrderGlobalTreeNode) {\n orderTreeNode = currentTreeNode;\n break;\n } else {\n currentTreeNode = UnaryTreeNode.class.cast(currentTreeNode).getInputNode();\n }\n }\n if (null != orderTreeNode) {\n OrderGlobalTreeNode orderGlobalTreeNode = OrderGlobalTreeNode.class.cast(orderTreeNode);\n TreeNode aggTreeNode = orderTreeNode.getOutputNode();\n while (aggTreeNode != null && aggTreeNode.getNodeType() != NodeType.AGGREGATE) {\n aggTreeNode = aggTreeNode.getOutputNode();\n }\n if (null != aggTreeNode) {\n if (aggTreeNode instanceof FoldTreeNode) {\n TreeNode inputTreeNode = UnaryTreeNode.class.cast(aggTreeNode).getInputNode();\n if (inputTreeNode == orderTreeNode) {\n return;\n }\n UnaryTreeNode inputUnaryTreeNode = UnaryTreeNode.class.cast(inputTreeNode);\n if (inputUnaryTreeNode.getInputNode() == orderTreeNode &&\n (inputUnaryTreeNode instanceof EdgeVertexTreeNode &&\n EdgeVertexTreeNode.class.cast(inputUnaryTreeNode).getDirection() != Direction.BOTH)) {\n return;\n }\n String orderLabel = orderGlobalTreeNode.enableOrderFlag(labelManager);\n SelectOneTreeNode selectOneTreeNode = new SelectOneTreeNode(new SourceDelegateNode(inputUnaryTreeNode, schema), orderLabel, Pop.last, Lists.newArrayList(), schema);\n selectOneTreeNode.setConstantValueType(new ValueValueType(Message.VariantType.VT_INTEGER));\n OrderGlobalTreeNode addOrderTreeNode = new OrderGlobalTreeNode(inputUnaryTreeNode, schema,\n Lists.newArrayList(Pair.of(selectOneTreeNode, Order.incr)));\n UnaryTreeNode.class.cast(aggTreeNode).setInputNode(addOrderTreeNode);\n }\n } else {\n if (treeLeaf instanceof OrderGlobalTreeNode) {\n return;\n }\n TreeNode currTreeNode = orderTreeNode.getOutputNode();\n boolean hasSimpleShuffle = false;\n while (currTreeNode != null) {\n if (currTreeNode.getNodeType() == NodeType.FLATMAP\n || (currTreeNode instanceof PropertyNode &&\n !(UnaryTreeNode.class.cast(currTreeNode).getInputNode().getOutputValueType() instanceof EdgeValueType))) {\n hasSimpleShuffle = true;\n break;\n }\n currTreeNode = currTreeNode.getOutputNode();\n }\n if (!hasSimpleShuffle) {\n return;\n }\n\n UnaryTreeNode outputTreeNode = UnaryTreeNode.class.cast(treeLeaf);\n if (outputTreeNode.getInputNode() == orderTreeNode) {\n if (outputTreeNode instanceof EdgeVertexTreeNode &&\n EdgeVertexTreeNode.class.cast(outputTreeNode).getDirection() != Direction.BOTH) {\n return;\n }\n if (orderTreeNode.getOutputValueType() instanceof EdgeValueType && outputTreeNode instanceof PropertyNode) {\n return;\n }\n }\n String orderLabel = orderGlobalTreeNode.enableOrderFlag(labelManager);\n SelectOneTreeNode selectOneTreeNode = new SelectOneTreeNode(new SourceDelegateNode(treeLeaf, schema), orderLabel, Pop.last, Lists.newArrayList(), schema);\n selectOneTreeNode.setConstantValueType(new ValueValueType(Message.VariantType.VT_INTEGER));\n treeLeaf = new OrderGlobalTreeNode(treeLeaf, schema,\n Lists.newArrayList(Pair.of(selectOneTreeNode, Order.incr)));\n }\n }\n }", "public void receiveResultorderQuery(\n com.xteam.tourismpay.PFTMXStub.OrderQueryResponse result) {\n }", "public void orderPlace() {\n Log.d(\"Method\", \"orderPlaced()\");\n\n if (coffeeCount < getResources().getInteger(R.integer.min_coffee)) {\n Log.e(\"\", \"coffeeCount < minimum coffee order\");\n displayMessage(String.format(Locale.getDefault(), getString(R.string.min_order_message), getResources().getInteger(R.integer.min_coffee)));\n } else if (coffeeCount > getResources().getInteger(R.integer.max_coffee)) {\n Log.e(\"\", \"coffeeCount > maximum coffee order\");\n displayMessage(String.format(Locale.getDefault(), getString(R.string.max_order_message), getResources().getInteger(R.integer.max_coffee)));\n } else {\n Log.i(\"\", \"Order placed: \" + coffeeCount + \" coffee.\");\n displayMessage(String.format(Locale.getDefault(), getString(R.string.order_thanks), 176));\n }\n resetQuantity();\n }", "public void confirmPrepared() {\n getCurrentOrder().setPrepared(true);\n getRestaurant().getOrderSystem().preparedOrder(getCurrentOrder());\n EventLogger.log(\"Order #\" + getCurrentOrder().getOrderNum() + \" has been prepared by chef \" + this.getName());\n doneWithOrder();\n }", "@Override\n public void deliverResult(Cursor data) {\n mOrderData = data;\n super.deliverResult(data);\n }", "private void setQueryResults(final QueryResultBundle bundle){\n\t\t// Get the sort info\n\t\tthis.synapseClient.getSortFromTableQuery(this.startingQuery.getSql(), new AsyncCallback<List<SortItem>>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSuccess(List<SortItem> sortItems) {\n\t\t\t\tsetQueryResultsAndSort(bundle, sortItems);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\tshowError(caught);\n\t\t\t}\n\t\t});\n\n\t}", "public void processOrders() \n\t{\n\t\tfor(int index = 0; index < orderList.size(); index++)\n\t\t{\t\n\t\t\t//process the order and possibly promote the customer object\n\t\t\tcustomerArrayHolder.processOrder(orderList.get(index));\n\t\t}\n\t\torderList.clear(); //should prevent memory leaks, not sure if necessary\n\t}", "public void run(){\n ArrayList<ArrayList<Furniture>> all = getSubsets(getFoundFurniture());\n ArrayList<ArrayList<Furniture>> valid = getValid(all);\n ArrayList<ArrayList<Furniture>> ordered = comparePrice(valid);\n ArrayList<ArrayList<Furniture>> orders = produceOrder();\n checkOrder(orders, false);\n }", "private void setAllLocalResults() {\n TreeMap<FlworKey, List<FlworTuple>> keyValuePairs = mapExpressionsToOrderedPairs();\n // get only the values(ordered tuples) and save them in a list for next() calls\n keyValuePairs.forEach((key, valueList) -> valueList.forEach((value) -> _localTupleResults.add(value)));\n\n _child.close();\n if (_localTupleResults.size() == 0) {\n this._hasNext = false;\n } else {\n this._hasNext = true;\n }\n }", "public void addOrders() {\n\t\torders.stream()\n\t\t\t.forEach(db::store);\n\t}", "@Override\n\tpublic void getOrders() {\n\t\t\n\t}", "protected void processOrder( Game game )\n {\n }", "void getOrders();", "@Override\n\tpublic void accept_order() {\n\t\t\n\t}", "public Order viewOrders() {\r\n\t\tEntityManager em = emfactory.createEntityManager();\r\n\t\tem.getTransaction().begin();\r\n\t\t//Order nextOrder = \r\n\t\treturn nextOrder;\r\n\t}", "@Override\n\tpublic void placeOrder() {\n\t\t\n\t}", "public void saveResults(){\n //Tell adapter to save gathered data\n //Call appropriate function\n }", "void order() {\n\n\t\tSystem.out.println(\"In Zomato order method\");\n\t\tclass Hotels {\n\t\t\tString name;\n\t\t\tHotels(String name ) {\n\t\t\t\tthis.name = name;\n\t\t\t}\n\n\t\t\tvoid orderPlaced() {\n\t\t\t\tSystem.out.println(\"Order placd at hotel \"+ name);\n\t\t\t}\n\t\t}\n\t}", "public void provideOrderAccess() {\n\t\tint choiceOrder = View.NO_CHOICE;\n\t\t// get customer id and date for the order\n\t\tLong customerId = view.readIDWithPrompt(\"Enter Customer ID for Order: \");\n\t\tif (customerId == null) {\n\t\t\tSystem.out.println(\"Error: Customer Not Found.\");\n\t\t}\n\t\tLong orderId = view.readIDWithPrompt(\"Enter new Unique ID for Order: \");\n\t\tDate currDate = new Date();\n\n\t\t// create the order,\n\t\t// add the orderID to Customer\n\t\tatMyService.placeOrder(customerId, orderId, currDate);\n\n\t\t// enter loop to add items to the order\n\t\tArrayList<Long[]> items = new ArrayList<Long[]>();\n\t\twhile (choiceOrder != View.ENDORDER) {\n\t\t\t// display the order menu\n\t\t\tview.menuOrder();\n\t\t\tchoiceOrder = view.readIntWithPrompt(\"Enter choice: \");\n\t\t\tswitch (choiceOrder) {\n\t\t\t\tcase View.ADD_ORDER_ITEM:\n\t\t\t\t\tLong itemID = view.readIDWithPrompt(\"Enter Item ID: \");\n\t\t\t\t\t// note: Needs to be Long for Long[] below. \n\t\t\t\t\t//Also, i DO want to use readID rather than readInt then convert to long,\n\t\t\t\t\t// because I do not want amt to be negative. \n\t\t\t\t\tLong amt = view.readIDWithPrompt(\"Enter Amount: \");\n\t\t\t\t\t// check to see if the item exists and is in stock\n\t\t\t\t\tItem temp = atMyService.findItem(itemID);\n\t\t\t\t\tif (temp == null) {\n\t\t\t\t\t\tSystem.out.println(\"Item '\" + itemID + \"' not found. Item skipped.\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ((temp.getStock() - amt) < 0) {\n\t\t\t\t\t\t\tSystem.out.println(\"There is only '\" + temp.getStock() + \"' of this item left. Please try again.\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// add the items to the arrayList\n\t\t\t\t\t\t\tLong[] toAdd = { itemID, amt };\n\t\t\t\t\t\t\titems.add(toAdd);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase View.ENDORDER:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// convert arrayList to array, add to orders.\n\t\tif (!(items.isEmpty())) {\n\t\t\tLong[][] array = new Long[items.size()][2];\n\t\t\tfor (int i = 0; i < items.size(); i++) {\n\t\t\t\tarray[i][0] = items.get(i)[0];\n\t\t\t\tarray[i][1] = items.get(i)[1];\n\t\t\t}\n\t\t\tatMyService.addOrderItems(orderId, array);\n\t\t}\n\t}", "@Override\r\n\tprotected void process() {\n\t\tconsultarSustentoProxy.setCodigoActvidad(codigo_actividad);\r\n\t\tconsultarSustentoProxy.setCodigoCliente(codigo_cliente);\r\n\t\tconsultarSustentoProxy.setCodigoPLan(codigo_plan);\r\n\t\tconsultarSustentoProxy.execute();\r\n\t}", "private void btnCompleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCompleteActionPerformed\n DBManager db = new DBManager();\n \n for(Map.Entry<Integer, OrderLine> olEntry : loggedInCustomer.findLatestOrder().getOrderLines().entrySet())\n {\n OrderLine actualOrderLine = olEntry.getValue();\n Product orderedProduct = actualOrderLine.getProduct();\n \n orderedProduct.setStockLevel(orderedProduct.getStockLevel() - olEntry.getValue().getQuantity());\n db.updateProductAvailability(orderedProduct); \n }\n \n loggedInCustomer.findLatestOrder().setStatus(\"Complete\");\n db.completeOrder(orderId); \n \n Confirmation confirmation = new Confirmation(loggedInCustomer, orderId);\n this.dispose();\n confirmation.setVisible(true);\n \n }", "public void onSuccess(Token token) {\n placeOrder(token);\n\n progressDialog.dismiss();\n\n // Proceed to confirmation activity\n proceedToConfirmation();\n }", "public void queryCurrent() {\n if (this.bizOrderIds != null && this.currentID >= 0 && this.currentID < this.bizOrderIds.size()) {\n BusinessRequest.getBusinessRequest().requestOrderDetail(Long.valueOf(Long.parseLong(this.bizOrderIds.get(this.currentID))), new BizRequestListener<OrderDetailMO>(new WeakReference((BaseActivity) this.mActivityContext)) {\n public boolean onError(int resultCode, String msg) {\n QRDialog.this.queryAgain();\n return true;\n }\n\n public void onSuccess(OrderDetailMO data) {\n QRDialog.this.results[QRDialog.this.currentID] = data;\n if ((!\"BUYER_PAYED_DEPOSIT\".equals(data.getOrderInfo().getOrderStatusCode()) || QRDialog.this.prePay) && !\"WAIT_BUYER_PAY\".equals(data.getOrderInfo().getOrderStatusCode())) {\n QRDialog.this.queryNext();\n } else {\n QRDialog.this.queryAgain();\n }\n }\n\n public boolean ifFinishWhenCloseErrorDialog() {\n return false;\n }\n });\n }\n }", "public void findAllMyOrders() {\n log.info(\"OrdersBean : findAllMyOrders\");\n FacesContext context = FacesContext.getCurrentInstance();\n\n ordersEntities = ordersServices.findAllByIdUsersAndStatusIsValidateOrCanceled(usersBean.getUsersEntity().getId());\n if (ordersEntities.isEmpty()) {\n context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, JsfUtils.returnMessage(getLocale(), \"fxs.modalContractsOrder.listOrderEmpty\"), null));\n } else {\n deadlineLeasing();\n }\n }", "public OrderResponseBuilder result(OrderResult result) {\r\n orderResponse.setResult(result);\r\n return this;\r\n }", "private synchronized void addResultToMultiList() {\n\t addObjectToMultiList(resultArrayList);\r\n\t }", "public static void viewOrder() {\n\t\tSystem.out.print(\"\\t\\t\");\n\t\tSystem.out.println(\"************Viewing existing orders************\");\n\t\t// TODO - implement RRPSS.viewOrder\n\t\tOrderManager orderManager = new OrderManager();\n\t\tList listOfOrders = orderManager.viewOrder();\n\n\t\tOrderedItemManager orderedItemManager = new OrderedItemManager();\n\t\tList listOfOrderedItems = null;\n\t\tOrderedPackageManager orderedPackageManager = new OrderedPackageManager();\n\t\tList listOfOrderedPromotionalPackage = null;\n\n\t\tint i = 0;\n\t\tint choice = 0;\n\t\tOrder order = null;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tif (listOfOrders.size() == 0) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"There is no orders!\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// print the list of orders for the user to select from.\n\t\t\tfor (i = 0; i < listOfOrders.size(); i++) {\n\t\t\t\torder = (Order) listOfOrders.get(i);\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.println((i + 1) + \") Order: \" + order.getId()\n\t\t\t\t\t\t+ \" | Table: \" + order.getTable().getId());\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\tSystem.out.print(\"Select an order to view the item ordered: \");\n\t\t\tchoice = Integer.parseInt(sc.nextLine());\n\n\t\t\torder = (Order) listOfOrders.get(choice - 1);\n\n\t\t\tlistOfOrderedItems = orderedItemManager\n\t\t\t\t\t.retrieveOrderedItemsByOrderID(order.getId());\n\t\t\tlistOfOrderedPromotionalPackage = orderedPackageManager\n\t\t\t\t\t.retrieveOrderedPackageByOrderID(order.getId());\n\n\t\t\tif (listOfOrderedItems.size() == 0\n\t\t\t\t\t&& listOfOrderedPromotionalPackage.size() == 0) {\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\t\tSystem.out.println(\"Order is empty!\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tSystem.out.println();\n\t\t\tif (listOfOrderedItems.size() > 0) {\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.println(\"All Cart Items Ordered:\");\n\n\t\t\t\tfor (int j = 0; j < listOfOrderedItems.size(); j++) {\n\t\t\t\t\tOrderedItem orderedItem = (OrderedItem) listOfOrderedItems\n\t\t\t\t\t\t\t.get(j);\n\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\t\tSystem.out.println((j + 1) + \") ID: \"\n\t\t\t\t\t\t\t+ orderedItem.getItem().getId() + \" | Name: \"\n\t\t\t\t\t\t\t+ orderedItem.getItem().getName() + \" | $\"\n\t\t\t\t\t\t\t+ orderedItem.getPrice());\n\t\t\t\t}\n\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\n\t\t\tif (listOfOrderedPromotionalPackage.size() > 0) {\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.println(\"Promotional Packages Ordered:\");\n\n\t\t\t\tfor (int j = 0; j < listOfOrderedPromotionalPackage.size(); j++) {\n\t\t\t\t\tOrderedPackage orderedPackage = (OrderedPackage) listOfOrderedPromotionalPackage\n\t\t\t\t\t\t\t.get(j);\n\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\t\tSystem.out.println((j + 1) + \") ID: \"\n\t\t\t\t\t\t\t+ orderedPackage.getPackage().getId() + \" | Name: \"\n\t\t\t\t\t\t\t+ orderedPackage.getPackage().getName() + \" | $\"\n\t\t\t\t\t\t\t+ orderedPackage.getPrice());\n\t\t\t\t}\n\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\n\t\tcatch (Exception e) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"Invalid Input!\");\n\t\t}\n\t\tSystem.out.print(\"\\t\\t\");\n\t\tSystem.out.println(\"************End of viewing orders************\");\n\t}", "private void orderCompleted(ArrayList<Transaction> transactionList) {\n String customerName = studentDetails[0].getName();\n String customerMobile = studentDetails[0].getMobile();\n String customerEmail = studentDetails[0].getEmail();\n Order order = new Order(-1, customerName, customerMobile, customerEmail\n , \"\",\n total, discount, false);\n\n ArrayList<SubOrder> subOrderList = new ArrayList<>();\n\n for (CartItem cartItem : cartList) {\n ProductHeader product = cartItem.getProductHeader();\n subOrderList.add(new SubOrder(product.getName(), product.getId(),\n product.getSku(), cartItem.getPrice(), cartItem.getQuantity(),\n 0, 0, 0, 0, false));\n }\n\n ProductAPI.saveAndSyncOrder(getContext(), db, order, subOrderList, transactionList);\n\n Toast.makeText(getContext(), \"Order completed\", Toast.LENGTH_SHORT).show();\n cartList.clear();\n cartAdapter.notifyDataSetChanged();\n updatePriceView();\n\n cartRecyclerView.setVisibility(View.GONE);\n emptyCartView.setVisibility(View.VISIBLE);\n dismissDialog();\n }", "public void deliverResult(List<VehiclesTotalRunningCosts> data) {\n super.deliverResult(data);\n }", "private void orderItem(HttpServletRequest request, HttpServletResponse response) {\n\t\t\n\t}", "@Override\n protected void onStop() {\n super.onStop();\n\n // We need an Editor object to make preference changes\n SharedPreferences.Editor editor = sharedPreferences.edit();\n // persist preferences that are not set by the Preferences Fragment\n editor.putString(DEFAULT_QUERY_PATH, sortOrderOfResults);\n // Note: for preferences that are set by the Preferences Fragment no additional\n // actions to ensure their persistance are needed. However, if the user has chosen the\n // option not to save the changes upon exit\n\n // Commit the edits\n editor.apply();\n }", "@Override\n\tpublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tif (resultCode == Activity.RESULT_OK) {\n\t\t\treadOrdersInfo();\n\t\t}\n\t\telse if (resultCode == RESULT_CANCEL_WITHOUT_BIND_ORDERS) {\n\t\t\treadOrdersInfo();\n\t\t\tToast.makeText(getActivity().getApplicationContext(), \"未能绑定全部订单!\", Toast.LENGTH_SHORT).show();\n\t\t}\n\n\t}", "@Override\n\tpublic void getSpecificOrders() {\n\t\t\n\t}", "@Override\n\tpublic void getSpecificOrders() {\n\t\t\n\t}", "@Override\r\n public void executeReinforcement() {\r\n notifyView();\r\n\r\n Integer getReinforcementCountFromCards = getReinforcementCountFromValidCardsAI();\r\n Integer totalReinforcementArmyCount = getReinforcementCountFromCards + calculateReinforcementArmy();\r\n ReinforcementPhaseState reinforcementPhase = new ReinforcementPhaseState();\r\n reinforcementPhase.setNumberOfArmiesReceived(totalReinforcementArmyCount);\r\n\r\n reinforcementPhaseState.add(reinforcementPhase);\r\n\r\n notifyView();\r\n placeArmy(totalReinforcementArmyCount);\r\n\r\n }", "void finishOrder(int orderId);", "public void calculatePriceOrder() {\n log.info(\"OrdersBean : calculatePriceOrder!\");\n this.priceOrder = 0;\n for (ContractsEntity c : contractsBean.getContractsEntities()\n ) {\n this.priceOrder += c.getFinalPrice();\n }\n }", "private void acceptOrder() {\n buttonAcceptOrder.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n order.setDriver(ParseUser.getCurrentUser());\n order.saveInBackground();\n Log.i(TAG, \"driver!!: \" + order.getDriver().getUsername());\n ParseUser.getCurrentUser().put(KEY_HAS_ORDER, true);\n ParseUser.getCurrentUser().saveInBackground();\n\n finish();\n }\n });\n }", "void processResponse(OrdersRes ordersRes){\n openOrders.clear();\n for (OrdersRes.Order order : ordersRes.getOrders()) {\n Order order_ = new Order();\n if(order.getStatus() == 1) {\n order_.setId(order.getId());\n order_.setVendor_id(order.getVendorId());\n if(order.getCustomer() != null){\n order_.setCustomer(WordUtils.capitalize(order.getCustomer().getName()));\n order_.setCustomer_address(order.getCustomer().getCustomerAddress().getAddress());\n order_.setCustomer_landmark(order.getCustomer().getCustomerAddress().getLandmark());\n }\n order_.setQuantity(order.getQuantity());\n order_.setStatus(order.getStatus());\n order_.setDate(DateTime.ServerFormatToCustom(order.getCreated_date(),\"d MMM\"));\n openOrders.add(order_);\n }\n }\n\n openOrdersListAdapter.notifyDataSetChanged();\n\n // update customers list\n //orderHistoryPagesAdapter.updateOrdersOpenFragment(openOrders);\n //orderHistoryPagesAdapter.updateOrdersClosedFragment(closedOrders);\n //orderHistoryPagesAdapter.notifyDataSetChanged();\n }", "public void doneOrder(){\n setId(++count);\n }", "public void onSuccess(List<GwtStepVerficationResult> result)\r\n\t\t\t\t{\n\t\t\t\t\tCollections.sort(result, new Comparator<GwtStepVerficationResult>()\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\t\tpublic int compare(GwtStepVerficationResult o1, GwtStepVerficationResult o2)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif (o1.getStep() == null\r\n\t\t\t\t\t\t\t\t\t\t\t|| o2.getStep() == null)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\treturn o1.getStep().getDescription().compareTo(o2.getStep().getDescription());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\t\t\t\t\t\r\n\t\t\t\t\tlistOfSteps = result;\t\r\n\t\t\t\t\tCreateStepGrid();\r\n\t\t\t\t}", "@Override\n public void realmTransaction(MainModelImp res) {\n realm.executeTransaction(realmT -> {\n RealmResults<MainModelImp> current = getRealmResults(res.getLocation().getLatitude(), res.getLocation().getLongitude());\n current.deleteAllFromRealm();\n MainModelImp cache = realmT.createObject(MainModelImp.class);\n cache.setLat(res.getLocation().getLatitude());\n cache.setLon(res.getLocation().getLongitude());\n for (Nearby_restaurant nearby : res.getNearby_restaurants()) {\n cache.getNearby_restaurants().add(nearby);\n }\n });\n\n }", "void order(Pizza pizza) {\n order.add(pizza);\n }", "@Override\n public ArrayList<Order> getAllAvailableOrders() throws PersistenceException{ //list is the interface\n return new ArrayList<Order>(orders.values()); //ArrayList is the class that implements the List\n }", "@Override\n\tpublic void execute(final CheckoutActionContext context) throws EpSystemException {\n\t\tcheckoutEventHandler.preCheckoutOrderPersist(context.getShoppingCart(),\n\t\t\t\tcontext.getOrderPaymentList(), context.getOrder());\n\n\t\t//process and update order - should limit our updates to once\n\t\tfinal Order updatedOrder = orderService.processOrderOnCheckout(context.getOrder(),\n\t\t\t\tcontext.getShoppingCart().isExchangeOrderShoppingCart());\n\t\tcontext.setOrder(updatedOrder);\n\t\tcontext.setOrderPaymentList(updatedOrder.getOrderPayments());\n\t}", "public void acceptResult(ArrayList<Stock> stocks){\n searchResult.clear();\n //if no matching result\n if(stocks.size() == 0){\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setMessage(\"Data for stock symbol not found.\");\n builder.setTitle(\"Symbol Not Found\");\n AlertDialog dialog = builder.create();\n dialog.show();\n }\n //if only one matching result, add it to stock list directly\n else if(stocks.size() == 1){\n validateAdd(stocks.get(0));\n updatePrice();\n }\n //if multiple matching results\n else{\n searchResult.addAll(stocks);\n handleResultShow();\n }\n\n }", "public void listOrder()\r\n {o.listOrder();}", "@Override\n\tpublic void getMarketOrders() {\n\t\t\n\t}", "@Override\n\tpublic void getMarketOrders() {\n\t\t\n\t}", "public void saveResults();", "List<Inventory> executeOrder(OrderForm orderForm) throws Exception;", "@Override\n public void sure() {\n onOrderUpdate();\n orderListAdpater.notifyDataSetChanged();\n }", "@Override\n public void sure() {\n onOrderUpdate();\n orderListAdpater.notifyDataSetChanged();\n }", "public HashMap<Integer, ExecutedOrder> getExecutedOrders(){\n\t\treturn hmExecutedOrder;\n\t}", "public void queryOrder(){\n\t\ttry{\n\t\t\tlock.lock();\n\t\t\tSystem.out.println(Thread.currentThread().getName()+\"查询到数据:\"+System.currentTimeMillis());\n\t\t\tThread.sleep(2000);\n\t\t}catch( Exception e){\n\t\t\te.printStackTrace();\n\t\t}finally{\n\t\t\tlock.unlock();\n\t\t}\n\t}", "@Override\n public Map.Entry<Order, Integer> process(int resultOrder, Map<String, Order> orderMap) {\n Order answerValuableOrder = null;\n Integer answerOrderValue =(resultOrder == OrderMetric.HIGHEST? -1 : Integer.MAX_VALUE);\n Integer orderValue;\n\n for(Order order : orderMap.values()){\n Integer counter;\n\n orderValue=0;\n //For each order item\n for(OrderItem item : order.getItems()) {\n orderValue += item.getPrice_cents()*item.getQuantity();\n }\n if(resultOrder == OrderMetric.HIGHEST) {\n if (orderValue > answerOrderValue) {\n answerValuableOrder = order;\n answerOrderValue = orderValue;\n }\n }else\n if(orderValue < answerOrderValue) {\n answerValuableOrder = order;\n answerOrderValue = orderValue;\n }\n }\n return new HashMap.SimpleEntry<>(answerValuableOrder, answerOrderValue);\n }", "protected boolean gotResult (SurveyQuestion result) {\n _cache.questionUpdated(_survey, _questionIndex, result);\n Link.replace(Pages.ADMINZ, \"survey\", \"e\", _survey.surveyId);\n return true;\n }", "@Override\r\n public void onSuccess(OrderProxy response)\r\n {\n }", "@Override\r\n public void onSuccess(OrderProxy response)\r\n {\n }", "@Override\r\npublic List<Order> getallorders() {\n\treturn productdao.getalloderds();\r\n}", "@Override\n public void onSuccess(ArrayList<CheckInProposal> results) {\n mapTreatmentCheckIn = createMapTreatmentCheckInFromProposal(results);\n\n medications = extractMedicationsFromProposal(results);\n symptoms = extractSymptomsFromProposal(results);\n\n total = medications.size() + symptoms.size();\n count = 0;\n\n if (total > 0)\n nextStep();\n }", "@Override\n\tpublic boolean PlaceOrder(Order order) {\n\t\treturn false;\n\t}", "public void postResult(int result, int index) {\n for (int i = 0; i < table.length; i++) {\n if (table[i] != null && table[i].isBusy()) {\n if (table[i].getQj() != null && table[i].getQj() == index) {\n InstructionBase instructionBase = table[i].getInstruction();\n ReservationStationEntry reservationStationEntry = new ReservationStationEntry(instructionBase, null, false);\n reservationStationEntry.setVj(result);\n table[i] = reservationStationEntry;\n }\n\n }\n }\n\n //LOGGER.info(\"after set result reorderBufferEntry index #\"+index+\" qj \"+reservationStationEntry.getQj()+\" vj \"+reservationStationEntry.getVj());\n }", "private void sendResultQueue() {\n\t\tfor (PluginResult pluginResult : resultQueue) {\n\t\t\tmainCallback.sendPluginResult(pluginResult);\n\t\t}\n\t\tresultQueue.clear();\n\t}", "public void writeResults() {\n gfmBroker.storeResults(this.responses, fileOutputPath);\n }", "public boolean cakeOrdered() {\n\t\tordered = true;\n\t\tSystem.out.println(\"Your \" +name+ \" order has been placed\");\n\t\treturn ordered;\n\t}", "public void result() {\n\t\tthis.animais = new ArrayList<Animal>();\n\t\tanimais = relProducaoFacade.relAnimaisPorEntrada(rebanhosMarcados, inicio, fim);\n\t\tcriaGraficoPizza();\t\t\n\t\tinicializaEntradas();\n\t}", "public void orderAlphabet(){\n market.orderAlphabet();\n car = market.products;\n }", "protected JSONObject successMessage(JSONObject jsonOrder) throws Exception {\n processedOrders.get().put(processedOrders.get().length(), jsonOrder);\n return super.successMessage(jsonOrder);\n }", "private void results() {\n\t\t// when the election is not closed,\n\t\ttry{\n\t\t\tMap<String,Integer> results = election.getResultsFromPolls();\n\t\t\t// when the election is closed,\n\n\t\t\tCollection<Integer> values = results.values();\n\t\t\tint totalVotes = 0;\n\n\t\t\tfor(Integer i:values){\n\t\t\t\ttotalVotes += i;\n\t\t\t}\n\t\t\tSystem.out.println(\"Current election results for all polling places.\");\n\t\t\tSystem.out.println(\"NAME PARTY VOTES %\");\n\t\t\tprintResultsHelper(results,totalVotes);\n\n\t\t}catch(UnsupportedOperationException uoe){\n\t\t\tSystem.out.println(\"The election is still open for votes.\");\n\t\t\tSystem.out.println(\"You must close the election before viewing results.\");\n\t\t}\n\t}", "@Override\n public void setFinished() {\n finishedBanking = true;\n }", "private void perPollingPlaceResults() {\n\t\tif (election.pollsStatus()){\n\t\t\t// when the election is not closed,\n\t\t\tSystem.out.println(\"The election is still open for votes.\");\n\t\t\tSystem.out.println(\"You must close the election before viewing results.\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry{\n\t\t\tString pollingPlaceName = ValidInputReader.getValidString(\"Name of polling place:\", \"^[a-zA-Z0-9 ]+$\");\n\t\t\tMap<String,Integer> results = election.resultsForSpecficPollingPlace(pollingPlaceName);\n\t\t\tCollection<Integer> values = results.values();\n\t\t\tint totalVotes = 0;\n\n\t\t\tfor(Integer i:values){\n\t\t\t\ttotalVotes += i;\n\t\t\t}\n\n\t\t\t// when the polling place exists,\n\t\t\tSystem.out.println(\"Current election results for \" + pollingPlaceName + \".\");\n\t\t\tSystem.out.println(\"NAME PARTY VOTES %\");\n\t\t\tprintResultsHelper(results,totalVotes);\n\n\t\t}catch(UnsupportedOperationException uoeError){\n\n\n\t\t}catch(IllegalArgumentException iaeError){\n\t\t\t// when the polling place doesn't exist,\n\t\t\tSystem.out.println(\"No such polling place was found.\");\n\t\t}\n\t}", "@Override\n public void onSuccess(Location location) {\n if (location != null) {\n latitude = location.getLatitude();\n longitude = location.getLongitude();\n finalList = adapter.getMenu();\n Order newOrder = new Order();\n newOrder.setVendor(Id);\n newOrder.setCustomer(userID);\n newOrder.setCustomerLocation(latitude+\",\"+longitude);\n newOrder.setVendorName(curr.getName());\n newOrder.setDate(new SimpleDateFormat(\"dd/MM/yyyy\", Locale.getDefault()).format(new Date()));\n HashMap<String, CartItem> newCart = new HashMap<>();\n float amount = 0;\n for (MenuItem item : finalList) {\n if (!item.getQuantity().equals(\"0\")) {\n amount += Integer.parseInt(item.getQuantity()) * Integer.parseInt(item.getPrice());\n newCart.put(item.getName(), new CartItem(item.getPrice(), item.getQuantity()));\n }\n }\n if(newCart.size()==0)\n {\n Toast.makeText(restrauntPage.this, \"Please add atleast 1 item\", Toast.LENGTH_SHORT).show();\n return;\n }\n amount = amount * 1.14f;\n newOrder.setTotalAmount(String.valueOf(amount));\n newOrder.setItemsOrdered(newCart);\n Log.d(\"checkout\", newOrder.toString());\n Intent mainIntent = new Intent(restrauntPage.this, paymentOrder.class);\n mainIntent.putExtra(\"order\",newOrder);\n mainIntent.putExtra(\"userId\",userID);\n mainIntent.putExtra(\"userInfo\",currUser);\n startActivity(mainIntent);\n finish();\n }\n }", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n initiateOrder(request, response);\n }", "@Override\n public void sure() {\n orderListAdpater.notifyDataSetChanged();\n onOrderUpdate();\n }", "void getMarketOrders();", "public void execute(){\n\t\tnew PayCarOrderTask().execute();\n\t}", "public static Result confirmOrder(Orders orderObj){\n \n Result result = Result.FAILURE_PROCESS;\n MysqlDBOperations mysql = new MysqlDBOperations();\n ResourceBundle rs = ResourceBundle.getBundle(\"com.generic.resources.mysqlQuery\");\n Connection conn = mysql.getConnection();\n PreparedStatement preStat;\n boolean isSuccessInsertion;\n \n// if(!Checker.isValidDate(date))\n// return Result.FAILURE_CHECKER_DATE;\n\n try{ \n String order_id = Util.generateID();\n \n preStat = conn.prepareStatement(rs.getString(\"mysql.order.update.insert.1\"));\n preStat.setString(1, order_id);\n preStat.setString(2, \"1\" );\n preStat.setInt(3, 0);\n preStat.setLong(4, orderObj.getDate());\n preStat.setLong(5, orderObj.getDelay());\n preStat.setString(6, orderObj.getNote());\n preStat.setDouble(7, -1);\n preStat.setString(8, orderObj.getUserAddressID());\n preStat.setString(9, orderObj.getDistributerAddressID());\n \n \n if(preStat.executeUpdate()==1){\n List<OrderProduct> orderProductList = orderObj.getOrderProductList();\n isSuccessInsertion = orderProductList.size()>0;\n\n // - * - If process fail then break operation\n insertionFail:\n for(OrderProduct orderProduct:orderProductList){\n preStat = conn.prepareStatement(rs.getString(\"mysql.orderProduct.update.insert.1\"));\n preStat.setString(1, order_id);\n preStat.setString(2, orderProduct.getCompanyProduct_id());\n preStat.setDouble(3, orderProduct.getQuantity());\n\n if(preStat.executeUpdate()!=1){\n isSuccessInsertion = false;\n break insertionFail;\n }\n }\n\n // - * - Return success\n if(isSuccessInsertion){\n mysql.commitAndCloseConnection();\n return Result.SUCCESS.setContent(\"Siparişiniz başarılı bir şekilde verilmiştir...\");\n }\n\n // - * - If operation fail then rollback \n mysql.rollbackAndCloseConnection();\n }\n\n } catch (Exception ex) {\n mysql.rollbackAndCloseConnection();\n Logger.getLogger(DBOrder.class.getName()).log(Level.SEVERE, null, ex);\n return Result.FAILURE_PROCESS.setContent(ex.getMessage());\n } finally {\n mysql.closeAllConnection();\n } \n\n return result;\n }", "@Override\n public void sure() {\n orderListAdpater.notifyDataSetChanged();\n onOrderUpdate();\n }", "@Override\n\tpublic void doManuallyLoadResult(final S criteria, final T result) {\n\t\tif (isUseCachedResult() && getServiceCacheKey() == null) {\n\t\t\tthrow new IllegalStateException(\"No cache key provided for the result to be held against.\");\n\t\t}\n\t\tgetContentHolder().reset();\n\t\tgetStartButton().setVisible(false);\n\t\tsetServiceCriteria(criteria);\n\t\tResultHolder resultHolder = new ResultHolder(criteria, result);\n\t\thandleSaveServiceResult(resultHolder);\n\t\thandleResult(resultHolder);\n\t}", "@Override\n public void onReceive(Context arg0, Intent intent) {\n if(intent.getAction().equals(Constants.GRAB_ORDER_FAIL_ACTION)){\n currentItem = 0;\n requestOrderList(Url.RecommendOptimalOrder);\n }\n if(intent.getAction().equals(Constants.GRAB_ORDER_SUCCESS_ACTION) || intent.getAction().equals(Constants.DISPATCH_ORDER_SUCCESS_ACTION) || intent.getAction().equals(Constants.CANCLE_GRABBED_ORDER_ACTION) ){\n currentItem = 1;\n requestOrderList(Url.GetHaveGrabbedOrder);\n }\n if(intent.getAction().equals(Constants.IS_OPERATING_STATE_ORDER_ACTION)){\n currentItem = 2;\n requestOrderList(Url.GetIsOperatingOrder);\n }\n if(intent.getAction().equals(Constants.OPERATED_ORDER_ACTION) || intent.getAction().equals(Constants.CANCLE_ORDER_ACTION)){\n currentItem = 3;\n requestOrderList(Url.GetOperatedOrder);\n }\n\n }", "public void fillOrders(int totalEntries) {\n StoreAPI storeOperations = new StoreAPIMongoImpl();\n for (int i = 0; i < totalEntries; i++) {\n DateFormat dateFormat = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\");\n Date date = new Date();\n int getRandomUserId = getRandomNumber(0, 999);\n storeOperations.submitOrder(dateFormat.format(date), \"user_\" + getRandomUserId, \"password_\" + getRandomUserId, getProductsToBeOrdered(getRandomNumber(1, 10)));\n }\n }", "private void listadoEstados() {\r\n sessionProyecto.getEstados().clear();\r\n sessionProyecto.setEstados(itemService.buscarPorCatalogo(CatalogoEnum.ESTADOPROYECTO.getTipo()));\r\n }", "@Override\n\tprotected OperationResult persistResult() throws IOException {\n\t\treturn App.getState().get(processInput());\n\t}", "public void setOrder(Order order){\n this.order = order;\n }", "public void incrementOrder() {\n mOrder++;\n }", "public OrderDoneExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "private static void placeOrder() {\n System.out.println();\n System.out.println(\"Menu : \");\n for (int i = 0; i < menuItems.length; i++) {\n System.out.printf(\"%2d. %-30s Price: %8.2f Baht%n\", i + 1, menuItems[i], menuPrices[i]);\n }\n System.out.println();\n\n int orderNo = getIntReply(\"What would you like to menuOrder (by menu number)\");\n if (orderNo > menuOrder.length || orderNo == -1) {\n System.out.println(\"Invalid menu number\");\n return;\n }\n\n int amount = getIntReply(\"How many of them\");\n if (amount == -1) return;\n menuOrder[orderNo - 1] += amount;\n\n System.out.printf(\"You've ordered %s for %d piece(s)%n%n\", menuItems[orderNo - 1], menuOrder[orderNo - 1]);\n }", "protected void execute() {\n finished = true;\n }", "public void addAll(List<ContentValues> result) {\n for (ContentValues c : result) {\n add(c);\n }\n }", "public void deliverResult(ArrayList<Recept> data) {\n recepts = data;\n super.deliverResult(recepts);\n }", "public static void addOrderedItem() {\n\t\tSystem.out.print(\"\\t\\t\");\n\t\tSystem.out.println(\"************Adding ordered item************\");\n\t\tOrderManager orderManager = new OrderManager();\n\t\tList listOfOrders = orderManager.viewOrder();\n\n\t\tOrderedItemManager orderedItemManager = new OrderedItemManager();\n\t\tList listOfOrderedItems = null;\n\n\t\tItemManager itemManager = new ItemManager();\n\t\tList listOfItems = itemManager.onStartUp();\n\n\t\tint i = 0;\n\t\tint choice = 0;\n\t\tOrder order = null;\n\t\tItem item = null;\n\t\tOrderedItem orderedItem = null;\n\t\tboolean check = false;\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tif (listOfOrders.size() == 0) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"There is no orders!\");\n\t\t\treturn;\n\t\t}\n\n\t\tif (listOfItems.size() == 0) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"There is no items!\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tSystem.out.println();\n\t\t\t// print the list of orders for the user to select from.\n\t\t\tfor (i = 0; i < listOfOrders.size(); i++) {\n\t\t\t\torder = (Order) listOfOrders.get(i);\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.println((i + 1) + \") Order: \" + order.getId()\n\t\t\t\t\t\t+ \" | Table: \" + order.getTable().getId());\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\tSystem.out.print(\"Select an order to add the item ordered: \");\n\t\t\tchoice = Integer.parseInt(sc.nextLine());\n\n\t\t\torder = (Order) listOfOrders.get(choice - 1);\n\n\t\t\tdo {\n\t\t\t\tfor (i = 0; i < listOfItems.size(); i++) {\n\t\t\t\t\titem = (Item) listOfItems.get(i);\n\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\t\tSystem.out.println((i + 1) + \") ID: \" + item.getId()\n\t\t\t\t\t\t\t+ \" | Name: \" + item.getName() + \" | Price: $\"\n\t\t\t\t\t\t\t+ item.getPrice());\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\tSystem.out.println((i + 1) + \") Done\");\n\t\t\t\tSystem.out.println();\n\t\t\t\tSystem.out.print(\"\\t\\t\");\n\n\t\t\t\tSystem.out.print(\"Select an item to add into order: \");\n\t\t\t\tchoice = Integer.parseInt(sc.nextLine());\n\n\t\t\t\tif (choice != (i + 1)) {\n\t\t\t\t\titem = (Item) listOfItems.get(choice - 1);\n\n\t\t\t\t\torderedItem = new OrderedItem();\n\t\t\t\t\torderedItem.setItem(item);\n\t\t\t\t\torderedItem.setOrder(order);\n\t\t\t\t\torderedItem.setPrice(item.getPrice());\n\n\t\t\t\t\torder.addOrderedItem(orderedItem);\n\n\t\t\t\t\tcheck = orderedItemManager.createOrderedItem(orderedItem);\n\n\t\t\t\t\tif (check) {\n\t\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\t\t\tSystem.out.format(\"%-25s:\", \"TASK UPDATE\");\n\t\t\t\t\t\tSystem.out\n\t\t\t\t\t\t\t\t.println(\"Item added into order successfully!\");\n\t\t\t\t\t}\n\n\t\t\t\t\telse {\n\t\t\t\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\t\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\t\t\t\tSystem.out.println(\"Failed to add item into order!\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} while (choice != (i + 1));\n\n\t\t}\n\n\t\tcatch (Exception e) {\n\t\t\tSystem.out.print(\"\\t\\t\");\n\t\t\tSystem.out.format(\"%-25s:\", \"TASK STATUS\");\n\t\t\tSystem.out.println(\"Invalid Input!\");\n\t\t}\n\t\tSystem.out.print(\"\\t\\t\");\n\t\tSystem.out.println(\"************End of adding items************\");\n\t}", "@Override\n public void doAfterTransaction(int result) {\n\n }" ]
[ "0.5897403", "0.5751736", "0.56410867", "0.5538355", "0.55276465", "0.5516176", "0.5516176", "0.5516176", "0.5481661", "0.547631", "0.54754114", "0.5468732", "0.5426445", "0.5417231", "0.5415052", "0.5412216", "0.54036194", "0.53926736", "0.53875047", "0.53676254", "0.53287166", "0.52821684", "0.5225093", "0.5219204", "0.52069426", "0.5203527", "0.520231", "0.51989514", "0.5187029", "0.5159849", "0.51545584", "0.51458114", "0.5129882", "0.512696", "0.5108148", "0.51078033", "0.5097547", "0.5082488", "0.5078975", "0.50788546", "0.50741225", "0.50741225", "0.5064977", "0.5059204", "0.5059034", "0.5057807", "0.50561464", "0.503731", "0.5034303", "0.5028435", "0.5026994", "0.50267243", "0.5022426", "0.50167394", "0.50119317", "0.5011169", "0.5011169", "0.5007249", "0.49927622", "0.49919817", "0.49919817", "0.49809822", "0.49755594", "0.4970287", "0.49626374", "0.49611512", "0.49611512", "0.49542767", "0.4953063", "0.49432677", "0.49411657", "0.49327686", "0.49327034", "0.49283472", "0.4928024", "0.49229494", "0.4916451", "0.49001464", "0.48915434", "0.48874694", "0.48864344", "0.48860702", "0.4877851", "0.4870357", "0.48668748", "0.48650616", "0.48632967", "0.4860133", "0.4853307", "0.48531863", "0.48440525", "0.484323", "0.48336968", "0.4826425", "0.4823363", "0.48006985", "0.47963685", "0.47904655", "0.4788484", "0.4786657", "0.47827035" ]
0.0
-1
Returns true iff each dominoe in list is the same.
public static boolean same(int[][] list) { for (int i=1; i<list.length; i++) if (!same(list[0], list[i])) return false; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean allDuplicatesEqual() {\n int[] input = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};\n int dupA = findDuplicatesA(input);\n int dupB = findDuplicatesB(input);\n int dupC = findDuplicatesC(input);\n int dupD = findDuplicatesD(input);\n int dupE = findDuplicatesE(input);\n return dupA == dupB && dupA == dupC && dupA == dupD && dupA == dupE;\n }", "public boolean equals(LinkedList list){\n if (this.size() == list.size()){\n for (int i = 0; i < this.size(); i++){\n if(this.get(i) != list.get(i)){\n return false;\n }\n }\n return true;\n }else{ \n return false;\n } \n }", "public static <T> boolean hasDuplicates(final List<T> elements) {\n\t\tfor (int i = 0; i < elements.size() - 1; i++) {\n\t\t\tfinal T element = elements.get(i);\n\t\t\tfor (int j = i + 1; j < elements.size(); j++) {\n\t\t\t\tif (elements.get(j).equals(element))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public boolean equals(DoublyLinkedList<Element> list) {\n if(super.equals(list)) return true;\n else {\n if(this.size != list.size) return false;\n else {\n Node<Element> temp = header.getNextNode();\n Node<Element> other_temp = list.header.getNextNode();\n while (temp != last() && other_temp != list.last()) {\n if(!temp.getPreNode().equals(other_temp.getPreNode())\n || !temp.getContent().equals(other_temp.getContent())\n || !temp.getNextNode().equals(other_temp.getNextNode()))\n return false;\n temp = temp.getNextNode();\n other_temp = other_temp.getNextNode();\n }\n return true;\n }\n }\n }", "private boolean hasNomeRepetido(String[] listaNomes) {\n for (int i = 0; i < listaNomes.length; i++) {\n for (int j = 0; j < listaNomes.length; j++) {\n if ((i != j) && (listaNomes[i].equals(listaNomes[j]))) {\n return true;\n }\n }\n }\n\n return false;\n }", "private boolean isEqual(Iterator<?> instance, OasisList<?> baseList) {\n\n boolean equal = true;\n int i = 0;\n while (instance.hasNext()) {\n if (!baseList.get(i++).equals(instance.next())) {\n equal = false;\n break;\n }\n }\n\n return equal;\n }", "private boolean sameElements(List firstList, List secondList)\r\n\t{\r\n\t\t\r\n\t\t// The size hould be the same, otherwise stop.\r\n\t\tif (firstList.size() != secondList.size())\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Iterate over the elements of the first list.\r\n\t\tfor (int index = 0; index < firstList.size(); index++)\r\n\t\t{\r\n\t\t\t// Check if the element is also in the second list.\r\n\t\t\tif (!secondList.contains(firstList.get(index)))\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// They heve the same elements.\r\n\t\treturn true;\r\n\t}", "private boolean identicalBonds(List<List<IBond>> bondListList, List<IBond> bondList) {\n \n \tboolean identical = false;\n \tint count = 0;\n \tint size = 0;\n \t\n \tfor (int i = 0; i < bondListList.size(); i++) {\n\t\t\t//different amount of bonds\n \t\tif(bondListList.get(i).size() != bondList.size())\n\t\t\t\tcontinue;\n \t\t\n \t\tsize = bondListList.get(i).size();\n \t\tfor(IBond currentBond : bondListList.get(i))\n \t\t{\n \t\t\tif(bondList.contains(currentBond))\n \t\t\t\tcount++;\n \t\t\telse\n \t\t\t\tbreak;\n \t\t\t\n \t\t\tif(count == size)\n \t\t\t\tidentical = true;\n \t\t}\n\t\t}\n \treturn identical;\n }", "public boolean equals(Object L)\n\t{\n\t\tList tempList = (List) L; //creates a List object \n\n\t\tboolean isEqual = true;\n\t\tNode thisTempFront = front; \n\t\tNode thatTempFront = tempList.front; \n\t\tif (length == tempList.length) //check if the List and L are at least the same length\n\t\t {\n\t\t\twhile( isEqual == true && thisTempFront != null && thatTempFront != null) \n\t\t\t{\n\t\t\t\tif (thisTempFront.data.equals(thatTempFront.data)) //if the data within each node is equivalent move on to the next node to check\n\t\t\t\t{\n\n\t\t\t\t\tthatTempFront = thatTempFront.next;\n\t\t\t\t\tthisTempFront = thisTempFront.next;\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tisEqual = false; //if the data is not the same within each node then the integer sequence is not the same and the loop ends\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn isEqual;\n\t\t}\n\t\telse //the List and L are not the same length, therefore they cannot be the same integer sequence\n\t\t{\n\t\t\tisEqual = false;\n\t\t\treturn isEqual;\n\t\t}\n\t}", "private static boolean isSame(List<PokerLabel> list, int size) {\n PokerLabel firstPokerLabel = list.get(0);\n int num = firstPokerLabel.getNum();\n for (PokerLabel p: list) {\n if (num != p.getNum()) {\n return false;\n }\n }\n return true;\n }", "private static boolean areAdjoining(List<Integer> list) {\r\n if (list.isEmpty()) {\r\n return false;\r\n }\r\n int check = list.get(0);\r\n for (int value : list) { // (use iterator for efficiency)\r\n if (value != check) {\r\n return false;\r\n }\r\n check += 1;\r\n }\r\n return true;\r\n }", "public boolean hasAdjacentEqualPair()\n { \n \tfor( int i = 0; i < purchases.size()-1; i++ )\n \t{\n \t\tGizmo curr = purchases.get( i );\n \t\tGizmo nxt = purchases.get( i + 1 );\n \t\tif( curr.equals( nxt ) )\n \t\t\treturn true;\n \t}\n \treturn false; \t\n }", "public static boolean duplicateCheck(ArrayList<Integer> aList) {\n\t\tBoolean duplicates = false;\n\t\tint elementIndex = 0;\n\t\twhile (duplicates == false && elementIndex < aList.size()-1) {\n\t\t\tint compareIndex = elementIndex + 1;\n\t\t\twhile (duplicates == false && compareIndex < aList.size()) {\n\t\t\t\t//System.out.println(aList.get(elementIndex));\n\t\t\t\t//System.out.println(aList.get(compareIndex));\n\t\t\t\tif (aList.get(elementIndex) == aList.get(compareIndex)) {\n\t\t\t\t\t//System.out.println(\"duplicate is true\");\n\t\t\t\t\tduplicates = true;\n\t\t\t\t}\n\t\t\t\tcompareIndex++;\n\t\t\t}\n\t\t\telementIndex++;\n\t\t}\n\t\tif (duplicates == true) {\n\t\t\t//System.out.println(\"final return for duplicate is true\");\n\t\t\treturn true;\n\t\t} else {\n\t\t\t//System.out.println(\"final return for duplicate is false\");\n\t\t\treturn false;\n\t\t}\n\t}", "private final boolean domainsEqual(Collection<String> list1, Collection<String> list2)\n {\n logger.info(\"domainsEqual - Enter - Domain1: {}, Domain2: {}\", list1, list2);\n\n // lists must have the same number of domains.\n if (list1.size() != list2.size()) {\n logger.warn(\"Domain lists are different sizes!\");\n return false;\n }\n\n // lists must have the same domains (irrespective of internal ordering).\n Iterator<String> iter = list1.iterator();\n while (iter.hasNext()) {\n if (!list2.contains(iter.next())) {\n logger.warn(\"Domain mismatch in list!\");\n return false;\n }\n }\n\n return true;\n }", "private boolean containsSameCoord(Point p) {\n boolean elementsContainsP = false;\n Iterator<Point> it = _elements.iterator();\n while (it.hasNext()) {\n Point pt = it.next();\n if (x(pt) == x(p) && y(pt) == y(p)) {\n elementsContainsP = true;\n break;\n }\n }\n return elementsContainsP;\n }", "public static boolean isDuplicate(List list, int id)\r\n {\r\n for (int i = 0; i < list.size(); i++)\r\n {\r\n int dupID = ((Integer) list.get(i)).intValue();\r\n\r\n if (dupID == id)\r\n {\r\n //slist.remove(list.get(i));\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }", "private static boolean allElementsEqual(Mark[] array) {\n\t\t\n\t\tboolean areEqual = true;\n\t\t\n for(int i=0 ; i < array.length; i++) {\n \t\n \t\n \tif (array[i] == null) {\n \t\tareEqual = false;\n \t\tbreak;\n \t}\n \t\n if(!array[0].equals(array[i])) {\n areEqual = false;\n break;\n }\n }\n\n return areEqual;\n }", "private boolean hasAnyRepeatedElement(List<Integer> row) {\n List<Integer> copyRow = new ArrayList<>(row);\n Collections.sort(copyRow);\n for (int i = 0; i < copyRow.size(); i++) {\n if(!isLastElement(i, copyRow)) {\n int current = copyRow.get(i);\n int next = copyRow.get(i+1);\n // If current is equals to next means that a repeated element has been found\n if(current == next) return true;\n }\n }\n return false;\n }", "Boolean same(MultiSet<X> s);", "boolean hasIsEquivalent();", "private boolean Equals(ArrayList<Integer> list) {\n f = list.get(0);\n o = list.get(1);\n r = list.get(2);\n t = list.get(3);\n y = list.get(4);\n s = list.get(5);\n i = list.get(6);\n x = list.get(7);\n e = list.get(8);\n n = list.get(9);\n // Y is in 1's place, T in 10's, R in 100's, O in 1000's place and finally F in 10000's place. assign these\n // values approprately for each number.\n FORTY = (f * 10000 + o * 1000 + r * 100 + t * 10 + y * 1);\n SIXTY = (s * 10000 + i * 1000 + x * 100 + t * 10 + y * 1);\n TEN = (t * 100 + e * 10 + n * 1);\n int sum = FORTY + TEN + TEN;\n\n // if our values match up correctly, then we will show the values of each.\n if (sum == SIXTY) {\n System.out.printf(\"Forty: %d,\\nTen: %d,\\nSixty: %d\\n\", FORTY, TEN, SIXTY);\n System.out.printf(\"The values of each letters are as follows:\\nF = %d,\\nO = %d,\\nR = %d,\\nT = %d,\\nY = %d,\\n\" +\n \"S = %d,\\nI = %d,\\nX = %d,\\nE = %d,\\nand N = %d.\", f, o, r, t, y, s, i, x, e, n);\n return true;\n }\n return false;\n }", "static boolean allSame(int freq[], int N)\n {\n int same = 0;\n\n // get first non-zero element\n int i;\n for (i = 0; i < N; i++) {\n if (freq[i] > 0) {\n same = freq[i];\n break;\n }\n }\n\n // check equality of each element with variable same\n for (int j = i + 1; j < N; j++)\n if (freq[j] > 0 && freq[j] != same)\n return false;\n\n return true;\n }", "boolean isSameValue(final List<T> value) {\n // identity check intentional\n return backing == value;\n }", "private static boolean containsAddivelySameNumber(Card card, ArrayList<Card> list){\n if(card.getRank().getValue()<3 || card.getRank().getValue()>7){\n for(int i=0; i<list.size(); i++){\n for(int j=i; j<list.size(); j++){\n if(list.get(i).getRank().getValue()+list.get(j).getRank().getValue() == card.getRank().getValue())\n return true;\n }\n }\n return false;\n }\n else\n return false;\n }", "public static boolean haveIdenticalContents(List list1, List list2)\r\n {\r\n if ((list1 == null) != (list2 == null))\r\n {\r\n // One is null and other is not.\r\n return false;\r\n }\r\n if (list1 != null)\r\n {\r\n // Both are not null.\r\n if (list1.size() != list2.size())\r\n {\r\n // Different sizes.\r\n return false;\r\n }\r\n // Both not null and same size.\r\n for (int i = 0; i < list1.size(); i++)\r\n {\r\n if (list1.get(i) != list2.get(i))\r\n {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }", "public boolean equals(LinkedList otherList) {\n\t\tif (this.size()==otherList.size()){\n\t\t\tNode compthis = this.head;\n\t\t\tNode compother = otherList.head;\n\t\t\twhile (compthis!=null){\n\t\t\t\tif (!compthis.equals(compother)){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tcompthis = compthis.next;\n\t\t\t\tcompother = compother.next;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean isDupe(T element);", "private boolean isSameList(CardList l1, CardList l2){\r\n\t\tif (l1.size()!=l2.size())\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tIterator<Card> i1 = l1.iterator();\r\n\t\tIterator<Card> i2 = l2.iterator();\r\n\t\twhile(i1.hasNext()){\r\n\t\t\tif (!i1.next().equals(i2.next()))\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public boolean equals (Object obj) {\n\t\tif (this.size() != ((List) obj).size()) {\n\t\t\treturn false;\n\t\t}\n\t\telse {\n\t\t\tint i = 0;\n\t\t\tfor (ListNode p = myHead; p != null; p = p.myNext) {\n\t\t\t\tif (p.myItem != ((List) obj).get(i)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}", "private boolean inSameSuit() {\n for (int i = 0; i < cards.length-2; i++) {\n if (cards[i].charAt(1) != cards[i + 1].charAt(1)) {\n return false;\n }\n }\n \n return true;\n }", "public static boolean allSameValues(Example[] examples)\n {\n if (examples.length == 0)\n throw new RuntimeException(\"Empty examples set!\");\n double last_value;\n for(int val=0; val<examples[0].values.length;val++)\n {\n last_value = examples[0].values[val];\n for (int idx = 1; idx < examples.length; idx++)\n if( last_value != examples[idx].values[val])\n return false;\n }\n return true;\n }", "public boolean hasDuplicates(boolean ignoreWhenIdentical) {\n boolean compareJustClassNames = !ignoreWhenIdentical;\n if (compareJustClassNames) {\n return list.size() > 1;\n }\n\n if (list.size() <= 1) {\n return false;\n }\n\n String previousHash = list.get(0).getHash();\n for (int i = 1; i < list.size(); i++) {\n String currentHash = list.get(i).getHash();\n if (!previousHash.equals(currentHash)) {\n return true;\n }\n }\n\n log.debug(\"ignoring duplicates of class \" + classFilePath + \" since the bytecode matches exactly\");\n\n return false;\n }", "public final boolean equal() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue == secondTopMostValue) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "@Override\n public boolean hasDuplicates() {\n ArrayList<String> itemList = new ArrayList(Arrays.asList(\"\"));\n Node currNode = this.head;\n while(true){\n if(itemList.contains(currNode.getItem())){ // need to edit\n return true;\n }else{\n itemList.add(currNode.getItem());\n }\n if(currNode.getNextNode() == null){\n break;\n }\n currNode = currNode.getNextNode();\n }\n return false;\n }", "public Boolean sameCenterPoints(Cell cell) {\r\n int centerX = cell.getcenterX();\r\n int centerY = cell.getcenterY();\r\n for (int i = 0; i < cells.size(); i++) {\r\n Cell currCell = cells.get(i);\r\n if (currCell.getcenterX()==centerX && currCell.getcenterY()==centerY\r\n ) {\r\n return (true);\r\n }\r\n }\r\n return false;\r\n }", "public boolean isEqualNode(int xcoords, int ycoords){ \n boolean ret = false;\n Node N = head;\n for (int i = 1; i < numItems; i++){\n if (xcoords == N.x && ycoords == N.y){\n ret = true;\n }else { \n ret = false;\n }\n N = N.next;\n }\n return ret;\n }", "static public boolean sequenceEquals(List source, List arg) {\n\t\tif ( source.size() != arg.size() ) {\n\t\t\treturn false;\n\t\t}\n\t\tIterator it1 = source.iterator();\n\t\tIterator it2 = arg.iterator();\n\t\twhile ( it1.hasNext() ) {\n\t\t\tObject elem1 = it1.next();\n\t\t\tObject elem2 = it2.next();\n\t\t\tif ( elem1 instanceof Integer ) {\n\t\t\t\tif ( ((Integer)elem1).intValue() != ((Integer)elem2).intValue() ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( elem1 instanceof Float ) {\n\t\t\t\t\tif ( ((Float)elem1).floatValue() != ((Float)elem2).floatValue() ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( elem1 instanceof Boolean ) {\n\t\t\t\t\t\tif ( ((Boolean)elem1).booleanValue() != ((Boolean)elem2).booleanValue() ) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( !elem1.equals(elem2) ) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "boolean hasSameAs();", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 1;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 1;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 1;\r\n\t\t\t}", "private boolean isEqualList(List<Node> a, List<Node> b, boolean value){\n\t\tList<Node> tmp1 = new ArrayList<Node>(a);\n\t\tList<Node> tmp2 = new ArrayList<Node>(b);\n\t\tfor(Node n1 : tmp1){\n\t\t\tfor(Node n2 : tmp2){\n\t\t\t\tif((value && n1.isEqualNode(n2)) || (!value && n1.isSameNode(n2)))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public static boolean haveEqualContents(List list1, List list2)\r\n {\r\n if ((list1 == null) != (list2 == null))\r\n {\r\n // One is null and other is not.\r\n return false;\r\n }\r\n if (list1 != null)\r\n {\r\n // Both are not null.\r\n if (list1.size() != list2.size())\r\n {\r\n // Different sizes.\r\n return false;\r\n }\r\n // Both not null and same size.\r\n for (int i = 0; i < list1.size(); i++)\r\n {\r\n if (!ObjUtil.equalsOrBothNull(list1.get(i), list2.get(i)))\r\n {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }", "public static boolean listEquals(ListNode one, ListNode two){\n\t \t\tif(one == null && two == null) return true;\n\t \t\t//System.out.println(one);\n\t \t\t//System.out.println(two);\n\t \t\twhile(one != null || two != null){\n\t\t \t\tif(one == null && two != null || one != null && two == null) return false;\n\t\t \t\tif(one.val != two.val) return false;\n\t\t \t\tone = one.next;\n\t\t \t\ttwo = two.next;\n\t \t\t}\n\t \t\treturn true;\n\t \t}", "public boolean containsDuplicate(int[] nums) {\n if (nums == null || nums.length == 0)\n return false;\n Set<Integer> distinctElems = new HashSet<>();\n for (int val : nums) {\n if (!distinctElems.add(val)) {\n return true;\n }\n }\n return false;\n }", "private final boolean AreListStatesEqual(List<State> list1, List<State> list2) {\r\n if ((list1.size() != list2.size())) {\r\n return false;\r\n }\r\n \r\n for (State state : list1) {\r\n if (!list2.contains(state)) {\r\n return false;\r\n }\r\n \r\n }\r\n \r\n return true;\r\n }", "public boolean checkDuplicates() {\n\t\tboolean[] vals = new boolean[9];\n\t\tfor(int i = 0; i < 3; i++) {\n\t\t\tfor(int k = 0; k < 3; k++) {\n\t\t\t\tint num = this.getCellNum(i, k);\n\t\t\t\tif(num != 0) {\n\t\t\t\t\tif(!vals[num-1]) {\n\t\t\t\t\t\t//The number hasn't already been found\n\t\t\t\t\t\tvals[num-1] = true;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t//A duplicate number was found\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public boolean palindrome(int[] list){\n int counter = 0;\n for (int i = 0, j = list.length-1; j >= i; i++, j--){\n if (list[i] != list[j])\n counter++;\n\n }\n return counter == 0;\n }", "public boolean containsDuplicate(int[] nums) {\n Arrays.sort(nums);\n for (int i=1;i<nums.length;i++) {\n \tif (nums[i]==nums[i-1]) return true;\n }\n return false;\n }", "public boolean equals(Object other) {\r\n if (other == null || getClass() != other.getClass() || length != ((MoneyList) other).length)\r\n return false;\r\n\r\n MoneyNode nodeThis = first;\r\n MoneyNode nodeOther = ((MoneyList) other).first;\r\n while (nodeThis != null) {\r\n // Since the two linked lists are the same length,\r\n // they should reach null on the same iteration.\r\n\r\n if (nodeThis.data != nodeOther.data)\r\n return false;\r\n\r\n nodeThis = nodeThis.next;\r\n nodeOther = nodeOther.next;\r\n } // while\r\n\r\n return true;\r\n }", "public boolean checkDuplicates(String chars) {\n char[] check = chars.toCharArray();\n for (int i = 0; i < chars.length(); i++) {\n for (int j = i + 1; j < chars.length(); j++) {\n if (check[i] == check[j]) {\n return true;\n }\n }\n }\n return false;\n }", "public static final boolean allTheSame(float... numbers) {\n\n for (int i = 1; i < numbers.length; i++) {\n if (numbers[i] != numbers[i - 1]) return false;\n }\n return true;\n }", "public boolean Alone(ArrayList<Animal> animals)\n {\n boolean result = true;\n Iterator it = animals.iterator();\n while(it.hasNext() && result)\n {\n Animal other = (Animal)it.next();\n if (id != other.id)\n {\n float dist = PVector.dist(pos, other.pos);\n result = (dist > cohesionDist) && (dist > separationDist) && (dist > alignDist);\n }\n }\n return result;\n }", "@Test\r\n\tpublic void test1() {\r\n\t\tint[] nums = {1,2,3,1,4};\r\n\t\tAssert.assertEquals(true, containsDuplicate(nums));\r\n\t}", "@Override\r\n public boolean equals(Object o) \r\n {\r\n if (o instanceof DoublyLinkedList<?>){\r\n DoublyLinkedList<?> dll = (DoublyLinkedList<?>) o;\r\n if (dll.size() != size) return false;\r\n Node<T> curr = getFirst();\r\n Node<?> ocurr = dll.getFirst();\r\n for(int i = 0; i < size; i++){\r\n if (curr.getValue() == null){\r\n if (ocurr.getValue() != null) return false;\r\n }\r\n else {\r\n if (!curr.getValue().equals(ocurr.getValue())) return false;\r\n }\r\n curr = curr.getNext();\r\n ocurr = ocurr.getNext();\r\n }\r\n return true;\r\n }\r\n else return false;\r\n }", "public static boolean isDapartmentNameDuplicated(ObservableList<Department> deList, String name, int size) {\n\n for (int i = 0; i < size; i++) {\n if (deList.get(i).getName().equals(name)) {\n\n return true;\n }\n }\n return false;\n }", "public boolean checkDuplicates(String value) {\n for (Entry i : listentries) {\n if (i.getName().equals(value))\n return true;\n }\n return false;\n }", "public boolean equals(DoubleLinkedList other) {\n\n\t\tif (this.elements != other.elements) {\n\t\t\treturn false;\n\t\t}\n\t\tDLNode n = head;\n\t\tDLNode o = other.head;\n\n\t\tint nc = nodeCounter();\n\n\t\tfor (int i = 0; i < nc; i++) {\n\n\t\t\tif (n.val != o.val) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (n.val == Integer.MIN_VALUE) {\n\t\t\t\tboolean check = n.list.equals(o.list);\n\t\t\t\tif (check) {\n\t\t\t\t\treturn check;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tn = n.next;\n\t\t\to = o.next;\n\n\t\t}\n\n\t\treturn true;\n\n\t}", "private static boolean compareList(List<Object> l1, List<Object> l2)\n {\n int count=0;\n for (Object o : l1)\n {\n Object temp = o;\n for (Object otemp : l2)\n {\n if (EqualsBuilder.reflectionEquals(temp, otemp))\n {\n count++;\n }\n }\n\n }\n\n if(count == l1.size()) return true;\n return false;\n\n }", "private boolean isInList(List<Point3D> pointsList, Point3D point) {\r\n for (Point3D tempPoint : pointsList) {\r\n if(point.isAlmostEquals(tempPoint))\r\n return true;\r\n }\r\n return false;\r\n }", "protected boolean isSameSnakSet(Iterator<Snak> snaks1, Iterator<Snak> snaks2) {\n\t\tArrayList<Snak> snakList1 = new ArrayList<>(5);\n\t\twhile (snaks1.hasNext()) {\n\t\t\tsnakList1.add(snaks1.next());\n\t\t}\n\n\t\tint snakCount2 = 0;\n\t\twhile (snaks2.hasNext()) {\n\t\t\tsnakCount2++;\n\t\t\tSnak snak2 = snaks2.next();\n\t\t\tboolean found = false;\n\t\t\tfor (int i = 0; i < snakList1.size(); i++) {\n\t\t\t\tif (snak2.equals(snakList1.get(i))) {\n\t\t\t\t\tsnakList1.set(i, null);\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!found) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn snakCount2 == snakList1.size();\n\t}", "public static boolean itContains(ArrayList<Integer> list, int n) {\r\n\t\tfor (Integer broj : list) {\r\n\t\t\tif (n == broj) {\r\n\t\t\t\t\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Ako ga nema vraca se false\r\n\t\treturn false;\r\n\t}", "public boolean member(Object item) {\n\t\tfor (Object element : list)\n\t\t\tif (element.equals(item))\n\t\t\t\treturn true;\n\n\t\treturn false;\n\t}", "public boolean containsDuplicate(int[] nums) {\n if (nums == null || nums.length <= 1) {\n return false;\n }\n TreeSet<Integer> set = new TreeSet<>();\n for (int num : nums) {\n if (set.contains(num)) {\n return true;\n } else {\n set.add(num);\n }\n }\n return false;\n }", "@Override\n public boolean equals(final Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n LinkedList<T> that = (LinkedList<T>) o;\n if (numElement != that.numElement) {\n return false;\n }\n Node<T> iter = head;\n Node<T> iter2 = that.head;\n for (int index = 0; index < numElement; index++) {\n if (!iter.getData().equals(iter2.getData())) {\n return false;\n }\n iter = iter.getNext();\n iter2 = iter2.getNext();\n }\n return true;\n }", "public boolean checkforDuplicates(Tour tocheck) {\r\n\t\t boolean duplicate=false;\r\n\t\tfor(int t=0; t<tours.length-1;t++) {\r\n\t\t\tif(tocheck.checkforOrderDiffrence(tours[t])==false) {\r\n\t\t\t\tduplicate=true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn duplicate;\r\n\t}", "private static boolean collectionHasRepeat(List<Integer> square) {\n\t\tfor(int index = 1; index <= BOUNDARY; index++) {\n\t\t\tif(Collections.frequency(square, index) > 1) return true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean containsDuplicate(int[] nums) {\r\n\t Set<Integer> set = new HashSet<Integer>();\r\n\t for(int i = 0; i < nums.length; i++) {\r\n\t if(set.contains(nums[i]))\r\n\t return true;\r\n\t else\r\n\t set.add(nums[i]);\r\n\t }\r\n\t return false;\r\n\t }", "private final static boolean equivalent(Automaton automaton,\n\t\t\tBinaryMatrix equivs, Automaton.List il, Automaton.List jl) {\n\t\tint il_size = il.size();\n\t\tint jl_size = jl.size();\n\t\tif (il_size != jl_size) {\n\t\t\t// List have different sizes, so cannot be equivalent.\n\t\t\treturn false;\n\t\t} else {\n\t\t\t// Lists have the same size, so check each child is equivalent in\n\t\t\t// sequence\n\t\t\tint[] il_children = il.children;\n\t\t\tint[] jl_children = jl.children;\n\t\t\tfor (int k = 0; k != il_size; ++k) {\n\t\t\t\tint il_child = il_children[k];\n\t\t\t\tint jl_child = jl_children[k];\n\t\t\t\tif (il_child < 0 || jl_child < 0) {\n\t\t\t\t\t// In this case, one or both of the child states are\n\t\t\t\t\t// virtual. Thus, we cannot look them up in the equivs\n\t\t\t\t\t// relation, and must compare directly (which is safe).\n\t\t\t\t\tif (il_child != jl_child) {\n\t\t\t\t\t\t// Children are not equivalent so fail\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else if (!equivs.get(il_child, jl_child)) {\n\t\t\t\t\t// Children are not equivalent so fail\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// All children must have been equivalent\n\t\t\treturn true;\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\tList l=new ArrayList();\r\n\t\tl.add(12);\r\n\t\tl.add(45);\r\n\t\tl.add(15);\r\n\t\tl.add(78);\r\n\t\t\r\n\t\tList l2=new ArrayList();\r\n\t\tl2.add(12);\r\n\t\tl2.add(45);\r\n\t\tl2.add(10);\r\n\t\tl2.add(78);\r\n\t\t\r\n\t\tBoolean m=l.containsAll(l2);\r\n\t\t\r\n\t\tif(m)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Elements are same\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Not equal\");\r\n\t\t}\r\n\t\t\r\n\r\n\t}", "private boolean isHomogenous(List<Location> list){\n\t\tboolean homogenous = true;\n\t\tLocation proto = list.get(0);\n\t\tfor(Location l:list){\n\t\t\tif(proto.getClass() != l.getClass()) homogenous = false;\n\t\t}\n\t\treturn homogenous;\n\t}", "public boolean alreadyOwnsIdenticalRoute(){\n City city1 = mSelectedRoute.getCity1();\n City city2 = mSelectedRoute.getCity2();\n for(int i=0; i<mUser.getClaimedRoutes().size(); i++){\n City ownedCity1 = mUser.getClaimedRoutes().get(i).getCity1();\n City ownedCity2 = mUser.getClaimedRoutes().get(i).getCity2();\n if(city1.equals(ownedCity1) && city2.equals(ownedCity2))\n return true;\n }\n return false;\n }", "public static boolean opposites(Pair[] data){\n HashSet<Pair> hs = new HashSet<>(20, 0.9f);\n for(Pair p : data) {\n if(hs.contains(new Pair(p.b(), p.a())))\n return true;\n hs.add(p);\n }\n return false;\n }", "@Override public boolean equals(Object o) {\n if (this == o) { return true; }\n if ( !(o instanceof Set) ) { return false; }\n Set that = (Set) o;\n return that.size() == inner.size() &&\n containsAll(that);\n }", "@Override\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n\n // Not SetI?\n if (!(o instanceof SetI s)) {\n return false;\n }\n\n Iterator<Integer> anotherIter = s.iterator();\n\n for (Integer e : this) {\n if (!anotherIter.hasNext()) {\n // Not in same length.\n return false;\n }\n if (!e.equals(anotherIter.next())) {\n return false;\n }\n }\n\n // Not in same length?\n return !anotherIter.hasNext();\n }", "private boolean contains(List<PointList> list, PointList pList){\n\t\n\t\tfor (PointList p : list){\n\t\t\tif (p.equals(pList)) return true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "public boolean equals(Object other) {\n //first make sure that the object is an arraylist\n //and also make sure that it isnt null\n if (other == null || !(other instanceof ArrayList)) {\n return false;\n }\n \n //type cast the argument into an array, now that we know that it is one\n ArrayList<E> that = (ArrayList<E>) other;\n \n //check to see if the lengths are the same\n if (this.array.length == that.array.length) {\n //if the lengths are the same, check each value to see if they are the same\n //loop through the array only once\n for (int i = 0; i < this.array.length; i++) {\n //compare the elements of each index\n if (this.array[i] == that.array[i]) {\n //continue to check all elements\n continue;\n } else {\n //if one of the elements aren't the same, return false\n return false;\n }\n }\n } else {\n //return false if the lengths are not the same\n return false;\n }\n \n //if it gets through the loop, then all of the elements are equal \n return true;\n }", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 2;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 2;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 2;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 2;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 2;\r\n\t\t\t}", "@Override\r\n\t\t\tpublic boolean matches(Object list) {\n\t\t\t\treturn ((List<String>) list).size() == 2;\r\n\t\t\t}", "public Boolean sameDay(Event event) {\n int year_given = event.getDate().get(Calendar.YEAR);\n int month_given = event.getDate().get(Calendar.MONTH);\n int day_given = event.getDate().get(Calendar.DATE);\n\n int year = this.getDate().get(Calendar.YEAR);\n int month = this.getDate().get(Calendar.MONTH);\n int day = this.getDate().get(Calendar.DATE);\n\n return (year == year_given) && (month == month_given) && (day == day_given);\n }", "public boolean equals(Coordinate c) {\r\n\t\treturn (c.x == x) && (c.y == y);\r\n\t}", "public boolean equals(ListNode one, ListNode two){\n\t \t\treturn one.val == two.val;\n\t \t}", "public static boolean isPalindrome(LinkedList<Integer> list){\n\t\tStack<Integer> stack = new Stack<>();\n\t\tint n = list.size();\n\t\t\n\t\t/* Add the first half of the list to a stack */\n\t\tfor (int i=0; i<n/2; i++){\n\t\t\tInteger currNum = list.get(i); \n\t\t\tstack.push(currNum);\n\t\t}\n\t\t\n\t\t/* Check if the second half is the same as the stack content */\n\t\tfor (int i=n/2+n%2; i<n; i++){\n\t\t\tInteger currNum = list.get(i);\n\t\t\tif (currNum == stack.peek())\n\t\t\t\tstack.pop();\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "public boolean hasPair(ArrayList<Card>cards) {\r\n\t\tCollections.sort(cards);\r\n\t\tfor(int i = 0; i < cards.size() - 1; i++) {\r\n\t\t\tfor(int j = i+1; j < cards.size(); j++) {\r\n\t\t\t\tif(cards.get(i).getValue() == cards.get(j).getValue()) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t\r\n\t}", "@Override\n\tpublic boolean equals(MengdeADT<T> m) {\n\t\tboolean likeMengder = true;\n\t\tIterator<T> nye = m.oppramser();\n\t\tif (this.antall == m.antall()) {\n\t\t\twhile (nye.hasNext() && likeMengder) {\n\t\t\t\t// Hvis neste element i m ikke er med i denne mengden --> likeMengder = false\n\t\t\t\tif (!inneholder(nye.next())) {\n\t\t\t\t\tlikeMengder = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlikeMengder = false;\n\t\t}\n\t\t\n\t\treturn likeMengder;\n\t}", "@Override\r\n\tpublic boolean equals(Object o) {\r\n\t\tif (o instanceof Seed) {\r\n\t\t\tSeed s = (Seed) o;\r\n\t\t\tCards cs1, cs2;\r\n\r\n\t\t\tif (this.size() != s.size()) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tfor (int i = 0; i < s.size(); i++) {\r\n\t\t\t\tcs1 = s.get(i);\r\n\t\t\t\tcs2 = this.get(i);\r\n\t\t\t\tif (cs1.getCardsType() != cs2.getCardsType()\r\n\t\t\t\t\t\t|| cs1.getCardsValue() != cs2.getCardsValue()) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "public boolean hasCycle(Node<T> first) {\n Iterator itOne = this.iterator();\n Iterator itTwo = this.iterator();\n try {\n while (true) {\n T one = (T) itOne.next();\n itTwo.next();\n T two = (T) itTwo.next();\n if (one.equals(two)) {\n return true;\n }\n }\n } catch (NullPointerException ex) {\n ex.printStackTrace();\n }\n return false;\n }", "public boolean equals(Object o) {\n\t\tif(o != null) {\n\n\n\t\t\tif(getClass() != o.getClass()) return false;\n\t\t\tSinglyLinkedList other = (SinglyLinkedList) o;\n\t\t\tif(size != other.size()) {\n\t\t\t\tNode walkA = head;\n\t\t\t\tNode walkB = other.head;\n\n\t\t\t\twhile(walkA != null) {\n\t\t\t\t\tif(!walkA.getElement().equals(walkB.getElement())) return false;\n\t\t\t\t\twalkA = walkA.getNext();\n\t\t\t\t\twalkB = walkB.getNext();\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private boolean identicalAtoms(IAtomContainer molecule1, List<IAtomContainer> fragsToCompare) {\n\t\n \tfor (int i = 0; i < fragsToCompare.size(); i++) {\n \t\t//no match\n \t\tif (molecule1.getBondCount() != fragsToCompare.get(i).getBondCount() && molecule1.getAtomCount() != fragsToCompare.get(i).getAtomCount()) \n \t\t{\n \t\t\tcontinue;\n \t\t}\n \t\t\n\n \t\tint n = 0;\n \t\t//array storing all already tried atoms\n \t\tboolean[] doneAtoms = new boolean[atomsContained + 1];\n \t\tfor (int j = 0; j < molecule1.getAtomCount(); j++) {\n \t\t\tfor (int k = 0; k < fragsToCompare.get(i).getAtomCount(); k++) \n \t\t\t{\n \t\t\t\t//compare atoms by symbol, thus only check for the same sum formula --> EXPERIMENTAL\n \t\t\t\tif(molecularFormulaRedundancyCheck)\n \t\t\t\t{\n \t\t\t\t\tif (molecule1.getAtom(j).getSymbol().equals(fragsToCompare.get(i).getAtom(k).getSymbol()) &&\n \t\t\t\t\t\t\t!doneAtoms[Integer.parseInt(fragsToCompare.get(i).getAtom(k).getID())]) {\n \t\t\t\t\tn++;\n \t\t\t\t\tdoneAtoms[Integer.parseInt(fragsToCompare.get(i).getAtom(k).getID())] = true;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\t} \t\t\t\t\n \t\t\t\t//normal test creates way more fragments!\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\tif (molecule1.getAtom(j).equals(fragsToCompare.get(i).getAtom(k))) {\n \t\t\t\t\tn++;\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tif(n == molecule1.getAtomCount())\n \t\t\treturn true;\n\t\t}\n\t //no match found\n\t\treturn false;\n\t}", "static public boolean orderedsetEquals(List source, List arg) {\n\t\tif ( source.size() != arg.size() ) {\n\t\t\treturn false;\n\t\t}\n\t\tIterator it1 = source.iterator();\n\t\tIterator it2 = arg.iterator();\n\t\twhile ( it1.hasNext() ) {\n\t\t\tObject elem1 = it1.next();\n\t\t\tObject elem2 = it2.next();\n\t\t\tif ( elem1 instanceof Integer ) {\n\t\t\t\tif ( ((Integer)elem1).intValue() != ((Integer)elem2).intValue() ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( elem1 instanceof Float ) {\n\t\t\t\t\tif ( ((Float)elem1).floatValue() != ((Float)elem2).floatValue() ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( elem1 instanceof Boolean ) {\n\t\t\t\t\t\tif ( ((Boolean)elem1).booleanValue() != ((Boolean)elem2).booleanValue() ) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( !elem1.equals(elem2) ) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public static boolean sameUniqueCharsInBothLists( List<Character> list1, \n List<Character> list2 ) {\n Set<Character> s1 = new TreeSet<Character>( list1 );\n Set<Character> s2 = new TreeSet<Character>( list2 );\n return s1.equals(s2);\n }", "private boolean mozeLiSeSpojiti() {\r\n\t\t// provjera po redovima\r\n\t\tfor(int i = 0 ; i < 4 ; i++)\r\n\t\t\tfor(int j = 0 ; j < 3 ; j++)\r\n\t\t\t\tif(tabela[i][j] == tabela[i][j + 1])\r\n\t\t\t\t\treturn true;\r\n\t\t// provjera po kolonama\r\n\t\tfor(int j = 0 ; j < 4 ; j++)\r\n\t\t\tfor(int i = 0 ; i < 3 ; i++)\r\n\t\t\t\tif(tabela[i][j] == tabela[i + 1][j])\r\n\t\t\t\t\treturn true;\r\n\t\treturn false;\r\n\t}", "boolean isUnique();", "private boolean in(Integer e, ArrayList<Integer> l) {\n for (int i=0; i<l.size();i++) {\n if (l.get(i) == e) {\n return true;\n }\n }\n return false;\n }", "public static boolean equals(int[] list1, int[] list2) {\n boolean verdict = false;\n \n // use bubbleSort to sort each list\n list1 = bubbleSort(list1);\n list2 = bubbleSort(list2);\n \n if (list1.length == list2.length) {\n verdict = true;\n for (int i = 0; i < list1.length; i++) {\n if (list1[i] != list2[i]) {\n verdict = false;\n break;\n }\n }\n }\n return verdict;\n }", "public boolean equals(CMPhones oCompare)\r\n {\r\n if (oCompare.phoneList.size() != this.phoneList.size())\r\n {\r\n return false;\r\n }\r\n \r\n int iCnt = this.phoneList.size();\r\n for (int i = 0; i < iCnt; i++)\r\n {\r\n if (! this.phoneList.get(i).equals(oCompare.phoneList.get(i)))\r\n {\r\n return false;\r\n }\r\n }\r\n \r\n // If we got here then everything is the same...\r\n //----------------------------------------------\r\n return true;\r\n }" ]
[ "0.71830744", "0.7058859", "0.7019039", "0.6973274", "0.6582109", "0.6501392", "0.64531314", "0.6441906", "0.64192384", "0.63849086", "0.63272125", "0.62338406", "0.6233756", "0.61787444", "0.606574", "0.60290766", "0.6012705", "0.5998341", "0.5985778", "0.5961322", "0.5949131", "0.5928291", "0.59080935", "0.59056944", "0.5891376", "0.5871935", "0.5864064", "0.58604455", "0.5846949", "0.5824184", "0.58108807", "0.5806848", "0.580294", "0.58001596", "0.57918626", "0.57799524", "0.5779505", "0.57680917", "0.57679355", "0.57679355", "0.57679355", "0.5752059", "0.5734676", "0.5720156", "0.57093817", "0.57051677", "0.57032347", "0.5696541", "0.5686744", "0.56774455", "0.5641366", "0.5632568", "0.5623518", "0.5618446", "0.5616707", "0.5604142", "0.5580832", "0.55772954", "0.5568398", "0.5565657", "0.5549464", "0.5549161", "0.55359966", "0.553173", "0.5529947", "0.552415", "0.5521402", "0.55198884", "0.55177885", "0.550982", "0.5509722", "0.5504766", "0.5501509", "0.5499554", "0.54909635", "0.54882824", "0.5482007", "0.5472177", "0.5472177", "0.5472177", "0.5472177", "0.5472177", "0.5472177", "0.5465381", "0.5460583", "0.545926", "0.5456686", "0.5451711", "0.5449365", "0.5444424", "0.5440712", "0.5437314", "0.54366535", "0.5435639", "0.5429563", "0.5427864", "0.54221785", "0.54198635", "0.54186505", "0.5414648" ]
0.72863543
0
Precondition: a and b are length 2. Postcondition: Returns true iff a and b store the same pair (order doesn't matter).
public static boolean same(int[] a, int[] b) { return (a[0] == b[0] && a[1] == b[1]) || (a[0] == b[1] && a[1] == b[0]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean isTwoPair();", "boolean isOnePair();", "private static boolean areEqual (byte[] a, byte[] b) {\r\n int aLength = a.length;\r\n if (aLength != b.length)\r\n return false;\r\n for (int i = 0; i < aLength; i++)\r\n if (a[i] != b[i])\r\n return false;\r\n return true;\r\n }", "public boolean isTwoPair(){\r\n int temp[] = getIntArr();\r\n\r\n if(temp[0] == temp[1] && temp[2] == temp[3])\r\n return true;\r\n\r\n else if(temp[0] == temp[1] && temp[3] == temp[4])\r\n return true;\r\n\r\n else if(temp[1] == temp[2] && temp[3] == temp[4])\r\n return true;\r\n\r\n else return false;\r\n }", "static boolean isPermutation_1(String a, String b){\n //get the sorted format of a string\n String sorted_A = sortString(a);\n String sorted_B = sortString(b);\n return sorted_A.equals(sorted_B);\n }", "private boolean eq(int[] a,int[] b){\n\t\tboolean eq = true;\n\t\tif(a.length != b.length) return false;\n\t\tfor(int i=0;i<a.length;i++){\n\t\t\tif( a[i] != b[i] ){\n\t\t\t\teq = false;\n\t\t\t\tbreak;\n\t\t\t}else{\n\n\t\t\t}\n\t\t}\n\t\treturn eq;\n\t}", "public boolean hasAdjacentEqualPair()\n { \n \tfor( int i = 0; i < purchases.size()-1; i++ )\n \t{\n \t\tGizmo curr = purchases.get( i );\n \t\tGizmo nxt = purchases.get( i + 1 );\n \t\tif( curr.equals( nxt ) )\n \t\t\treturn true;\n \t}\n \treturn false; \t\n }", "boolean hasIsEquivalent();", "public boolean Equals(Pair rhs) {\n if(this.first == rhs.first &&\n this.second == rhs.second)\n return true;\n\n return false;\n }", "public boolean makePair(int [] a, int [] b, int k) {\n\t\t\n\t\tif(a==null||b==null||a.length==0||b.length==0) return true;\n\t\t\n\t\tfor(int i=0; i<a.length; i++) {\n\t\t\ta[i] = k-a[i];\t\n\t\t}\n\t\tArrays.sort(a);\n\t\tArrays.sort(b);\n\t\tboolean res = true;\n\t\t\n\t\t//add optimization\n\t\tif(a[a.length-1]<=b[0]) return res;\n\t\t\n\t\tfor(int j=0; j<a.length; j++) {\n\t\t\tif(a[j]>b[j]) {\n\t\t\t\tres = false;\n\t\t\t\tbreak; \n\t\t\t}\n\t\t}\n\t\treturn(res);\n\n\t}", "public boolean hasTwoPairs() {\n\t\t\n\t\tboolean paired = false;\n\t\t\n\t\tif (firstDigit == secondDigit && thirdDigit == forthDigit) {paired = true;}\n\t\telse if (firstDigit == thirdDigit && secondDigit == forthDigit) {paired = true;}\n\t\telse if (firstDigit == forthDigit && secondDigit == thirdDigit) {paired = true;}\n\t\t\n\t\treturn paired;\n\t}", "public boolean isSecondPair(){\n\t\treturn testBitwiseFlag(128);\n\t}", "public boolean isPair() {\r\n\r\n return getHighestConsecutive() == 2;\r\n }", "public boolean twoPair(int[] numArr) {\n\t\tfor (int i = 1; i < numArr.length-2; i++) {\n\t\t\tif (numArr[i-1]==numArr[i]&&numArr[i]==numArr[i+1]){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public static boolean isPair(final Noun noun1, final Noun noun2) {\r\n\t\treturn Mark.getPairNoun(noun1, noun2.type) == noun2;\r\n\t}", "static boolean isPermutation_2(String a, String b){\n boolean isPermutation = true;\n //lets store every char in an array of boolean\n int[] charCount = new int[256];\n for(char c:a.toCharArray()){\n charCount[c]++;\n }\n //now verify the count in another string and subtract the count\n for(char c:b.toCharArray()){\n charCount[c]--;\n }\n //now check if any count is non-zero then the two string have unequal count of that char\n for(int i=0;i<charCount.length;i++)\n if(charCount[i]!=0)\n return false;\n \n return isPermutation;\n }", "@Override\r\n\t\tpublic boolean equalsWithOrder(\r\n\t\t\t\tPair<? extends T, ? extends S> anotherPair) {\n\t\t\tsynchronized (mutex) {\r\n\t\t\t\treturn pair.equalsWithOrder(anotherPair);\r\n\t\t\t}\r\n\t\t}", "public boolean isAPermutation(String st1, String st2) {\n\t\tif(st1.length() != st2.length() || st1.length() == 0 || st2.length() == 0) return false;\n\t\t\n\t\tHashMap<Character, Integer> cc1 = charactersCount(st1);\n\t\tHashMap<Character, Integer> cc2 = charactersCount(st2);\n\t\t\n\t\treturn sameCharactersCount(cc1, cc2);\n\t}", "public boolean almostEqual(Coordinates a, Coordinates b);", "private boolean isEqual(int[] x, int[] y) {\n for (int i = 0; i < 3; i++) {\n if (x[i] != y[i]) {\n return false;\n }\n }\n return true;\n }", "public static boolean opposites(Pair[] data){\n HashSet<Pair> hs = new HashSet<>(20, 0.9f);\n for(Pair p : data) {\n if(hs.contains(new Pair(p.b(), p.a())))\n return true;\n hs.add(p);\n }\n return false;\n }", "boolean areTheyEqual(int[] array_a, int[] array_b) {\n if(array_a == null || array_b == null || array_a.length!=array_b.length) return false;\n\n HashMap<Integer,Integer> count = new HashMap<>();\n for(int x : array_a){\n count.put(x, count.getOrDefault(x,0)+1);\n }\n for(int y : array_b){\n count.put(y, count.getOrDefault(y,0)-1);\n if(count.get(y)==0) count.remove(y);\n }\n return count.size()==0;\n }", "private boolean compareMomenta(int[] a, int[] b){\n return ((a[0] == b[0]) &&\n (a[1]) == b[1]) ;\n }", "private boolean slowEquals(byte[] a, byte[] b)\n {\n int diff = a.length ^ b.length;\n for(int i = 0; i < a.length && i < b.length; i++)\n diff |= a[i] ^ b[i];\n return diff == 0;\n }", "private static boolean slowEquals(byte[] a, byte[] b) {\r\n int diff = a.length ^ b.length;\r\n for (int i = 0; i < a.length && i < b.length; i++) {\r\n diff |= a[i] ^ b[i];\r\n }\r\n return diff == 0;\r\n }", "public static boolean Match(Vector a, Vector b){\n return a.axis.length == b.axis.length;\n }", "private static boolean slowEquals(byte[] a, byte[] b) {\n\t int diff = a.length ^ b.length;\n\t for(int i = 0; i < a.length && i < b.length; i++)\n\t diff |= a[i] ^ b[i];\n\t return diff == 0;\n\t }", "public static boolean slowEquals(byte[] a, byte[] b) {\n int diff = a.length ^ b.length;\n for (int i = 0; i < a.length && i < b.length; i++)\n diff |= a[i] ^ b[i];\n return diff == 0;\n }", "private static boolean slowEquals(final byte[] a, final byte[] b) {\n int diff = a.length ^ b.length;\n for (int i = 0; i < a.length && i < b.length; i++) {\n diff |= a[i] ^ b[i];\n }\n return diff == 0;\n }", "boolean hasSameAs();", "public static boolean hasTwoPair(Card[] cards) {\n\t\tint counter = 0;\n\t\tint value = 0;\n\t\tfor(int i = 0; i< cards.length; i++){\n\t\t\tfor(int j = i+1; j< cards.length; j++){\n\t\t\t\tif(cards[i].getValue() == cards[j].getValue() \n\t\t\t\t\t\t&& value !=cards[j].getValue()){\n\t\t\t\t\tcounter++;\n\t\t\t\t\tvalue = cards[j].getValue();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(counter>=2){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean isTwoPairs(){\n \r\n List<PokerCard> pair1;\r\n List<PokerCard> pair2;\r\n \r\n //First possibility: first four cards are two pairs\r\n pair1 = cards.subList(0, 2);\r\n pair2 = cards.subList(2, 4);\r\n if(haveSameValue(pair1) && haveSameValue(pair2)){\r\n handValue = pair2.get(0).getValue();\r\n lowerPairValue = pair1.get(0).getValue();\r\n remainingCardValue = cards.get(cards.size()-1).getValue();\r\n return true;\r\n }\r\n \r\n //Second possibility: First two and last two cards are pairs\r\n pair1 = cards.subList(0, 2);\r\n pair2 = cards.subList(3, 5);\r\n if(haveSameValue(pair1) && haveSameValue(pair2)){\r\n handValue = pair2.get(0).getValue();\r\n lowerPairValue = pair1.get(0).getValue();\r\n remainingCardValue = cards.get(2).getValue();\r\n return true;\r\n }\r\n \r\n //Third possibility: Last four cards are two pairs\r\n pair1 = cards.subList(1, 3);\r\n pair2 = cards.subList(3, 5);\r\n if(haveSameValue(pair1) && haveSameValue(pair2)){\r\n handValue = pair2.get(0).getValue();\r\n lowerPairValue = pair1.get(0).getValue();\r\n remainingCardValue = cards.get(0).getValue();\r\n return true;\r\n }\r\n return false;\r\n }", "public boolean isTwoPair() {\n int numbersSame = 0;\n int pairs = 0;\n for (int i = 0; i < dice.length && numbersSame < 3; i++) {\n numbersSame = 0;\n for (int x = 0; x < dice.length; x++) {\n if (dice[i].getFaceValue() == dice[x].getFaceValue()) {\n numbersSame++;\n }\n }\n if (numbersSame == 2) {\n pairs++;\n }\n }\n return (pairs == 4);\n }", "public boolean equals(Pair otherPair){\n return this.item1 == otherPair.item1 && this.item2 == otherPair.item2;\n }", "boolean checkPermutation(String a, String b) {\r\n\r\n if (a == null || b == null) {\r\n throw new NullPointerException();\r\n }\r\n\r\n if (a.length() != b.length()) {\r\n return false;\r\n }\r\n\r\n Map<Character, Integer> frequencies = getFrequency(a);\r\n\r\n for (int i = 0; i < b.length(); i++) {\r\n char c = b.charAt(i);\r\n\r\n if (frequencies.containsKey(c)) {\r\n int count = frequencies.get(c);\r\n if (count == 0) {\r\n return false;\r\n }\r\n\r\n frequencies.replace(c, count - 1);\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }", "boolean isPermutationBuckets(String s1, String s2) {\n\t\tint[] countsS1 = new int[256];\n\t\tint[] countsS2 = new int[256];\n\t\t\n\t\tif(s1.length() != s2.length()) return false;\n\t\tfor(int i = 0; i < s1.length(); ++i) {\n\t\t\tchar c1 = s1.charAt(i);\n\t\t\tchar c2 = s2.charAt(i);\n\t\t\t++countsS1[c1];\n\t\t\t++countsS2[c2];\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < countsS1.length; ++i) {\n\t\t\tif(countsS1[i] != countsS2[i]) return false;\n\t\t}\n\t\treturn true;\n\t}", "public static long pair(long a, long b) {\n if (a > -1 || b > -1) {\n //Creating an array of the two inputs for comparison later\n long[] input = {a, b};\n\n //Using Cantors paring function to generate unique number\n long result = (long) (0.5 * (a + b) * (a + b + 1) + b);\n\n /*Calling depair function of the result which allows us to compare\n the results of the depair function with the two inputs of the pair\n function*/\n if (Arrays.equals(depair(result), input)) {\n return result; //Return the result\n } else {\n return -1; //Otherwise return rouge value\n }\n } else {\n return -1; //Otherwise return rouge value\n }\n }", "private final static boolean equivalent(Automaton automaton,\n\t\t\tBinaryMatrix equivs, Automaton.Bag b1, Automaton.Bag b2) {\n\t\tint b1_size = b1.size();\n\t\tint b2_size = b2.size();\n\n\t\tif (b1_size != b2_size) {\n\t\t\t// Observe that, unlike a set, the size of a bag will never be\n\t\t\t// changed by the identification of equivalent states. Therefore,\n\t\t\t// the size of both collection must be identical, otherwise they can\n\t\t\t// never be equivalent.\n\t\t\treturn false;\n\t\t}\n\n\t\tint[] b1_children = b1.children;\n\t\tint[] b2_children = b2.children;\n\t\t// maps vertices in b2 to those they are matched against in b1\n\t\tint[] matches = new int[b1_size];\n\t\tArrays.fill(matches, -1);\n\t\t// Used to ensure no vertex is explored more than once during\n\t\t// reconfiguration.\n\t\tboolean[] visited = new boolean[b1_size];\n\t\t\n\t\t// For every state in s1\n\t\tfor (int i = 0; i != b1_size; ++i) {\n\t\t\tint b1_child = b1_children[i];\n\t\t\tif(b1_child < 0) {\n\t\t\t\t// In this case, we have to do something different.\n\t\t\t\tif(!findNegativeMatch(i,b1_children,b2_children,equivs,matches)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tArrays.fill(visited,false);\n\t\t\t\tif(!findMatch(i,b1_children,b2_children,equivs,matches,visited)) {\n\t\t\t\t\t// If we can't find a match, then it's game over and we know for\n\t\t\t\t\t// sure these two states are not equivalent.\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "public static boolean equalsArray(int[] a, int[] b){\n\t\t\tif (a.length != b.length) return false;\n\t\t\t\telse{\n\t\t\t\t\tint i = 0;\n\t\t\t\t\twhile (i < a.length){\n\t\t\t\t\t\tif (a[i] != b[i]) return false;\n\t\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "static boolean bigint_eq(bigint a, bigint b)\n {\n if (a.bigint_sign != b.bigint_sign)\n return false;\n else if (a.bigint_len != b.bigint_len)\n return false;\n else\n {\n for (int i = 0; i < a.bigint_len; i++)\n if (a.bigint_chiffres[i] != b.bigint_chiffres[i])\n return false;\n return true;\n }\n }", "boolean hasXYPairs();", "public boolean isAnagram(String a, String b) {\n if (a.length() != b.length()) {\n return false;\n }\n\n HashMap<Character, Integer> aTable = new HashMap<>();\n\n //Store the counts of all the characters of the first string in a hashmap\n for (int i = 0; i < a.length(); i++) {\n Character currChar = a.charAt(i);\n if (aTable.containsKey(currChar)) {\n aTable.put(currChar, aTable.get(currChar) + 1);\n } else {\n aTable.put(currChar, 1);\n }\n }\n\n //Now iterate through the second string and decrement the count of the characters\n for (int j = 0; j < b.length(); j++) {\n Character currChar = b.charAt(j);\n if (!aTable.containsKey(currChar)) {\n return false;\n } else if (aTable.get(currChar) == 0) {\n return false;\n } else if (aTable.get(currChar) > 0) {\n aTable.put(currChar, aTable.get(currChar) - 1);\n }\n\n }\n\n return true;\n\n\n }", "public boolean paired();", "private static boolean isEqual(int[] nums1, int[] nums2){\n \tfor(int i=0; i<nums1.length; i++){\n \t\tif(nums1[i]!=nums2[i]){\n \t\t\treturn false;\n \t\t}\n \t}\n \treturn true;\n }", "private static boolean equalityTest4(String a, String b)\n {\n if(a.length() == 0 && b.length() == 0)\n {\n return true;\n }\n else\n {\n if(a.length() == 0 || b.length() == 0)\n {\n return false;\n }\n if(a.charAt(0) == b.charAt(0))\n {\n return equalityTest4(a.substring(1), b.substring(1));\n }\n else\n {\n return false;\n }\n }\n }", "private boolean equalsChars(char[] first, char[] second) {\n for (int i = 0; i < second.length; i++)\n if (first[i] != second[i])\n return false;\n return true;\n }", "private boolean comparePersistentIdEntrys(@Nonnull PairwiseId one, @Nonnull PairwiseId other)\n {\n // Do not compare times\n //\n return Objects.equals(one.getPairwiseId(), other.getPairwiseId()) &&\n Objects.equals(one.getIssuerEntityID(), other.getIssuerEntityID()) &&\n Objects.equals(one.getRecipientEntityID(), other.getRecipientEntityID()) &&\n Objects.equals(one.getSourceSystemId(), other.getSourceSystemId()) &&\n Objects.equals(one.getPrincipalName(), other.getPrincipalName()) &&\n Objects.equals(one.getPeerProvidedId(), other.getPeerProvidedId());\n }", "static boolean byteMatch(byte[] a, int aOff, int aLen,\n byte[] b, int bOff, int bLen) {\n if ((aLen != bLen) || (a.length < aOff + aLen) ||\n (b.length < bOff + bLen)) {\n return false;\n }\n \n for (int i = 0; i < aLen; i++) {\n if (a[i + aOff] != b[i + bOff]) {\n return false;\n }\n }\n\n return true;\n }", "public abstract boolean isSameDirection(double[] direction1, double[] direction2);", "public static boolean compare(byte[] a, byte[] b) {\n\t\tif (a.length!=b.length) return false;\n\t\tfor (int i=0; i<a.length; i++)\n\t\t\tif (a[i]!=b[i]) return false;\n\t\treturn true;\n\t}", "private void assertEquivalentPair(Set<Pair> result, String s1, String s2) {\n\t\tPair resultPair = filterResult(result, s1, s2);\n\t\tassertFalse(resultPair.isMarked());\n\t}", "private boolean sameElements(List firstList, List secondList)\r\n\t{\r\n\t\t\r\n\t\t// The size hould be the same, otherwise stop.\r\n\t\tif (firstList.size() != secondList.size())\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\t// Iterate over the elements of the first list.\r\n\t\tfor (int index = 0; index < firstList.size(); index++)\r\n\t\t{\r\n\t\t\t// Check if the element is also in the second list.\r\n\t\t\tif (!secondList.contains(firstList.get(index)))\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// They heve the same elements.\r\n\t\treturn true;\r\n\t}", "public boolean checkPalindromeFormation(String a, String b) {\n int n = a.length();\n return findCommonSubstring(a.toCharArray(), b.toCharArray(), 0, n - 1) ||\n findCommonSubstring(b.toCharArray(), a.toCharArray(), 0, n - 1);\n }", "private boolean rangeEquals(Object [] b1, Object [] b2, int length)\n /*! #end !*/\n {\n for (int i = 0; i < length; i++)\n {\n if (!Intrinsics.equalsKType(b1[i], b2[i]))\n {\n return false;\n }\n }\n\n return true;\n }", "public static boolean similarFrequencies(ArrayList<Character> a, char b) {\n\t\tboolean dup = true;\n\t\tfor (int i = 0; i<a.size(); i++) {\n\t\t\t\tif (a.get(i) == b) {\n\t\t\t\t\tdup = false;\n\t\t\t\t}\n\t\t\t}\n\t\treturn dup;\n\t}", "public static boolean equal(int[] one, int[] two)\r\n {\r\n if(one.length!=two.length) return false;\r\n for(int i= 0; i<one.length; i++) \r\n {\r\n if(one[i]!=two[i]) return false;\r\n }\r\n return true;\r\n }", "public boolean anagram(char [] a, char [] b);", "boolean sameName(String a, String b){\n\t\tif(a.length()!=b.length()){\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tfor(int i=0;i<a.length();i++){\r\n\t\t\tif(a.charAt(i)!=b.charAt(i)){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public static boolean equalQuick(final Object a, final Object b) {\n \treturn a == b || ((a != null & b != null) && a.equals(b));\n }", "private static boolean equalityTest2(String a, String b)\n {\n return a.equals(b);\n }", "private static boolean compareByteArray(byte[] a1, byte[] a2, int length){\n for (int i = 0 ; i < length ; i++){\n if(a1[i] != a2[i])\n return false;\n else\n System.out.println(\"-------------------GOOD ---[ \"+ i);// log feedback\n }\n return true;\n }", "public static void main(String[] args) {\n Pair first = new Pair(\"Pesho\", \"Gosho\");\r\n Pair second = new Pair(\"Pesho\", \"Gosho\");\r\n Pair third = new Pair(\"Pesho\", \"Mariika\");\r\n \r\n System.out.println(first.equals(second));\r\n System.out.println(first.equals(third));\r\n }", "static int ifEquals(int x, int y, int a, int b) { \n //return x==y?a:b; \n return onEqu1(x, y, a, b, ((x-y)-1)>>31);\n }", "private static boolean equalityTest1(String a, String b)\n {\n return a == b;\n }", "private static boolean equalityTest3(String a, String b)\n {\n return System.identityHashCode(a) == System.identityHashCode(b);\n }", "public boolean doWeHaveSameStops(String corridorA, String corridorB);", "public static boolean isPermutation(String s1, String s2) {\n // TODO\n /** using set, and add a compare method in the set interface */\n return false;\n }", "public boolean isPair() {\n \t\n return (rankSet().size() ==4);\n }", "public boolean RepVec(String []a){\n boolean rep=false;\n String aux1=\"\",aux2=\"\";\n for (int i = 0; i < a.length; i++) {\n aux1=a[i];\n for (int j = 0; j < a.length; j++) {\n aux2=a[j];\n if( i!=j ){ \n if(aux1==aux2){\n rep=true;\n return rep;\n } \n } \n }\n }\n return rep;\n \n }", "public boolean hasTwoPair(Hand handToCheck){\n\t\tHand hand = new FiveCardHand(handToCheck); //Make copy of the object so original doesn't get modified\n\t\tHand firstPair = getPair(hand);\n\t\tif(firstPair == null){\n\t\t\treturn false;\n\t\t}\n\t\tlog.debug(\"First Pair = \"+firstPair);\n\t\thand.removeHand(firstPair);\n\t\tHand secondPair = getPair(hand);\n\t\tif(secondPair == null){\n\t\t\treturn false;\n\t\t}\n\t\tlog.debug(\"Second Pair = \"+secondPair);\n\n\t\tlog.debug(\"returning true\");\n\t\treturn true;\n\t}", "private static boolean isAnagram(String a, String b) {\n\t\tint[] charsA = new int[26];\n\t\tint[] charsB = new int[26];\n\t\t\n\t\tfor(int i = 0 ; i < a.length(); i++)\n\t\t\tcharsA[a.charAt(i) - 'a']++;\n\t\tfor(int i = 0 ; i < b.length(); i++)\n\t\t\tcharsB[b.charAt(i) - 'a']++;\n\t\t\n\t\tfor(int i = 0 ; i < 26 ; i++) \n\t\t\tif(charsA[i] != charsB[i])\n\t\t\t\treturn false;\n\t\treturn true;\n\t}", "public boolean adjacent(String a, String b) {\n\t\tint nDifferent = 0;\n\t\tint length = a.length();\n\t\tfor (int i = 0; i < length; i++) {\n\t\t\tif (a.charAt(i) != b.charAt(i)) {\n\t\t\t\tnDifferent++;\n\t\t\t}\n\t\t\tif (nDifferent > 1)\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private boolean isSameColumnKeyComponent(ByteBuffer[] components1, ByteBuffer[] components2) {\n\t\tfor (int i = columnAliasNames.length - 1; i >= 0; i--) {\n\t\t\tif (!components1[i].equals(components2[i]))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public static boolean isNeighbor(String a, String b) {\n assert a.length() == b.length();\n int differ = 0;\n for (int i = 0; i < a.length(); i++) {\n if (a.charAt(i) != b.charAt(i))\n differ++;\n if (differ > 1)\n return false;\n }\n return true;\n }", "public boolean isIsomorphic(String str1, String str2) {\r\n if(str1.length() != str2.length()) return false;\r\n \r\n int[] arr1 = new int[256];\r\n int[] arr2 = new int[256];\r\n \r\n Arrays.fill(arr1, -1);\r\n Arrays.fill(arr2, -1);\r\n \r\n for(int i=0;i<str1.length();i++){\r\n int value1 = str1.charAt(i);\r\n int value2 = str2.charAt(i);\r\n if(arr1[value1]== -1){\r\n arr1[value1] = value2;\r\n } else {\r\n if(arr1[value1] != value2) return false;\r\n }\r\n \r\n if(arr2[value2]== -1){\r\n arr2[value2] = value1;\r\n } else {\r\n if(arr2[value2] != value1) return false;\r\n }\r\n \r\n }\r\n return true;\r\n \r\n}", "protected boolean checkTwoPairs(ReturnValue returnValueTwoPairs, ReturnValue returnValueOnePair) {\n\t\tboolean returnBool = false;\n\n\t\tif (returnValueOnePair.getIsPossible()) {\n\t\t\tint localCheck = 0;\n\t\t\tint localPoints = 0;\n\t\t\tboolean localBool = false;\n\n\t\t\tfor (int i = 0; i < 5; i++) {\n\t\t\t\tfor (int j = 0; j < 5; j++) {\n\t\t\t\t\tif (intList.get(i) == intList.get(j) && intList.get(i) != returnValueOnePair.getTheDiceInt()) {\n\t\t\t\t\t\tlocalCheck++;\n\t\t\t\t\t\tif (localCheck == 2) {\n\t\t\t\t\t\t\tlocalBool = true;\n\t\t\t\t\t\t\tif (localPoints < intList.get(i) * 2) {\n\t\t\t\t\t\t\t\tlocalPoints = intList.get(i) * 2;\n\t\t\t\t\t\t\t\tlocalPoints += returnValueOnePair.getPoints();\n\t\t\t\t\t\t\t\treturnValueTwoPairs.setValue(localBool, localPoints, Box.TWO_PAIRS);\n\t\t\t\t\t\t\t\treturnBool = true;\n\t\t\t\t\t\t\t\treturn returnBool;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlocalCheck = 0;\n\t\t\t}\n\t\t\treturnValueTwoPairs.setValue(localBool, localPoints, Box.TWO_PAIRS);\n\t\t}\n\t\treturn returnBool;\n\t}", "private static final boolean equal(Object a, Object b) {\n if (a == b)\n return true;\n if (a == null)\n return false;\n if (b == null)\n return false;\n return a.equals(b);\n }", "public static boolean constantTimeEq(byte[] a, byte[] b) {\n if (a.length != b.length) {\n return false;\n }\n int result = 0;\n for (int i = 0; i < a.length; i++) {\n result |= a[i] ^ b[i];\n }\n return result == 0;\n }", "public static boolean isAnagram(char[]s1, char[]s2)\r\n{\n\t if(s1.length!=s2.length)\r\n\t\t return false; \r\n\t \r\n\t //sort both strings using Arrays sort method\r\n\t Arrays.sort(s1); \r\n\t Arrays.sort(s2);\r\n\t \r\n\t for(int i=0; i<s1.length;i++)\r\n\t if(s1[i]!=s2[i])\r\n\t\t return false; \r\n\t\r\n\treturn true; \r\n\t \r\n}", "private static boolean isPermutation(String str1, String str2) {\r\n if (!validate(str1, str2)) {\r\n return false;\r\n }\r\n if (str1.isEmpty() && str2.isEmpty()) { // simple case\r\n return true; // empty strings are permutation of each other\r\n }\r\n\r\n return fillCounter(str1).equals(fillCounter(str2));\r\n }", "public boolean hasTwoP(ArrayList<Card> cards) {\r\n\t\tCollections.sort(cards);\r\n\t\tboolean retVal = false;\r\n\t\tint numPairs = 0;\r\n\t\tint counter;// counts how many of those cards are in the hand\r\n\t\tint pairVal = 0;\r\n\t\tfor (int i = 0; i <cards.size()-1; i++) {\r\n\t\t\tcounter = 1;\r\n\t\t\tfor (int j = i+1; j < cards.size(); j++) {\r\n\t\t\t\tif(cards.get(i).getValue() == cards.get(j).getValue() &&\r\n\t\t\t\t\t\tcards.get(i).getValue() != pairVal){\r\n\t\t\t\t\tcounter++;\r\n\t\t\t\t\tpairVal = cards.get(j).getValue();\r\n\t\t\t\t\tif(counter > 1) {\r\n\t\t\t\t\t\tnumPairs++;\r\n\t\t\t\t\t\tif (numPairs == 2) {\r\n\t\t\t\t\t\t\tretVal = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn retVal;\r\n\t}", "public boolean equals(Object other)\n\t{\n\t\tif (other == null || other instanceof Pair<?> == false)\n\t\t\treturn false;\n\t\t\n\t\t@SuppressWarnings(\"unchecked\") //safe cast\n\t\tPair<T> p = (Pair<T>) other;\n\t\t\n\t\tif ((first.equals(p.first) && second.equals(p.second)) || (first.equals(p.second) && second.equals(p.first)))\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}", "int main()\n{\nint a,b,count=0;\ncin>>a>>b;\nint arr1[a],arr2[b];\n for(int i=0;i<a;i++)\n {\ncin>>arr1[i];\n }\n for(int i=0;i<b;i++)\n {\ncin>>arr2[i];\n }\n if(a==b)\n {\n for(int i=0;i<a;i++)\n {\n if(arr1[i]==arr2[i])\n {\n count++;\n }\n }\n if(count==a)\n {\ncout<<\"Same\";\n }\n else\n {\ncout<<\"Not Same\";\n }\n }\n else\n {\ncout<<\"Not Same\";\n}\n}", "public boolean Permutation(String A, String B) {\n int[] res = new int[256];\n if(A.length()!=B.length()) return false;\n for(int i=0;i<A.length();i++){\n res[A.charAt(i)]++;\n res[B.charAt(i)]--;\n }\n for(int i=0;i<res.length;i++){\n if(res[i]!=0) return false;\n }\n return true;\n }", "private int pairContains(HashMap<Integer,HashSet<Integer>> pairs, int k1, int k2){\n\t\t\n\t\t\n\t\t\tif(pairs.containsKey(k1))\n\t\t\t\tif(pairs.get(k1).contains(k2))\n\t\t\t\t\treturn 2;\n\t\t\t\telse\n\t\t\t\t\treturn 1;\n\t\t\n\t\treturn 0;\n\t}", "@Override // com.google.common.base.Equivalence\n public boolean doEquivalent(Object a, Object b) {\n return false;\n }", "public static boolean isAnagram2(String s1, String s2) {\r\n List<Character> list = new ArrayList<>();\r\n\r\n for (char c : s1.toCharArray()) {\r\n list.add(c);\r\n }\r\n\r\n for (char c : s2.toCharArray()) {\r\n list.remove(new Character(c));\r\n }\r\n\r\n return (list.isEmpty());\r\n }", "private boolean isCanLink(String[] strA1, String[] strA2) {\n\t\tboolean flag = true;\n\t\tif(strA1.length != strA2.length){\n\t\t\treturn false;\n\t\t}else {\n\t\t\tfor(int i = 0; i < strA1.length - 1; i++){\n\t\t\t\tif(!strA1[i].equals(strA2[i])){\n\t\t\t\t\tflag = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(strA1[strA1.length -1].equals(strA2[strA1.length -1])){\n\t\t\t\tflag = false;\n\t\t\t}\n\t\t}\n\t\treturn flag;\n\t}", "public static boolean same_int(int a, int b){\n if(a == b) {\n return true;\n } else {\n return false;\n }\n }", "private static boolean sameDestination(Reservation a, Reservation b){\n\t\tif( (a.seatOwner() == b.seatOwner() ) && ( a.seatDestination() == b.seatDestination() ) ){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public static boolean isPermutation(String str1, String str2)\r\n\t{\r\n\t\t if(str1.length() != str2.length()) return false;\r\n\t\t char[] charset1 = str1.toCharArray();\r\n\t\t char[] charset2 = str2.toCharArray();\r\n\t\t HashMap<Character, Integer> hashmap = new HashMap<Character, Integer>();\r\n\t\t \r\n\t\t for(char c : charset1)\r\n\t\t {\r\n\t\t\t if(!hashmap.containsKey(c)) hashmap.put(c, 1);\r\n\t\t\t else hashmap.put(c, hashmap.get(c) + 1);\r\n\t\t }\r\n\t\t \r\n\t\t for(char c : charset2)\r\n\t\t {\r\n\t\t\t if(!hashmap.containsKey(c) || hashmap.get(c) == 0) return false; \r\n\t\t\t hashmap.put(c, hashmap.get(c) - 1);\r\n\t\t }\r\n\t\t \r\n\t\t return true;\r\n\t}", "private boolean complementsBlockBuffer(Block b) {\n for (Block i : blockBuffer) {\n if (b.prevHash.equals(i.hash)) {\n return true;\n }\n }\n return false;\n }", "public static boolean isPermutation(String s1, String s2) {\n if (s1 == null || s2 == null) {\n return false;\n }\n\n if (s1.length() != s2.length()) {\n return false;\n }\n\n int[] charCounterArr = new int[256];\n\n char[] s1CharArr = s1.toCharArray();\n char[] s2CharArr = s2.toCharArray();\n\n // counting the characters in s1;\n for (int i = 0; i < s1CharArr.length; i++) {\n int index = s1CharArr[i];\n charCounterArr[index] = charCounterArr[index] + 1;\n }\n\n // now check whether characters in s2 are in s1\n // pay attention to characters that appear more than once\n for (int i = 0; i < s2CharArr.length; i++) {\n int index = s2CharArr[i];\n // expecting the value to be 1 or more.\n // if see 0, means that there was a mismatch\n int value = charCounterArr[index];\n if (value == 0) {\n return false;\n }\n value--;\n // now update the value\n charCounterArr[index] = value;\n }\n return true;\n\n }", "@Test\n public void testHashCodeAndEquals() {\n Set<Pair<String, String>> pairs = IntStream.rangeClosed(1, 10).mapToObj( i->Pair.of(\"l\"+i, \"r\"+i)).collect( toSet() );\n assertEquals( 10, pairs.size() );\n assertTrue( pairs.contains(Pair.of(\"l1\", \"r1\")));\n assertFalse( pairs.contains(Pair.of(\"l100\", \"r100\")));\n }", "public boolean checkAnagram(String s1, String s2) {\n if (s1.length() != s2.length()) {\n return false;\n }\n char[] stringArr1 = s1.toCharArray();\n char[] stringArr2 = s2.toCharArray();\n Arrays.sort(stringArr1);\n Arrays.sort(stringArr2);\n\n for (int i = 0; i < stringArr1.length; i++) {\n if (stringArr1[i] != stringArr1[i]) {\n return false;\n }\n }\n return true;\n }", "public static boolean permuteCompare(String strA, String strB) {\n\t\tif(strA == null || strB == null)\n\t\t\treturn false;\n\t\t\n\t\t/*\n\t\t * Step 2: Check if the length of both strings is not equal, then they will not match\n\t\t */\n\t\tif(strA.length() != strB.length()) \n\t\t\treturn false;\n\t\t\n\t\t/*\n\t\t * Step 3: Convert both strings to ArrayList (split method looks like not a elegant way, but works)\n\t\t */\n\t\tList<String> strAList = new ArrayList<String>(Arrays.asList(strA.split(\"\")));\n\t\tList<String> strBList = new ArrayList<String>(Arrays.asList(strB.split(\"\")));\n\t\t\n\t\t/*\n\t\t * Step 4: Sort both ArrayList using Collections\n\t\t */\n\t\tCollections.sort(strAList);\n\t\tCollections.sort(strBList);\n\t\t\n\t\t/*\n\t\t * Step 5: Compare them using equals that will compare size and each element value (Ref: https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#equals-java.lang.Object-)\n\t\t */\n\t\tif(!strAList.equals(strBList))\n\t\t\treturn false;\n\n\t\treturn true;\n\t}", "private static boolean equals(int[] array1, int[] array2) {\n if(array1.length != array2.length)\n return false;\n \n Arrays.sort(array1);\n Arrays.sort(array2);\n \n int i = 0;\n for(; i < array1.length; ++i) {\n if(array1[i] != array2[i])\n break;\n }\n \n return (i == array1.length);\n }", "public static boolean isAnagramImperApproach(char[] str1, char[] str2) {\n int n1 = str1.length;\n int n2 = str2.length;\n\n if (n1 != n2) return false;\n\n Arrays.sort(str1);\n Arrays.sort(str2);\n\n for (int i = 0; i < n1; i++) {\n if (str1[i] != str2[i]) {\n return false;\n }\n }\n return true;\n }", "static boolean areAnagram(char[] str1, char[] str2)\n\t{\n\t\t// Get lengths of both strings\n\t\tint n1 = str1.length;\n\t\tint n2 = str2.length;\n\n\t\t// If length of both strings is not same,\n\t\t// then they cannot be anagram\n\t\tif (n1 != n2)\n\t\t\treturn false;\n\n\t\t// Sort both strings\n\t\tArrays.sort(str1);\n\t\tArrays.sort(str2);\n\n\t\t// Compare sorted strings\n\t\tfor (int i = 0; i < n1; i++)\n\t\t\tif (str1[i] != str2[i])\n\t\t\t\treturn false;\n\n\t\treturn true;\n\t}", "private boolean adjacent(Location a, Location b)\n {\n for (Location loc: getAdjacentLocations(a))\n {\n if (loc.equals(b))\n return true;\n }\n return false;\n }" ]
[ "0.75111294", "0.6855549", "0.68396425", "0.67834973", "0.6730056", "0.6685752", "0.66554165", "0.6589773", "0.65781456", "0.65423876", "0.653856", "0.6530745", "0.6502255", "0.650178", "0.6486586", "0.6439017", "0.6424096", "0.6377158", "0.6352817", "0.62959546", "0.6266301", "0.6251596", "0.6244468", "0.622913", "0.6224922", "0.62225884", "0.6214703", "0.62142265", "0.62075245", "0.6192389", "0.61859626", "0.6167635", "0.61575836", "0.61508584", "0.6107008", "0.6097528", "0.60949147", "0.6088735", "0.6072838", "0.60520107", "0.60517365", "0.6037237", "0.60261536", "0.6023954", "0.6014214", "0.6004694", "0.60028857", "0.6000433", "0.59933543", "0.597877", "0.5973196", "0.596788", "0.59556127", "0.5928987", "0.5925855", "0.5922994", "0.5900282", "0.5898511", "0.58979774", "0.58926976", "0.58891153", "0.5881891", "0.58771914", "0.5876935", "0.5876695", "0.5873268", "0.5854913", "0.58515346", "0.58417195", "0.58337617", "0.58309937", "0.58199006", "0.581877", "0.581405", "0.5809781", "0.5807172", "0.5806423", "0.57973945", "0.5770118", "0.57657295", "0.5760416", "0.57590765", "0.5750275", "0.5745382", "0.5745221", "0.57391036", "0.57361805", "0.5732674", "0.5731732", "0.5729948", "0.5728912", "0.5708401", "0.57059824", "0.56952035", "0.5688269", "0.5686077", "0.5679081", "0.5676709", "0.56658727", "0.5662226" ]
0.72148275
1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof Hospedaje_Salon)) { return false; } Hospedaje_Salon other = (Hospedaje_Salon) object; if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.getId().equals(other.getId()))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void setId(int id) { this.id = id; }", "public void setId(int id) { this.id = id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public void setId(long id) { this.id = id; }", "public void setId(long id) { this.id = id; }", "public int getId(){ return id; }", "public int getId() {return id;}", "public int getId() {return Id;}", "public int getId(){return id;}", "public void setId(long id) {\n id_ = id;\n }", "private int getId() {\r\n\t\treturn id;\r\n\t}", "public Integer getId(){return id;}", "public int id() {return id;}", "public long getId(){return this.id;}", "public int getId(){\r\n return this.id;\r\n }", "@Override public String getID() { return id;}", "public Long id() { return this.id; }", "public Integer getId() { return id; }", "@Override\n\tpublic Integer getId() {\n return id;\n }", "@Override\n public Long getId () {\n return id;\n }", "@Override\n public long getId() {\n return id;\n }", "public Long getId() {return id;}", "public Long getId() {return id;}", "public String getId(){return id;}", "@Override\r\n\tpublic Long getId() {\n\t\treturn null;\r\n\t}", "public Integer getId() { return this.id; }", "@Override\r\n public int getId() {\n return id;\r\n }", "@Override\n\t\tpublic long getId() {\n\t\t\treturn 0;\n\t\t}", "public int getId() {\n return id;\n }", "public long getId() { return _id; }", "public int getId() {\n/* 35 */ return this.id;\n/* */ }", "public long getId() { return id; }", "public long getId() { return id; }", "public void setId(Long id) \n {\n this.id = id;\n }", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "public void setId(String id) {\n this.id = id;\n }", "@Override\n\tpublic void setId(Long id) {\n\t}", "public Long getId() {\n return id;\n }", "public long getId() { return this.id; }", "public int getId()\n {\n return id;\n }", "public void setId(int id){\r\n this.id = id;\r\n }", "@Test\r\n\tpublic void testSetId() {\r\n\t\tbreaku1.setId(5);\r\n\t\texternu1.setId(6);\r\n\t\tmeetingu1.setId(7);\r\n\t\tteachu1.setId(8);\r\n\r\n\t\tassertEquals(5, breaku1.getId());\r\n\t\tassertEquals(6, externu1.getId());\r\n\t\tassertEquals(7, meetingu1.getId());\r\n\t\tassertEquals(8, teachu1.getId());\r\n\t}", "protected abstract String getId();", "@Override\n\tpublic int getId(){\n\t\treturn id;\n\t}", "public int getID() {return id;}", "public int getID() {return id;}", "public String getId() { return id; }", "public String getId() { return id; }", "public String getId() { return id; }", "public int getId ()\r\n {\r\n return id;\r\n }", "@Override\n public int getField(int id) {\n return 0;\n }", "public void setId(Long id)\n/* */ {\n/* 66 */ this.id = id;\n/* */ }", "public int getId(){\r\n return localId;\r\n }", "void setId(int id) {\n this.id = id;\n }", "@Override\n public Integer getId() {\n return id;\n }", "@Override\n\tpublic Object selectById(Object id) {\n\t\treturn null;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "@Override\n public int getId() {\n return id;\n }", "@Override\n public int getId() {\n return id;\n }", "public void setId(int id)\n {\n this.id=id;\n }", "@Override\r\n public int getID()\r\n {\r\n\treturn id;\r\n }", "@Override\n\tpublic Integer getId() {\n\t\treturn null;\n\t}", "public int getId()\r\n {\r\n return id;\r\n }", "public void setId(Long id){\n this.id = id;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "private void clearId() {\n \n id_ = 0;\n }", "final protected int getId() {\n\t\treturn id;\n\t}", "public abstract Long getId();", "public void setId(Long id) \r\n {\r\n this.id = id;\r\n }", "@Override\n public long getId() {\n return this.id;\n }", "public String getId(){ return id.get(); }", "@SuppressWarnings ( \"unused\" )\n private void setId ( final Long id ) {\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(Integer id)\r\n/* */ {\r\n/* 122 */ this.id = id;\r\n/* */ }", "public Long getId() \n {\n return id;\n }", "@Override\n\tpublic void setId(int id) {\n\n\t}", "public void test_getId() {\n assertEquals(\"'id' value should be properly retrieved.\", id, instance.getId());\n }", "@Override\r\n\tpublic Object getId() {\n\t\treturn null;\r\n\t}", "public int getID(){\n return id;\n }", "public int getId()\n {\n return id;\n }", "public String getID(){\n return Id;\n }" ]
[ "0.6896886", "0.6838461", "0.67056817", "0.66419715", "0.66419715", "0.6592331", "0.6579151", "0.6579151", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.65624106", "0.65624106", "0.65441847", "0.65243006", "0.65154546", "0.6487427", "0.6477893", "0.6426692", "0.6418966", "0.6416817", "0.6401561", "0.63664836", "0.63549376", "0.63515353", "0.6347672", "0.6324549", "0.6319196", "0.6301484", "0.62935394", "0.62935394", "0.62832105", "0.62710917", "0.62661785", "0.6265274", "0.6261401", "0.6259253", "0.62559646", "0.6251244", "0.6247282", "0.6247282", "0.6245526", "0.6238957", "0.6238957", "0.6232451", "0.62247443", "0.6220427", "0.6219304", "0.6211484", "0.620991", "0.62023336", "0.62010616", "0.6192621", "0.61895776", "0.61895776", "0.61893976", "0.61893976", "0.61893976", "0.6184292", "0.618331", "0.61754644", "0.6173718", "0.6168409", "0.6166131", "0.6161708", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.61556244", "0.61556244", "0.61430943", "0.61340135", "0.6128617", "0.6127841", "0.61065215", "0.61043483", "0.61043483", "0.6103568", "0.61028486", "0.61017346", "0.6101399", "0.6098963", "0.6094214", "0.6094", "0.6093529", "0.6093529", "0.6091623", "0.60896", "0.6076881", "0.60723215", "0.6071593", "0.6070138", "0.6069936", "0.6069529" ]
0.0
-1
Parses out first and last names and original filename
private String grabNameFile(String absPath) { // parse filename from absolute path String[] delimSlashes = absPath.split("/"); String fn = delimSlashes[delimSlashes.length - 1]; if (fn.substring(0, 5).equals("files")) { fn = fn.substring(5); // removes "files" from the beginning which is prepended by the Android Beam API } // split string based on underscores String[] result = fn.split("_"); if (result.length < 3) { //error, this means first/last name wasn't appended return null; } // the order of the names is (last,first) when sent by the sender: mFirstName = result[1]; mLastName = result[0]; return fn; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static String fixAuthor_lastnameFirst(String in){\n \n // Check if we have cached this particular name string before:\n Object old = Globals.nameCache_lastFirst.get(in);\n if (old != null)\n return (String)old;\n \n //Util.pr(\"lastnamefirst: in\");\n StringBuffer sb=new StringBuffer();\n \n String[] authors = in.split(\" and \");\n for(int i=0; i<authors.length; i++){\n \t authors[i]=authors[i].trim();\n \t int comma = authors[i].indexOf(',');\n \t test:if (comma >= 0) {\n \t // There is a comma, so we assume it's ok.\n \t sb.append(authors[i]);\n }\n else {\n // The name is without a comma, so it must be rearranged.\n int pos = authors[i].lastIndexOf(' ');\n if (pos == -1) {\n // No spaces. Give up and just add the name.\n sb.append(authors[i]);\n break test;\n }\n String surname = authors[i].substring(pos+1);\n if (surname.equalsIgnoreCase(\"jr.\")) {\n pos = authors[i].lastIndexOf(' ', pos - 1);\n if (pos == -1) {\n // Only last name and jr?\n sb.append(authors[i]);\n break test;\n }\n else\n surname = authors[i].substring(pos+1);\n }\n // Ok, we've isolated the last name. Put together the rearranged name:\n sb.append(surname + \", \");\n sb.append(authors[i].substring(0, pos));\n \n }\n if (i != authors.length - 1)\n sb.append(\" and \");\n }\n /*String[] t = authors[i].split(\",\");\n if(t.length < 2) {\n // The name is without a comma, so it must be rearranged.\n t = authors[i].split(\" \");\n if (t.length > 1) {\n sb.append(t[t.length - 1]+ \",\"); // Last name\n for (int j=0; j<t.length-1; j++)\n sb.append(\" \"+t[j]);\n } else if (t.length > 0)\n sb.append(t[0]);\n }\n else {\n // The name is written with last name first, so it's ok.\n sb.append(authors[i]);\n }\n \n if(i !=authors.length-1)\n sb.append(\" and \");\n \n }*/\n //Util.pr(in+\" -> \"+sb.toString());\n String fixed = sb.toString();\n \n // Add the fixed name string to the cache.\n Globals.nameCache_lastFirst.put(in, fixed);\n \n return fixed;\n }", "public void getFirstAndLastName( String name ){//\r\n String nameNew = name.trim();\r\n String[] arr = nameNew.split(\"\\\\s\");\r\n firstName = arr[0];\r\n lastName = arr[1];\r\n }", "java.lang.String getLastName();", "java.lang.String getLastName();", "public void extractAuthorsName() {\r\n try {\r\n // gets all matched objects for Author Name.\r\n Matcher matcherObject = matcher.patternMatcher(\"AuthorsName\");\r\n\r\n // add name to outputResult\r\n while (matcherObject.find()) {\r\n format.Formatter(1, matcherObject.group(1));\r\n isValidFile = true;\r\n }\r\n\r\n } catch (Exception e) {\r\n System.out.println(\"Error has occured in extractAuthorsName method\");\r\n }\r\n }", "private static String[] extractName(String[] fileNames) {\n\t\tString[] nameOfFiles = new String[4];\n\t\tString[] file = null;\n\t\tString fileName = \"\";\n\t\tString name = \"\";\n\t\t\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tfile = fileNames[i].split(\"\\\\/\");\n\t\t\tfileName = file[file.length - 1];\n\t\t\tname = fileName.substring(0, fileName.length() - 10);\n\t\t\tnameOfFiles[i] = name;\n\t\t}\n\t\t\n\t\treturn nameOfFiles;\n\t}", "private String createName(String line) {\n line = line.replace(\"(L)\",\"\").replace(\"(D)\",\"\").replace(\"(R)\",\"\").replace(\"(I)\",\"\").replace(\"(\",\"\").replace(\")\",\"\");\n String firstName;\n String middleName = \"\";\n String lastName;\n String postNominal = \"\";\n\n firstName = line.split(\",\")[1].trim();\n if (firstName.contains(\" \")){\n middleName = firstName.split(\" \")[1];\n firstName = firstName.split(\" \")[0];\n }\n lastName = line.split(\",\")[0];\n if(lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"iii\")\n || lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"ii\")\n || lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"sr\")\n || lastName.split(\" \")[lastName.split(\" \").length-1].toLowerCase().equals(\"jr\")){\n postNominal = lastName.split(\" \")[1];\n lastName = lastName.split(\" \")[0];\n }\n\n return firstName.trim() + \",\" + middleName.trim() + \",\" + lastName.trim() + \",\" + postNominal.trim();\n }", "private String extractFileName(Part part) {\n\t\tString contentDisp = part.getHeader(\"content-disposition\");\n\t\tString[] items = contentDisp.split(\";\");\n\t\tfor (String s : items) {\n\t\t\tif (s.trim().startsWith(\"filename\")) {\n\t\t\t\t// C:\\file1.zip\n\t\t\t\t// C:\\Note\\file2.zip\n\t\t\t\tString clientFileName = s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\n\t\t\t\tclientFileName = clientFileName.replace(\"\\\\\", \"/\");\n\t\t\t\tint i = clientFileName.lastIndexOf('/');\n\t\t\t\t// file1.zip\n\t\t\t\t// file2.zip\n\t\t\t\treturn clientFileName.substring(i + 1);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "private String extractFileName(Part part) {\n\t\tString contentDisp = part.getHeader(\"content-disposition\");\n\t\tString[] items = contentDisp.split(\";\");\n\t\tfor (String s : items) {\n\t\t\tif (s.trim().startsWith(\"filename\")) {\n\t\t\t\t// C:\\file1.zip\n\t\t\t\t// C:\\Note\\file2.zip\n\t\t\t\tString clientFileName = s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\n\t\t\t\tclientFileName = clientFileName.replace(\"\\\\\", \"/\");\n\t\t\t\tint i = clientFileName.lastIndexOf('/');\n\t\t\t\t// file1.zip\n\t\t\t\t// file2.zip\n\t\t\t\treturn clientFileName.substring(i + 1);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "String getLastName();", "String getLastName();", "String getOriginalName();", "public String getSecondFilename() {\n\t\tTreeMap<Double,File> tm = new TreeMap<Double,File>();\n\t\tFile file=new File(\"C:\\\\temp\");\n\t\tFile subFile[] = file.listFiles();\n\t\tint fileNum = subFile.length;\n\t\tfor (int i = 0; i < fileNum; i++) {\n\t\t Double tempDouble = new Double(subFile[i].lastModified());\n\t\t tm.put(tempDouble, subFile[i]);\n\t\t }\t \n\t\t System.out.println(\"第二个log的文件名称-->\"+tm.get(tm.lastKey()).getName());\n\t\t return tm.get(tm.lastKey()).getName();\n\t}", "public String getFileNamingDetails();", "public String getFirstFilename() {\n\t\tTreeMap<Double,File> tm = new TreeMap<Double,File>();\n\t\tFile file=new File(\"C:\\\\temp\");\n\t\tFile subFile[] = file.listFiles();\n\t\tint fileNum = subFile.length;\n\t\tfor (int i = 0; i < fileNum; i++) {\n\t\t Double tempDouble = new Double(subFile[i].lastModified());\n\t\t tm.put(tempDouble, subFile[i]);\n\t\t }\t \n\t\tint count=0;\n\t\tString fileName=null;\n\t\tSet<Double> set = tm.keySet();\n\t\tIterator<Double> it = set.iterator();\n\t\twhile (it.hasNext()) {\n\t\t Object key = it.next();\n\t\t Object objValue = tm.get(key);\n\t\t File tempFile = (File) objValue;\n\t\t if(count==fileNum-2)\n\t\t\t fileName=tempFile.getName();\n\t\t count++;\n\t\t }\n\t\tSystem.out.println(\"第一个log的文件名称-->\"+fileName);\n\t\treturn fileName;\n\t}", "public static String secondName(String s) {\n\t\tint s0 = s.indexOf(FILE_SEP);\n\t\tint s1 = s.lastIndexOf(FILE_SEP);\n\t\tif (s0 != -1 && s1 != -1 ){\n\t\t\tif (s0 != s1) \treturn s.substring(s0 + 1, s1);//1\n\t\t\tif (s0 == s1) \treturn s.substring(s0 + 1);//2\n\t\t}\n\t\treturn \"\";\n\t}", "private FileNamePieces extractFileNamePieces(RepoPath repoPath) {\n String fullFileName = repoPath.getName();\n String[] zipExtensionPieces = fullFileName.split(\"\\\\.\");\n String extension = zipExtensionPieces[zipExtensionPieces.length - 1];\n int extensionStart = fullFileName.indexOf(extension) - 1;\n String extensionRemovedFileName = fullFileName.substring(0, extensionStart);\n\n String[] componentNameHashPieces = extensionRemovedFileName.split(\"-\");\n String hash = componentNameHashPieces[componentNameHashPieces.length - 1];\n int hashStart = extensionRemovedFileName.indexOf(hash) - 1;\n String componentName = extensionRemovedFileName.substring(0, hashStart).toLowerCase();\n\n return new FileNamePieces(componentName, hash, extension);\n }", "private String extractFileName(Part part) {\n\t String contentDisp = part.getHeader(\"content-disposition\");\r\n\t String[] items = contentDisp.split(\";\");\r\n\t for (String s : items) {\r\n\t if (s.trim().startsWith(\"filename\")) {\r\n\t // C:\\file1.zip\r\n\t // C:\\Note\\file2.zip\r\n\t String clientFileName = s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\r\n\t clientFileName = clientFileName.replace(\"\\\\\", \"/\");\r\n\t int i = clientFileName.lastIndexOf('/');\r\n\t // file1.zip\r\n\t // file2.zip\r\n\t return clientFileName.substring(i + 1);\r\n\t }\r\n\t }\r\n\t return null;\r\n\t }", "private String extractFileName(Part part) {\r\n\t\tString contentDisp = part.getHeader(\"content-disposition\");\r\n\t\tString[] items = contentDisp.split(\";\");\r\n\t\tfor (String s : items) {\r\n\t\t\tif (s.trim().startsWith(\"filename\")) {\r\n\t\t\t\treturn s.substring(s.indexOf(\"=\") + 2, s.length()-1);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn \"\";\r\n\t}", "private String extractFileName(final Part part) {\n\t\tfinal String contentDisp = part.getHeader(\"content-disposition\");\n\t\tfinal String[] items = contentDisp.split(\";\");\n\t\tfor (final String s : items) {\n\t\t\tif (s.trim().startsWith(\"filename\")) {\n\t\t\t\treturn s.substring(s.indexOf(\"=\") + 2, s.length()-1);\n\t\t\t}\n\t\t}\n\t\treturn \"\";\n\t}", "private String extractFileName(Part part) {\r\n\t\tString contentDisp = part.getHeader(\"content-disposition\");\r\n\t\tString[] items = contentDisp.split(\";\");\r\n\t\tfor (String s : items) {\r\n\t\t\tif (s.trim().startsWith(\"filename\")) {\r\n\t\t\t\treturn s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public String getOriginalFileName();", "private String extractFileName(Part part) {\n String contentDisp = part.getHeader(\"content-disposition\");\n String[] items = contentDisp.split(\";\");\n for (String s : items) {\n if (s.trim().startsWith(\"filename\")) {\n return s.substring(s.indexOf(\"=\") + 2, s.length()-1);\n }\n }\n return \"\";\n }", "public java.lang.String getLastName();", "private String extractFileName(Part part) {\n String contentDisp = part.getHeader(\"content-disposition\");\n String[] items = contentDisp.split(\";\");\n for (String s : items) {\n if (s.trim().startsWith(\"filename\")) {\n return s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\n }\n }\n return \"\";\n }", "public String getName() {\n if (filename != null) {\n int index = filename.lastIndexOf(separatorChar);\n\n if (index >= 0) {\n return filename.substring(index + 1);\n } else {\n if (filename == null) {\n return \"\";\n } else {\n return filename;\n }\n }\n } else {\n return \"\";\n }\n }", "public String getParsedFileName(String name, int index) {\r\n\t\t// We split until the first 3 (4-1) underscores.\r\n\t\tString[] parsedText = name.split(\"_\", 4);\r\n\r\n\t\t// format: latency_estclk_luts_filename\r\n\t\t// format: 0_1_2_3\r\n\t\tswitch (index) {\r\n\t\tcase 0:\r\n\t\t\t// We return the latency.\r\n\t\t\treturn parsedText[0];\r\n\t\tcase 1:\r\n\t\t\t// We return the estimated clock.\r\n\t\t\treturn parsedText[1];\r\n\t\tcase 2:\r\n\t\t\t// We return the luts.\r\n\t\t\treturn parsedText[2];\r\n\t\tcase 3:\r\n\t\t\t// We return the file name.\r\n\t\t\treturn parsedText[3];\r\n\t\tdefault:\r\n\t\t\treturn (\"Out of bounds in getParsedFileName\");\r\n\t\t}\r\n\t}", "public static void main(String args[]) throws FileNotFoundException{\n\t\tFile file = new File(\"input.txt\");\r\n\t\tScanner scan = new Scanner(file);\r\n\t\twhile (scan.hasNext()) {\r\n\t\t\tString fName = scan.next();\r\n\t\t\tString lName = scan.next();\r\n\t\t\tSystem.out.println(\"Full name is: \" + fName + \" \" + lName);\r\n\t\t}\r\n\t\t\tscan.close();\r\n\t\t\r\n\t}", "public void display_names()\n {\n //delare variables to hold file types\n BufferedReader br = null;\n \n \n //try to open the file for reading\n try\n {\n br = new BufferedReader(new FileReader(filename)); \n \n }\n catch(IOException ioe)\n {\n System.out.println(\"display_names: Exception opening the file\");\n }\n /*\n try to read each record and display the field values.\n a) display all the lastName, firstName paired fields in the file; \n display with the format lastName, firstName\n count each record that is read \n */\n int counter = 0; //record counter\n try\n {\n //read the first record\n String line = br.readLine();\n //while the record is not null, display the record, count the record\n while(line != null)\n {\n System.out.print(\"\\n\" + line);\n counter += 1;\n line = br.readLine();\n }\n System.out.println(\"\\n\\nTotal records read: \" + counter);\n \n \n \n }\n catch(IOException ioe)\n {\n System.out.println(\"display_names: Exception reading the file\");\n }\n \n //try to close the file\n try\n {\n br.close(); \n \n }\n catch(IOException ioe)\n {\n System.out.println(\"display_names: Exception closing the file\");\n }\n //dislay a count of the records read\n \n }", "private String createInitials(String firstName, String lastName) {\n final String firstInitial = Character.toString(firstName.charAt(0));\n final String lastInitial = Character.toString(lastName.charAt(0));\n final String initials = firstInitial.toUpperCase() + lastInitial.toUpperCase();\n return initials;\n }", "static void getFullsetMid2Name() throws IOException {\n\t\tDelimitedWriter dw = new DelimitedWriter(Main.file_mid2namesfullset);\r\n\t\tDelimitedReader dr = new DelimitedReader(Main.file_fbdump_2_len4);\r\n\t\tString[] l;\r\n\t\twhile ((l = dr.read()) != null) {\r\n\t\t\t// set name\r\n\t\t\tif (l[1].equals(\"/type/object/name\") && l[2].equals(\"/lang/en\")) {\r\n\t\t\t\tString mid = l[0];\r\n\t\t\t\tString name = l[3];\r\n\t\t\t\tdw.write(mid, name, \"name\");\r\n\t\t\t}\r\n\t\t\tif (l[1].equals(\"/common/topic/alias\") && l[2].equals(\"/lang/en\")) {\r\n\t\t\t\tString mid = l[0];\r\n\t\t\t\tString name = l[3];\r\n\t\t\t\tdw.write(mid, name, \"alias\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tdw.close();\r\n\t}", "static String normaliseFileName(String name) {\n return cleanUpName(name)\n .replaceAll(\"_.*\", \"\") // Removes\n .replaceAll(\"\\\\(.*?\\\\)\", \"\") // Remove parenthesis\n .replaceAll(\"v\\\\d+\\\\s*$\", \"\")\n .trim();\n }", "public String extractLastName(String fullName) throws IllegalArgumentException {\n // check to make sure there is a space in the name, if there is no space in the name\n // we don't know if there is a first and a last name\n \n if (fullName == null || fullName.isEmpty() || fullName.indexOf(\" \") < LAST_NAME_IDX) {\n throw new IllegalArgumentException(\"Name cannot be null, empty, and must contain a space.\");\n }\n //String lastName = null;\n \n int spaceIndex = fullName.lastIndexOf(\" \");\n String lastName = fullName.substring(spaceIndex, fullName.length());\n \n // alternative\n // String[] parts = fullName.split(\" \");\n \n // Your code goes here. Assign your value to lastName\n return lastName;\n }", "public String extractFileName(Part part) {\r\n\t\tString contentDisp = part.getHeader(\"content-disposition\");\r\n\t\tString[] items = contentDisp.split(\";\");\r\n\t\tfor (String s : items) {\r\n\t\t\tif (s.trim().startsWith(\"filename\")) {\r\n\t\t\t\treturn s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn \"\";\r\n\t}", "public String getFileNameToInsert()\r\n\t{\n\t\tif(n1<n2 || algo==1)\r\n\t\t\treturn getFileName(0);\r\n\t\telse\r\n\t\t\treturn getFileName(1);\r\n\t}", "private String removeNamePrefix(String sFileName){\n int iDateScoreIndex = 0;\n String sOriginalFileName = \"\";\n\n iDateScoreIndex = sFileName.indexOf(\"_attempt_\");\n sOriginalFileName = sFileName.substring(iDateScoreIndex + 29);\n\n return sOriginalFileName;\n }", "private String lastName(List<String> components) {\n int size = components.size();\n\n return size > 0 ? components.get(size - 1) : \"\";\n }", "private String getPDFFileName(){\r\n String[] split = inputFilePath.split(\"\\\\\\\\\");\r\n\r\n return split[split.length-1].split(\"\\\\.\")[0];\r\n }", "private String preprocessName(String original){\n\t\t// Remove non-alphabetical characters from the name\n\t\toriginal = original.replaceAll( \"[^A-Za-z]\", \"\" );\n\t\t\t\t\n\t\t// Convert to uppercase to help us ignore case-sensitivity\n\t\toriginal = original.toUpperCase();\n\t\t\n\t\t// Remove all occurences of the letters outlined in step 3\n\t\toriginal = original.substring(0,1) + original.substring(1).replaceAll(\"[AEIHOUWY]\",\"\");\n\t\t\n\t\t// Return the result\n\t\treturn original;\n\t}", "private String getFileName(String url) {\n // get the begin and end index of name which will be between the\n //last \"/\" and \".\"\n int beginIndex = url.lastIndexOf(\"/\")+1;\n int endIndex = url.lastIndexOf(\".\");\n return url.substring(beginIndex, endIndex);\n \n }", "String getFileName(String filePath) {\n\t\tint lastSlash = savedFilePath.lastIndexOf(\"\\\\\");\n\t\tint dotPos = savedFilePath.lastIndexOf(\".\");\n\t\tString fileName = savedFilePath.substring(lastSlash+1,dotPos);\n\t\treturn fileName;\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tScanner input = new Scanner(System.in);\n\t\tSystem.out.println(\"Enter fullname:\");\n\t\tString name = input.nextLine();\n\t\tinput.close();\n\t\t\n\t\t//find the index of the space between first and last names\n\t\tint spaceIndex = name.indexOf(\" \");\n\t\t//Gives the value from index 0 until spaceIndex \n\t\tString firstName = name.substring(0, spaceIndex);\n\t\t//Gives the value from spaceIndex + 1 until the last index of lastName\n\t\tString lastName = name.substring(spaceIndex + 1);\n\t\t\n\t\t\n\t\ttheNameSong(firstName);\n\t\ttheNameSong(lastName);\n\t}", "private String extractFileName(Part part) {\n\nString contentDisp = part.getHeader(\"content-disposition\");\n\nString[] items = contentDisp.split(\";\");\n\nfor (String s : items) {\n\nif (s.trim().startsWith(\"filename\")) {\n\nreturn s.substring(s.indexOf(\"=\") + 2, s.length() - 1);\n\n}\n\n}\n\nreturn \"\";\n\n}", "private static String getEntryName(File source, File file) throws IOException {\n\t\tint index = source.getAbsolutePath().length() + 1;\n\t\tString path = file.getCanonicalPath();\n\n\t\treturn path.substring(index);\n\t}", "public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(\"./first_and_last_names.csv\"));\n\t\tPrintWriter writer = new PrintWriter(\"./first_and_last_names_fix.csv\", \"UTF-8\");\n\t\tString line = br.readLine();\n\t\twriter.println(line);\n\t\tline = br.readLine();\n\t\t\n\t\twhile (line!=null)\n\t\t{\n\t\t\tif (line.length()>0)\n\t\t\t{\n\t\t\t\tif (Character.isDigit(line.charAt(0)))\n\t\t\t\t{\t\n\t\t\t\t\tif (line.endsWith(\"\\\"\"))\n\t\t\t\t\twriter.println(line);\n\t\t\t\t\telse\n\t\t\t\t\twriter.print(line);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(line.endsWith(\"\\\"\"))\n\t\t\t\t\t{\t\n\t\t\t\t\t\twriter.print(\"\\\"\");\n\t\t\t\t\t\tline = line.substring(line.indexOf(\",\"), line.length());\n\t\t\t\t\t\twriter.println(line);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tline = br.readLine();\n\t\t\tactualLine++;\n\t\t\tif(actualLine%1000==0)\n\t\t\t\tSystem.out.println(actualLine);\n\t\t\t\n\t\t\t\n\t\t\n\t\t}\n\t\tbr.close();\n\t\twriter.close();\n\t}", "public void getLastName() {\n\n\t}", "public String getLastName();", "protected String getFileName()\n {\n return new StringBuilder()\n .append(getInfoAnno().filePrefix())\n .append(getName())\n .append(getInfoAnno().fileSuffix())\n .toString();\n }", "String getShortName() {\n final int lastSlash = name.lastIndexOf('/');\n final String fileName = name.substring(lastSlash + 1);\n final int lastDot = fileName.lastIndexOf('.');\n return fileName.substring(0, lastDot);\n }", "public void getFilenames(String filename) {\n\t\ttry {\n\t\t\tBufferedReader myReader = new BufferedReader(new FileReader(filename));\n\t\t\tString readLine;\n\t\t\ttry {\n\t\t\t\twhile ((readLine = myReader.readLine()) != null) {\n\t\t\t\t\tString newName = parseName(readLine);\n\n\t\t\t\t\t// Already contains element so append it to end.\n\t\t\t\t\tif (mapNames.containsKey(newName)) {\n\n\t\t\t\t\t\t// Add new name onto the end of the existing ArrayList.\n\t\t\t\t\t\tmapNames.get(newName).add(readLine);\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Create new arraylist with the unparsed name as the\n\t\t\t\t\t\t// value\n\t\t\t\t\t\tArrayList<String> arrName = new ArrayList<String>();\n\t\t\t\t\t\tarrName.add(readLine);\n\t\t\t\t\t\tmapNames.put(newName, arrName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(\"There has been an error reading the specified file.\");\n\t\t\t\t// End program if exception thrown.\n\t\t\t\tSystem.exit(1);\n\t\t\t}\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"The filename you have given does not exist.\\nPlease re-run the program.\");\n\t\t\t// End program if exception thrown.\n\t\t\tSystem.exit(1);\n\t\t}\n\t}", "static void getMidWidNames() throws IOException {\n\t\tHashMap<String, String[]> mid2other = new HashMap<String, String[]>();\r\n\t\t{\r\n\t\t\tDelimitedReader dr = new DelimitedReader(Main.file_mid2wid);\r\n\t\t\tString[] l;\r\n\t\t\twhile ((l = dr.read()) != null) {\r\n\t\t\t\tif (mid2other.containsKey(l[0])) {\r\n\t\t\t\t\tString[] s = mid2other.get(l[0]);\r\n\t\t\t\t\ts[1] = s[1] + \"::\" + l[1];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tString[] s = new String[5];\r\n\t\t\t\t\ts[0] = l[0] + \"\";\r\n\t\t\t\t\ts[1] = l[1] + \"\";\r\n\t\t\t\t\ts[2] = \"\";\r\n\t\t\t\t\ts[3] = \"\";\r\n\t\t\t\t\ts[4] = \"\";\r\n\t\t\t\t\tmid2other.put(l[0], s);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdr.close();\r\n\t\t}\r\n\t\t//load notable type\r\n\t\t{\r\n\t\t\tDelimitedReader dr = new DelimitedReader(Main.file_mid2notabletype);\r\n\t\t\tString[] l;\r\n\t\t\twhile ((l = dr.read()) != null) {\r\n\t\t\t\tString mid = l[0];\r\n\t\t\t\tif (mid2other.containsKey(mid)) {\r\n\t\t\t\t\tString[] s = mid2other.get(mid);\r\n\t\t\t\t\tif (s[2].equals(\"\")) {\r\n\t\t\t\t\t\ts[2] = l[1];\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\ts[2] = s[2] + \"::\" + l[1];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdr.close();\r\n\t\t}\r\n\t\t//load names & alias\r\n\t\t{\r\n\t\t\tDelimitedReader dr = new DelimitedReader(Main.file_fbdump_2_len4);\r\n\t\t\tString[] l;\r\n\t\t\twhile ((l = dr.read()) != null) {\r\n\t\t\t\t// set name\r\n\t\t\t\tif (l[1].equals(\"/type/object/name\") && l[2].equals(\"/lang/en\")) {\r\n\t\t\t\t\tString mid = l[0];\r\n\t\t\t\t\tif (mid2other.containsKey(mid)) {\r\n\t\t\t\t\t\tString[] s = mid2other.get(mid);\r\n\t\t\t\t\t\tif (s[3].equals(\"\")) {\r\n\t\t\t\t\t\t\ts[3] = l[3];\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ts[3] = s[3] + \"::\" + l[3];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (s[4].equals(\"\")) {\r\n\t\t\t\t\t\t\ts[4] = l[3];\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ts[4] = s[4] + \"::\" + l[3];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (l[1].equals(\"/common/topic/alias\") && l[2].equals(\"/lang/en\")) {\r\n\t\t\t\t\tString mid = l[0];\r\n\t\t\t\t\tif (mid2other.containsKey(mid)) {\r\n\t\t\t\t\t\tString[] s = mid2other.get(mid);\r\n\t\t\t\t\t\tif (s[4].equals(\"\")) {\r\n\t\t\t\t\t\t\ts[4] = l[3];\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\ts[4] = s[4] + \"::\" + l[3];\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//write\r\n\t\t{\r\n\t\t\tDelimitedWriter dw = new DelimitedWriter(Main.file_midWidTypeNameAlias);\r\n\t\t\tfor (Entry<String, String[]> e : mid2other.entrySet()) {\r\n\t\t\t\tdw.write(e.getValue());\r\n\t\t\t}\r\n\t\t\tdw.close();\r\n\t\t}\r\n\t}", "@Test\r\n\tpublic void getFileName() {\n\t\tString test = \"form-data; name=\\\"uploadFile\\\"; filename=\\\"james.png\\\"\";\r\n\r\n\t\t/***When***/\r\n\t\tString result = futil.getFileName(test);\r\n\t\t/***Then***/\r\n\t\t//assertEquals(\"sally.png\", result);\r\n\t\tassertEquals(\"james.png\", result);\r\n\r\n\t}", "java.lang.String getFirstName();", "java.lang.String getFirstName();", "private String getFileName(String eingabe) {\n\t\tString[] words = eingabe.split(\" \");\n\t\tfor (int i = 0; i < words.length; i++) {\n\t\t\tif (words[i].equals(\"public\") && i <= words.length) {\n\t\t\t\tif (words[i+1].equals(\"class\") && i+1 <= words.length) {\n\t\t\t\t\treturn words[i+2];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "String fullName();", "private String checkName(String filename,int start_off){\n String name=FilenameUtil.setForwardSlash(filename);\n\n // check that it is a possibility\n if(name==null || name.length()<=0) return null;\n if(name.indexOf(matchname)<0) \n if( name.indexOf( matchname1) < 0) return null;\n if(! name.endsWith(\".class\") ) return null;\n if(name.indexOf(\"$\")>name.lastIndexOf(\"/\")) return null;\n \n // chop off the class part\n name=name.substring(start_off,name.length()-6);\n name=name.replace('/','.');\n \n return name;\n }", "public static void main(String[] args){\n\n String fileName = \"abc.jpeg\";\n String[] parts = fileName.split(\"\\\\.\");\n\n System.out.println(parts[1]);\n\n\n\n }", "public String getSimpleName() {\r\n final int startFileName = fileName.lastIndexOf(File.separator) + 1;\r\n if (startFileName < 0) {\r\n return fileName;\r\n } else {\r\n return fileName.substring(startFileName, fileName.length());\r\n }\r\n }", "private static String getFileName(Player player){\n if (player != null) {\n return (player != null) ? player.getFirstName() + player.getLastName() + player.getNumber() + player.getTeamName() : \"\";\n } else {\n return null;\n }\n }", "public int compareToByName(String first, String last){\r\n // Checks if the names are equal\r\n if(this.getFirstName().equals(first) && this.getLastName().equals(last)){\r\n return 0;\r\n }\r\n // Checks the alphabetical order if the last names are not equal\r\n else if(this.getLastName().equals(last) == false){\r\n // i stores the index of both last names\r\n int i = 0;\r\n /* Goal: To iterate through both last names simultaneously until an unmatching character is found */\r\n while(this.getLastName().charAt(i) == last.charAt(i)){\r\n i = i + 1;\r\n }\r\n if((int)this.getLastName().charAt(i) < (int)last.charAt(i)){\r\n return -1;\r\n }\r\n else if((int)this.getLastName().charAt(i) > (int)last.charAt(i)){\r\n return 1;\r\n }\r\n else\r\n return 7;\r\n }\r\n // Checks the alphabetical order if the last names are equal, but the first names are not\r\n else if(this.getLastName().equals(last) && this.getFirstName().equals(first) == false){\r\n // i stores the index of both first names\r\n int i = 0;\r\n /* Goal: To iterate through both first names simultaneously until an unmatching character is found */\r\n while(this.getFirstName().charAt(i) == first.charAt(i)){\r\n i = i + 1;\r\n }\r\n if((int)this.getFirstName().charAt(i) < (int)first.charAt(i)){\r\n return -1;\r\n }\r\n else if((int)this.getFirstName().charAt(i) > (int)first.charAt(i)){\r\n return 1;\r\n }\r\n else\r\n return 7;\r\n }\r\n else\r\n return 7;\r\n }", "public String extractName(String line) {\n\t\t// Linux case\n\t\tif (line.contains(\"/\")) {\n\t\t\treturn line.substring(line.lastIndexOf(\"/\") + 1, line.indexOf(\".\"));\n\t\t}\n\t\t// Root dir case\n\t\treturn line.substring(1, line.indexOf(\".\")).trim();\n\t}", "private String entryName(String name) {\n name = name.replace(File.separatorChar, '/');\n String matchPath = \"\";\n /* Need to add code to consolidate paths\n for (String path : paths) {\n if (name.startsWith(path)\n && (path.length() > matchPath.length())) {\n matchPath = path;\n }\n }\n */\n name = name.substring(matchPath.length());\n \n if (name.startsWith(\"/\")) {\n name = name.substring(1);\n } else if (name.startsWith(\"./\")) {\n name = name.substring(2);\n }\n return name;\n }", "private String nakedFileName() {\n return f.getName().split(\"\\\\.\")[0];\n }", "public void extractLastTaskName() throws IllegalCommandArgumentException {\n // Adds name that isn't checked by \";\" (i.e. start is < wordsOfInput.length)\n for (int n = start; n < index; n++) {\n if (wordsOfInput[n].indexOf(\"/\") == 0) {\n name += wordsOfInput[n].substring(1);\n } else {\n name += wordsOfInput[n];\n }\n if (n < index-1) {\n name += \" \";\n }\n }\n \n if (name.length() == 0 && parseType == 0) {\n throw new IllegalCommandArgumentException(Constants.FEEDBACK_NO_TASK_NAME, \n Constants.CommandParam.NAME);\n } \n names.add(name);\n }", "public String getFullNameOfPerson(int index, String file)\n\t\t\tthrows FileNotFoundException, IOException, ParseException {\n\t\tarrayList = pareseFile(file);\n\n\t\tJSONObject jsonObject = (JSONObject) arrayList.get(index);\n\t\tString fullName = (String) jsonObject.get(\"firstName\") + \" \" + (String) jsonObject.get(\"lastName\");\n\t\t//System.out.println(arrayList.toString());\n\t\treturn fullName;\n\t}", "public String getFullName( String firstName, String middleName, String lastName ) {\n String name = \"\";\n\n if ( firstName != null ) {\n name += firstName;\n }\n if ( middleName != null ) {\n name += \" \";\n name += middleName;\n }\n if ( lastName != null ) {\n name += \" \";\n name += lastName;\n }\n\n return name;\n }", "@AutoEscape\n\tpublic String getLast_name();", "private static String getResultFilename(String pathToFile) {\n\t\tString result = null;\n\t\tPath originalFilename = Paths.get(pathToFile).getFileName();\n\t\tif(originalFilename != null) {\n\t\t\tlogger.debug(\"A file name exists: {}\", originalFilename.toString());\n\t\t\tString[] nameParts = originalFilename.toString().split(\"[.]\");\n\t\t\tlogger.debug(\"The {} detected part(s) of the file name are:\", nameParts.length);\n\t\t\tresult = \"\";\n\t\t\tfor(int i=0; i<nameParts.length-1; i++) {\n\t\t\t\tlogger.debug(\"Part {}: {}\", i+1, nameParts[i]);\n\t\t\t\tresult += nameParts[i];\n\t\t\t}\n\t\t\tlogger.debug(\"Part {}: {}\", nameParts.length, nameParts[nameParts.length-1]);\n\t\t\tresult += \".csv\";\n\t\t}\n\t\treturn result;\n\t}", "public static String lastName(String name) {\n int i = name.lastIndexOf('.');\n if (i == -1) return name;\n else return name.substring(i + 1);\n }", "public String getSimpleName() { return FilePathUtils.getFileName(_name); }", "private String parseArgs(String args[])\n {\n String fpath = null;\n \n for (String arg : args)\n {\n if (arg.startsWith(\"-\"))\n {\n // TODO: maybe add something here.\n }\n else // expect a filename.\n {\n fpath = arg;\n }\n }\n \n return fpath;\n }", "private String getEditedFilename(File f) {\n \tString name = \"$Corrupted$\";\n \tString s = \"$Corrupted$\";\n \t\n \ttry {\n \t\tBufferedReader br = new BufferedReader( new FileReader(f) );\n \t\ts = br.readLine();\n \t\tbr.close();\n \t\n \t}catch (IOException e) {\n \t\te.printStackTrace();\n \t}\n \t\n\n \tif ( s.substring(0,6).equals(\"title\"+dataSep) ) {\n \t\tname = s.substring(6,s.length());\n \t\t\n \t}\n \t\n \treturn name;\n \t\n }", "@Override\n\tpublic java.lang.String getLastName() {\n\t\treturn _candidate.getLastName();\n\t}", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "java.lang.String getFileName();", "@Override\n public void search(String firstName,String lastName,String fileName){\n int Pointer;\n ArrayList<String> lineKeeper = saveText();\n /* Search into the list to find the firstname, if it founds\n * old information and then rewrite new inforamtion\n * Search and remove*/\n if(lineKeeper.contains(firstName)){\n Pointer=lineKeeper.indexOf(firstName);\n if(lineKeeper.get(Pointer+1).equals(lastName)){\n this.load(lineKeeper.get(Pointer-3),fileName);\n }\n }\n }", "private void getDetailsOfFiles(){\n\t\tString path = tfile.getAbsolutePath();\n\t\t\n\t\ttype = path.substring(path.lastIndexOf('.')+1);\n\t\t\n\t\tif(path.contains(\"/\")){\n\t\t\tfileName = path.substring(path.lastIndexOf(\"/\")+1);\n\t\t}else if(path.contains(\"\\\\\")){\n\t\t\tfileName = path.substring(path.lastIndexOf(\"\\\\\")+1);\n\t\t}\n\t}", "public static String findFileExtNameFromHeaders(Header[] headers) {\n\t\tString ext = null;\n\t\ttry {\n\t\t\tfor (Header header : headers) {\n\t\t\t\tString value = header.getValue();\n\t\t\t\tint idx = value.indexOf(\"filename\");\n\t\t\t\tif (idx != -1) {\n\t\t\t\t\tidx = value.indexOf(\"\\\"\", idx);\n\t\t\t\t\tint idx2 = value.indexOf(\"\\\"\", idx + 1);\n\t\t\t\t\tString name = value.substring(idx + 1, idx2);\n\t\t\t\t\tidx = name.lastIndexOf(\".\");\n\t\t\t\t\tif (idx != -1) {\n\t\t\t\t\t\text = name.substring(idx + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn ext;\n\t}", "private Map<String, List<ZipEntry>> parseLocalFileHeaderData(List<ZipEntry> entries) {\n /** Maps String to list of ZipEntrys, name -> actual entries. */\n Map<String, List<ZipEntry>> nameMap = new LinkedHashMap<>();\n\n for (ZipEntry entry : entries) {\n long offset = entry.getLocalHeaderOffset();\n archive.position(offset + ZipConstants.LOCNAM);\n\n // Gets the data offset of this entry.\n int fileNameLen = getShort();\n int extraFieldLen = getShort();\n long dataOffset = offset + ZipConstants.LOCEXT + ZipConstants.SHORT_BYTE_SIZE\n + fileNameLen + extraFieldLen;\n entry.setDataOffset(dataOffset);\n\n // Puts the entry into the nameMap.\n String name = entry.getName();\n List<ZipEntry> entriesWithTheSameName;\n if (nameMap.containsKey(name)) {\n entriesWithTheSameName = nameMap.get(name);\n } else {\n entriesWithTheSameName = new ArrayList<>();\n nameMap.put(name, entriesWithTheSameName);\n }\n entriesWithTheSameName.add(entry);\n }\n\n return nameMap;\n }", "public static void main (String[] args){\n System.out.println(\"What is your name?\");\n Scanner console = new Scanner(System.in);\n String first = console.next();\n String subfirst = first.substring(1);\n String last = console.next();\n String sublast = last.substring(1);\n\n name(first, subfirst);\n name(last, sublast);\n\n\n }", "public static String getLastFileName()\r\n\t{\r\n\t\treturn _outputFileName;\r\n\t}", "@Override\n\tpublic String problemHeader() {\n\t\treturn \"Reverse Last and First Names\";\n\t}", "public static String[] getDblpUrlEnding( String name ) {\r\n if( name == null ) {\r\n return null;\r\n }; // if\r\n \r\n name = StringEscapeUtils.escapeHtml( name );\r\n \r\n String modifiedName = null;\r\n String retName = name;\r\n \r\n // get the index of the last space in the name\r\n int index = name.lastIndexOf( \" \" );\r\n\r\n if( index == -1 ) {\r\n modifiedName = name;\r\n }\r\n else {\r\n String lastName = name.substring( index + 1, name.length() );\r\n Integer number = null;\r\n try {\r\n number = new Integer( lastName );\r\n }\r\n catch( Exception e ) {\r\n number = null;\r\n }; // try\r\n if( number == null ) {\r\n modifiedName = lastName.substring( 0, 1 ).toLowerCase() + \"/\" + lastName + \":\" + name.substring( 0, index );\r\n }\r\n else {\r\n //System.err.println( \"HERE lastName: -->\" + lastName + \"<-- number: \" + number );\r\n int index2 = name.lastIndexOf( \" \", index - 1 );\r\n lastName = name.substring( index2 + 1, name.length() );\r\n modifiedName = lastName.substring( 0, 1 ).toLowerCase() + \"/\" + lastName + \":\" + name.substring( 0, index2 );\r\n retName = name.substring( 0, index );\r\n //System.err.println( \"HERE lastName: \" + lastName + \", modifiedName: -->\" + modifiedName + \"<--\" );\r\n //System.err.println( \"HERE label: -->\" + name.substring( 0, index ) + \"<--\" );\r\n }; // if\r\n }; // if\r\n \r\n modifiedName = modifiedName.replace( ' ', '_' );\r\n modifiedName = modifiedName.replace( '.', '=' );\r\n modifiedName = modifiedName.replace( '-', '=' );\r\n modifiedName = modifiedName.replace( '&', '=' );\r\n modifiedName = modifiedName.replace( ';', '=' );\r\n modifiedName = modifiedName.replace( '\\'', '=' );\r\n \r\n return new String[] { modifiedName, \r\n StringEscapeUtils.escapeXml( StringEscapeUtils.unescapeHtml( retName ) ) };\r\n }", "public String getOriginalFileName() {\n if (originalFilePath==null) {\n return null;\n }\n // the path passed is in the client system's format,\n // so test all known path separator chars ('/', '\\' and \"::\" )\n // and pick the one which would create the smallest filename\n // Using Math is rather ugly but at least it is shorter and performs better\n // than Stringtokenizer, regexp, or sorting collections\n int last = Math.max(Math.max(\n originalFilePath.lastIndexOf(':'), // old mac path (::)\n originalFilePath.lastIndexOf('/')), // unix path\n originalFilePath.lastIndexOf('\\\\')); // windows path\n if (last > -1) {\n return originalFilePath.substring(last+1);\n }\n return originalFilePath;\n }", "static String getFileNameFromFileUrl( final String url ) {\n\n\t\tString name = url.substring( url.lastIndexOf('/') + 1 );\n\t\tint index = name.lastIndexOf( '?' );\n\t\tif( index > 0 )\n\t\t\tname = name.substring( 0, index );\n\t\telse if( index == 0 )\n\t\t\tname = name.substring( 1 );\n\n\t\treturn name.replaceAll( \"[^\\\\w.-]\", \"_\" );\n\t}", "private String upFirstLetter(){\n\t\tString firstLetter = nameField.substring(0,1);\n\t\tfirstLetter = firstLetter.toUpperCase();\n\t\treturn firstLetter + nameField.substring(1,nameField.length());\n\t}", "private String getSaveName(String filepath) {\r\n String newname = \"\";\r\n for (char c : filepath.toCharArray()) {\r\n if (c == '/' || c == '\\\\' || c == ':') newname+=\"_\";\r\n else newname+=c;\r\n }\r\n newname+=EXTENSION;\r\n return newname;\r\n }", "public void getName(ArrayList<String> document) {\r\n name = \"\";\r\n int atIndex = address.indexOf('@');\r\n String username = address.substring(0, atIndex);\r\n for(int i = 0; i < document.size(); i++)\r\n {\r\n String[] words = document.get(i).split(\" \");\r\n for(int j = 0; j < words.length; j++)\r\n {\r\n if(username.contains(words[j].toLowerCase()))\r\n {\r\n name = document.get(i);\r\n break;\r\n }\r\n }\r\n if(!name.equals(\"\"))\r\n {\r\n break;\r\n }\r\n } \r\n }", "public NameInfo(String inFirst, String inLast)\n\t{\n\t\t//Set instance data.\n\t\tfirstName = inFirst;\n\t\tlastName = inLast;\n\n\t}", "public String getFinalFileName()\r\n\t{\r\n\t\treturn this.getFileName() + this.getFileFormat();\r\n\t}", "String getFullName();", "protected String extractServerName(String fileName) {\n if (fileName.contains(\":\")) {\n fileName = StringUtils.substringAfter(fileName, \":\");\n }\n fileName = FilenameUtils.removeExtension(fileName);\n String first = FilenameUtils.getName(FilenameUtils.getPathNoEndSeparator(fileName));\n String second = FilenameUtils.getName(fileName);\n if (StringUtils.isEmpty(first) || first.equals(second) || second.startsWith(first + \"-\")) {\n return second;\n }\n return first + \"-\" + second;\n }" ]
[ "0.6482541", "0.63891965", "0.6212019", "0.6212019", "0.6095925", "0.5971432", "0.5968083", "0.5961284", "0.5961284", "0.5940213", "0.5940213", "0.5922544", "0.5901065", "0.5872462", "0.5872007", "0.57907885", "0.5788724", "0.57855517", "0.5771928", "0.5714694", "0.56881887", "0.56863993", "0.56804204", "0.5678036", "0.5677551", "0.56568605", "0.56044406", "0.56037194", "0.5601545", "0.5592923", "0.5586502", "0.5585714", "0.55853915", "0.5570064", "0.5569434", "0.55502677", "0.5548855", "0.5543899", "0.55134577", "0.5502935", "0.55016035", "0.5500166", "0.54997003", "0.5492265", "0.54728276", "0.54572445", "0.5450391", "0.5428744", "0.5428134", "0.5423614", "0.542144", "0.54189706", "0.5408152", "0.5408152", "0.5388786", "0.53874564", "0.5370719", "0.53655773", "0.5359453", "0.5348912", "0.5335329", "0.53353274", "0.53333575", "0.53117794", "0.5303651", "0.52928746", "0.5291475", "0.52855474", "0.52542627", "0.52529794", "0.524636", "0.5244917", "0.5244442", "0.5240022", "0.523524", "0.523524", "0.523524", "0.523524", "0.523524", "0.523524", "0.523524", "0.523524", "0.523524", "0.52234447", "0.52144384", "0.52051765", "0.5199534", "0.5195316", "0.51950014", "0.51934415", "0.5189358", "0.51795894", "0.51756376", "0.51686954", "0.516527", "0.51632214", "0.5159312", "0.51578975", "0.5147423", "0.514561" ]
0.6910334
0
/ Construtors Creates a new parser for the SPARQL Query Results XML Format.
public SPARQLBooleanXMLParser() { super(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static QueryInterface createQuery() {\n return new XmlQuery();\n }", "public static Result fromXMLElement(String query, XMLElement resultElement){\n\t\tResult result = new Result();\n\t\t\n\t\t/* Set query. */\n\t\tresult.query = query;\n\t\t\n\t\t/* Set suggestion. */\n\t\tif(resultElement.hasChild(\"did-you-mean\")){\n\t\t\tresult.suggestion = resultElement.getChildText(\"did-you-mean\");\n\t\t}\n\t\t\n\t\t/* Set result quantities.*/\n\t\tif(resultElement.hasChild(\"total-artists\") &&\n\t\t\tresultElement.hasChild(\"total-albums\") &&\n\t\t\tresultElement.hasChild(\"total-tracks\")){\n\t\t\tresult.totalArtists = Integer.parseInt(resultElement.getChildText(\"total-artists\"));\n\t\t\tresult.totalAlbums = Integer.parseInt(resultElement.getChildText(\"total-albums\"));\n\t\t\tresult.totalTracks = Integer.parseInt(resultElement.getChildText(\"total-tracks\"));\n\t\t}\n\t\t\n\t\t/* Get artists. */\n\t\tif(resultElement.hasChild(\"artists\")){\n\t\t\tfor(XMLElement artistElement : resultElement.getChild(\"artists\").getChildren()){\n\t\t\t\tresult.artists.add(Artist.fromXMLElement(artistElement));\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* Get albums. */\n\t\tif(resultElement.hasChild(\"albums\")){\n\t\t\tfor(XMLElement albumElement : resultElement.getChild(\"albums\").getChildren()){\n\t\t\t\tresult.albums.add(Album.fromXMLElement(albumElement));\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* Get tracks. */\n\t\tif(resultElement.hasChild(\"tracks\")){\n\t\t\tfor(XMLElement trackElement : resultElement.getChild(\"tracks\").getChildren()){\n\t\t\t\tresult.tracks.add(Track.fromXMLElement(trackElement));\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* Return result. */\n\t\treturn result;\n\t}", "private ASTQuery() {\r\n dataset = Dataset.create();\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"directQueryReturn\"));\n \n \n elementList.add(localDirectQueryReturn==null?null:\n localDirectQueryReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"terminalDownloadQueryForMonthReturn\"));\n \n \n elementList.add(localTerminalDownloadQueryForMonthReturn==null?null:\n localTerminalDownloadQueryForMonthReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"terminalDownloadQueryForDayReturn\"));\n \n \n elementList.add(localTerminalDownloadQueryForDayReturn==null?null:\n localTerminalDownloadQueryForDayReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "protected AbstractQueryResultParser(ValueFactory valueFactory) {\n\t\tsetValueFactory(valueFactory);\n\t\tsetParserConfig(new ParserConfig());\n\t}", "public QueryParser(QueryParserTokenManager tm) {\n token_source = tm;\n token = new Token();\n jj_ntk = -1;\n jj_gen = 0;\n for (int i = 0; i < 117; i++) jj_la1[i] = -1;\n for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\n }", "Object executeQuery(String sparqlQuery);", "public static void querying(String constructQuery2) {\n\t\t//construct the new query\n\t\t//String constructQuery2 = prefix+\" \"+select+\" \"+selectValues+\" \"+where+openBracket+openBracket+\" \"+local+\" \"+service+\" \"+openBracket+\" \"+remote+\" \"+closeBracket+closeBracket;\n\t\t//constructQuery2 = constructQuery2+\" UNION \"+\" \"+openBracket+\" \"+local+\" \"+service+\" \"+openBracket+\" \"+remote+\" \"+closeBracket+closeBracket+closeBracket;\n\t\t\n\t\tSystem.out.println(constructQuery2);\n\t\tQuery query2 = QueryFactory.create(constructQuery2);\n\t\tQueryExecution qe2 = QueryExecutionFactory.sparqlService(\n\t\t\t\t\"http://localhost:3030/USNA/query\", query2);\n\t\t\n\t\tResultSet results1 = qe2.execSelect();\n\t\tif(constantOutput == \"\") {\n\t\t\tResultSetFormatter.out(System.out, results1);\n\t\t}else {\n\t\t\tString NS = \"http://www.usna.org/ns#\";\n\t\t\tModel rdfssExample = ModelFactory.createDefaultModel();\n\t\t\tString [] constant = constantOutput.trim().split(\" \");\n\t\t\t\n\t\t\tString [] headers = selectValues.split(\" \");\n\t\t System.out.println(\"--------------------------------------------------------------------------------------------------------------------------------------------\");\n\t\t\tfor(int i = 0; i< headers.length; i++) {\n\t\t\t\t//System.out.print(headers[i].substring(1,headers[i].length()).trim()+\"\\t\\t\\t\\t\\t\\t\");\n\t\t\t\tSystem.out.print(headers[i].substring(1,headers[i].length()).trim()+\"\\t\\t\\t\\t\\t\\t\");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"----------------------------------------------------------------------------------------------------------------------------------------------\");\n\t\t\tSystem.out.println();\n\t\t\t\n\t\t\ttry {\n\t\t\t\t int count = 0;\n\t\t while ( results1.hasNext() ) {\n\t\t \t //Resource Response = rdfssExample.createResource(NS+constant[count]);\n\t\t \t \n\t\t QuerySolution soln = results1.nextSolution();\n\t\t Resource first = soln.getResource(headers[0].substring(1,headers[0].length()).trim());\n\t\t //Resource second = soln.getResource(headers[1].substring(1,headers[1].length()).trim());\n\t\t //Resource third = soln.getResource(headers[2].substring(1,headers[2].length()).trim());\n\t\t //Resource fourth = soln.getResource(headers[3].substring(1,headers[3].length()).trim());\n\t\t for(int i=0; i< constant.length; i++) {\n\t\t \t Resource Response = rdfssExample.createResource(NS+constant[i]);\n\t\t \t System.out.format(\"%10s %50s\",first, Response);\n\t\t \t System.out.println();\n\t\t\t\t\t //count++;\n\t\t }\n\t\t //System.out.format(\"%10s %50s\",first, Response);\n\t\t //System.out.format(\"%10s\",first);\n\t\t\t\t System.out.println();\n\t\t\t\t //count++;\n\t\t\t\t \n\t\t\t\t //System.out.println(count);\n\t\t \n\t\t }\n\t\t } finally {\n\t\t \t qe2.close();\n\t\t}\n\t\t\t \n\t\t}\t\t \n\t}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localErrorMessageTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://dto.thirdsdk.api.pms.cms.hikvision.com/xsd\",\n \"errorMessage\"));\n \n elementList.add(localErrorMessage==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localErrorMessage));\n } if (localResponseXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://dto.thirdsdk.api.pms.cms.hikvision.com/xsd\",\n \"responseXml\"));\n \n elementList.add(localResponseXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localResponseXml));\n } if (localResultTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://dto.thirdsdk.api.pms.cms.hikvision.com/xsd\",\n \"result\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localResult));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public SparqlParserConfig parseAsGiven() {\n setIrixResolverAsGiven();\n setBaseURI(\"\");\n return this;\n }", "public SPARQL() {\n initComponents();\n \n model = ModelFactory.createOntologyModel(OntModelSpec.OWL_LITE_MEM_RDFS_INF);\n model.setDynamicImports(true);\n model.read(\"file:\"+\"data/ontologies/Papers_Ready.owl\", \"http://www.l3g.pl/ontologies/OntoBeef/Papers.owl\", \"N-TRIPLE\");\n model.loadImports();\n \n for (Individual i : model.listIndividuals(model.getOntClass(\"http://www.l3g.pl/ontologies/OntoBeef/Conceptualisation.owl#Category\")).toSet())\n {\n System.out.println(i.listLabels(null).toSet());\n }\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public static DirectQueryResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n DirectQueryResponse object =\n new DirectQueryResponse();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"directQueryResponse\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (DirectQueryResponse)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"directQueryReturn\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n object.setDirectQueryReturn(null);\n reader.next();\n \n reader.next();\n \n }else{\n \n object.setDirectQueryReturn(org.apache.axis2.databinding.types.soapencoding.String.Factory.parse(reader));\n \n reader.next();\n }\n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "@Override\r\n\t\t\tpublic void startElement(String uri, String localName,\r\n\t\t\t\t\tString qName, Attributes attributes) throws SAXException {\r\n\t\t\t\t\r\n\t\t\t\tstack.push(new SaxStackElement(qName, attributes));\r\n\t\t\t\t\r\n\t\t\t\tif (\"ResultSet\".equals(qName)) {\r\n\t\t\t\t\tresultSet.setTotalResultsAvailable(Long.parseLong(attributes.getValue(\"totalResultsAvailable\")));\r\n\t\t\t\t\tresultSet.setTotalResultsReturned(Integer.parseInt(attributes.getValue(\"totalResultsReturned\")));\r\n\t\t\t\t\tresultSet.setFirstResultPosition(Integer.parseInt(attributes.getValue(\"firstResultPosition\")));\r\n\t\t\t\t} else if (\"Result\".equals(qName)) {\r\n\t\t\t\t\tcurResult = new ImageSearchResultEntity();\r\n\t\t\t\t} else if (\"Thumbnail\".equals(qName)) {\r\n\t\t\t\t\tcurThumbnail = new ImageSearchThumbnailEntity();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}", "XResultSet() {\n this.nodeRefs = new LinkedList<>();\n this.numberFound = 0;\n }", "public BooleanQueryResultParser getParser() {\r\n\t\treturn new BooleanTextParser();\r\n\t}", "TSearchResults createSearchResults(TSearchQuery searchQuery);", "public static SPARQLResult make(String str, Model model)\n {\n return new XMLInputSAX(str, model) ;\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"directOrderStateQueryReturn\"));\n \n \n elementList.add(localDirectOrderStateQueryReturn==null?null:\n localDirectOrderStateQueryReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public Query( String queryString ) {\r\n\tStringTokenizer tok = new StringTokenizer( queryString );\r\n\twhile ( tok.hasMoreTokens() ) {\r\n\t terms.add( tok.nextToken() );\r\n\t weights.add( new Double(1) );\r\n\t} \r\n }", "public XPathParser(java_cup.runtime.Scanner s) {super(s);}", "public static DirectQuery parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n DirectQuery object =\n new DirectQuery();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"directQuery\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (DirectQuery)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n object.setRequestXml(null);\n reader.next();\n \n reader.next();\n \n }else{\n \n object.setRequestXml(org.apache.axis2.databinding.types.soapencoding.String.Factory.parse(reader));\n \n reader.next();\n }\n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "String buildQueryResultXml(QueryContextTo queryContextTo);", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"PatientID\"));\n \n if (localPatientID != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPatientID));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"PatientID cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"CaseID\"));\n \n if (localCaseID != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localCaseID));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"CaseID cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"ExaminationType\"));\n \n \n if (localExaminationType==null){\n throw new org.apache.axis2.databinding.ADBException(\"ExaminationType cannot be null!!\");\n }\n elementList.add(localExaminationType);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.sample\",\n \"return\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public static SPARQLResult make(InputStream in, Model model)\n {\n return new XMLInputSAX(in, model) ;\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.sample\",\n \"return\"));\n \n elementList.add(local_return==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.sample\",\n \"return\"));\n \n elementList.add(local_return==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.sample\",\n \"return\"));\n \n elementList.add(local_return==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.sample\",\n \"return\"));\n \n elementList.add(local_return==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"CSPID\"));\n \n \n elementList.add(localCSPID==null?null:\n localCSPID);\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"LSPID\"));\n \n \n elementList.add(localLSPID==null?null:\n localLSPID);\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"CorrelateID\"));\n \n \n elementList.add(localCorrelateID==null?null:\n localCorrelateID);\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"CmdFileURL\"));\n \n \n elementList.add(localCmdFileURL==null?null:\n localCmdFileURL);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"getDirectSrvInfoReturn\"));\n \n \n elementList.add(localGetDirectSrvInfoReturn==null?null:\n localGetDirectSrvInfoReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (local_returnTracker){\r\n if (local_return!=null){\r\n for (int i = 0;i < local_return.length;i++){\r\n \r\n if (local_return[i] != null){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n elementList.add(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return[i]));\r\n } else {\r\n \r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n elementList.add(null);\r\n \r\n }\r\n \r\n\r\n }\r\n } else {\r\n \r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n elementList.add(null);\r\n \r\n }\r\n\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (local_returnTracker){\r\n if (local_return!=null) {\r\n for (int i = 0;i < local_return.length;i++){\r\n\r\n if (local_return[i] != null){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n elementList.add(local_return[i]);\r\n } else {\r\n \r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n elementList.add(null);\r\n \r\n }\r\n\r\n }\r\n } else {\r\n \r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n elementList.add(local_return);\r\n \r\n }\r\n\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "protected abstract DataSet parseQueryResultsIntoDataSet(DataSet dataSet, \n HashMap<String,String> params,\n String searchGene,\n int radius,\n GeneSourceOption geneSourceOption,\n DbSnpSourceOption dbSnpOption,\n String xmlResult) throws RetrievalException;", "public EntrezSearcher (String db, String retFormat, String query, String folderPath){\n this.db = db;\n this.retFormat = retFormat;\n addQuery(query);\n this.XmlFolderPath = folderPath;\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (local_returnTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"return\"));\r\n \r\n elementList.add(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (local_returnTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.sample\",\n \"return\"));\n \n \n elementList.add(local_return==null?null:\n local_return);\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"PatientID\"));\n \n if (localPatientID != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPatientID));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"PatientID cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"RadiologyOrderID\"));\n \n if (localRadiologyOrderID != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRadiologyOrderID));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"RadiologyOrderID cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"DateOfExamination\"));\n \n if (localDateOfExamination != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDateOfExamination));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"DateOfExamination cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"ReportText\"));\n \n if (localReportText != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localReportText));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"ReportText cannot be null!!\");\n }\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public Collection<URI> searchWithSPARQL(final String queryString)\n {\n if (DEBUG.SEARCH) Log.debug(\"searchWithSPARQL; queryString:\\n\" + Util.tags(queryString));\n \n final Collection<URI> resultSet = new ArrayList<URI>();\n final com.hp.hpl.jena.query.Query query = QueryFactory.create(queryString);\n \n if (DEBUG.SEARCH) Log.debug(\"QF created \" + Util.tag(query)\n + \"; memory=\" + Runtime.getRuntime().freeMemory()\n + \"\\n\" + query.toString().trim().replaceAll(\"\\n\\n\", \"\\n\"));\n\n final QueryExecution qe = QueryExecutionFactory.create(query, this); // 2nd arg is for Model or for FileManager?\n if (DEBUG.SEARCH) Log.debug(\"created QEF \" + qe + \"; memory=\" + Runtime.getRuntime().freeMemory());\n\n final ResultSet results = qe.execSelect();\n if (DEBUG.SEARCH) Log.debug(\"execSelect returned; memory=\" + Runtime.getRuntime().freeMemory());\n \n while (results.hasNext()) {\n final QuerySolution qs = results.nextSolution();\n if (DEBUG.SEARCH) {\n final String qss = qs.toString().replaceAll(\"<http://vue.tufts.edu\", \"...\"); // shorten debug output\n Log.debug(\"qSol \" + String.format(\"%.190s%s\", qss, qss.length() > 190 ? (\"...x\"+qss.length()) : \"\"));\n }\n if (false) {\n // debug debug all vars from query\n //Util.dumpIterator(qs.varNames());\n Iterator<String> vn = qs.varNames(); \n while (vn.hasNext()) {\n String v = vn.next();\n Log.debug(\"\\t\" + Util.tags(v) + \"=\" + Util.tags(qs.get(v)));\n }\n }\n try {\n resultSet.add(new URI(qs.getResource(\"rid\").getURI()));\n } catch (Throwable t) {\n Log.warn(\"handling QuerySolution \" + qs, t);\n }\n }\n qe.close();\n return resultSet;\n }", "public DOMParser() { ; }", "public ResultSet construct(String szQuery) {\n\t\treturn null;\n\t}", "public SAXParser createSaxParser() {\n \n System.err.println(\"Create new sax parser\");\n\n SAXParser saxParser = null;\n\n SAXParserFactory saxFactory = SAXParserFactory.newInstance();\n\n try {\n saxFactory.setValidating(true);\n saxFactory.setNamespaceAware(true);\n saxFactory.setFeature(SAX_NAMESPACES_PREFIXES, true);\n saxFactory.setFeature(SAX_VALIDATION, true);\n saxFactory.setFeature(SAX_VALIDATION_DYNAMIC, true);\n saxFactory.setFeature(FEATURES_VALIDATION_SCHEMA, true);\n saxFactory.setFeature(PROPERTIES_LOAD_EXT_DTD, true);\n //saxFactory.setFeature(Namespaces.SAX_NAMESPACES_PREFIXES, true);\n\n saxParser = saxFactory.newSAXParser();\n \n setupSaxParser(saxParser);\n\n } catch (Exception e) {\n // ignore: feature only recognized by xerces\n e.printStackTrace();\n }\n\n return saxParser;\n }", "public Results() {\n\t\t\t// TODO Auto-generated constructor stub\n\t\t}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException {\r\n\r\n\r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (local_returnTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"return\"));\r\n\r\n\r\n elementList.add(local_return == null ? null :\r\n local_return);\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n\r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException {\r\n\r\n\r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (local_returnTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"return\"));\r\n\r\n\r\n elementList.add(local_return == null ? null :\r\n local_return);\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n\r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (localNameTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"name\"));\r\n \r\n elementList.add(localName==null?null:\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName));\r\n } if (localIpTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"ip\"));\r\n \r\n elementList.add(localIp==null?null:\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIp));\r\n } if (localPortTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"port\"));\r\n \r\n elementList.add(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPort));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "@Override\r\n\tpublic XMLParser getParser() {\r\n\t\treturn new ResponseXMLParser();\r\n\t}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException {\r\n\r\n\r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (local_returnTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"return\"));\r\n\r\n elementList.add(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(local_return));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n\r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"terminalReturnCardReturn\"));\n \n \n elementList.add(localTerminalReturnCardReturn==null?null:\n localTerminalReturnCardReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public Api getQueryResult(String query) throws Exception {\n\t\tApi api = getQueryResult(getWiki(),query);\n\t\treturn api;\n\t}", "public SolrQuery() {\n super(null);\n store = null;\n }", "private QueryParser getQueryParser(String searchField, Analyzer analyzer){\n QueryParser qp = new QueryParser(searchField,analyzer);\n //this sets the query parser to AND all of the query terms it finds.\n qp.setDefaultOperator(QueryParser.AND_OPERATOR);\n return qp;\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"getTerminalCardTypeReturn\"));\n \n \n elementList.add(localGetTerminalCardTypeReturn==null?null:\n localGetTerminalCardTypeReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"OrderID\"));\n \n if (localOrderID != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOrderID));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"OrderID cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"Date\"));\n \n if (localDate != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDate));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"Date cannot be null!!\");\n }\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public Parser() {}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localTokenTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"token\"));\n \n elementList.add(localToken==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localToken));\n } if (localObjectNameTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"objectName\"));\n \n elementList.add(localObjectName==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localObjectName));\n } if (localOldProperty_descriptionTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"oldProperty_description\"));\n \n elementList.add(localOldProperty_description==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOldProperty_description));\n } if (localOldValues_descriptionTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"oldValues_description\"));\n \n elementList.add(localOldValues_description==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOldValues_description));\n } if (localNewProperty_descriptionTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"newProperty_description\"));\n \n elementList.add(localNewProperty_description==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNewProperty_description));\n } if (localNewValues_descriptionTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"newValues_description\"));\n \n elementList.add(localNewValues_description==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNewValues_description));\n } if (localOldProperty_descriptionTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"oldProperty_descriptionType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOldProperty_descriptionType));\n } if (localOldValues_descriptionTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"oldValues_descriptionType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOldValues_descriptionType));\n } if (localNewProperty_descriptionTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"newProperty_descriptionType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNewProperty_descriptionType));\n } if (localNewValues_descriptionTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"newValues_descriptionType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNewValues_descriptionType));\n } if (localOldCardinalityTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"oldCardinalityType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOldCardinalityType));\n } if (localOldCardinalityNumTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"oldCardinalityNum\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOldCardinalityNum));\n } if (localNewCardinalityTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"newCardinalityType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNewCardinalityType));\n } if (localNewCardinalityNumTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"newCardinalityNum\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localNewCardinalityNum));\n } if (localDescriptionTypeTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://knowledge.sjxx.cn\",\n \"descriptionType\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDescriptionType));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "private TwigcsResultParser getParser() {\n\t\tif (parser == null) {\n\t\t\tparser = new TwigcsResultParser();\n\t\t}\n\t\treturn parser;\n\t}", "private void init() throws JRException {\n if (result != null) {\n return;\n }\n if (endpointUrl == null) {\n throw new JRException(\"Endpoint URLs can't be null\");\n }\n if (sparqlStatement == null || sparqlStatement.length() == 0) {\n throw new JRException(\"SPARQL statements can't be null for \" + endpointUrl);\n }\n try {\n endpointObj = new SPARQLRepository(endpointUrl);\n endpointObj.initialize();\n } catch (Exception e) {\n throw new JRException(\"Exception initializing endpoint \" + endpointUrl, e);\n }\n try {\n conn = endpointObj.getConnection();\n log.info(\"Executing SPARQL: \" + sparqlStatement);\n TupleQuery q = conn.prepareTupleQuery(QueryLanguage.SPARQL, sparqlStatement);\n result = q.evaluate();\n log.debug(\"Bindings got, size: \" + result.getBindingNames().size());\n } catch (Exception e) {\n throw new JRException(\"Exception connecting to endpoint \" + endpointUrl, e);\n } finally {\n try {\n conn.close();\n } catch (RepositoryException e) {\n e.printStackTrace();\n }\n }\n }", "@Override\n\tpublic <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass) {\n\t\treturn null;\n\t}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException {\r\n\r\n\r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (localAttributesTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"attributes\"));\r\n\r\n\r\n elementList.add(localAttributes == null ? null :\r\n localAttributes);\r\n }\r\n if (localIdentifierTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"identifier\"));\r\n\r\n\r\n elementList.add(localIdentifier == null ? null :\r\n localIdentifier);\r\n }\r\n if (localNameTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"name\"));\r\n\r\n elementList.add(localName == null ? null :\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName));\r\n }\r\n if (localSourceTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"source\"));\r\n\r\n elementList.add(localSource == null ? null :\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSource));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n\r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (localIdTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry/xsd\",\r\n \"id\"));\r\n \r\n elementList.add(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localId));\r\n } if (localIpTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry/xsd\",\r\n \"ip\"));\r\n \r\n elementList.add(localIp==null?null:\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIp));\r\n } if (localNameTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry/xsd\",\r\n \"name\"));\r\n \r\n elementList.add(localName==null?null:\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName));\r\n } if (localPortTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry/xsd\",\r\n \"port\"));\r\n \r\n elementList.add(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localPort));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n \r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "public SearchResults() {\n\t\tPageFactory.initElements(driver, this);\n\t}", "public PseudoQuery() {\r\n\t}", "public String getResult(){\n \tString result = \"OK\";\n System.out.print(this.mainQuery);\n Query query = QueryFactory.create(this.mainQuery);\n Query querycount = QueryFactory.create(this.countQuery);\n //System.out.println(this.countQuery);\n QueryExecution qexecCount = QueryExecutionFactory.create(querycount, Initialisation.getModel());\n QueryExecution qexec = QueryExecutionFactory.create(query, Initialisation.getModel());\n try{\n \torg.apache.jena.query.ResultSet results = qexec.execSelect();\n //////////////////////////\n org.apache.jena.query.ResultSet resultsCount = qexecCount.execSelect();\n \tint compteur = 0;\n while (resultsCount.hasNext()){\n QuerySolution soln = resultsCount.nextSolution();\n compteur = soln.getLiteral(\"count\").getInt();\n }\n //System.out.println(\"Compteur = \"+compteur );\n if(compteur>1){\n return \"NONE\";\n }\n else if (compteur==0){\n return \"NF\";\n }\n /////////////////////////\n \twhile (results.hasNext()){\n \t\tcompteur++;\n \t\tQuerySolution soln = results.nextSolution();\n \t\tLiteral title = soln.getLiteral(\"label\");\n \t\tLiteral comment = soln.getLiteral(\"comment\");\n \t\tthis.title = title.getString().replace(\"-\",\" \");\n \t\ttry{\n \t\tthis.comment = comment.getString();\n \t\t}\n \t\tcatch(NullPointerException e){\n \t\t\tthis.comment = \"There is not any summary available for this film.\";\n \t\t}\n \t}\n\n }\n finally{\n \tqexec.close();\n }\n \n return result;\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n \n //We can safely assume an element has only one type associated with it\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME,\n new java.lang.Object[]{\n org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localExaminationType_type0)\n },\n null);\n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n \n //We can safely assume an element has only one type associated with it\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME,\n new java.lang.Object[]{\n org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT,\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localExaminationType_type0)\n },\n null);\n\n }", "public static QueryResult build() {\n return new QueryResult(ImmutableList.of());\n }", "public QueryResponse(Query q) {\n this.q = q;\n this.docIDs = new HashSet<>();\n }", "private Nodes xPathQuery(String query)\r\n \t{\r\n \t\treturn document.query(query, context);\r\n \t}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"OrderID\"));\n \n if (localOrderID != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOrderID));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"OrderID cannot be null!!\");\n }\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"OrderStatus\"));\n \n if (localOrderStatus != null){\n elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOrderStatus));\n } else {\n throw new org.apache.axis2.databinding.ADBException(\"OrderStatus cannot be null!!\");\n }\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException {\r\n\r\n\r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (localIdentifierKeyTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"identifierKey\"));\r\n\r\n elementList.add(localIdentifierKey == null ? null :\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIdentifierKey));\r\n }\r\n if (localIdentifierValueTracker) {\r\n elementList.add(new javax.xml.namespace.QName(\"\",\r\n \"identifierValue\"));\r\n\r\n elementList.add(localIdentifierValue == null ? null :\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localIdentifierValue));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n\r\n\r\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n \n elementList.add(new javax.xml.namespace.QName(\"\",\n \"getDirectAreaInfoReturn\"));\n \n \n elementList.add(localGetDirectAreaInfoReturn==null?null:\n localGetDirectAreaInfoReturn);\n \n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "@Override\n\tprotected void parseResult() {\n\t\t\n\t}", "public Query() {\r\n }", "public EntrezSearcher (String query, String folderPath){\n this(\"pubmed\",\"xml\", query,folderPath);\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\r\n throws org.apache.axis2.databinding.ADBException{\r\n\r\n\r\n \r\n java.util.ArrayList elementList = new java.util.ArrayList();\r\n java.util.ArrayList attribList = new java.util.ArrayList();\r\n\r\n if (localNameTracker){\r\n elementList.add(new javax.xml.namespace.QName(\"http://registry\",\r\n \"name\"));\r\n \r\n elementList.add(localName==null?null:\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName));\r\n }\r\n\r\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\r\n \r\n \r\n\r\n }", "public interface SparqlQueryService {\n\n\t/**\n\t * Generic method to invoke a supplied query regardless of its type. The\n\t * client has to inspect and cast the result object accordingly.\n\t * \n\t * @param name\n\t * @param params\n\t * @return\n\t */\n\tObject executeQuery(String sparqlQuery);\n\n\t/**\n\t * Generic method to invoke a query regardless of its type. The client has\n\t * to inspect and cast the result object accordingly.\n\t * \n\t * @param name\n\t * @param params\n\t * @return\n\t */\n\tObject callQuery(String name, Map<String, String> params);\n\n\t/**\n\t * Invocation of a SPARQL SELECT query. The resultant JSON structure is\n\t * serialized according to the W3C SPARQL 1.1 Query Results JSON Format.\n\t * \n\t * @see http://www.w3.org/TR/sparql11-query/#select\n\t * @param name\n\t * @param params\n\t * @return JSON result structure.\n\t */\n\tSparqlResultObject callSelectQuery(String name, Map<String, String> params);\n\n\t/**\n\t * Invocation of a SPARQL CONSTRUCT query resulting in new graph serialized\n\t * according to RDF/JSON format\n\t * (http://jena.apache.org/documentation/io/rdf-json.html).\n\t * \n\t * \n\t * @see http://www.w3.org/TR/sparql11-query/#construct\n\t * @param name\n\t * @param params\n\t * @return\n\t */\n\tGraph callConstructQuery(String name, Map<String, String> params);\n\n\t/**\n\t * Invocation of a SPARQL ASK query resulting in a boolean value.\n\t * \n\t * @see\n\t * \n\t * @param name\n\t * Unique name of the query.\n\t * @param params\n\t * Map of required parameter-value pairs.\n\t * @return true or false, depending whether the pattern matches.\n\t */\n\tBoolean callAskQuery(String name, Map<String, String> params);\n\n}", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localRequestXmlTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\n \"requestXml\"));\n \n elementList.add(localRequestXml==null?null:\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localRequestXml));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)\n throws org.apache.axis2.databinding.ADBException{\n\n\n \n java.util.ArrayList elementList = new java.util.ArrayList();\n java.util.ArrayList attribList = new java.util.ArrayList();\n\n if (localVersionTracker){\n elementList.add(new javax.xml.namespace.QName(\"http://ws.platform.blackboard/xsd\",\n \"version\"));\n \n elementList.add(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localVersion));\n }\n\n return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());\n \n \n\n }", "@Test\n\tpublic void testSparqlQuery() throws OWLOntologyCreationException,\n\t\t\tIOException {\n\t\tInputStream ontStream = LDLPReasonerTest.class\n\t\t\t\t.getResourceAsStream(\"/data/university0-0.owl\");\n\t\tOWLOntologyManager manager = OWLManager.createOWLOntologyManager();\n\t\tOWLOntology ontology = manager\n\t\t\t\t.loadOntologyFromOntologyDocument(ontStream);\n\n\t\tInputStream queryStream = LDLPReasonerTest.class\n\t\t\t\t.getResourceAsStream(\"/data/lubm-query4.sparql\");\n\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tqueryStream));\n\t\tString line;\n\t\tString queryText = \"\";\n\t\twhile ((line = reader.readLine()) != null) {\n\t\t\tqueryText = queryText + line + \"\\n\";\n\t\t}\n\n\t\tQuery query = QueryFactory.create(queryText, Syntax.syntaxARQ);\n\t\tLDLPReasoner reasoner = new LDLPReasoner(ontology);\n\t\tList<Literal> results = reasoner.executeQuery(query);\n\t\tSystem.out.println(results.size() + \" answers :\");\n\t\tfor (Literal result : results) {\n\t\t\tSystem.out.println(result);\n\t\t}\n\t\tLDLPCompilerManager m = LDLPCompilerManager.getInstance();\n\n\t\t// m.dump();\n\n\t}" ]
[ "0.6510691", "0.61387485", "0.57937264", "0.5720295", "0.56742156", "0.5610605", "0.556115", "0.55526364", "0.55370295", "0.5484091", "0.544585", "0.5435908", "0.5407082", "0.53972375", "0.53972375", "0.53972375", "0.53972375", "0.53972375", "0.53972375", "0.53972375", "0.53972375", "0.53972375", "0.53905106", "0.5389674", "0.5380385", "0.53685224", "0.53641915", "0.53636336", "0.536202", "0.5347255", "0.5345774", "0.53244615", "0.5319596", "0.53151345", "0.5304707", "0.5304599", "0.52973044", "0.52973044", "0.52973044", "0.52973044", "0.52916616", "0.5268957", "0.526474", "0.5262011", "0.5261109", "0.5259835", "0.52570325", "0.52446413", "0.52299714", "0.5204998", "0.51976115", "0.51848584", "0.51843995", "0.5175037", "0.51677924", "0.51677924", "0.51574993", "0.5149323", "0.5148325", "0.51456547", "0.5116214", "0.5114155", "0.5107512", "0.510018", "0.5097196", "0.50944984", "0.5092098", "0.50917387", "0.5087328", "0.5087324", "0.5085244", "0.508222", "0.50770223", "0.5076506", "0.5073914", "0.5057176", "0.5055726", "0.5055726", "0.5055275", "0.50508106", "0.5046007", "0.50306726", "0.50223386", "0.5019337", "0.5013191", "0.5011112", "0.5008802", "0.5002643", "0.49972436", "0.49862257", "0.49862257", "0.49862257", "0.49862257", "0.49862257", "0.49862257", "0.49862257", "0.49862257", "0.49862257", "0.4985132", "0.49842325" ]
0.57439125
3
Set up mockBean responses
@Test public void productMapperLowestAvailabilityTest() { Mockito.when( flightSegmentsMapper.mapFlightSegments(Mockito.any(Option.class), Mockito.eq(segmentsMap))) .thenReturn(new ArrayList<FlightSegment>()); Mockito .when(passengerFlightMapper.mapPassengerFlight(Mockito.eq(pricePoint.getAirPricingInfo()), Mockito.eq(ppFareInfo), Mockito.eq(brandMap), Mockito.eq(option))) .thenReturn(new ArrayList<PassengerFlight>()); // Call the function being tested List<ProductOption> productOptions = productMapper.mapProductOptions(pricePoint, ppFareInfo, segmentsMap, brandMap); // Asserts assertNotNull(productOptions); assertEquals("p0", productOptions.get(0).getProduct().get(0).getId()); assertEquals("PT45H50M", productOptions.get(0).getProduct().get(0).getTotalDuration()); assertEquals(3, productOptions.get(0).getProduct().get(0).getQuantity().intValue()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void useFakeResponse() {\n EmployeeApp.useFakeResponse = true;\n ResponseObject responseObject = new ResponseObject();\n responseObject.setReturnCode(200);\n responseObject.setType(ResponseObject.ResponseType.JSON);\n responseObject.setResponseBodyString(new CompanyEmployeesResponse().getRandomResponse());\n FakeInterceptor.addTest(\"-mobile-\", responseObject);\n }", "private void setUpMockObjects() {\n this.request = new CustomMockHttpServletRequest();\n byte[] content = { 4, 6, 7 };\n ServletInputStream inputStream = new DelegatingServletInputStream(\n new ByteArrayInputStream(content));\n this.request.inputStream = inputStream;\n\n this.response = new MockHttpServletResponse();\n\n this.setUpXmlRpcElementFactory();\n this.setUpXmlRpcRequestParser();\n this.setUpXmlRpcResponseWriter();\n this.setUpXmlRpcServiceExporterMap();\n }", "private void setupStubs() {\n wireMockServer.stubFor(get(urlEqualTo(BRITISH_LONG_HAIR))\n .willReturn(aResponse().withHeader(\"Content-Type\", \"application-json\")\n .withStatus(200)\n .withBodyFile(\"json/british-long-hair.json\")));\n }", "private Response() {\n initFields();\n }", "private void setupOkMock() throws Exception {\n mockEndpoint = EasyMock.createMock(OpportunitiesApi.class);\n\n // Set up LPs\n List<GetCharactersCharacterIdOpportunities200Ok> opList = Arrays.stream(oppTestData)\n .map(x -> {\n GetCharactersCharacterIdOpportunities200Ok newOpp = new GetCharactersCharacterIdOpportunities200Ok();\n newOpp.setTaskId((int) x[0]);\n newOpp.setCompletedAt(\n new DateTime(new Date((long) x[1])));\n return newOpp;\n })\n .collect(Collectors.toList());\n\n // Setup retrieval mock calls\n Map<String, List<String>> headers = createHeaders(\"Expires\", \"Thu, 21 Dec 2017 12:00:00 GMT\");\n ApiResponse<List<GetCharactersCharacterIdOpportunities200Ok>> apir = new ApiResponse<>(200, headers, opList);\n EasyMock.expect(mockEndpoint.getCharactersCharacterIdOpportunitiesWithHttpInfo(\n EasyMock.eq((int) charSyncAccount.getEveCharacterID()),\n EasyMock.isNull(),\n EasyMock.isNull(),\n EasyMock.anyString()))\n .andReturn(apir);\n\n // Setup server mock\n mockServer = EasyMock.createMock(ESIAccountClientProvider.class);\n EasyMock.expect(mockServer.getOpportunitiesApi())\n .andReturn(mockEndpoint);\n }", "private CallResponse() {\n initFields();\n }", "@Before\r\n public void setup() {\n JacksonTester.initFields(this, new ObjectMapper());\r\n // MockMvc standalone approach\r\n mvc = MockMvcBuilders.standaloneSetup(peopleController)\r\n .build();\r\n //peopleService = Mockito.mock(PeopleServiceImpl.class);\r\n }", "public void mock(){\n\n }", "@Before\n public void setUp() throws Exception {\n\n // Used for testing getStatus and getError\n test1JsonResponse = new JsonResponse() {\n @Override\n public String toString() {\n return null;\n }\n };\n test1JsonResponse.setStatus(test1status);\n test1JsonResponse.setError(test1error);\n\n // Test getStatus and setStatus with random values\n Random random = new Random();\n test2status = random.nextInt(500);\n test2error = RandomStringUtils.random(8, true, false);\n\n test2JsonResponse = new JsonResponse() {\n @Override\n public String toString() {\n return null;\n }\n };\n\n // Used for testing setError with null or empty string\n test3JsonResponse = new JsonResponse() {\n @Override\n public String toString() {\n return null;\n }\n };\n }", "public Object answer(InvocationOnMock invocation) throws Throwable {\n return craftResponse(invocation);\n }", "@Override\r\n\tpublic SampleResponse getSomedata() {\r\n\r\n\t\tsampleResponse.setMoney(SampleConstants.MONEY);\r\n\t\t\r\n\t\tMap<String, String> hashmap = new HashMap<String, String>();\r\n\t\thashmap.put(\"testkey\", \"testValue\");\r\n\t\thashmap.put(\"testkey1\", \"testValue1\");\r\n\t\tsampleResponse.setAdditionalPorperties(hashmap);\r\n\r\n\t\treturn sampleResponse;\r\n\t}", "@Before\n public void initBeans() throws Exception {\n MockitoAnnotations.initMocks(this);\n doReturn(aweElements).when(context).getBean(any(Class.class));\n emailService.setApplicationContext(context);\n emailBuilder.setApplicationContext(context);\n when(aweElements.getLocaleWithLanguage(anyString(), any())).thenReturn(\"\");\n }", "public void GetListaTjWomenResponseBean() {\n }", "@Test\n public void testSetResponse_1()\n throws Exception {\n Transaction fixture = new Transaction();\n fixture.setResponse(new Response());\n fixture.setRequest(new Request());\n Response response = new Response();\n\n fixture.setResponse(response);\n\n }", "@Override\n\tpublic BaseResponse testResponse() {\n\t\treturn setResultSuccess();\n\t}", "private WebResponse() {\n initFields();\n }", "@Test\n public void mapToTest() throws Exception {\n RESTEasyContextMapper rcm = new RESTEasyContextMapper();\n RESTEasyBindingData rbd = new RESTEasyBindingData();\n\n Context context = new DefaultContext();\n context.setProperty(\"one\", Integer.valueOf(1));\n \n rcm.mapTo(context, rbd);\n Iterator<Map.Entry<String, List<String>>> entries = rbd.getHeaders().entrySet().iterator();\n while (entries.hasNext()) {\n Map.Entry<String, List<String>> entry = entries.next();\n List<String> values = entry.getValue();\n Assert.assertTrue(values.size() == 1);\n Assert.assertTrue(entry.getKey().equals(\"one\"));\n Assert.assertTrue(values.get(0).equals(\"1\"));\n }\n \n RESTEasyBindingData rbd2 = new RESTEasyBindingData();\n context.removeProperties();\n List<Integer> list = new ArrayList<Integer>();\n list.add(Integer.valueOf(1));\n list.add(Integer.valueOf(2));\n list.add(Integer.valueOf(3));\n context.setProperty(\"numbers\", list);\n rcm.mapTo(context, rbd2);\n entries = rbd2.getHeaders().entrySet().iterator();\n while (entries.hasNext()) {\n Map.Entry<String, List<String>> entry = entries.next();\n List<String> values = entry.getValue();\n Assert.assertTrue(values.size() == 3);\n Assert.assertTrue(entry.getKey().equals(\"numbers\"));\n for (String value : values) {\n Assert.assertTrue(values.get(0).equals(\"1\") || values.get(1).equals(\"2\") ||\n values.get(1).equals(\"3\"));\n }\n } \n }", "void stubResponses(HttpExecuteResponse... responses);", "private void merge(HttpMockRequest mockRequest, HttpMockRequest mockResponse) {\n mockResponse.setRequestMethod(mockRequest.getRequestMethod());\n mockResponse.setRequestUrl(mockRequest.getRequestUrl());\n mockResponse.setRequestHeaders(mockRequest.getRequestHeaders());\n\n mockResponse.setQueryString(mockRequest.getQueryString());\n //mockResponse.setFormData(mockRequest.getFormData());\n mockResponse.setRequestBody(mockRequest.getRequestBody());\n }", "Map<Object, Object> getAllMockAPI();", "private static void verifyMocksCalled(DataRequestResponse response) {\n for (ConnectionDetail entry : response.getResources().values()) {\n verify(((DataService) entry.createService()), times(1)).read(any());\n }\n }", "@BeforeEach\n void setUp() {\n mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();\n\n objectMapper = new ObjectMapper();\n }", "private Response() {}", "private Response() {}", "protected void setUp() throws Exception {\n super.setUp();\n clientAddress = getNonAnonymousClientAddress();\n responseProcessor = Endpoint.create(new NonAnonymousRespProcessor(respMsgExchanger));\n responseProcessor.publish(clientAddress);\n }", "void SetupMockRequestHandler2(RequestHandler2 mockHandler, int attemptCount, MockRequestOutcome outcome) {\n\n HttpResponse testResponse = EasyMock.createMock(HttpResponse.class);\n\n // beforeRequest\n EasyMock.reset(mockHandler);\n mockHandler.beforeRequest(EasyMock.<Request<?>>anyObject());\n EasyMock.expectLastCall().once();\n\n for(int i = 0; i < attemptCount; ++i) {\n // beforeAttempt\n mockHandler.beforeAttempt(EasyMock.<HandlerBeforeAttemptContext>anyObject());\n EasyMock.expectLastCall().once();\n\n if (outcome == MockRequestOutcome.Success && i + 1 == attemptCount) {\n // beforeUnmarshalling, requires success-based test\n EasyMock.expect(mockHandler.beforeUnmarshalling(EasyMock.<Request<?>>anyObject(), EasyMock.<HttpResponse>anyObject()))\n .andReturn(testResponse)\n .once();\n }\n\n // afterAttempt\n mockHandler.afterAttempt(EasyMock.<HandlerAfterAttemptContext>anyObject());\n EasyMock.expectLastCall().once();\n }\n\n if(outcome == MockRequestOutcome.Success) {\n // afterResponse, requires success\n mockHandler.afterResponse(EasyMock.<Request<?>>anyObject(), EasyMock.<Response<?>>anyObject());\n EasyMock.expectLastCall().once();\n } else if (outcome == MockRequestOutcome.FailureWithAwsClientException){\n // afterError, only called if exception was an AwsClientException\n mockHandler.afterError(EasyMock.<Request<?>>anyObject(), EasyMock.<Response<?>>anyObject(), EasyMock.<Exception>anyObject());\n EasyMock.expectLastCall().once();\n }\n EasyMock.replay(mockHandler);\n }", "public MockApplication10()\n {\n\n setActionListener(new MockActionListener());\n components = new HashMap();\n converters = new HashMap();\n converters1 = new HashMap();\n setDefaultLocale(Locale.getDefault());\n setDefaultRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);\n setNavigationHandler(new MockNavigationHandler());\n setStateManager(new MockStateManager());\n setSupportedLocales(new ArrayList());\n validators = new HashMap();\n setViewHandler(new MockViewHandler());\n\n // Register the standard by-id converters\n addConverter(\"jakarta.faces.BigDecimal\",\n \"jakarta.faces.convert.BigDecimalConverter\");\n addConverter(\"jakarta.faces.BigInteger\",\n \"jakarta.faces.convert.BigIntegerConverter\");\n addConverter(\"jakarta.faces.Boolean\",\n \"jakarta.faces.convert.BooleanConverter\");\n addConverter(\"jakarta.faces.Byte\", \"jakarta.faces.convert.ByteConverter\");\n addConverter(\"jakarta.faces.Character\",\n \"jakarta.faces.convert.CharacterConverter\");\n addConverter(\"jakarta.faces.DateTime\",\n \"jakarta.faces.convert.DateTimeConverter\");\n addConverter(\"jakarta.faces.Double\",\n \"jakarta.faces.convert.DoubleConverter\");\n addConverter(\"jakarta.faces.Float\", \"jakarta.faces.convert.FloatConverter\");\n addConverter(\"jakarta.faces.Integer\",\n \"jakarta.faces.Convert.IntegerConverter\");\n addConverter(\"jakarta.faces.Long\", \"jakarta.faces.convert.LongConverter\");\n addConverter(\"jakarta.faces.Number\",\n \"jakarta.faces.convert.NumberConverter\");\n addConverter(\"jakarta.faces.Short\", \"jakarta.faces.convert.ShortConverter\");\n\n // Register the standard by-type converters\n addConverter(Boolean.class, \"jakarta.faces.convert.BooleanConverter\");\n addConverter(Boolean.TYPE, \"jakarta.faces.convert.BooleanConverter\");\n addConverter(Byte.class, \"jakarta.faces.convert.ByteConverter\");\n addConverter(Byte.TYPE, \"jakarta.faces.convert.ByteConverter\");\n addConverter(Character.class, \"jakarta.faces.convert.CharacterConverter\");\n addConverter(Character.TYPE, \"jakarta.faces.convert.CharacterConverter\");\n addConverter(Double.class, \"jakarta.faces.convert.DoubleConverter\");\n addConverter(Double.TYPE, \"jakarta.faces.convert.DoubleConverter\");\n addConverter(Float.class, \"jakarta.faces.convert.FloatConverter\");\n addConverter(Float.TYPE, \"jakarta.faces.convert.FloatConverter\");\n addConverter(Integer.class, \"jakarta.faces.convert.IntegerConverter\");\n addConverter(Integer.TYPE, \"jakarta.faces.convert.IntegerConverter\");\n addConverter(Long.class, \"jakarta.faces.convert.LongConverter\");\n addConverter(Long.TYPE, \"jakarta.faces.convert.LongConverter\");\n addConverter(Short.class, \"jakarta.faces.convert.ShortConverter\");\n addConverter(Short.TYPE, \"jakarta.faces.convert.ShortConverter\");\n\n }", "private Mocks() { }", "@Before\n public void setup() {\n MockitoAnnotations.initMocks(this);\n final AddressEndpoint addressEndpoint = new AddressEndpoint(addressRepository);\n this.mockAddressEndpoint = MockMvcBuilders.standaloneSetup(addressEndpoint).build();\n\n address01 = new Address(\"Procession St\", \"Paris\", \"75015\", \"FR\");\n address02 = new Address(\"Ritherdon Rd\", \"London\", \"8QE\", \"UK\");\n address03 = new Address(\"Inacio Alfama\", \"Lisbon\", \"A54\", \"PT\");\n address04 = new Address(\"Jardins\", \"Sao Paulo\", \"345678\", \"BR\");\n address05 = new Address(\"Coffey\", \"Perth\", \"654F543\", \"AU\");\n address06 = new Address(\"Harbour Bridge\", \"Sydney\", \"JHG3\", \"AU\");\n address07 = new Address(\"Playa de la Concha\", \"San Sebastian\", \"45678\", \"ES\");\n\n // Persist the object\n addressRepository.save(address01);\n addressRepository.save(address02);\n addressRepository.save(address03);\n addressRepository.save(address04);\n addressRepository.save(address05);\n addressRepository.save(address06);\n addressRepository.save(address07);\n }", "@Override\n\tpublic void handle(OperationRequest req, Context context) throws SoapClientException {\n\n\t\tObject responseInstance = context.getResponseInstance();\n\t\tMap<String, Holder<?>> resultHolders = context.getResultHolders();\n\t\t\n\t\tfor (Map.Entry<String, Holder<?>> resultHolder: resultHolders.entrySet()) {\n\t\t\tString setterName = \"set\" + Character.toUpperCase(resultHolder.getKey().charAt(0)) + resultHolder.getKey().substring(1);\n\t\t\tMethod[] meths = responseInstance.getClass().getMethods();\n\t\t\tMethod setter = null;\n\t\t\tfor (Method meth: meths) {\n\t\t\t\tif (meth.getName().equals(setterName)) {\n\t\t\t\t\tsetter = meth;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (setter == null) {\n\t\t\t\tLog.debug(\"Unable to find a setter method - falling back to field named \" + resultHolder.getKey());\n\t\t\t\tField field;\n\t\t\t\ttry {\n\t\t\t\t\tfield = responseInstance.getClass().getDeclaredField(resultHolder.getKey());\n\t\t\t\t} catch (NoSuchFieldException | SecurityException e) {\n\t\t\t\t\tthrow new SoapClientException(\"Unable to successfully get field \" + resultHolder.getKey() + \" due to \" + e.getClass().getSimpleName() + \": \" + e.getMessage(), e);\n\t\t\t\t}\n\t\t\t\tif (field.getType() == List.class) {\n\t\t\t\t\tfield.setAccessible(true);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfield.set(responseInstance, resultHolder.getValue().value);\n\t\t\t\t\t} catch (IllegalArgumentException | IllegalAccessException e) {\n\t\t\t\t\t\tthrow new SoapClientException(\"Unable to inoke setter on result holder due to \" + e.getClass().getSimpleName() + \": \" + e.getMessage(), e);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow new SoapClientException(\"Field \" + resultHolder.getKey() + \" was not of type List\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tLog.debug(\"Invoking setter method \" + setterName + \" with value \" + resultHolder.getValue().value);\n\t\t\t\ttry {\n\t\t\t\t\tsetter.invoke(responseInstance, resultHolder.getValue().value);\n\t\t\t\t} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {\n\t\t\t\t\tthrow new SoapClientException(\"Unable to inoke setter on result holder due to \" + e.getClass().getSimpleName() + \": \" + e.getMessage(), e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}", "@Test\r\n public void testPatientResultsPatientIdGet() throws Exception {\r\n PowerMockito.whenNew(PatientServiceImpl.class).withNoArguments().thenReturn(patientServiceImplMock);\r\n\r\n PatientResultResponse patientResultResponse = new PatientResultResponse();\r\n PatientResponse patientResponse = new PatientResponse();\r\n PatientDetailsResponse patientDetailsResponse = new PatientDetailsResponse();\r\n patientDetailsResponse.setId(123);\r\n patientDetailsResponse.setFirstName(\"FIRST_NAME\");\r\n patientDetailsResponse.setLastName(\"LAST_NAME\");\r\n patientDetailsResponse.setMrn(\"MRN\");\r\n patientDetailsResponse.setFin(\"FIN\");\r\n patientResponse.setPatientDetails(patientDetailsResponse);\r\n CategoryResponse categoryResponse = new CategoryResponse();\r\n categoryResponse.setId(123);\r\n List<CategoryResponse> categoryList = new ArrayList<>();\r\n ResultResponse resultResponse = new ResultResponse();\r\n resultResponse.setId(123);\r\n resultResponse.setValue(\"TEST_VALUE\");\r\n List<ResultResponse> resultList = new ArrayList<>();\r\n resultList.add(resultResponse);\r\n categoryResponse.setResult(resultList);\r\n categoryList.add(categoryResponse);\r\n patientResultResponse.setCategory(categoryList);\r\n patientResultResponse.setPatient(patientResponse);\r\n when(patientServiceImplMock.getPatientDetails(any(String.class))).thenReturn(patientResultResponse);\r\n\r\n\r\n List<PatientDetailsResponse> patientResultResponseList = new ArrayList<>();\r\n patientResultResponseList.add(patientDetailsResponse);\r\n PowerMockito.whenNew(ChildDAOImpl.class).withNoArguments().thenReturn(childDaoImplMock);\r\n when(childDaoImplMock.getPatientById(any(Integer.class))).thenReturn(patientResultResponseList);\r\n\r\n PowerMockito.whenNew(ResultDAOImpl.class).withNoArguments().thenReturn(resultDAOMock);\r\n\r\n PowerMockito.whenNew(BabyResultDAOImpl.class).withNoArguments().thenReturn(babyResultDAOImpl);\r\n BabyResultResponse babyResultResponse = new BabyResultResponse();\r\n babyResultResponse.setDateTime(new Date());\r\n when(babyResultDAOImpl.getBabyPatientByChildId(any(Integer.class))).thenReturn(babyResultResponse);\r\n\r\n\r\n PatientResultsApiServiceImpl patientResultsApiService = new PatientResultsApiServiceImpl();\r\n Response response = patientResultsApiService.patientResultsPatientIdGet(\"123\", securityContext);\r\n assertEquals(200, response.getStatus());\r\n\r\n when(babyResultDAOImpl.getBabyPatientByChildId(any(Integer.class))).thenReturn(null);\r\n patientResultsApiService = new PatientResultsApiServiceImpl();\r\n response = patientResultsApiService.patientResultsPatientIdGet(\"123\", securityContext);\r\n assertEquals(200, response.getStatus());\r\n }", "private TestBeanResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {\n super(builder);\n }", "Response createResponse();", "private void getResponse() {\n response = new Response();\n\n getResponseCode();\n getResponseMessage();\n getResponseBody();\n\n LOG.info(\"--- RESPONSE ---\");\n LOG.info(\"Code: \" + response.getResponseCode());\n LOG.info(\"Message: \" + response.getResponseMessage());\n LOG.info(\"Body: \" + response.getResponseBody());\n LOG.info(\"*************************************\");\n }", "@Before\n public void init(){\n mockClient = MockWebServiceClient.createClient(applicationContext);\n }", "@Before\n public void init(){\n mockClient = MockWebServiceClient.createClient(applicationContext);\n }", "@Before\n public void setUp() {\n deviceController = Mockito.mock(DeviceController.class);\n settingController = Mockito.mock(SettingController.class);\n gprsMessageDAO = Mockito.mock(GprsMessageDAO.class);\n postResults = new ArrayList<>();\n\n Mockito.when(settingController.getSetting(\"deviceCommunicator.endpoint\"))\n .thenReturn(\"http://jouko.test/\");\n\n Mockito.when(settingController.getSetting(\"deviceCommunicator.asId\"))\n .thenReturn(\"as\");\n\n Mockito.when(settingController.getSetting(\"deviceCommunicator.enabled\", \"false\"))\n .thenReturn(\"true\");\n\n subject = new DeviceCommunicator(\n deviceController,\n settingController,\n Clock.fixed(Instant.EPOCH, ZoneOffset.UTC),\n (String postResult) -> {\n postResults.add(postResult);\n return \"<html><body>Request queued by LRC</body></html>\";\n }\n );\n }", "public Response() {\n objectMap = new JSONObject<>();\n }", "public GetResponseTest() {\n\t\t/*\n\t\t * This constructor should not be modified. Any initialization code\n\t\t * should be placed in the setUp() method instead.\n\t\t */\n\n\t}", "@Override\n public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {\n }", "@Test\n\tpublic void testGettersAndSetters() {\n\t\tnew BeanTester().testBean(ShortestPathOutput.class, configuration);\n\t}", "@RequestMapping(value = \"/test\", method = RequestMethod.GET)\n\t@ResponseBody\n\tpublic ResponseBean testRest() {\n\n\t\treturn ResponseBean.sendSuccessResponseBean(null);\n\t}", "private DeviceBCFMockImpl getDeviceMock()\r\n\t{\r\n\t\treturn (DeviceBCFMockImpl)SensusAppContext.getApplicationContext().getBean(MapAPIController.class)\r\n\t\t\t\t.getDeviceBCF();\r\n\t}", "public void setResponse(T response) {\n this.response = response;\n }", "public OrderResponseBuilder() {\r\n orderResponse = new OrderResponse();\r\n }", "@Override\r\n\tprotected void processRespond() {\n\r\n\t}", "@Override\r\n\tprotected void processRespond() {\n\r\n\t}", "@Override\n public void onResponse(ArrayList<DummyObject> dummyObjectArrayList) {\n onApiResponse(dummyObjectArrayList);\n }", "public MockRenderResponse(PortalContext portalContext) {\n\t\tsuper(portalContext);\n\t}", "@Before\n\tpublic void setUp() throws Exception {\n\t\teventDao = new EventDAO();\t\t\n\t\tcontroller = new EventController();\n\t\tresponse = new MockHttpServletResponse();\t\t\n\t}", "@Test\n\t\tpublic void testSuccessResultMapping() throws Exception {\n\n\t\t\tString responseBody = TestUtils.getValidResponse();\n\t\t\ttry {\n\t\t\t\t\n\t\t\t\tResponseEntity<ResponseWrapper> responseEntity= prepareReponseEntity(responseBody);\n\t\t\t\t\n\t\t\t\tLocationForecast locationForecast=mapWithObjectMapper(responseEntity.getBody());\n\t\t\t\t\n\t\t\t\t/*Checking for fields visible to viewers*/\n\t\t\t\tassertEquals(locationForecast.getCity().getCity(),\"Newark\");\n\t\t\t\tassertEquals(locationForecast.getCity().getState(),\"NJ\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tassertEquals(locationForecast.getForecast().getTemp_f(),\"82.6\");\n\t\t\t\tassertEquals(locationForecast.getForecast().getTemp_c(),\"28.1\");\n\t\t\t\tassertEquals(locationForecast.getForecast().getFeelslike_c(),\"29\");\n\t\t\t\tassertEquals(locationForecast.getForecast().getFeelslike_f(),\"85\");\n\t\t\t\tassertEquals(locationForecast.getForecast().getWeather(),\"Partly Cloudy\");\n\t\t\t\t\n\t\t\t\tthis.mockServer.verify();\n\t\t\t} catch (Exception e) {\n\t\t\t\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "protected void setUpServletObjects() throws Exception\n {\n servletContext = new MockServletContext();\n config = new MockServletConfig(servletContext);\n session = new MockHttpSession();\n session.setServletContext(servletContext);\n request = new MockHttpServletRequest(session);\n request.setServletContext(servletContext);\n response = new MockHttpServletResponse();\n }", "@Test\n\tpublic void callGetDemographicDetailsWithPreIdTest()\n\t\t\tthrows JsonParseException, JsonMappingException, IOException, java.io.IOException {\n\t\tResponseEntity<String> respEntity = new ResponseEntity<String>(jsonTestObject.toString(), HttpStatus.OK);\n\t\tnotificationDTO.setAdditionalRecipient(false);\n\n\t\tmainReqDto.setRequest(notificationDTO);\n\t\tString stringjson = mapper.writeValueAsString(mainReqDto);\n\t\tString langCode = \"eng\";\n\t\tMultipartFile file = new MockMultipartFile(\"test.txt\", \"test.txt\", null, new byte[1100]);\n\t\tResponseEntity<MainResponseDTO<DemographicResponseDTO>> demores = new ResponseEntity<>(demographicdto, HttpStatus.OK);\n\t\tResponseEntity<MainResponseDTO<BookingRegistrationDTO>> bookingres = new ResponseEntity<>(bookingResultDto, HttpStatus.OK);\n\t\tMockito.when(restTemplate.exchange(Mockito.anyString(), Mockito.eq(HttpMethod.GET), Mockito.any(),\n\t\t\t\tMockito.eq(new ParameterizedTypeReference<MainResponseDTO<DemographicResponseDTO>>() {\n\t\t\t\t}))).thenReturn(demores);\n\t\tMockito.when(restTemplate.exchange(Mockito.anyString(), Mockito.eq(HttpMethod.GET), Mockito.any(),\n\t\t\t\tMockito.eq(new ParameterizedTypeReference<MainResponseDTO<BookingRegistrationDTO>>() {\n\t\t\t\t}),Mockito.anyMap())).thenReturn(bookingres);\n\t\tTemplateResponseListDTO templateResponseListDTO = new TemplateResponseListDTO();\n\t\ttemplateResponseListDTO.setTemplates(tepmlateList);\n\t\tMockito.when(NotificationUtil.notify(\"sms\", notificationDTO, langCode, file)).thenReturn(responselist);\n\t\tResponseEntity<TemplateResponseListDTO> res = new ResponseEntity<TemplateResponseListDTO>(\n\t\t\t\ttemplateResponseListDTO, HttpStatus.OK);\n\t\tMockito.when(restTemplate.getForEntity(Mockito.anyString(), Mockito.eq(TemplateResponseListDTO.class)))\n\t\t\t\t.thenReturn(res);\n\n\t\tHttpHeaders headers = new HttpHeaders();\n\t\theaders.setContentType(MediaType.MULTIPART_FORM_DATA);\n\t\tResponseEntity<NotificationResponseDTO> resp = new ResponseEntity<NotificationResponseDTO>(\n\t\t\t\tnotificationResponseDTO, HttpStatus.OK);\n\t\tMockito.when(restTemplate.exchange(Mockito.anyString(), Mockito.eq(HttpMethod.POST), Mockito.any(),\n\t\t\t\tMockito.eq(NotificationResponseDTO.class))).thenReturn(resp);\n\t\tMockito.when(restTemplate.exchange(Mockito.anyString(), Mockito.eq(HttpMethod.GET), Mockito.any(),\n\t\t\t\tMockito.eq(String.class))).thenReturn(respEntity);\n\t\tMainResponseDTO<ResponseDTO> response = service.sendNotification(stringjson, langCode, file);\n\t\tassertEquals(responseDTO.getResponse(), response.getResponse());\n\t}", "void initHero() throws Exception {\n mockMvc.perform(MockMvcRequestBuilders.post(\"/api/hero\")\n .content(objectMapper.writeValueAsString(createHeroObject()))\n .contentType(MediaType.APPLICATION_JSON));\n }", "private MockClientFacade() {\n\t\t//this.c = Client.getInstance();\n\t}", "@BeforeClass\n public static void setup() throws JsonIOException, JsonSyntaxException, FileNotFoundException {\n Fixtures.deleteDatabase();\n\n JsonElement jsonUsers = new JsonParser().parse(new FileReader(new File(\"test/services/UserServiceTestUsers.json\")));\n JsonElement jsonRepo1 = new JsonParser().parse(new FileReader(new File(\"test/services/UserServiceTestRepo1.json\")));\n JsonElement jsonRepo2 = new JsonParser().parse(new FileReader(new File(\"test/services/UserServiceTestRepo2.json\")));\n\n WebServiceWrapper ws = mock(WebServiceWrapper.class);\n HttpResponse respUsers = mock(HttpResponse.class);\n when(respUsers.getJson()).thenReturn(jsonUsers);\n when(ws.get(\"www.test.com/orgs/test/members\")).thenReturn(respUsers);\n\n HttpResponse respRepo1 = mock(HttpResponse.class);\n when(respRepo1.getJson()).thenReturn(jsonRepo1);\n when(ws.get(\"bobRepoUrl\")).thenReturn(respRepo1);\n HttpResponse respRepo2 = mock(HttpResponse.class);\n when(respRepo2.getJson()).thenReturn(jsonRepo2);\n when(ws.get(\"aliceRepoUrl\")).thenReturn(respRepo2);\n\n // Run\n new GithubUserRetriever(ws, \"www.test.com\", null , null).getUsersWithRepos(\"test\");\n }", "@Test\n\tpublic void testGetResponseValues() throws Throwable {\n\t\tGetResponse testedObject = new GetResponse();\n\t\ttestedObject.setMainJob(\"mainJob22\");\n\t\tSonarAnalysisInfo sonar = new SonarAnalysisInfo();\n\t\ttestedObject.setSonar(sonar);\n\t\tList<TestAnalysis> functionalTest = new ArrayList<TestAnalysis>();\n\t\ttestedObject.setFunctionalTest(functionalTest);\n\t\ttestedObject.setDashboard(\"dashboard21\");\n\t\ttestedObject.setPipelineStatus(\"pipelineStatus\");\n\t\tList<Performance> performanceTest = new ArrayList<Performance>();\n\t\ttestedObject.setPerformanceTest(performanceTest);\n\t\t\n\t\tassertEquals(\"pipelineStatus\",testedObject.getPipelineStatus());\n\t\tassertEquals(performanceTest, testedObject.getPerformanceTest());\n\t\tassertEquals(\"mainJob22\",testedObject.getMainJob());\n\t\tassertEquals(\"dashboard21\",testedObject.getDashboard());\n\t\tassertEquals(sonar, testedObject.getSonar());\n\t\tassertEquals(functionalTest, testedObject.getFunctionalTest());\n\t}", "public Response(){\n\t\t// nothing needed\n\t}", "@Before\n public void setUp() {\n response = new DocumentsResponse();\n testDocList = new ArrayList<>();\n testDocList.add(new DocumentTestData().createTestDocument(1));\n }", "@Test\n\tpublic void testResponse() {\n\t\tquestions.setResponse(\"No\");\n\t\tassertEquals(\"No\",questions.getResponse());\n\t}", "@Override\n public void afterPropertiesSet() throws Exception {\n mockSolrServer = new MockSolrServer(\"statistics\");\n solr = mockSolrServer.getSolrServer();\n\n // Mock GeoIP's DatabaseReader\n DatabaseReader reader = mock(DatabaseReader.class);\n // Ensure that any tests requesting a city() get a mock/fake CityResponse\n Mockito.lenient().when(reader.city(any(InetAddress.class))).thenReturn(mockCityResponse());\n // Save this mock DatabaseReader to be used by SolrLoggerService\n locationService = reader;\n }", "public MockAction() {\n\t\tsetResultEventId(\"success\");\n\t}", "@Test\n public void testFindAllProduct() throws Exception {\n // Mock method\n when(productRepository.findAll()).thenReturn(products);\n\n testResponseData(RequestInfo.builder()\n .request(get(PRODUCT_ENDPOINT))\n .token(memberToken)\n .httpStatus(HttpStatus.OK)\n .build());\n }", "void stubNextResponse(HttpExecuteResponse nextResponse);", "public ResponseRegister() {\n }", "@Before\n\tpublic void setUp() throws Exception {\n\t\tpar = new TreeMap<String, String>();\n\t\tpar.put(\"Server\", \"Apache\");\n\t\tmyReply = new MyHTTPReply(\"HTTP/1.0\", \"404\", \"Not Found\", par, \"Ciao mamma\");\n\t}", "@SuppressWarnings(\"JavaUtilDate\")\n public OAIPMHtype build() {\n response.setRequest(requestType);\n GregorianCalendar cal = new GregorianCalendar();\n cal.setGregorianChange(new Date());\n try {\n response.setResponseDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(cal));\n } catch (DatatypeConfigurationException ex) {\n LOGGER.error(\"Failed to set response date to OAI-PMH response.\", ex);\n }\n\n if (!isError()) {\n switch (verb) {\n case IDENTIFY:\n response.setIdentify(identifyType);\n break;\n case LIST_METADATA_FORMATS:\n response.setListMetadataFormats(listMetadataFormatsType);\n break;\n case LIST_SETS:\n response.setListSets(listSetsType);\n break;\n case GET_RECORD:\n response.setGetRecord(getRecordType);\n break;\n case LIST_IDENTIFIERS:\n response.setListIdentifiers(listIdentifiers);\n break;\n case LIST_RECORDS:\n response.setListRecords(listRecordsType);\n break;\n }\n }\n\n return response;\n }", "@Before\n public void setup() {\n //用于初始化@Mock注解修饰的组件\n MockitoAnnotations.initMocks(this);\n\n requestVO = new RoleRequestVO();\n requestVO.setName(\"ROLE_ADMIN\");\n\n role = new Role();\n role.setName(\"ROLE_ADMIN\");\n role.setId(new Random().nextLong());\n }", "@Test\n public void shouldReturnOKStatus() throws Exception{\n Mockito.when(itemService.getItemById(1)).thenReturn(new Item(1,\"Item1\",12,25));\n RequestBuilder requestBuilder= MockMvcRequestBuilders.get(\"/item?id=1\").accept(MediaType.APPLICATION_JSON);\n mockMvc.perform(requestBuilder).andExpect(status().isOk()).andExpect(content().json(\"{\" +\n \"id:1,name:Item1,price:12,quantity:25}\"));\n }", "public void setUpWithMock(String fileName, Exception e) {\n\n apiConfig = new ApiConfig.ConfigBuilder().apiLocation(\"api\").port(\"8081\").host(\"localhost\").build();\n mockApiImpl = new MockDefaultApiImplementation(apiConfig, fileName);\n // We create a new instance of test class under test as usually.\n\n // This is the way to tell PowerMock to mock all static methods of a\n // given class\n mockStatic(ApiFactory.class);\n\n expect(ApiFactory.getDefaultImplementation()).andReturn(mockApiImpl);\n\n // Note how we replay the class, not the instance!\n PowerMock.replay(ApiFactory.class);\n\n }", "private void setUpCustomerDaoMock() {\n // Set up the CustomerDao Mock\n customerDao = mock(CustomerDaoJdbcTemplateImpl.class);\n\n // customerDao Mock Input (customerInput1)\n Customer customerInput1 = new Customer();\n customerInput1.setFirstName(\"Dominick\");\n customerInput1.setLastName(\"DeChristofaro\");\n customerInput1.setEmail(\"dominick.dechristofaro@gmail.com\");\n customerInput1.setCompany(\"Omni\");\n customerInput1.setPhone(\"999-999-9999\");\n\n // customerDao Mock Response (customerResponse1)\n Customer customerResponse1 = new Customer();\n customerResponse1.setCustomerId(1);\n customerResponse1.setFirstName(\"Dominick\");\n customerResponse1.setLastName(\"DeChristofaro\");\n customerResponse1.setEmail(\"dominick.dechristofaro@gmail.com\");\n customerResponse1.setCompany(\"Omni\");\n customerResponse1.setPhone(\"999-999-9999\");\n\n // customerDao Mock Input (customerInput2)\n Customer customerInput2 = new Customer();\n customerInput2.setFirstName(\"Michael\");\n customerInput2.setLastName(\"Stuckey\");\n customerInput2.setEmail(\"michaelallenstuckey@gmail.com\");\n customerInput2.setCompany(\"NuclearFuelServices\");\n customerInput2.setPhone(\"222-222-2222\");\n\n // customerDao Mock Response (customerResponse2)\n Customer customerResponse2 = new Customer();\n customerResponse2.setCustomerId(2);\n customerResponse2.setFirstName(\"Michael\");\n customerResponse2.setLastName(\"Stuckey\");\n customerResponse2.setEmail(\"michaelallenstuckey@gmail.com\");\n customerResponse2.setCompany(\"NuclearFuelServices\");\n customerResponse2.setPhone(\"222-222-2222\");\n\n // Add customerResponse to a list of Customer objects\n List<Customer> customerList = new ArrayList<>();\n customerList.add(customerResponse1);\n customerList.add(customerResponse2);\n\n // Mocking addCustomer()\n doReturn(customerResponse1).when(customerDao).addCustomer(customerInput1);\n doReturn(customerResponse2).when(customerDao).addCustomer(customerInput2);\n\n // Mocking getCustomer()\n doReturn(customerResponse1).when(customerDao).getCustomer(customerResponse1.getCustomerId());\n doReturn(customerResponse1).when(customerDao).getCustomer(customerResponse1.getCustomerId());\n\n // Mocking getAllCustomer()\n doReturn(customerList).when(customerDao).findAllCustomer();\n\n // Mocking updateCustomer()\n doNothing().when(customerDao).updateCustomer(customerArgumentCaptor.capture());\n\n // Mocking deleteCustomer()\n doNothing().when(customerDao).deleteCustomer(integerArgumentCaptor.capture());\n }", "@Before\n public void setUp() throws Exception {\n INIT_LOC = new Location(INIT_LOC_STRING);\n ERR_LOC = new Location(ERR_LOC_STRING);\n INIT_LOCGRB = new LocationGroup(INIT_LOCGB_STRING);\n ERR_LOCGRB = new LocationGroup(ERR_LOCGB_STRING);\n mockMvc = MockMvcBuilders\n .webAppContextSetup(context)\n .apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris()\n .withPort(8888))\n .addFilters(new CharacterEncodingFilter(\"UTF-8\", true))\n .build();\n }", "@Test\n void getInitValueCompatibilityAnswersSuccess() throws Exception {\n\n //when\n MvcResult mvcResult = mockMvc.perform(get(\"/test/initTest\"))\n .andExpect(status().isOk())\n .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))\n .andReturn();\n\n //then\n // map response from string to ValueCompatibilityAnswersDto\n ValueCompatibilityAnswersDto valueCompatibilityAnswersDto = mapper\n .readValue(mvcResult.getResponse().getContentAsString(), ValueCompatibilityAnswersDto.class);\n\n // GOAL\n assertTrue(valueCompatibilityAnswersDto.getGoal().size() == TOTAL_NUMBER_OF_QUESTIONS_FOR_AREA);\n // chosenScale\n assertTrue(valueCompatibilityAnswersDto.getGoal().stream().allMatch(goal -> goal.getChosenScale().getScale() == null));\n assertTrue(valueCompatibilityAnswersDto.getGoal().stream().allMatch(goal -> goal.getChosenScale().getScaleHeader() == null));\n assertTrue(valueCompatibilityAnswersDto.getGoal().stream().allMatch(goal -> goal.getChosenScale().getScaleDescription() == null));\n // firstScale and secondScale\n for (int value = 0; value < Scale.values().length; value++) {\n Scale finalValue = Scale.values()[value];\n assertTrue(valueCompatibilityAnswersDto.getGoal()\n .stream()\n .filter(goal -> goal.getFirstScale().getScale() == finalValue\n || goal.getSecondScale().getScale() == finalValue)\n .count() == 5);\n }\n\n // QUALITY\n assertTrue(valueCompatibilityAnswersDto.getQuality().size() == TOTAL_NUMBER_OF_QUESTIONS_FOR_AREA);\n // chosenScale\n assertTrue(valueCompatibilityAnswersDto.getQuality().stream().allMatch(quality -> quality.getChosenScale().getScale() == null));\n assertTrue(valueCompatibilityAnswersDto.getQuality().stream().allMatch(quality -> quality.getChosenScale().getScaleHeader() == null));\n assertTrue(valueCompatibilityAnswersDto.getQuality().stream().allMatch(quality -> quality.getChosenScale().getScaleDescription() == null));\n // firstScale and secondScale\n for (int value = 0; value < Scale.values().length; value++) {\n Scale finalValue = Scale.values()[value];\n assertTrue(valueCompatibilityAnswersDto.getQuality()\n .stream()\n .filter(quality -> quality.getFirstScale().getScale() == finalValue\n || quality.getSecondScale().getScale() == finalValue)\n .count() == 5);\n }\n\n // STATE\n assertTrue(valueCompatibilityAnswersDto.getState().size() == TOTAL_NUMBER_OF_QUESTIONS_FOR_AREA);\n // chosenScale\n assertTrue(valueCompatibilityAnswersDto.getState().stream().allMatch(state -> state.getChosenScale().getScale() == null));\n assertTrue(valueCompatibilityAnswersDto.getState().stream().allMatch(state -> state.getChosenScale().getScaleHeader() == null));\n assertTrue(valueCompatibilityAnswersDto.getState().stream().allMatch(state -> state.getChosenScale().getScaleDescription() == null));\n // firstScale and secondScale\n for (int value = 0; value < Scale.values().length; value++) {\n Scale finalValue = Scale.values()[value];\n assertTrue(valueCompatibilityAnswersDto.getState()\n .stream()\n .filter(state -> state.getFirstScale().getScale() == finalValue\n || state.getSecondScale().getScale() == finalValue)\n .count() == 5);\n }\n\n assertNull(valueCompatibilityAnswersDto.getId());\n assertNull(valueCompatibilityAnswersDto.getUserId());\n assertNull(valueCompatibilityAnswersDto.getPassed());\n assertNull(valueCompatibilityAnswersDto.getPassDate());\n }", "@Override\n protected Map<String, Object> getBeansMap()\n {\n return TestUtility.getCountyData();\n }", "public void setResponse(HttpResponseWrapper response) {\n this.response = response;\n }", "TypedResponse createTypedResponse();", "@Before\n\tpublic void setUp() {\n\t beanFactory = context.mock(BeanFactory.class);\n\t\texpectationsFactory = new BeanFactoryExpectationsFactory(context, beanFactory);\n\t}", "@Test\n public void testSetAndGetDocuments() {\n DocumentsResponse testResponse = new DocumentsResponse();\n testResponse.setDocuments(testDocList);\n checkDocumentsList(testResponse);\n }", "protected void setUp() throws Exception {\r\n // used by KeyConstants and UserProfile\r\n TestsHelper.loadConfig(TestsHelper.CONFIG_FILE);\r\n\r\n actionContext = new ActionContext(request, response);\r\n handler =\r\n new BidUpdateHandler(TestsHelper.createHandlerElement(\r\n \"BidUpdateHandler\", new String[] {\"auction_id_param_key\",\r\n \"max_amount_param_key\",\r\n \"bid_id_param_key\"}, new String[] {\"auction\", \"amount\", \"bid\"}));\r\n\r\n auctionManager = new MockAuctionManager();\r\n auctionPersistence = new MockAuctionPersistence();\r\n\r\n // initialize profile manager\r\n profileManager = new MockUserProfileManager();\r\n\r\n // initialize login handler\r\n Map attrs = new HashMap();\r\n attrs.put(\"profile_manager\", profileManager);\r\n attrs.put(\"request_param_keys\", new String[] {\"firstName\", \"lastName\", \"e-mail\"});\r\n attrs.put(\"search_profile_keys\", new String[] {\"first_name\", \"last_name\"});\r\n attrs.put(\"credential_profile_keys\", new String[] {\"email_address\"});\r\n attrs.put(\"no_such_profile_result_name\", \"no_such_profile_result_name\");\r\n attrs.put(\"incorrect_credential_result_name\", \"incorrect_credential_result_name\");\r\n loginHandler = new LoginHandler(attrs);\r\n\r\n // remove attribute from the servlet context if it exists\r\n request.getSession().getServletContext().removeAttribute(KeyConstants.AUCTION_MANAGER_KEY);\r\n }", "@Before\r\n\tpublic void init() {\r\n\t\tMockitoAnnotations.initMocks(this);\r\n\t\tmockMvc = MockMvcBuilders.standaloneSetup(tokenController).build();\r\n\r\n\t\t// mockMvc = MockMvcBuilders.webAppContextSetup(context).build();\r\n\t}", "@Before\n public void setup(){\n MockitoAnnotations.initMocks(this);\n\n // create a standalone MVC Context to mocking\n mockMvc = MockMvcBuilders.standaloneSetup(customerController).build();\n }", "private void initForReadableEndpoints() {\n // clear content type\n response.setContentType(null);\n }", "@WebService(targetNamespace = \"http://ws.jinouts.org/\", name = \"AndProxyClientRespTestWS\")\r\n@XmlSeeAlso({ObjectFactory.class})\r\npublic interface AndProxyClientRespTestWS {\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testPrimitiveResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestPrimitiveResponse\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testPrimitiveResponseResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestPrimitiveResponseResponse\")\r\n public java.lang.String testPrimitiveResponse(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user,\r\n @WebParam(name = \"pass\", targetNamespace = \"\")\r\n java.lang.String pass\r\n );\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testComplexResponseObject\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestComplexResponseObject\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testComplexResponseObjectResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestComplexResponseObjectResponse\")\r\n public org.jinouts.ws.TestComplexResponse testComplexResponseObject(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user\r\n );\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testListResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestListResponse\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testListResponseResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestListResponseResponse\")\r\n public java.util.List<java.lang.String> testListResponse(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user\r\n );\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testDateResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestDateResponse\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testDateResponseResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestDateResponseResponse\")\r\n public javax.xml.datatype.XMLGregorianCalendar testDateResponse(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user\r\n );\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testListOfComplexResponseObject\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestListOfComplexResponseObject\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testListOfComplexResponseObjectResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestListOfComplexResponseObjectResponse\")\r\n public java.util.List<org.jinouts.ws.TestComplexResponse> testListOfComplexResponseObject(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user\r\n );\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testArrayResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestArrayResponse\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testArrayResponseResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestArrayResponseResponse\")\r\n public java.util.List<java.lang.String> testArrayResponse(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user\r\n );\r\n\r\n @WebResult(name = \"return\", targetNamespace = \"\")\r\n @RequestWrapper(localName = \"testListOfObjResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestListOfObjResponse\")\r\n @WebMethod\r\n @ResponseWrapper(localName = \"testListOfObjResponseResponse\", targetNamespace = \"http://ws.jinouts.org/\", className = \"org.jinouts.ws.TestListOfObjResponseResponse\")\r\n public java.util.List<org.jinouts.ws.MbrDetail> testListOfObjResponse(\r\n @WebParam(name = \"user\", targetNamespace = \"\")\r\n java.lang.String user\r\n );\r\n}", "private CityResponse mockCityResponse() {\n List<String> cityLocales = new ArrayList<String>(Collections.singleton(\"en\"));\n Map<String, String> cityNames = new HashMap<>();\n cityNames.put(\"en\", \"New York\");\n City city = new City(cityLocales, 1, 1, cityNames);\n\n List<String> countryNames = new ArrayList<>(Collections.singleton(\"United States\"));\n Country country = new Country(countryNames, 1, 1, \"US\", new HashMap());\n\n Location location = new Location(1, 1, 40.760498D, -73.9933D, 501, 1, \"EST\");\n\n Postal postal = new Postal(\"10036\", 1);\n\n return new CityResponse(city, new Continent(), country, location, new MaxMind(), postal,\n country, new RepresentedCountry(), new ArrayList<>(0),\n new Traits());\n }", "@Before\n\tpublic void setUp()\n\t{\n\t\tm_mockery = new Mockery();\n\t\tm_values = m_mockery.mock(KeyedValues.class);\n\t}", "public void setUpWithMock() {\n\n setUpWithMock(\"plainPluto.json\", null);\n\n }", "public interface IResponse {\n\n // abstract method for returning a String message in JSON format\n String getJSON();\n\n // abstract method to initialize code JSON property\n void setCode(String code);\n\n // abstract method to initialize message JSON property\n void setMessage(String message);\n}", "@Test\n public void testInfoEndpoints() throws Exception {\n List<QueryFormat> qfs = new ArrayList<>();\n\n wireMockRule.stubFor(any(anyUrl())\n .willReturn(aResponse()\n .withStatus(200)\n .withBody(objectMapper.writeValueAsString(qfs))));\n\n String uri = composeURL(endpointUrl, \"/info/\" + resourceId);\n\n\n HttpResponse response = retrievePostResponse(uri, headers, \"\");\n assertEquals(\"Missing credentials should return 401\", 401, response.getStatusLine().getStatusCode());\n\n QueryRequest infoRequest = new QueryRequest();\n Map<String, String> clientCredentials = new HashMap<String, String>();\n //TODO I guess we need some way to identify the token key? Maybe V1.4_BEARER_TOKEN\n clientCredentials.put(IRCTResourceRS.IRCT_BEARER_TOKEN_KEY, \"testToken\");\n infoRequest.setResourceCredentials(clientCredentials);\n String body = objectMapper.writeValueAsString(infoRequest);\n\n response = retrievePostResponse(uri, headers, body);\n assertEquals(\"Response status code should be 200\", 200, response.getStatusLine().getStatusCode());\n ResourceInfo responseInfo = HttpClientUtil.readObjectFromResponse(response, ResourceInfo.class);\n assertNotNull(\"Resource response should not be null\", responseInfo);\n assertNotNull(\"Resource response should have queryFormats\", responseInfo.getQueryFormats());\n assertNotNull(\"Resource response should have a name\", responseInfo.getName());\n\n //Try with a non-existent id\n uri = composeURL(endpointUrl , \"/info/3b2437fe-df56-4360-8156-27bcf0b1a467\");\n response = retrievePostResponse(uri, headers, body);\n assertEquals(\"Incorrect resource Id should return 500\", 500, response.getStatusLine().getStatusCode());\n }", "public void setResponse(edu.itq.soa.ResponseDocument.Response response)\n {\n generatedSetterHelperImpl(response, RESPONSE$0, 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);\n }", "@Test\n public void testDocumentsResponse() {\n DocumentsResponse testResponse = new DocumentsResponse(testDocList);\n checkDocumentsList(testResponse);\n }", "@Before\n\tpublic void init() {\n\t\tthis.acccountMock = new AccountDTO();\n\t\tthis.acccountMock.setId(ACCOUNT_ID);\n\t\tthis.acccountMock.setActive(true);\n\t\tthis.acccountMock.setBankingTransactions(new ArrayList<>());\n\n\t}", "@Test\n void getAllProfessors() throws Exception{\n MvcResult result = mvc.perform(get(\"/api/v1/professors\")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andReturn();\n System.out.println(result.getResponse().getContentAsString());\n\n }", "@BeforeEach\n public void initEach() {\n sut = new ApiKeyController(apiKeyService, new ModelMapper(), apiKeyLogWriter);\n mvc = MockMvcBuilders.standaloneSetup(sut)//\n .setCustomArgumentResolvers(new PageableHandlerMethodArgumentResolver())//\n .build();\n principal = new Principal() {\n @Override\n public String getName() {\n return \"principal\";\n }\n };\n }", "private <T extends MwsObject> T newResponse(\n Class<T> cls) {\n InputStream is = null;\n try {\n is = this.getClass().getResourceAsStream(cls.getSimpleName()+\".xml\");\n MwsXmlReader reader = new MwsXmlReader(is);\n T obj = cls.newInstance();\n obj.readFragmentFrom(reader);\n ResponseHeaderMetadata rhmd = new ResponseHeaderMetadata(\n \"mockRequestId\", Arrays.asList(\"A\",\"B\",\"C\"), \"mockTimestamp\", 0d, 0d, new Date());\n cls.getMethod(\"setResponseHeaderMetadata\", rhmd.getClass()).invoke(obj, rhmd);\n return obj;\n } catch (Exception e) {\n throw MwsUtl.wrap(e);\n } finally {\n MwsUtl.close(is);\n }\n }", "@Test\r\n\tvoid testGetAllMedicines() throws Exception {\r\n\t\tString URI = \"/medicine/getall\";\r\n\t\tMedicine medicine = new Medicine(); \r\n\t\tmedicine.setMedicineId(1345);\r\n\t\tmedicine.setMedicineName(\"Calcium\");\r\n\t\tmedicine.setMedicineCost(300);\r\n\t\t \r\n\t\tMedicine med = new Medicine();\r\n\t\tmed.setMedicineId(134);\r\n\t\tmed.setMedicineName(\"crosin\");\r\n\t\tmed.setMedicineCost(200);\r\n\t\r\n\t List<Medicine> medicineList = new ArrayList<>();\r\n\t medicineList.add(medicine);\r\n\t medicineList.add(med);\r\n\r\n Mockito.when(medicineService.getAllMedicines()).thenReturn(medicineList);\r\n MvcResult mvcResult = this.mockMvc.perform(MockMvcRequestBuilders.get(URI).accept(MediaType.APPLICATION_JSON)).andReturn();\r\n MockHttpServletResponse mockHttpServletResponse = mvcResult.getResponse();\r\n String jsonOutput = mockHttpServletResponse.getContentAsString();\r\n assertNotNull(jsonOutput);\r\n\r\n\t}", "public AdyenResponses() {\n\t\tthis(\"adyen_responses\", null);\n\t}", "@SuppressWarnings(\"unused\")\n private RunUnitTestsResponse() {\n this((TestResultInfo) null, -1, -1);\n }", "@Test\n public void happyFlow() throws Exception {\n RegisterHandler registerHandler = new RegisterHandler(service);\n RegistrationVerificationHandler verificationHandler = new RegistrationVerificationHandler(service);\n LoginHandler loginHandler = new LoginHandler(service);\n HttpHandler dummyHandler = new Mockito().mock(HttpHandler.class);\n AuthenticationFilter authenticationFilter = new AuthenticationFilter(service, dummyHandler);\n ResetPasswordHandler resetPasswordHandler = new ResetPasswordHandler(service);\n ChangePasswordHandler changePasswordHandler = new ChangePasswordHandler(service);\n\n String password = \"test\";\n String email = \"test@test.com\";\n\n // Register\n String body = \"{address:\\\"\" + email + \"\\\", password:\\\"\" + password + \"\\\"}\";\n InputStream bodyStream = new ByteArrayInputStream(body.getBytes());\n HttpExchange post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n registerHandler.handle(post);\n\n //intercept verification code\n ArgumentCaptor<String> codeCaptor = ArgumentCaptor.forClass(String.class);\n verify(emailService).sendVerificationCode(codeCaptor.capture(), any(EmailAddress.class));\n\n // Verify code\n body = \"{address:\\\"\" + email + \"\\\", code:\\\"\" + codeCaptor.getValue() + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n verificationHandler.handle(post);\n\n //login\n body = \"{address:\\\"\" + email + \"\\\", password:\\\"\" + password + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n loginHandler.handle(post);\n\n Headers responseHeaders = post.getResponseHeaders();\n String loginToken = responseHeaders.get(\"login-token\").get(0);\n\n // authorized request\n body = \"{dummy:\\\"value\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n Headers headers = new Headers();\n headers.add(\"login-token\", loginToken);\n post = mockHttpExchange(\"POST\", \"\", bodyStream, headers);\n authenticationFilter.handle(post);\n\n ArgumentCaptor<HttpExchange> exchangeCaptor = ArgumentCaptor.forClass(HttpExchange.class);\n verify(dummyHandler).handle(exchangeCaptor.capture());\n assertThat(exchangeCaptor.getValue()).isEqualTo(post);\n\n //login via address\n body = \"{address:\\\"\" + email + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n loginHandler.handle(post);\n\n //intercept login token\n ArgumentCaptor<LoginToken> tokenCaptor = ArgumentCaptor.forClass(LoginToken.class);\n verify(emailService).sendLoginLink(tokenCaptor.capture());\n loginToken = tokenCaptor.getValue().token;\n\n // authorized request\n dummyHandler = new Mockito().mock(HttpHandler.class);\n authenticationFilter = new AuthenticationFilter(service, dummyHandler);\n body = \"{dummy:\\\"value\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n Headers headers2 = new Headers();\n headers2.add(\"login-token\", loginToken);\n post = mockHttpExchange(\"POST\", \"\", bodyStream, headers2);\n authenticationFilter.handle(post);\n\n verify(dummyHandler).handle(exchangeCaptor.capture());\n assertThat(exchangeCaptor.getAllValues().get(1)).isEqualTo(post);\n\n //reset password\n body = \"{address:\\\"\" + email + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n resetPasswordHandler.handle(post);\n\n //intercept new password\n ArgumentCaptor<Login> passwordCaptor = ArgumentCaptor.forClass(Login.class);\n verify(emailService).sendNewLogin(passwordCaptor.capture());\n String resetPassword = passwordCaptor.getValue().password;\n\n //login\n body = \"{address:\\\"\" + email + \"\\\", password:\\\"\" + resetPassword + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n loginHandler.handle(post);\n\n responseHeaders = post.getResponseHeaders();\n assertThat(responseHeaders.get(\"login-token\")).isNotEmpty();\n\n //change password\n String newPassword = \"test2\";\n body = \"{address:\\\"\" + email + \"\\\", oldPassword:\\\"\" + resetPassword + \"\\\", newPassword:\\\"\" + newPassword + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n changePasswordHandler.handle(post);\n\n //login\n body = \"{address:\\\"\" + email + \"\\\", password:\\\"\" + newPassword + \"\\\"}\";\n bodyStream = new ByteArrayInputStream(body.getBytes());\n post = mockHttpExchange(\"POST\", \"\", bodyStream, new Headers());\n loginHandler.handle(post);\n\n responseHeaders = post.getResponseHeaders();\n assertThat(responseHeaders.get(\"login-token\")).isNotEmpty();\n }", "@JsonSetter(\"response\")\n public void setResponse (EventResponseModel value) {\n this.response = value;\n }", "@BeforeEach\n public void reset() {\n WIREMOCK_SERVER.resetAll();\n // create new TestRail client instance\n restClientActor =\n RestClientActor.newBuilder()\n .withBaseURL(\"http://localhost:\" + WIREMOCK_SERVER.port())\n .withBasicAuth(\"User\", \"Password\")\n .withDefaultHeader(\"DefaultStaticHeader\", \"static-header-value\")\n .withDefaultHeader(\"DefaultDynamicHeader\", defaultDynamicHeaderSupplier)\n .build();\n }", "@Test\n\tpublic void test_04() {\n\n\t\t//Json data configuration\n\t\tcomplexobjectinformationclass childdataobject = new complexobjectinformationclass();\n\t\tcomplexobjectclass dataobject = new complexobjectclass();\n\n\t\tchilddataobject.setEmail(\"complex@complex.com\");\n\t\tchilddataobject.setPhone(\"12300000\");\n\t\tchilddataobject.setAddress(\"Bangladesh\");\n\n\t\tdataobject.setId(\"2\");\n\t\tdataobject.setAuthor(\"ataure\");\n\t\tdataobject.setTitle(\"This is title\");\n\t\tdataobject.setinformation(childdataobject);\n\n\n\t\t//Request body\n\t\tResponse reponse = given().\n\t\t\t\twhen().\n\t\t\t\tcontentType(ContentType.JSON).\n\t\t\t\tbody(dataobject).\n\t\t\t\tpost(\"http://localhost:3000/posts\");\n\n\t\tSystem.out.println(\"updated response data \"+ reponse.asString());\t\t\n\t}" ]
[ "0.6742217", "0.65042096", "0.642185", "0.6006969", "0.59948856", "0.5975626", "0.5953582", "0.5903493", "0.58599657", "0.5828512", "0.5768728", "0.56531745", "0.56189245", "0.55648553", "0.5540453", "0.55339664", "0.5527434", "0.55107933", "0.549772", "0.54943717", "0.5490647", "0.54706013", "0.54582906", "0.54582906", "0.54434234", "0.5417938", "0.54174906", "0.5405905", "0.54057544", "0.54008865", "0.53800136", "0.5369918", "0.5362027", "0.53599006", "0.5353103", "0.5353103", "0.53505206", "0.53494287", "0.5336552", "0.53292286", "0.5321962", "0.53090656", "0.5300655", "0.5297257", "0.52929384", "0.52918553", "0.52918553", "0.5274176", "0.52599514", "0.5256132", "0.52498823", "0.5208096", "0.5198045", "0.51901966", "0.5177646", "0.51651204", "0.5155623", "0.51523376", "0.5133427", "0.5124199", "0.51196367", "0.5096671", "0.5094972", "0.5087336", "0.5085697", "0.5083825", "0.50768125", "0.50718546", "0.5068274", "0.5064242", "0.5061676", "0.5056386", "0.50542766", "0.5053016", "0.50519735", "0.50488704", "0.504859", "0.50481707", "0.50332093", "0.5019823", "0.5018346", "0.5015225", "0.50121295", "0.50119555", "0.5007556", "0.50060284", "0.50037", "0.5003694", "0.5002402", "0.5001396", "0.49979454", "0.49931246", "0.4991215", "0.49903724", "0.49865818", "0.49819168", "0.49812806", "0.49740022", "0.4966865", "0.4963568", "0.49579942" ]
0.0
-1
Title: EventActionInfo Description: Description of the constructor
public EventActionInfo(org.dom4j.Element el) throws Exception { this(); readXML(el); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ActionEvent(Object source, int id, int clicks, String command, Object param) {\n super(source, id, command);\n this.clicks = clicks; \n this.param = param; \n }", "public Event() {\r\n\r\n\t}", "protected ICEvent() {}", "public Event() {\n }", "public Event() {\n }", "public Event() {\n\t}", "public Event() {}", "public\n CreateEvent()\n {}", "public Event() {\n\n }", "public Event(int type) {\n this.type=type;\n this.arg=null;\n }", "public EventMessage(Event event)\r\n {\r\n //super(\"EventMessage\");\r\n super(TYPE_IDENT, event);\r\n }", "public Event(){\n \n }", "public Event(){\n\n }", "public Eventd() {\n }", "public ScheduledActionAction() {\n\n }", "BasicEvents createBasicEvents();", "public Event() {\n this.name = null;\n this.description = null;\n this.date = new GregorianCalendar();\n }", "public UpcomingContestsManagerAction() {\r\n }", "public void setActionInfo(String actionInfo);", "public PSCacheEvent(int action, Object object)\n {\n if (action != CACHE_ITEM_ACCESSED_FROM_DISK && \n action != CACHE_ITEM_ACCESSED_FROM_MEMORY && \n action != CACHE_ITEM_ADDED &&\n action != CACHE_ITEM_NOT_FOUND &&\n action != CACHE_ITEM_REMOVED &&\n action != CACHE_ITEM_STORED_TO_DISK)\n {\n throw new IllegalArgumentException(\"invalid action\");\n }\n \n m_action = action;\n m_object = object;\n }", "public CreateIndividualPreAction() {\n }", "private LogEvent()\n\t{\n\t\tsuper();\n\t}", "public void createAction() {\n }", "public AddApplicationReleaseAction() {\r\n }", "public EventDetails() {\n initComponents();\n }", "public ActionInfo(Class actionClass, Preferences actionPrefs) {\n this.actionClass = actionClass;\n this.actionPrefs = actionPrefs;\n }", "public VisitAction() {\n }", "Event createEvent();", "Event createEvent();", "Action(String desc){\n this.desc = desc;\n this.append = \"\";\n }", "protected PMBaseAction() {\r\n super();\r\n }", "public void actionStarted(ActionStreamEvent action);", "public JHI_ENTITY_AUDIT_EVENT() {\n this(\"jhi_entity_audit_event\", null);\n }", "public QPEvent() {}", "public ScheduleEvent()\n\t{\n\n\t}", "BasicEvent createBasicEvent();", "public DescribeEventsRequest() {}", "ActionEvent createActionEvent();", "public ActionManager() {\n\t\tsuper();\n\t}", "@Override\r\n public void initAction() {\n \r\n }", "private void createEvents() {\n\t}", "public MessagingEvent(T source, MessagingAction action, KafkaOutputChannel destination) {\n super(source);\n this.source = source;\n this.action = action;\n this.destination = destination;\n }", "public MemberAction() {\n\t\tsuper();\n\t}", "public InspectorEvent (double time,double clock, Inspector insp, factoryComponent fc,EventTypes type){\n eventfTime = time + clock;\n eventsTime = clock;\n this.fc = fc;\n this.insp = insp;\n eventType = type;\n }", "public Event(int id, String eventName){\n this.id = id;\n this.event = eventName;\n this.location = null;\n this.date = 0;\n this.startTime = \"00:00 AM\";\n this.endTime = \"00:00 AM\";\n this.notes = \"No notes\";\n this.allDay = false;\n this.bigId = -1;\n this.alarm = -1;\n\n }", "public ICEvent(int addr, TOP_Type type) {\n super(addr, type);\n readObject();\n }", "public SoundEvent() \n\t{\n\tsuper(GAME_SOUND_EVENT);\n\t}", "Event(int start, int end, String eventName) {\r\n this.start = start;\r\n this.end = end;\r\n this.eventName = eventName;\r\n this.description = \"\";\r\n }", "Action createAction();", "Action createAction();", "Action createAction();", "public ArticleSearchDoneEvent() {\n\n }", "public AbstractFoxEvent(Object source, String eventName) {\r\n super(source);\r\n this.eventName = eventName;\r\n this.createTimestamp = System.currentTimeMillis();\r\n }", "public Action(String name) {\n this.name = name;\n }", "public SoHandleEventAction getAction() { return eventAction; }", "public Event(int eventType, double eventTime){\n this.eventType = eventType;\n this.eventTime = eventTime;\n }", "LogAction createLogAction();", "@Override\r\n\tprotected void initEvents() {\n\t\t\r\n\t}", "public interface Event\n\t{\n\t\tpublic static final String EVENT_ID = \"aether.event.id\";\n\t\tpublic static final String TIME = \"aether.event.time\";\n\t\tpublic static final String EVENT_TYPE = \"aether.event.type\";\n\t}", "public PDAnnotationAdditionalActions(COSDictionary a) {\n/* 49 */ this.actions = a;\n/* */ }", "@AutoEscape\n\tpublic String getActionInfo();", "EventManager()\n {\n }", "private ActionPackage() {}", "public MTInputEvent(Object source) {\n\t\tsuper(source);\n\t\t\n\t}", "public ServiceEvent() {\n // eventSenderID and eventSenderClass are initialized by the OperatingSystem! \n }", "public Event (int id, String title, String text, String imagePath, String[] titleOptions, String[] textOptions ) {\n\t\tthis.id=id;\n\t\tthis.title=title;\n\t\tthis.text=text;\n\t\tthis.imagePath=imagePath;\n\t\tthis.titleOptions=titleOptions;\n\t\tthis.textOptions=textOptions;\n\t}", "Event(int start, int end, String eventName, String description) {\r\n this.start = start;\r\n this.end = end;\r\n this.eventName = eventName;\r\n this.description = description;\r\n }", "public Event(EventType type, String eventKey) \n\t{\n\t\tsuper();\n\t\tthis.evntType = type;\n\t\tthis.key = eventKey;\n\t\tthis.uuid = UUID.randomUUID().toString();\n\t\tthis.milliseconds = 0;\n\t\tthis.repeated = false;\n\t}", "public Event(String description, String checker, String info) {\n super(description, checker);\n this.details = new Date(info);\n this.info = info.trim();\n }", "public MCalendarEventView()\r\n {\r\n }", "public EventException() {\n super(\"OOPS!!! The description or time of an event cannot be empty.\");\n }", "@Override\n\tpublic void onActionStart(int action) {\n\t\t\n\t}", "@Override\n protected void initEventAndData() {\n }", "BaseAction(int key, String name) {\n this.key = key;\n this.name = name;\n }", "public void viewReference(ActionEvent actionEvent) {\n }", "public Event (Display display, ResponseInputStream in) {\n this.display = display;\n code = in.read_int8 ();\n detail = in.read_int8 ();\n sequence_number = in.read_int16();\n }", "public CmdEvent(Object source, ICmdDataFlowContext cmdDataFlowContext) {\n super(source);\n this.cmdDataFlowContext = cmdDataFlowContext;\n\n }", "CustomAction(String actionType, String message) {\n action.put(\"Object\", actionType);\n JSONObject attributes = new JSONObject();\n attributes.put(\"message\", message);\n action.put(\"Action\", attributes);\n }", "CustomAction(String actionType, String color, double startX, double startY){\n action.put(\"Object\", actionType);\n JSONObject attributes = new JSONObject();\n attributes.put(\"color\", color);\n attributes.put(\"startX\", startX);\n attributes.put(\"startY\", startY);\n action.put(\"Action\", attributes);\n }", "public ApplicationEvent(Object source) {\n super(source);\n this.timestamp = System.currentTimeMillis();\n }", "protected void init_actions()\r\n {\r\n action_obj = new CUP$SintaxAnalysis$actions(this);\r\n }", "@Override\r\n public void actionPerformed( ActionEvent e )\r\n {\n }", "protected ActionListener createAboutActionListener() {\r\n return new AboutActionListener();\r\n }", "public EventTimeline() {\n this(0, 0, 91, 9);\n }", "public ConfigAction()\n {\n this(null, null, true);\n }", "protected void init_actions()\r\n {\r\n action_obj = new CUP$Parser$actions(this);\r\n }", "public void actionPerformed( ActionEvent event )\n {\n \n }", "@Override\r\n\tpublic void startNewEvent(int t) {\r\n\t\t// TODO Auto-generated method stub\r\n\t\tthis.newEvent(\"Ernest\", \"action\", t);\r\n\t}", "@Override\r\n\tpublic void initActions() {\n\t\t\r\n\t}", "public Event(String title, String location,\n LocalDateTime datetime, int duration, int eventCapacity){\n this.title = title;\n this.location = location;\n this.datetime = datetime;\n this.usernames = new ArrayList<>();\n this.duration = duration;\n this.eventCapacity = eventCapacity;\n uuid = UUID.randomUUID();\n this.type = \"event\";\n }", "public Logger(int ActorID, int TargetID, Action action){\n this.date = new Date();\n this.actorID = ActorID;\n this.targetID = TargetID;\n this.action = action;\n }", "public DocumentoVinculadoAction() {\n }", "protected Event(String title, String location,\n LocalDateTime datetime, int duration, int eventCapacity, String type){\n this.title = title;\n this.location = location;\n this.datetime = datetime;\n this.usernames = new ArrayList<>();\n this.duration = duration;\n this.eventCapacity = eventCapacity;\n uuid = UUID.randomUUID();\n this.type = type;\n }", "public M_Hompeage1_evt() {\n initComponents();\n }", "public void init() {\r\n setEventType(4);\r\n }", "public CustomerEvent()\r\n {\r\n this(0, 0, ENTER);\r\n }", "protected void init_actions()\n {\n action_obj = new CUP$Asintactico$actions(this);\n }", "protected void init_actions()\r\n {\r\n action_obj = new CUP$parser$actions(this);\r\n }", "public CEventProgram()\r\n {\r\n }", "protected void init_actions()\n {\n action_obj = new CUP$FractalParser$actions(this);\n }" ]
[ "0.6984802", "0.69004315", "0.6830575", "0.6793733", "0.6793733", "0.6768989", "0.6739078", "0.6702686", "0.6700572", "0.6611491", "0.65922576", "0.65319145", "0.65303993", "0.65123254", "0.64596176", "0.6407589", "0.6384298", "0.63566", "0.6355616", "0.63542384", "0.63047314", "0.6294761", "0.62899554", "0.62800324", "0.6277947", "0.6266948", "0.6262396", "0.6240005", "0.6240005", "0.61978185", "0.61793643", "0.61762226", "0.6173648", "0.61725444", "0.6172109", "0.6167862", "0.6148744", "0.61225426", "0.6116372", "0.61011577", "0.60966635", "0.6079131", "0.6063136", "0.6057566", "0.6047385", "0.60469854", "0.6023839", "0.6023158", "0.602283", "0.602283", "0.602283", "0.6012102", "0.5993572", "0.59867394", "0.5976899", "0.5972817", "0.59433484", "0.5942888", "0.5938722", "0.5908547", "0.5897163", "0.58899325", "0.5888623", "0.5887826", "0.5880416", "0.58797306", "0.5878703", "0.5871211", "0.5870511", "0.5865782", "0.585934", "0.58556813", "0.58553183", "0.5854008", "0.5846613", "0.5842367", "0.5828436", "0.58224225", "0.58108634", "0.5793446", "0.5792749", "0.57924306", "0.57908523", "0.5789563", "0.57880604", "0.57878095", "0.5787035", "0.5784775", "0.5776686", "0.5775815", "0.57669646", "0.57664454", "0.5764003", "0.5763768", "0.5761952", "0.5760908", "0.57579106", "0.5756169", "0.57455456", "0.5740526" ]
0.63453937
20
Title: validate Description: Description of the method
public boolean validate() throws Exception { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void validate() {}", "void validate();", "void validate();", "protected void validate() {\n // no op\n }", "public abstract boolean validate();", "@Override\n\tpublic void validate()\n\t{\n\n\t}", "@Override\r\n\tpublic void validate() {\n\t\t\r\n\t}", "ValidationResponse validate();", "@Override\n\tpublic void validate() {\n\t}", "private void validateData() {\n }", "@Override\r\n public void validate() {\r\n }", "void validate() throws ValidationException;", "protected void validate() {\n // no implementation.\n }", "private void validateInputParameters(){\n\n }", "public void validate () { throw new RuntimeException(); }", "public void validate() throws Exception {\n }", "@Override\r\n\tprotected void validate() {\n\t}", "void checkValid();", "@Override\r\n public void validate() {\n\r\n }", "@Override\n\tpublic void validate(Object arg0, Errors arg1) {\n\n\t}", "public boolean validate(){\n return true;\n }", "@Override\r\n public boolean validate() {\n return true;\r\n }", "public void validate(DataRecord value) {\n\r\n\t}", "public void validate() throws ValidationException {\r\n/* 522 */ Validator validator = new Validator();\r\n/* 523 */ validator.validate(this);\r\n/* */ }", "@Override\r\n\tpublic boolean validate() {\n\t\treturn true;\r\n\t}", "@Override\r\n\tpublic boolean validate() {\n\t\treturn true;\r\n\t}", "public void validate() throws ValidationException {\n\t}", "public abstract void validate () throws ModelValidationException;", "public boolean validate() {\n return true;\n }", "public boolean validate() {\n return true;\n }", "@Override\n\tpublic void validate() {\n\t\tsuper.validate();\n\t}", "@Override\r\n\tpublic void Validate() {\n\r\n\t}", "protected abstract boolean isValidate();", "boolean checkValidity();", "public String validate() {\n\t\treturn \"valid\";\n\t}", "public boolean isValid() {\r\n/* */ try {\r\n/* 326 */ validate();\r\n/* 327 */ } catch (ValidationException vex) {\r\n/* 328 */ return false;\r\n/* */ } \r\n/* 330 */ return true;\r\n/* */ }", "@Test\n\tpublic void testValidate()\n\t{\n\t\tSystem.out.println(\"validate\");\n\t\tUserTypeCode userTypeCode = new UserTypeCode();\n\t\tuserTypeCode.setCode(\"Test\");\n\t\tuserTypeCode.setDescription(\"Test\");\n\n\t\tValidationModel validateModel = new ValidationModel(userTypeCode);\n\t\tvalidateModel.setConsumeFieldsOnly(true);\n\n\t\tValidationResult result = ValidationUtil.validate(validateModel);\n\t\tSystem.out.println(\"Any Valid consume: \" + result.toString());\n\t\tif (result.valid() == false) {\n\t\t\tAssert.fail(\"Failed validation when it was expected to pass.\");\n\t\t}\n\t\tSystem.out.println(\"---------------------------\");\n\n\t\tvalidateModel = new ValidationModel(userTypeCode);\n\t\tresult = ValidationUtil.validate(validateModel);\n\t\tSystem.out.println(\"Faild: \" + result.toString());\n\t}", "private void validate() {\n\n etCardNumber.validate();\n\n etCardExpiryDate.validate();\n\n etCardCvv.validate();\n\n etCardHolderName.validate();\n\n etPhoneNumber.validate();\n\n etCustomerName.validate();\n }", "public List<String> validate();", "public abstract boolean isValid();", "public abstract boolean isValid();", "public abstract boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "private void validate() {\n\n if (this.clsname == null)\n throw new IllegalArgumentException();\n if (this.dimension < 0)\n throw new IllegalArgumentException();\n if (this.generics == null)\n throw new IllegalArgumentException();\n }", "public void validate(){\r\n\t\ttry{\r\n\t\t\t//First name, last name, date of birth and email are compulsory.\r\n\t\tif(FirstName==null||LastName==null||Dob==null||Email==null) \r\n\t\t\tthrow new Exception(\"One of the field is Empty :\\n(First name / last name / dob / email )\");\r\n\t\tif(TelephoneNumber!=0||MobileNumber!=0)\r\n\t\t\tthrow new Exception(\"Enter Contact Number\");\r\n\t\t\r\n\t\t}\r\n\t\tcatch(Exception e){\r\n\t\t\tSystem.out.println(e);\r\n\t\t}\r\n\t\t\r\n\t\t/*finally{\r\n\t\t\tSystem.out.println(\"Program Executed\");\r\n\t\t}*/\r\n\t}", "@Override\n public void customValidation() {\n }", "@Override\n public void customValidation() {\n }", "@Override\n public void customValidation() {\n }", "public String validate(Data[] data);", "protected abstract boolean isValid();", "public abstract void validate(List<String> validationMessages);", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "public void validate(){\n if (validated){\n validated = false;\n } else {\n validated = true;\n }\n }", "@Override\n\tprotected void doValidate() throws InstructionValidationException {\n\t}", "public void validateObjectMetier() throws NSValidation.ValidationException {\n\n\t}", "public void validateObjectMetier() throws NSValidation.ValidationException {\n\n\t}", "public void validateObjectMetier() throws NSValidation.ValidationException {\n\n\t}", "@Override\n public boolean validate(final String param) {\n return false;\n }", "@Test\n\tpublic void testValidate() {\n\t\tSystem.out.println(\"starting testValidate()\");\n\t\tPersonalData personalData = new PersonalData(\"Kelvin\", \"Huynh\", \"4081234567\", \"Kelvin_Huynh@email.com\");\n\t\tassertTrue (\"address validates\", personalData.validatePersonalData());\n\t System.out.println(\"testValidate PASSED\");\n\t}", "public String validate() {\n\t\tString msg=\"\";\n\t\t// for name..\n\t\tif(name==null||name.equals(\"\"))\n\t\t{\n\t\t\tmsg=\"Task name should not be blank or null\";\n\t\t}\n\t\tif(name.split(\" \").length>1)\n\t\t{\n\t\t\tmsg=\"multiple words are not allowed\";\n\t\t}\n\t\telse\n\t\t{\n\t\t for(int i=0;i<name.length();i++)\n\t\t {\n\t\t\t char c=name.charAt(i);\n\t\t\t\tif(!(Character.isDigit(c)||Character.isLetter(c)))\n\t\t\t\t{\n\t\t\t\t\tmsg=\"special characters are not allowed\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t }\n\t\t}\n\t\t\t\n\t\t\n\t\t\t// for Description...\n\t\t\tif(desc==null||desc.equals(\"\"))\n\t\t\t{\n\t\t\t\tmsg=\"Task descrshould not be blank or null\";\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t // for tag...\n\t\t\t \n\t\t\t if(tag==null||tag.equals(\"\"))\n\t\t\t\t{\n\t\t\t\t\tmsg=\"Task tags not be blank or null\";\n\t\t\t\t}\n\t\t\t\t\n\t\t\t // for date { imp here}\n\t\t\t if(tarik!=null)\n\t\t\t {\n\t\t\t SimpleDateFormat sdf=new SimpleDateFormat(\"dd/MM/yyyy\");\n\t\t\t sdf.setLenient(false); // very imp here..\n\t\t\t try {\n\t\t\t\tDate d=sdf.parse(tarik);\n\t\t\t} catch (ParseException e) {\n\t\t\t\t\n\t\t\t//\tmsg=\"date should be correct foramat\";\n\t\t\t\tmsg=e.getMessage();\n\t\t\t}\n\t\t\t }\n\t\t\t// for prority..\n\t\t\t if(prio<1&&prio>10)\n\t\t\t {\n\t\t\t\t msg=\"prority range is 1 to 10 oly pa\";\n\t\t\t }\n\t\t\t\t\n\t\t\t\tif(msg.equals(\"\"))\n\t\t\t\t{\n\t\t\t\t\treturn Constant.SUCCESS;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\treturn msg;\n\t}", "@Override\n\tpublic void selfValidate() {\n\t\t\n\t}", "ValidationError getValidationError();", "@Override\n protected Result validate() {\n return successful(this);\n }", "protected boolean isValid()\r\n {\r\n \treturn true;\r\n }", "public void validate() throws SpringBootBaseAppException,MessageValidationException;", "@Override\n public boolean validate() throws ValidationException\n {\n boolean isValid = super.validate();\n return checkAAField() && isValid;\n }", "@Override\n\tpublic boolean validate() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean validate() {\n\t\treturn false;\n\t}", "public boolean validateModel(){\r\n System.out.println(\"Validated!\");\r\n return true;\r\n }", "void validate(N ndcRequest, ErrorsType errorsType);", "private boolean isValidInput() {\n\t\treturn true;\n\t}", "public void validate() throws org.apache.thrift.TException {\n\t}", "public void validate() throws org.apache.thrift.TException {\n\t}", "public void validate() throws org.apache.thrift.TException {\n\t}", "public Result validate(MessageNode mesgNode, Message mesg);", "@Override\n\tpublic void validate() {\n\t\tFormFieldValidator.validateStudent(this, student);\n\t\tFormFieldValidator.validateCourseList(this, courseID);\n\t}", "private void validate(Path path) {\n }", "boolean valid() {\n return true;\n }", "boolean valid() {\n return true;\n }", "boolean valid() {\n return true;\n }", "public void validate() {\n\t\tthis.invalidated = false;\n\t}", "protected abstract boolean isInputValid();", "String validate(String toValidate);", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }", "public void validate() throws TException {\n }" ]
[ "0.8720467", "0.8495479", "0.8495479", "0.7929322", "0.79288965", "0.79250175", "0.78354645", "0.77511495", "0.77239466", "0.7713707", "0.77110773", "0.76732004", "0.7655603", "0.7642864", "0.7637283", "0.7630704", "0.7611805", "0.74356633", "0.7348816", "0.7274531", "0.72593325", "0.7188649", "0.7185065", "0.71847737", "0.7180193", "0.7180193", "0.71602225", "0.71558654", "0.7129031", "0.7129031", "0.7109189", "0.7080692", "0.7074441", "0.706933", "0.70326173", "0.69837105", "0.6943954", "0.690095", "0.68920565", "0.68478024", "0.68478024", "0.68478024", "0.681049", "0.681049", "0.681049", "0.681049", "0.681049", "0.6802406", "0.6796713", "0.6794938", "0.6794938", "0.6794938", "0.6793601", "0.67689294", "0.67558503", "0.6746516", "0.6746516", "0.6746516", "0.6746516", "0.6746516", "0.6720966", "0.67147404", "0.67047006", "0.67047006", "0.67047006", "0.6682023", "0.66698253", "0.6667449", "0.66536605", "0.6652235", "0.6651451", "0.66349316", "0.6620793", "0.66187406", "0.6615201", "0.6615201", "0.66087496", "0.6594049", "0.6541026", "0.6534994", "0.6534994", "0.6534994", "0.6530815", "0.65265954", "0.65164095", "0.651047", "0.651047", "0.651047", "0.6504242", "0.6488144", "0.6477092", "0.64729345", "0.64729345", "0.64729345", "0.64729345", "0.64729345", "0.64729345", "0.64729345", "0.64729345", "0.64729345", "0.64729345" ]
0.0
-1
Title: readXML Description: Parses XML into Object instance
public void readXML(org.dom4j.Element el) throws Exception { String name,value; org.dom4j.Element node=el; if (el.attribute("type") != null) setType(el.attribute("type").getText()); if (el.attribute("action") != null) setAction(ActionList.valueOf(el.attribute("action").getText())); if (el.attribute("direction") != null) setDirection(DirectionList.valueOf(el.attribute("direction").getText())); if (el.attribute("content") != null) setContent(el.attribute("content").getText()); if (el.attribute("iterations") != null) setIterations(org.jbrain.xml.binding._TypeConverter.parseInteger(el.attribute("iterations").getText(), sObjName, "Iterations")); if (el.attribute("asynchronous") != null) setAsynchronous(org.jbrain.xml.binding._TypeConverter.parseBoolean(el.attribute("asynchronous").getText(), sObjName, "Asynchronous")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void parseXML(String XML);", "public static Object objectFromXml(String xml) throws XmlParseException\n {\n return objectFromXmlElement(Xmlwise.createXml(xml));\n }", "public static Obj fromString(String xml) \n { \n try\n {\n ByteArrayInputStream in = new ByteArrayInputStream(xml.getBytes(\"UTF-8\"));\n ObixDecoder decoder = new ObixDecoder(in);\n return decoder.decodeDocument(); \n }\n catch(Exception e)\n {\n throw new RuntimeException(e.toString());\n }\n }", "void read(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException;", "public abstract T readFromXml(XmlPullParser parser, int version, Context context)\n throws IOException, XmlPullParserException;", "public Object fromXML(Reader input) throws XMLUtilityException {\r\n\t\tObject beanObject;\r\n\t\tbeanObject = unmarshaller.fromXML(input);\r\n\t\treturn beanObject;\r\n\t}", "private static Document loadXMLFromString(String xml) throws ParserConfigurationException, SAXException,\n\t\t\tIOException {\n\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n\t\tDocumentBuilder builder = factory.newDocumentBuilder();\n\t\tInputSource is = new InputSource(new StringReader(xml));\n\t\treturn builder.parse(is);\n\t}", "public static Object fromXML(String xml, Class className) {\r\n\t\tByteArrayInputStream xmlData = new ByteArrayInputStream(xml.getBytes());\r\n\t\tJOXBeanInputStream joxIn = new JOXBeanInputStream(xmlData);\r\n\t\ttry {\r\n\t\t\treturn (Object) joxIn.readObject(className);\r\n\t\t} catch (IOException exc) {\r\n\t\t\tlog.info(\"从xml转换成bean失败\" + exc.toString());\r\n\t\t\treturn null;\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\txmlData.close();\r\n\t\t\t\tjoxIn.close();\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\tlog.info(\"从xml转换成bean失败\" + e.toString());\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void getXmlFromStream (BufferedReader reader){\n\n String tmpDate = null;\n String strDate = null;\n Date date = null;\n\n try{\n XmlPullParserFactory factory = XmlPullParserFactory.newInstance();\n XmlPullParser xpp = factory.newPullParser();\n\n // point the parser to our file.\n xpp.setInput(reader);\n // get initial eventType\n int eventType = xpp.getEventType();\n\n // process tag while not reaching the end of document\n while(eventType != XmlPullParser.END_DOCUMENT) {\n switch(eventType) {\n // at start of document: START_DOCUMENT\n case XmlPullParser.START_DOCUMENT:\n //study = new Study();\n break;\n\n // at start of a tag: START_TAG\n case XmlPullParser.START_TAG:\n // get tag name\n String tagName = xpp.getName();\n\n // if <Cube>, get attribute: 'currency'\n if(tagName.equalsIgnoreCase(KEY_CUBE)) {\n if(strDate == null){\n strDate = xpp.getAttributeValue(null, KEY_DATE);\n }\n\n String currency = xpp.getAttributeValue(null, KEY_CURRENCY);\n String rate = xpp.getAttributeValue(null, KEY_RATE);\n if(currency != null) {\n\n // Create new object\n date = createDate(strDate); // Create date\n double doubleRate = Double.parseDouble(rate); // Convert string to double\n cubes.add(new CubeXML(new Date(),currency, doubleRate)); // Create object and store in list\n }\n }\n break;\n }\n // jump to next event\n eventType = xpp.next();\n }\n\n // Add euro\n cubes.add(new CubeXML(date, \"Euro\",1));\n\n } catch (XmlPullParserException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "public Object fromXML(File xmlFile) throws XMLUtilityException {\r\n\t\tObject beanObject = null;\r\n\t\tbeanObject = unmarshaller.fromXML(xmlFile);\r\n\t\treturn beanObject;\r\n\t}", "public <T> T fromXML(final String xml) throws ClassNotFoundException, ObjectStreamException {\n try {\n return fromXML(new StringReader(xml));\n } catch (final ObjectStreamException e) {\n throw e;\n } catch (final IOException e) {\n throw new StreamException(\"Unexpected IO error from a StringReader\", e);\n }\n }", "void readXML(Element elem) throws XMLSyntaxError;", "private void readXML() {\n\t\tSAXParserFactory factory = SAXParserFactory.newInstance();\n\t\tXMLReader handler = new XMLReader();\n\t\tSAXParser parser;\n\t\t\n\t\t//Parsing xml file\n\t\ttry {\n\t\t\tparser = factory.newSAXParser();\n\t\t\tparser.parse(\"src/data/users.xml\", handler);\n\t\t\tgroupsList = handler.getGroupNames();\n\t\t} catch(SAXException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ParserConfigurationException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t};\n\t}", "protected abstract void _fromXml_(Element in_xml) throws ConfigurationException;", "public static Element parse(Reader xml)\n {\n Element ret = null;\n DocumentBuilder builder = getDocumentBuilder();\n try\n {\n ret = builder.parse(new InputSource(xml)).getDocumentElement();\n releaseBuilder(builder);\n return ret;\n }\n catch(Exception e)\n {\n LOGGER.error(\"could not parse given xml\", e);\n }\n finally\n {\n releaseBuilder(builder);\n }\n return ret;\n }", "public void readXML() {\n\t try {\n\n\t \t//getting xml file\n\t \t\tFile fXmlFile = new File(\"cards.xml\");\n\t\t\tDocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\n\t\t\tDocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\n\t\t\tDocument doc = dBuilder.parse(fXmlFile);\n\t\t \n\t\t\t//doc.getDocumentElement().normalize(); ???\n\t\t \n\t\t \t//inserting card IDs and Effects into arrays\n\t\t\tNodeList nList = doc.getElementsByTagName(\"card\");\n\t\t\tfor (int i = 0; i < nList.getLength(); i++) {\n\t\t\t\tNode nNode = nList.item(i);\n\t\t\t\tif (nNode.getNodeType() == Node.ELEMENT_NODE) {\n\t\t\t\t\tElement eElement = (Element) nNode;\n\t\t\t\t\tint id = Integer.parseInt(eElement.getAttribute(\"id\"));\n\t\t\t\t\tString effect = eElement.getElementsByTagName(\"effect\").item(0).getTextContent();\n\t\t\t\t\tidarr.add(id);\n\t\t\t\t\teffsarr.add(effect);\n\t\t\t\t}\n\t\t\t}\n\t } catch (Exception e) {\n\t\t\te.printStackTrace();\n\t }\n }", "public static MxCain00300101 parse(String xml, MxReadConfiguration conf) {\n return ((MxCain00300101) com.prowidesoftware.swift.model.mx.MxReadImpl.parse(MxCain00300101 .class, xml, _classes, new com.prowidesoftware.swift.model.mx.MxReadParams(conf)));\n }", "public static Document loadXMLFromString(String xml) {\n\n\t\tDocument document = null;\n\t\ttry {\n\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n\t\t\tDocumentBuilder builder = factory.newDocumentBuilder();\n\t\t\tStringReader sr = new StringReader(xml);\n\t\t\tInputSource is = new InputSource(sr);\n\t\t\tdocument = builder.parse(is);\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn document;\n\t}", "public static Element parse(String xml)\n {\n return parse(new StringReader(xml));\n }", "public void parseXML(String xmlString) {\n DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); \n Document document = null; \n try { \n //DOM parser instance \n DocumentBuilder builder = builderFactory.newDocumentBuilder(); \n \n //parse an XML file into a DOM tree, in this case, change the filepath to xml String \n document = builder.parse(new File(filePath));\n \n //get root element, which is <Airports>\n Element rootElement = document.getDocumentElement(); \n \n //traverse child elements. retrieve all the <Airport>\n NodeList nodes = rootElement.getChildNodes(); \n for (int i=0; i < nodes.getLength(); i++) \n { \n Node node = nodes.item(i); \n if (node.getNodeType() == Node.ELEMENT_NODE) { \n Element airport = (Element) node; \n \n //process child element \n String code = airport.getAttribute(\"Code\");\n String name = airport.getAttribute(\"Name\"); \n \n // child node of airport\n NodeList airportChildren = airport.getChildNodes();\n \n // value of longitude & latitude\n String longitude = airportChildren.item(1).getTextContent();\n String latitude = airportChildren.item(2).getTextContent();\n \n Location location = new Location(longitude, latitude);\n airportList.add(new Airport(code, name, location));\n } \n } \n \n // another approach to traverse all the listNode by tagName \n /*NodeList nodeList = rootElement.getElementsByTagName(\"book\"); \n if(nodeList != null) \n { \n for (int i = 0 ; i < nodeList.getLength(); i++) \n { \n Element element = (Element)nodeList.item(i); \n String id = element.getAttribute(\"id\"); \n } \n }*/\n // add the DOM object to the airportList\n } catch (ParserConfigurationException e) { \n e.printStackTrace(); \n } catch (SAXException e) { \n e.printStackTrace(); \n } catch (IOException e) { \n e.printStackTrace(); \n } \n }", "public void parse() throws ParserConfigurationException, SAXException, IOException, XMLStreamException {\n\t\tString currentElem = null;\n\t\tCard card = null;\n\t\tType type = null;\n\t\tAuthor author = null;\n\n\t\tXMLInputFactory xmlFactory = XMLInputFactory.newInstance();\n\t\tXMLEventReader xmlReader = xmlFactory.createXMLEventReader(new StreamSource(xmlFileName));\n\n\t\twhile (xmlReader.hasNext()) {\n\t\t\tXMLEvent event = xmlReader.nextEvent();\n\n\t\t\tif (event.isCharacters() && event.asCharacters().isWhiteSpace()) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (event.isStartElement()) {\n\t\t\t\tStartElement startElement = event.asStartElement();\n\t\t\t\tcurrentElem = startElement.getName().getLocalPart();\n\n\t\t\t\tif (currentElem.equals(\"OldCards\")) {\n\t\t\t\t\toldCards = new OldCards();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (currentElem.equals(\"Card\")) {\n\t\t\t\t\tcard = new Card();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (currentElem.equals(\"Type\")) {\n\t\t\t\t\ttype = new Type();\n\t\t\t\t\tAttribute attribute = startElement.getAttributeByName(new QName(\"send\"));\n\t\t\t\t\tif (attribute != null) {\n\t\t\t\t\t\ttype.setSend(Boolean.parseBoolean(attribute.getValue()));\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (currentElem.equals(\"Author\")) {\n\t\t\t\t\tauthor = new Author();\n\t\t\t\t\tAttribute attribute = startElement.getAttributeByName(new QName(\"famous\"));\n\t\t\t\t\tif (attribute != null) {\n\t\t\t\t\t\tauthor.setFamous(Boolean.parseBoolean(attribute.getValue()));\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event.isCharacters()) {\n\t\t\t\tCharacters characters = event.asCharacters();\n\n\t\t\t\tif (currentElem.equals(\"Thema\")) {\n\t\t\t\t\tcard.setThema(characters.getData());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (currentElem.equals(\"Type\")) {\n\t\t\t\t\ttype.setType(characters.getData());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (currentElem.equals(\"Country\")) {\n\t\t\t\t\tcard.setCountry(characters.getData());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (currentElem.equals(\"Year\")) {\n\t\t\t\t\tcard.setYear(Integer.parseInt(characters.getData()));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (currentElem.equals(\"Author\")) {\n\t\t\t\t\tauthor.setName(characters.getData());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (currentElem.equals(\"Valuable\")) {\n\t\t\t\t\tcard.setValuable(characters.getData());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event.isEndElement()) {\n\t\t\t\tEndElement endElement = event.asEndElement();\n\t\t\t\tString localName = endElement.getName().getLocalPart();\n\n\t\t\t\tif (localName.equals(\"Card\")) {\n\t\t\t\t\toldCards.getCards().add(card);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (localName.equals(\"Type\")) {\n\t\t\t\t\tcard.setType(type);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (localName.equals(\"Author\")) {\n\t\t\t\t\tcard.getAuthors().add(author);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\txmlReader.close();\n\t}", "public static Object loadObject(String filename) throws XmlParseException, IOException\n {\n return loadObject(new File(filename));\n }", "@Override\n\t\tpublic List<Person> parse(InputStream xml) throws Exception {\n\t\t\tList<Person> list = null;\n\t\t\tPerson p = null;\n\t\t\tXmlPullParser xpp = Xml.newPullParser();\n\t\t\txpp.setInput(xml, \"UTF-8\");\n\t\t\tint eventType = xpp.getEventType();\n\t\t\twhile (eventType != XmlPullParser.END_DOCUMENT) {\n\t\t\t\tswitch (eventType) {\n\n\t\t\t\tcase XmlPullParser.START_DOCUMENT:\n\t\t\t\t\tlist = new ArrayList<Person>();\n\t\t\t\t\tbreak;\n\t\t\t\tcase XmlPullParser.START_TAG:\n\t\t\t\t\tString name = xpp.getName();\n\t\t\t\t\tif (name.equals(\"person\")) {\n\t\t\t\t\t\tp = new Person();\n\t\t\t\t\t} else if (name.equals(\"id\")) {\n\t\t\t\t\t\tString id = xpp.nextText();\n\t\t\t\t\t\tp.setId(Integer.parseInt(id));\n\t\t\t\t\t} else if (name.equals(\"name\")) {\n\t\t\t\t\t\tString pName = xpp.nextText();\n\t\t\t\t\t\tp.setName(pName);\n\t\t\t\t\t} else if (name.equals(\"age\")) {\n\t\t\t\t\t\tString age = xpp.nextText();\n\t\t\t\t\t\tp.setAge(Integer.parseInt(age));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase XmlPullParser.END_TAG:\n\t\t\t\t\tString tagName = xpp.getName();\n\t\t\t\t\tif (tagName.equals(\"person\")) {\n\t\t\t\t\t\tlist.add(p);\n\t\t\t\t\t\tp = null;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\t\t\t\teventType = xpp.next();\n\t\t\t}\n\t\t\treturn list;\n\t\t}", "DataObject loadObject(XMLStreamReader reader) throws XMLStreamException, IllegalStateException;", "public ParseXML() throws XmlPullParserException, IOException\n {\n\t input =\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><Balls version=1.0><ball><name>900 Global Hook! Black </name><brand>900 Global</brand><release_date>05/15/2012</release_date><radius_of_gyration>2.551</radius_of_gyration><differential>0.046</differential><mass_biass_diff>n/a</mass_biass_diff><lane_condition>Medium</lane_condition><finish>Polished</finish><coverstock>Reactive Resin</coverstock><coverstock_name>S43 Pearl Reactive</coverstock_name><factory_finish>n/a</factory_finish><core_type>Symmetric</core_type><core_name>n/a</core_name></ball><ball><name>900 Global Hook! Hybrid</name><brand>900 Global</brand><release_date>05/15/2012</release_date><radius_of_gyration>2.551</radius_of_gyration><differential>0.046</differential><mass_biass_diff>n/a</mass_biass_diff><lane_condition>Medium</lane_condition><finish>Polished</finish><coverstock>Hybrid Reactive</coverstock><coverstock_name>S43 Hybrid Reactive</coverstock_name><factory_finish>n/a</factory_finish><core_type>Symmetric</core_type><core_name>Symmetric (10# has a pancake core)</core_name></ball>\"; \n\t parse();\n }", "private static Document parseXML(InputStream stream) throws Exception {\n DocumentBuilderFactory objDocumentBuilderFactory = null;\n DocumentBuilder objDocumentBuilder = null;\n Document doc = null;\n try {\n objDocumentBuilderFactory = DocumentBuilderFactory.newInstance();\n objDocumentBuilder = objDocumentBuilderFactory.newDocumentBuilder();\n doc = objDocumentBuilder.parse(stream);\n } catch (Exception ex) {\n throw ex;\n }\n return doc;\n }", "public static native JavaScriptObject parseString(String xml) /*-{\n\t\treturn Titanium.XML.parseString(xml);\n\t}-*/;", "public static Object getObjectWithXML(Class<?> c, String xml) throws JAXBException {\n Unmarshaller unmarsh = JAXBContext.newInstance(c).createUnmarshaller();\n return unmarsh.unmarshal(new StringReader(xml.trim()));\n }", "private XMLObject resolve(byte[] xml) {\n\t\tXMLObject parsed = parse(xml);\n\t\tif (parsed != null) {\n\t\t\treturn parsed;\n\t\t}\n\t\tthrow new Saml2Exception(\"Deserialization not supported for given data set\");\n\t}", "private Core loadXMLFromString(String xml)\r\n throws Exception\r\n {\r\n DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder builder = factory.newDocumentBuilder();\r\n Document doc = builder.parse(new InputSource(new StringReader(xml)));\r\n XPathFactory xpathFactory = XPathFactory.newInstance();\r\n XPath xpath = xpathFactory.newXPath();\r\n Integer docno = Integer.valueOf(xpath.evaluate(\"/DOC/DOCNO\", doc));\r\n String title = xpath.evaluate(\"/DOC/TITLE\", doc);\r\n String abstra = xpath.evaluate(\"/DOC/ABSTRACT\", doc);\r\n if(corpus != null){\r\n Map<String,String> map = new HashMap<>();\r\n map.put(title,abstra);\r\n corpus.put(docno,map);\r\n }\r\n return new Core(\r\n docno,\r\n normalisation(eliminateEmptyTerm(token(title))),\r\n normalisation(eliminateEmptyTerm(token(abstra))));\r\n }", "public void readxml() throws JAXBException, FileNotFoundException {\n Player loadplayer = xml_methods.load();\n logger.info(\"player name: \" + loadplayer.getName());\n if (!item.isEmpty()) {\n logger.trace(loadplayer.getitem(0).getName());\n }\n tfName.setText(loadplayer.getName());\n isset = true;\n player = loadplayer;\n\n }", "public Object fromXML(Class klazz, File xmlFile) throws XMLUtilityException {\r\n\r\n\t\tif (!(unmarshaller instanceof JAXBUnmarshaller)){\r\n\t\t\tthrow new XMLUtilityException(\"Invalid method invocation. This method is only valid when the unmarshaller is a JAXBUnmarshaller instance\");\r\n\t\t}\r\n\r\n\t\tObject beanObject = null;\r\n\t\tbeanObject = ((JAXBUnmarshaller)unmarshaller).fromXML(klazz,xmlFile);\r\n\t\treturn beanObject;\r\n\t}", "@Override\n\t\tpublic List<Person> parse(InputStream xml) throws Exception {\n\t\t\tfinal List<Person> list = new ArrayList<Person>();\n\t\t\tSAXParserFactory factory = SAXParserFactory.newInstance();\n\t\t\tjavax.xml.parsers.SAXParser parser = factory.newSAXParser();\n\t\t\tparser.parse(xml, new DefaultHandler() {\n\n\t\t\t\tStringBuilder builder;\n\t\t\t\tPerson t;\n\n\t\t\t\t@Override\n\t\t\t\tpublic void characters(char[] ch, int start, int length)\n\t\t\t\t\t\tthrows SAXException {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.characters(ch, start, length);\n\t\t\t\t\tbuilder.append(ch, start, length);\n\t\t\t\t\tLog.d(TAG, \"ch=\" + builder.toString());\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void endDocument() throws SAXException {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.endDocument();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void endElement(String uri, String localName,\n\t\t\t\t\t\tString qName) throws SAXException {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.endElement(uri, localName, qName);\n\t\t\t\t\tif (localName.equals(\"id\")) {\n\t\t\t\t\t\tt.setId(Integer.parseInt(builder.toString()));\n\t\t\t\t\t} else if (localName.equals(\"name\")) {\n\t\t\t\t\t\tt.setName(builder.toString());\n\t\t\t\t\t} else if (localName.equals(\"age\")) {\n\t\t\t\t\t\tt.setAge(Integer.parseInt(builder.toString()));\n\t\t\t\t\t} else if (localName.equals(\"person\")) {\n\t\t\t\t\t\tlist.add(t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void startDocument() throws SAXException {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.startDocument();\n\t\t\t\t\tbuilder = new StringBuilder();\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void startElement(String uri, String localName,\n\t\t\t\t\t\tString qName, Attributes attributes)\n\t\t\t\t\t\tthrows SAXException {\n\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\tsuper.startElement(uri, localName, qName, attributes);\n\t\t\t\t\tif (localName.equals(\"person\")) {\n\t\t\t\t\t\tt = new Person();\n\t\t\t\t\t}\n\t\t\t\t\tbuilder.setLength(0);\n\t\t\t\t}\n\n\t\t\t});\n\t\t\treturn list;\n\t\t}", "private static <T> T readObjectAsXmlFrom(Reader reader, Class<T> c) throws Exception\n {\n JAXBContext jaxb = JAXBContext.newInstance(c);\n \n XMLStreamReader xmlReader =\n XMLInputFactory.newInstance().createXMLStreamReader(reader);\n \n Unmarshaller xmlInterpreter = jaxb.createUnmarshaller();\n \n return xmlInterpreter.unmarshal(xmlReader, c).getValue();\n }", "public static ExaminationType_type1 parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n ExaminationType_type1 object = null;\n // initialize a hash map to keep values\n java.util.Map attributeMap = new java.util.HashMap();\n java.util.List extraAttributeList = new java.util.ArrayList<org.apache.axiom.om.OMAttribute>();\n \n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n while(!reader.isEndElement()) {\n if (reader.isStartElement() || reader.hasText()){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"ExaminationType_type0\" +\" cannot be null\");\n }\n \n\n java.lang.String content = reader.getElementText();\n \n if (content.indexOf(\":\") > 0) {\n // this seems to be a Qname so find the namespace and send\n prefix = content.substring(0, content.indexOf(\":\"));\n namespaceuri = reader.getNamespaceURI(prefix);\n object = ExaminationType_type1.Factory.fromString(content,namespaceuri);\n } else {\n // this seems to be not a qname send and empty namespace incase of it is\n // check is done in fromString method\n object = ExaminationType_type1.Factory.fromString(content,\"\");\n }\n \n \n } else {\n reader.next();\n } \n } // end of while loop\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static void parseXML(String strXmlContent) {\n\t\tSAXParserFactory spf = SAXParserFactory.newInstance();\r\n\t\ttry {\r\n\t\t\tSAXParser saxParser = spf.newSAXParser();\r\n\t\t\tsaxParser.parse(new ByteArrayInputStream(strXmlContent.getBytes()),\r\n\t\t\t\t\tnew SAXXMLReader());\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "XMLDocument load(XMLStreamReader reader) throws XMLStreamException, IllegalStateException;", "public Object unmarshal (String xmlText) throws Exception {\n\t\treturn unmarshal (xmlText, true); // default is true..\n\t}", "@Override\n public Object parseXmlString(String xmlDoc,TypeXml type) {\n Object object;\n switch (type){\n case USER:\n object = parseXmlStringUser(xmlDoc);\n break;\n case PERSON:\n object = parseXmlStringPerson(xmlDoc);\n break;\n default:\n object = null;\n break;\n }\n return object;\n }", "public Object fromXml(XmlElement xml)\n {\n // TODO: copy the relevant namespaces declared by the parent\n // should that be done by clone?\n return xml == null ? null : xml.clone();\n }", "public InvCatalogImpl readXML(String uriString) {\n\n URI uri;\n try {\n uri = new URI(uriString);\n } catch (URISyntaxException e) {\n InvCatalogImpl cat = new InvCatalogImpl(uriString, null, null);\n cat.appendErrorMessage(\n \"**Fatal: InvCatalogFactory.readXML URISyntaxException on URL (\" + uriString + \") \" + e.getMessage() + \"\\n\",\n true);\n return cat;\n }\n\n /*\n * if (uriString.startsWith(\"file:\")) {\n * String filename = uriString.substring(5);\n * File f = new File(filename);\n * if (f.exists()) {\n * try {\n * return readXML(new FileInputStream(f), uri);\n * \n * } catch (Exception e) {\n * InvCatalogImpl cat = new InvCatalogImpl(uriString, null, null);\n * cat.appendErrorMessage(\"**Fatal: InvCatalogFactory.readXML error (\" +\n * uriString + \") \" + e.getMessage() + \"\\n\", true);\n * }\n * }\n * }\n */\n\n return readXML(uri);\n }", "@Override\n\t\tpublic List<Person> parse(InputStream xml) throws Exception {\n\t\t\tList<Person> list = new ArrayList<Person>();\n\t\t\tDocumentBuilderFactory factory = DocumentBuilderFactory\n\t\t\t\t\t.newInstance();\n\t\t\tDocumentBuilder builder = factory.newDocumentBuilder();\n\t\t\tDocument doc = builder.parse(xml);\n\t\t\tElement rootElement = doc.getDocumentElement();\n\t\t\tNodeList nodes = rootElement.getElementsByTagName(\"person\");\n\t\t\tfor (int i = 0; i < nodes.getLength(); i++) {\n\t\t\t\tPerson p = new Person();\n\t\t\t\tNode node = nodes.item(i);\n\t\t\t\tNodeList properties = node.getChildNodes();\n\t\t\t\tfor (int j = 0; j < properties.getLength(); j++) {\n\t\t\t\t\tNode property = properties.item(j);\n\t\t\t\t\tString nodeName = property.getNodeName();\n\t\t\t\t\tif (nodeName.equals(\"id\")) {\n\t\t\t\t\t\tint id = Integer.parseInt(property.getFirstChild()\n\t\t\t\t\t\t\t\t.getNodeValue());\n\t\t\t\t\t\tp.setId(id);\n\t\t\t\t\t} else if (nodeName.equals(\"name\")) {\n\t\t\t\t\t\tString name = property.getFirstChild().getNodeValue();\n\t\t\t\t\t\tp.setName(name);\n\t\t\t\t\t} else if (nodeName.equals(\"age\")) {\n\t\t\t\t\t\tint age = Integer.parseInt(property.getFirstChild()\n\t\t\t\t\t\t\t\t.getNodeValue());\n\t\t\t\t\t\tp.setAge(age);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlist.add(p);\n\t\t\t}\n\t\t\treturn list;\n\t\t}", "public void readFromXML(XMLStreamReader in) throws XMLStreamException {\n readFromXMLImpl(in);\n }", "@Override\n public Object parseFromXml(String path, TypeXml type) {\n try {\n Object object = new Object();\n switch (type) {\n case PERSON:\n object = parseFromXmlPerson(path);\n break;\n case USER:\n object = parseFormXmlUser(path);\n break;\n default:\n break;\n }\n return object;\n }catch (Exception e){\n AppLogger.getLogger().error(e.getMessage());\n return null;\n }\n }", "public void parse()\n throws ClassNotFoundException, IllegalAccessException,\n\t InstantiationException, IOException, SAXException,\n\t ParserConfigurationException\n {\n\tSAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();\n\txmlReader = saxParser.getXMLReader();\n\txmlReader.setContentHandler(this);\n\txmlReader.setEntityResolver(this);\n\txmlReader.setErrorHandler(this);\n\txmlReader.setDTDHandler(this);\n\txmlReader.parse(xmlSource);\n\t}", "public static GetVehicleBookPage parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetVehicleBookPage object =\n new GetVehicleBookPage();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getVehicleBookPage\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetVehicleBookPage)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setRequestXml(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {\n\t\tDocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();\r\n\t\t\r\n\t\t//Create object of DocumentBuilder using DocumentBuilderFactory - to get the Document object for XML\r\n\t\tDocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();\r\n\t\t\r\n\t\t//Create object of Document by parsing the input XML - to be able to obtain the NodeList for traversal.\r\n\t\tDocument document = builder.parse(\"D://employees.xml\");\r\n\t\t//ClassLoader.getSystemResourceAsStream(\"employees.xml\")\r\n\t\t\r\n\t\t//Create object of NodeList from the Document object - to be able to identify individual nodes (items)\r\n\t\tNodeList nodeList = document.getChildNodes();\r\n\t\t\r\n\t\tList<Employee> empList = new ArrayList<Employee>();\r\n\r\n\t\t//Looping over nodeList\r\n\t\tfor(int i=0;i<nodeList.getLength();i++)\r\n\t\t{\r\n\t\t\t//Picking up a node/item from the list\r\n\t\t\tNode node = nodeList.item(i);\r\n\t\t\t\r\n\t\t\tif(node instanceof Element)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t//emp.id = node.getAttributes().getNamedItem(\"id\").getNodeValue();\r\n\t\t\t\t\r\n\t\t\t\tNodeList internalNodeList = node.getChildNodes();\r\n\t\t\t\t\r\n\t\t\t\tfor(int j=0; j < internalNodeList.getLength(); j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tEmployee emp = new Employee();\r\n\t\t\t\t\t\r\n\t\t\t\t\tNode iNode = internalNodeList.item(j);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(iNode instanceof Element)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tString iNodeText = iNode.getLastChild().getTextContent().trim();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tswitch(iNodeText)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\tcase \"firstName\":\r\n\t\t\t\t\t\t\temp.firstName = iNodeText;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"lastName\":\r\n\t\t\t\t\t\t\temp.lastName = iNodeText;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase \"location\":\r\n\t\t\t\t\t\t\temp.location = iNodeText;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tempList.add(emp);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tfor(Employee emp : empList)\r\n\t\t{\r\n\t\t\tSystem.out.println(emp);\r\n\t\t}\r\n\t}", "@SuppressWarnings(\"unchecked\")\r\n\tpublic static <T> T fromXML(String xml, Class<T> clazz, String alias) {\r\n\t\tif (xml == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"XML string cannot be null\");\r\n\t\t}\r\n\t\tif (clazz == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"Class cannot be null\");\r\n\t\t}\r\n\t\tif (alias == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"Alais cannot be null\");\r\n\t\t}\r\n\t\tXStream xStream = new XStream();\r\n\t\txStream.alias(alias, clazz);\r\n\t\tStringReader reader = new StringReader(xml);\r\n\t\treturn (T) xStream.fromXML(reader);\r\n\t}", "public static ExaminationType_type0 parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n ExaminationType_type0 object = null;\n // initialize a hash map to keep values\n java.util.Map attributeMap = new java.util.HashMap();\n java.util.List extraAttributeList = new java.util.ArrayList<org.apache.axiom.om.OMAttribute>();\n \n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n while(!reader.isEndElement()) {\n if (reader.isStartElement() || reader.hasText()){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"ExaminationType_type0\" +\" cannot be null\");\n }\n \n\n java.lang.String content = reader.getElementText();\n \n if (content.indexOf(\":\") > 0) {\n // this seems to be a Qname so find the namespace and send\n prefix = content.substring(0, content.indexOf(\":\"));\n namespaceuri = reader.getNamespaceURI(prefix);\n object = ExaminationType_type0.Factory.fromString(content,namespaceuri);\n } else {\n // this seems to be not a qname send and empty namespace incase of it is\n // check is done in fromString method\n object = ExaminationType_type0.Factory.fromString(content,\"\");\n }\n \n \n } else {\n reader.next();\n } \n } // end of while loop\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static Staff readFromXml() throws JAXBException {\n JAXBContext jaxbContext = JAXBContext.newInstance(Staff.class);\n Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();\n return (Staff)jaxbUnmarshaller.unmarshal(new File(\"test.xml\"));\n }", "public void readFromXMLImpl(XMLStreamReader in) throws XMLStreamException {\n super.readAttributes(in);\n \n // Remove this when the 0.9.x save hack (in Game.java) is gone.\n ownerId = in.getAttributeValue(null, \"owner\");\n \n messageType = Enum.valueOf(MessageType.class, getAttribute(in, \"messageType\", MessageType.DEFAULT.toString()));\n beenDisplayed = Boolean.parseBoolean(in.getAttributeValue(null, \"hasBeenDisplayed\"));\n sourceId = in.getAttributeValue(null, \"source\");\n displayId = in.getAttributeValue(null, \"display\");\n \n super.readChildren(in);\n }", "@Override\n public void parseXml(Element ele, LoadContext lc) {\n\n }", "public <T> T fromXML(final HierarchicalStreamDriver driver, final String xml)\n throws ClassNotFoundException, ObjectStreamException {\n try {\n return fromXML(driver, new StringReader(xml));\n } catch (final ObjectStreamException e) {\n throw e;\n } catch (final IOException e) {\n throw new StreamException(\"Unexpected IO error from a StringReader\", e);\n }\n }", "XMLStreamReader createXMLStreamReader(DataObject sdo);", "@Override\n\tpublic Object fromXMLString(String arg0) {\n\t\treturn null;\n\t}", "public static GetVehicleInfoPage parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetVehicleInfoPage object =\n new GetVehicleInfoPage();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getVehicleInfoPage\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetVehicleInfoPage)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setRequestXml(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "private PersonDao parseXmlStringPerson(String xmlDoc){\n try {\n SAXParserFactory factory = SAXParserFactory.newInstance();\n SAXParser saxParser = factory.newSAXParser();\n PersonHandler personHandle = new PersonHandler();\n saxParser.parse(new InputSource(new StringReader(xmlDoc)), personHandle);\n return ((ArrayList<PersonDao>)personHandle.getObjects()).get(0);\n } catch (Exception e) {\n AppLogger.getLogger().error(e.getMessage());\n }\n return null;\n }", "public static Document parseXML(String xmlContent) throws BaseException\r\n\t{\r\n\t\tDocument xmlDoc = null;\r\n\t\tif (!StringUtils.isEmpty(xmlContent))\r\n\t\t{\r\n\t\t\txmlDoc = parseXML(new ByteArrayInputStream(xmlContent.getBytes()));\r\n\t\t}\r\n\t\treturn xmlDoc;\r\n\t}", "public <T> T fromXML(final String xml, final TypePermission... permissions)\n throws ClassNotFoundException, ObjectStreamException {\n try {\n return fromXML(new StringReader(xml), permissions);\n } catch (final ObjectStreamException e) {\n throw e;\n } catch (final IOException e) {\n throw new StreamException(\"Unexpected IO error from a StringReader\", e);\n }\n }", "public InvCatalogImpl readXML(URI uri) {\n // get ready for XML parsing\n warnMessages.setLength(0);\n errMessages.setLength(0);\n fatalMessages.setLength(0);\n\n org.jdom2.Document jdomDoc;\n InputStream is = null;\n try {\n jdomDoc = saxBuilder.build(uri.toURL());\n // HttpUriResolver httpUriResolver = HttpUriResolver.newDefaultUriResolver();\n // String s = httpUriResolver.getString( url );\n // //StringReader\n // is = new BufferedInputStream( httpUriResolver.getInputStream( url ), 1000000 );\n // jdomDoc = saxBuilder.build( is );\n } catch (Exception e) {\n InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, null);\n cat.appendErrorMessage(\"**Fatal: InvCatalogFactory.readXML failed\" + \"\\n Exception= \" + e.getClass().getName()\n + \" \" + e.getMessage() + \"\\n fatalMessages= \" + fatalMessages.toString() + \"\\n errMessages= \"\n + errMessages.toString() + \"\\n warnMessages= \" + warnMessages.toString() + \"\\n\", true);\n return cat;\n } finally {\n if (is != null)\n try {\n is.close();\n } catch (IOException e) {\n log.warn(\"Failed to close input stream [\" + uri.toString() + \"].\");\n }\n }\n\n if (fatalMessages.length() > 0) {\n InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, null);\n cat.appendErrorMessage(\n \"**Fatal: InvCatalogFactory.readXML XML Fatal error(s) =\\n\" + fatalMessages.toString() + \"\\n\", true);\n return cat;\n }\n\n return readXML(jdomDoc, uri);\n }", "protected void readFromXMLImpl(XMLStreamReader in)\n throws XMLStreamException {\n aiObjects.clear();\n \n if (!in.getLocalName().equals(getXMLElementTagName())) {\n logger.warning(\"Expected element name, got: \" + in.getLocalName());\n }\n final String nextIDStr = in.getAttributeValue(null, \"nextID\");\n if (nextIDStr != null) {\n nextID = Integer.parseInt(nextIDStr);\n }\n \n String lastTag = \"\";\n while (in.nextTag() != XMLStreamConstants.END_ELEMENT) {\n final String tagName = in.getLocalName();\n final String oid = in.getAttributeValue(null, ID_ATTRIBUTE);\n try {\n if (oid != null && aiObjects.containsKey(oid)) {\n getAIObject(oid).readFromXML(in);\n } else if (tagName.equals(AIUnit.getXMLElementTagName())) {\n new AIUnit(this, in);\n } else if (tagName.equals(AIPlayer.getXMLElementTagName())) {\n Player p = (Player) getGame().getFreeColGameObject(oid);\n if (p != null) {\n if (p.isIndian()) {\n new NativeAIPlayer(this, in);\n } else if (p.isREF()) {\n new REFAIPlayer(this, in);\n } else if (p.isEuropean()) {\n new EuropeanAIPlayer(this, in);\n } else {\n logger.warning(\"Bogus AIPlayer: \" + p);\n in.nextTag();\n }\n }\n } else if (tagName.equals(\"colonialAIPlayer\")) {\n // TODO: remove 0.10.1 compatibility code\n new EuropeanAIPlayer(this, in);\n // end TODO\n } else if (tagName.equals(AIColony.getXMLElementTagName())) {\n new AIColony(this, in);\n } else if (tagName.equals(AIGoods.getXMLElementTagName())) {\n new AIGoods(this, in);\n } else if (tagName.equals(WorkerWish.getXMLElementTagName())) {\n new WorkerWish(this, in);\n } else if (tagName.equals(GoodsWish.getXMLElementTagName())) {\n new GoodsWish(this, in);\n } else if (tagName.equals(TileImprovementPlan.getXMLElementTagName())) {\n new TileImprovementPlan(this, in);\n } else {\n logger.warning(\"Unknown AI-object read: \" + tagName + \"(\" + lastTag + \")\");\n }\n lastTag = in.getLocalName();\n } catch (Exception e) {\n StringWriter sw = new StringWriter();\n e.printStackTrace(new PrintWriter(sw));\n logger.warning(\"Exception while reading an AIObject(\" + tagName\n + \", \" + oid + \"): \" + sw.toString());\n while (!in.getLocalName().equals(tagName) && !in.getLocalName().equals(getXMLElementTagName())) {\n in.nextTag();\n }\n if (!in.getLocalName().equals(getXMLElementTagName())) {\n in.nextTag();\n }\n }\n }\n \n if (!in.getLocalName().equals(getXMLElementTagName())) {\n logger.warning(\"Expected element name (2), got: \" + in.getLocalName());\n }\n \n // This should not be necessary - but just in case:\n findNewObjects(false);\n }", "private void parsePrivate(String xmlString) throws XmlPullParserException,\n IOException\n {\n if (xmlString == null || xmlString.length() == 0)\n return;\n\n XmlPullParserFactory factory = XmlPullParserFactory.newInstance();\n // factory.setNamespaceAware(true);\n XmlPullParser xpp = factory.newPullParser();\n\n xpp.setInput(new StringReader(xmlString));\n int eventType = xpp.getEventType();\n while (eventType != XmlPullParser.END_DOCUMENT)\n {\n if (eventType == XmlPullParser.START_DOCUMENT)\n {\n Log.v(TAG, \"Start document\");\n }\n else if (eventType == XmlPullParser.START_TAG)\n {\n String name = xpp.getName();\n //Log.v(TAG, \"Start tag: \" + name);\n if (name.equalsIgnoreCase(TEMPERATURE))\n {\n String attrValue = readAttributeValue(xpp, \"type\",\n INVALID);\n if (attrValue.equalsIgnoreCase(MAXIMUM))\n readMaxTemperatureValues(xpp);\n else if (attrValue.equalsIgnoreCase(MINIMUM))\n readMinTemperatureValues(xpp);\n }\n else if (name.equalsIgnoreCase(WEATHER))\n {\n readWeatherConditions(xpp);\n }\n else if (name.equalsIgnoreCase(CONDITIONS_ICON))\n {\n readIconLinks(xpp);\n }\n }\n eventType = xpp.next();\n }\n }", "public static GetVehicleAlarmInfoPage parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetVehicleAlarmInfoPage object =\n new GetVehicleAlarmInfoPage();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getVehicleAlarmInfoPage\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetVehicleAlarmInfoPage)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setRequestXml(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public void readXML(Reader inReader)\n\t{\n\t\tXmlUtil util = new XmlUtil();\n\t\tElement root = util.getXml(inReader, \"UTF-8\");\n\t\tpopulate(root);\n\t}", "public static GetVehicleRecordPage parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetVehicleRecordPage object =\n new GetVehicleRecordPage();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getVehicleRecordPage\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetVehicleRecordPage)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setRequestXml(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public interface XMLParser {\n\n String parse();\n}", "public static MxCain00300101 parse(String xml) {\n return ((MxCain00300101) com.prowidesoftware.swift.model.mx.MxReadImpl.parse(MxCain00300101 .class, xml, _classes, new com.prowidesoftware.swift.model.mx.MxReadParams()));\n }", "public void loadConfig(XMLElement xml) {\r\n\r\n }", "public static MxSeev03400211 parse(String xml, MxReadConfiguration conf) {\n return ((MxSeev03400211) com.prowidesoftware.swift.model.mx.MxReadImpl.parse(MxSeev03400211 .class, xml, _classes, new com.prowidesoftware.swift.model.mx.MxReadParams(conf)));\n }", "private GameModel load(String xmlFilePath) throws Exception {\r\n\t\ttry {\r\n\t\t\t// Load Game from XML\r\n\t\t\tJAXBContext context = JAXBContext.newInstance(GameModel.class);\r\n\t\t\tSystem.out.println(\"instance passed \");\r\n\t\t\tUnmarshaller unmarshaller = context.createUnmarshaller();\r\n\t\t\tSystem.out.println(\"marshaller created\");\r\n\t\t\treturn (GameModel) unmarshaller.unmarshal(new File(xmlFilePath));\r\n\r\n\t\t} catch (Exception ex) {\r\n\t\t\t// log the exception, show the error message on UI\r\n\t\t\tSystem.out.println(ex.getMessage());\r\n\t\t\tthrow ex;\r\n\t\t}\r\n\t}", "public static void readXML(){\n try{\n Document doc = getDoc(\"config.xml\");\n Element root = doc.getRootElement();\n\n //Muestra los elementos dentro de la configuracion del xml\n \n System.out.println(\"Color : \" + root.getChildText(\"color\"));\n System.out.println(\"Pattern : \" + root.getChildText(\"pattern\"));\n System.out.println(\"Background : \" + root.getChildText(\"background\"));\n \n\n } catch(Exception e){\n System.out.println(e.getMessage());\n }\n }", "public static android.service.notification.ZenModeConfig readXml(org.xmlpull.v1.XmlPullParser r17) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {\n /*\n r12 = r17.getEventType();\n r14 = 2;\n if (r12 == r14) goto L_0x0009;\n L_0x0007:\n r8 = 0;\n L_0x0008:\n return r8;\n L_0x0009:\n r11 = r17.getName();\n r14 = \"zen\";\n r14 = r14.equals(r11);\n if (r14 != 0) goto L_0x0018;\n L_0x0016:\n r8 = 0;\n goto L_0x0008;\n L_0x0018:\n r8 = new android.service.notification.ZenModeConfig;\n r8.<init>();\n r14 = \"version\";\n r15 = 1;\n r0 = r17;\n r13 = safeInt(r0, r14, r15);\n r2 = new java.util.ArrayList;\n r2.<init>();\n r4 = new java.util.ArrayList;\n r4.<init>();\n L_0x0031:\n r12 = r17.next();\n r14 = 1;\n if (r12 == r14) goto L_0x0184;\n L_0x0038:\n r11 = r17.getName();\n r14 = 3;\n if (r12 != r14) goto L_0x006b;\n L_0x003f:\n r14 = \"zen\";\n r14 = r14.equals(r11);\n if (r14 == 0) goto L_0x006b;\n L_0x0048:\n r14 = r2.isEmpty();\n if (r14 != 0) goto L_0x0008;\n L_0x004e:\n r14 = r2.size();\n r14 = new android.content.ComponentName[r14];\n r14 = r2.toArray(r14);\n r14 = (android.content.ComponentName[]) r14;\n r8.conditionComponents = r14;\n r14 = r4.size();\n r14 = new android.net.Uri[r14];\n r14 = r4.toArray(r14);\n r14 = (android.net.Uri[]) r14;\n r8.conditionIds = r14;\n goto L_0x0008;\n L_0x006b:\n r14 = 2;\n if (r12 != r14) goto L_0x0031;\n L_0x006e:\n r14 = \"allow\";\n r14 = r14.equals(r11);\n if (r14 == 0) goto L_0x00c9;\n L_0x0076:\n r14 = \"calls\";\n r15 = 0;\n r0 = r17;\n r14 = safeBoolean(r0, r14, r15);\n r8.allowCalls = r14;\n r14 = \"messages\";\n r15 = 0;\n r0 = r17;\n r14 = safeBoolean(r0, r14, r15);\n r8.allowMessages = r14;\n r14 = \"events\";\n r15 = 1;\n r0 = r17;\n r14 = safeBoolean(r0, r14, r15);\n r8.allowEvents = r14;\n r14 = \"from\";\n r15 = 0;\n r0 = r17;\n r14 = safeInt(r0, r14, r15);\n r8.allowFrom = r14;\n r14 = r8.allowFrom;\n if (r14 < 0) goto L_0x00ac;\n L_0x00a7:\n r14 = r8.allowFrom;\n r15 = 2;\n if (r14 <= r15) goto L_0x0031;\n L_0x00ac:\n r14 = new java.lang.IndexOutOfBoundsException;\n r15 = new java.lang.StringBuilder;\n r15.<init>();\n r16 = \"bad source in config:\";\n r15 = r15.append(r16);\n r0 = r8.allowFrom;\n r16 = r0;\n r15 = r15.append(r16);\n r15 = r15.toString();\n r14.<init>(r15);\n throw r14;\n L_0x00c9:\n r14 = \"sleep\";\n r14 = r14.equals(r11);\n if (r14 == 0) goto L_0x0142;\n L_0x00d2:\n r14 = 0;\n r15 = \"mode\";\n r0 = r17;\n r7 = r0.getAttributeValue(r14, r15);\n r14 = isValidSleepMode(r7);\n if (r14 == 0) goto L_0x0138;\n L_0x00e2:\n r8.sleepMode = r7;\n r14 = \"none\";\n r15 = 0;\n r0 = r17;\n r14 = safeBoolean(r0, r14, r15);\n r8.sleepNone = r14;\n r14 = \"startHour\";\n r15 = 0;\n r0 = r17;\n r9 = safeInt(r0, r14, r15);\n r14 = \"startMin\";\n r15 = 0;\n r0 = r17;\n r10 = safeInt(r0, r14, r15);\n r14 = \"endHour\";\n r15 = 0;\n r0 = r17;\n r5 = safeInt(r0, r14, r15);\n r14 = \"endMin\";\n r15 = 0;\n r0 = r17;\n r6 = safeInt(r0, r14, r15);\n r14 = isValidHour(r9);\n if (r14 == 0) goto L_0x013a;\n L_0x011c:\n r8.sleepStartHour = r9;\n r14 = isValidMinute(r10);\n if (r14 == 0) goto L_0x013c;\n L_0x0124:\n r8.sleepStartMinute = r10;\n r14 = isValidHour(r5);\n if (r14 == 0) goto L_0x013e;\n L_0x012c:\n r8.sleepEndHour = r5;\n r14 = isValidMinute(r6);\n if (r14 == 0) goto L_0x0140;\n L_0x0134:\n r8.sleepEndMinute = r6;\n goto L_0x0031;\n L_0x0138:\n r7 = 0;\n goto L_0x00e2;\n L_0x013a:\n r9 = 0;\n goto L_0x011c;\n L_0x013c:\n r10 = 0;\n goto L_0x0124;\n L_0x013e:\n r5 = 0;\n goto L_0x012c;\n L_0x0140:\n r6 = 0;\n goto L_0x0134;\n L_0x0142:\n r14 = \"condition\";\n r14 = r14.equals(r11);\n if (r14 == 0) goto L_0x0166;\n L_0x014a:\n r14 = \"component\";\n r0 = r17;\n r1 = safeComponentName(r0, r14);\n r14 = \"id\";\n r0 = r17;\n r3 = safeUri(r0, r14);\n if (r1 == 0) goto L_0x0031;\n L_0x015c:\n if (r3 == 0) goto L_0x0031;\n L_0x015e:\n r2.add(r1);\n r4.add(r3);\n goto L_0x0031;\n L_0x0166:\n r14 = \"exitCondition\";\n r14 = r14.equals(r11);\n if (r14 == 0) goto L_0x0031;\n L_0x016e:\n r14 = readConditionXml(r17);\n r8.exitCondition = r14;\n r14 = r8.exitCondition;\n if (r14 == 0) goto L_0x0031;\n L_0x0178:\n r14 = \"component\";\n r0 = r17;\n r14 = safeComponentName(r0, r14);\n r8.exitConditionComponent = r14;\n goto L_0x0031;\n L_0x0184:\n r14 = new java.lang.IllegalStateException;\n r15 = \"Failed to reach END_DOCUMENT\";\n r14.<init>(r15);\n throw r14;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.service.notification.ZenModeConfig.readXml(org.xmlpull.v1.XmlPullParser):android.service.notification.ZenModeConfig\");\n }", "private void readFromXMLFile(XMLStreamReader reader) throws XMLStreamException {\n while (reader.hasNext())\n {\n int eventType= reader.next();\n switch (eventType){\n case XMLStreamReader.START_ELEMENT:\n String elemName=reader.getLocalName();\n if (elemName.equals(\"student\"))\n {\n try {\n super.save(readStudent(reader));\n } catch (ValidatorException e) {\n e.printStackTrace();\n }\n }\n }\n }\n }", "public static MxAcmt00400101 parse(String xml, MxReadConfiguration conf) {\n return ((MxAcmt00400101) com.prowidesoftware.swift.model.mx.MxReadImpl.parse(MxAcmt00400101 .class, xml, _classes, new com.prowidesoftware.swift.model.mx.MxReadParams(conf)));\n }", "public ConstituencyResult returnXmlFileAsPojo(String xmlAsString) {\n ObjectMapper xmlMapper = new XmlMapper();\n\n try {\n //feed the xml file as a string and the constituency result object we want in.\n List<ConstituencyResult> constituencyResult = xmlMapper.readValue(xmlAsString, new TypeReference<List<ConstituencyResult>>() {\n });\n\n //return the object\n return constituencyResult.get(0);\n\n } catch (IOException e) {\n //return empty\n return new ConstituencyResult();\n }\n\n\n }", "public static MxAuth05300101 parse(String xml, MxReadConfiguration conf) {\n return ((MxAuth05300101) com.prowidesoftware.swift.model.mx.MxReadImpl.parse(MxAuth05300101 .class, xml, _classes, new com.prowidesoftware.swift.model.mx.MxReadParams(conf)));\n }", "abstract org.apache.xmlbeans.XmlObject getXmlObject();", "public static Hello parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n Hello object =\n new Hello();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"hello\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (Hello)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://ws.sample\",\"param0\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setParam0(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static Fact parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {\r\n Fact object =\r\n new Fact();\r\n\r\n int event;\r\n java.lang.String nillableValue = null;\r\n java.lang.String prefix = \"\";\r\n java.lang.String namespaceuri = \"\";\r\n try {\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n\r\n\r\n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"type\") != null) {\r\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\r\n \"type\");\r\n if (fullTypeName != null) {\r\n java.lang.String nsPrefix = null;\r\n if (fullTypeName.indexOf(\":\") > -1) {\r\n nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(\":\"));\r\n }\r\n nsPrefix = nsPrefix == null ? \"\" : nsPrefix;\r\n\r\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\") + 1);\r\n\r\n if (!\"Fact\".equals(type)) {\r\n //find namespace for the prefix\r\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\r\n return (Fact) ExtensionMapper.getTypeObject(\r\n nsUri, type, reader);\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n\r\n // Note all attributes that were handled. Used to differ normal attributes\r\n // from anyAttributes.\r\n java.util.List handledAttributes = new java.util.ArrayList();\r\n\r\n\r\n reader.next();\r\n\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n\r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\", \"attributes\").equals(reader.getName())) {\r\n\r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"nil\");\r\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)) {\r\n object.setAttributes(null);\r\n reader.next();\r\n\r\n reader.next();\r\n\r\n } else {\r\n\r\n object.setAttributes(FactAttributes.Factory.parse(reader));\r\n\r\n reader.next();\r\n }\r\n } // End of if for expected property start element\r\n\r\n else {\r\n\r\n }\r\n\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n\r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\", \"identifier\").equals(reader.getName())) {\r\n\r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"nil\");\r\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)) {\r\n object.setIdentifier(null);\r\n reader.next();\r\n\r\n reader.next();\r\n\r\n } else {\r\n\r\n object.setIdentifier(FactIdentifier.Factory.parse(reader));\r\n\r\n reader.next();\r\n }\r\n } // End of if for expected property start element\r\n\r\n else {\r\n\r\n }\r\n\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n\r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\", \"name\").equals(reader.getName())) {\r\n\r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"nil\");\r\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)) {\r\n\r\n java.lang.String content = reader.getElementText();\r\n\r\n object.setName(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\r\n\r\n } else {\r\n\r\n\r\n reader.getElementText(); // throw away text nodes if any.\r\n }\r\n\r\n reader.next();\r\n\r\n } // End of if for expected property start element\r\n\r\n else {\r\n\r\n }\r\n\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n\r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\", \"source\").equals(reader.getName())) {\r\n\r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\", \"nil\");\r\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)) {\r\n\r\n java.lang.String content = reader.getElementText();\r\n\r\n object.setSource(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\r\n\r\n } else {\r\n\r\n\r\n reader.getElementText(); // throw away text nodes if any.\r\n }\r\n\r\n reader.next();\r\n\r\n } // End of if for expected property start element\r\n\r\n else {\r\n\r\n }\r\n\r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n\r\n if (reader.isStartElement())\r\n // A start element we are not expecting indicates a trailing invalid property\r\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\r\n\r\n\r\n } catch (javax.xml.stream.XMLStreamException e) {\r\n throw new java.lang.Exception(e);\r\n }\r\n\r\n return object;\r\n }", "@Test\n\tpublic void testTextFromXml()\n\t{\n\t\tString xml = \"<text val=\\\"Steve Unger Smells\\\" />\";\t\t\n\t\tDocument doc = XMLUtil.parse(xml);\n\t\tElement element = doc.getDocumentElement();\n\t\tText text = this.parser.fromXML(element);\n\t\t\n\t\tassertEquals(\"Steve Unger Smells\",text.getText());\n\t}", "abstract Object getXMLProperty(XMLName name);", "public void testXmlReader() throws Exception {\n File file = new File(\"src/test/resources/reader/sample.xml\");\n final URL testdata = file.toURI().toURL();\n reader.parse(testdata, creator);\n assertEquals(\"Did not create expected number of nodes\", 1, creator.size());\n }", "public static GetDirectAreaInfo parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetDirectAreaInfo object =\n new GetDirectAreaInfo();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getDirectAreaInfo\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetDirectAreaInfo)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n object.setRequestXml(null);\n reader.next();\n \n reader.next();\n \n }else{\n \n object.setRequestXml(org.apache.axis2.databinding.types.soapencoding.String.Factory.parse(reader));\n \n reader.next();\n }\n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public void parseXmlFile(String fileName){\n\t\t//get the factory\n\t\tDocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n\t\t\n\t\ttry {\n\t\t\t//Using factory get an instance of document builder\n\t\t\tDocumentBuilder db = dbf.newDocumentBuilder();\n\t\t\t\n\t\t\t//parse using builder to get DOM representation of the XML file\n\t\t\tdoc = db.parse(fileName);\n\t\t} catch(ParserConfigurationException pce) {\n\t\t\tpce.printStackTrace();\n\t\t} catch(SAXException se) {\n\t\t\tSystem.err.println(\"Malformed XML: Make sure to provide a valid XML document.\");\n\t\t} catch(IOException ioe) {\n\t\t\tSystem.err.println(\"File not found: Path to a valid XML file has to be specified.\" );\n\t\t}\n\t}", "@Override\n\tpublic void parseXML(Element root) throws Exception {\n\t\t\n\t}", "public <T> T fromXML(final HierarchicalStreamDriver driver, final String xml, final TypePermission... permissions)\n throws ClassNotFoundException, ObjectStreamException {\n try {\n return fromXML(driver, new StringReader(xml), permissions);\n } catch (final ObjectStreamException e) {\n throw e;\n } catch (final IOException e) {\n throw new StreamException(\"Unexpected IO error from a StringReader\", e);\n }\n }", "public static User parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\r\n User object =\r\n new User();\r\n\r\n int event;\r\n java.lang.String nillableValue = null;\r\n java.lang.String prefix =\"\";\r\n java.lang.String namespaceuri =\"\";\r\n try {\r\n \r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n\r\n \r\n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\r\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\r\n \"type\");\r\n if (fullTypeName!=null){\r\n java.lang.String nsPrefix = null;\r\n if (fullTypeName.indexOf(\":\") > -1){\r\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\r\n }\r\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\r\n\r\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\r\n \r\n if (!\"User\".equals(type)){\r\n //find namespace for the prefix\r\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\r\n return (User)ExtensionMapper.getTypeObject(\r\n nsUri,type,reader);\r\n }\r\n \r\n\r\n }\r\n \r\n\r\n }\r\n\r\n \r\n\r\n \r\n // Note all attributes that were handled. Used to differ normal attributes\r\n // from anyAttributes.\r\n java.util.Vector handledAttributes = new java.util.Vector();\r\n \r\n\r\n \r\n \r\n reader.next();\r\n \r\n \r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n \r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://registry/xsd\",\"id\").equals(reader.getName())){\r\n \r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\r\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\r\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"id\" +\" cannot be null\");\r\n }\r\n \r\n\r\n java.lang.String content = reader.getElementText();\r\n \r\n object.setId(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(content));\r\n \r\n reader.next();\r\n \r\n } // End of if for expected property start element\r\n \r\n else {\r\n \r\n object.setId(java.lang.Integer.MIN_VALUE);\r\n \r\n }\r\n \r\n \r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n \r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://registry/xsd\",\"ip\").equals(reader.getName())){\r\n \r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\r\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\r\n \r\n\r\n java.lang.String content = reader.getElementText();\r\n \r\n object.setIp(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\r\n \r\n } else {\r\n \r\n \r\n reader.getElementText(); // throw away text nodes if any.\r\n }\r\n \r\n reader.next();\r\n \r\n } // End of if for expected property start element\r\n \r\n else {\r\n \r\n }\r\n \r\n \r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n \r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://registry/xsd\",\"name\").equals(reader.getName())){\r\n \r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\r\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\r\n \r\n\r\n java.lang.String content = reader.getElementText();\r\n \r\n object.setName(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\r\n \r\n } else {\r\n \r\n \r\n reader.getElementText(); // throw away text nodes if any.\r\n }\r\n \r\n reader.next();\r\n \r\n } // End of if for expected property start element\r\n \r\n else {\r\n \r\n }\r\n \r\n \r\n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\r\n \r\n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://registry/xsd\",\"port\").equals(reader.getName())){\r\n \r\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\r\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\r\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"port\" +\" cannot be null\");\r\n }\r\n \r\n\r\n java.lang.String content = reader.getElementText();\r\n \r\n object.setPort(\r\n org.apache.axis2.databinding.utils.ConverterUtil.convertToInt(content));\r\n \r\n reader.next();\r\n \r\n } // End of if for expected property start element\r\n \r\n else {\r\n \r\n object.setPort(java.lang.Integer.MIN_VALUE);\r\n \r\n }\r\n \r\n while (!reader.isStartElement() && !reader.isEndElement())\r\n reader.next();\r\n \r\n if (reader.isStartElement())\r\n // A start element we are not expecting indicates a trailing invalid property\r\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\r\n \r\n\r\n\r\n\r\n } catch (javax.xml.stream.XMLStreamException e) {\r\n throw new java.lang.Exception(e);\r\n }\r\n\r\n return object;\r\n }", "public static String parse(javax.xml.stream.XMLStreamReader reader)\n throws java.lang.Exception {\n String object = new String();\n\n int event;\n javax.xml.namespace.QName currentQName = null;\n java.lang.String nillableValue = null;\n java.lang.String prefix = \"\";\n java.lang.String namespaceuri = \"\";\n\n try {\n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n currentQName = reader.getName();\n\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"nil\");\n\n if (\"true\".equals(nillableValue) ||\n \"1\".equals(nillableValue)) {\n // Skip the element and report the null value. It cannot have subelements.\n while (!reader.isEndElement())\n reader.next();\n\n return object;\n }\n\n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n\n while (!reader.isEndElement()) {\n if (reader.isStartElement()) {\n if (reader.isStartElement() &&\n new javax.xml.namespace.QName(\n \"http://schemas.microsoft.com/2003/10/Serialization/\",\n \"string\").equals(reader.getName())) {\n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"nil\");\n\n if (!\"true\".equals(nillableValue) &&\n !\"1\".equals(nillableValue)) {\n java.lang.String content = reader.getElementText();\n\n object.setString(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(\n content));\n } else {\n reader.getElementText(); // throw away text nodes if any.\n }\n } // End of if for expected property start element\n\n else {\n // 3 - A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\n \"Unexpected subelement \" +\n reader.getName());\n }\n } else {\n reader.next();\n }\n } // end of while loop\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static Document loadXMLFrom(String xml) throws Exception {\n\t\tSource source = new StreamSource(new StringReader(xml));\n\t\tDOMResult result = new DOMResult();\n\t\tTransformerFactory.newInstance().newTransformer().transform(source, result);\n\t\treturn (Document) result.getNode();\n\t}", "public SCMLProject load(String xml)\n\t{\n\t\tXmlReader reader = new XmlReader();\n\t\treturn load(reader.parse(xml));\n\t}", "public static RadiologyReport parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n RadiologyReport object =\n new RadiologyReport();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"RadiologyReport\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (RadiologyReport)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"PatientID\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"PatientID\" +\" cannot be null\");\n }\n \n\n java.lang.String content = reader.getElementText();\n \n object.setPatientID(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n reader.next();\n \n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"RadiologyOrderID\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"RadiologyOrderID\" +\" cannot be null\");\n }\n \n\n java.lang.String content = reader.getElementText();\n \n object.setRadiologyOrderID(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n reader.next();\n \n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"DateOfExamination\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"DateOfExamination\" +\" cannot be null\");\n }\n \n\n java.lang.String content = reader.getElementText();\n \n object.setDateOfExamination(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(content));\n \n reader.next();\n \n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"ReportText\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n throw new org.apache.axis2.databinding.ADBException(\"The element: \"+\"ReportText\" +\" cannot be null\");\n }\n \n\n java.lang.String content = reader.getElementText();\n \n object.setReportText(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n reader.next();\n \n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static GetRoadwayPage parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetRoadwayPage object =\n new GetRoadwayPage();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getRoadwayPage\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetRoadwayPage)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setRequestXml(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public ArrayList<Airport> loadXMLFromString(String xml) throws Exception\n\t\t\t{\n\t\t\t DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n\t\t\t DocumentBuilder builder = factory.newDocumentBuilder();\n\t\t\t InputSource is = new InputSource(new StringReader(xml));\n\t\t\t Document airports = builder.parse(is);\n\t\t\t \n\t\t\t //Airport oneAirport = new Airport();\n\t\t\t ArrayList<Airport> allAirports = new ArrayList<Airport>();\n\t\t\t \n\t\t\t NodeList airportlist = airports.getElementsByTagName(\"Airport\");\n\t\t\t \n\t\t\t for(int i=0; i<airportlist.getLength(); i++){\n\t\t\t Airport oneAirport = new Airport();\n\t Element airport=(Element)airportlist.item(i);\n\t /*parse attributes*/\n\t\t\t oneAirport.setCode(airport.getAttribute(\"Code\"));\n\t\t\t oneAirport.setName(airport.getAttribute(\"Name\"));\n\t\t\t /*parse child nodes*/\n\t\t\t oneAirport.setLatitude(Double.parseDouble(airport.getElementsByTagName(\"Latitude\").item(0).getTextContent()));\n\t\t\t oneAirport.setLongitude(Double.parseDouble(airport.getElementsByTagName(\"Longitude\").item(0).getTextContent()));\n\t\t\t allAirports.add(oneAirport);\n\t\t }\n\t\t\t \n\t\t\t return allAirports;\n\t\t\t}", "public static GetVehicleBookPageResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetVehicleBookPageResponse object =\n new GetVehicleBookPageResponse();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getVehicleBookPageResponse\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetVehicleBookPageResponse)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"return\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n object.set_return(null);\n reader.next();\n \n reader.next();\n \n }else{\n \n object.set_return(WsPmsResult.Factory.parse(reader));\n \n reader.next();\n }\n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static HelloAuthenticatedWithEntitlements parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n HelloAuthenticatedWithEntitlements object =\n new HelloAuthenticatedWithEntitlements();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"helloAuthenticatedWithEntitlements\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (HelloAuthenticatedWithEntitlements)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://ws.sample\",\"param0\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setParam0(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "private static Document initializeXML(String filePath) throws Exception {\n\t\ttry {\n\t\t\tlogger.info(\"Initializing the xml file :\" + filePath);\n\t\t\txmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(filePath));\n\t\t\txmlDocument.getDocumentElement().normalize();\n\t\t\treturn xmlDocument;\n\t\t} catch (Exception e) {\n\n\t\t\tlogger.error(\"Error while reading from XML. File Path : \" + filePath + \" \\n\" + e.getMessage());\n\t\t\tthrow (new Exception(e.getMessage()));\n\n\t\t}\n\t}", "public Map<Object, Object> parseXML(String xmlString) {\n try {\n DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\n Document doc = dBuilder.parse(new ByteArrayInputStream(xmlString\n .getBytes()));\n doc.getDocumentElement().normalize();\n NodeList resultNode = doc.getChildNodes();\n HashMap<Object, Object> result = new HashMap<Object, Object>();\n XmlParser.MyNodeList tempNodeList = new XmlParser.MyNodeList();\n String emptyNodeName = null, emptyNodeValue = null;\n\n for (int index = 0; index < resultNode.getLength(); index++) {\n Node tempNode = resultNode.item(index);\n if (tempNode.getNodeType() == Node.ELEMENT_NODE) {\n tempNodeList.addNode(tempNode);\n }\n emptyNodeName = tempNode.getNodeName();\n emptyNodeValue = tempNode.getNodeValue();\n }\n\n if (tempNodeList.getLength() == 0 && emptyNodeName != null\n && emptyNodeValue != null) {\n result.put(emptyNodeName, emptyNodeValue);\n return result;\n }\n\n this.parseXMLNode(tempNodeList, result);\n return result;\n } catch (Exception ex) {\n logger.error(ex.getMessage(), ex);\n return null;\n }\n }", "public static GetDownLoadCard parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetDownLoadCard object =\n new GetDownLoadCard();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getDownLoadCard\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetDownLoadCard)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"\",\"requestXml\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n object.setRequestXml(null);\n reader.next();\n \n reader.next();\n \n }else{\n \n object.setRequestXml(org.apache.axis2.databinding.types.soapencoding.String.Factory.parse(reader));\n \n reader.next();\n }\n } // End of if for expected property start element\n \n else{\n // A start element we are not expecting indicates an invalid parameter was passed\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static HelloAuthenticatedWithEntitlementPrecheck parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n HelloAuthenticatedWithEntitlementPrecheck object =\n new HelloAuthenticatedWithEntitlementPrecheck();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"helloAuthenticatedWithEntitlementPrecheck\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (HelloAuthenticatedWithEntitlementPrecheck)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://ws.sample\",\"param0\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (!\"true\".equals(nillableValue) && !\"1\".equals(nillableValue)){\n \n java.lang.String content = reader.getElementText();\n \n object.setParam0(\n org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));\n \n } else {\n \n \n reader.getElementText(); // throw away text nodes if any.\n }\n \n reader.next();\n \n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }", "public static GetVehicleInfoPageResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{\n GetVehicleInfoPageResponse object =\n new GetVehicleInfoPageResponse();\n\n int event;\n java.lang.String nillableValue = null;\n java.lang.String prefix =\"\";\n java.lang.String namespaceuri =\"\";\n try {\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n\n \n if (reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"type\")!=null){\n java.lang.String fullTypeName = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\n \"type\");\n if (fullTypeName!=null){\n java.lang.String nsPrefix = null;\n if (fullTypeName.indexOf(\":\") > -1){\n nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(\":\"));\n }\n nsPrefix = nsPrefix==null?\"\":nsPrefix;\n\n java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(\":\")+1);\n \n if (!\"getVehicleInfoPageResponse\".equals(type)){\n //find namespace for the prefix\n java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);\n return (GetVehicleInfoPageResponse)ExtensionMapper.getTypeObject(\n nsUri,type,reader);\n }\n \n\n }\n \n\n }\n\n \n\n \n // Note all attributes that were handled. Used to differ normal attributes\n // from anyAttributes.\n java.util.Vector handledAttributes = new java.util.Vector();\n \n\n \n \n reader.next();\n \n \n while (!reader.isStartElement() && !reader.isEndElement()) reader.next();\n \n if (reader.isStartElement() && new javax.xml.namespace.QName(\"http://impl.thirdsdk.api.pms.cms.hikvision.com\",\"return\").equals(reader.getName())){\n \n nillableValue = reader.getAttributeValue(\"http://www.w3.org/2001/XMLSchema-instance\",\"nil\");\n if (\"true\".equals(nillableValue) || \"1\".equals(nillableValue)){\n object.set_return(null);\n reader.next();\n \n reader.next();\n \n }else{\n \n object.set_return(WsPmsResult.Factory.parse(reader));\n \n reader.next();\n }\n } // End of if for expected property start element\n \n else {\n \n }\n \n while (!reader.isStartElement() && !reader.isEndElement())\n reader.next();\n \n if (reader.isStartElement())\n // A start element we are not expecting indicates a trailing invalid property\n throw new org.apache.axis2.databinding.ADBException(\"Unexpected subelement \" + reader.getLocalName());\n \n\n\n\n } catch (javax.xml.stream.XMLStreamException e) {\n throw new java.lang.Exception(e);\n }\n\n return object;\n }" ]
[ "0.68273723", "0.670118", "0.6559582", "0.64295214", "0.63820726", "0.6348522", "0.6344613", "0.6323239", "0.6308286", "0.6168632", "0.6150282", "0.6042915", "0.60363364", "0.6021233", "0.5985197", "0.5978715", "0.5974074", "0.59519297", "0.59381205", "0.59323287", "0.59084535", "0.5898428", "0.58536714", "0.5845223", "0.5837229", "0.58370215", "0.58212286", "0.58151865", "0.58117294", "0.5802435", "0.5757538", "0.57463247", "0.57366973", "0.5725125", "0.57240057", "0.5722393", "0.5719859", "0.57189655", "0.5709232", "0.5708673", "0.5701036", "0.5685584", "0.56854856", "0.56744885", "0.5655685", "0.5650075", "0.5648311", "0.56481194", "0.5646227", "0.563907", "0.56332946", "0.56290364", "0.5628954", "0.56220007", "0.5617392", "0.56142133", "0.5611117", "0.5608432", "0.5596177", "0.55947864", "0.55839384", "0.5578314", "0.5573003", "0.5572043", "0.5570719", "0.5561729", "0.5538546", "0.55332017", "0.55301565", "0.5524832", "0.5520408", "0.5513611", "0.55095315", "0.5505272", "0.54967254", "0.54921293", "0.54917693", "0.5483706", "0.548317", "0.54809284", "0.5473389", "0.54544246", "0.54435635", "0.5439284", "0.5433818", "0.543264", "0.5425014", "0.5423973", "0.5420737", "0.5405193", "0.5397541", "0.5395833", "0.53921777", "0.53905135", "0.5387378", "0.5384625", "0.5383644", "0.53795666", "0.53740704", "0.53689677" ]
0.57603276
30
Title: writeXML Description: Creates XML from Object instance
public org.dom4j.Element writeXML() throws Exception { return writeXML(sObjName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract String toXML();", "public abstract String toXML();", "public abstract String toXML();", "private void jaxbObjectToXML(Object object, Writer outputWriter) throws JAXBException {\r\n \r\n JAXBContext context = JAXBContext.newInstance(object.getClass());\r\n Marshaller marshaller = context.createMarshaller();\r\n \r\n // for pretty-print XML in JAXB\r\n marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);\r\n // Marshaller.JAXB_ENCODING exemplo: \"ISO-8859-1\" apenas para referência\r\n marshaller.setProperty(Marshaller.JAXB_ENCODING, CHAR_ENCODING);\r\n \r\n // write to System.out for debugging (TODO: REMOVE THIS LINE IN THE FUTURE)\r\n //marshaller.marshal(object, System.out);\r\n \r\n // write to file\r\n marshaller.marshal(object, outputWriter);\r\n \r\n }", "void writeObj(MyAllTypesFirst myFirst, StrategyI xmlStrat);", "Element toXML();", "private static void writeAsXml(Object o, Writer writer) throws Exception\n {\n JAXBContext jaxb = JAXBContext.newInstance(o.getClass());\n \n Marshaller xmlConverter = jaxb.createMarshaller();\n xmlConverter.setProperty(\"jaxb.formatted.output\", true);\n xmlConverter.marshal(o, writer);\n }", "protected abstract void toXml(PrintWriter result);", "public String exportXML() {\n\n\t\tXStream xstream = new XStream();\n\t\txstream.setMode(XStream.NO_REFERENCES);\n\n\t\treturn xstream.toXML(this);\n\t}", "void writeObj(MyAllTypesSecond aRecord, StrategyI xmlStrat);", "public String toXML() {\n StringWriter stringWriter = new StringWriter();\n PrintWriter printWriter = new PrintWriter(stringWriter, true);\n toXML(printWriter);\n return stringWriter.toString();\n }", "public abstract void writeToXml(T o, XmlSerializer serializer, Context context)\n throws IOException;", "void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException;", "public void writeXML(OutputStream stream) throws IOException {\n\t\tPrintWriter out = new PrintWriter(stream);\n\t\tout.println(\"<?xml version=\\\"1.0\\\"?>\");\n\t\tout.println(\"<VLDocking version=\\\"2.1\\\">\");\n\t\tfor(int i = 0; i < desktops.size(); i++) {\n\t\t\tWSDesktop desktop = (WSDesktop) desktops.get(i);\n\t\t\tdesktop.writeDesktopNode(out);\n\t\t}\n\t\tout.println(\"</VLDocking>\");\n\n\t\tout.flush();\n\t}", "@Override\n\tpublic void write() {\n\t\tSystem.out.println(\"使用xml方式存储\");\n\t}", "public abstract StringBuffer toXML();", "public abstract StringBuffer toXML ();", "abstract org.apache.xmlbeans.XmlObject getXmlObject();", "public void writeXML(OutputStream stream) throws IOException {\n\t\tPrintWriter out = new PrintWriter(stream);\n\t\tout.println(\"<?xml version=\\\"1.0\\\"?>\");\n\t\tout.println(\"<VLToolBars version=\\\"1.0\\\">\");\n\t\txmlWriteContainer(out);\n\n\t\tout.println(\"</VLToolBars>\");\n\t\tout.flush();\n\t}", "public String toXML(Object beanObject) throws XMLUtilityException {\r\n\t\tStringWriter strWriter = new StringWriter();\r\n\t\ttoXML(beanObject, strWriter);\r\n\t\treturn strWriter.toString();\r\n\t}", "@Override\n public void toXml(XmlContext xc) {\n\n }", "public void convertObjectToXML() throws TransformerException{\r\n\t\tDocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();\r\n\t\ttry {\r\n\t\t\tDocumentBuilder docBuilder = docFactory.newDocumentBuilder();\r\n\r\n\t\t\t// root elements\r\n\t\t\tDocument doc = docBuilder.newDocument();\r\n\t\t\tElement fileElement = doc.createElement(\"TextFile\");\r\n\t\t\tdoc.appendChild(fileElement);\r\n\r\n\t\t\t// set attribute to file element\r\n\t\t\tAttr attr = doc.createAttribute(\"filename\");\r\n\t\t\tattr.setValue(this.fileName);\r\n\t\t\tfileElement.setAttributeNode(attr);\r\n\t\t\t\r\n\t\t\t//Tagged for paragraphs,sentence,word and punctuation\r\n\r\n\t\t\tfor (Paragraph paragraph : paragraphs) { // for each paragraph\r\n\r\n\t\t\t\tElement paragraphElement = doc.createElement(paragraph.getXMLTag());\r\n\t\t\t\tfileElement.appendChild(paragraphElement);\r\n\t\t\t\t//System.out.println(\"PARAGRAPH:\"+paragraph.getSentences().size());\r\n\t\t\t\tfor (Sentence sentence : paragraph.getSentences()) { // for each sentence\r\n\t\t\t\t\tElement sentenceElement = doc.createElement(sentence.getXMLTag());\r\n\t\t\t\t\tparagraphElement.appendChild(sentenceElement);\r\n\t\t\t\t\t//System.out.println(\"Sentence:\"+sentence.getSentencesItems().size());\r\n\t\t\t\t\tfor (Items sentenceItem : sentence.getSentencesItems()) { // for each sentence item\r\n\t\t\t\t\t\tif (sentenceItem instanceof Word) {\r\n\t\t\t\t\t\t\tWord word = (Word)sentenceItem;\r\n\t\t\t\t\t\t\tElement wordElement = doc.createElement(word.getXMLTag());\r\n\t\t\t\t\t\t\twordElement.appendChild(doc.createTextNode(word.getWord()));\r\n\t\t\t\t\t\t\tsentenceElement.appendChild(wordElement); //output text for each word\r\n\t\t\t\t\t\t\t//System.out.println(\"Word:\"+word.getWord());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if (sentenceItem instanceof Punctuation) {\r\n\t\t\t\t\t\t\tPunctuation punctuation = (Punctuation)sentenceItem;\r\n\t\t\t\t\t\t\tElement punctuationElement = doc.createElement(punctuation.getXMLTag());\r\n\t\t\t\t\t\t\tpunctuationElement.appendChild(doc.createTextNode(punctuation.getPunctuation()));\r\n\t\t\t\t\t\t\tsentenceElement.appendChild(punctuationElement); //output text for each punctuation\r\n\t\t\t\t\t\t\t//System.out.println(\"Punctuation:\"+punctuation.getPunctuation());\r\n\t\t\t\t\t\t}\t\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// write the content into xml file\r\n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance();\r\n\t\t\tTransformer transformer = transformerFactory.newTransformer();\r\n\t\t\tDOMSource source = new DOMSource(doc);\r\n\r\n\t\t\t//System.out.println(fileName.lastIndexOf(\"/\"));\r\n\t\t\tStreamResult result = new StreamResult(new File(\"output_\"+fileName.substring(fileName.lastIndexOf(\"/\")+1, fileName.length()-4)+\".xml\"));\r\n\t\t\ttransformer.transform(source, result);\r\n\r\n\t\t\tSystem.out.println(\"File: \"+\"output_\"+fileName.substring(fileName.lastIndexOf(\"/\")+1, fileName.length()-4)+\".xml\"+\" saved!\");\r\n\r\n\t\t}\r\n\t\tcatch (ParserConfigurationException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "public Document saveAsXML() {\n\tDocument xmldoc= new DocumentImpl();\n\tElement root = createFeaturesElement(xmldoc);\n\txmldoc.appendChild(root);\n\treturn xmldoc;\n }", "protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n // Start element:\n out.writeStartElement(getXMLElementTagName());\n\n out.writeAttribute(\"id\", getId());\n out.writeAttribute(\"accelerator\", getKeyStrokeText(getAccelerator()));\n\n out.writeEndElement();\n }", "ObjectElement createObjectElement();", "public String generateXML() \n { \n \n String xml = new String();\n \n String nodetype = new String();\n if (type.equals(\"internal\")){\n nodetype = \"INTERNAL\"; //change this for change in XML node name\n }\n else {\n nodetype = \"LEAF\"; //change this for change in XML node name\n }\n \n xml = \"<\" + nodetype;\n if (!name.equals(\"\")){\n xml = xml + \" name = \\\"\" + name + \"\\\"\";\n }\n if (length >0){\n xml = xml + \" length = \\\"\" + length + \"\\\"\";\n }\n //Section below tests tree size and depths\n // if (level > 0){\n // xml = xml + \" level = \\\"\" + level + \"\\\"\";\n // }\n //if (depth > 0){\n // xml = xml + \" depth = \\\"\" + depth + \"\\\"\";\n //}\n //if (newicklength > 0){\n // xml = xml + \" newicklength = \\\"\" + newicklength + \"\\\"\";\n //}\n // if (treesize > 0){\n // xml = xml + \" treesize = \\\"\" + treesize + \"\\\"\";\n //}\n //if (startxcoord >= 0){\n // xml = xml + \" startx = \\\"\" + startxcoord + \"\\\"\";\n //}\n //if (endxcoord >= 0){\n // xml = xml + \" endx = \\\"\" + endxcoord + \"\\\"\";\n //}\n //Test section done\n xml = xml + \">\";\n \n if (!children.isEmpty()){ //if there are children in this node's arraylist\n Iterator it = children.iterator();\n while(it.hasNext()){\n Node child = (Node) it.next();\n xml = xml + child.generateXML(); //The recursive coolness happens here!\n }\n }\n xml = xml + \"</\" + nodetype + \">\";\n \n return xml;\n }", "private String toXML(){\n\tString buffer = \"<xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\">\\n\";\n\tfor(Room[] r : rooms)\n\t for(Room s : r)\n\t\tif(s != null)\n\t\t buffer += s.toXML();\n\tbuffer += \"</xml>\";\n\treturn buffer;\n }", "void toXml(OutputStream out, boolean format) throws IOException;", "public void writeXML() throws IOException {\n OutputFormat format = OutputFormat.createPrettyPrint();//th format of xml file\n XMLWriter xmlWriter =new XMLWriter( new FileOutputStream(file), format);\n xmlWriter.write(document);//write the new xml into the file\n xmlWriter.flush();\n }", "String objectWrite();", "public void toXML(XMLWriter xmlWriter, int indent, boolean relative)\n throws IOException {\n xmlWriter.printXMLStartTag(objectXMLTag, indent, relative, true);\n xmlWriter.print(stringApiValue());\n xmlWriter.printXMLEndTag(objectXMLTag, -indent, true);\n }", "public void writeObject ();", "public String\ttoXML()\t{\n\t\treturn toXML(0);\n\t}", "public interface XmlOut {\n public void writeXML(XMLStreamWriter xmlStreamWriter);\n}", "abstract void toXML(StringBuilder xml, int level);", "public static void outputXMLdoc() throws Exception {\n // transform the Document into a String\n DOMSource domSource = new DOMSource(doc);\n TransformerFactory tf = TransformerFactory.newInstance();\n Transformer transformer = tf.newTransformer();\n transformer.setOutputProperty(OutputKeys.METHOD, \"xml\");\n transformer.setOutputProperty(OutputKeys.ENCODING,\"UTF-8\");\n transformer.setOutputProperty(\"{http://xml.apache.org/xslt}indent-amount\", \"4\");\n transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");\n java.io.StringWriter sw = new java.io.StringWriter();\n StreamResult sr = new StreamResult(sw);\n transformer.transform(domSource, sr);\n String xml = sw.toString();\n\n\tSystem.out.println(xml);\n\n }", "public void printToXML() {\n String fileString = \"outputDisposal.xml\";\n //Creating the path object of the file\n Path filePath = Paths.get(fileString);\n if (Files.notExists(filePath)) {\n try {\n Files.createFile(filePath);\n } catch (IOException e1) {\n\n e1.printStackTrace();\n }\n }\n //Converting the path object to file to use in the FileWriter constructor \n File newFile = filePath.toFile();\n\n /*\n Typical try-with-resources block that features three streams: FileWriter,BufferedWriter and PrintWriter.\n The FileWriter object connects the file tho the stream.\n The BufferedWriter object \n */\n try ( PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(newFile)))) {\n for (PickUp pck : pickups) {\n out.print(pck);\n }\n\n } catch (IOException e) {\n System.err.println(e);\n }\n\n }", "public <T> String SerializeXml(T obj, String pathToRoot){\n this.lastPath = pathToRoot + obj.getClass().getSimpleName().toLowerCase() + \"_object-\" + Math.abs(new Random().nextLong()) + \".xml\";\n\n XmlMapper xmlMapper = new XmlMapper();\n xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);\n xmlMapper.registerModule(new JavaTimeModule());\n xmlMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);\n\n File file = new File(this.lastPath);\n\n try {\n file.createNewFile();\n xmlMapper.writeValue(file, obj);\n System.out.println(xmlMapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj));\n return xmlMapper.writeValueAsString(obj);\n } catch (IOException e) {\n e.printStackTrace();\n }\n return \"\";\n }", "public void dump( Result out ) throws JAXBException;", "public static String toXMLString(Object obj) {\r\n if (obj == null) {\r\n return null;\r\n }\r\n\r\n String pkgName = obj.getClass().getPackage().getName();\r\n try {\r\n if (!entityMarshallers.containsKey(pkgName)) {\r\n JAXBContext jc = JAXBContext.newInstance(pkgName);\r\n entityMarshallers.put(pkgName, jc.createMarshaller());\r\n entityMarshallerLock.put(pkgName, new Object());\r\n }\r\n\r\n StringWriter sw = new StringWriter();\r\n Marshaller marshaller = entityMarshallers.get(pkgName);\r\n Object locker = entityMarshallerLock.get(pkgName);\r\n\r\n synchronized (locker) {\r\n marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Configuration.getBoolean(Constant.CONFIG_KEY.PCM_XML_PRETTY_PRINT));\r\n marshaller.marshal(obj, sw);\r\n }\r\n\r\n return sw.toString();\r\n\r\n } catch (Exception e) {\r\n Logger.defaultLogger.error(e.getMessage(), e);\r\n }\r\n return \"\";\r\n }", "@Override\n public void marshal(T object, XMLStreamWriter output,\n AttachmentMarshaller am) throws JAXBException {\n try {\n output.flush();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n SAX2StaxContentHandler handler = new SAX2StaxContentHandler(output);\n if (object instanceof DataObject) {\n serializeDataObject((DataObject) object, new SAXResult(handler),\n am);\n return;\n }\n\n try {\n String value = serializePrimitive(object, javaType);\n String prefix = output.getPrefix(xmlTag.getNamespaceURI());\n //TODO, this is a hack, seems to be wrong. why should namespace returned is \"\"?\n if (xmlTag.getNamespaceURI().equals(\"\")) {\n output.writeStartElement(\"\", xmlTag.getLocalPart(), xmlTag.getNamespaceURI());\n// } else if (prefix == null) {\n// output.writeStartElement(xmlTag.getNamespaceURI(), xmlTag.getLocalPart());\n } else {\n output.writeStartElement(prefix, xmlTag.getLocalPart(), xmlTag.getNamespaceURI());\n output.writeNamespace(prefix, xmlTag.getNamespaceURI());\n }\n output.writeCharacters(value);\n output.writeEndElement();\n } catch (XMLStreamException e) {\n throw new SDODatabindingException(e);\n }\n }", "public String toXml() {\n\t\treturn(toString());\n\t}", "Document toXml() throws ParserConfigurationException, TransformerException, IOException;", "protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n super.toXML(out, getXMLElementTagName());\n }", "public void toXML(FreeColXMLWriter xw) throws XMLStreamException {\n xw.writeStartElement(getTagName());\n\n xw.writeAttribute(FreeColObject.ID_ATTRIBUTE_TAG,\n (AIObject)getTransportable());\n\n xw.writeAttribute(CARRIER_TAG, getCarrier());\n\n xw.writeAttribute(TRIES_TAG, getTries());\n\n xw.writeAttribute(SPACELEFT_TAG, getSpaceLeft());\n\n if (plan.twait != null) {\n xw.writeLocationAttribute(TWAIT_TAG, plan.twait);\n }\n\n if (plan.cwait != null) {\n xw.writeLocationAttribute(CWAIT_TAG, plan.cwait);\n }\n\n if (plan.cdst != null) {\n xw.writeLocationAttribute(CDST_TAG, plan.cdst);\n }\n\n if (plan.tdst != null) {\n xw.writeLocationAttribute(TDST_TAG, plan.tdst);\n }\n\n xw.writeAttribute(TURNS_TAG, plan.turns);\n\n xw.writeAttribute(MODE_TAG, plan.mode);\n\n xw.writeAttribute(FALLBACK_TAG, plan.fallback);\n\n xw.writeEndElement();\n }", "public static String xmlMarshall(Object obj) throws Exception {\n\t\tStringWriter writer = null;\n\t\ttry {\n\t\t\tJAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass());\n\t\t\tMarshaller marshaller = jaxbContext.createMarshaller();\n\t\t\twriter = new StringWriter();\n\n\t\t\tmarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);\n\t\t\tmarshaller.setProperty(Marshaller.JAXB_ENCODING, \"UTF-8\");\n\t\t\tmarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\t\t\tmarshaller.marshal(obj, writer);\n\t\t\tString result = writer.toString();\n\t\t\treturn result;\t\t\n\t\t}finally {\n\t\t\tif (writer != null)\n\t\t\t\twriter.close();\n\t\t}\t\t\n\t}", "public String printToXml()\n {\n XMLOutputter outputter = new XMLOutputter();\n outputter.setFormat(org.jdom.output.Format.getPrettyFormat());\n return outputter.outputString(this.toXml());\n }", "static <T> T printLogAndReturn(Object obj) throws JAXBException {\n StringWriter writer = new StringWriter();\n // create JAXBContext which will be used to update writer\n JAXBContext context = JAXBContext.newInstance(obj.getClass());\n // marshall or convert jaxbElement containing student to xml format\n context.createMarshaller().marshal(obj, writer);\n // print XML string representation of Student object\n System.out.println(writer.toString());\n return (T) obj;\n }", "public static void main(String[]args){\n XMLOutputter out = new XMLOutputter();\n SAXBuilder sax = new SAXBuilder();\n\n //Objekte die gepseichert werden sollen\n Car car = new Car(\"CR-MD-5\",\"16.05.1998\",4,4,4);\n Car car2 = new Car(\"UL-M-5\",\"11.03.2002\",10,2,5);\n\n\n Element rootEle = new Element(\"cars\");\n Document doc = new Document(rootEle);\n\n //hinzufuegen des ersten autos\n Element carEle = new Element(\"car\");\n carEle.setAttribute(new Attribute(\"car\",\"1\"));\n carEle.addContent(new Element(\"licenseplate\").setText(car.getLicensePlate()));\n carEle.addContent(new Element(\"productiondate\").setText(car.getProductionDate()));\n carEle.addContent(new Element(\"numberpassengers\").setText(Integer.toString(car.getNumberPassengers())));\n carEle.addContent(new Element(\"numberwheels\").setText(Integer.toString(car.getNumberWheels())));\n carEle.addContent(new Element(\"numberdoors\").setText(Integer.toString(car.getNumberDoors())));\n\n //hinzufuegen des zweiten autos\n Element carEle2 = new Element(\"car2\");\n carEle2.setAttribute(new Attribute(\"car2\",\"2\"));\n carEle2.addContent(new Element(\"licenseplate\").setText(car2.getLicensePlate()));\n carEle2.addContent(new Element(\"productiondate\").setText(car2.getProductionDate()));\n carEle2.addContent(new Element(\"numberpassengers\").setText(Integer.toString(car2.getNumberPassengers())));\n carEle2.addContent(new Element(\"numberwheels\").setText(Integer.toString(car2.getNumberWheels())));\n carEle2.addContent(new Element(\"numberdoors\").setText(Integer.toString(car2.getNumberDoors())));\n\n\n doc.getRootElement().addContent(carEle);\n doc.getRootElement().addContent(carEle2);\n\n //Einstellen des Formates auf gut lesbares, eingeruecktes Format\n out.setFormat(Format.getPrettyFormat());\n //Versuche in xml Datei zu schreiben\n try {\n out.output(doc, new FileWriter(\"SaveCar.xml\"));\n } catch (IOException e) {\n System.out.println(\"Error opening File\");\n }\n\n\n //Einlesen\n\n File input = new File(\"SaveCar.xml\");\n Document inputDoc = null;\n //Versuche aus xml Datei zu lesen und Document zu instanziieren\n try {\n inputDoc = (Document) sax.build(input);\n } catch (JDOMException e) {\n System.out.println(\"An Error occured\");\n } catch (IOException e) {\n System.out.print(\"Error opening File\");\n }\n\n //Liste von Elementen der jeweiligen Autos\n List<Element> listCar = inputDoc.getRootElement().getChildren(\"car\");\n List<Element> listCar2 = inputDoc.getRootElement().getChildren(\"car2\");\n\n //Ausgabe der Objekte auf der Konsole (manuell)\n printXML(listCar);\n System.out.println();\n printXML(listCar2);\n\n //Erstellen der abgespeicherten Objekte\n Car savedCar1 = createObj(listCar);\n Car savedCar2 = createObj(listCar2);\n\n System.out.println();\n System.out.println(savedCar1);\n System.out.println();\n System.out.println(savedCar2);\n\n}", "public void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n // Start element:\n out.writeStartElement(getXMLElementTagName());\n\n //out.writeAttribute(ID_ATTRIBUTE_TAG, getId());\n out.writeAttribute(\"nationalAdvantages\", nationalAdvantages.toString());\n out.writeStartElement(\"Nations\");\n for (Map.Entry<Nation, NationState> entry : nations.entrySet()) {\n out.writeStartElement(\"Nation\");\n out.writeAttribute(ID_ATTRIBUTE_TAG, entry.getKey().getId());\n out.writeAttribute(\"state\", entry.getValue().toString());\n out.writeEndElement();\n }\n out.writeEndElement();\n\n out.writeEndElement();\n }", "protected static boolean writeXMLType(Output out, Object xml) {\n log.trace(\"writeXMLType\");\n // If it's a Document write it as Document\n if (xml instanceof Document) {\n writeDocument(out, (Document) xml);\n } else {\n return false;\n }\n return true;\n }", "public void write(Object o)\r\n throws IOException, XmlPullParserException\r\n {\n if(o instanceof XmlNode) {\r\n\t writeNode((XmlNode)o);\r\n } else if(o instanceof XmlStartTag) {\r\n\t writeStartTag((XmlStartTag)o);\r\n } else if(o instanceof XmlEndTag) {\r\n\t writeEndTag((XmlEndTag)o);\r\n } else if(o instanceof XmlWritable) {\r\n\t ((XmlWritable)o).writeXml(out);\r\n } else {\r\n\t if(o != null) {\r\n\t\twriteContent(o.toString());\r\n\t } else {\r\n\t\t//silenty ignore null values\r\n\t }\r\n\t}\r\n }", "protected abstract ArrayList<Element> _toXml_();", "public String toXML() {\n return null;\n }", "public void writeXML(InvCatalogImpl catalog, OutputStream os) throws IOException {\r\n // Output the document, use standard formatter\r\n //XMLOutputter fmt = new XMLOutputter();\r\n //fmt.setNewlines(true);\r\n //fmt.setIndent(\" \");\r\n //fmt.setTrimAllWhite( true);\r\n XMLOutputter fmt = new XMLOutputter(org.jdom.output.Format.getPrettyFormat()); // LOOK maybe compact ??\r\n fmt.output(writeCatalog(catalog), os);\r\n }", "public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {\n final Writer writer = new StringWriter();\n try {\n toXML(xstream, obj, writer);\n } catch (final ObjectStreamException e) {\n throw e;\n } catch (final IOException e) {\n throw new StreamException(\"Unexpected IO error from a StringWriter\", e);\n }\n return writer.toString();\n }", "protected abstract Element toXmlEx(Document doc);", "String toXML() throws RemoteException;", "public void save() {\n int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);\r\n int minute = Calendar.getInstance().get(Calendar.MINUTE);\r\n\r\n // Hierarchie: 2010/04/05/01_05042010_00002.xml\r\n File dir = getOutputDir();\r\n File f = new File(dir, getCode().replace(' ', '_') + \".xml\");\r\n Element topLevel = new Element(\"ticket\");\r\n topLevel.setAttribute(new Attribute(\"code\", this.getCode()));\r\n topLevel.setAttribute(\"hour\", String.valueOf(hour));\r\n topLevel.setAttribute(\"minute\", String.valueOf(minute));\r\n // Articles\r\n for (Pair<Article, Integer> item : this.items) {\r\n Element e = new Element(\"article\");\r\n e.setAttribute(\"qte\", String.valueOf(item.getSecond()));\r\n // Prix unitaire\r\n e.setAttribute(\"prix\", String.valueOf(item.getFirst().getPriceInCents()));\r\n e.setAttribute(\"prixHT\", String.valueOf(item.getFirst().getPriceHTInCents()));\r\n e.setAttribute(\"idTaxe\", String.valueOf(item.getFirst().getIdTaxe()));\r\n e.setAttribute(\"categorie\", item.getFirst().getCategorie().getName());\r\n e.setAttribute(\"codebarre\", item.getFirst().getCode());\r\n e.setText(item.getFirst().getName());\r\n topLevel.addContent(e);\r\n }\r\n // Paiements\r\n for (Paiement paiement : this.paiements) {\r\n final int montantInCents = paiement.getMontantInCents();\r\n if (montantInCents > 0) {\r\n final Element e = new Element(\"paiement\");\r\n String type = \"\";\r\n if (paiement.getType() == Paiement.CB) {\r\n type = \"CB\";\r\n } else if (paiement.getType() == Paiement.CHEQUE) {\r\n type = \"CHEQUE\";\r\n } else if (paiement.getType() == Paiement.ESPECES) {\r\n type = \"ESPECES\";\r\n }\r\n e.setAttribute(\"type\", type);\r\n e.setAttribute(\"montant\", String.valueOf(montantInCents));\r\n topLevel.addContent(e);\r\n }\r\n\r\n }\r\n try {\r\n final XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());\r\n out.output(topLevel, new FileOutputStream(f));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "public String toXML() {\n return null;\n }", "public JodaBeanXmlWriter xmlWriter() {\n return new JodaBeanXmlWriter(this);\n }", "private void write(){\n\t\ttry {\n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance();\n\t\t\tTransformer transformer = transformerFactory.newTransformer();\n\t\t\tDOMSource source = new DOMSource(doc);\n\t\t\t\n\t\t\tString pathSub = ManipXML.class.getResource(path).toString();\n\t\t\tpathSub = pathSub.substring(5, pathSub.length());\n\t\t\tStreamResult result = new StreamResult(pathSub);\n\t\t\t\n\t\t\ttransformer.transform(source, result);\n\t\t} catch (TransformerConfigurationException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (TransformerException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void writeXML(String xml){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t\tDocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); \n\t\t\tDocumentBuilder documentBuilder = documentFactory.newDocumentBuilder(); \n\t\t\t// define root elements \n\t\t\tDocument document = documentBuilder.newDocument(); \n\t\t\tElement rootElement = document.createElement(\"graph\"); \n\t\t\tdocument.appendChild(rootElement);\n\t\t\t\n\t\t\tfor(int i=0;i<Rel.getChildCount();i++){\n\t\t\t\tif(Rel.getChildAt(i).getTag() != null){\n\t\t\t\t\tif(Rel.getChildAt(i).getTag().toString().compareTo(\"node\") == 0){\n\t\t\t\t\t\tArtifact artifact = (Artifact) Rel.getChildAt(i);\n\t\t\t\t\t\tElement node = addElement(rootElement, \"node\", document);\n\t\t\t\t\t\tElement id = addAttribute(\"id\",artifact.getId()+\"\", document); //we create an attribute for a node\n\t\t\t\t\t\tnode.appendChild(id);//and then we attach it to the node\n\t\t\t\t\t\t\n\t\t\t\t\t\tArrayList <Artifact> fathers = artifact.getFathers();\n\t\t\t\t\t\tif(fathers != null){\n\t\t\t\t\t\t\taddElement(node, \"fathers\", document);//for complex attribute like array of fathers we add an element to the node\n\t\t\t\t\t\t\tfor(int j=0;j<fathers.size();j++){\n\t\t\t\t\t\t\t\tElement father = addAttribute(\"father\",fathers.get(j).getId()+\"\", document);//inside this element created in the node we add all its fathers as attributes\n\t\t\t\t\t\t\t\tnode.appendChild(father);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tArrayList <Artifact> sons = artifact.getSons();\n\t\t\t\t\t\tif(sons != null){\n\t\t\t\t\t\t\taddElement(node, \"sons\", document);//for complex attribute like array of sons we add an element to the node\n\t\t\t\t\t\t\tfor(int j=0;j<sons.size();j++){\n\t\t\t\t\t\t\t\tElement son = addAttribute(\"son\",sons.get(j).getId()+\"\", document);//inside this element created in the node we add all its sons as attributes\n\t\t\t\t\t\t\t\tnode.appendChild(son);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement label = addAttribute(\"label\", artifact.getText()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(label);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement age = addAttribute(\"age\", artifact.getAge()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(age);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement type = addAttribute(\"type\", artifact.getType()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(type);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement information = addAttribute(\"information\", artifact.getInformation()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(information);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement position = addAttribute(\"position\", artifact.getPosition()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(position);\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t// creating and writing to xml file \n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance(); \n\t\t\tTransformer transformer = transformerFactory.newTransformer(); \n\t\t\tDOMSource domSource = new DOMSource(document); \n\t\t\tStreamResult streamResult = new StreamResult(new File(xml)); \n\t\t\ttransformer.transform(domSource, streamResult);\n \n \n }catch(Exception e){\n \tLog.v(\"error writing xml\",e.toString());\n }\n\t\t\n\t\t\n\t}", "public Element toXml(Document doc)\n {\n if (null == doc)\n throw new IllegalArgumentException(\"Must provide a valid Document\");\n Element root = doc.createElement(XML_NODE_NAME);\n root.setAttribute(XML_NAME_ATTR, m_name);\n if (m_displayName.length() > 0)\n root.setAttribute(XML_DISPLAYNAME_ATTR, m_displayName);\n root.setAttribute(XML_DIMENSION_ATTR, m_dimension);\n root.setAttribute(XML_CHOICESET_ATTR, m_choiceSet);\n if (m_description.length() > 0)\n PSXmlDocumentBuilder.addElement(doc, root, XELEM_DESCRIPTION,\n m_description);\n\n // psxctl:ParamList\n if (m_params.size() > 0)\n {\n Element paramList = doc.createElement( XELEM_PARAMLIST );\n for (Iterator iter = m_params.iterator(); iter.hasNext();)\n {\n PSControlParameter param = (PSControlParameter) iter.next();\n paramList.appendChild(param.toXml(doc));\n }\n root.appendChild(paramList);\n }\n\n // psxctl:AssociatedFileList\n if (m_files.size() > 0)\n {\n Element files = doc.createElement( XELEM_FILES );\n for (Iterator iter = m_files.iterator(); iter.hasNext();)\n {\n PSFileDescriptor file = (PSFileDescriptor) iter.next();\n files.appendChild( file.toXml( doc ) );\n }\n root.appendChild(files);\n }\n\n // psxctl:Dependencies\n if (m_dependencies.size() > 0)\n {\n Element dependencies = doc.createElement( XELEM_DEPENDENCIES );\n for (Iterator iter = m_dependencies.iterator(); iter.hasNext();)\n {\n PSDependency dependency = (PSDependency) iter.next();\n dependencies.appendChild( dependency.toXml( doc ) );\n }\n root.appendChild(dependencies);\n }\n\n return root;\n }", "public interface IXMLWriter {\n\n /**\n * @param game to serialize and output\n * @param outputFile to write to\n */\n void convertXMLToGame (IGame game, File outputFile);\n}", "public String getXML() {\n\t\tString xml = \"\";\n\t\ttry {\n\t\t\tJAXBContext jc = JAXBContext.newInstance( VolumeRs.class );\n\t\t\tMarshaller m = jc.createMarshaller();\n\t\t\tStringWriter stringWriter = new StringWriter();\n\t\t\tm.marshal(this, stringWriter);\n\t\t\txml = stringWriter.toString();\n\t\t} catch (JAXBException ex) {}\n\t\treturn xml;\n\t}", "void write(Writer out, boolean escapeXML) throws IOException;", "protected static void writeXML(String path, String ID, String abs,String cls) {\n\t\tDocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder dBuilder;\r\n try {\r\n dBuilder = dbFactory.newDocumentBuilder();\r\n Document doc = dBuilder.newDocument();\r\n //add elements to Document\r\n Element rootElement =doc.createElement(\"Data\");\r\n //append root element to document\r\n doc.appendChild(rootElement);\r\n\r\n rootElement.appendChild(getReviewsPositive(doc, ID, abs,cls));\r\n //for output to file, console\r\n TransformerFactory transformerFactory = TransformerFactory.newInstance();\r\n Transformer transformer = transformerFactory.newTransformer();\r\n //for pretty print\r\n transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");\r\n DOMSource source = new DOMSource(doc);\r\n\r\n //write to console or file\r\n StreamResult console = new StreamResult(System.out);\r\n StreamResult file = new StreamResult(new File(path+\"\"+ID+\".xml\"));\r\n\r\n //write data\r\n transformer.transform(source, console);\r\n transformer.transform(source, file);\r\n //System.out.println(\"DONE\");\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n\t}", "public interface XMLObject {\n public XMLObject getXMLObject();\n}", "public static void createXmlNote() throws JAXBException {\n Staff staff = new Staff();\n\n //Creating xml root node;\n //Create JAXB context and instantiate marshaller;\n JAXBContext jaxbContext = JAXBContext.newInstance(Staff.class);\n // Marshaller : Java Object to XML content\n Marshaller jaxbMarshaller = jaxbContext.createMarshaller();\n jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n jaxbMarshaller.marshal(staff, new File(\"test.xml\"));\n }", "protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n toXML(out, getXMLElementTagName());\n }", "void writeObject(OutputSerializer out) throws java.io.IOException;", "protected String getXML() {\n\n StringBuffer b = new StringBuffer(\"title =\\\"\");\n b.append(title);\n b.append(\"\\\" xAxisTitle=\\\"\");\n b.append(xAxisTitle);\n b.append(\"\\\" yAxisTitle=\\\"\");\n b.append(yAxisTitle);\n b.append(\"\\\" xRangeMin=\\\"\");\n b.append(xRangeMin);\n b.append(\"\\\" xRangeMax=\\\"\");\n b.append(xRangeMax);\n b.append(\"\\\" xRangeIncr=\\\"\");\n b.append(xRangeIncr);\n b.append(\"\\\" yRangeMin=\\\"\");\n b.append(yRangeMin);\n b.append(\"\\\" yRangeMax=\\\"\");\n b.append(yRangeMax);\n b.append(\"\\\" yRangeIncr=\\\"\");\n b.append(yRangeIncr);\n b.append(\"\\\" >\\n\");\n\n for (int i = 0, n = dataSources.size(); i < n; i++) {\n GuiChartDataSource ds = (GuiChartDataSource)dataSources.get(i);\n b.append(ds.toXML());\n b.append(\"\\n\");\n }\n\n return b.toString();\n }", "public String getXML() //Perhaps make a version of this where the header DTD can be manually specified\n { //Also allow changing of generated tags to user specified values\n \n String xml = new String();\n xml= \"<?xml version = \\\"1.0\\\"?>\\n\";\n xml = xml + generateXML();\n return xml;\n }", "public String toXML()\n\t{\n\t\treturn toXML(0);\n\t}", "public String toXML()\n\t{\n\t\treturn toXML(0);\n\t}", "public void createXml(String fileName) { \n\t\tElement root = this.document.createElement(\"TSETInfoTables\"); \n\t\tthis.document.appendChild(root); \n\t\tElement metaDB = this.document.createElement(\"metaDB\"); \n\t\tElement table = this.document.createElement(\"table\"); \n\t\t\n\t\tElement column = this.document.createElement(\"column\");\n\t\tElement columnName = this.document.createElement(\"columnName\");\n\t\tcolumnName.appendChild(this.document.createTextNode(\"test\")); \n\t\tcolumn.appendChild(columnName); \n\t\tElement columnType = this.document.createElement(\"columnType\"); \n\t\tcolumnType.appendChild(this.document.createTextNode(\"INTEGER\")); \n\t\tcolumn.appendChild(columnType); \n\t\t\n\t\ttable.appendChild(column);\n\t\tmetaDB.appendChild(table);\n\t\troot.appendChild(metaDB); \n\t\t\n\t\tTransformerFactory tf = TransformerFactory.newInstance(); \n\t\ttry { \n\t\t\tTransformer transformer = tf.newTransformer(); \n\t\t\tDOMSource source = new DOMSource(document); \n\t\t\ttransformer.setOutputProperty(OutputKeys.ENCODING, \"gb2312\"); \n\t\t\ttransformer.setOutputProperty(OutputKeys.INDENT, \"yes\"); \n\t\t\tPrintWriter pw = new PrintWriter(new FileOutputStream(fileName)); \n\t\t\tStreamResult result = new StreamResult(pw); \n\t\t\ttransformer.transform(source, result); \n\t\t\tlogger.info(\"Generate XML file success!\");\n\t\t} catch (TransformerConfigurationException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (IllegalArgumentException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (FileNotFoundException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (TransformerException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} \n\t}", "private void write( TypeItem type ) throws SAXException, IOException {\n\t\t\t\t\n\t\tDocumentHandler outHandler = new XMLSerializer(\n\t\t\tcontroller.getOutput(type),\n\t\t\tnew OutputFormat(\"xml\",null,true) );\n\t\tXMLWriter out = new XMLWriter(outHandler);\n\t\t\t\t\n\t\toutHandler.setDocumentLocator( new LocatorImpl() );\n\t\toutHandler.startDocument();\n\t\toutHandler.processingInstruction(\"xml-stylesheet\",\n\t\t\t\"type='text/xsl' href='classFileDebug.xsl'\");\n\t\twriteClass( type, out );\n\t\toutHandler.endDocument();\n\t}", "@Test\n\tpublic void testWrite(){\n\t\tGameWorld gw = getGameWorld();\n\t\ttry{\n\t\t\tXMLWriter writer = new XMLWriter(\"testWrite\");\n\t\t\twriter.write(gw);\n\t\t\twriter.close();\n\t\t} catch(FileNotFoundException e){\n\t\t\te.printStackTrace();\n\t\t\tfail(\"XMLWriter, testWrite.xml not found\");\n\t\t} catch(IntrospectionException e){\n\t\t\te.printStackTrace();\n\t\t\tfail(\"XMLWriter, introspection failure\");\n\t\t}\n\t}", "public void savetoxml() throws FileNotFoundException, JAXBException {\n xml_methods.save(player);\n }", "public String getXML() {\n\t\tString xml = \"\";\n\t\ttry {\n\t\t\tJAXBContext jc = JAXBContext.newInstance( QuotaUserRs.class );\n\t\t\tMarshaller m = jc.createMarshaller();\n\t\t\tStringWriter stringWriter = new StringWriter();\n\t\t\tm.marshal(this, stringWriter);\n\t\t\txml = stringWriter.toString();\n\t\t} catch (JAXBException ex) {}\n\t\treturn xml;\n\t}", "@Override\r\n public boolean save(Object object, String fileName)\r\n throws FileAlreadyExistsException, IOException, JAXBException {\n File outputFile = new File(fileName);\r\n FileWriter fstream = new FileWriter(outputFile);\r\n BufferedWriter xmlOutputWriter = new BufferedWriter(fstream);\r\n \r\n if(!this.enableOverwrite && outputFile.exists()) {\r\n throw new FileAlreadyExistsException(fileName);\r\n }\r\n \r\n try {\r\n this.jaxbObjectToXML(object, xmlOutputWriter);\r\n } finally {\r\n xmlOutputWriter.close();\r\n } \r\n \r\n return (outputFile.length() > 0);\r\n }", "public String toXml() {\n StringWriter outputStream = new StringWriter();\n try {\n PrintWriter output = new PrintWriter(outputStream);\n try {\n output.write(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\n toXml(output);\n return outputStream.toString();\n }\n catch (Exception ex) {\n Logger logger = Logger.getLogger(this.getClass());\n logger.error(ex);\n throw new EJBException(ex);\n }\n finally {\n output.close();\n }\n }\n finally {\n try {\n outputStream.close();\n }\n catch (IOException ex) {\n Logger logger = Logger.getLogger(this.getClass());\n logger.error(ex);\n throw new EJBException(ex);\n }\n }\n }", "public void exportPropertiesToXML(PropertySet properties, String xmlPath){\n\t\t\n\t\t\n\t\ttry {\n\n\t\t\t//Call the method to get the root element of this document\n\t\t\tElement root = createJDOMRepresentation(properties);\n\t\t\t\n\t\t\t//Create an XML Outputter\n\t\t\tXMLOutputter outputter = new XMLOutputter();\n\t\t\t\n\t\t\t//Set the format of the outputted XML File\n\t\t\tFormat format = Format.getPrettyFormat();\n\t\t\toutputter.setFormat(format);\n\t\t\t\n\t\t\t//Output the XML File to standard output and the desired file\n\t\t\tFileWriter filew = new FileWriter(xmlPath);\n\t\t\t//outputter.output(root, System.out);\n\t\t\toutputter.output(root, filew);\n\t\t\t\n\t\t} catch (IOException e){\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t}", "@Override\r\n protected XMLSave createXMLSave() {\r\n prepareSave();\r\n return super.createXMLSave();\r\n }", "String toXmlString() throws IOException;", "public abstract OMElement serialize();", "private Element createXmlElementForObject(ObjectExtValue object, Document xmlDocument, Constraint constraint) {\n\t\tElement element = xmlDocument.createElement(XML_OBJECT);\n\t\t\n\t\tArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();\n\t\tfor (Iterator<Map.Entry<Value,Value>> iter = ((EntrySet) object.entrySet()).iterator(); iter.hasNext(); ) {\n\t\t\tMap.Entry<Value, Value> pair = iter.next();\n\t\t\tpairs.add(new NameValuePair(pair.getKey(), pair.getValue()));\n\t\t}\n\t\t\t\n\t\tCollections.sort(pairs, SortNameValuePairByName.inst);\n\t\t\n\t\tfor (NameValuePair pair : pairs) {\n\t\t\tElement childElement = createXmlElementForNameValuePair(pair.getName(), pair.getValue(), xmlDocument, constraint);\n\t\t\tif (childElement != null)\n\t\t\t\telement.appendChild(childElement);\n\t\t}\n\n\t\treturn (element.hasChildNodes() ? element : null);\n\t}", "public org.dom4j.Element writeXML(String name) throws Exception {\n org.dom4j.Element el = org.dom4j.DocumentHelper.createElement(name);\n\n if(getType() != null)\n el.addAttribute(\"type\", getType());\n if(getAction() != null)\n el.addAttribute(\"action\", getAction().toString());\n if(getDirection() != null)\n el.addAttribute(\"direction\", getDirection().toString());\n if(getContent() != null)\n el.addAttribute(\"content\", getContent());\n if(getIterations() != null)\n el.addAttribute(\"iterations\", org.jbrain.xml.binding._TypeConverter.buildInteger(getIterations()));\n if(getAsynchronous() != null)\n el.addAttribute(\"asynchronous\", org.jbrain.xml.binding._TypeConverter.buildBoolean(getAsynchronous()));\n return el;\n }", "@SuppressWarnings( { \"incomplete-switch\", \"rawtypes\", \"unchecked\" } )\n XmlElement objectToXml(Object o)\n {\n ElementType type = m_simpleTypes.get(o.getClass());\n if (type != null)\n {\n switch (type)\n {\n case REAL:\n return new XmlElement(\"real\", o.toString());\n case INTEGER:\n return new XmlElement(\"integer\", o.toString());\n case TRUE:\n return new XmlElement(((Boolean) o).booleanValue() ? \"true\" : \"false\");\n case DATE:\n return new XmlElement(\"date\", m_dateFormat.format((Date) o));\n case STRING:\n return new XmlElement(\"string\", (String) o);\n case DATA:\n return new XmlElement(\"data\", base64encode((byte[]) o));\n }\n }\n if (o instanceof Map)\n {\n return toXmlDict((Map) o);\n }\n else if (o instanceof List)\n {\n return toXmlArray((List) o);\n }\n else throw new RuntimeException(\"Cannot use \" + o.getClass() + \" in plist.\");\n }", "public static <T> String toXML(T object, String alias) {\r\n\t\tif (object == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"Object cannot be null\");\r\n\t\t}\r\n\t\tif (alias == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"Alais cannot be null\");\r\n\t\t}\r\n\t\tXStream xStream = new XStream();\r\n\t\txStream.alias(alias, object.getClass());\r\n\t\tStringWriter writer = new StringWriter();\r\n\t\txStream.toXML(object, writer);\r\n\t\treturn writer.toString();\r\n\t}", "@Get(\"xml\")\n public Representation toXml() {\n\n \tString status = getRequestFlag(\"status\", \"valid\");\n \tString access = getRequestFlag(\"location\", \"all\");\n\n \tList<Map<String, String>> metadata = getMetadata(status, access,\n \t\t\tgetRequestQueryValues());\n \tmetadata.remove(0);\n\n List<String> pathsToMetadata = buildPathsToMetadata(metadata);\n\n String xmlOutput = buildXmlOutput(pathsToMetadata);\n\n // Returns the XML representation of this document.\n StringRepresentation representation = new StringRepresentation(xmlOutput,\n MediaType.APPLICATION_XML);\n\n return representation;\n }", "public java.lang.String getXml();", "public void xmlPresentation () {\n System.out.println ( \"****** XML Data Module ******\" );\n ArrayList<Book> bookArrayList = new ArrayList<Book>();\n Books books = new Books();\n books.setBooks(new ArrayList<Book>());\n\n bookArrayList = new Request().postRequestBook();\n\n for (Book aux: bookArrayList) {\n books.getBooks().add(aux);\n }\n\n try {\n javax.xml.bind.JAXBContext jaxbContext = JAXBContext.newInstance(Books.class);\n Marshaller jaxbMarshaller = jaxbContext.createMarshaller();\n\n jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\n jaxbMarshaller.marshal(books, System.out);\n } catch (JAXBException e) {\n System.out.println(\"Error: \"+ e);\n }\n ClientEntry.showMenu ( );\n }", "private void exportarXML(){\n \n String nombre_archivo=IO_ES.leerCadena(\"Inserte el nombre del archivo\");\n String[] nombre_elementos= {\"Modulos\", \"Estudiantes\", \"Profesores\"};\n Document doc=XML.iniciarDocument();\n doc=XML.estructurarDocument(doc, nombre_elementos);\n \n for(Persona estudiante : LEstudiantes){\n estudiante.escribirXML(doc);\n }\n for(Persona profesor : LProfesorado){\n profesor.escribirXML(doc);\n }\n for(Modulo modulo: LModulo){\n modulo.escribirXML(doc);\n }\n \n XML.domTransformacion(doc, RUTAXML, nombre_archivo);\n \n }", "public void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n super.toXML(out, getXMLElementTagName());\n }", "public File makeXML(String key, int layerID, String value1, String time1, int totalCopies1, int copyNum1, boolean timerType1, String userId, String time, Certificate cert) {\n\n try {\n\n DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();\n\n DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();\n\n Document document = documentBuilder.newDocument();\n\n Element key1 = document.createElement(\"Search_Result_for\" + key);\n document.appendChild(key1);\n key1.setAttribute(\"Key\", key);\n\n Element layerid = document.createElement(\"layerid\");\n\n key1.appendChild(layerid);\n layerid.setAttribute(\"Id\", String.valueOf(layerID));\n\n Element Value = document.createElement(\"Value\");\n Value.appendChild(document.createTextNode(value1));\n layerid.appendChild(Value);\n\n Element timer = document.createElement(\"timer\");\n timer.appendChild(document.createTextNode(String.valueOf(time1)));\n layerid.appendChild(timer);\n\n Element totcopies = document.createElement(\"totcopies\");\n totcopies.appendChild(document.createTextNode(String.valueOf(totalCopies1)));\n layerid.appendChild(totcopies);\n\n Element copynum = document.createElement(\"copynum\");\n copynum.appendChild(document.createTextNode(String.valueOf(copyNum1)));\n layerid.appendChild(copynum);\n\n Element timertype = document.createElement(\"timertype\");\n timertype.appendChild(document.createTextNode(String.valueOf(timerType1)));\n layerid.appendChild(timertype);\n\n Element userid = document.createElement(\"userid\");\n userid.appendChild(document.createTextNode(userId));\n layerid.appendChild(userid);\n\n Element time2 = document.createElement(\"time\");\n time2.appendChild(document.createTextNode(String.valueOf(time1)));\n layerid.appendChild(time2);\n\n /*Element cert1 = document.createElement(\"cert\");\n cert1.appendChild(document.createTextNode(String.valueOf(cert)));\n layerid.appendChild((Node) cert);*/\n\n // create the xml file\n //transform the DOM Object to an XML File\n TransformerFactory transformerFactory = TransformerFactory.newInstance();\n Transformer transformer = transformerFactory.newTransformer();\n DOMSource domSource = new DOMSource(document);\n StreamResult streamResult = new StreamResult(new File(layerID + \"_Search Result for \" + key + \".xml\"));\n\n transformer.transform(domSource, streamResult);\n\n System.out.println(\"Done creating XML File\");\n\n } catch (ParserConfigurationException pce) {\n pce.printStackTrace();\n } catch (TransformerException tfe) {\n tfe.printStackTrace();\n }\n\n File file = new File(layerID + \"_Search Result for \" + key + \".xml\");\n return file;\n }", "public String toXml( String inEncoding )\n\t{\n\t\tDocument doc = DocumentHelper.createDocument();\n\t\tElement root = doc.addElement(getName());\n\t\tappendXml(this,root);\n\t\tStringWriter text = new StringWriter();\n\t\tOutputFormat format = OutputFormat.createPrettyPrint();\n\t\tformat.setEncoding(inEncoding);\n\t\tXMLWriter out = new XMLWriter(text, format);\n\t\ttry\n\t\t{\n\t\t\tout.write(doc);\n\t\t}\n\t\tcatch (IOException ex)\n\t\t{\n\t\t\tthrow new OpenEditRuntimeException(ex);\n\t\t}\n\t\treturn text.toString();\n\t}", "public void createXMLFileForNOC(Report report) {\n\ttry{\n\t\tFile outDir = new File(report.getXmlFilePath()); \n\t\tboolean isDirCreated = outDir.mkdirs();\n\t\tif (isDirCreated)\n\t\t\tlogger.info(\"In FileUploadDownload class fileUpload() method: upload file folder location created.\");\n\t\telse\n\t\t\tlogger.info(\"In FileUploadDownload class fileUpload() method: upload file folder location already exist.\");\n\t\t\n\t\tDocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();\n\t\tDocumentBuilder docBuilder = docFactory.newDocumentBuilder();\n\t\t\n\t\t// root elements\n\t\tDocument doc = docBuilder.newDocument();\n\t\tElement rootElement = doc.createElement(\"root\");\n\t\tdoc.appendChild(rootElement);\n\t\n\t\t\t//for(Student student : report.getStudentList()){\n\t\t\t\t\t\n\t\t\t\tElement studentList = doc.createElement(\"student\");\n\t\t\t\trootElement.appendChild(studentList);\n\t\t\t\t\n\t\t\t\t/*Element schoolname = doc.createElement(\"schoolname\");\n\t\t\t\tschoolname.appendChild(doc.createTextNode((report.getSchoolDetails().getSchoolDetailsName() != null ? report.getSchoolDetails().getSchoolDetailsName() : \"\" )));\n\t\t\t\tstudentList.appendChild(schoolname);*/\n\t\t\t\t\n\t\t\t\tElement academicYear = doc.createElement(\"academicYear\");\n\t\t\t\tacademicYear.appendChild(doc.createTextNode((String) (report.getAcademicYear().getAcademicYearName()!= null ? report.getAcademicYear().getAcademicYearName() : \"\" )));\n\t\t\t\tstudentList.appendChild(academicYear);\n\t\t\t\t\n\t\t\t\tElement roll = doc.createElement(\"roll\");\n\t\t\t\troll.appendChild(doc.createTextNode((report.getReportCode().toString()!=null?report.getReportCode().toString():\"---------\")));\n\t\t\t\tstudentList.appendChild(roll);\n\t\t\t\t\n\t\t\t\tElement studentname = doc.createElement(\"studentname\");\n\t\t\t\tstudentname.appendChild(doc.createTextNode((report.getUpdatedBy()!=null?report.getUpdatedBy():\"---------------\")));\n\t\t\t\tstudentList.appendChild(studentname);\n\t\t\t\n\t\t\t\t\n\t\t\t//}\n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance();\n\t\t\tTransformer transformer = transformerFactory.newTransformer();\n\t\t\tDOMSource source = new DOMSource(doc);\t\t\n\t\t\tStreamResult result = new StreamResult(new File(report.getXmlFilePath()+report.getXmlFileName()));\n\t\t\t\n\t\t\t// Output to console for testing\n\t\t\t// StreamResult result = new StreamResult(System.out);\t\t\t\n\t\t\ttransformer.transform(source, result);\n\t\t}catch (ParserConfigurationException pce) {\n\t\t\tpce.printStackTrace();\n\t\t\tlogger.error(\"\",pce);\n\t\t} catch (TransformerException tfe) {\n\t\t\ttfe.printStackTrace();\n\t\t\tlogger.error(tfe);\n\t\t}\n\t}" ]
[ "0.6904498", "0.6904498", "0.6904498", "0.6811819", "0.67173654", "0.66696966", "0.6579164", "0.6572036", "0.65064514", "0.64062136", "0.63893497", "0.63393104", "0.6327431", "0.6308585", "0.63021785", "0.63006294", "0.6248789", "0.6224102", "0.61897224", "0.61164314", "0.611031", "0.6087306", "0.6046633", "0.60394907", "0.6024676", "0.59885675", "0.5969792", "0.59658766", "0.59640443", "0.595096", "0.5948745", "0.5926716", "0.5914506", "0.590804", "0.5905895", "0.58946174", "0.5893019", "0.5883319", "0.58608735", "0.58498627", "0.5847619", "0.5833858", "0.5832483", "0.58311665", "0.582418", "0.5818564", "0.5815558", "0.5814583", "0.5808248", "0.58075887", "0.57989854", "0.57962376", "0.5763789", "0.5762995", "0.5762843", "0.57535875", "0.57446927", "0.5744244", "0.57334805", "0.5730781", "0.57206947", "0.57201195", "0.5708534", "0.57069665", "0.5697786", "0.5694003", "0.5687739", "0.568621", "0.56728464", "0.566078", "0.5657486", "0.5651974", "0.5650533", "0.56377065", "0.563275", "0.563275", "0.5629851", "0.561596", "0.5603592", "0.5603305", "0.55990326", "0.55956", "0.5586411", "0.558249", "0.55793023", "0.55785143", "0.55762744", "0.555744", "0.5555457", "0.5546962", "0.5540713", "0.55398834", "0.5528177", "0.55127114", "0.55107385", "0.5505279", "0.5499759", "0.5493183", "0.54697204" ]
0.6630437
7
Title: writeXML Description: Creates XML from Object instance
public org.dom4j.Element writeXML(String name) throws Exception { org.dom4j.Element el = org.dom4j.DocumentHelper.createElement(name); if(getType() != null) el.addAttribute("type", getType()); if(getAction() != null) el.addAttribute("action", getAction().toString()); if(getDirection() != null) el.addAttribute("direction", getDirection().toString()); if(getContent() != null) el.addAttribute("content", getContent()); if(getIterations() != null) el.addAttribute("iterations", org.jbrain.xml.binding._TypeConverter.buildInteger(getIterations())); if(getAsynchronous() != null) el.addAttribute("asynchronous", org.jbrain.xml.binding._TypeConverter.buildBoolean(getAsynchronous())); return el; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract String toXML();", "public abstract String toXML();", "public abstract String toXML();", "private void jaxbObjectToXML(Object object, Writer outputWriter) throws JAXBException {\r\n \r\n JAXBContext context = JAXBContext.newInstance(object.getClass());\r\n Marshaller marshaller = context.createMarshaller();\r\n \r\n // for pretty-print XML in JAXB\r\n marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);\r\n // Marshaller.JAXB_ENCODING exemplo: \"ISO-8859-1\" apenas para referência\r\n marshaller.setProperty(Marshaller.JAXB_ENCODING, CHAR_ENCODING);\r\n \r\n // write to System.out for debugging (TODO: REMOVE THIS LINE IN THE FUTURE)\r\n //marshaller.marshal(object, System.out);\r\n \r\n // write to file\r\n marshaller.marshal(object, outputWriter);\r\n \r\n }", "void writeObj(MyAllTypesFirst myFirst, StrategyI xmlStrat);", "Element toXML();", "public org.dom4j.Element writeXML() throws Exception {\n return writeXML(sObjName);\n }", "public org.dom4j.Element writeXML() throws Exception {\n return writeXML(sObjName);\n }", "private static void writeAsXml(Object o, Writer writer) throws Exception\n {\n JAXBContext jaxb = JAXBContext.newInstance(o.getClass());\n \n Marshaller xmlConverter = jaxb.createMarshaller();\n xmlConverter.setProperty(\"jaxb.formatted.output\", true);\n xmlConverter.marshal(o, writer);\n }", "protected abstract void toXml(PrintWriter result);", "public String exportXML() {\n\n\t\tXStream xstream = new XStream();\n\t\txstream.setMode(XStream.NO_REFERENCES);\n\n\t\treturn xstream.toXML(this);\n\t}", "void writeObj(MyAllTypesSecond aRecord, StrategyI xmlStrat);", "public String toXML() {\n StringWriter stringWriter = new StringWriter();\n PrintWriter printWriter = new PrintWriter(stringWriter, true);\n toXML(printWriter);\n return stringWriter.toString();\n }", "public abstract void writeToXml(T o, XmlSerializer serializer, Context context)\n throws IOException;", "void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException;", "public void writeXML(OutputStream stream) throws IOException {\n\t\tPrintWriter out = new PrintWriter(stream);\n\t\tout.println(\"<?xml version=\\\"1.0\\\"?>\");\n\t\tout.println(\"<VLDocking version=\\\"2.1\\\">\");\n\t\tfor(int i = 0; i < desktops.size(); i++) {\n\t\t\tWSDesktop desktop = (WSDesktop) desktops.get(i);\n\t\t\tdesktop.writeDesktopNode(out);\n\t\t}\n\t\tout.println(\"</VLDocking>\");\n\n\t\tout.flush();\n\t}", "@Override\n\tpublic void write() {\n\t\tSystem.out.println(\"使用xml方式存储\");\n\t}", "public abstract StringBuffer toXML();", "public abstract StringBuffer toXML ();", "abstract org.apache.xmlbeans.XmlObject getXmlObject();", "public void writeXML(OutputStream stream) throws IOException {\n\t\tPrintWriter out = new PrintWriter(stream);\n\t\tout.println(\"<?xml version=\\\"1.0\\\"?>\");\n\t\tout.println(\"<VLToolBars version=\\\"1.0\\\">\");\n\t\txmlWriteContainer(out);\n\n\t\tout.println(\"</VLToolBars>\");\n\t\tout.flush();\n\t}", "public String toXML(Object beanObject) throws XMLUtilityException {\r\n\t\tStringWriter strWriter = new StringWriter();\r\n\t\ttoXML(beanObject, strWriter);\r\n\t\treturn strWriter.toString();\r\n\t}", "@Override\n public void toXml(XmlContext xc) {\n\n }", "public void convertObjectToXML() throws TransformerException{\r\n\t\tDocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();\r\n\t\ttry {\r\n\t\t\tDocumentBuilder docBuilder = docFactory.newDocumentBuilder();\r\n\r\n\t\t\t// root elements\r\n\t\t\tDocument doc = docBuilder.newDocument();\r\n\t\t\tElement fileElement = doc.createElement(\"TextFile\");\r\n\t\t\tdoc.appendChild(fileElement);\r\n\r\n\t\t\t// set attribute to file element\r\n\t\t\tAttr attr = doc.createAttribute(\"filename\");\r\n\t\t\tattr.setValue(this.fileName);\r\n\t\t\tfileElement.setAttributeNode(attr);\r\n\t\t\t\r\n\t\t\t//Tagged for paragraphs,sentence,word and punctuation\r\n\r\n\t\t\tfor (Paragraph paragraph : paragraphs) { // for each paragraph\r\n\r\n\t\t\t\tElement paragraphElement = doc.createElement(paragraph.getXMLTag());\r\n\t\t\t\tfileElement.appendChild(paragraphElement);\r\n\t\t\t\t//System.out.println(\"PARAGRAPH:\"+paragraph.getSentences().size());\r\n\t\t\t\tfor (Sentence sentence : paragraph.getSentences()) { // for each sentence\r\n\t\t\t\t\tElement sentenceElement = doc.createElement(sentence.getXMLTag());\r\n\t\t\t\t\tparagraphElement.appendChild(sentenceElement);\r\n\t\t\t\t\t//System.out.println(\"Sentence:\"+sentence.getSentencesItems().size());\r\n\t\t\t\t\tfor (Items sentenceItem : sentence.getSentencesItems()) { // for each sentence item\r\n\t\t\t\t\t\tif (sentenceItem instanceof Word) {\r\n\t\t\t\t\t\t\tWord word = (Word)sentenceItem;\r\n\t\t\t\t\t\t\tElement wordElement = doc.createElement(word.getXMLTag());\r\n\t\t\t\t\t\t\twordElement.appendChild(doc.createTextNode(word.getWord()));\r\n\t\t\t\t\t\t\tsentenceElement.appendChild(wordElement); //output text for each word\r\n\t\t\t\t\t\t\t//System.out.println(\"Word:\"+word.getWord());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if (sentenceItem instanceof Punctuation) {\r\n\t\t\t\t\t\t\tPunctuation punctuation = (Punctuation)sentenceItem;\r\n\t\t\t\t\t\t\tElement punctuationElement = doc.createElement(punctuation.getXMLTag());\r\n\t\t\t\t\t\t\tpunctuationElement.appendChild(doc.createTextNode(punctuation.getPunctuation()));\r\n\t\t\t\t\t\t\tsentenceElement.appendChild(punctuationElement); //output text for each punctuation\r\n\t\t\t\t\t\t\t//System.out.println(\"Punctuation:\"+punctuation.getPunctuation());\r\n\t\t\t\t\t\t}\t\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// write the content into xml file\r\n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance();\r\n\t\t\tTransformer transformer = transformerFactory.newTransformer();\r\n\t\t\tDOMSource source = new DOMSource(doc);\r\n\r\n\t\t\t//System.out.println(fileName.lastIndexOf(\"/\"));\r\n\t\t\tStreamResult result = new StreamResult(new File(\"output_\"+fileName.substring(fileName.lastIndexOf(\"/\")+1, fileName.length()-4)+\".xml\"));\r\n\t\t\ttransformer.transform(source, result);\r\n\r\n\t\t\tSystem.out.println(\"File: \"+\"output_\"+fileName.substring(fileName.lastIndexOf(\"/\")+1, fileName.length()-4)+\".xml\"+\" saved!\");\r\n\r\n\t\t}\r\n\t\tcatch (ParserConfigurationException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t}", "public Document saveAsXML() {\n\tDocument xmldoc= new DocumentImpl();\n\tElement root = createFeaturesElement(xmldoc);\n\txmldoc.appendChild(root);\n\treturn xmldoc;\n }", "protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n // Start element:\n out.writeStartElement(getXMLElementTagName());\n\n out.writeAttribute(\"id\", getId());\n out.writeAttribute(\"accelerator\", getKeyStrokeText(getAccelerator()));\n\n out.writeEndElement();\n }", "ObjectElement createObjectElement();", "public String generateXML() \n { \n \n String xml = new String();\n \n String nodetype = new String();\n if (type.equals(\"internal\")){\n nodetype = \"INTERNAL\"; //change this for change in XML node name\n }\n else {\n nodetype = \"LEAF\"; //change this for change in XML node name\n }\n \n xml = \"<\" + nodetype;\n if (!name.equals(\"\")){\n xml = xml + \" name = \\\"\" + name + \"\\\"\";\n }\n if (length >0){\n xml = xml + \" length = \\\"\" + length + \"\\\"\";\n }\n //Section below tests tree size and depths\n // if (level > 0){\n // xml = xml + \" level = \\\"\" + level + \"\\\"\";\n // }\n //if (depth > 0){\n // xml = xml + \" depth = \\\"\" + depth + \"\\\"\";\n //}\n //if (newicklength > 0){\n // xml = xml + \" newicklength = \\\"\" + newicklength + \"\\\"\";\n //}\n // if (treesize > 0){\n // xml = xml + \" treesize = \\\"\" + treesize + \"\\\"\";\n //}\n //if (startxcoord >= 0){\n // xml = xml + \" startx = \\\"\" + startxcoord + \"\\\"\";\n //}\n //if (endxcoord >= 0){\n // xml = xml + \" endx = \\\"\" + endxcoord + \"\\\"\";\n //}\n //Test section done\n xml = xml + \">\";\n \n if (!children.isEmpty()){ //if there are children in this node's arraylist\n Iterator it = children.iterator();\n while(it.hasNext()){\n Node child = (Node) it.next();\n xml = xml + child.generateXML(); //The recursive coolness happens here!\n }\n }\n xml = xml + \"</\" + nodetype + \">\";\n \n return xml;\n }", "private String toXML(){\n\tString buffer = \"<xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\">\\n\";\n\tfor(Room[] r : rooms)\n\t for(Room s : r)\n\t\tif(s != null)\n\t\t buffer += s.toXML();\n\tbuffer += \"</xml>\";\n\treturn buffer;\n }", "void toXml(OutputStream out, boolean format) throws IOException;", "public void writeXML() throws IOException {\n OutputFormat format = OutputFormat.createPrettyPrint();//th format of xml file\n XMLWriter xmlWriter =new XMLWriter( new FileOutputStream(file), format);\n xmlWriter.write(document);//write the new xml into the file\n xmlWriter.flush();\n }", "String objectWrite();", "public void toXML(XMLWriter xmlWriter, int indent, boolean relative)\n throws IOException {\n xmlWriter.printXMLStartTag(objectXMLTag, indent, relative, true);\n xmlWriter.print(stringApiValue());\n xmlWriter.printXMLEndTag(objectXMLTag, -indent, true);\n }", "public void writeObject ();", "public String\ttoXML()\t{\n\t\treturn toXML(0);\n\t}", "public interface XmlOut {\n public void writeXML(XMLStreamWriter xmlStreamWriter);\n}", "abstract void toXML(StringBuilder xml, int level);", "public static void outputXMLdoc() throws Exception {\n // transform the Document into a String\n DOMSource domSource = new DOMSource(doc);\n TransformerFactory tf = TransformerFactory.newInstance();\n Transformer transformer = tf.newTransformer();\n transformer.setOutputProperty(OutputKeys.METHOD, \"xml\");\n transformer.setOutputProperty(OutputKeys.ENCODING,\"UTF-8\");\n transformer.setOutputProperty(\"{http://xml.apache.org/xslt}indent-amount\", \"4\");\n transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");\n java.io.StringWriter sw = new java.io.StringWriter();\n StreamResult sr = new StreamResult(sw);\n transformer.transform(domSource, sr);\n String xml = sw.toString();\n\n\tSystem.out.println(xml);\n\n }", "public void printToXML() {\n String fileString = \"outputDisposal.xml\";\n //Creating the path object of the file\n Path filePath = Paths.get(fileString);\n if (Files.notExists(filePath)) {\n try {\n Files.createFile(filePath);\n } catch (IOException e1) {\n\n e1.printStackTrace();\n }\n }\n //Converting the path object to file to use in the FileWriter constructor \n File newFile = filePath.toFile();\n\n /*\n Typical try-with-resources block that features three streams: FileWriter,BufferedWriter and PrintWriter.\n The FileWriter object connects the file tho the stream.\n The BufferedWriter object \n */\n try ( PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(newFile)))) {\n for (PickUp pck : pickups) {\n out.print(pck);\n }\n\n } catch (IOException e) {\n System.err.println(e);\n }\n\n }", "public <T> String SerializeXml(T obj, String pathToRoot){\n this.lastPath = pathToRoot + obj.getClass().getSimpleName().toLowerCase() + \"_object-\" + Math.abs(new Random().nextLong()) + \".xml\";\n\n XmlMapper xmlMapper = new XmlMapper();\n xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);\n xmlMapper.registerModule(new JavaTimeModule());\n xmlMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);\n\n File file = new File(this.lastPath);\n\n try {\n file.createNewFile();\n xmlMapper.writeValue(file, obj);\n System.out.println(xmlMapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj));\n return xmlMapper.writeValueAsString(obj);\n } catch (IOException e) {\n e.printStackTrace();\n }\n return \"\";\n }", "public void dump( Result out ) throws JAXBException;", "public static String toXMLString(Object obj) {\r\n if (obj == null) {\r\n return null;\r\n }\r\n\r\n String pkgName = obj.getClass().getPackage().getName();\r\n try {\r\n if (!entityMarshallers.containsKey(pkgName)) {\r\n JAXBContext jc = JAXBContext.newInstance(pkgName);\r\n entityMarshallers.put(pkgName, jc.createMarshaller());\r\n entityMarshallerLock.put(pkgName, new Object());\r\n }\r\n\r\n StringWriter sw = new StringWriter();\r\n Marshaller marshaller = entityMarshallers.get(pkgName);\r\n Object locker = entityMarshallerLock.get(pkgName);\r\n\r\n synchronized (locker) {\r\n marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Configuration.getBoolean(Constant.CONFIG_KEY.PCM_XML_PRETTY_PRINT));\r\n marshaller.marshal(obj, sw);\r\n }\r\n\r\n return sw.toString();\r\n\r\n } catch (Exception e) {\r\n Logger.defaultLogger.error(e.getMessage(), e);\r\n }\r\n return \"\";\r\n }", "@Override\n public void marshal(T object, XMLStreamWriter output,\n AttachmentMarshaller am) throws JAXBException {\n try {\n output.flush();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n SAX2StaxContentHandler handler = new SAX2StaxContentHandler(output);\n if (object instanceof DataObject) {\n serializeDataObject((DataObject) object, new SAXResult(handler),\n am);\n return;\n }\n\n try {\n String value = serializePrimitive(object, javaType);\n String prefix = output.getPrefix(xmlTag.getNamespaceURI());\n //TODO, this is a hack, seems to be wrong. why should namespace returned is \"\"?\n if (xmlTag.getNamespaceURI().equals(\"\")) {\n output.writeStartElement(\"\", xmlTag.getLocalPart(), xmlTag.getNamespaceURI());\n// } else if (prefix == null) {\n// output.writeStartElement(xmlTag.getNamespaceURI(), xmlTag.getLocalPart());\n } else {\n output.writeStartElement(prefix, xmlTag.getLocalPart(), xmlTag.getNamespaceURI());\n output.writeNamespace(prefix, xmlTag.getNamespaceURI());\n }\n output.writeCharacters(value);\n output.writeEndElement();\n } catch (XMLStreamException e) {\n throw new SDODatabindingException(e);\n }\n }", "public String toXml() {\n\t\treturn(toString());\n\t}", "Document toXml() throws ParserConfigurationException, TransformerException, IOException;", "protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n super.toXML(out, getXMLElementTagName());\n }", "public void toXML(FreeColXMLWriter xw) throws XMLStreamException {\n xw.writeStartElement(getTagName());\n\n xw.writeAttribute(FreeColObject.ID_ATTRIBUTE_TAG,\n (AIObject)getTransportable());\n\n xw.writeAttribute(CARRIER_TAG, getCarrier());\n\n xw.writeAttribute(TRIES_TAG, getTries());\n\n xw.writeAttribute(SPACELEFT_TAG, getSpaceLeft());\n\n if (plan.twait != null) {\n xw.writeLocationAttribute(TWAIT_TAG, plan.twait);\n }\n\n if (plan.cwait != null) {\n xw.writeLocationAttribute(CWAIT_TAG, plan.cwait);\n }\n\n if (plan.cdst != null) {\n xw.writeLocationAttribute(CDST_TAG, plan.cdst);\n }\n\n if (plan.tdst != null) {\n xw.writeLocationAttribute(TDST_TAG, plan.tdst);\n }\n\n xw.writeAttribute(TURNS_TAG, plan.turns);\n\n xw.writeAttribute(MODE_TAG, plan.mode);\n\n xw.writeAttribute(FALLBACK_TAG, plan.fallback);\n\n xw.writeEndElement();\n }", "public static String xmlMarshall(Object obj) throws Exception {\n\t\tStringWriter writer = null;\n\t\ttry {\n\t\t\tJAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass());\n\t\t\tMarshaller marshaller = jaxbContext.createMarshaller();\n\t\t\twriter = new StringWriter();\n\n\t\t\tmarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);\n\t\t\tmarshaller.setProperty(Marshaller.JAXB_ENCODING, \"UTF-8\");\n\t\t\tmarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\t\t\tmarshaller.marshal(obj, writer);\n\t\t\tString result = writer.toString();\n\t\t\treturn result;\t\t\n\t\t}finally {\n\t\t\tif (writer != null)\n\t\t\t\twriter.close();\n\t\t}\t\t\n\t}", "public String printToXml()\n {\n XMLOutputter outputter = new XMLOutputter();\n outputter.setFormat(org.jdom.output.Format.getPrettyFormat());\n return outputter.outputString(this.toXml());\n }", "static <T> T printLogAndReturn(Object obj) throws JAXBException {\n StringWriter writer = new StringWriter();\n // create JAXBContext which will be used to update writer\n JAXBContext context = JAXBContext.newInstance(obj.getClass());\n // marshall or convert jaxbElement containing student to xml format\n context.createMarshaller().marshal(obj, writer);\n // print XML string representation of Student object\n System.out.println(writer.toString());\n return (T) obj;\n }", "public static void main(String[]args){\n XMLOutputter out = new XMLOutputter();\n SAXBuilder sax = new SAXBuilder();\n\n //Objekte die gepseichert werden sollen\n Car car = new Car(\"CR-MD-5\",\"16.05.1998\",4,4,4);\n Car car2 = new Car(\"UL-M-5\",\"11.03.2002\",10,2,5);\n\n\n Element rootEle = new Element(\"cars\");\n Document doc = new Document(rootEle);\n\n //hinzufuegen des ersten autos\n Element carEle = new Element(\"car\");\n carEle.setAttribute(new Attribute(\"car\",\"1\"));\n carEle.addContent(new Element(\"licenseplate\").setText(car.getLicensePlate()));\n carEle.addContent(new Element(\"productiondate\").setText(car.getProductionDate()));\n carEle.addContent(new Element(\"numberpassengers\").setText(Integer.toString(car.getNumberPassengers())));\n carEle.addContent(new Element(\"numberwheels\").setText(Integer.toString(car.getNumberWheels())));\n carEle.addContent(new Element(\"numberdoors\").setText(Integer.toString(car.getNumberDoors())));\n\n //hinzufuegen des zweiten autos\n Element carEle2 = new Element(\"car2\");\n carEle2.setAttribute(new Attribute(\"car2\",\"2\"));\n carEle2.addContent(new Element(\"licenseplate\").setText(car2.getLicensePlate()));\n carEle2.addContent(new Element(\"productiondate\").setText(car2.getProductionDate()));\n carEle2.addContent(new Element(\"numberpassengers\").setText(Integer.toString(car2.getNumberPassengers())));\n carEle2.addContent(new Element(\"numberwheels\").setText(Integer.toString(car2.getNumberWheels())));\n carEle2.addContent(new Element(\"numberdoors\").setText(Integer.toString(car2.getNumberDoors())));\n\n\n doc.getRootElement().addContent(carEle);\n doc.getRootElement().addContent(carEle2);\n\n //Einstellen des Formates auf gut lesbares, eingeruecktes Format\n out.setFormat(Format.getPrettyFormat());\n //Versuche in xml Datei zu schreiben\n try {\n out.output(doc, new FileWriter(\"SaveCar.xml\"));\n } catch (IOException e) {\n System.out.println(\"Error opening File\");\n }\n\n\n //Einlesen\n\n File input = new File(\"SaveCar.xml\");\n Document inputDoc = null;\n //Versuche aus xml Datei zu lesen und Document zu instanziieren\n try {\n inputDoc = (Document) sax.build(input);\n } catch (JDOMException e) {\n System.out.println(\"An Error occured\");\n } catch (IOException e) {\n System.out.print(\"Error opening File\");\n }\n\n //Liste von Elementen der jeweiligen Autos\n List<Element> listCar = inputDoc.getRootElement().getChildren(\"car\");\n List<Element> listCar2 = inputDoc.getRootElement().getChildren(\"car2\");\n\n //Ausgabe der Objekte auf der Konsole (manuell)\n printXML(listCar);\n System.out.println();\n printXML(listCar2);\n\n //Erstellen der abgespeicherten Objekte\n Car savedCar1 = createObj(listCar);\n Car savedCar2 = createObj(listCar2);\n\n System.out.println();\n System.out.println(savedCar1);\n System.out.println();\n System.out.println(savedCar2);\n\n}", "public void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n // Start element:\n out.writeStartElement(getXMLElementTagName());\n\n //out.writeAttribute(ID_ATTRIBUTE_TAG, getId());\n out.writeAttribute(\"nationalAdvantages\", nationalAdvantages.toString());\n out.writeStartElement(\"Nations\");\n for (Map.Entry<Nation, NationState> entry : nations.entrySet()) {\n out.writeStartElement(\"Nation\");\n out.writeAttribute(ID_ATTRIBUTE_TAG, entry.getKey().getId());\n out.writeAttribute(\"state\", entry.getValue().toString());\n out.writeEndElement();\n }\n out.writeEndElement();\n\n out.writeEndElement();\n }", "protected static boolean writeXMLType(Output out, Object xml) {\n log.trace(\"writeXMLType\");\n // If it's a Document write it as Document\n if (xml instanceof Document) {\n writeDocument(out, (Document) xml);\n } else {\n return false;\n }\n return true;\n }", "public void write(Object o)\r\n throws IOException, XmlPullParserException\r\n {\n if(o instanceof XmlNode) {\r\n\t writeNode((XmlNode)o);\r\n } else if(o instanceof XmlStartTag) {\r\n\t writeStartTag((XmlStartTag)o);\r\n } else if(o instanceof XmlEndTag) {\r\n\t writeEndTag((XmlEndTag)o);\r\n } else if(o instanceof XmlWritable) {\r\n\t ((XmlWritable)o).writeXml(out);\r\n } else {\r\n\t if(o != null) {\r\n\t\twriteContent(o.toString());\r\n\t } else {\r\n\t\t//silenty ignore null values\r\n\t }\r\n\t}\r\n }", "protected abstract ArrayList<Element> _toXml_();", "public String toXML() {\n return null;\n }", "public void writeXML(InvCatalogImpl catalog, OutputStream os) throws IOException {\r\n // Output the document, use standard formatter\r\n //XMLOutputter fmt = new XMLOutputter();\r\n //fmt.setNewlines(true);\r\n //fmt.setIndent(\" \");\r\n //fmt.setTrimAllWhite( true);\r\n XMLOutputter fmt = new XMLOutputter(org.jdom.output.Format.getPrettyFormat()); // LOOK maybe compact ??\r\n fmt.output(writeCatalog(catalog), os);\r\n }", "public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {\n final Writer writer = new StringWriter();\n try {\n toXML(xstream, obj, writer);\n } catch (final ObjectStreamException e) {\n throw e;\n } catch (final IOException e) {\n throw new StreamException(\"Unexpected IO error from a StringWriter\", e);\n }\n return writer.toString();\n }", "protected abstract Element toXmlEx(Document doc);", "String toXML() throws RemoteException;", "public void save() {\n int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);\r\n int minute = Calendar.getInstance().get(Calendar.MINUTE);\r\n\r\n // Hierarchie: 2010/04/05/01_05042010_00002.xml\r\n File dir = getOutputDir();\r\n File f = new File(dir, getCode().replace(' ', '_') + \".xml\");\r\n Element topLevel = new Element(\"ticket\");\r\n topLevel.setAttribute(new Attribute(\"code\", this.getCode()));\r\n topLevel.setAttribute(\"hour\", String.valueOf(hour));\r\n topLevel.setAttribute(\"minute\", String.valueOf(minute));\r\n // Articles\r\n for (Pair<Article, Integer> item : this.items) {\r\n Element e = new Element(\"article\");\r\n e.setAttribute(\"qte\", String.valueOf(item.getSecond()));\r\n // Prix unitaire\r\n e.setAttribute(\"prix\", String.valueOf(item.getFirst().getPriceInCents()));\r\n e.setAttribute(\"prixHT\", String.valueOf(item.getFirst().getPriceHTInCents()));\r\n e.setAttribute(\"idTaxe\", String.valueOf(item.getFirst().getIdTaxe()));\r\n e.setAttribute(\"categorie\", item.getFirst().getCategorie().getName());\r\n e.setAttribute(\"codebarre\", item.getFirst().getCode());\r\n e.setText(item.getFirst().getName());\r\n topLevel.addContent(e);\r\n }\r\n // Paiements\r\n for (Paiement paiement : this.paiements) {\r\n final int montantInCents = paiement.getMontantInCents();\r\n if (montantInCents > 0) {\r\n final Element e = new Element(\"paiement\");\r\n String type = \"\";\r\n if (paiement.getType() == Paiement.CB) {\r\n type = \"CB\";\r\n } else if (paiement.getType() == Paiement.CHEQUE) {\r\n type = \"CHEQUE\";\r\n } else if (paiement.getType() == Paiement.ESPECES) {\r\n type = \"ESPECES\";\r\n }\r\n e.setAttribute(\"type\", type);\r\n e.setAttribute(\"montant\", String.valueOf(montantInCents));\r\n topLevel.addContent(e);\r\n }\r\n\r\n }\r\n try {\r\n final XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());\r\n out.output(topLevel, new FileOutputStream(f));\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n\r\n }", "public String toXML() {\n return null;\n }", "public JodaBeanXmlWriter xmlWriter() {\n return new JodaBeanXmlWriter(this);\n }", "private void write(){\n\t\ttry {\n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance();\n\t\t\tTransformer transformer = transformerFactory.newTransformer();\n\t\t\tDOMSource source = new DOMSource(doc);\n\t\t\t\n\t\t\tString pathSub = ManipXML.class.getResource(path).toString();\n\t\t\tpathSub = pathSub.substring(5, pathSub.length());\n\t\t\tStreamResult result = new StreamResult(pathSub);\n\t\t\t\n\t\t\ttransformer.transform(source, result);\n\t\t} catch (TransformerConfigurationException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (TransformerException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void writeXML(String xml){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t\tDocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); \n\t\t\tDocumentBuilder documentBuilder = documentFactory.newDocumentBuilder(); \n\t\t\t// define root elements \n\t\t\tDocument document = documentBuilder.newDocument(); \n\t\t\tElement rootElement = document.createElement(\"graph\"); \n\t\t\tdocument.appendChild(rootElement);\n\t\t\t\n\t\t\tfor(int i=0;i<Rel.getChildCount();i++){\n\t\t\t\tif(Rel.getChildAt(i).getTag() != null){\n\t\t\t\t\tif(Rel.getChildAt(i).getTag().toString().compareTo(\"node\") == 0){\n\t\t\t\t\t\tArtifact artifact = (Artifact) Rel.getChildAt(i);\n\t\t\t\t\t\tElement node = addElement(rootElement, \"node\", document);\n\t\t\t\t\t\tElement id = addAttribute(\"id\",artifact.getId()+\"\", document); //we create an attribute for a node\n\t\t\t\t\t\tnode.appendChild(id);//and then we attach it to the node\n\t\t\t\t\t\t\n\t\t\t\t\t\tArrayList <Artifact> fathers = artifact.getFathers();\n\t\t\t\t\t\tif(fathers != null){\n\t\t\t\t\t\t\taddElement(node, \"fathers\", document);//for complex attribute like array of fathers we add an element to the node\n\t\t\t\t\t\t\tfor(int j=0;j<fathers.size();j++){\n\t\t\t\t\t\t\t\tElement father = addAttribute(\"father\",fathers.get(j).getId()+\"\", document);//inside this element created in the node we add all its fathers as attributes\n\t\t\t\t\t\t\t\tnode.appendChild(father);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tArrayList <Artifact> sons = artifact.getSons();\n\t\t\t\t\t\tif(sons != null){\n\t\t\t\t\t\t\taddElement(node, \"sons\", document);//for complex attribute like array of sons we add an element to the node\n\t\t\t\t\t\t\tfor(int j=0;j<sons.size();j++){\n\t\t\t\t\t\t\t\tElement son = addAttribute(\"son\",sons.get(j).getId()+\"\", document);//inside this element created in the node we add all its sons as attributes\n\t\t\t\t\t\t\t\tnode.appendChild(son);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement label = addAttribute(\"label\", artifact.getText()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(label);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement age = addAttribute(\"age\", artifact.getAge()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(age);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement type = addAttribute(\"type\", artifact.getType()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(type);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement information = addAttribute(\"information\", artifact.getInformation()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(information);\n\t\t\t\t\t\t\n\t\t\t\t\t\tElement position = addAttribute(\"position\", artifact.getPosition()+\"\", document);\n\t\t\t\t\t\tnode.appendChild(position);\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t// creating and writing to xml file \n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance(); \n\t\t\tTransformer transformer = transformerFactory.newTransformer(); \n\t\t\tDOMSource domSource = new DOMSource(document); \n\t\t\tStreamResult streamResult = new StreamResult(new File(xml)); \n\t\t\ttransformer.transform(domSource, streamResult);\n \n \n }catch(Exception e){\n \tLog.v(\"error writing xml\",e.toString());\n }\n\t\t\n\t\t\n\t}", "public Element toXml(Document doc)\n {\n if (null == doc)\n throw new IllegalArgumentException(\"Must provide a valid Document\");\n Element root = doc.createElement(XML_NODE_NAME);\n root.setAttribute(XML_NAME_ATTR, m_name);\n if (m_displayName.length() > 0)\n root.setAttribute(XML_DISPLAYNAME_ATTR, m_displayName);\n root.setAttribute(XML_DIMENSION_ATTR, m_dimension);\n root.setAttribute(XML_CHOICESET_ATTR, m_choiceSet);\n if (m_description.length() > 0)\n PSXmlDocumentBuilder.addElement(doc, root, XELEM_DESCRIPTION,\n m_description);\n\n // psxctl:ParamList\n if (m_params.size() > 0)\n {\n Element paramList = doc.createElement( XELEM_PARAMLIST );\n for (Iterator iter = m_params.iterator(); iter.hasNext();)\n {\n PSControlParameter param = (PSControlParameter) iter.next();\n paramList.appendChild(param.toXml(doc));\n }\n root.appendChild(paramList);\n }\n\n // psxctl:AssociatedFileList\n if (m_files.size() > 0)\n {\n Element files = doc.createElement( XELEM_FILES );\n for (Iterator iter = m_files.iterator(); iter.hasNext();)\n {\n PSFileDescriptor file = (PSFileDescriptor) iter.next();\n files.appendChild( file.toXml( doc ) );\n }\n root.appendChild(files);\n }\n\n // psxctl:Dependencies\n if (m_dependencies.size() > 0)\n {\n Element dependencies = doc.createElement( XELEM_DEPENDENCIES );\n for (Iterator iter = m_dependencies.iterator(); iter.hasNext();)\n {\n PSDependency dependency = (PSDependency) iter.next();\n dependencies.appendChild( dependency.toXml( doc ) );\n }\n root.appendChild(dependencies);\n }\n\n return root;\n }", "public interface IXMLWriter {\n\n /**\n * @param game to serialize and output\n * @param outputFile to write to\n */\n void convertXMLToGame (IGame game, File outputFile);\n}", "public String getXML() {\n\t\tString xml = \"\";\n\t\ttry {\n\t\t\tJAXBContext jc = JAXBContext.newInstance( VolumeRs.class );\n\t\t\tMarshaller m = jc.createMarshaller();\n\t\t\tStringWriter stringWriter = new StringWriter();\n\t\t\tm.marshal(this, stringWriter);\n\t\t\txml = stringWriter.toString();\n\t\t} catch (JAXBException ex) {}\n\t\treturn xml;\n\t}", "void write(Writer out, boolean escapeXML) throws IOException;", "protected static void writeXML(String path, String ID, String abs,String cls) {\n\t\tDocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\r\n DocumentBuilder dBuilder;\r\n try {\r\n dBuilder = dbFactory.newDocumentBuilder();\r\n Document doc = dBuilder.newDocument();\r\n //add elements to Document\r\n Element rootElement =doc.createElement(\"Data\");\r\n //append root element to document\r\n doc.appendChild(rootElement);\r\n\r\n rootElement.appendChild(getReviewsPositive(doc, ID, abs,cls));\r\n //for output to file, console\r\n TransformerFactory transformerFactory = TransformerFactory.newInstance();\r\n Transformer transformer = transformerFactory.newTransformer();\r\n //for pretty print\r\n transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");\r\n DOMSource source = new DOMSource(doc);\r\n\r\n //write to console or file\r\n StreamResult console = new StreamResult(System.out);\r\n StreamResult file = new StreamResult(new File(path+\"\"+ID+\".xml\"));\r\n\r\n //write data\r\n transformer.transform(source, console);\r\n transformer.transform(source, file);\r\n //System.out.println(\"DONE\");\r\n\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n\t}", "public interface XMLObject {\n public XMLObject getXMLObject();\n}", "public static void createXmlNote() throws JAXBException {\n Staff staff = new Staff();\n\n //Creating xml root node;\n //Create JAXB context and instantiate marshaller;\n JAXBContext jaxbContext = JAXBContext.newInstance(Staff.class);\n // Marshaller : Java Object to XML content\n Marshaller jaxbMarshaller = jaxbContext.createMarshaller();\n jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n jaxbMarshaller.marshal(staff, new File(\"test.xml\"));\n }", "protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n toXML(out, getXMLElementTagName());\n }", "void writeObject(OutputSerializer out) throws java.io.IOException;", "protected String getXML() {\n\n StringBuffer b = new StringBuffer(\"title =\\\"\");\n b.append(title);\n b.append(\"\\\" xAxisTitle=\\\"\");\n b.append(xAxisTitle);\n b.append(\"\\\" yAxisTitle=\\\"\");\n b.append(yAxisTitle);\n b.append(\"\\\" xRangeMin=\\\"\");\n b.append(xRangeMin);\n b.append(\"\\\" xRangeMax=\\\"\");\n b.append(xRangeMax);\n b.append(\"\\\" xRangeIncr=\\\"\");\n b.append(xRangeIncr);\n b.append(\"\\\" yRangeMin=\\\"\");\n b.append(yRangeMin);\n b.append(\"\\\" yRangeMax=\\\"\");\n b.append(yRangeMax);\n b.append(\"\\\" yRangeIncr=\\\"\");\n b.append(yRangeIncr);\n b.append(\"\\\" >\\n\");\n\n for (int i = 0, n = dataSources.size(); i < n; i++) {\n GuiChartDataSource ds = (GuiChartDataSource)dataSources.get(i);\n b.append(ds.toXML());\n b.append(\"\\n\");\n }\n\n return b.toString();\n }", "public String getXML() //Perhaps make a version of this where the header DTD can be manually specified\n { //Also allow changing of generated tags to user specified values\n \n String xml = new String();\n xml= \"<?xml version = \\\"1.0\\\"?>\\n\";\n xml = xml + generateXML();\n return xml;\n }", "public String toXML()\n\t{\n\t\treturn toXML(0);\n\t}", "public String toXML()\n\t{\n\t\treturn toXML(0);\n\t}", "public void createXml(String fileName) { \n\t\tElement root = this.document.createElement(\"TSETInfoTables\"); \n\t\tthis.document.appendChild(root); \n\t\tElement metaDB = this.document.createElement(\"metaDB\"); \n\t\tElement table = this.document.createElement(\"table\"); \n\t\t\n\t\tElement column = this.document.createElement(\"column\");\n\t\tElement columnName = this.document.createElement(\"columnName\");\n\t\tcolumnName.appendChild(this.document.createTextNode(\"test\")); \n\t\tcolumn.appendChild(columnName); \n\t\tElement columnType = this.document.createElement(\"columnType\"); \n\t\tcolumnType.appendChild(this.document.createTextNode(\"INTEGER\")); \n\t\tcolumn.appendChild(columnType); \n\t\t\n\t\ttable.appendChild(column);\n\t\tmetaDB.appendChild(table);\n\t\troot.appendChild(metaDB); \n\t\t\n\t\tTransformerFactory tf = TransformerFactory.newInstance(); \n\t\ttry { \n\t\t\tTransformer transformer = tf.newTransformer(); \n\t\t\tDOMSource source = new DOMSource(document); \n\t\t\ttransformer.setOutputProperty(OutputKeys.ENCODING, \"gb2312\"); \n\t\t\ttransformer.setOutputProperty(OutputKeys.INDENT, \"yes\"); \n\t\t\tPrintWriter pw = new PrintWriter(new FileOutputStream(fileName)); \n\t\t\tStreamResult result = new StreamResult(pw); \n\t\t\ttransformer.transform(source, result); \n\t\t\tlogger.info(\"Generate XML file success!\");\n\t\t} catch (TransformerConfigurationException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (IllegalArgumentException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (FileNotFoundException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} catch (TransformerException e) { \n\t\t\tlogger.error(e.getMessage());\n\t\t} \n\t}", "private void write( TypeItem type ) throws SAXException, IOException {\n\t\t\t\t\n\t\tDocumentHandler outHandler = new XMLSerializer(\n\t\t\tcontroller.getOutput(type),\n\t\t\tnew OutputFormat(\"xml\",null,true) );\n\t\tXMLWriter out = new XMLWriter(outHandler);\n\t\t\t\t\n\t\toutHandler.setDocumentLocator( new LocatorImpl() );\n\t\toutHandler.startDocument();\n\t\toutHandler.processingInstruction(\"xml-stylesheet\",\n\t\t\t\"type='text/xsl' href='classFileDebug.xsl'\");\n\t\twriteClass( type, out );\n\t\toutHandler.endDocument();\n\t}", "@Test\n\tpublic void testWrite(){\n\t\tGameWorld gw = getGameWorld();\n\t\ttry{\n\t\t\tXMLWriter writer = new XMLWriter(\"testWrite\");\n\t\t\twriter.write(gw);\n\t\t\twriter.close();\n\t\t} catch(FileNotFoundException e){\n\t\t\te.printStackTrace();\n\t\t\tfail(\"XMLWriter, testWrite.xml not found\");\n\t\t} catch(IntrospectionException e){\n\t\t\te.printStackTrace();\n\t\t\tfail(\"XMLWriter, introspection failure\");\n\t\t}\n\t}", "public void savetoxml() throws FileNotFoundException, JAXBException {\n xml_methods.save(player);\n }", "public String getXML() {\n\t\tString xml = \"\";\n\t\ttry {\n\t\t\tJAXBContext jc = JAXBContext.newInstance( QuotaUserRs.class );\n\t\t\tMarshaller m = jc.createMarshaller();\n\t\t\tStringWriter stringWriter = new StringWriter();\n\t\t\tm.marshal(this, stringWriter);\n\t\t\txml = stringWriter.toString();\n\t\t} catch (JAXBException ex) {}\n\t\treturn xml;\n\t}", "@Override\r\n public boolean save(Object object, String fileName)\r\n throws FileAlreadyExistsException, IOException, JAXBException {\n File outputFile = new File(fileName);\r\n FileWriter fstream = new FileWriter(outputFile);\r\n BufferedWriter xmlOutputWriter = new BufferedWriter(fstream);\r\n \r\n if(!this.enableOverwrite && outputFile.exists()) {\r\n throw new FileAlreadyExistsException(fileName);\r\n }\r\n \r\n try {\r\n this.jaxbObjectToXML(object, xmlOutputWriter);\r\n } finally {\r\n xmlOutputWriter.close();\r\n } \r\n \r\n return (outputFile.length() > 0);\r\n }", "public String toXml() {\n StringWriter outputStream = new StringWriter();\n try {\n PrintWriter output = new PrintWriter(outputStream);\n try {\n output.write(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\n toXml(output);\n return outputStream.toString();\n }\n catch (Exception ex) {\n Logger logger = Logger.getLogger(this.getClass());\n logger.error(ex);\n throw new EJBException(ex);\n }\n finally {\n output.close();\n }\n }\n finally {\n try {\n outputStream.close();\n }\n catch (IOException ex) {\n Logger logger = Logger.getLogger(this.getClass());\n logger.error(ex);\n throw new EJBException(ex);\n }\n }\n }", "public void exportPropertiesToXML(PropertySet properties, String xmlPath){\n\t\t\n\t\t\n\t\ttry {\n\n\t\t\t//Call the method to get the root element of this document\n\t\t\tElement root = createJDOMRepresentation(properties);\n\t\t\t\n\t\t\t//Create an XML Outputter\n\t\t\tXMLOutputter outputter = new XMLOutputter();\n\t\t\t\n\t\t\t//Set the format of the outputted XML File\n\t\t\tFormat format = Format.getPrettyFormat();\n\t\t\toutputter.setFormat(format);\n\t\t\t\n\t\t\t//Output the XML File to standard output and the desired file\n\t\t\tFileWriter filew = new FileWriter(xmlPath);\n\t\t\t//outputter.output(root, System.out);\n\t\t\toutputter.output(root, filew);\n\t\t\t\n\t\t} catch (IOException e){\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t}", "@Override\r\n protected XMLSave createXMLSave() {\r\n prepareSave();\r\n return super.createXMLSave();\r\n }", "String toXmlString() throws IOException;", "public abstract OMElement serialize();", "private Element createXmlElementForObject(ObjectExtValue object, Document xmlDocument, Constraint constraint) {\n\t\tElement element = xmlDocument.createElement(XML_OBJECT);\n\t\t\n\t\tArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();\n\t\tfor (Iterator<Map.Entry<Value,Value>> iter = ((EntrySet) object.entrySet()).iterator(); iter.hasNext(); ) {\n\t\t\tMap.Entry<Value, Value> pair = iter.next();\n\t\t\tpairs.add(new NameValuePair(pair.getKey(), pair.getValue()));\n\t\t}\n\t\t\t\n\t\tCollections.sort(pairs, SortNameValuePairByName.inst);\n\t\t\n\t\tfor (NameValuePair pair : pairs) {\n\t\t\tElement childElement = createXmlElementForNameValuePair(pair.getName(), pair.getValue(), xmlDocument, constraint);\n\t\t\tif (childElement != null)\n\t\t\t\telement.appendChild(childElement);\n\t\t}\n\n\t\treturn (element.hasChildNodes() ? element : null);\n\t}", "@SuppressWarnings( { \"incomplete-switch\", \"rawtypes\", \"unchecked\" } )\n XmlElement objectToXml(Object o)\n {\n ElementType type = m_simpleTypes.get(o.getClass());\n if (type != null)\n {\n switch (type)\n {\n case REAL:\n return new XmlElement(\"real\", o.toString());\n case INTEGER:\n return new XmlElement(\"integer\", o.toString());\n case TRUE:\n return new XmlElement(((Boolean) o).booleanValue() ? \"true\" : \"false\");\n case DATE:\n return new XmlElement(\"date\", m_dateFormat.format((Date) o));\n case STRING:\n return new XmlElement(\"string\", (String) o);\n case DATA:\n return new XmlElement(\"data\", base64encode((byte[]) o));\n }\n }\n if (o instanceof Map)\n {\n return toXmlDict((Map) o);\n }\n else if (o instanceof List)\n {\n return toXmlArray((List) o);\n }\n else throw new RuntimeException(\"Cannot use \" + o.getClass() + \" in plist.\");\n }", "public static <T> String toXML(T object, String alias) {\r\n\t\tif (object == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"Object cannot be null\");\r\n\t\t}\r\n\t\tif (alias == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"Alais cannot be null\");\r\n\t\t}\r\n\t\tXStream xStream = new XStream();\r\n\t\txStream.alias(alias, object.getClass());\r\n\t\tStringWriter writer = new StringWriter();\r\n\t\txStream.toXML(object, writer);\r\n\t\treturn writer.toString();\r\n\t}", "@Get(\"xml\")\n public Representation toXml() {\n\n \tString status = getRequestFlag(\"status\", \"valid\");\n \tString access = getRequestFlag(\"location\", \"all\");\n\n \tList<Map<String, String>> metadata = getMetadata(status, access,\n \t\t\tgetRequestQueryValues());\n \tmetadata.remove(0);\n\n List<String> pathsToMetadata = buildPathsToMetadata(metadata);\n\n String xmlOutput = buildXmlOutput(pathsToMetadata);\n\n // Returns the XML representation of this document.\n StringRepresentation representation = new StringRepresentation(xmlOutput,\n MediaType.APPLICATION_XML);\n\n return representation;\n }", "public java.lang.String getXml();", "public void xmlPresentation () {\n System.out.println ( \"****** XML Data Module ******\" );\n ArrayList<Book> bookArrayList = new ArrayList<Book>();\n Books books = new Books();\n books.setBooks(new ArrayList<Book>());\n\n bookArrayList = new Request().postRequestBook();\n\n for (Book aux: bookArrayList) {\n books.getBooks().add(aux);\n }\n\n try {\n javax.xml.bind.JAXBContext jaxbContext = JAXBContext.newInstance(Books.class);\n Marshaller jaxbMarshaller = jaxbContext.createMarshaller();\n\n jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\n jaxbMarshaller.marshal(books, System.out);\n } catch (JAXBException e) {\n System.out.println(\"Error: \"+ e);\n }\n ClientEntry.showMenu ( );\n }", "private void exportarXML(){\n \n String nombre_archivo=IO_ES.leerCadena(\"Inserte el nombre del archivo\");\n String[] nombre_elementos= {\"Modulos\", \"Estudiantes\", \"Profesores\"};\n Document doc=XML.iniciarDocument();\n doc=XML.estructurarDocument(doc, nombre_elementos);\n \n for(Persona estudiante : LEstudiantes){\n estudiante.escribirXML(doc);\n }\n for(Persona profesor : LProfesorado){\n profesor.escribirXML(doc);\n }\n for(Modulo modulo: LModulo){\n modulo.escribirXML(doc);\n }\n \n XML.domTransformacion(doc, RUTAXML, nombre_archivo);\n \n }", "public void toXMLImpl(XMLStreamWriter out) throws XMLStreamException {\n super.toXML(out, getXMLElementTagName());\n }", "public File makeXML(String key, int layerID, String value1, String time1, int totalCopies1, int copyNum1, boolean timerType1, String userId, String time, Certificate cert) {\n\n try {\n\n DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();\n\n DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();\n\n Document document = documentBuilder.newDocument();\n\n Element key1 = document.createElement(\"Search_Result_for\" + key);\n document.appendChild(key1);\n key1.setAttribute(\"Key\", key);\n\n Element layerid = document.createElement(\"layerid\");\n\n key1.appendChild(layerid);\n layerid.setAttribute(\"Id\", String.valueOf(layerID));\n\n Element Value = document.createElement(\"Value\");\n Value.appendChild(document.createTextNode(value1));\n layerid.appendChild(Value);\n\n Element timer = document.createElement(\"timer\");\n timer.appendChild(document.createTextNode(String.valueOf(time1)));\n layerid.appendChild(timer);\n\n Element totcopies = document.createElement(\"totcopies\");\n totcopies.appendChild(document.createTextNode(String.valueOf(totalCopies1)));\n layerid.appendChild(totcopies);\n\n Element copynum = document.createElement(\"copynum\");\n copynum.appendChild(document.createTextNode(String.valueOf(copyNum1)));\n layerid.appendChild(copynum);\n\n Element timertype = document.createElement(\"timertype\");\n timertype.appendChild(document.createTextNode(String.valueOf(timerType1)));\n layerid.appendChild(timertype);\n\n Element userid = document.createElement(\"userid\");\n userid.appendChild(document.createTextNode(userId));\n layerid.appendChild(userid);\n\n Element time2 = document.createElement(\"time\");\n time2.appendChild(document.createTextNode(String.valueOf(time1)));\n layerid.appendChild(time2);\n\n /*Element cert1 = document.createElement(\"cert\");\n cert1.appendChild(document.createTextNode(String.valueOf(cert)));\n layerid.appendChild((Node) cert);*/\n\n // create the xml file\n //transform the DOM Object to an XML File\n TransformerFactory transformerFactory = TransformerFactory.newInstance();\n Transformer transformer = transformerFactory.newTransformer();\n DOMSource domSource = new DOMSource(document);\n StreamResult streamResult = new StreamResult(new File(layerID + \"_Search Result for \" + key + \".xml\"));\n\n transformer.transform(domSource, streamResult);\n\n System.out.println(\"Done creating XML File\");\n\n } catch (ParserConfigurationException pce) {\n pce.printStackTrace();\n } catch (TransformerException tfe) {\n tfe.printStackTrace();\n }\n\n File file = new File(layerID + \"_Search Result for \" + key + \".xml\");\n return file;\n }", "public String toXml( String inEncoding )\n\t{\n\t\tDocument doc = DocumentHelper.createDocument();\n\t\tElement root = doc.addElement(getName());\n\t\tappendXml(this,root);\n\t\tStringWriter text = new StringWriter();\n\t\tOutputFormat format = OutputFormat.createPrettyPrint();\n\t\tformat.setEncoding(inEncoding);\n\t\tXMLWriter out = new XMLWriter(text, format);\n\t\ttry\n\t\t{\n\t\t\tout.write(doc);\n\t\t}\n\t\tcatch (IOException ex)\n\t\t{\n\t\t\tthrow new OpenEditRuntimeException(ex);\n\t\t}\n\t\treturn text.toString();\n\t}", "public void createXMLFileForNOC(Report report) {\n\ttry{\n\t\tFile outDir = new File(report.getXmlFilePath()); \n\t\tboolean isDirCreated = outDir.mkdirs();\n\t\tif (isDirCreated)\n\t\t\tlogger.info(\"In FileUploadDownload class fileUpload() method: upload file folder location created.\");\n\t\telse\n\t\t\tlogger.info(\"In FileUploadDownload class fileUpload() method: upload file folder location already exist.\");\n\t\t\n\t\tDocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();\n\t\tDocumentBuilder docBuilder = docFactory.newDocumentBuilder();\n\t\t\n\t\t// root elements\n\t\tDocument doc = docBuilder.newDocument();\n\t\tElement rootElement = doc.createElement(\"root\");\n\t\tdoc.appendChild(rootElement);\n\t\n\t\t\t//for(Student student : report.getStudentList()){\n\t\t\t\t\t\n\t\t\t\tElement studentList = doc.createElement(\"student\");\n\t\t\t\trootElement.appendChild(studentList);\n\t\t\t\t\n\t\t\t\t/*Element schoolname = doc.createElement(\"schoolname\");\n\t\t\t\tschoolname.appendChild(doc.createTextNode((report.getSchoolDetails().getSchoolDetailsName() != null ? report.getSchoolDetails().getSchoolDetailsName() : \"\" )));\n\t\t\t\tstudentList.appendChild(schoolname);*/\n\t\t\t\t\n\t\t\t\tElement academicYear = doc.createElement(\"academicYear\");\n\t\t\t\tacademicYear.appendChild(doc.createTextNode((String) (report.getAcademicYear().getAcademicYearName()!= null ? report.getAcademicYear().getAcademicYearName() : \"\" )));\n\t\t\t\tstudentList.appendChild(academicYear);\n\t\t\t\t\n\t\t\t\tElement roll = doc.createElement(\"roll\");\n\t\t\t\troll.appendChild(doc.createTextNode((report.getReportCode().toString()!=null?report.getReportCode().toString():\"---------\")));\n\t\t\t\tstudentList.appendChild(roll);\n\t\t\t\t\n\t\t\t\tElement studentname = doc.createElement(\"studentname\");\n\t\t\t\tstudentname.appendChild(doc.createTextNode((report.getUpdatedBy()!=null?report.getUpdatedBy():\"---------------\")));\n\t\t\t\tstudentList.appendChild(studentname);\n\t\t\t\n\t\t\t\t\n\t\t\t//}\n\t\t\tTransformerFactory transformerFactory = TransformerFactory.newInstance();\n\t\t\tTransformer transformer = transformerFactory.newTransformer();\n\t\t\tDOMSource source = new DOMSource(doc);\t\t\n\t\t\tStreamResult result = new StreamResult(new File(report.getXmlFilePath()+report.getXmlFileName()));\n\t\t\t\n\t\t\t// Output to console for testing\n\t\t\t// StreamResult result = new StreamResult(System.out);\t\t\t\n\t\t\ttransformer.transform(source, result);\n\t\t}catch (ParserConfigurationException pce) {\n\t\t\tpce.printStackTrace();\n\t\t\tlogger.error(\"\",pce);\n\t\t} catch (TransformerException tfe) {\n\t\t\ttfe.printStackTrace();\n\t\t\tlogger.error(tfe);\n\t\t}\n\t}" ]
[ "0.6904498", "0.6904498", "0.6904498", "0.6811819", "0.67173654", "0.66696966", "0.6630437", "0.6630437", "0.6579164", "0.6572036", "0.65064514", "0.64062136", "0.63893497", "0.63393104", "0.6327431", "0.6308585", "0.63021785", "0.63006294", "0.6248789", "0.6224102", "0.61897224", "0.61164314", "0.611031", "0.6087306", "0.6046633", "0.60394907", "0.6024676", "0.59885675", "0.5969792", "0.59658766", "0.59640443", "0.595096", "0.5948745", "0.5926716", "0.5914506", "0.590804", "0.5905895", "0.58946174", "0.5893019", "0.5883319", "0.58608735", "0.58498627", "0.5847619", "0.5833858", "0.5832483", "0.58311665", "0.582418", "0.5818564", "0.5815558", "0.5814583", "0.5808248", "0.58075887", "0.57989854", "0.57962376", "0.5763789", "0.5762995", "0.5762843", "0.57535875", "0.57446927", "0.5744244", "0.57334805", "0.5730781", "0.57206947", "0.57201195", "0.5708534", "0.57069665", "0.5697786", "0.5694003", "0.5687739", "0.568621", "0.56728464", "0.566078", "0.5657486", "0.5651974", "0.5650533", "0.56377065", "0.563275", "0.563275", "0.5629851", "0.561596", "0.5603592", "0.5603305", "0.55990326", "0.55956", "0.5586411", "0.558249", "0.55793023", "0.55785143", "0.55762744", "0.555744", "0.5546962", "0.5540713", "0.55398834", "0.5528177", "0.55127114", "0.55107385", "0.5505279", "0.5499759", "0.5493183", "0.54697204" ]
0.5555457
90
Create an image file name
private File createImageFile() throws IOException { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); File image = File.createTempFile( imageFileName, /* prefix */ ".jpg", /* suffix */ storageDir /* directory */ ); // Save a file: path for use with ACTION_VIEW intents mCurrentPhotoPath = image.getAbsolutePath(); return image; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private File createImageFileName() throws IOException {\n String timestamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n //there are two types of SimpleDateFormat and Date()\n String prepend = \"JPEG_\" + timestamp + \"_\";\n File imageFile = File.createTempFile(prepend, \".jpg\", mImageFolder);\n mImageFileName = imageFile.getAbsolutePath();\n return imageFile;\n\n }", "public void createNewImageFile(){\n fillNewImage();\n\n try {\n ImageIO.write(newImage, imageFileType, new File(k + \"_Colored_\" + fileName.substring(0,fileName.length() - 4) + \".\" + imageFileType));\n } catch (IOException e){\n e.printStackTrace();\n }\n \n }", "private static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);\n return imageF;\n }", "private static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);\n return imageF;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"MAZE_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);\n return imageF;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\")\n .format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + \"_\";\n File albumF = getAlbumDir();\n File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX,\n albumF);\n return imageF;\n }", "private File createImageFile() throws IOException{\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\"+timeStamp;\n File image = File.createTempFile(imageFileName, \".jpg\", this.savePath);\n \n return image;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "private File createImageFile() throws IOException{\n @SuppressLint(\"SimpleDateFormat\")\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"img_\"+timeStamp+\"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n return File.createTempFile(imageFileName,\".jpg\",storageDir);\n }", "private File createImageFile() throws IOException {\n @SuppressLint({\"NewApi\", \"LocalSuppress\"}) String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault()).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "public String createImageName(File imageFile)\n\t{\n\t\tString name = imageFile.getAbsolutePath();\n\t\t\n\t\t// remove the initial part of the path that is common among all images so that only the relative path within the image folder remains\n\t\t// also remove the file's extension\n\t\tname = name.substring(imageFolder.getAbsolutePath().length() + 1, name.lastIndexOf('.'));\t\t\n\t\treturn name;\n\t}", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(getString(R.string.day_format)).format(new Date());\n String imageFileName = getString(R.string.image_file_prefix) + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(imageFileName, getString(R.string.image_file_format),\n storageDir\n );\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.US).format(new Date());\n String imageFileName = \"perfil_\" + timeStamp + \"_\";\n String outputPath = PATH;\n File storageDir = new File(outputPath);\n if(!storageDir.exists())storageDir.mkdirs();\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException\n {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File imageFile = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return imageFile;\n }", "private String createFileName(){\n \t\n \tString state = Environment.getExternalStorageState();\n \tif(state.equals(Environment.MEDIA_MOUNTED)){ \t\t\n \t\tFile folder = new File(Environment.getExternalStorageDirectory() + \"/ArtCameraPro\");\n \t\tboolean success = true;\n \t\tif (!folder.exists()) {\n \t\t success = folder.mkdir();\n \t\t} \n \t\tString sFileName = Environment.getExternalStorageDirectory() + \"/ArtCameraPro\" + File.separator + System.currentTimeMillis() + \".jpg\";\n \t\treturn sFileName;\n \t\t\n \t}\n \treturn \"\";\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "private static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = MyApplication.getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return image;\n }", "public static String createFotoFileName(String prefix) {\n return prefix + \"_\" + DateUtil.getCurrentDateTimeAsString(\"yyyyMMdd_hhmmss\") + \".jpg\";\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File imageFile = File.createTempFile(imageFileName, \".jpg\", storageDir);\n return imageFile;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp;\n\n String folderName = context.getString(R.string.app_name).toLowerCase();\n\n File path = new File(ContextCompat.getExternalFilesDirs(getActivity(), null)[0]\n .getAbsolutePath() + \"/\" + folderName);\n\n //make sure folder exists\n path.mkdirs();\n\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n path /* directory */\n );\n\n return image;\n }", "private File createImageFile(String imgDir) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = imgDir + File.separator + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\n String mFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File mFile = File.createTempFile(mFileName, \".jpg\", storageDir);\n return mFile;\n }", "@SuppressLint(\"SimpleDateFormat\")\n public static File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = JPEG_FILE_PREFIX + timeStamp + JPEG_FILE_SUFFIX;\n String nameAlbum = Environment.getExternalStorageDirectory().getAbsolutePath() + \"/\" + nameDir;// getString(R.string.app_name);\n File albumF = new File(nameAlbum);\n if (!albumF.exists()) {\n albumF.mkdirs();\n File noMedia = new File(albumF, \".nomedia\");\n noMedia.createNewFile();\n }\n\n File imageF = new File(albumF, imageFileName);\n imageF.createNewFile();\n return imageF;\n }", "private String generateFilename() {\n UUID uuid = UUID.randomUUID();\n return uuid.toString();\n }", "private File createImageFile() throws IOException\n {\n String timeStamp = new SimpleDateFormat(\"yyyymmddHHmmss\").format(new Date());\n String imageFileName = timeStamp;\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n userCacheDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n return image;\n }", "private File createImageFile() {\n\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.getDefault()).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES + APP_PICTURE_DIRECTORY);\n storageDir.mkdirs();\n\n File imageFile = null;\n\n try {\n imageFile = File.createTempFile(\n imageFileName, /* prefix */\n FILE_SUFFIX_JPG, /* suffix */\n storageDir /* directory */\n );\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return imageFile;\n }", "private File createImageFile() {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"GIS\");\n File image = null;\n\n if(!storageDir.exists()){\n\n storageDir.mkdirs();\n\n }\n try {\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }catch (Exception e){\n\n e.printStackTrace();\n\n }\n // Save a file: path for use with ACTION_VIEW intents\n\n return image;\n }", "private String beautiplyFileNameGenerator() {\r\n\t\t// /randomvalue between 0 to 9\r\n\t\tString name = \"beautiply\" + new Random().nextInt(9) + \".png\";\r\n\r\n\t\treturn name;\r\n\t}", "private void createImage (String image_name, int filename){\n\n\t\tString image_folder = getLevelImagePatternFolder();\n\t\t\n\t\tString resource = filename+\".png\";\n\t\tImageIcon ii = new ImageIcon(this.getClass().getResource(image_folder + resource));\n images.put(image_name, ii.getImage());\n\t}", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File imageFile = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return imageFile;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n String z = image.getAbsolutePath();\n return image;\n }", "public String createImageName(String empName) {\n StringBuilder iN = new StringBuilder();\n\n String[] fnLn = empName.split(\" \");\n iN.append(fnLn[0]);\n iN.append(fnLn[fnLn.length-1].substring(0, 1));\n return iN.toString().trim();\n }", "public File createImageFile() {\n // the public picture director\n File picturesDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); // To get pictures directory from android system\n\n // timestamp makes unique name.\n @SuppressLint(\"SimpleDateFormat\") SimpleDateFormat sdf = new SimpleDateFormat(\"yyyyMMdd_HHmmss\");\n String timestamp = sdf.format(new Date());\n\n // put together the directory and the timestamp to make a unique image location.\n File imageFile = new File(picturesDirectory, timestamp + \".jpg\");\n\n return imageFile;\n }", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = mContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n return File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat ( \"yyyyMMdd_HHmmss\" ).format ( new Date () );\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir ( Environment.DIRECTORY_PICTURES );\n File image = File.createTempFile (\n imageFileName , /* prefix */\n \".jpg\" , /* suffix */\n storageDir /* directory */\n );\n\n // luu file: su dung ACTION_VIEW\n pathToFile = image.getAbsolutePath ();\n return image;\n }", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getActivity().getFilesDir();\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n return image;\n }", "protected File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n strAbsolutePath = image.getAbsolutePath();\n Log.e(\"XpathX\", image.getAbsolutePath());\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\n String mFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File mFile = File.createTempFile(mFileName, \".jpg\", storageDir);\n pictureFilePath = mFile.getAbsolutePath();\n return mFile;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"1mind_\" + timeStamp + \".png\";\n File photo = new File(Environment.getExternalStorageDirectory(), imageFileName);\n mCurrentPhotoPath = photo.getAbsolutePath();\n return photo;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\r\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(\r\n imageFileName, // prefix //\r\n \".jpg\", // suffix //\r\n storageDir // directory //\r\n );\r\n\r\n // Save a file: path for use with ACTION_VIEW intents\r\n mPath = image.getAbsolutePath();\r\n return image;\r\n }", "private File createImageFile() throws IOException {\n String imageFileName = new SimpleDateFormat(\"yyyyMMdd-HHmmss\", Locale.ENGLISH).format(new Date());\n String storageDir = Environment.getExternalStorageDirectory() + \"/DokuChat\";\n File dir = new File(storageDir);\n if (!dir.exists())\n dir.mkdir();\n\n image = new File(storageDir + \"/\" + imageFileName + \".jpg\");\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n pictureImagePath = image.getAbsolutePath();\n return image;\n\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new java.util.Date());\n String imageFileName = \"WILDLIFE_JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n //Todo:Este sera el nombre que tendra el archivo\n String imageFileName = \"IMAGE_\" + timeStamp + \"_\";\n //Todo:Ruta donde se almacenara la imagen\n File storageDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n\n //Todo:El tipo de archivo que se almacenara en el directorio\n File image = File.createTempFile(imageFileName,\".jpg\",storageDirectory);\n //Todo: mImageFileLocation sera el valor que se\n mImageFileLocation = image.getAbsolutePath();\n\n return image;\n }", "private File createImageFile() throws IOException\r\n {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = \"MYAPPTEMP_\" + timeStamp + \"_\";\r\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(imageFileName, /* prefix */\r\n \".jpg\", /* suffix */\r\n storageDir /* directory */\r\n );\r\n\r\n return image;\r\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n pictureImagePath = image.getAbsolutePath();\n return image;\n }", "public abstract String getImageSuffix();", "private File createImageFile() {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = new File(utils.getSentImagesDirectory());\n\n File image = null;\n try {\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n // Save a file: path for use with ACTION_VIEW intents\n //LOG.info(\"test place3\");\n try {\n imageFilePath = image.getAbsolutePath();\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n //LOG.info(\"test place4\");\n if (image == null) {\n LOG.info(\"image file is null\");\n } else {\n LOG.info(\"image file is not null path is:\" + imageFilePath);\n }\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".png\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, // prefix\n \".jpg\", // suffix\n storageDir // directory\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = SettingsHelper.getPrivateImageFolder(this);\n if (!storageDir.exists()) {\n storageDir.mkdirs();\n }\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n imageUri = Uri.fromFile(image);\n return image;\n }", "private Image createImage(String image_file) {\n\t\tImage img = new Image(image_file);\n\t\treturn img;\n\t}", "public File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.US).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(getPhotoLocation());\n File image = File.createTempFile(\n imageFileName,\n \".jpg\",\n storageDir\n );\n\n setCurrentPhotoFile(image.getAbsolutePath());\n return image;\n }", "private File createImageFile() throws IOException\n {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"Picko_JPEG\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DOCUMENTS),\"Whatsapp\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n String mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n\n\n }", "public static File createImageFile(Context context, String name) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = name + \"_\" + timeStamp + \"_\";\r\n File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(\r\n imageFileName, /* prefix */\r\n \".jpg\", /* suffix */\r\n storageDir /* directory */\r\n );\r\n return image;\r\n }", "public abstract String createFilename(Entity entity);", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //The directory where to save the file image\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n //The actual image file\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format( new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\" ;\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment. DIRECTORY_PICTURES);\n File image = File. createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private static File createImageFile(Activity activity) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n// File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n// File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n savePhotoPathToSharedPrefs();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n //galleryAddPic();\n return image;\n }", "private File createImageFile() throws IOException {\n Date d = new Date();\n String nameDate = new SimpleDateFormat(\"ddMMyyyy_HHmmss\").format(d);\n this.date = new SimpleDateFormat(\"dd/MM/yyyy\").format(d);\n String imageFileName = \"JPEG_\" + nameDate + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\r\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\r\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\r\n File image = File.createTempFile(\r\n imageFileName, /* prefix */\r\n \".jpg\", /* suffix */\r\n storageDir /* directory */\r\n );\r\n\r\n // Save a file: path for use with ACTION_VIEW intents\r\n mCurrentPhotoPath = image.getAbsolutePath();\r\n return image;\r\n\r\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n photosPaths.add(mCurrentPhotoPath);\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp;\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "public abstract FileName createName(String absolutePath, FileType fileType);", "public String getPhotoFileName() {\n return \"IMG_\" + getId().toString() + \".jpg\";\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n // Create an image file name\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(imageFileName, \".jpg\", storageDir);\n\n // Save a file: path for use with ACTION_VIEW intents\n this.currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n currentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\", Locale.ENGLISH).format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = \"file:\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName,\n \".jpg\",\n storageDir\n );\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "public static File createImageFile(Context ctx) throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = ctx.getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(imageFileName, \".jpg\", storageDir);\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = imageFileName + \"camera.jpg\";\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStoragePublicDirectory(\n Environment.DIRECTORY_DCIM), \"Camera\");\n image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n //This is the directory in which the file will be created. This is the default location of Camera photos\n File storageDir = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name));\n if (!storageDir.exists()){\n storageDir.mkdir();\n }\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n // Save a file: path for using again\n cameraFilePath = \"file://\" + image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n// File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }", "private File createImageFile() throws IOException {\n String timeStamp = new SimpleDateFormat(\"yyyyMMdd_HHmmss\").format(new Date());\n String imageFileName = \"JPEG_\" + timeStamp + \"_\";\n File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);\n File image = File.createTempFile(\n imageFileName, /* prefix */\n \".jpg\", /* suffix */\n storageDir /* directory */\n );\n\n // Save a file: path for use with ACTION_VIEW intents\n mCurrentPhotoPath = image.getAbsolutePath();\n return image;\n }" ]
[ "0.7782615", "0.7292824", "0.6992056", "0.6992056", "0.6943564", "0.6911284", "0.68938434", "0.686538", "0.68592805", "0.68590325", "0.68580544", "0.68443614", "0.67711073", "0.67546785", "0.6751638", "0.6737171", "0.6726197", "0.67170936", "0.67068315", "0.6706409", "0.6694521", "0.6692518", "0.66892946", "0.6665624", "0.6658789", "0.66203934", "0.66164696", "0.6615736", "0.6610864", "0.66096437", "0.6604602", "0.66028416", "0.6600987", "0.65886337", "0.6579357", "0.6576186", "0.65653497", "0.65549564", "0.65421396", "0.65305394", "0.6530493", "0.6523718", "0.6517966", "0.65117127", "0.6505747", "0.6493113", "0.64924705", "0.6475854", "0.6471266", "0.6448684", "0.6419626", "0.64166796", "0.6413514", "0.640042", "0.63892233", "0.6379753", "0.6375813", "0.6375534", "0.6367382", "0.63566", "0.6355329", "0.6345687", "0.6332988", "0.6329631", "0.6329631", "0.6329631", "0.6329631", "0.6329631", "0.63276523", "0.63276523", "0.6326054", "0.6324831", "0.6323436", "0.63181776", "0.6311542", "0.63093704", "0.63077575", "0.630525", "0.6300038", "0.6297278", "0.6296964", "0.6294874", "0.6292948", "0.6289597", "0.62894386", "0.6282458", "0.6281662", "0.62706375", "0.6261314", "0.6258569", "0.62572557", "0.6256673", "0.62541807" ]
0.0
-1
Bundle extras = data.getExtras(); Bitmap bitmap = (Bitmap) extras.get("data"); imgDisplay.setImageBitmap(bitmap);
@Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (requestCode == CAPTURE_IMAGE_REQUEST && resultCode == RESULT_OK) { Bitmap myBitmap = BitmapFactory.decodeFile(photoFile.getAbsolutePath()); imgDisplay.setImageBitmap(myBitmap); textPath.setText(photoFile.getName()); } else { displayMessage(getBaseContext(), "Request cancelled or something went wrong."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\r\n Bitmap b=(Bitmap)data.getExtras().get(\"data\");\r\n i1.setImageBitmap(b);\r\n\r\n }", "@Override\r\nprotected void onActivityResult(int requestCode, int resultCode, Intent vgt) {\n\t\tsuper.onActivityResult(requestCode, resultCode, vgt);\r\n\t\tBitmap bm=(Bitmap) vgt.getExtras().get(\"data\"); //Use only data\r\n\t\tiv.setImageBitmap(bm); \r\n\t}", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (resultCode == RESULT_OK) {\n Bundle extras = data.getExtras();\n Bitmap bmp = (Bitmap) extras.get(\"data\");\n iv.setImageBitmap(bmp);\n }\n super.onActivityResult(requestCode, resultCode, data);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == TAKE_IMAGE && resultCode == RESULT_OK) {\n Bundle extra = data.getExtras();\n bitmap = (Bitmap) extra.get(\"data\");\n saveImage(bitmap);\n imageView.setImageBitmap(bitmap);\n } else if (requestCode == SELECT_IMAGE && resultCode == RESULT_OK) {\n Uri targetUri = data.getData();\n Toast.makeText(getApplicationContext(), targetUri.toString(), Toast.LENGTH_LONG).show();\n Bitmap bitmap;\n try {\n\n bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(targetUri));\n\n imageView.setImageBitmap(bitmap);\n } catch (FileNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){\n Bundle extras = data.getExtras();\n imageBitmap = (Bitmap) extras.get(\"data\");\n imgFoto.setImageBitmap(imageBitmap);\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\n if(requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){\n // Get the photo\n Bundle extras = data.getExtras();\n Bitmap photo = (Bitmap) extras.get(\"data\");\n myImageView.setImageBitmap(photo);\n }\n }", "private void setPicToView(Intent picdata) {\n Bundle extras = picdata.getExtras();\n if (extras != null) {\n Bitmap photo = extras.getParcelable(\"data\");\n Drawable drawable = new BitmapDrawable(getResources(), photo);\n groupSetAvatar.setImageDrawable(drawable);\n // uploadUserAvatar(Bitmap2Bytes(photo));\n saveBitmapFile(picdata);\n\n }\n\n }", "private void showBitmap() {\n Bitmap bitmap = BitmapFactory.decodeByteArray(mImgData, 0, mImgData.length);\n mImgView.setImageBitmap(bitmap);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n if(resultCode == RESULT_OK) {\n imgView.setImageURI(image_uri);\n// image_uri = data.getData();\n// try {\n// InputStream inputStream = getContentResolver().openInputStream(image_uri);\n// bitmap = BitmapFactory.decodeStream(inputStream);\n// imgView.setImageBitmap(bitmap);\n//// imgView.setVisibility(View.VISIBLE);\n//// btnUpload.setVisibility(View.VISIBLE);\n// } catch (IOException e) {\n// e.printStackTrace();\n// }\n// Toast.makeText(GambarActivity.this, \"o\", Toast.LENGTH_SHORT).show();\n }\n// super.onActivityResult(requestCode, resultCode, data);\n }", "public void setImage(){\n\n Bundle extras = getIntent().getExtras();\n String image = extras.getString(\"pic\");\n String imageFlower = extras.getString(\"picflower\");\n\n\n\n if(image != null) {\n int pic = getResources().getIdentifier(image + \".png\",\"drawable\",getPackageName());\n\n achvImage.setImageResource(pic);\n achvImage.setVisibility(View.VISIBLE);\n\n }else {\n int flowerPic = getResources().getIdentifier(imageFlower + \".jpg\", \"drawable\", getPackageName());\n achvImage.setImageResource(flowerPic);\n achvImage.setVisibility(View.VISIBLE);\n }\n\n achvImage.setImageResource(R.drawable.medaldetails);\n\n\n String text = extras.getString(\"text\");\n achvDetails.setText(text);\n\n String title = extras.getString(\"title\");\n achvTitle.setText(title);\n\n int points1 = extras.getInt(\"points\");\n points.setText(\"Points: \" + points1);\n\n\n String desText1 = extras.getString(\"achDesA\");\n des1.setText(desText1);\n\n\n\n\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if(resultCode == RESULT_OK){\n if(requestCode == REQUEST_CODE && data.getExtras().get(\"data\")!=null){\n Bitmap bp = (Bitmap) data.getExtras().get(\"data\");\n prescription.setVisibility(View.VISIBLE);\n userNameQO.setVisibility(View.GONE);\n phoneNo.setVisibility(View.GONE);\n captureButton.setText(getResources().getString(R.string.send_prescription));\n prescription.setImageBitmap(bp);\n }\n }\n }", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\t\tif(requestCode==IMAGE_REQUEST_CODE){\n\t\t\tif(resultCode==RESULT_OK){\n\t\t\t\tBundle bundle = data.getExtras();\n\t\t\t\tbitmap = (Bitmap) bundle.get(\"data\");\n\t\t\t\timgView.setImageBitmap(bitmap);\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.main);\n \n ImageView image = (ImageView) findViewById(R.id.imageView1);\n \n image.setImageURI((Uri) getIntent().getExtras().get(Intent.EXTRA_STREAM)); \n }", "@Override\n protected void onActivityResult(int requestCode,int resultCode,Intent data){\n super.onActivityResult(requestCode,resultCode,data);\n if(resultCode == RESULT_OK) {\n switch (requestCode){\n case PICK_GALLERY:\n imageURi = data.getData();\n imageView.setImageURI(imageURi);\n break;\n case REQUEST_IMAGE_CAPTURE:\n Bundle extras = data.getExtras();\n Bitmap bitmap = (Bitmap)extras.get(\"data\");\n imageView.setImageBitmap(bitmap);\n break;\n }\n }\n }", "protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == 7 && resultCode == RESULT_OK) {\n\n Bitmap bitmap = (Bitmap) data.getExtras().get(\"data\");\n currentBitMap = bitmap;\n imageView.setImageBitmap(bitmap);\n }\n\n try {\n if (requestCode == IMG_RESULT && resultCode == RESULT_OK && data != null) {\n Uri URI = data.getData();\n String[] FILE = {MediaStore.Images.Media.DATA};\n\n Cursor cursor = getContentResolver().query(URI, FILE, null, null, null);\n cursor.moveToFirst();\n\n int columnIndex = cursor.getColumnIndex(FILE[0]);\n String ImageDecode = cursor.getString(columnIndex);\n cursor.close();\n\n currentBitMap = BitmapFactory.decodeFile(ImageDecode);\n imageView.setImageBitmap(currentBitMap);\n }\n } catch (Exception e) {\n Toast.makeText(this, \"Please try again\", Toast.LENGTH_LONG)\n .show();\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) { /// automatski se zove kada krene startActivityResult\n //super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK){\n // get the photo\n Bundle extras = data.getExtras();\n Bitmap photo = (Bitmap)extras.get(\"data\"); // spremanje u bitmap\n mojImageView.setImageBitmap(photo); // stavljanje na zaslon\n\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if(requestCode==1&&resultCode==RESULT_OK&&data!=null&&data.getData()!=null){\n imguri=data.getData();\n picIv.setImageURI(imguri);\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n try {\n\n if (requestCode == IMG_RESULT && resultCode == RESULT_OK\n && null != data) {\n\n\n imageeUri = data.getData();\n\n mInsertImage.setImageURI(imageeUri);\n }\n }\n catch (Exception e) {\n Toast.makeText(this, \"Please try again\", Toast.LENGTH_LONG)\n .show();\n }\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if(resultCode == RESULT_OK && requestCode ==200){\n Uri uri_img=data.getData();\n try{\n assert uri_img != null;\n InputStream input_img = updateView.getContext().getContentResolver().openInputStream(uri_img);\n DecodeImage_stream = BitmapFactory.decodeStream(input_img);\n chooseImage.setImageBitmap(DecodeImage_stream);\n }catch (FileNotFoundException f){\n Log.d(\"add new file not found:\",f.getMessage());\n }\n }\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == 234 && data != null && data.getData() != null) {\n filePath = data.getData();\n Uri uri = data.getData();\n try {\n Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);\n ImageView imageView = findViewById(R.id.displayPicture);\n imageView.setImageBitmap(bitmap);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n }", "@Override\n public void imageLoad(ImageView imageView, Bitmap bitmap) {\n imageView.setImageBitmap(bitmap);\n //item.picture = bitmap;\n }", "protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {\n if (resultCode == RESULT_OK) {\n\n Bitmap bp = (Bitmap) data.getExtras().get(\"data\");\n //iv.setImageBitmap(bp);\n storeImage(bp);\n\n Intent inte = new Intent(this, ScanResults.class);\n startActivity(inte);\n\n } else if (resultCode == RESULT_CANCELED) {\n // User cancelled the image capture\n } else {\n // Image capture failed, advise user\n }\n }\n\n\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == PICK_IMAGE && resultCode == RESULT_OK && data != null && data.getData() != null) {\n filePath = data.getData();\n try {\n Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);\n Image_brand.setImageBitmap(bitmap);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "public void drawImage() {\n ImageView imageView = (ImageView) findViewById(R.id.photo);\n imageView.setVisibility(View.VISIBLE);\n Glide.with(MainActivity.this).load(iURI).fitCenter().into(imageView);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK && data != null && data.getData() != null) {\n\n Uri imageUri = data.getData();\n\n try {\n //Attempt for the application to save the picture the user wants to use\n Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);\n // Log.d(TAG, String.valueOf(bitmap));\n //Reference the ImageView\n ImageView imageView = (ImageView) findViewById(R.id.image_input);\n imageView.setImageBitmap(bitmap);\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (resultCode == RESULT_OK) {\n //everything processed successfully\n if (requestCode == Image_Gallery_Request) {\n //image gallery correctly responds\n Uri imageUri = data.getData(); //address of image on SD Card\n InputStream inputStream; //declaring stream to read data from SD card\n try {\n inputStream = getContentResolver().openInputStream(imageUri);\n Bitmap imagebtmp = BitmapFactory.decodeStream(inputStream); //Puts stream data into bitmap format\n Profile_Picture.setImageBitmap(imagebtmp); //Loads Image to ImageView\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n //error message if image is unavailable\n Toast.makeText(this, \"Unable to open image\", Toast.LENGTH_LONG).show();\n }\n }\n }\n }", "protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n switch (requestCode) {\n case RESULT_CODE:\n if (resultCode == Activity.RESULT_OK){\n Bundle bundle = data.getExtras();\n // 转化数据\n Bitmap bitmap = (Bitmap) bundle.get(\"data\");\n // 将图片添加到imagineview中\n imgview.setImageBitmap(bitmap);\n bitmap_orgin = getBitmap(imgview.getDrawable());\n }\n\n break;\n case SAVE_CODE:\n if (resultCode == RESULT_OK) {\n // 加载本地库的图片\n Uri uri = data.getData();\n imgview.setImageURI(uri);\n bitmap_orgin = getBitmap(imgview.getDrawable());\n }\n break;\n default:\n break;\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == CODIGO_DE_SOLICITUD_IMAGEN\n && resultCode == RESULT_OK\n && data!=null\n && data.getData() != null){\n\n RutaArchivoUri = data.getData();\n try {\n //Convertimos a bitmap\n Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(),RutaArchivoUri);\n //seteamos la imagen\n ImagenAgregarSerie.setImageBitmap(bitmap);\n\n }catch (Exception e){\n Toast.makeText(this, \"\"+e.getMessage(), Toast.LENGTH_SHORT).show();\n\n }\n }\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if(requestCode==PICK_IMAGE && data!=null && data.getData()!=null){\n imageUri=data.getData();\n postImage.setImageURI(imageUri);\n\n\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (resultCode == RESULT_OK) {\n\n switch (requestCode) {\n case 100:\n Bundle extras = data.getExtras();\n Bitmap imageBitmap = (Bitmap) extras.get(\"data\");\n\n ByteArrayOutputStream stream = new ByteArrayOutputStream();\n imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);\n byte[] byteArray = stream.toByteArray();\n Media media = new Media();\n media.setType(Media.TYPE.IMAGE_JPG);\n media.setBytes(byteArray);\n if (recyclerView.getVisibility() == View.GONE)\n recyclerView.setVisibility(View.VISIBLE);\n medias.add(media);\n ((PicturesRecyclerAdapter) recyclerView.getAdapter()).updateContent(medias);\n break;\n default:\n Toast.makeText(this, \"Something went wrong...\", Toast.LENGTH_SHORT).show();\n break;\n }\n\n }\n }", "@Override\n\tpublic void onActivityCreated(Bundle savedInstanceState) {\n\t\tsuper.onActivityCreated(savedInstanceState);\n\t\t\n\t\tif(savedInstanceState != null){\n\t\t\tmData = savedInstanceState.getInt(\"data\");\n\t\t}\n\t\t\n\t\tBundle args = getArguments();\n\t\t\n\t\tLog.e(\"TAG\",\"what's?? \" + args.getInt(\"index\"));\n\t\t\n\t\t\n\t\t\n\t\tBitmap bmp = null;\n\t\ttry {\n\t\t\tbmp = MediaStore.Images.Media\n\t\t\t .getBitmap(getActivity().getContentResolver(), ContentUris.withAppendedId(\n\t\t\t\t\t MediaStore.Images.Media.EXTERNAL_CONTENT_URI, args.getLong(\"imageId\")));\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tLog.e(\"TAG\",\"bbbb\");\n\t\t\n\t\t//if(bmp != null && imageView != null)\n\t\t\n\t\tsurFaceView.setFixedSize(bmp.getWidth(),bmp.getHeight());\n\t\t//imageView.setImageBitmap(this.scale(bmp));\n\t\t\n\t\t\n\t\tBitmapDrawable ob = new BitmapDrawable(bmp);\n\t\tsurFaceView.setBackgroundDrawable(ob);\n\t\t\n\t\t\n\t\t\n\t\t//int index = args.getInt(\"index\");\n\t\t\n\t}", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n switch (requestCode) {\n case SELECT_PHOTO:\n if (resultCode == RESULT_OK) {\n // imABoolean=true;\n try {\n filePath = data.getData();\n bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), filePath);\n\n logo.setImageBitmap(bitmap);\n\n\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n break;\n }\n }\n\n\n }", "private void setDataFromIntent() {\n GlideApp.with(UserDetailsActivity.this)\n .load(strImage)\n .listener(new RequestListener<Drawable>() {\n @Override\n public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {\n return false;\n }\n\n @Override\n public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, com.bumptech.glide.load.DataSource dataSource, boolean isFirstResource) {\n return false;\n }\n }).apply(new RequestOptions().placeholder(R.drawable.no_image).error(R.drawable.no_image))\n .into(userProfileImage);\n //set userName,userNick,userStatus\n if (strName.isEmpty()){\n tvUserName.setText(\"Name - \"+\"No Name Available\");\n }else {\n tvUserName.setText(\"Name - \"+strName);\n }\n if (strNick.isEmpty()){\n tvUserNick.setText(\"Nick - \"+\"No Name Available\");\n }else {\n tvUserNick.setText(\"Nick - \"+strNick);\n }\n tvUserStatus.setText(\"Status - \"+strStatus);\n }", "public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage);", "@Override\n protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (resultCode == RESULT_OK) {\n try {\n final Uri imageUri = data.getData();\n final InputStream imageStream = getContentResolver().openInputStream(imageUri);\n final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);\n mImageViewSS.setImageBitmap(selectedImage);\n //Store image locally\n saveToInternalStorage(selectedImage);\n //EOF Store image locally\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n Toast.makeText(this, getString(R.string.image_error), Toast.LENGTH_LONG).show();\n }\n } else {\n Toast.makeText(this, getString(R.string.didnt_pick_image), Toast.LENGTH_LONG).show();\n }\n }", "@Override\n protected void onPostExecute(Bitmap imgBm){\n imgView.setImageBitmap(imgBm);\n\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == 0 && resultCode == RESULT_OK ) {\n\n Uri imageUri=data.getData();\n\n\n try {\n Bitmap bm = null;\n ContentResolver resolver = getContentResolver();\n //获得图片的uri\n originalUri = data.getData();\n bitmapUri = originalUri;\n System.out.println(\"URi:\"+ originalUri);\n System.out.println(\"URi:\"+ originalUri.getClass());\n // isSelectPic = true;\n bm = MediaStore.Images.Media.getBitmap(resolver, originalUri);\n //显得到bitmap图片\n iv.setImageBitmap(bm);\n\n } catch (Exception e) {\n Log.e(\"TAG-->Error\", e.toString());\n }\n\n //放到imageview中\n\n\n }\n\n\n if (requestCode == 1 && resultCode == 2) {//当请求码是1&&返回码是2进行下面操作\n System.out.println(\"OK\");\n uid = data.getStringExtra(\"uid\");\n city = data.getStringExtra(\"city\");\n name = data.getStringExtra(\"name\");\n address = data.getStringExtra(\"address\");\n latitude = data.getDoubleExtra(\"latitude\", 0);\n longitude = data.getDoubleExtra(\"longitude\", 0);\n search_name.setText(name);\n // System.out.println(uid+\"\\n\"+city+\"\\n\"+name+\"\\n\"+address+\"\\n\"+latitude+\"\\n\"+longitude+\"\\n\");\n\n }\n\n }", "protected void onPostExecute(Bitmap bitmap) {\n image.setImageBitmap(bitmap);\n }", "@Override\n public void onSuccess(byte[] bytes) {\n Drawable image = new BitmapDrawable(getResources(), BitmapFactory.decodeByteArray(bytes, 0, bytes.length));\n imageView.setImageDrawable(image);\n }", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\t\tif (resultCode == RESULT_OK) {\n\t\t\tswitch (requestCode) {\n//\t\t\tcase EDIT_FROM_EDITOR:\n//\t\t\t\tbyte[] bb = data.getByteArrayExtra(\"bitmap\");\n//\t\t\t\tBitmap tmp_bitmap = BitmapFactory.decodeByteArray(bb, 0,\n//\t\t\t\t\t\tbb.length);\n//\t\t\t\tcur_bitmap_list.add(tmp_bitmap);\n//\t\t\t\tiv_seller_reply_img.setImageBitmap(cur_bitmap_list.get(0));\n//\t\t\t\tbreak;\n\t\t\tcase PICK_FROM_ALBUM :\n//\t\t\t\tIntent intent = new Intent(Consumer_post.this, ImageEditActivity.class);\n//\t\t\t\tintent.putExtra(\"output\", data.getData());\n//\t\t\t\tintent.putExtra(\"flag\", \"album\");\n//\t\t\t\tstartActivityForResult(intent, EDIT_FROM_EDITOR);\n\t\t\t\tif (!addImage(data)) {\n\t\t\t\t\tToast.makeText(Seller_reply.this, \"사진 첨부 실패\",\n\t\t\t\t\t\t\tToast.LENGTH_LONG).show();\n\t\t\t\t}\n\t\t\t\tbreak;\n//\t\t\tcase PICK_FROM_CAMERA:\n//\t\t\t\tIntent intent2 = new Intent(Seller_reply.this,\n//\t\t\t\t\t\tImageEditActivity.class);\n//\t\t\t\tintent2.putExtra(\"output\", path + \"/\" + TEMP_IMAGE);\n//\t\t\t\tintent2.putExtra(\"flag\", \"camera\");\n//\t\t\t\tstartActivityForResult(intent2, EDIT_FROM_EDITOR);\n//\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "@Override\n public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {\n }", "@Override\n protected void onActivityResult(int id, int result, Intent data) {\n if(result == RESULT_OK)\n {\n //check if its the choose image activity\n if(id == CHOOSE_IMAGE_ID)\n {\n Uri imageAddress = data.getData();\n //used to read image data\n InputStream inStream;\n\n try\n {\n inStream = getContentResolver().openInputStream(imageAddress);\n\n teamLogo = BitmapFactory.decodeStream(inStream);\n imageButton.setImageBitmap(teamLogo);\n }\n catch (FileNotFoundException e)\n {\n e.printStackTrace();\n }\n }\n }\n }", "private void setUpImage(byte[] bytes) {\n\n ImageView imageview = (ImageView)findViewById(R.id.imgEmpPhoto);\n Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);\n imageview.setImageBitmap(bitmap);\n }", "@Override\n protected void onPostExecute(Bitmap bitmap) {\n imageView.setImageBitmap(bitmap);\n }", "protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n switch (requestCode) {\n case SELECTED_PICTURE:\n if (resultCode == RESULT_OK) {\n uri = data.getData();\n\n\n Log.e(\"Image path is \", \"\" + uri);\n String[] projection = {MediaStore.Images.Media.DATA};\n\n Cursor cursor = getContentResolver().query(uri, projection,\n null, null, null);\n cursor.moveToFirst();\n\n int columnIndex = cursor.getColumnIndex(projection[0]);\n String filePath = cursor.getString(columnIndex);\n String path = filePath;\n img = path;\n\n cursor.close();\n\n\n Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);\n\n Drawable d = new BitmapDrawable(yourSelectedImage);\n\n newImage.setImageDrawable(d);\n Toast.makeText(getApplicationContext(), filePath,\n Toast.LENGTH_SHORT).show();\n\n\n\n }\n break;\n\n default:\n break;\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n if(requestCode == TAKE_IMAGE && resultCode == RESULT_OK){\n Bundle extra = data.getExtras();\n bitmap = (Bitmap) extra.get(\"data\");\n imageView.setImageBitmap(bitmap);\n }\n else {\n if (requestCode == SELECT_IMAGE && resultCode == RESULT_OK) {\n Uri targetUri = data.getData();\n Toast.makeText(getApplicationContext(), targetUri.toString(), Toast.LENGTH_SHORT).show();\n //textTargetUri.setText(targetUri.toString());\n Bitmap bitmap;\n try {\n\n bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(targetUri));\n imageView.setImageBitmap(bitmap);\n } catch (FileNotFoundException e) {\n\n e.printStackTrace();\n }\n /*String[] filePathColumn = {MediaStore.Images.Media.DATA};\n\n\t\t\tCursor cursor = getContentResolver().query(data.getData(), filePathColumn, null, null, null);\n\t\t\tcursor.moveToFirst();\n\n\t\t\tint columnIndex = cursor.getColumnIndex(filePathColumn[0]);\n\n\t\t\tString filePath = cursor.getString(columnIndex);\n\t\t\tcursor.close();\n\n\t\t\tBitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);\n\t\t\tToast.makeText(getApplicationContext(), filePath, 1000).show();\n\t\t\timageView.setImageBitmap(yourSelectedImage);\n*/\n }\n }\n if(requestCode == 0 && resultCode == RESULT_OK){\n Bundle extra = data.getExtras();\n bitmap = (Bitmap) extra.get(\"data\");\n // imageView.setImageBitmap(bitmap);\n\n\n File root = Environment.getExternalStorageDirectory();\n File file = new File(root.getAbsolutePath()+\"/DCIM/Camera/img.jpg\");\n try\n {\n file.createNewFile();\n FileOutputStream ostream = new FileOutputStream(file);\n bitmap.compress(Bitmap.CompressFormat.JPEG, 100, ostream);\n ostream.close();\n }\n catch (Exception e)\n {\n e.printStackTrace();\n Toast.makeText(this,\"Failed to save image, try again\",Toast.LENGTH_LONG).show();\n }\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data)\n {\n\n if ((requestCode == PICK_CODE) && (resultCode == RESULT_OK) && (data.getData() != null))\n {\n System.out.println(\"we are in if cond now try block run\");\n imgUriPath = data.getData();// this is full path of image\n\n try\n {\n Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imgUriPath);// got image in bitmap\n\n profile_pic.setImageBitmap(bitmap);//setting image\n\n\n } catch (IOException e)\n {\n\n e.printStackTrace();\n }\n\n }\n\n\n super.onActivityResult(requestCode, resultCode, data);\n }", "@Override\n public void run() {\n imageView.setImageBitmap(photo);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n try {\n // When an Image is picked\n if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK\n && null != data) {\n // Get the Image from data\n checkbit = 1;\n Uri selectedImage = data.getData();\n bitmap = scaleImage(this,selectedImage);\n origmap = bitmap;\n\n String[] filePathColumn = {MediaStore.Images.Media.DATA};\n\n // Get the cursor\n Cursor cursor = getContentResolver().query(selectedImage,\n filePathColumn, null, null, null);\n // Move to first row\n cursor.moveToFirst();\n\n int columnIndex = cursor.getColumnIndex(filePathColumn[0]);\n imgPath = cursor.getString(columnIndex);\n cursor.close();\n imgView.setImageBitmap(bitmap);\n\n Calendar c = Calendar.getInstance();\n SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n int amorpmint = c.get(Calendar.AM_PM);\n String amorpm;\n if (amorpmint == 0)\n {\n amorpm = \"AM\";\n } else {\n amorpm = \"PM\";\n }\n\n lastUpdated = df.format(c.getTime()) + \" \" + amorpm;\n SimpleDateFormat timef = new SimpleDateFormat(\"HH:mm\");\n time = timef.format(c.getTime()) + \" \" + amorpm;\n\n fileName = user + \"orig\";\n params = new ArrayList<>();\n // Put file name in Async Http Post Param which will used in Php web app\n params.add(new BasicNameValuePair(\"filename\", fileName));\n params.add(new BasicNameValuePair(\"username\", user));\n params.add(new BasicNameValuePair(\"Time\", time));\n params.add(new BasicNameValuePair(\"LastUpdated\", lastUpdated));\n\n } else {\n Toast.makeText(this, \"You haven't picked Image\",\n Toast.LENGTH_LONG).show();\n }\n } catch (Exception e) {\n Toast.makeText(this, \"Something went wrong\", Toast.LENGTH_LONG)\n .show();\n }\n\n }", "@Override\n public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {\n SharePhoto photo = new SharePhoto.Builder()\n .setBitmap(bitmap)\n .build();\n if(ShareDialog.canShow(SharePhotoContent.class)){\n SharePhotoContent content = new SharePhotoContent.Builder()\n .addPhoto(photo)\n .build();\n shareDialog.show(content);\n }\n\n }", "public void getImage(){\n Cursor c = db.rawQuery(\"SELECT * FROM Stories\",null);\n if(c.moveToNext()){\n byte[] image = c.getBlob(0);\n Bitmap bmp = BitmapFactory.decodeByteArray(image,0,image.length);\n }\n}", "@Override\n protected void onActivityResult(int requestCode,int resultCode, Intent data){\n if (requestCode == 0x1 && resultCode == RESULT_OK) {\n if (data != null) {\n imageuri=data.getData();\n imageView.setImageURI(imageuri);\n changeUri(imageuri.toString());\n }\n }\n super.onActivityResult(requestCode, resultCode, data);\n }", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tif (resultCode == RESULT_OK) {\n\t\t\tswitch (requestCode) {\n\t\t\tcase REQUEST_IMAGE_CAPTURE1:\n\t\t\t\tBundle extras = data.getExtras();\n\t\t\t\tBitmap imageBitmap = (Bitmap) extras.get(\"data\");\n\n\t\t\t\timView.setImageBitmap(imageBitmap);\n\t\t\t\tBitmapDrawable drawable = (BitmapDrawable) imView.getDrawable();\n\t\t\t\tBitmap bitmap = drawable.getBitmap();\n\t\t\t\tByteArrayOutputStream baos = new ByteArrayOutputStream();\n\t\t\t\tbitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);\n\t\t\t\tbyte[] datas = baos.toByteArray();\n\t\t\t\tstrBase64 = Base64.encodeToString(datas, Base64.DEFAULT);\n\n\t\t\t\tbreak;\n\t\t\tcase REQUEST_IMAGE_CAPTURE2:\n\n\t\t\t\tBundle extras1 = data.getExtras();\n\t\t\t\tBitmap imageBitmap1 = (Bitmap) extras1.get(\"data\");\n\t\t\t\timView2.setImageBitmap(imageBitmap1);\n\t\t\t\tBitmapDrawable drawable2 = (BitmapDrawable) imView2\n\t\t\t\t\t\t.getDrawable();\n\t\t\t\tBitmap bitmap2 = drawable2.getBitmap();\n\n\t\t\t\tByteArrayOutputStream baos2 = new ByteArrayOutputStream();\n\t\t\t\tbitmap2.compress(Bitmap.CompressFormat.PNG, 100, baos2);\n\t\t\t\tbyte[] datas2 = baos2.toByteArray();\n\n\t\t\t\tstrBase642 = Base64.encodeToString(datas2, Base64.DEFAULT);\n\n\t\t\t}\n\t\t}\n\n\t}", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (requestCode == request_code && resultCode == RESULT_OK && data != null && data.getData() != null) {\n uri = data.getData();\n slika.setImageURI(uri);\n }\n }", "public void onItemClick(View view, PictureModel pictureModel) {\n Intent intent = new Intent(getActivity(), SecondActivity.class);\n /*Bundle bundle = new Bundle();\n bundle.putParcelable(\"bitmap\",bitmap);\n intent.putExtra(\"bundle\",bundle);\n startActivity(intent);*/\n //intent.putExtra(\"path\",\"/sdcard/namecard/\");\n byte buff[] = new byte[1024*1024];//看你图有多大..自己看着改\n buff = Bitmap2Bytes(pictureModel.getPictureBitmap());\n intent.putExtra(\"image\",buff);\n startActivity(intent);\n\n\n\n }", "@Override\n public void onCreate(Bundle savedInstanceState){\n super.onCreate(savedInstanceState);\n uri = getIntent().getStringExtra(\"uri\");\n imageArray = getIntent().getStringArrayListExtra(\"array\");\n getIntent().getParcelableArrayListExtra(\"array\");\n\n setContentView(R.layout.image_view_main);\n\n imageView = (ImageView) findViewById(R.id.imageView);\n Picasso.with(this).load(uri).into(imageView);\n\n index = getIntent().getIntExtra(\"index\", 0);\n\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (requestCode == 1 && resultCode == getActivity().RESULT_OK && data != null && data.getData() != null) {\n\n Uri uri = data.getData();\n\n try {\n ByteArrayOutputStream boas = new ByteArrayOutputStream();\n\n\n Bitmap btmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);\n\n btmap.compress(Bitmap.CompressFormat.JPEG, 70, boas); //bm is the bitmap object\n byte[] byteArrayImage = boas.toByteArray();\n\n\n BitmapFactory.Options opt;\n\n opt = new BitmapFactory.Options();\n opt.inTempStorage = new byte[16 * 1024];\n opt.inSampleSize = 2;\n Bitmap bitmap = BitmapFactory.decodeByteArray(byteArrayImage, 0, byteArrayImage.length, opt);\n\n ImageView imageView = (ImageView) getActivity().findViewById(R.id.profile_back);\n CircleImageView dp = (CircleImageView) getActivity().findViewById(R.id.dp1);\n dp.setImageBitmap(bitmap);\n Bitmap bitmap1=grayscale(bitmap);\n Bitmap blurred = blurRenderScript(bitmap1, 25);\n imageView.setImageBitmap(blurred);\n } catch (OutOfMemoryError a) {\n Toast.makeText(getActivity().getApplicationContext(), \"Image size high\", Toast.LENGTH_SHORT).show();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "private Bitmap postBitmap(Post p) {\n byte[] loadedBytes = Base64.decode(p.getImageURL(), Base64.DEFAULT);\n Bitmap loadedBitmap = BitmapFactory.decodeByteArray(loadedBytes, 0, loadedBytes.length);\n return loadedBitmap;\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n //here we are applying the condition\n if(requestCode==50 && resultCode==RESULT_OK){\n //here it will Get the url from data\n Uri selectedImageUri = data.getData();\n if (null != selectedImageUri) {\n //displays image\n imageView.setImageURI(selectedImageUri);\n }\n }\n }", "public void resultImgSet(Bitmap bitmap) {\n fpResultImg.setImageBitmap(bitmap);\n }", "protected void onPostExecute(Bitmap result){\n imageView.setImageBitmap(result);\n }", "public void onActivityResult(int requestCode, int resultCode, Intent data) {\n imageView = (ImageView) findViewById(R.id.contactImg);\n\n if (resultCode == RESULT_OK) {\n if (requestCode == SELECT_PICTURE) {\n selectedImageUri = data.getData();\n\n if (null != selectedImageUri) {\n saveImage(selectedImageUri.toString());\n imageView.setImageURI(selectedImageUri);\n setSelectedImgURI(selectedImageUri);\n\n }\n\n }\n }\n }", "@Override\n protected void onActivityResult (int requestCode, int resultCode, Intent data)\n {\n\t\tif(requestCode == CAMERA_REQUEST_CODE)\n\t\t{\n\t\t\t// if user keeps the photo\n\t\t\tif(resultCode == RESULT_OK)\n\t\t\t{\n\t\t\t\tif(data!=null){\n\t\t\t\t\t DBAdapter db = new DBAdapter(this); \n\n\t\t\t\t db.open();\n\t\t\t\t ByteArrayOutputStream baos = new ByteArrayOutputStream(); \n\t\t\t\t \n\t\t\t\t\tBitmap bitmap = data.getParcelableExtra(\"data\");\n\n\t\t\t\t\tbitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); \n\t\t\t byte[] photo = baos.toByteArray(); \n\t\t\t Log.d (\"CHECKTHIS\", \"\" +photo.length);\n\t\t\t db.insertUserDetails(\"tuan\",\"one\", \"pass\", photo,\"visibility\");\n\t\t\t\t\timageView.setImageBitmap(bitmap);\n\t\t\t db.close();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {\n filePath = data.getData();\n try {\n bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);\n imageView.setImageBitmap(bitmap);\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "@Override\n public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {\n SharePhoto photo = new SharePhoto.Builder()\n .setBitmap(bitmap)\n .build();\n if (ShareDialog.canShow(SharePhotoContent.class))\n {\n SharePhotoContent content = new SharePhotoContent.Builder()\n .addPhoto(photo)\n .build();\n shareDialog.show(content);\n\n }\n\n\n }", "@Override\n\tpublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\t\tLog.e(\"on success\", \"on success\");\n\t\tBitmap s = null;\n\n\t\tif (resultCode == getActivity().RESULT_OK) {\n\t\t\t// user is returning from capturing an image using the camera\n\t\t\tif (requestCode == CAMERA_CAPTURE) {\n\t\t\t\tLog.e(\"camera\", \"camera\");\n\t\t\t\tpicUri = data.getData();\n\t\t\t\tBundle extras = data.getExtras();\n\t\t\t\t// get the cropped bitmap\n\t\t\t\tBitmap thePic = extras.getParcelable(\"data\");\n\t\t\t\tsavetoaFileLocation(thePic);\n\t\t\t\tthePic = getResizedBitmap(thePic, 200, 200);\n\t\t\t\tcameraBitmap = thePic;\n\t\t\t\t// ImageView picView = (ImageView)\n\t\t\t\t// findViewById(R.id.img_userimage);\n\t\t\t\t// display the returned cropped image\n\t\t\t\tprofileimageeditflag=\"true\";\n\t\t\t\tGraphicsUtil graphicUtil = new GraphicsUtil();\n\t\t\t\t// picView.setImageBitmap(graphicUtil.getRoundedShape(thePic));\n\t\t\t\t\n\t\t\t\tpicview1.setImageBitmap(graphicUtil.getCircleBitmap(thePic, 16));\n\t\t\t\t//picview1.setImageBitmap(cameraBitmap);\n\t\t\t} else if (requestCode == GALLERY_CAPTURE) {\n\n\n\n\n\t\t\t\tUri selectedImage = data.getData();\n\n\t\t\t\tString stringUri;\n\t\t\t\tstringUri = selectedImage.toString();\n\t\t\t\tif ((stringUri != \"\") || stringUri != null) {\n\n\t\t\t\t\tString selectedImagePath = getPath(selectedImage);\ntry {\n\tExifInterface exifInterface = new ExifInterface(selectedImagePath);\n\torientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);\n\n}\ncatch (Exception e){}\n\n\n\n\t\t\t\t\tString[] filePathColumn = { MediaStore.Images.Media.DATA };\n\t\t\t\t\tCursor cursor = getActivity().getContentResolver().query(\n\t\t\t\t\t\t\tselectedImage, filePathColumn, null, null, null);\n\t\t\t\t\tcursor.moveToFirst();\n\t\t\t\t\tint columnIndex = cursor.getColumnIndex(filePathColumn[0]);\n\t\t\t\t\tString selectedimage_path = cursor.getString(columnIndex);\n\t\t\t\t\tLog.e(\"selected path\",selectedimage_path);\n\t\t\t\t\tcursor.close();\n\t\t\t\t\tif (selectedimage_path.startsWith(\"https://\")) {\n\t\t\t\t\t\tgetBiymapFromGoogleLocation(selectedimage_path);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts = getBitmapFromFile(selectedimage_path);\n\t\t\t\t\t}\n\t\t\t\t\ts = getResizedBitmap(s, 200, 200);\n\t\t\t\t\tcameraBitmap = s;\n\n\t\t\t\t\tswitch(orientation) {\n\t\t\t\t\t\tcase ExifInterface.ORIENTATION_ROTATE_90:\n\t\t\t\t\t\t\tcorrectedBitMap = rotateImage(cameraBitmap, 90);\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase ExifInterface.ORIENTATION_ROTATE_180:\n\t\t\t\t\t\t\tcorrectedBitMap = rotateImage(cameraBitmap, 180);\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase ExifInterface.ORIENTATION_ROTATE_270:\n\t\t\t\t\t\t\tcorrectedBitMap = rotateImage(cameraBitmap, 270);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tcorrectedBitMap=cameraBitmap;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t// ImageView picView = (ImageView)\n\t\t\t\t\t// findViewById(R.id.img_userimage);\n\t\t\t\t\t// display the returned cropped image\nprofileimageeditflag=\"true\";\n\t\t\t\t\tGraphicsUtil graphicUtil = new GraphicsUtil();\n\n\n\t/*\t\t\t\tif(correctedBitMap!= null)\n\t\t\t\t\t{\n\t\t\t\t\t\tpicView.setImageBitmap(graphicUtil.getCircleBitmap(\n\t\t\t\t\t\t\t\tcorrectedBitMap, 16));\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// picView.setImageBitmap(graphicUtil.getRoundedShape(thePic));\n\t\t\t\t\t\tpicView.setImageBitmap(graphicUtil.getCircleBitmap(\n\t\t\t\t\t\t\t\tcameraBitmap, 16));\n\t\t\t\t\t}\n\n*/\n\n\t\t\t\t\tif (correctedBitMap != null)\n\t\t\t\t\t{\n\t\t\t\t\t\tpicview1.setImageBitmap(graphicUtil.getCircleBitmap(correctedBitMap, 16));\n\t\t\t\t\t\tsavetoaFileLocation(correctedBitMap);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tpicview1.setImageBitmap(graphicUtil.getCircleBitmap(s, 16));\n\t\t\t\t\t\tsavetoaFileLocation(s);\n\t\t\t\t\t}\n\n\n\n\t\t\t\t\t// picView.setImageBitmap(graphicUtil.getRoundedShape(thePic));\n\t\t\t\n\t\t\t\t//\tpicview1.setImageBitmap(graphicUtil.getCircleBitmap(s, 16));\n\t\t\t\t//\tpicview1.setImageBitmap(cameraBitmap);\n\t\t\t\t//\tsavetoaFileLocation(s);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}", "private void processAndSetImage() {\n\n // Resample the saved image to fit the ImageView\n mResultsBitmap = resamplePic(this, mTempPhotoPath);\n\n// tv.setText(base64conversion(photoFile));\n//\n// Intent intent = new Intent(Intent.ACTION_SEND);\n// intent.setType(\"text/plain\");\n// intent.putExtra(Intent.EXTRA_TEXT, base64conversion(photoFile));\n// startActivity(intent);\n\n /**\n * UPLOAD IMAGE USING RETROFIT\n */\n\n retroFitHelper(base64conversion(photoFile));\n\n // Set the new bitmap to the ImageView\n imageView.setImageBitmap(mResultsBitmap);\n }", "@Override\n\t\t\t\tpublic void onObtainBitmap(Bitmap bitmap, ImageView imageView) {\n\t\t\t\t\timageView.setImageBitmap(bitmap);\n\t\t\t\t}", "public void getresponse(){\n\r\n BitmapDrawable drawable = (BitmapDrawable) pic.getDrawable();\r\n Bitmap bitmap = drawable.getBitmap();\r\n bitmap = Bitmap.createScaledBitmap(bitmap, 70, 70, true);\r\n pic.setImageBitmap(bitmap);\r\n base64=encodeTobase64(bitmap);\r\n\r\n JSONObject obj = new JSONObject();\r\n try {\r\n obj.put(\"name\", username.getText().toString());\r\n obj.put(\"designation\",designation.getText().toString() );\r\n obj.put(\"company\", company.getText().toString());\r\n obj.put(\"location\", location.getText().toString());\r\n obj.put(\"base64Image\",encodeTobase64(bitmap));\r\n obj.put(\"picture\", \"\");\r\n obj.put(\"phone\",cell.getText().toString() );\r\n obj.put(\"chat\", chat.getText().toString());\r\n obj.put(\"email\", email.getText().toString());\r\n obj.put(\"website\", link.getText().toString());\r\n obj.put(\"facebook\",fb .getText().toString());\r\n obj.put(\"linkedin\", linkedin.getText().toString());\r\n obj.put(\"whatsapp\", wno.getText().toString());\r\n obj.put(\"skype\", skype.getText().toString());\r\n obj.put(\"google\",gid.getText().toString());\r\n obj.put(\"notes\", notes.getText().toString());\r\n\r\n } catch (JSONException e) {\r\n e.printStackTrace();\r\n }\r\n Log.d(\"TAG\",obj.toString());\r\n\r\n\r\n final ProgressDialog pDialog = new ProgressDialog(this);\r\n pDialog.setMessage(\"Loading...\");\r\n pDialog.show();\r\n\r\n JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,\r\n url, obj,\r\n new Response.Listener<JSONObject>() {\r\n\r\n @Override\r\n public void onResponse(JSONObject response) {\r\n Log.d(\"TAG\", response.toString());\r\n pDialog.hide();\r\n SharedPreferences sharedPreferences = getSharedPreferences(\"mydata\", Context.MODE_PRIVATE);\r\n SharedPreferences.Editor editor = sharedPreferences.edit();\r\n String profileId = null;\r\n String profileLink = null;\r\n try {\r\n profileId = response.getString(\"profileId\");\r\n profileLink = response.getString(\"profileLink\");\r\n } catch (JSONException e) {\r\n e.printStackTrace();\r\n }\r\n editor.putString(\"profileId\", profileId );\r\n editor.putString(\"profileLink\", profileLink);\r\n editor.commit();\r\n }\r\n }, new Response.ErrorListener() {\r\n\r\n @Override\r\n public void onErrorResponse(VolleyError error) {\r\n VolleyLog.d(\"TAG\", \"Error: \" + error.getMessage());\r\n // hide the progress dialog\r\n pDialog.hide();\r\n }\r\n });\r\n\r\n// Adding request to request queue\r\n AppController.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj);\r\n\r\n }", "@Override\n public void photoLoaded(byte[] data, int resourceId) {\n if (data != null) {\n //Decodificamos el array de bytes de la imagen, obteniendo un Bitmap y se lo asignamos al ImageView.\n Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);\n\n if (bitmap != null)\n ((ImageView) findViewById(resourceId)).setImageBitmap(bitmap);\n }\n }", "@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_main);\n\t\tcontext = EffectActivity.this;\n\t\tbyte[] byteArray = getIntent().getByteArrayExtra(CommonVL.BITMAP_TO_EDITTING);\n\t\tbitmapPic = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);\n\t}", "public void catchImage(String data) {\n\t\tsetPicturePreview(data);\n\n\t}", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n try {\n\n // camera photo\n if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {\n imageUri = Uri.fromFile(new File(mCameraFileName)); //zwraca zdjęcie z aparatu jako ścieszkę uri\n Log.d(TAG, \"onActivityResult: imageUri z aparatu: \" + imageUri);\n }\n\n // save picture to imageBitmap from taken mageUri from camera\n imageBitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri);\n imageViewOfPhotoFromCamera.setImageBitmap(imageBitmap); // set imageBitmap in image View\n Log.d(TAG, \"onActivityResult, imageBitmap SAVED and set in imageView\");\n\n } catch (Exception e) {\n Log.d(TAG, \"onActivityResult, ERROr, imageBitmap NOT saved because e: \" + e);\n }\n }", "@Override\r\n public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {\n \tLog.v(\"catch\",view+\"\");\r\n \ttry{\r\n if (loadedImage != null && view!=null) { \r\n ImageView imageView = (ImageView) view; \r\n // imageView.setImageBitmap(loadedImage);\r\n // 是否第一次显示 \r\n boolean firstDisplay = !displayedImages.contains(imageUri); \r\n if (firstDisplay) { \r\n // 图片淡入效果 \r\n FadeInBitmapDisplayer.animate(imageView, 800); \r\n displayedImages.add(imageUri); \r\n \r\n/* \t ViewGroup.LayoutParams params = imageView.getLayoutParams(); \r\n \t params.height =loadedImage.getHeight(); \r\n \t ((MarginLayoutParams)params).setMargins(10, 10, 10, 10);\r\n \t imageView.setLayoutParams(params);*/ \r\n } \r\n } \r\n \t}catch(Exception e){\r\n \t\tLog.v(\"catch1\",e.getMessage());\r\n \t}\r\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.home8_day3_secondview);\n Log.i(TAG, \"onCreate: \");\n textView = findViewById(R.id.textview);\n imageView = findViewById(R.id.image);\n\n Intent intent = getIntent();\n if (intent != null){\n String root = intent.getStringExtra(\"root\");\n if (root.equals(\"button1\")){\n String name = intent.getStringExtra(\"name\");\n int age = intent.getIntExtra(\"age\",0);\n textView.setText(\"name=\"+name+\" age=\"+age);\n } else if (root.equals(\"button2\")){\n String name = intent.getStringExtra(\"name\");\n int age = intent.getIntExtra(\"age\",0);\n textView.setText(\"name=\"+name+\" age=\"+age);\n }else if (root.equals(\"button3\")){\n Person person = (Person) intent.getSerializableExtra(\"person\");\n textView.setText(person.toString());\n }else if (root.equals(\"button4\")){\n Bitmap bitmap = (Bitmap) intent.getParcelableExtra(\"bitmap\");\n imageView.setImageBitmap(bitmap);\n }\n }\n }", "@Override\n public void run() {\n try {\n Drawable drawable = Drawable.createFromStream(new URL(image_path).openStream(), \"\");\n\n Message message = Message.obtain();\n message.obj = drawable;\n handler.sendMessage(message);\n } catch (MalformedURLException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n //O sea que, la accion que ejecuta el usuario es igual a seleccionar una imagen de la galeria\n // Y \"&&\" que la seleccion de la imagen se hizo bien\n if (requestCode == CODIGO_GALERIA && resultCode == RESULT_OK);\n try {\n //Esto nos va transformar la URI en este archivo que esta aqui colocado.\n ArchivoImagen = UtilidadFile.from(this,data.getData());\n //Para que la imagen cargue en uno de los recuadros de la interfaz grafica se hara\n //esta implementacion en la cual recibe la ruta de la imagen.\n imgpost1.setImageBitmap(BitmapFactory.decodeFile(ArchivoImagen.getAbsolutePath()));\n }catch (Exception ex){\n Log.d(\"ERROR\", \"Ha ocurrido un error \"+ ex.getMessage());\n }\n }", "protected void onPostExecute(Bitmap result){\n imageView.setImageBitmap(result);\n ByteArrayOutputStream byteStream = new ByteArrayOutputStream();\n result.compress(Bitmap.CompressFormat.PNG, 0, byteStream);\n byte bitmapBytes[] = byteStream.toByteArray();\n item.ImageBitmapBytes = bitmapBytes;\n }", "protected void onPostExecute(Integer result) {\n if (result == 1) {\n mMyPictureAdapter = new MyPictureAdapter(picItemList);\n mRecyclerView.setAdapter(mMyPictureAdapter);\n mMyPictureAdapter.setOnItemClickListener(new MyPictureAdapter.OnRecyclerViewItemClickListener() {\n public void onItemClick(View view, PictureModel pictureModel) {\n //ContentModel mContentModel = contentModel;\n //saveBitmap(pictureModel.getPictureBitmap());\n Intent intent = new Intent(getActivity(), SecondActivity.class);\n /*Bundle bundle = new Bundle();\n bundle.putParcelable(\"bitmap\",bitmap);\n intent.putExtra(\"bundle\",bundle);\n startActivity(intent);*/\n //intent.putExtra(\"path\",\"/sdcard/namecard/\");\n byte buff[] = new byte[1024*1024];//看你图有多大..自己看着改\n buff = Bitmap2Bytes(pictureModel.getPictureBitmap());\n intent.putExtra(\"image\",buff);\n startActivity(intent);\n\n\n\n }\n });\n } else {\n Log.e(TAG, \"Failed to fetch data!\");\n }\n }", "@Override\n protected void onPostExecute(Bitmap result) {\n super.onPostExecute(result);\n if(result!=null){\n showImageView.setImageBitmap(result);\n }\n }", "void setImage(Bitmap bitmap);", "@Override\r\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\r\n super.onActivityResult(requestCode, resultCode, data);\r\n\r\n ImageView image = (ImageView) findViewById(R.id.editprofile_image);\r\n try {\r\n if (requestCode == requestCode && resultCode == RESULT_OK && null != data) {\r\n Uri selectedImage = data.getData();\r\n Log.d(\"d\", \"Image URI: \" + selectedImage);\r\n\r\n Bitmap bm = MediaStore.Images.Media.getBitmap(this.getContentResolver(), selectedImage);\r\n image.setImageBitmap(bm);\r\n\r\n //Encoding image to base64\r\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\r\n bm.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);\r\n byte[] byteArray = byteArrayOutputStream .toByteArray();\r\n to64 = Base64.encodeToString(byteArray, Base64.DEFAULT);\r\n Log.d(\"d\", \"Encoded String: \" + to64);\r\n\r\n }\r\n }catch (IOException e){\r\n Toast.makeText(this, \"An error occurred.\", Toast.LENGTH_LONG).show();\r\n }\r\n\r\n }", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\n\t\t/*if (requestCode == REQUEST_CODE_TAKE_FROM_CAMERA && resultCode == RESULT_OK) {\n\t\t\tBundle extras = data.getExtras();\n\t\t\tBitmap imageBitmap = (Bitmap) extras.get(\"data\");\n\t\t\tif(imageBitmap!=null){\n\t\t\t\tBitmap scaledImageBitmap = getScaledImage(imageBitmap);\n\t\t\t\tprofilePic.setImageBitmap( scaledImageBitmap );\n\t\t\t}\n\n\t\t\tfinish();\n\t\t}*/\n\t}", "@Override\n\t\t\tpublic void onDataCallBack(int code, Bitmap avatar) {\n\t\t\t\tiamgeView.setImageBitmap(avatar);\n\t\t\t}", "@Override\n protected void onPostExecute(Bitmap bitmap) {\n log(\"BEGIN onPostExecute\");\n\n image.setImageBitmap(bitmap);\n\n log(\"END onPostExecute\");\n }", "public void onPictureTaken(byte[] arg0, Camera arg1) {\n \t String pname = \"/sdcard/\"+System.currentTimeMillis()+\".jpg\";\n\t FileOutputStream outStream = null;\n\t try {\n\t\t outStream = new FileOutputStream(pname);\n\t\t outStream.write(arg0);\n\t\t outStream.close(); \n\t \n\t\t Calendar calendar = Calendar.getInstance();\n\t \tjava.util.Date now = calendar.getTime();\n\t \tjava.util.Date today = new java.util.Date();\n\t\t\tjava.sql.Timestamp ti = new java.sql.Timestamp(now.getTime());\n\t\t\t// storing photo on SD Card and link in database...\n\t\t\t\n\t Toast.makeText(AddContact.this,\n\t \"Image \"+pname+\" saved \",\n\t Toast.LENGTH_LONG).show();\n\t Bitmap bm = BitmapFactory.decodeFile(pname);\n\t img2.setImageBitmap(bm);\n\t // data.Insert(name,strmn,strln,strmno,mshome,mswork,msother,mscust, streid,eswork,esother,mscust,pname,strtag,0);\n\t } catch (FileNotFoundException e) {\n\t // TODO Auto-generated catch block\n\t e.printStackTrace();\n\t } catch (IOException e) {\n\t // TODO Auto-generated catch block\n\t e.printStackTrace();\n\t }\n\n\t camera.startPreview();\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (resultCode == RESULT_OK) {\n if (requestCode == CommenString.TAKE_PHOTO) {\n cameraUtil.photoZoomFromTake(CropperImageScale.square);\n } else if (requestCode == CommenString.LOCAL_PHOTO) {\n List<String> selectedImage = data.getStringArrayListExtra(\"paths\");\n cameraUtil.photoZoomFromMapStorage(selectedImage.get(0),\n CropperImageScale.square);\n } else if (requestCode == CommenString.PHOTO_RESULT) {\n Bundle extras = data.getExtras();\n if (extras != null) {\n headBitmap = extras.getParcelable(\"data\");\n image_up.setImageBitmap(headBitmap);\n }\n } else {\n }\n }\n }", "private void decodeBase64AndSetImage(String completeImageData, ImageView imageView) {\n String imageDataBytes = completeImageData.substring(completeImageData.indexOf(\",\")+1);\n\n InputStream stream = new ByteArrayInputStream(Base64.decode(imageDataBytes.getBytes(), Base64.DEFAULT));\n\n Bitmap bitmap = BitmapFactory.decodeStream(stream);\n\n imageView.setImageBitmap(bitmap);\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {\n filePath = data.getData();\n try {\n Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "@Override\r\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\r\n\t\t\r\n\t\tif(resultCode!=RESULT_OK){\r\n\t\t\tSystem.out.println(\"error\");\r\n\t\t}if(requestCode==SLE_PH){\r\n\t\t\tif(imageuri!=null){\r\n\t\t\t\ttry {\r\n\t\t\t\t\tis= getContentResolver().openInputStream(imageuri);\r\n\t\t\t\t\tBitmap bm=BitmapFactory.decodeStream(is);\r\n\t\t\t\t\tBitmap bm2= toRoundBitmap(bm);\r\n\t\t\t\t\tself_headimg.setImageBitmap(bm2);\r\n\t\t\t\t\tsaveMyBitmap(bm2);\r\n\t\t\t\t\tpath=Environment.getExternalStorageDirectory()+\"/head.png\";\r\n\t\t\t\t\tmyApplication my=(myApplication) Main_Activity.this.getApplication();\r\n//\t\t\t\t\tToast.makeText(Main_Activity.this, \"\"+my.getUser_name(), Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\tNetUtil.uploadDataByHttpClientFile(Main_Activity.this,f);\r\n\t\t\t\t\t\r\n\t\t\t\t} catch (FileNotFoundException e) {\r\n\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}}", "public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n if (resultCode == RESULT_OK) {\n\n // compare the resultCode with the\n // SELECT_PICTURE constant\n if (requestCode == SELECT_PICTURE) {\n Uri selectedImageURI = data.getData();\n// File imageFile = new File(getRealPathFromURI(selectedImageURI));\n Uri selectedImageUri = data.getData( );\n String picturePath = getPath( getApplicationContext( ), selectedImageUri );\n Log.d(\"Picture Path\", picturePath);\n\n // Get the url of the image from data\n selectedImageUri = data.getData();\n if (null != selectedImageUri) {\n bitmap = null;\n // update the preview image in the layout\n try {\n bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), selectedImageUri);\n } catch (IOException e) {\n e.printStackTrace();\n }\n// IVPreviewImage.setImageURI(selectedImageUri);\n// runTextRecognition(bitmap);\n IVPreviewImage.setImageBitmap(bitmap);\n\n }\n }\n\n if (requestCode == 123) {\n\n\n Bitmap photo = (Bitmap) data.getExtras()\n .get(\"data\");\n\n // Set the image in imageview for display\n IVPreviewImage.setImageBitmap(photo);\n runTextRecognition(photo);\n\n }\n\n }\n }", "@Override\n\t\t\t\t\t\tpublic void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {\n\t\t \t\t\t\tDrawable drawable = iv_details_poster.getDrawable();\n\t\t \t\t\t\tBitmap bitmap = ImageUtil.drawableToBitmap(drawable);\n\t\t \t\t\t\tBitmap bit = Reflect3DImage.skewImage(bitmap, 60);\n\t\t \t\t\t\tiv_details_poster.setImageBitmap(bit);\n\t\t\t\t\t\t}", "private void displaySelectedImage(Intent data) {\n if (data == null) {\n return;\n }\n\n // checkPicture = true; depreciated, try catch to catch if photo exists\n Uri selectedImage = data.getData();\n String[] filePathColumn = {MediaStore.Images.Media.DATA};\n Cursor cursor = getContentResolver().query(selectedImage,\n filePathColumn, null, null, null);\n cursor.moveToFirst();\n int columnIndex = cursor.getColumnIndex(filePathColumn[0]);\n currentPhotoPath = cursor.getString(columnIndex);\n cursor.close();\n Bitmap temp = fixOrientation(BitmapFactory.decodeFile(currentPhotoPath));\n bitmapForAnalysis = temp;\n imageView.setImageBitmap(temp);\n }", "public void onActivityResult(int reqCode, int resCode, Intent data)\n {\n if (reqCode == 1 && resCode == RESULT_OK && data != null)\n {\n // set the URI of the image view\n postImageView.setImageURI(data.getData());\n }\n }", "protected void onPostExecute(Bitmap result){\n // Hide the progress dialog\n // mProgressDialog.dismiss();\n\n if(result!=null){\n // Display the downloaded image into ImageView\n // mImageView.setImageBitmap(result);\n\n // Save bitmap to internal storage\n Uri imageInternalUri = saveImageToInternalStorage(result);\n // Set the ImageView image from internal storage\n // mImageViewInternal.setImageURI(imageInternalUri);\n }else {\n // Notify user that an error occurred while downloading image\n // Snackbar.make(mCLayout,\"Error\",Snackbar.LENGTH_LONG).show();\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {\n Uri selectedImage = data.getData();\n String[] filePathColumn = {MediaStore.Images.Media.DATA};\n Cursor cursor = getContentResolver().query(selectedImage,\n filePathColumn, null, null, null);\n cursor.moveToFirst();\n int columnIndex = cursor.getColumnIndex(filePathColumn[0]);\n picturePath = cursor.getString(columnIndex);\n cursor.close();\n Bitmap bitmap = BitmapFactory.decodeFile(picturePath);\n mItemImageView.setImageBitmap(bitmap);\n }\n }", "@Override\n public void onResponse(JSONObject response) {\n\n try {\n JSONArray jsonArray = response.getJSONArray(\"concepts\");\n //System.out.println(\"array: \" + jsonArray);\n\n for (int i = 0; i < jsonArray.length(); i++){\n JSONObject datos = jsonArray.getJSONObject(i);\n JSONObject datosTop = datos.getJSONObject(\"imgTop\");\n JSONObject datosBot = datos.getJSONObject(\"imgBottom\");\n JSONObject datosMisc = datos.getJSONObject(\"imgMisc\");\n JSONObject datosShoes = datos.getJSONObject(\"imgShoes\");\n JSONObject datosConjunto = datos.getJSONObject(\"imgConjunto\");\n\n imgBase64TopObtenidoDetalle = datosTop.getString(\"img64top\");\n imgBase64BottomObtenidoDetalle = datosBot.getString(\"img64bottom\");\n imgBase64MiscObtenidoDetalle = datosMisc.getString(\"img64misc\");\n imgBase64ShoesObtenidoDetalle = datosShoes.getString(\"img64shoes\");\n imgBase64ConjuntoObtenidoDetalle = datosConjunto.getString(\"img64conjunto\");\n }\n\n //System.out.println(\"top: \" + imgBase64TopObtenidoDetalle);\n //System.out.println(\"bottom: \" + imgBase64BottomObtenidoDetalle);\n //System.out.println(\"misc: \" + imgBase64MiscObtenidoDetalle);\n //System.out.println(\"shoes: \" + imgBase64ShoesObtenidoDetalle);\n //System.out.println(\"conjunto: \" + imgBase64ConjuntoObtenidoDetalle);\n\n byte[] decodedStringTop = Base64.decode(imgBase64TopObtenidoDetalle, Base64.DEFAULT);\n Bitmap decodedByteTop = BitmapFactory.decodeByteArray(decodedStringTop, 0, decodedStringTop.length);\n imgViewTop.setImageBitmap(decodedByteTop);\n\n byte[] decodedStringBottom = Base64.decode(imgBase64BottomObtenidoDetalle, Base64.DEFAULT);\n Bitmap decodedByteBottom = BitmapFactory.decodeByteArray(decodedStringBottom, 0, decodedStringBottom.length);\n imgViewBottom.setImageBitmap(decodedByteBottom);\n\n byte[] decodedStringMisc = Base64.decode(imgBase64MiscObtenidoDetalle, Base64.DEFAULT);\n Bitmap decodedByteMisc = BitmapFactory.decodeByteArray(decodedStringMisc, 0, decodedStringMisc.length);\n imgViewMisc.setImageBitmap(decodedByteMisc);\n\n byte[] decodedStringShoes = Base64.decode(imgBase64ShoesObtenidoDetalle, Base64.DEFAULT);\n Bitmap decodedByteShoes = BitmapFactory.decodeByteArray(decodedStringShoes, 0, decodedStringShoes.length);\n imgViewShoes.setImageBitmap(decodedByteShoes);\n\n byte[] decodedStringConjunto = Base64.decode(imgBase64ConjuntoObtenidoDetalle, Base64.DEFAULT);\n Bitmap decodedByteConjunto = BitmapFactory.decodeByteArray(decodedStringConjunto, 0, decodedStringConjunto.length);\n imgViewConjunto.setImageBitmap(decodedByteConjunto);\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n }", "@Override \r\n\t\t public boolean setViewValue(View view, Object data, \r\n\t\t String textRepresentation) {\n\t\t if(view instanceof ImageView && data instanceof Bitmap){ \r\n\t\t ImageView i = (ImageView)view; \r\n\t\t i.setImageBitmap((Bitmap) data); \r\n\t\t return true; \r\n\t\t } \r\n\t\t return false; \r\n\t\t }", "private Bitmap getGalleryBitmap(@Nullable Intent data) {\n String imagePath = getImagePath(data);\n Thread askPermissionThread = ThreadFactory.createAskPermissionThread(this);\n\n askPermissionThread.start();\n\n try {\n askPermissionThread.join();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n\n return BitmapFactory.decodeFile(imagePath);\n }", "public void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\r\n if (resultCode == Activity.RESULT_OK)\r\n switch (requestCode) {\r\n case 0:\r\n //data.getData return the content URI for the selected Image\r\n Uri selectedImage = data.getData();\r\n String[] filePathColumn = {MediaStore.Images.Media.DATA};\r\n // Get the cursor\r\n Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);\r\n // Move to first row\r\n cursor.moveToFirst();\r\n //Get the column index of MediaStore.Images.Media.DATA\r\n int columnIndex = cursor.getColumnIndex(filePathColumn[0]);\r\n\r\n //Gets the String value in the column\r\n image = cursor.getString(columnIndex);\r\n cursor.close();\r\n // Set the Image in ImageView after decoding the String\r\n // imageView.setImageBitmap(BitmapFactory.decodeFile(imgDecodableString));\r\n\r\n textView.setText(image);\r\n\r\n break;\r\n\r\n }\r\n }" ]
[ "0.7988478", "0.7850651", "0.7450289", "0.7301483", "0.728674", "0.7263929", "0.72353697", "0.7212281", "0.7128506", "0.71188265", "0.710277", "0.7083879", "0.7067691", "0.70519567", "0.70432043", "0.6903063", "0.6888615", "0.68865937", "0.68682015", "0.685968", "0.6804317", "0.6689851", "0.66394687", "0.66192967", "0.6592124", "0.65587765", "0.6549515", "0.6527163", "0.65235066", "0.65019524", "0.6486875", "0.6482178", "0.64820796", "0.6479127", "0.64754266", "0.64733446", "0.64633805", "0.64413774", "0.6437725", "0.64355254", "0.6434056", "0.64317524", "0.6431284", "0.6423758", "0.64172804", "0.6413193", "0.64124084", "0.6407834", "0.64025867", "0.64006037", "0.6399554", "0.63914555", "0.63879585", "0.6386078", "0.63837594", "0.63672906", "0.6359972", "0.63597405", "0.6354348", "0.6353988", "0.63525254", "0.63511753", "0.63494587", "0.6332287", "0.63306713", "0.63303065", "0.63253623", "0.6320552", "0.6305424", "0.63010913", "0.6296188", "0.6292419", "0.6280188", "0.6272531", "0.6270517", "0.627029", "0.62681323", "0.6267341", "0.626395", "0.62578166", "0.62532353", "0.62408525", "0.62325406", "0.62307227", "0.62132055", "0.6208636", "0.6201488", "0.62008005", "0.61985934", "0.61966586", "0.6192174", "0.61884993", "0.6183867", "0.6175949", "0.61744213", "0.61717373", "0.6171643", "0.6171556", "0.6170945", "0.6165982" ]
0.6503229
29
Assert the the job started and notices the change of content.
@Test public void testStartJob() { // Set a specific date for the last change DateTime originalDate = new DateTime(2014, 12, 23, 0, 0, 0); List<MonitorJob> listMonitorJobs = new ArrayList<>(); String url = "http://www.google.com"; MonitorJob monitorJob = new MonitorJob(); monitorJob.setUrl(url); monitorJob.setElement("body"); monitorJob.setLastChange(originalDate.toDate()); monitorJob.setBody("empty body"); listMonitorJobs.add(monitorJob); when(monitorJobRepositoryMock.getAllMonitorJobs()) .thenReturn(listMonitorJobs); monitorJobExecutor.startCheckJobs(); // Assert that the specific date has been changed because content of page changed Assert.assertNotEquals(monitorJob.getLastChange(), originalDate.toDate()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testLaunchJob() throws Exception {\n\t\tJobExecution jobExecution = jobLauncherTestUtils.launchJob();\n\t\tassertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());\n\n\t}", "@InSequence(1)\n @Test\n public void worksAfterDeployment() throws InterruptedException {\n int sum = sendMessages(10);\n runJob();\n Assert.assertEquals(10, collector.getLastItemCount());\n Assert.assertEquals(sum, collector.getLastSum());\n Assert.assertEquals(1, collector.getNumberOfJobs());\n }", "public void assertMsgCheck() {\r\n\t\tassertEquals(successMsg.getText().substring(0,36), \"Success: You have modified products!\");\r\n\t\tSystem.out.println(\"Asserted that the msg has been displayed: \"+ successMsg.getText().substring(0,36));\r\n\t}", "@Override\r\n\tpublic void doBeforeJob() {\n\r\n\t}", "@Test\n\tpublic void testLaunchStep() {\n\t\tJobExecution jobExecution = jobLauncherTestUtils.launchStep(\"step1\");\n\t\tassertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());\n\t}", "public static void beginStep() {\n\t\tTestNotify.log(STEP_SEPARATOR);\n\t TestNotify.log(GenLogTC() + \"is being tested ...\");\n\t}", "@Test\n public void testNewJobHistoryProcessing()\n {\n Job job = jobFakery.makeFakeJob();\n JobHistory newJobHistory = jobHistoryTx.newJobHistoryProcessing(job, START_TIME);\n\n verify(mockJobHistoryDAO).persist(newJobHistory);\n assertEquals(newJobHistory.getStatus(), JobStatus.PROCESSING);\n assertNull(newJobHistory.getEndTime());\n }", "private void verifyChanges() {\n System.out.println(\"Verify changes\"); \n }", "public void testRunWhileBuilding() {\n \t\tfinal IWorkspace workspace = ResourcesPlugin.getWorkspace();\n \t\t//create a POST_BUILD listener that will touch a project\n \t\tfinal IProject touch = workspace.getRoot().getProject(\"ToTouch\");\n \t\tfinal IProject rule = workspace.getRoot().getProject(\"jobThree\");\n \t\tfinal IFile ruleFile = rule.getFile(\"somefile.txt\");\n \t\tensureExistsInWorkspace(rule, true);\n \t\tensureExistsInWorkspace(touch, true);\n \t\tensureExistsInWorkspace(ruleFile, true);\n \t\tfinal Throwable[] failure = new Throwable[1];\n \t\tIResourceChangeListener listener = new IResourceChangeListener() {\n \t\t\tpublic void resourceChanged(IResourceChangeEvent event) {\n \t\t\t\ttry {\n \t\t\t\t\ttouch.touch(null);\n \t\t\t\t} catch (CoreException e) {\n \t\t\t\t\tfailure[0] = e;\n \t\t\t\t} catch (RuntimeException e) {\n \t\t\t\t\tfailure[0] = e;\n \t\t\t\t}\n \t\t\t}\n \t\t};\n \t\tworkspace.addResourceChangeListener(listener, IResourceChangeEvent.POST_BUILD);\n \t\ttry {\n \t\t\t//create one job that does a build, and then waits\n \t\t\tfinal int[] status = new int[3];\n \t\t\tJob jobOne = new Job(\"jobOne\") {\n \t\t\t\tprotected IStatus run(IProgressMonitor monitor) {\n \t\t\t\t\ttry {\n \t\t\t\t\t\tworkspace.run(new IWorkspaceRunnable() {\n \t\t\t\t\t\t\tpublic void run(IProgressMonitor monitor) throws CoreException {\n \t\t\t\t\t\t\t\t//do a build\n \t\t\t\t\t\t\t\tworkspace.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);\n \t\t\t\t\t\t\t\t//signal that the job has done the build\n \t\t\t\t\t\t\t\tstatus[0] = TestBarrier.STATUS_RUNNING;\n \t\t\t\t\t\t\t\t//wait for job two to start\n \t\t\t\t\t\t\t\tTestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_WAIT_FOR_DONE);\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}, null);\n \t\t\t\t\t} catch (CoreException e) {\n \t\t\t\t\t\treturn e.getStatus();\n \t\t\t\t\t}\n \t\t\t\t\treturn Status.OK_STATUS;\n \t\t\t\t}\n \t\t\t};\n \t\t\t//schedule and wait for job one to start\n \t\t\tjobOne.schedule();\n \t\t\tTestBarrier.waitForStatus(status, 0, TestBarrier.STATUS_RUNNING);\n \t\t\t\n \t\t\t//create job two that does an empty workspace operation\n \t\t\tJob jobTwo = new Job(\"jobTwo\") {\n \t\t\t\tprotected IStatus run(IProgressMonitor monitor) {\n \t\t\t\t\ttry {\n \t\t\t\t\t\tworkspace.run(new IWorkspaceRunnable() {\n\t\t\t\t\t\t\tpublic void run(IProgressMonitor monitor) throws CoreException {\n \t\t\t\t\t\t\t\t//signal that this job has started\n \t\t\t\t\t\t\t\tstatus[1] = TestBarrier.STATUS_RUNNING;\n \t\t\t\t\t\t\t\t//let job one finish\n \t\t\t\t\t\t\t\tstatus[0] = TestBarrier.STATUS_WAIT_FOR_DONE;\n \t\t\t\t\t\t\t\t//wait for job three to start\n \t\t\t\t\t\t\t\tTestBarrier.waitForStatus(status, 1, TestBarrier.STATUS_WAIT_FOR_DONE);\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}, null, IResource.NONE, null);\n \t\t\t\t\t} catch (CoreException e) {\n \t\t\t\t\t\treturn e.getStatus();\n \t\t\t\t\t}\n \t\t\t\t\treturn Status.OK_STATUS;\n \t\t\t\t}\n \t\t\t};\n \t\t\tjobTwo.schedule();\n \t\t\t//create job three that has a non-null rule\n \t\t\tJob jobThree= new Job(\"jobThree\") {\n \t\t\t\tprotected IStatus run(IProgressMonitor monitor) {\n \t\t\t\t\ttry {\n \t\t\t\t\t\tworkspace.run(new IWorkspaceRunnable() {\n \t\t\t\t\t\t\tpublic void run(IProgressMonitor monitor) throws CoreException {\n \t\t\t\t\t\t\t\t//signal that this job has started\n \t\t\t\t\t\t\t\tstatus[2] = TestBarrier.STATUS_RUNNING;\n \t\t\t\t\t\t\t\t//let job two finish\n \t\t\t\t\t\t\t\tstatus[1] = TestBarrier.STATUS_WAIT_FOR_DONE;\n \t\t\t\t\t\t\t\t//ensure this job does something so the build listener runs\n \t\t\t\t\t\t\t\truleFile.touch(null);\n \t\t\t\t\t\t\t\t//wait for the ok to complete\n \t\t\t\t\t\t\t\tTestBarrier.waitForStatus(status, 2, TestBarrier.STATUS_WAIT_FOR_DONE);\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t}, workspace.getRuleFactory().modifyRule(ruleFile), IResource.NONE, null);\n \t\t\t\t\t} catch (CoreException e) {\n \t\t\t\t\t\treturn e.getStatus();\n \t\t\t\t\t}\n \t\t\t\t\treturn Status.OK_STATUS;\n \t\t\t\t}\n \t\t\t};\n \t\t\tjobThree.schedule();\n \t\t\t//wait for job two to complete\n \t\t\twaitForCompletion(jobTwo);\n \t\t\t\n \t\t\t//let job three complete\n \t\t\tstatus[2] = TestBarrier.STATUS_WAIT_FOR_DONE;\n \t\t\t\n \t\t\t//wait for job three to complete\n \t\t\twaitForCompletion(jobThree);\n \n \t\t\t//ensure no jobs failed\n \t\t\tIStatus result = jobOne.getResult();\n \t\t\tif (!result.isOK())\n \t\t\t\tfail(\"1.0\", new CoreException(result));\n \t\t\tresult = jobTwo.getResult();\n \t\t\tif (!result.isOK())\n \t\t\t\tfail(\"1.1\", new CoreException(result));\n \t\t\tresult = jobThree.getResult();\n \t\t\tif (!result.isOK())\n \t\t\t\tfail(\"1.2\", new CoreException(result));\n \t\t\t\n \t\t\tif (failure[0] != null)\n \t\t\t\tfail(\"1.3\", failure[0]);\n \t\t} finally {\n\t\t\t//esure listener is removed\n \t\t\tworkspace.removeResourceChangeListener(listener);\n \t\t}\n \t}", "protected void beforeJobExecution() {\n\t}", "@Test\n\tpublic void jobPage() {\n\t\tWebElement jobLink = getDriver().findElement(By.linkText(\"Jobs\"));\n\t\tjobLink.click();\n\t\tWebElement header = getDriver().findElement(By.cssSelector(\"header>h1\"));\n\t\tString headerText = header.getText();\n\t\tAssert.assertEquals(\"Jobs\", headerText, \"Assert Header Text\");\n\n\t}", "@Override\r\n public void onAssertSuccess(IAssert<?> assertCommand) {\r\n BaseTest.print(\"Step \" + (assertMessages.size()+1) + \": PASSED - \" + assertCommand.getMessage());\r\n }", "@Test\n @DisplayName(\"We're R4, there have been successful jobs so set default since\")\n void testDefaultSince() {\n Job oldJob = new Job();\n oldJob.setJobUuid(\"AA-BB\");\n oldJob.setStatus(JobStatus.SUCCESSFUL);\n oldJob.setStatusMessage(\"100%\");\n oldJob.setOrganization(pdpClient.getOrganization());\n oldJob.setOutputFormat(NDJSON_FIRE_CONTENT_TYPE);\n OffsetDateTime oldJobTime = OffsetDateTime.parse(\"2021-01-01T00:00:00.000-05:00\", DateTimeFormatter.ISO_DATE_TIME);\n oldJob.setCreatedAt(oldJobTime);\n oldJob.setFhirVersion(STU3);\n oldJob.setContractNumber(contract.getContractNumber());\n oldJob = jobRepository.save(oldJob);\n\n // This is an even early job (want to make sure it picks the correct old job)\n Job reallyOldJob = new Job();\n reallyOldJob.setJobUuid(\"CC-DD\");\n reallyOldJob.setStatus(JobStatus.SUCCESSFUL);\n reallyOldJob.setStatusMessage(\"100%\");\n reallyOldJob.setOrganization(pdpClient.getOrganization());\n reallyOldJob.setStartedBy(DEVELOPER);\n reallyOldJob.setOutputFormat(NDJSON_FIRE_CONTENT_TYPE);\n OffsetDateTime reallyOldldJobTime = OffsetDateTime.parse(\"2020-12-01T00:00:00.000-05:00\", DateTimeFormatter.ISO_DATE_TIME);\n reallyOldJob.setCreatedAt(reallyOldldJobTime);\n reallyOldJob.setFhirVersion(R4);\n reallyOldJob.setContractNumber(contract.getContractNumber());\n reallyOldJob = jobRepository.save(reallyOldJob);\n\n Job newJob = new Job();\n newJob.setJobUuid(\"YY-ZZ\");\n newJob.setStatus(JobStatus.SUBMITTED);\n newJob.setStatusMessage(\"0%\");\n newJob.setOrganization(pdpClient.getOrganization());\n newJob.setOutputFormat(NDJSON_FIRE_CONTENT_TYPE);\n newJob.setCreatedAt(OffsetDateTime.now());\n newJob.setFhirVersion(R4);\n newJob.setContractNumber(contract.getContractNumber());\n newJob = jobRepository.save(newJob);\n\n Job processedJob = cut.preprocess(newJob.getJobUuid());\n assertEquals(oldJobTime.getNano(), processedJob.getSince().getNano());\n assertEquals(AB2D, processedJob.getSinceSource());\n\n addJobForCleanup(oldJob);\n addJobForCleanup(reallyOldJob);\n addJobForCleanup(newJob);\n }", "public void testBundleRerun1() throws Exception {\n BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);\n this.addRecordToBundleActionTable(job.getId(), \"action1\", 0, Job.Status.SUCCEEDED);\n this.addRecordToBundleActionTable(job.getId(), \"action2\", 0, Job.Status.SUCCEEDED);\n addRecordToCoordJobTable(\"action1\", CoordinatorJob.Status.SUCCEEDED, false);\n addRecordToCoordJobTable(\"action2\", CoordinatorJob.Status.SUCCEEDED, false);\n\n JPAService jpaService = Services.get().get(JPAService.class);\n assertNotNull(jpaService);\n BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());\n job = jpaService.execute(bundleJobGetExecutor);\n assertEquals(Job.Status.SUCCEEDED, job.getStatus());\n\n new BundleRerunXCommand(job.getId(), null, \"2009-02-01T00:00Z\", false, true).call();\n\n job = jpaService.execute(bundleJobGetExecutor);\n assertEquals(Job.Status.RUNNING, job.getStatus());\n }", "public void testContent() {\n TestWARCBatchJob job = new TestWARCBatchJob();\n job.processFile(WARC_FILE, new ByteArrayOutputStream());\n assertEquals(\"Should get the expected record last\",\n LAST_URL, lastSeenURL);\n }", "@Override\n\tpublic void doJob() {\n\t\tSystem.out.println(\"Studying\");\n\t}", "@Test\n public void testCreateConfirmDepositAmountsJob() throws Exception {\n Job asj = new AllocationScraperJob();\n asj.setStatus( JobStatus.completed );\n dao.insertJob( asj );\n\n // setup the job\n Job j = new CreateConfirmDepositAmountsJob();\n j.setStatus( JobStatus.submitted );\n j.getDependentJobs().add( asj );\n int jobId = dao.insertJob( j );\n\n // this should now run the job\n processorService.processJobs();\n\n // verify that the job completed successfully\n Job jobVerify = dao.fetchJobById( jobId );\n Assert.assertEquals( JobStatus.completed, jobVerify.getStatus() );\n }", "@Deployment(resources = {\"org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldCreateIncidentOnFailedStartTimerEvent.bpmn\"})\n @Test\n public void shouldCreateIncidentOnFailedStartTimerEvent() {\n JobQuery jobQuery = managementService.createJobQuery();\n assertEquals(1, jobQuery.count());\n\n Job job = jobQuery.singleResult();\n String jobId = job.getId();\n\n while(0 != job.getRetries()) {\n try {\n managementService.executeJob(jobId);\n fail();\n } catch (Exception e) {\n // expected\n }\n job = jobQuery.jobId(jobId).singleResult();\n\n }\n\n // job exists\n job = jobQuery.singleResult();\n assertNotNull(job);\n\n assertEquals(0, job.getRetries());\n\n // incident was created\n Incident incident = runtimeService.createIncidentQuery().configuration(job.getId()).singleResult();\n assertNotNull(incident);\n\n // manually delete job for timer start event\n managementService.deleteJob(job.getId());\n }", "@Test\n public void testAllocationScraperJob() throws Exception {\n AllocationScraperJob j = new AllocationScraperJob();\n j.setStatus( JobStatus.submitted );\n j.setStartDate( Calendar.getInstance().getTime() );\n j.setDaysAhead( 27 );\n int jobId = dao.insertJob( j );\n\n // this should now run the job\n processorService.processJobs();\n\n // verify that the job completed successfully\n Job jobVerify = dao.fetchJobById( jobId );\n Assert.assertEquals( JobStatus.completed, jobVerify.getStatus() );\n }", "public void testBundleRerun2() throws Exception {\n BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, false);\n this.addRecordToBundleActionTable(job.getId(), \"action1\", 0, Job.Status.SUCCEEDED);\n this.addRecordToBundleActionTable(job.getId(), \"action2\", 0, Job.Status.SUCCEEDED);\n addRecordToCoordJobTable(\"action1\", CoordinatorJob.Status.SUCCEEDED, false);\n addRecordToCoordJobTable(\"action2\", CoordinatorJob.Status.SUCCEEDED, false);\n\n JPAService jpaService = Services.get().get(JPAService.class);\n assertNotNull(jpaService);\n BundleJobGetJPAExecutor bundleJobGetExecutor = new BundleJobGetJPAExecutor(job.getId());\n job = jpaService.execute(bundleJobGetExecutor);\n assertEquals(Job.Status.SUCCEEDED, job.getStatus());\n\n new BundleRerunXCommand(job.getId(), \"action1\", null, false, true).call();\n\n job = jpaService.execute(bundleJobGetExecutor);\n assertEquals(Job.Status.RUNNING, job.getStatus());\n }", "@Override protected void succeeded(Description description) {\n try {\n assertThat(spans.poll(100, TimeUnit.MILLISECONDS))\n .withFailMessage(\"Span remaining in queue. Check for redundant reporting\")\n .isNull();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "public void assertUpdateChangesMessage() {\r\n\t\tprint(\"Assert Updates Changes Confirmation Message\");\r\n\t\tlocator = Locator.MyTrader.Updated_Changes_Messages.value;\r\n\t\tAssert.assertTrue(isElementPresent(locator));\r\n\t}", "@Test\n public void testUnpaidDepositReportJob() throws Exception {\n Job allocScraperJob = new AllocationScraperJob();\n allocScraperJob.setStatus( JobStatus.completed );\n dao.insertJob( allocScraperJob );\n\n // setup a job to scrape allocation info\n Job j = new UnpaidDepositReportJob();\n j.setStatus( JobStatus.submitted );\n j.setParameter( \"allocation_scraper_job_id\", String.valueOf( allocScraperJob.getId() ) );\n int jobId = dao.insertJob( j );\n\n // this should now run the job\n processorService.processJobs();\n\n // verify that the job completed successfully\n Job jobVerify = dao.fetchJobById( jobId );\n Assert.assertEquals( JobStatus.completed, jobVerify.getStatus() );\n }", "@Override\n public void onTestStart(ITestResult tr) {\n StatusPrinter.printTestStart(tr);\n }", "@Test\n void markCompleted() {\n }", "private void handleJobLaunchSuccess() {\n EventBus eventbus = EventBus.getInstance();\n \n JobLaunchedEvent event = new JobLaunchedEvent(tagCaller, fieldName.getValue());\n eventbus.fireEvent(event);\n \n // close dialog now that job has launched\n closeDialog();\n \n MessageBox.info(I18N.DISPLAY.analysisSubmitted(), I18N.DISPLAY.analysisSubmittedMsg(), null);\n \n }", "@Test\n public void testSplitRoomReservationReportJob() throws Exception {\n Job allocJob = new AllocationScraperJob();\n allocJob.setStatus( JobStatus.completed );\n dao.insertJob( allocJob );\n\n // setup a job to find all bookings spanning different rooms\n Job j = new SplitRoomReservationReportJob();\n j.setStatus( JobStatus.submitted );\n j.setParameter( \"allocation_scraper_job_id\", String.valueOf( allocJob.getId() ) );\n int jobId = dao.insertJob( j );\n\n // this should now run the job\n processorService.processJobs();\n\n // verify that the job completed successfully\n Job jobVerify = dao.fetchJobById( jobId );\n Assert.assertEquals( JobStatus.completed, jobVerify.getStatus() );\n }", "@Override\n public void onStart(ITestContext tc) {\n StatusPrinter.printRunStart();\n }", "@Test\n\tpublic void testGetStartDate() {\n\t\tassertEquals(cal, initialJob.getStartDate());\n\t}", "public void testComplete(String msg);", "@Test\n public void testCommitLifecycle() throws Exception {\n describe(\"Full test of the expected lifecycle:\\n\" +\n \" start job, task, write, commit task, commit job.\\n\" +\n \"Verify:\\n\" +\n \"* no files are visible after task commit\\n\" +\n \"* the expected file is visible after job commit\\n\");\n JobData jobData = startJob(false);\n JobContext jContext = jobData.jContext;\n TaskAttemptContext tContext = jobData.tContext;\n ManifestCommitter committer = jobData.committer;\n assertCommitterFactoryIsManifestCommitter(tContext,\n tContext.getWorkingDirectory());\n validateTaskAttemptWorkingDirectory(committer, tContext);\n\n // write output\n describe(\"1. Writing output\");\n final Path textOutputPath = writeTextOutput(tContext);\n describe(\"Output written to %s\", textOutputPath);\n\n describe(\"2. Committing task\");\n Assertions.assertThat(committer.needsTaskCommit(tContext))\n .as(\"No files to commit were found by \" + committer)\n .isTrue();\n commitTask(committer, tContext);\n final TaskManifest taskManifest = requireNonNull(\n committer.getTaskAttemptCommittedManifest(), \"committerTaskManifest\");\n final String manifestJSON = taskManifest.toJson();\n LOG.info(\"Task manifest {}\", manifestJSON);\n int filesCreated = 1;\n Assertions.assertThat(taskManifest.getFilesToCommit())\n .describedAs(\"Files to commit in task manifest %s\", manifestJSON)\n .hasSize(filesCreated);\n Assertions.assertThat(taskManifest.getDestDirectories())\n .describedAs(\"Directories to create in task manifest %s\",\n manifestJSON)\n .isEmpty();\n\n // this is only task commit; there MUST be no part- files in the dest dir\n try {\n RemoteIterators.foreach(getFileSystem().listFiles(outputDir, false),\n (status) ->\n Assertions.assertThat(status.getPath().toString())\n .as(\"task committed file to dest :\" + status)\n .contains(\"part\"));\n } catch (FileNotFoundException ignored) {\n log().info(\"Outdir {} is not created by task commit phase \",\n outputDir);\n }\n\n describe(\"3. Committing job\");\n\n commitJob(committer, jContext);\n\n // validate output\n describe(\"4. Validating content\");\n String jobUniqueId = jobData.jobId();\n ManifestSuccessData successData = validateContent(outputDir,\n true,\n jobUniqueId);\n // look in the SUMMARY\n Assertions.assertThat(successData.getDiagnostics())\n .describedAs(\"Stage entry in SUCCESS\")\n .containsEntry(STAGE, OP_STAGE_JOB_COMMIT);\n IOStatisticsSnapshot jobStats = successData.getIOStatistics();\n // manifest\n verifyStatisticCounterValue(jobStats,\n OP_LOAD_MANIFEST, 1);\n FileStatus st = getFileSystem().getFileStatus(getPart0000(outputDir));\n verifyStatisticCounterValue(jobStats,\n COMMITTER_FILES_COMMITTED_COUNT, filesCreated);\n verifyStatisticCounterValue(jobStats,\n COMMITTER_BYTES_COMMITTED_COUNT, st.getLen());\n\n // now load and examine the job report.\n // this MUST contain all the stats of the summary, plus timings on\n // job commit itself\n\n ManifestSuccessData report = loadReport(jobUniqueId, true);\n Map<String, String> diag = report.getDiagnostics();\n Assertions.assertThat(diag)\n .describedAs(\"Stage entry in report\")\n .containsEntry(STAGE, OP_STAGE_JOB_COMMIT);\n IOStatisticsSnapshot reportStats = report.getIOStatistics();\n verifyStatisticCounterValue(reportStats,\n OP_LOAD_MANIFEST, 1);\n verifyStatisticCounterValue(reportStats,\n OP_STAGE_JOB_COMMIT, 1);\n verifyStatisticCounterValue(reportStats,\n COMMITTER_FILES_COMMITTED_COUNT, filesCreated);\n verifyStatisticCounterValue(reportStats,\n COMMITTER_BYTES_COMMITTED_COUNT, st.getLen());\n\n }", "@Override\r\n\tpublic void tellStarting() {\r\n\t\t// TODO Auto-generated method stub\r\n\r\n\t\t// Not used here\r\n\t}", "@Test\n public void testScrapeReservationsBookedOnJob() throws Exception {\n Job j = new ScrapeReservationsBookedOnJob();\n j.setStatus( JobStatus.submitted );\n j.setParameter( \"booked_on_date\", BookingsPageScraper.DATE_FORMAT_YYYY_MM_DD.format( new Date() ) );\n int jobId = dao.insertJob( j );\n\n // this should now run the job\n processorService.processJobs();\n\n // verify that the job completed successfully\n Job jobVerify = dao.fetchJobById( jobId );\n Assert.assertEquals( JobStatus.completed, jobVerify.getStatus() );\n }", "@Override\n\tpublic void onTestStart(ITestResult arg0) {\n\t\tSystem.out.println(\"when test started\");\n\t\t\n\t}", "public void testGetStartTime() {\n assertTrue(mb.getStartTime() > -1);\n }", "@Override\n\tpublic void beforeJob(JobExecution arg0) {\n\t\t\n\t}", "@Test\n public void testSchedule() throws IOException, InterruptedException {\n Note note = notebook.createNote(\"note1\", anonymous);\n Paragraph p = note.addNewParagraph(ANONYMOUS);\n Map config = new HashMap<>();\n p.setConfig(config);\n p.setText(\"p1\");\n Date dateFinished = p.getDateFinished();\n Assert.assertNull(dateFinished);\n // set cron scheduler, once a second\n config = note.getConfig();\n config.put(\"enabled\", true);\n config.put(\"cron\", \"* * * * * ?\");\n note.setConfig(config);\n notebook.refreshCron(note.getId());\n Thread.sleep((2 * 1000));\n // remove cron scheduler.\n config.put(\"cron\", null);\n note.setConfig(config);\n notebook.refreshCron(note.getId());\n Thread.sleep((2 * 1000));\n dateFinished = p.getDateFinished();\n Assert.assertNotNull(dateFinished);\n Thread.sleep((2 * 1000));\n Assert.assertEquals(dateFinished, p.getDateFinished());\n notebook.removeNote(note.getId(), anonymous);\n }", "public void junitStarted() { }", "public void junitStarted() { }", "@Test\n public void testFileComponent() throws InterruptedException {\n fileComponent.expectedMessageCount(0);\n //fileComponent.expectedBodiesReceived(TRANSFORMED_MSG);\n\n dstartProducer.sendBody(MESSAGE);\n\n fileComponent.assertIsSatisfied();\n }", "public void testCheckinFile() throws Exception {\n System.out.print(\".. Testing checking in a file ..\");\n String filesystem = \"VSS \" + workingDirectory + File.separator + \"Work\";\n Node filesystemNode = new Node(new ExplorerOperator().repositoryTab().getRootNode(), filesystem);\n Node A_FileNode = new Node( filesystemNode, \"A_File [Locally Modified] (\" + userName + \")\");\n new Action(VERSIONING_MENU + \"|\" + CHECK_IN, CHECK_IN).perform(A_FileNode);\n CheckinCommandOperator checkinCommand = new CheckinCommandOperator(\"A_File.java\");\n checkinCommand.setChangeDescription(\"Three lines have changed.\");\n checkinCommand.ok();\n Thread.sleep(2000);\n A_FileNode = new Node(filesystemNode, \"A_File [Current]\");\n File A_File = new File(workingDirectory + File.separator + \"Work\" + File.separator + \"A_File.java\");\n if (A_File.canWrite()) captureScreen(\"Error: A_File.java remained read-write after check in.\");\n System.out.println(\". done !\");\n }", "private void assertRunningState() {\n Misc.checkArgument(this.state == State.STARTED || this.state == State.STOPPING,\n \"Replicate state must be STARTED or STOPPING.\");\n }", "@Test\n public void testEJTracking_RollingQuota() {\n JobStatus jobStatus = createExpeditedJobStatus(\"testEJTracking_RollingQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus);\n setProcessState(ActivityManager.PROCESS_STATE_SERVICE);\n Handler handler = mQuotaController.getHandler();\n spyOn(handler);\n\n long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n final long remainingTimeMs = SECOND_IN_MILLIS;\n // The package only has one second to run, but this session is at the edge of the rolling\n // window, so as the package \"reaches its quota\" it will have more to keep running.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - mQcConstants.EJ_WINDOW_SIZE_MS,\n 10 * SECOND_IN_MILLIS - remainingTimeMs, 1), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS,\n mQcConstants.EJ_LIMIT_WORKING_MS - 10 * SECOND_IN_MILLIS, 1), true);\n\n synchronized (mQuotaController.mLock) {\n assertEquals(remainingTimeMs,\n mQuotaController.getRemainingEJExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n\n // Start the job.\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(0))\n .onControllerStateChanged(argThat(jobs -> jobs.size() > 0));\n assertTrue(jobStatus.isExpeditedQuotaApproved());\n // The job used up the remaining quota, but in that time, the same amount of time in the\n // old TimingSession also fell out of the quota window, so it should still have the same\n // amount of remaining time left its quota.\n synchronized (mQuotaController.mLock) {\n assertEquals(remainingTimeMs,\n mQuotaController.getRemainingEJExecutionTimeLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE));\n }\n // Handler is told to check when the quota will be consumed, not when the initial\n // remaining time is over.\n verify(handler, atLeast(1)).sendMessageDelayed(\n argThat(msg -> msg.what == QuotaController.MSG_REACHED_EJ_QUOTA),\n eq(10 * SECOND_IN_MILLIS));\n verify(handler, never()).sendMessageDelayed(any(), eq(remainingTimeMs));\n }", "@Override\n\tpublic void startWork() {\n\t\tSystem.out.println(\"Robot is working\");\n\t}", "private void scheduleJob() {\n\n }", "@Test(groups={\"broken\"})\n\tpublic void triggerCompleteDeletesJob() throws SchedulerException,\n\t\t\tInterruptedException {\n\n\t\tScheduler sched = null;\n\t\ttry {\n\t\t\t\n\t\t\tSchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory(); \n\t\t\tsched = schedFact.getScheduler(); \n\t\t\t\n//\t\t\tsched.getListenerManager().addTriggerListener(\n//\t new TriggerListener() {\n//\n//\t @Override\n//\t public String getName() {\n//\t return \"Unit Test Trigger Listener\";\n//\t }\n//\n//\t\t\t\t\t\t@Override\n//\t\t\t\t\t\tpublic void triggerFired(Trigger trigger,\n//\t\t\t\t\t\t\t\tJobExecutionContext context) {\n//\t\t\t\t\t\t\tlog.debug(\"working on a new job\"); \n//\t\t\t\t\t\t}\n//\n//\t\t\t\t\t\t@Override\n//\t\t\t\t\t\tpublic boolean vetoJobExecution(Trigger trigger,\n//\t\t\t\t\t\t\t\tJobExecutionContext context) {\n//\t\t\t\t\t\t\treturn false;\n//\t\t\t\t\t\t}\n//\n//\t\t\t\t\t\t@Override\n//\t\t\t\t\t\tpublic void triggerMisfired(Trigger trigger) {\n//\t\t\t\t\t\t\tlog.debug(\"ignoring misfire event\"); \n//\t\t\t\t\t\t}\n//\n//\t\t\t\t\t\t@Override\n//\t\t\t\t\t\tpublic void triggerComplete(\n//\t\t\t\t\t\t\t\tTrigger trigger,\n//\t\t\t\t\t\t\t\tJobExecutionContext context,\n//\t\t\t\t\t\t\t\tCompletedExecutionInstruction triggerInstructionCode) {\n//\t\t\t\t\t\t\tjobFinished.set(true);\n//\t\t\t\t\t\t}\n//\t \n//\t }, EverythingMatcher.allTriggers()\n//\t );\n//\t\t\t\n//\t\t\tsched.getListenerManager().addJobListener(\n//\t\t\t\t\tnew AgaveJobCleanupListener(), EverythingMatcher.allJobs());\n//\t\t\t\n//\t\t\t\n\t\t\tString jobUuid = \"12345\";\n\n\t\t\tJobDetail jobDetail = org.quartz.JobBuilder.newJob(StagingWatch.class)\n\t\t\t\t\t.usingJobData(\"uuid\", jobUuid)\n\t\t\t\t\t.withIdentity(jobUuid, \"demoWorkers\")\n\t\t\t\t\t.build();\n\n\t\t\tSimpleTrigger trigger = (SimpleTrigger) newTrigger()\n\t\t\t\t\t.withIdentity(jobUuid, \"demoWorkers\")\n\t\t\t\t\t.build();\n\t\t\t\n\t\t\tsched.scheduleJob(jobDetail, trigger);\n\t\t\tsched.start();\n\t\t\t\n\t\t\tThread.sleep(3000);\n\t\t\t\n//\t\t\tString summary = null;\n//\t\t\twhile (sched.getMetaData().getNumberOfJobsExecuted() == 0) {\n//\t\t\t\tif (!StringUtils.equals(summary, sched.getMetaData().getSummary())) {\n//\t\t\t\t\tSystem.out.println(sched.getMetaData().getSummary());\n//\t\t\t\t\tsummary = sched.getMetaData().getSummary();\n//\t\t\t\t}\n//\t\t\t\t//System.out.println(sched.getJobDetail(jobDetail.getKey()));\n//\t\t\t};\n\t\t\t\n\t\t\tAssert.assertEquals(sched.getMetaData().getNumberOfJobsExecuted(), 1,\n\t\t\t\t\t\"Incorrect number of jobs executed.\");\n\n\t\t\tAssert.assertFalse(sched.checkExists(jobDetail.getKey()),\n\t\t\t\t\t\"Job should be deleted immediately after it fires.\");\n\n\t\t\tAssert.assertFalse(sched.checkExists(trigger.getKey()),\n\t\t\t\t\t\"Trigger should be deleted immediately after it fires.\");\n\t\t} finally {\n\t\t\tif (sched != null) {\n\t\t\t\ttry {\n\t\t\t\t\tsched.clear();\n\t\t\t\t\tsched.shutdown(false);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t\t\"Failed to shtudown and clear scheduler after test.\",\n\t\t\t\t\t\t\te);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}", "public void onTestStart(ITestResult result) {\n\t\tSystem.out.println(\"The test case is started :\"+result.getName());\n\t}", "public void verifyEngagementOverviewToDoChange() {\n String strStepSuccess = \"Verify engagement overview ToDo does change when click on archive button\";\n String strStepFail = \"TestScript Failed: Verify engagement overview ToDo does not change when click on archive button\";\n try {\n boolean result;\n waitForVisibleElement(eleEngagementOverViewToDoText, \"Wait engagement overview todo\");\n result = engagementOverViewToDoBefore.toLowerCase().equals(eleEngagementOverViewToDoText.getText().trim().toLowerCase());\n // will update to assert false when bug has fixed\n Assert.assertTrue(result, \"Engagement overview ToDo change\");\n NXGReports.addStep(strStepSuccess, LogAs.PASSED, null);\n } catch (AssertionError e) {\n AbstractService.sStatusCnt++;\n NXGReports.addStep(strStepFail, LogAs.FAILED, new CaptureScreen(CaptureScreen.ScreenshotOf.BROWSER_PAGE));\n }\n }", "public void execute(JobExecutionContext context)\r\n throws JobExecutionException {\n _log.info(\"Hello World! Job 2 - \" + new Date());\r\n System.out.println(\"Hello World! Job 2 - \" + new Date());\r\n }", "public void onTestStart(ITestResult result) {\n\t\tSystem.out.println(\"********** \tTest Started : \"+result.getName());\n\t\t\n\t}", "@Test\n public void testSuccess() throws ComponentInitializationException {\n final Event event = action.execute(requestCtx);\n ActionTestingSupport.assertProceedEvent(event);\n }", "public void junitEnded() { }", "public void junitEnded() { }", "@Override\r\n\tpublic void onStart(ISuite arg0) {\n\t\tbuildTime = getCurrentDate();\r\n\t\tbuildDate = getCurrentTimeStamp();\r\n\t}", "protected void runBeforeStep() {}", "void onSuccessfulStarted();", "@Override\n\tpublic void onTestSuccess(ITestResult result) {\n\t\tthread.get().log(Status.PASS, \"Pass\");\n\t}", "private static void testValid() throws Throwable {\n Scheduler userInt = SchedulerTHelper.getSchedulerInterface();\n\n for (int i = 0; i < jobs_valid; i++) {\n String job_path = new File(jobs_path.toURI()).getAbsolutePath() + \"/flow_valid_\" + (i + 1) +\n \".xml\";\n\n Exception exc = null;\n JobId job = null;\n try {\n job = userInt.submit(JobFactory.getFactory().createJob(job_path));\n } catch (Exception e) {\n exc = e;\n } finally {\n userInt.removeJob(job);\n }\n Assert.assertTrue(\"JobFactory returned null for valid job \" + job_path, job != null);\n Assert.assertTrue(\"JobFactory threw an exception for valid job \" + job_path, exc == null);\n }\n SchedulerTHelper.log(jobs_valid + \" valid jobs successfully created\");\n }", "@Test\n public void testEJTimerTracking_TempAllowlisting() {\n setDischarging();\n setProcessState(ActivityManager.PROCESS_STATE_RECEIVER);\n final long gracePeriodMs = 15 * SECOND_IN_MILLIS;\n setDeviceConfigLong(QcConstants.KEY_EJ_GRACE_PERIOD_TEMP_ALLOWLIST_MS, gracePeriodMs);\n Handler handler = mQuotaController.getHandler();\n spyOn(handler);\n\n JobStatus job1 = createExpeditedJobStatus(\"testEJTimerTracking_TempAllowlisting\", 1);\n JobStatus job2 = createExpeditedJobStatus(\"testEJTimerTracking_TempAllowlisting\", 2);\n JobStatus job3 = createExpeditedJobStatus(\"testEJTimerTracking_TempAllowlisting\", 3);\n JobStatus job4 = createExpeditedJobStatus(\"testEJTimerTracking_TempAllowlisting\", 4);\n JobStatus job5 = createExpeditedJobStatus(\"testEJTimerTracking_TempAllowlisting\", 5);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(job1, null);\n }\n assertNull(mQuotaController.getEJTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE));\n List<TimingSession> expected = new ArrayList<>();\n\n long start = JobSchedulerService.sElapsedRealtimeClock.millis();\n synchronized (mQuotaController.mLock) {\n mQuotaController.prepareForExecutionLocked(job1);\n }\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStopTrackingJobLocked(job1, job1, true);\n }\n expected.add(createTimingSession(start, 10 * SECOND_IN_MILLIS, 1));\n assertEquals(expected,\n mQuotaController.getEJTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE));\n\n advanceElapsedClock(SECOND_IN_MILLIS);\n\n // Job starts after app is added to temp allowlist and stops before removal.\n start = JobSchedulerService.sElapsedRealtimeClock.millis();\n mTempAllowlistListener.onAppAdded(mSourceUid);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(job2, null);\n mQuotaController.prepareForExecutionLocked(job2);\n }\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStopTrackingJobLocked(job2, null, false);\n }\n assertEquals(expected,\n mQuotaController.getEJTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE));\n\n // Job starts after app is added to temp allowlist and stops after removal,\n // before grace period ends.\n mTempAllowlistListener.onAppAdded(mSourceUid);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(job3, null);\n mQuotaController.prepareForExecutionLocked(job3);\n }\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n mTempAllowlistListener.onAppRemoved(mSourceUid);\n start = JobSchedulerService.sElapsedRealtimeClock.millis();\n long elapsedGracePeriodMs = 2 * SECOND_IN_MILLIS;\n advanceElapsedClock(elapsedGracePeriodMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStopTrackingJobLocked(job3, null, false);\n }\n assertEquals(expected,\n mQuotaController.getEJTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE));\n\n advanceElapsedClock(SECOND_IN_MILLIS);\n elapsedGracePeriodMs += SECOND_IN_MILLIS;\n\n // Job starts during grace period and ends after grace period ends\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(job4, null);\n mQuotaController.prepareForExecutionLocked(job4);\n }\n final long remainingGracePeriod = gracePeriodMs - elapsedGracePeriodMs;\n start = JobSchedulerService.sElapsedRealtimeClock.millis() + remainingGracePeriod;\n advanceElapsedClock(remainingGracePeriod);\n // Wait for handler to update Timer\n // Can't directly evaluate the message because for some reason, the captured message returns\n // the wrong 'what' even though the correct message goes to the handler and the correct\n // path executes.\n verify(handler, timeout(gracePeriodMs + 5 * SECOND_IN_MILLIS)).handleMessage(any());\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n expected.add(createTimingSession(start, 10 * SECOND_IN_MILLIS, 1));\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStopTrackingJobLocked(job4, job4, true);\n }\n assertEquals(expected,\n mQuotaController.getEJTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE));\n\n // Job starts and runs completely after temp allowlist grace period.\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n start = JobSchedulerService.sElapsedRealtimeClock.millis();\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(job5, null);\n mQuotaController.prepareForExecutionLocked(job5);\n }\n advanceElapsedClock(10 * SECOND_IN_MILLIS);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStopTrackingJobLocked(job5, job5, true);\n }\n expected.add(createTimingSession(start, 10 * SECOND_IN_MILLIS, 1));\n assertEquals(expected,\n mQuotaController.getEJTimingSessions(SOURCE_USER_ID, SOURCE_PACKAGE));\n }", "@Test\n public void progressionUpdaterStartedAfterPlay() {\n expandPanel();\n SeekBar seekBar = (SeekBar) getActivity().findViewById(R.id.mpi_seek_bar);\n final int progress = seekBar.getProgress();\n\n onView(isRoot()).perform(ViewActions.waitForView(\n R.id.mpi_seek_bar, new ViewActions.CheckStatus() {\n @Override\n public boolean check(View v) {\n return ((SeekBar) v).getProgress() > progress;\n }\n }, 10000));\n }", "@Test\n \tpublic void testHandleStep() throws Exception {\n \t\t\n \t\tclass StubStep extends StepSupport {\n \n \t\t\tstatic final String value = \"message for next steps\";\n \n \t\t\tstatic final String key = \"StubStep\";\n \n \t\t\t{\n \t\t\t\tsetName(\"StubStep\");\n \t\t\t}\n \n \t\t\tpublic void execute(StepExecution stepExecution) throws JobInterruptedException {\n \t\t\t\tstepExecution.getJobExecution().getExecutionContext().put(key, value);\n \t\t\t}\n \t\t}\n \t\t\n \t\tMapJobRepositoryFactoryBean.clear();\n \t\tMapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean();\n \t\tfactory.setTransactionManager(new ResourcelessTransactionManager());\n \t\tfactory.afterPropertiesSet();\n \t\tJobRepository repository = (JobRepository) factory.getObject();\n \t\tjob.setJobRepository(repository);\n \t\tjob.setRestartable(true);\n \n \t\tJobExecution execution = repository.createJobExecution(\"testHandleStepJob\", new JobParameters());\n \t\tjob.handleStep(new StubStep(), execution);\n \n \t\tassertEquals(StubStep.value, execution.getExecutionContext().get(StubStep.key));\n \n \t\t// simulate restart and check the job execution context's content survives\n \t\texecution.setEndTime(new Date());\n \t\texecution.setStatus(BatchStatus.FAILED);\n \t\trepository.update(execution);\n \n \t\tJobExecution restarted = repository.createJobExecution(\"testHandleStepJob\", new JobParameters());\n \t\tassertEquals(StubStep.value, restarted.getExecutionContext().get(StubStep.key));\n \t}", "@Test\n public void testStartProcessing() {\n simpleProcessingStarterUnderTest.startProcessing();\n\n // Verify the results\n }", "@Override\r\n\tpublic void onTestStart(ITestResult result) {\n\t\tSystem.out.println(\"TC on Test start\"+\" \"+result.getName());\r\n\t}", "@Test\n public void testJobOverviewHandler() throws Exception {\n // this only works if there is no active job at this point\n assertTrue(getRunningJobs(CLUSTER.getClusterClient()).isEmpty());\n\n // Create a task\n final JobVertex sender = new JobVertex(\"Sender\");\n sender.setParallelism(2);\n sender.setInvokableClass(BlockingInvokable.class);\n\n final JobGraph jobGraph = JobGraphTestUtils.streamingJobGraph(sender);\n\n ClusterClient<?> clusterClient = CLUSTER.getClusterClient();\n clusterClient.submitJob(jobGraph).get();\n\n // wait for job to show up\n while (getRunningJobs(CLUSTER.getClusterClient()).isEmpty()) {\n Thread.sleep(10);\n }\n\n // wait for tasks to be properly running\n BlockingInvokable.latch.await();\n\n final Duration testTimeout = Duration.ofMinutes(2);\n\n String json =\n TestBaseUtils.getFromHTTP(\"http://localhost:\" + getRestPort() + \"/jobs/overview\");\n\n ObjectMapper mapper = new ObjectMapper();\n JsonNode parsed = mapper.readTree(json);\n ArrayNode jsonJobs = (ArrayNode) parsed.get(\"jobs\");\n assertEquals(1, jsonJobs.size());\n assertThat(\"Duration must be positive\", jsonJobs.get(0).get(\"duration\").asInt() > 0);\n\n clusterClient.cancel(jobGraph.getJobID()).get();\n\n // ensure cancellation is finished\n while (!getRunningJobs(CLUSTER.getClusterClient()).isEmpty()) {\n Thread.sleep(20);\n }\n\n BlockingInvokable.reset();\n }", "@Test\n\t@Deployment(resources = \"process.bpmn\")\n\tpublic void testCurrentStatus() {\n\t\t\t\n\t\t// Obtain test run of BPMN\n\t\tProcessInstanceWithVariables processInstance = (ProcessInstanceWithVariables)processEngine().getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY);\n\n\t\t// Obtain the value of the deliveryOK variable\n\t\tboolean deliveryOK = (boolean)processInstance.getVariables().get(\"deliveryOK\");\n\t\tSystem.out.println(\"DeliveryOK: \" + deliveryOK);\n\t\t\t\n\t \n\t\t// Obtain a reference to the current task\n\t\tTaskAssert task = assertThat(processInstance).task();\n\n\t\tif (deliveryOK) {\n\t\t\t\tassertThat(processInstance).isWaitingAt(\"Activity_066txhw\");\n\t\t\t\ttask.hasName(\"Checkout 1\");\n\t\t\t\ttask.isNotAssigned();\n\t\t\t} else {\n\t\t\t\tassertThat(processInstance).isWaitingAt(\"Activity_19fouew\");\n\t\t\t\ttask.hasName(\"Checkout 2\");\n\t\t\t\ttask.isNotAssigned();\n\t\t\t}\n\n\t\t}", "public void actionSuccessful() {\n System.out.println(\"Action performed successfully!\");\n }", "private static void scheduleJob(Context context, JobInfo job) {\n JobScheduler jobScheduler =\n (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);\n int result = jobScheduler.schedule(job);\n Assert.assertEquals(JobScheduler.RESULT_SUCCESS, result);\n if (DEBUG) {\n Log.d(TAG, \"Scheduling result is \" + result);\n }\n }", "@Override\n\tpublic void onTestSuccess(ITestResult arg0) {\n\t\tSystem.out.println(\"when test success\");\n\t\t\n\t}", "@Override\n\tpublic void start()\n\t{\n\t\tarena = \"scenarios/boxpushing/arena/pioneer.controller.arena.txt\"; \n\n\t\t\n\t\tschedule.reset();\n\n\t\tsuper.start();\n\n\t\tresetBehavior();\n\n\t}", "@Test\n\tpublic void testEqualsObject() {\n\t\tJob testJob = new Job(\"Trash Pickup\", initialPark, cal, cal2,\n\t\t\t\t\"This job will just be picking up trash.\", new ArrayList<User>(), 5, 2, 0);\n\t\tassertEquals(testJob, initialJob);\n\t}", "@Override\n\t\t\tpublic void beforeJob(JobExecution jobExecution) {\n\t\t\t\t\n\t\t\t}", "protected void succeed()\r\n {\r\n // inform user\r\n ((OwMainAppContext) getContext()).postMessage(getContext().localize(\"plug.owdocprops.OwFieldView.saved\", \"The changes have been applied.\"));\r\n }", "public void onTestStart(ITestResult result) {\n\t\tlogger.info(\"Test Case Started\" + result.getName());\n\t}", "@Test\n\tpublic void testAgentLogsFinal() {\n\t\tReporter reporter = mock(Reporter.class);\n\t\tparty = new ShineParty(reporter);\n\t\tparty.connect(connection);\n\t\tparty.notifyChange(settings);\n\t\tparty.notifyChange(new Finished(null));\n\n\t\tverify(reporter).log(eq(Level.INFO),\n\t\t\t\teq(\"Final ourcome:Finished[null]\"));\n\t}", "@Test\n public void testAMWorkflow() throws Throwable {\n describe(\"Create a committer with a null output path & use as an AM\");\n JobData jobData = startJob(true);\n JobContext jContext = jobData.jContext;\n TaskAttemptContext tContext = jobData.tContext;\n\n TaskAttemptContext newAttempt = new TaskAttemptContextImpl(\n jContext.getConfiguration(),\n taskAttempt0);\n Configuration conf = jContext.getConfiguration();\n\n // bind\n TextOutputForTests.bind(conf);\n\n OutputFormat<?, ?> outputFormat\n = ReflectionUtils.newInstance(newAttempt.getOutputFormatClass(), conf);\n Path outputPath = FileOutputFormat.getOutputPath(newAttempt);\n Assertions.assertThat(outputPath)\n .as(\"null output path in new task attempt\")\n .isNotNull();\n\n ManifestCommitter committer2 = (ManifestCommitter)\n outputFormat.getOutputCommitter(newAttempt);\n committer2.abortTask(tContext);\n\n }", "@Test\n public void testStartDateChange() throws Exception {\n EventData deltaEvent = prepareDeltaEvent(createdEvent);\n Calendar date = Calendar.getInstance();\n date.setTimeInMillis(date.getTimeInMillis() + TimeUnit.HOURS.toMillis(1));\n deltaEvent.setStartDate(DateTimeUtil.getDateTime(date));\n\n updateEventAsOrganizer(deltaEvent);\n\n /*\n * Check that start date has been updated\n * Note: Due internal handling of a shortened Event, no rescheduling will happen. Thus the participant status is\n * unchanged. For details see com.openexchange.chronos.impl.Utils.coversDifferentTimePeriod(Event, Event) or\n * http://documentation.open-xchange.com/latest/middleware/calendar/implementation_details.html#reset-of-participation-status\n */\n AnalyzeResponse analyzeResponse = receiveUpdateAsAttendee(PartStat.ACCEPTED, CustomConsumers.ACTIONS);\n AnalysisChange change = assertSingleChange(analyzeResponse);\n assertSingleDescription(change, \"The appointment was rescheduled.\");\n }", "@Then ( \"^The labor and delivery report is documented successfully$\" )\n public void documentedSuccessfully () {\n waitForAngular();\n // confirm that the error message is displayed\n driver.get( baseUrl );\n final WebDriverWait wait = new WebDriverWait( driver, 20 );\n wait.until( ExpectedConditions.titleContains( \"HCP Home\" ) );\n assertEquals( \"iTrust2: HCP Home\", driver.getTitle() );\n wait.until( ExpectedConditions.elementToBeClickable( By.name( \"transactionTypeCell\" ) ) );\n assertTextPresent( \"HCP views an OB/GYN Labor and Delivery Report\" );\n }", "@Override\n public void testPeriodic() {\n //Diagnostics.writeString(\"State\", \"TEST\");\n }", "@Test\n\tpublic void simpleSubmitAndWaitForeverTest() {\n\t\ttry {\n\t\t\tSession session = SessionFactory.getFactory().getSession();\n\n\t\t\tsession.init(contactName);\n\t\t\tJobTemplate jt = session.createJobTemplate();\n\t\t\t\n\t\t\t// Note: The test will fail if the user's home directory does not\n\t\t\t// exist on the execute node.\n\t\t\tjt.setWorkingDirectory(System.getProperty(\"user.home\"));\n\t\t\tjt.setRemoteCommand(\"/bin/sleep\");\n\t\t\tjt.setArgs(Collections.singletonList(\"10\"));\n\t\t\tjt.setJobName(SimpleTest.class.getSimpleName());\n\t\t\tString jobId = session.runJob(jt);\n\t\t\t\n\t\t\tassertNotNull(jobId);\n\t\t\tassertTrue(jobId.length() > 0);\n\t\t\t\n\t\t\t// Delete the template\n\t\t\tsession.deleteJobTemplate(jt);\n\n\t\t\t// Wait for the job to complete\n\t\t\tJobInfo jobInfo = session.wait(jobId, Session.TIMEOUT_WAIT_FOREVER);\n\n\t\t\tassertNotNull(jobInfo);\n\t\t\t\n\t\t\t// Exit the session\n\t\t\tsession.exit();\n\t\t} catch (Exception de) {\n\t\t\tde.printStackTrace();\n\t\t\tfail(de.getMessage());\n\t\t}\n\t}", "@Override\n\tvoid startWork() {\n\t\t\n\t}", "@Override\n\tvoid startWork() {\n\t\t\n\t}", "@Test\n @Ignore\n public void testFileTimestampChangeForManualTest() {\n \t// prepare test folder\n \tFile srcFolder = new File(\"C:\\\\bitlocker\\\\job_test\");\n \tFile targetFolder = new File(\"C:\\\\bitlocker\\\\job\");\n \ttry {\n \t\tif (targetFolder.exists()) FileUtils.cleanDirectory(targetFolder);\n\t\t\tFileUtils.copyDirectory(srcFolder, targetFolder);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n \tassertThat(targetFolder.exists(), is(true));\n \t\n \tint retentionDays = findAssetRetentionDays(META_INBOUNDFILE);\n \tassertThat(retentionDays, is(14));\n \t\n \t// change last modified date for testing files\n Date testingFileDate = getRetentionDate(retentionDays+1);\t// 1 day older\n for (File file: targetFolder.listFiles()) {\n \tfile.setLastModified(testingFileDate.getTime()); // update date\n }\n }", "@Override\n\tpublic void onTestStart(ITestResult arg0) {\n\t\t\n\t}", "@Override\r\n\tpublic void onTestStart(ITestResult arg0) {\n\t\t\r\n\t}", "public void menuJobTest() throws Exception;", "public void testRestart() throws Exception {\n \t\tsource.open(executionContext);\n \t\tsource.read();\n \t\tsource.update(executionContext);\n \t\tSystem.out.println(executionContext);\n\t\tassertEquals(1, executionContext.getLong(ClassUtils.getShortName(StaxEventItemReader.class) + \".piece.count\"));\n \t\tList expectedAfterRestart = (List) source.read();\n \n \t\tsource = createNewInputSouce();\n \t\tsource.open(executionContext);\n \t\tList afterRestart = (List) source.read();\n \t\tassertEquals(expectedAfterRestart.size(), afterRestart.size());\n \t}", "public void testHasPendingChanges() throws RepositoryException{\n boolean result = true;\n \n sessionControl.expectAndReturn(session.hasPendingChanges(), result);\n sessionControl.replay();\n sfControl.replay();\n \n assertEquals(jt.hasPendingChanges(), result);\n }", "@Override\r\n\tpublic void doAfterJob() {\n\r\n\t}", "public void markRunStart(){\r\n runStart = stepCount;\r\n }", "public abstract void displayMsgBeforeRun();", "@Test\n void isComplete() {\n }", "public void onTestStart(ITestResult arg0) {\n\t\t\n\t}", "public void onTestStart(ITestResult arg0) {\n\t\t\n\t}", "@Test\n public void testGroupBookingsReportJob() throws Exception {\n Job allocJob = new AllocationScraperJob();\n allocJob.setStatus( JobStatus.completed );\n dao.insertJob( allocJob );\n\n // setup a job to find reservations with more than X guests\n Job j = new GroupBookingsReportJob();\n j.setStatus( JobStatus.submitted );\n j.setParameter( \"allocation_scraper_job_id\", String.valueOf( allocJob.getId() ) );\n int jobId = dao.insertJob( j );\n\n // this should now run the job\n processorService.processJobs();\n\n // verify that the job completed successfully\n Job jobVerify = dao.fetchJobById( jobId );\n Assert.assertEquals( JobStatus.completed, jobVerify.getStatus() );\n }", "boolean notifyBegin();", "public void onTestStart(ITestResult result) {\n\t\t\r\n\t}", "public void onTestStart(ITestResult result) {\n\t\t\r\n\t}", "@Override\n\tpublic void onTestStart(ITestResult result) {\n\t\t\n\t}", "@Override\n\tpublic void onTestStart(ITestResult result) {\n\t\t\n\t}", "@Test\n public void processUpdates_Test() throws Exception {\n try {\n System.out.println(\"processUpdates_Test\");\n\n\n persistManager_Server.registerPersistenceEventListener(PersistenceEventType.Server_Event_ProcessedChunk,\n new PersistentMatricesManager_EventListener() {\n\n public void eventOccurred(PersistentMatricesManager persistenceMatrixManager, PersistenceEventType eventType, Object... eventParams)\n throws Exception_PersistenceEventHandler {\n try {\n serverEvent_ProcessedChunk((Integer)eventParams[0], (File)eventParams[1], (Long)eventParams[2]);\n } catch(Exception e) {\n throw new Exception_PersistenceEventHandler(\"Had ERROR!\", e);\n }\n }\n }\n );\n\n persistManager_Server.registerPersistenceEventListener(PersistenceEventType.Server_Event_ShutDownRequestCompleted,\n new PersistentMatricesManager_EventListener() {\n\n public void eventOccurred(PersistentMatricesManager persistenceMatrixManager, PersistenceEventType eventType, Object... eventParams)\n throws Exception_PersistenceEventHandler {\n try {\n serverEvent_ShutdownRequestCompleted();\n } catch(Exception e) {\n throw new Exception_PersistenceEventHandler(\"Had ERROR!\", e);\n }\n }\n }\n );\n\n super.register_PersistenceMatrixGeneration_ServerEvents();\n\n\n // Wait until all the chunks have been processed\n synchronized(testThread_LockObject) {\n testThread_LockObject.wait();\n }\n System.out.println(\"Waiting for server to terminate inbox monitor thread...\");\n persistManager_Server.awaitTermination();\n // sleep for a couple of secs, in case multiThreaded_AssertEquals() has had an assert failure,\n // is stopping the server, and doing any last operations.\n Thread.sleep(3000);\n\n System.out.println(\"...Test stopped.\");\n\n\n } catch (Exception e) {\n stopPersistenceServer();\n throw e;\n }\n\n }" ]
[ "0.6213956", "0.6040014", "0.59241295", "0.59132797", "0.58985513", "0.5856837", "0.5824152", "0.57940847", "0.5769601", "0.5755505", "0.569672", "0.56881154", "0.5682507", "0.5678452", "0.5641158", "0.56077504", "0.5583276", "0.55774015", "0.5530866", "0.5478374", "0.5473291", "0.54667765", "0.5461993", "0.5441938", "0.5438186", "0.54187435", "0.54123676", "0.54085016", "0.539713", "0.53842247", "0.53821933", "0.5381975", "0.5376251", "0.53729993", "0.5367487", "0.5361331", "0.5346669", "0.53427076", "0.53427076", "0.5332319", "0.5319849", "0.5307637", "0.5304436", "0.53000724", "0.5283721", "0.5273715", "0.5270508", "0.52502763", "0.5241135", "0.521983", "0.5217926", "0.51860076", "0.51860076", "0.51697874", "0.5153103", "0.5145966", "0.5143562", "0.5139841", "0.5137092", "0.5136142", "0.51339835", "0.5128015", "0.511104", "0.5109619", "0.51055056", "0.51046526", "0.51038396", "0.510352", "0.51000684", "0.50993997", "0.5099178", "0.5093769", "0.5086241", "0.5084187", "0.5084181", "0.5079644", "0.507857", "0.5069093", "0.50663483", "0.5066173", "0.5066173", "0.50649697", "0.5062378", "0.5057195", "0.50541955", "0.505384", "0.50522923", "0.50472", "0.5041572", "0.50395566", "0.5037184", "0.5036034", "0.5036034", "0.5031495", "0.50264174", "0.5025329", "0.5025329", "0.50226927", "0.50226927", "0.50207645" ]
0.686309
0
Creates new form formAnalisis
public formAnalisis() { initComponents(); // List<Double> testData = IntStream.range(1, 100) // .mapToDouble(d -> d) // .collect(ArrayList::new, ArrayList::add, ArrayList::addAll); // deskriptif stat = new deskriptif(); // stat.setNameDesc("foo"); // list1.add(stat); // testData.forEach((v) -> stat.addValue(v)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Command\n\tpublic void nuevoAnalista(){\n\t\tMap<String, Object> parametros = new HashMap<String, Object>();\n\n\t\t//parametros.put(\"recordMode\", \"NEW\");\n\t\tllamarFormulario(\"formularioAnalistas.zul\", null);\n\t}", "public static void create(Formulario form){\n daoFormulario.create(form);\n }", "@Override\n public boolean createApprisialForm(ApprisialFormBean apprisial) {\n apprisial.setGendate(C_Util_Date.generateDate());\n return in_apprisialformdao.createApprisialForm(apprisial);\n }", "FORM createFORM();", "public SalidaCajaForm() {\n\t\tinicializarComponentes();\n }", "public static Result newForm() {\n return ok(newForm.render(palletForm, setOfArticleForm));\n }", "@Override\n\tpublic void createForm(ERForm form) {\n\t\t\tString sql = \"insert into project1.reimbursementInfo (userName, fullName, thedate, eventstartdate, thelocation, description, thecost, gradingformat, passingpercentage, eventtype, filename,status,reason) values (?,?,?,?,?,?,?,?,?,?,?,?,?);\";\n\t\t\ttry {PreparedStatement stmt = conn.prepareCall(sql);\n\t\t\t//RID should auto increment, so this isnt necessary\n\t\t\t\n\t\t\tstmt.setString(1, form.getUserName());\n\t\t\tstmt.setString(2, form.getFullName());\n\t\t\tstmt.setDate(3, Date.valueOf(form.getTheDate()));\n\t\t\tstmt.setDate(4, Date.valueOf(form.getEventStartDate()));\n\t\t\tstmt.setString(5, form.getTheLocation());\n\t\t\tstmt.setString(6, form.getDescription());\n\t\t\tstmt.setDouble(7, form.getTheCost());\n\t\t\tstmt.setString(8, form.getGradingFormat());\n\t\t\tstmt.setString(9, form.getPassingPercentage());\n\t\t\tstmt.setString(10, form.getEventType());\n\t\t\tstmt.setString(11, form.getFileName());\n\t\t\tstmt.setString(12, \"pending\");\n\t\t\tstmt.setString(13, \"\");\n\t\t\tstmt.executeUpdate();\n\t\t\t\n\t\t} catch (SQLException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static AssessmentCreationForm openFillCreationForm(Assessment assm) {\n openCreationSearchForm(Roles.STAFF, WingsTopMenu.WingsStaffMenuItem.P_ASSESSMENTS, Popup.Create);\n\n Logger.getInstance().info(\"Fill out the required fields with valid data\");\n AssessmentCreationForm creationForm = new AssessmentCreationForm();\n creationForm.fillAssessmentInformation(new User(Roles.STAFF), assm);\n\n return new AssessmentCreationForm();\n }", "public FormInserir() {\n initComponents();\n }", "public String nuevo() {\n\n\t\tLOG.info(\"Submitado formulario, accion nuevo\");\n\t\tString view = \"/alumno/form\";\n\n\t\t// las validaciones son correctas, por lo cual los datos del formulario estan en\n\t\t// el atributo alumno\n\n\t\t// TODO simular index de la bbdd\n\t\tint id = this.alumnos.size();\n\t\tthis.alumno.setId(id);\n\n\t\tLOG.debug(\"alumno: \" + this.alumno);\n\n\t\t// TODO comprobar edad y fecha\n\n\t\talumnos.add(alumno);\n\t\tview = VIEW_LISTADO;\n\t\tmockAlumno();\n\n\t\t// mensaje flash\n\t\tFacesContext facesContext = FacesContext.getCurrentInstance();\n\t\tExternalContext externalContext = facesContext.getExternalContext();\n\t\texternalContext.getFlash().put(\"alertTipo\", \"success\");\n\t\texternalContext.getFlash().put(\"alertMensaje\", \"Alumno \" + this.alumno.getNombre() + \" creado con exito\");\n\n\t\treturn view + \"?faces-redirect=true\";\n\t}", "public Form_soal() {\n initComponents();\n tampil_soal();\n }", "public creacionempresa() {\n initComponents();\n mostrardatos();\n }", "public PnlAnalisis() {\n initComponents();\n ListarAnalisis();\n ListarProductos();\n }", "@Override public SnpAssociationForm createForm(Association association) {\n\n\n SnpAssociationStandardMultiForm form = new SnpAssociationStandardMultiForm();\n\n // Set association ID\n form.setAssociationId(association.getId());\n form.setAssociationExtension(association.getAssociationExtension());\n\n // Set simple string and float association attributes\n form.setRiskFrequency(association.getRiskFrequency());\n form.setPvalueDescription(association.getPvalueDescription());\n form.setSnpType(association.getSnpType());\n form.setMultiSnpHaplotype(association.getMultiSnpHaplotype());\n form.setSnpApproved(association.getSnpApproved());\n form.setPvalueMantissa(association.getPvalueMantissa());\n form.setPvalueExponent(association.getPvalueExponent());\n form.setStandardError(association.getStandardError());\n form.setRange(association.getRange());\n form.setDescription(association.getDescription());\n\n // Set OR/Beta values\n form.setOrPerCopyNum(association.getOrPerCopyNum());\n form.setOrPerCopyRecip(association.getOrPerCopyRecip());\n form.setOrPerCopyRecipRange(association.getOrPerCopyRecipRange());\n form.setBetaNum(association.getBetaNum());\n form.setBetaUnit(association.getBetaUnit());\n form.setBetaDirection(association.getBetaDirection());\n\n // Add collection of Efo traits\n form.setEfoTraits(association.getEfoTraits());\n\n // For each locus get genes and risk alleles\n Collection<Locus> loci = association.getLoci();\n Collection<Gene> locusGenes = new ArrayList<>();\n Collection<RiskAllele> locusRiskAlleles = new ArrayList<RiskAllele>();\n\n // For multi-snp and standard snps we assume their is only one locus\n for (Locus locus : loci) {\n locusGenes.addAll(locus.getAuthorReportedGenes());\n locusRiskAlleles.addAll(locus.getStrongestRiskAlleles()\n .stream()\n .sorted((v1, v2) -> Long.compare(v1.getId(), v2.getId()))\n .collect(Collectors.toList()));\n\n // There should only be one locus thus should be safe to set these here\n form.setMultiSnpHaplotypeNum(locus.getHaplotypeSnpCount());\n form.setMultiSnpHaplotypeDescr(locus.getDescription());\n }\n\n\n // Get name of gene and add to form\n Collection<String> authorReportedGenes = new ArrayList<>();\n for (Gene locusGene : locusGenes) {\n authorReportedGenes.add(locusGene.getGeneName());\n }\n form.setAuthorReportedGenes(authorReportedGenes);\n\n // Handle snp rows\n Collection<GenomicContext> snpGenomicContexts = new ArrayList<GenomicContext>();\n Collection<SingleNucleotidePolymorphism> snps = new ArrayList<>();\n List<SnpFormRow> snpFormRows = new ArrayList<SnpFormRow>();\n List<SnpMappingForm> snpMappingForms = new ArrayList<SnpMappingForm>();\n for (RiskAllele riskAllele : locusRiskAlleles) {\n SnpFormRow snpFormRow = new SnpFormRow();\n snpFormRow.setStrongestRiskAllele(riskAllele.getRiskAlleleName());\n\n SingleNucleotidePolymorphism snp = riskAllele.getSnp();\n snps.add(snp);\n String rsID = snp.getRsId();\n snpFormRow.setSnp(rsID);\n\n Collection<Location> locations = snp.getLocations();\n for (Location location : locations) {\n SnpMappingForm snpMappingForm = new SnpMappingForm(rsID, location);\n snpMappingForms.add(snpMappingForm);\n }\n\n // Set proxy if one is present\n Collection<String> proxySnps = new ArrayList<>();\n if (riskAllele.getProxySnps() != null) {\n for (SingleNucleotidePolymorphism riskAlleleProxySnp : riskAllele.getProxySnps()) {\n proxySnps.add(riskAlleleProxySnp.getRsId());\n }\n }\n snpFormRow.setProxySnps(proxySnps);\n\n snpGenomicContexts.addAll(genomicContextRepository.findBySnpId(snp.getId()));\n snpFormRows.add(snpFormRow);\n }\n\n form.setSnpMappingForms(snpMappingForms);\n form.setGenomicContexts(snpGenomicContexts);\n form.setSnps(snps);\n form.setSnpFormRows(snpFormRows);\n return form;\n }", "@GetMapping(\"/add\")\n public String showSocioForm(Model model, Persona persona) {\n List<Cargo> cargos = cargoService.getCargos();\n model.addAttribute(\"cargos\", cargos);\n return \"/backoffice/socioForm\";\n }", "@RequestMapping(value = \"/report.create\", method = RequestMethod.GET)\n @ResponseBody public ModelAndView newreportForm(HttpSession session) throws Exception {\n ModelAndView mav = new ModelAndView();\n mav.setViewName(\"/sysAdmin/reports/details\");\n\n //Create a new blank provider.\n reports report = new reports();\n \n mav.addObject(\"btnValue\", \"Create\");\n mav.addObject(\"reportdetails\", report);\n\n return mav;\n }", "public frmAfiliado() {\n initComponents();\n \n }", "@Override\r\n\tprotected void agregarObjeto() {\r\n\t\t// opcion 1 es agregar nuevo justificativo\r\n\t\tthis.setTitle(\"PROCESOS - PERMISOS INDIVIDUALES (AGREGANDO)\");\r\n\t\tthis.opcion = 1;\r\n\t\tactivarFormulario();\r\n\t\tlimpiarTabla();\r\n\t\tthis.panelBotones.habilitar();\r\n\t}", "public GestaoFormando() {\n \n initComponents();\n listarEquipamentos();\n listarmapainscritos();\n }", "public frm_tutor_subida_prueba() {\n }", "public Form(){\n\t\ttypeOfLicenseApp = new TypeOfLicencsApplication();\n\t\toccupationalTrainingList = new ArrayList<OccupationalTraining>();\n\t\taffiadavit = new Affidavit();\n\t\tapplicationForReciprocity = new ApplicationForReciprocity();\n\t\teducationBackground = new EducationBackground();\n\t\toccupationalLicenses = new OccupationalLicenses();\n\t\tofficeUseOnlyInfo = new OfficeUseOnlyInfo();\n\t}", "@GetMapping(\"/createRegistro\")\n\tpublic String crearValidacion(Model model) {\n\t\tList<Barrio> localidades = barrioService.obtenerBarrios();\n\t\tmodel.addAttribute(\"localidades\",localidades);\n\t\tmodel.addAttribute(\"persona\",persona);\n\t\tmodel.addAttribute(\"validacion\",validacion);\n\t\tmodel.addAttribute(\"registro\",registro);\n\t\tmodel.addAttribute(\"barrio\",barrio);\n\t\treturn \"RegistroForm\";\n\t}", "public void createAgendamento() {\n\n if (tbagendamento.getTmdataagendamento().after(TimeControl.getDateIni())) {\n if (agendamentoLogic.createTbagendamento(tbagendamento)) {\n AbstractFacesContextUtils.redirectPage(PagesUrl.URL_AGENDAMENTO_LIST);\n AbstractFacesContextUtils.addMessageInfo(\"Agendamento cadastrado com sucesso.\");\n } else {\n AbstractFacesContextUtils.addMessageWarn(\"Falhar ao realizado cadastro do agendamento.\");\n }\n } else {\n AbstractFacesContextUtils.addMessageWarn(\"verifique se a data de agendamento esta correta.\");\n }\n }", "@Override\n\tpublic Oglas createNewOglas(NewOglasForm oglasForm) {\n\t\tSimpleDateFormat formatter = new SimpleDateFormat(\"yyyy-MM-dd\");\n\t\t\n\t\tOglas oglas = new Oglas();\n\t\tSystem.out.println(oglas.getId());\n\t\toglas.setNaziv(oglasForm.getNaziv());\n\t\toglas.setOpis(oglasForm.getOpis());\n\t\ttry {\n\t\t\toglas.setDatum(formatter.parse(oglasForm.getDatum()));\n\t\t\tSystem.out.println(oglas.getDatum());\n System.out.println(formatter.format(oglas.getDatum()));\n\t\t} catch (ParseException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn repository.save(oglas);\n\t}", "private void azzeraInsertForm() {\n\t\tviewInserimento.getCmbbxTipologia().setSelectedIndex(-1);\n\t\tviewInserimento.getTxtFieldDataI().setText(\"\");\n\t\tviewInserimento.getTxtFieldValore().setText(\"\");\n\t\tviewInserimento.getTxtFieldDataI().setBackground(Color.white);\n\t\tviewInserimento.getTxtFieldValore().setBackground(Color.white);\n\t}", "@RequestMapping(method = RequestMethod.POST, value = {\"\",\"/\"})\r\n\tpublic ResponseEntity<FormularioDTO> add(@RequestBody @Valid Formulario formulario) throws AuthenticationException {\r\n\t\tformulario.setInstituicao(new Instituicao(authService.getDados().getInstituicaoId()));\r\n\t\treturn new ResponseEntity<>(formularioService.create(formulario), HttpStatus.CREATED);\r\n\t}", "public void CrearNew(ActionEvent e) {\n List<Pensum> R = ejbFacade.existePensumID(super.getSelected().getIdpensum());\n if(R.isEmpty()){\n super.saveNew(e);\n }else{\n new Auxiliares().setMsj(3,\"PENSUM ID YA EXISTE\");\n }\n }", "public void onNew() {\t\t\n\t\tdesignWidget.addNewForm();\n\t}", "public void crear() {\n con = new Conexion();\n con.setInsertar(\"insert into lenguajes_programacion (nombre, fecha_creacion, estado) values ('\"+this.getNombre()+\"', '\"+this.getFecha_creacion()+\"', 'activo')\");\n }", "public void createAd(/*Should be a form*/){\n Ad ad = new Ad();\n User owner = this.user;\n Vehicle vehicle = this.vehicle;\n String \n// //ADICIONAR\n ad.setOwner();\n ad.setVehicle();\n ad.setDescription();\n ad.setPics();\n ad.setMain_pic();\n }", "@PostMapping(\"/add\")\n public ModelAndView addSocio(Persona persona) {\n personaService.addPersona(persona);\n return new ModelAndView(\"redirect:/admin/socios\");\n }", "@GetMapping(value = \"/create\") // https://localhost:8080/etiquetasTipoDisenio/create\n\tpublic String create(Model model) {\n\t\tetiquetasTipoDisenio etiquetasTipoDisenio = new etiquetasTipoDisenio();\n\t\tmodel.addAttribute(\"title\", \"Registro de una nuev entrega\");\n\t\tmodel.addAttribute(\"etiquetasTipoDisenio\", etiquetasTipoDisenio); // similar al ViewBag\n\t\treturn \"etiquetasTipoDisenio/form\"; // la ubicacion de la vista\n\t}", "public Form getCreationForm() throws ProcessManagerException {\r\n try {\r\n Action creation = processModel.getCreateAction();\r\n return processModel.getPublicationForm(creation.getName(), currentRole,\r\n getLanguage());\r\n } catch (WorkflowException e) {\r\n throw new ProcessManagerException(\"SessionController\",\r\n \"processManager.ERR_NO_CREATION_FORM\", e);\r\n }\r\n }", "private void addInstituicao() {\n\n if (txtNome.getText().equals(\"\")) {\n JOptionPane.showMessageDialog(null, \"Campo Nome Invalido\");\n txtNome.grabFocus();\n return;\n } else if (txtNatureza.getText().equals(\"\")) {\n JOptionPane.showMessageDialog(null, \"Campo Natureza Invalido\");\n txtNatureza.grabFocus();\n return;\n }\n if ((instituicao == null) || (instituicaoController == null)) {\n instituicao = new Instituicao();\n instituicaoController = new InstituicaoController();\n }\n instituicao.setNome(txtNome.getText());\n instituicao.setNatureza_administrativa(txtNatureza.getText());\n if (instituicaoController.insereInstituicao(instituicao)) {\n limpaCampos();\n JOptionPane.showMessageDialog(null, \"Instituicao Cadastrada com Sucesso\");\n }\n }", "private void validarForm(AtualizarTramiteEspecificacaoActionForm form){\n\n\t\tString idLocalidade = form.getIdLocalidade();\n\t\tString codigoSetorComercial = form.getCodigoSetorComercial();\n\t\tString idMunicipio = form.getIdMunicipio();\n\t\tString codigoBairro = form.getCodigoBairro();\n\t\tString idSistemaAbastecimento = form.getIdSistemaAbastecimento();\n\t\tString idDistritoOperacional = form.getIdDistritoOperacional();\n\t\tString idZonaAbastecimento = form.getIdZonaAbastecimento();\n\t\tString idSetorAbastecimento = form.getIdSetorAbastecimento();\n\t\tString idSistemaEsgoto = form.getIdSistemaEsgoto();\n\t\tString idSubsistemaEsgoto = form.getIdSubsistemaEsgoto();\n\t\tString idBacia = form.getIdBacia();\n\t\tString idSubBacia = form.getIdSubBacia();\n\t\tString idUnidadeOrganizacionalOrigem = form.getIdUnidadeOrganizacionalOrigem();\n\t\tString idUnidadeOrganizacionalDestino = form.getIdUnidadeOrganizacionalDestino();\n\t\tString indicadorUso = form.getIndicadorUso();\n\n\t\tString numeroNaoInformadoStr = Integer.toString(ConstantesSistema.NUMERO_NAO_INFORMADO);\n\n\t\tFachada fachada = Fachada.getInstancia();\n\n\t\t// Localidade\n\t\tif(!Util.isVazioOuBranco(idLocalidade)){\n\t\t\tFiltroLocalidade filtro = new FiltroLocalidade();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroLocalidade.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroLocalidade.ID, idLocalidade));\n\n\t\t\tCollection<Localidade> colecao = fachada.pesquisar(filtro, Localidade.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Localidade\");\n\t\t\t}\n\t\t}\n\n\t\t// Setor Comercial\n\t\tif(Util.isVazioOuBranco(idLocalidade) && !Util.isVazioOuBranco(codigoSetorComercial)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Localidade\");\n\t\t}else if(!Util.isVazioOuBranco(idLocalidade) && !Util.isVazioOuBranco(codigoSetorComercial)){\n\t\t\tFiltroSetorComercial filtro = new FiltroSetorComercial();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorComercial.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorComercial.ID_LOCALIDADE, idLocalidade));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorComercial.CODIGO_SETOR_COMERCIAL, codigoSetorComercial));\n\n\t\t\tCollection<SetorComercial> colecao = fachada.pesquisar(filtro, SetorComercial.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Setor Comercial\");\n\t\t\t}\n\t\t}\n\n\t\t// Bairro\n\t\tif(Util.isVazioOuBranco(idMunicipio) && !Util.isVazioOuBranco(codigoBairro)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Município\");\n\t\t}else if(!Util.isVazioOuBranco(idMunicipio) && !Util.isVazioOuBranco(codigoBairro)){\n\t\t\tFiltroBairro filtro = new FiltroBairro();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBairro.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBairro.MUNICIPIO_ID, idMunicipio));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBairro.CODIGO, codigoBairro));\n\n\t\t\tCollection<Bairro> colecao = fachada.pesquisar(filtro, Bairro.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Bairro\");\n\t\t\t}\n\t\t}\n\n\t\t// Sistema de Abastecimento\n\t\tif(!Util.isVazioOuBranco(idSistemaAbastecimento) && !idSistemaAbastecimento.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSistemaAbastecimento filtro = new FiltroSistemaAbastecimento();\n\t\t\tfiltro\n\t\t\t\t\t\t\t.adicionarParametro(new ParametroSimples(FiltroSistemaAbastecimento.INDICADOR_USO,\n\t\t\t\t\t\t\t\t\t\t\tConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSistemaAbastecimento.ID, idSistemaAbastecimento));\n\n\t\t\tCollection<SistemaAbastecimento> colecao = fachada.pesquisar(filtro, SistemaAbastecimento.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Sistema de Abastecimento\");\n\t\t\t}\n\t\t}\n\n\t\t// Unidade Operacional\n\t\tif(!Util.isVazioOuBranco(idDistritoOperacional) && !idDistritoOperacional.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroDistritoOperacional filtro = new FiltroDistritoOperacional();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroDistritoOperacional.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroDistritoOperacional.ID, idDistritoOperacional));\n\n\t\t\tCollection<DistritoOperacional> colecao = fachada.pesquisar(filtro, DistritoOperacional.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Unidade Operacional\");\n\t\t\t}\n\t\t}\n\n\t\t// Zona de Abastecimento\n\t\tif(!Util.isVazioOuBranco(idZonaAbastecimento) && !idZonaAbastecimento.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroZonaAbastecimento filtro = new FiltroZonaAbastecimento();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroZonaAbastecimento.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroZonaAbastecimento.ID, idZonaAbastecimento));\n\n\t\t\tCollection<ZonaAbastecimento> colecao = fachada.pesquisar(filtro, ZonaAbastecimento.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Zona de Abastecimento\");\n\t\t\t}\n\t\t}\n\n\t\t// Setor de Abastecimento\n\t\tif(!Util.isVazioOuBranco(idSetorAbastecimento) && !idSetorAbastecimento.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSetorAbastecimento filtro = new FiltroSetorAbastecimento();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorAbastecimento.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSetorAbastecimento.ID, idSetorAbastecimento));\n\n\t\t\tCollection<SetorAbastecimento> colecao = fachada.pesquisar(filtro, SetorAbastecimento.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Setor de Abastecimento\");\n\t\t\t}\n\t\t}\n\n\t\t// Sistema de Esgoto\n\t\tif(!Util.isVazioOuBranco(idSistemaEsgoto) && !idSistemaEsgoto.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSistemaEsgoto filtro = new FiltroSistemaEsgoto();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSistemaEsgoto.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSistemaEsgoto.ID, idSistemaEsgoto));\n\n\t\t\tCollection<SistemaEsgoto> colecao = fachada.pesquisar(filtro, SistemaEsgoto.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Sistema de Esgoto\");\n\t\t\t}\n\t\t}\n\n\t\t// Subsistema de Esgoto\n\t\tif(!Util.isVazioOuBranco(idSubsistemaEsgoto) && !idSubsistemaEsgoto.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSubsistemaEsgoto filtro = new FiltroSubsistemaEsgoto();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubsistemaEsgoto.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubsistemaEsgoto.ID, idSubsistemaEsgoto));\n\n\t\t\tCollection<SubsistemaEsgoto> colecao = fachada.pesquisar(filtro, SubsistemaEsgoto.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Subsistema de Esgoto\");\n\t\t\t}\n\t\t}\n\n\t\t// Bacia\n\t\tif(!Util.isVazioOuBranco(idBacia) && !idBacia.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroBacia filtro = new FiltroBacia();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBacia.INDICADORUSO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroBacia.ID, idBacia));\n\n\t\t\tCollection<Bacia> colecao = fachada.pesquisar(filtro, Bacia.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Bacia\");\n\t\t\t}\n\t\t}\n\n\t\t// Subbacia\n\t\tif(!Util.isVazioOuBranco(idSubBacia) && !idSubBacia.equals(numeroNaoInformadoStr)){\n\t\t\tFiltroSubBacia filtro = new FiltroSubBacia();\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubBacia.INDICADOR_USO, ConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroSubBacia.ID, idSubBacia));\n\n\t\t\tCollection<SubBacia> colecao = fachada.pesquisar(filtro, SubBacia.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Subbacia\");\n\t\t\t}\n\t\t}\n\n\t\t// Unidade Origem\n\t\tif(!Util.isVazioOuBranco(idUnidadeOrganizacionalOrigem)){\n\t\t\tFiltroUnidadeOrganizacional filtro = new FiltroUnidadeOrganizacional();\n\t\t\tfiltro\n\t\t\t\t\t\t\t.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.INDICADOR_USO,\n\t\t\t\t\t\t\t\t\t\t\tConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.ID, idUnidadeOrganizacionalOrigem));\n\n\t\t\tCollection<UnidadeOrganizacional> colecao = fachada.pesquisar(filtro, UnidadeOrganizacional.class.getName());\n\t\t\tif(colecao == null || colecao.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Unidade Origem\");\n\t\t\t}\n\t\t}\n\n\t\t// Unidade Destino\n\t\tif(Util.isVazioOuBranco(idUnidadeOrganizacionalDestino)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Unidade Destino\");\n\t\t}else{\n\t\t\tFiltroUnidadeOrganizacional filtro = new FiltroUnidadeOrganizacional();\n\t\t\tfiltro\n\t\t\t\t\t\t\t.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.INDICADOR_USO,\n\t\t\t\t\t\t\t\t\t\t\tConstantesSistema.INDICADOR_USO_ATIVO));\n\t\t\tfiltro.adicionarParametro(new ParametroSimples(FiltroUnidadeOrganizacional.ID, idUnidadeOrganizacionalDestino));\n\n\t\t\tCollection<UnidadeOrganizacional> colecaoUnidadeOrganizacional = fachada.pesquisar(filtro, UnidadeOrganizacional.class\n\t\t\t\t\t\t\t.getName());\n\t\t\tif(colecaoUnidadeOrganizacional == null || colecaoUnidadeOrganizacional.isEmpty()){\n\t\t\t\tthrow new ActionServletException(\"atencao.pesquisa_inexistente\", null, \"Unidade Destino\");\n\t\t\t}\n\t\t}\n\n\t\t// Indicador de Uso\n\t\tif(Util.isVazioOuBranco(indicadorUso)){\n\t\t\tthrow new ActionServletException(\"atencao.required\", null, \"Indicador de Uso\");\n\t\t}\n\t}", "public FrmAbmAfiliado() {\n initComponents();\n }", "private void agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agregarActionPerformed\n boolean salida = true;\n Palabra p; \n p = new Palabra(campo1.getText());\n boolean continua = p.estaBien();\n if (continua) {\n agregarDiccionario(p);\n salida = pregunta();\n setVisible(true);\n }else {\n JOptionPane.showMessageDialog(null,\"#- Palabra mal escrita intente de nuevo -#\");\n }\n \n if (!salida) {\n JOptionPane.showMessageDialog(null,\"Gracias por usar el Corrector Ortográfico\");\n dic.guardarDiccionario();\n dispose(); //setVisible(false);\n }\n }", "@Override\n\tprotected void setViewAtributes() throws Exception {\n\t\tif (log.isDebugEnabled()) {\n\t\t\tlog.debug(\"Entering 'save' method\");\n\t\t}\n\t\tlog.debug(\"setAddAttributes method ....\");\n\t\tMantenimientoCRAMatrizDiasSearchForm f = (MantenimientoCRAMatrizDiasSearchForm) this.formBusqueda;\n\t\tPais pais = this.mPantallaPrincipalBean.getCurrentCountry();\n\n\t\tf.setCodigoPais(pais.getCodigo());\n\n\t\tf.setActividad(null);\n\t\tf.setGrupoZona(null);\n\n\t\tReporteService reporteService = (ReporteService) getBean(\"scsicc.reporteService\");\n\n\t\t// obteniendo las lista de grupode facturacion y actividad\n\t\tMantenimientoMAEClienteService clienteService = (MantenimientoMAEClienteService) getBean(\"spusicc.mantenimientoMAEClienteService\");\n\t\tLong oidMarca = clienteService\n\t\t\t\t.getOidMarca(Constants.CODIGO_MARCA_DEFAULT);\n\t\tLong oidCanal = clienteService\n\t\t\t\t.getOidCanal(Constants.CODIGO_CANAL_DEFAULT);\n\n\t\tMap params = new HashMap();\n\t\tparams.put(\"codigoPais\", pais.getCodigo());\n\t\tparams.put(\n\t\t\t\t\"oidPais\",\n\t\t\t\tnew Long(reporteService.getOidString(\"getOidPaisByCodigoPais\",\n\t\t\t\t\t\tparams)));\n\t\tparams.put(\"oidMarca\", oidMarca);\n\t\tparams.put(\"oidCanal\", oidCanal);\n\n\t\tsiccGrupoFacturacionList = reporteService.getGrupoFacturacion(params);\n\t\tsiccActividadList = reporteService.getActividad(params);\n\t\tfindList(f);\n\n\t\tthis.mostrarBotonBuscar = false;\n\t\tthis.mostrarBotonModificar = false;\n\t\tthis.mostrarBotonNuevo = false;\n\t\tthis.mostrarBotonEliminar = false;\n\t\tthis.mostrarBotonConsultar = false;\n\n\t}", "@GetMapping(\"/addPharmacist\")\n public String pharmacistForm(Model model) {\n model.addAttribute(\"pharmacist\", new Pharmacist());\n return \"addPharmacist\";\n }", "public void crearModelo() {\n modeloagr = new DefaultTableModel(null, columnasAgr) {\n public boolean isCellEditable(int fila, int columna) {\n return false;\n }\n };\n tbl.llenarTabla(AgendarA.tblAgricultor, modeloagr, columnasAgr.length, \"SELECT idPersonalExterno,cedula,CONCAT(nombres,' ',apellidos),municipios.nombre,telefono,telefono2,telefono3 FROM personalexterno,municipios WHERE tipo='agricultor' AND personalexterno.idMunicipio=municipios.idMunicipio\");\n tbl.alinearHeaderTable(AgendarA.tblAgricultor, headerColumnas);\n tbl.alinearCamposTable(AgendarA.tblAgricultor, camposColumnas);\n tbl.rowNumberTabel(AgendarA.tblAgricultor);\n }", "public void registrarMateria() {\n materia.setIdDepartamento(departamento);\n ejbFacade.create(materia);\n RequestContext requestContext = RequestContext.getCurrentInstance();\n requestContext.execute(\"PF('MateriaCreateDialog').hide()\");\n items = ejbFacade.findAll();\n departamento = new Departamento();\n materia = new Materia();\n\n FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, \"Información\", \"La materia se registró con éxito\");\n FacesContext.getCurrentInstance().addMessage(null, msg);\n requestContext.update(\"msg\");//Actualiza la etiqueta growl para que el mensaje pueda ser mostrado\n\n requestContext.update(\"MateriaListForm\");\n requestContext.update(\"MateriaCreateForm\");\n }", "public abstract Anuncio creaAnuncioIndividualizado();", "protected void creaPagine() {\n Pagina pag;\n Pannello pan;\n\n try { // prova ad eseguire il codice\n\n /* crea la pagina e aggiunge campi e pannelli */\n pag = this.addPagina(\"generale\");\n\n pan = PannelloFactory.orizzontale(this);\n pan.add(Cam.data);\n pan.add(Cam.importo.get());\n pan.add(Cam.note.get());\n pag.add(pan);\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n }", "@RequestMapping(\"/new\")\n\tpublic String displayProjectForm(Model model) {\n\t\tProject aproject = new Project();\n\t//Iterable<Employee> employees = \tpro.getall();\n\t\n\t\tmodel.addAttribute(\"project\", aproject);\n\n\t\t//model.addAttribute(\"allEmployees\", employees);\n\t\t\n\t\t\n\t\treturn \"newproject\";\n\t\t\n\t}", "public Ventaform() {\n initComponents();\n }", "private void newProject()\n\t{\n\t\tnew FenetreCreationProjet();\n\t}", "private void createBtnActionPerformed(java.awt.event.ActionEvent evt) {\n\n staff.setName(regName.getText());\n staff.setID(regID.getText());\n staff.setPassword(regPwd.getText());\n staff.setPosition(regPos.getSelectedItem().toString());\n staff.setGender(regGender.getSelectedItem().toString());\n staff.setEmail(regEmail.getText());\n staff.setPhoneNo(regPhone.getText());\n staff.addStaff();\n if (staff.getPosition().equals(\"Vet\")) {\n Vet vet = new Vet();\n vet.setExpertise(regExp.getSelectedItem().toString());\n vet.setExpertise_2(regExp2.getSelectedItem().toString());\n vet.addExpertise(staff.getID());\n }\n JOptionPane.showMessageDialog(null, \"User added to database\");\n updateJTable();\n }", "private void iniciaFrm() {\n statusLbls(false);\n statusBtnInicial();\n try {\n clientes = new Cliente_DAO().findAll();\n } catch (Exception ex) {\n Logger.getLogger(JF_CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public frmPrincipal() {\n initComponents(); \n inicializar();\n \n }", "public NewConsultasS() {\n initComponents();\n limpiar();\n bloquear();\n }", "public Managing_Staff_Main_Form() {\n initComponents();\n }", "private void loadForm() {\n service.getReasons(refusalReasons);\n service.getVacEligibilty(vacElig);\n service.getVacSites(vacSites);\n service.getReactions(vacReactions);\n service.getOverrides(vacOverrides);\n updateComboValues();\n \n selPrv = \"\";\n selLoc = \"\";\n \n //datGiven.setDateConstraint(new SimpleDateConstraint(SimpleDateConstraint.NO_NEGATIVE, DateUtil.addDays(patient.getBirthDate(), -1, true), null, BgoConstants.TX_BAD_DATE_DOB));\n datGiven.setDateConstraint(getConstraintDOBDate());\n datEventDate.setConstraint(getConstraintDOBDate());\n radFacility.setLabel(service.getParam(\"Caption-Facility\", \"&Facility\"));\n if (immunItem != null) {\n \n txtVaccine.setValue(immunItem.getVaccineName());\n txtVaccine.setAttribute(\"ID\", immunItem.getVaccineID());\n txtVaccine.setAttribute(\"DATA\", immunItem.getVaccineID() + U + immunItem.getVaccineName());\n setEventType(immunItem.getEventType());\n \n radRefusal.setDisabled(!radRefusal.isChecked());\n radHistorical.setDisabled(!radHistorical.isChecked());\n radCurrent.setDisabled(!radCurrent.isChecked());\n \n visitIEN = immunItem.getVisitIEN();\n if (immunItem.getProvider() != null) {\n txtProvider.setText(FhirUtil.formatName(immunItem.getProvider().getName()));\n txtProvider.setAttribute(\"ID\", immunItem.getProvider().getId().getIdPart());\n selPrv = immunItem.getProvider().getId().getIdPart() + U + U + immunItem.getProvider().getName();\n }\n switch (immunItem.getEventType()) {\n case REFUSAL:\n ListUtil.selectComboboxItem(cboReason, immunItem.getReason());\n txtComment.setText(immunItem.getComment());\n datEventDate.setValue(immunItem.getDate());\n break;\n case HISTORICAL:\n datEventDate.setValue(immunItem.getDate());\n txtLocation.setValue(immunItem.isImmunization() ? immunItem.getLocationName() : \"\");\n txtLocation.setAttribute(\"ID\", immunItem.isImmunization() ? immunItem.getLocationID() : \"\");\n selLoc = immunItem.getLocationID() + U + U + immunItem.getLocationName();\n radOther.setSelected(txtLocation.getAttribute(\"ID\") != null\n ? txtLocation.getAttribute(\"ID\").toString().isEmpty() : false);\n txtAdminNote.setText(immunItem.getAdminNotes());\n ZKUtil.disableChildren(fraDate, true);\n ZKUtil.disableChildren(fraHistorical, true);\n default:\n service.getLot(lotNumbers, getVaccineID());\n loadComboValues(cboLot, lotNumbers, comboRenderer);\n loadVaccination();\n txtLocation.setValue(immunItem.isImmunization() ? immunItem.getLocationName() : \"\");\n txtLocation.setAttribute(\"ID\", immunItem.isImmunization() ? immunItem.getLocationID() : \"\");\n selLoc = immunItem.getLocationID() + U + U + immunItem.getLocationName();\n radOther.setSelected(txtLocation.getAttribute(\"ID\") != null\n ? txtLocation.getAttribute(\"ID\").toString().isEmpty() : false);\n ListUtil.selectComboboxItem(cboLot, immunItem.getLot());\n ListUtil.selectComboboxItem(cboSite, StrUtil.piece(immunItem.getInjSite(), \"~\", 2));\n spnVolume.setText(immunItem.getVolume());\n datGiven.setDate(immunItem.getDate());\n datVIS.setValue(immunItem.isImmunization() ? immunItem.getVISDate() : null);\n ListUtil.selectComboboxItem(cboReaction, immunItem.getReaction());\n ListUtil.selectComboboxData(cboOverride, immunItem.getVacOverride());\n txtAdminNote.setText(immunItem.getAdminNotes());\n cbCounsel.setChecked(immunItem.wasCounseled());\n }\n } else {\n IUser user = UserContext.getActiveUser();\n Practitioner provider = new Practitioner();\n provider.setId(user.getLogicalId());\n provider.setName(FhirUtil.parseName(user.getFullName()));\n txtProvider.setValue(FhirUtil.formatName(provider.getName()));\n txtProvider.setAttribute(\"ID\", VistAUtil.parseIEN(provider)); //provider.getId().getIdPart());\n selPrv = txtProvider.getAttribute(\"ID\") + U + U + txtProvider.getValue();\n Location location = new Location();\n location.setName(\"\");\n location.setId(\"\");\n datGiven.setDate(getBroker().getHostTime());\n onClick$btnVaccine(null);\n \n if (txtVaccine.getValue().isEmpty()) {\n close(true);\n return;\n }\n \n Encounter encounter = EncounterContext.getActiveEncounter();\n if (!EncounterUtil.isPrepared(encounter)) {\n setEventType(EventType.HISTORICAL);\n radCurrent.setDisabled(true);\n } else {\n if (isCategory(encounter, \"E\")) {\n setEventType(EventType.HISTORICAL);\n Date date = encounter == null ? null : encounter.getPeriod().getStart();\n datEventDate.setValue(DateUtil.stripTime(date == null ? getBroker().getHostTime() : date));\n radCurrent.setDisabled(true);\n txtLocation.setText(user.getSecurityDomain().getName());\n PromptDialog.showInfo(user.getSecurityDomain().getLogicalId());\n txtLocation.setAttribute(\"ID\", user.getSecurityDomain().getLogicalId());\n \n } else {\n if (isVaccineInactive()) {\n setEventType(EventType.HISTORICAL);\n radCurrent.setDisabled(true);\n } else {\n setEventType(EventType.CURRENT);\n radCurrent.setDisabled(false);\n }\n }\n }\n selectItem(cboReason, NONESEL);\n }\n btnSave.setLabel(immunItem == null ? \"Add\" : \"Save\");\n btnSave.setTooltiptext(immunItem == null ? \"Add record\" : \"Save record\");\n txtVaccine.setFocus(true);\n }", "public void addNewAnimalAction() {\n\t\tAnimalModel newAnimalModel = new AnimalModel(\"\", \"\");\n\n\t\teditAnimalDetail(newAnimalModel, AnimalDetailPanel.NEW_ANIMAL);\n\t}", "@RequestMapping(value=\"/formpaciente\")\r\n\tpublic String crearPaciente(Map<String, Object> model) {\t\t\r\n\t\t\r\n\t\tPaciente paciente = new Paciente();\r\n\t\tmodel.put(\"paciente\", paciente);\r\n\t\tmodel.put(\"obrasociales\",obraSocialService.findAll());\r\n\t\t//model.put(\"obrasPlanesForm\", new ObrasPlanesForm());\r\n\t\t//model.put(\"planes\", planService.findAll());\r\n\t\tmodel.put(\"titulo\", \"Formulario de Alta de Paciente\");\r\n\t\t\r\n\t\treturn \"formpaciente\";\r\n\t}", "@RequestMapping(value={\"/projects/add\"}, method= RequestMethod.GET)\r\n\tpublic String createProjectForm(Model model) {\r\n\t\tUser loggedUser= sessionData.getLoggedUser();\r\n\t\tmodel.addAttribute(\"loggedUser\", loggedUser);\r\n\t\tmodel.addAttribute(\"projectForm\", new Project());\r\n\t\treturn \"addProject\";\r\n\t}", "private void nuevaLiga() {\r\n\t\tif(Gestion.isModificado()){\r\n\t\t\tint opcion = JOptionPane.showOptionDialog(null, \"¿Desea guardar los cambios?\", \"Nueva Liga\", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null,null, null);\r\n\t\t\tswitch(opcion){\r\n\t\t\tcase JOptionPane.YES_OPTION:\r\n\t\t\t\tguardar();\r\n\t\t\t\tbreak;\r\n\t\t\tcase JOptionPane.NO_OPTION:\r\n\t\t\t\tGestion.reset();\r\n\t\t\t\tbreak;\r\n\t\t\tcase JOptionPane.CANCEL_OPTION:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t\tGestion.reset();\r\n\t\tfrmLigaDeFtbol.setTitle(\"Liga de Fútbol\");\r\n\t}", "public Association createAssociation(SnpAssociationStandardMultiForm form) {\n Association association = setCommonAssociationElements(form);\n association.setSnpInteraction(false);\n\n // Add loci to association, for multi-snp and standard snps we assume their is only one locus\n Collection<Locus> loci = new ArrayList<>();\n Locus locus = new Locus();\n\n // Set locus description and haplotype count\n // Set this number to the number of rows entered by curator\n Integer numberOfRows = form.getSnpFormRows().size();\n if (numberOfRows > 1) {\n locus.setHaplotypeSnpCount(numberOfRows);\n association.setMultiSnpHaplotype(true);\n }\n\n if (form.getMultiSnpHaplotypeDescr() != null && !form.getMultiSnpHaplotypeDescr().isEmpty()) {\n locus.setDescription(form.getMultiSnpHaplotypeDescr());\n }\n else {\n if (numberOfRows > 1) {\n locus.setDescription(numberOfRows + \"-SNP haplotype\");\n }\n else {\n locus.setDescription(\"Single variant\");\n }\n }\n\n // Create gene from each string entered, may sure to check pre-existence\n Collection<String> authorReportedGenes = form.getAuthorReportedGenes();\n Collection<Gene> locusGenes = lociAttributesService.createGene(authorReportedGenes);\n\n // Set locus genes\n locus.setAuthorReportedGenes(locusGenes);\n\n // Handle rows entered for haplotype by curator\n Collection<SnpFormRow> rows = form.getSnpFormRows();\n Collection<RiskAllele> locusRiskAlleles = new ArrayList<>();\n\n for (SnpFormRow row : rows) {\n\n // Create snps from row information\n String curatorEnteredSNP = row.getSnp();\n SingleNucleotidePolymorphism snp = lociAttributesService.createSnp(curatorEnteredSNP);\n\n // Get the curator entered risk allele\n String curatorEnteredRiskAllele = row.getStrongestRiskAllele();\n\n // Create a new risk allele and assign newly created snp\n RiskAllele riskAllele = lociAttributesService.createRiskAllele(curatorEnteredRiskAllele, snp);\n\n // If association is not a multi-snp haplotype save frequency to risk allele\n if (!form.getMultiSnpHaplotype()) {\n riskAllele.setRiskFrequency(form.getRiskFrequency());\n }\n\n // Check for proxies and if we have one create a proxy snps\n if (row.getProxySnps() != null && !row.getProxySnps().isEmpty()) {\n Collection<SingleNucleotidePolymorphism> riskAlleleProxySnps = new ArrayList<>();\n\n for (String curatorEnteredProxySnp : row.getProxySnps()) {\n SingleNucleotidePolymorphism proxySnp = lociAttributesService.createSnp(curatorEnteredProxySnp);\n riskAlleleProxySnps.add(proxySnp);\n }\n\n riskAllele.setProxySnps(riskAlleleProxySnps);\n }\n\n locusRiskAlleles.add(riskAllele);\n }\n\n // Assign all created risk alleles to locus\n locus.setStrongestRiskAlleles(locusRiskAlleles);\n\n // Add locus to collection and link to our association\n loci.add(locus);\n association.setLoci(loci);\n return association;\n }", "public frmAddIncidencias() {\n initComponents();\n }", "public FrmInsertar() {\n initComponents();\n }", "public void makeFactura() {\n Usuario userCurrent = (Usuario) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(\"current\");\n if (userCurrent != null) {\n Calendar c = Calendar.getInstance();\n factura.setIdfactura(facturaFacade.findAll().size() + 1);\n factura.setFechaVenta(c.getTime());\n factura.setUsuarioIdusuario(userCurrent);\n factura.setHabilitada(true);\n try {\n facturaFacade.create(factura);\n FacesContext.getCurrentInstance().addMessage(\"messages\", new FacesMessage(FacesMessage.SEVERITY_INFO, \"Factura creada exitosamente\", null));\n factura = new Factura();\n articulosFacturas = new ArrayList<>();\n total = 0;\n } catch (Exception e) {\n System.err.println(\"Error en la creacion de la factura: \" + e.getMessage());\n FacesContext.getCurrentInstance().addMessage(\"messages\", new FacesMessage(FacesMessage.SEVERITY_FATAL, e.getMessage(), null));\n }\n }\n getAllFacturas();\n }", "public FGlavna() {\n initComponents();\n pripremiFormu();\n }", "public void limpiarCamposFormBusqueda() {\n\t}", "@RequestMapping(value = { \"/new\" }, method = RequestMethod.POST)\n\tpublic String saveEntity(@Valid ENTITY tipoConsumo, BindingResult result, ModelMap model,\n\t\t\t@RequestParam(required = false) Integer idEstadia) {\n\t\ttry{\n\t\n\t\t\tif (result.hasErrors()) {\n\t\t\t\treturn viewBaseLocation + \"/form\";\n\t\t\t}\n\t\n\t\t\tabm.guardar(tipoConsumo);\n\t\n\t\t\tif(idEstadia != null){\n\t\t\t\tmodel.addAttribute(\"idEstadia\", idEstadia);\n\t\t\t}\n\t\n\t\t\tmodel.addAttribute(\"success\", \"La creaci&oacuten se realiz&oacute correctamente.\");\n\t\t\t\n\t\t} catch(Exception e) {\n\t\t\tmodel.addAttribute(\"success\", \"La creaci&oacuten no pudo realizarse.\");\n\t\t}\n\t\tmodel.addAttribute(\"loggedinuser\", getPrincipal());\n\t\treturn \"redirect:list\";\n\t}", "@FXML\r\n private void crearSolicitud() {\r\n try {\r\n //Carga la vista de crear solicitud rma\r\n FXMLLoader loader = new FXMLLoader();\r\n loader.setLocation(Principal.class.getResource(\"/vista/CrearSolicitud.fxml\"));\r\n BorderPane vistaCrear = (BorderPane) loader.load();\r\n\r\n //Crea un dialogo para mostrar la vista\r\n Stage dialogo = new Stage();\r\n dialogo.setTitle(\"Solicitud RMA\");\r\n dialogo.initModality(Modality.WINDOW_MODAL);\r\n dialogo.initOwner(primerStage);\r\n Scene escena = new Scene(vistaCrear);\r\n dialogo.setScene(escena);\r\n\r\n //Annadir controlador y datos\r\n ControladorCrearSolicitud controlador = loader.getController();\r\n controlador.setDialog(dialogo, primerStage);\r\n\r\n //Carga el numero de Referencia\r\n int numReferencia = DAORma.crearReferencia();\r\n\r\n //Modifica el dialogo para que no se pueda cambiar el tamaño y lo muestra\r\n dialogo.setResizable(false);\r\n dialogo.showAndWait();\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "public frmVenda() {\n initComponents();\n }", "public void insert() {\n SiswaModel m = new SiswaModel();\n m.setNisn(view.getTxtNis().getText());\n m.setNik(view.getTxtNik().getText());\n m.setNamaSiswa(view.getTxtNama().getText());\n m.setTempatLahir(view.getTxtTempatLahir().getText());\n \n //save date format\n String date = view.getDatePickerLahir().getText();\n DateFormat df = new SimpleDateFormat(\"MM/dd/yyyy\"); \n Date d = null;\n try {\n d = df.parse(date);\n } catch (ParseException ex) {\n System.out.println(\"Error : \"+ex.getMessage());\n }\n m.setTanggalLahir(d);\n \n //Save Jenis kelamin\n if(view.getRadioLaki().isSelected()){\n m.setJenisKelamin(JenisKelaminEnum.Pria);\n }else{\n m.setJenisKelamin(JenisKelaminEnum.Wanita);\n }\n \n m.setAsalSekolah(view.getTxtAsalSekolah().getText());\n m.setHobby(view.getTxtHoby().getText());\n m.setCita(view.getTxtCita2().getText());\n m.setJumlahSaudara(Integer.valueOf(view.getTxtNis().getText()));\n m.setAyah(view.getTxtNamaAyah().getText());\n m.setAlamat(view.getTxtAlamat().getText());\n \n if(view.getRadioLkkAda().isSelected()){\n m.setLkk(LkkEnum.ada);\n }else{\n m.setLkk(LkkEnum.tidak_ada);\n }\n \n //save agama\n m.setAgama(view.getComboAgama().getSelectedItem().toString());\n \n dao.save(m);\n clean();\n }", "public FormCadastroAutomovel() {\n initComponents();\n }", "com.soa.SolicitarServicioDocument.SolicitarServicio addNewSolicitarServicio();", "int insert(AbiFormsForm record);", "@RequestMapping(value = \"/create\", method = RequestMethod.POST)\n public ModelAndView create(@RequestParam(\"horasalida\") Date horasalida,@RequestParam(\"horallegada\") Date horallegada,@RequestParam(\"aeropuerto_idaeropuerto\") Long aeropuerto_idaeropuerto,\n \t\t@RequestParam(\"aeropuerto_idaeropuerto2\") Long aeropuerto_idaeropuerto2,@RequestParam(\"avion_idavion\") Long avion_idavion) {\n Vuelo post=new Vuelo();\n post.setHorallegada(horallegada);\n post.setHorasalida(horasalida);\n\t\t\n post.setAeropuerto_idaeropuerto(aeropuerto_idaeropuerto);\n post.setAeropuerto_idaeropuerto2(aeropuerto_idaeropuerto2);\n post.setAvion_idavion(avion_idavion);\n repository.save(post);\n return new ModelAndView(\"redirect:/vuelos\");\n }", "public New_appointment() {\n initComponents();\n }", "public loanform() {\n assets = 0;\n initComponents();\n assettypeinputs = new ArrayList();\n assetvalueinputs = new ArrayList();\n assetassesedinputs = new ArrayList();\n assettypelabels = new ArrayList();\n assetvaluelabels = new ArrayList();\n assetassesedlabels = new ArrayList();\n //jPanel6.setLayout(new FlowLayout());\n jPanel6.setLayout(new GridLayout(0,2));\n }", "public ProfilsFIForm() {\r\n\t\tsuper();\r\n\t}", "@RequestMapping(value = \"sinResultado\", method = RequestMethod.GET)\n public ModelAndView initCreateFormSR(HttpServletRequest request) throws Exception {\n logger.debug(\"Crear reporte general de notificaciones\");\n String urlValidacion=\"\";\n try {\n urlValidacion = seguridadService.validarLogin(request);\n //si la url esta vacia significa que la validación del login fue exitosa\n if (urlValidacion.isEmpty())\n urlValidacion = seguridadService.validarAutorizacionUsuario(request, ConstantsSecurity.SYSTEM_CODE, false);\n }catch (Exception e){\n e.printStackTrace();\n urlValidacion = \"404\";\n }\n ModelAndView mav = new ModelAndView();\n if (urlValidacion.isEmpty()) {\n mav.setViewName(\"reportes/residencia/sinResultado\");\n long idUsuario = seguridadService.obtenerIdUsuario(request);\n List<EntidadesAdtvas> entidades = new ArrayList<EntidadesAdtvas>();\n if (seguridadService.esUsuarioNivelCentral(idUsuario, ConstantsSecurity.SYSTEM_CODE)){\n entidades = entidadAdmonService.getAllEntidadesAdtvas();\n }else {\n entidades = seguridadService.obtenerEntidadesPorUsuario((int) idUsuario, ConstantsSecurity.SYSTEM_CODE);\n }\n List<TipoNotificacion> tiposNotificacion = new ArrayList<TipoNotificacion>();// = catalogosService.getTipoNotificacion();\n TipoNotificacion tipoNotificacionSF = catalogosService.getTipoNotificacion(\"TPNOTI|SINFEB\");\n TipoNotificacion tipoNotificacionIRA = catalogosService.getTipoNotificacion(\"TPNOTI|IRAG\");\n tiposNotificacion.add(tipoNotificacionSF);\n tiposNotificacion.add(tipoNotificacionIRA);\n List<Divisionpolitica> departamentos = divisionPoliticaService.getAllDepartamentos();\n List<AreaRep> areas = seguridadService.getAreasUsuario((int)idUsuario,4);\n mav.addObject(\"areas\", areas);\n mav.addObject(\"departamentos\", departamentos);\n mav.addObject(\"entidades\",entidades);\n mav.addObject(\"tiposNotificacion\", tiposNotificacion);\n\n }else{\n mav.setViewName(urlValidacion);\n }\n return mav;\n }", "public TelaCadastrarProduto() {\n initComponents();\n entidade = new Produto();\n setRepositorio(RepositorioBuilder.getProdutoRepositorio());\n grupo.add(jRadioButton1);\n grupo.add(jRadioButton2);\n }", "private void crearVista() {\n\t\tVista vista = Vista.getInstancia();\n\t\tvista.addObservador(this);\n\n\t}", "@RequestMapping(\"/save\")\n\tpublic String createProjectForm(Project project, Model model) {\n\t\t\n\tproRep.save(project);\n\tList<Project> getall = (List<Project>) proRep.getAll();\n\tmodel.addAttribute(\"projects\", getall);\n\t\n\treturn \"listproject\";\n\t\t\n\t}", "public ArticulosAdd() {\n initComponents();\n Sistema.lblNotificacion.setText(\"Ingreso Artítuclos\");\n this.setLocationRelativeTo(null);\n\n Date date = new Date();\n\n dtDesde.setDate(date);\n dtHasta.setDate(date);\n\n articulos.searchArticulo(cboArticulos, \"\", 0, 1000, 0);\n }", "public ingresarDatos() {\n initComponents();\n Validacion();\n \n }", "@GetMapping(\"/restaurante/new\")\n\tpublic String newRestaurante(Model model) {\n\t\tmodel.addAttribute(\"restaurante\", new Restaurante());\n\t\tControllerHelper.setEditMode(model, false);\n\t\tControllerHelper.addCategoriasToRequest(categoriaRestauranteRepository, model);\n\t\t\n\t\treturn \"restaurante-cadastro\";\n\t\t\n\t}", "private void createForm(ArrayList<HashMap<String, String>> data) {\n\t\tLayoutInflater inflater = LayoutInflater.from(IPropertyRegistrationActivity.this);\n\t\tLinearLayout.LayoutParams params = new LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT,\n\t\t\t\tandroid.widget.LinearLayout.LayoutParams.WRAP_CONTENT);\n\t\tparams.topMargin = 10;\n\n\t\tfields = data;\n\t\tLinearLayout layout = null;\n\t\tint len = fields.size();\n\t\tfor (int j = 0; j < len; j++) {\n\t\t\tfinal HashMap<String, String> field = fields.get(j);\n\t\t\tView fieldView = inflater.inflate(R.layout.iproperty_registration_dynamic_view_item, null);\n\n\t\t\tif (field.get(TYPE).equals(LABEL)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrLabel));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t} else if (field.get(TYPE).equals(PASSWORD)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEdit));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tif (field.get(NAME).contains(getString(R.string.phone)) || field.get(NAME).contains(getString(R.string.year))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_CLASS_NUMBER);\n\t\t\t\t} else if (field.get(NAME).contains(getString(R.string.website)) || field.get(NAME).contains(getString(R.string.email))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);\n\t\t\t\t}\n\t\t\t} else if (field.get(TYPE).equals(TEXT)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEdit));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tif (field.get(NAME).contains(getString(R.string.phone)) || field.get(NAME).contains(getString(R.string.year))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_CLASS_NUMBER);\n\t\t\t\t} else if (field.get(NAME).contains(getString(R.string.website)) || field.get(NAME).contains(getString(R.string.email))) {\n\t\t\t\t\tedit.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);\n\t\t\t\t}\n\t\t\t} else if (field.get(TYPE).equals(TEXTAREA)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditArea));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\n\t\t\t\tif (field.get(VALUE).toString().trim().length() > 0) {\n\t\t\t\t\tedit.setText(field.get(VALUE));\n\t\t\t\t} else {\n\t\t\t\t}\n\n\t\t\t} else if (field.get(TYPE).equals(MAP)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tfinal ImageView imgMap;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditMap));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\timgMap = ((ImageView) layout.findViewById(R.id.imgMap));\n\t\t\t\tif (field.get(NAME).equalsIgnoreCase(getString(R.string.state))) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAddress address = IjoomerUtilities.getAddressFromLatLong(0, 0);\n\t\t\t\t\t\tedit.setText(address.getAdminArea().replace(address.getCountryName() == null ? \"\" : address.getCountryName(), \"\")\n\t\t\t\t\t\t\t\t.replace(address.getPostalCode() == null ? \"\" : address.getPostalCode(), \"\"));\n\t\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\t\tedit.setText(\"\");\n\t\t\t\t\t}\n\t\t\t\t} else if (field.get(NAME).equalsIgnoreCase(getString(R.string.city_town))) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAddress address = IjoomerUtilities.getAddressFromLatLong(0, 0);\n\t\t\t\t\t\tedit.setText(address.getSubAdminArea());\n\t\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\t\tedit.setText(\"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\timgMap.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(View v) {\n\t\t\t\t\t\teditMap = edit;\n\t\t\t\t\t\tIntent intent = new Intent(IPropertyRegistrationActivity.this, IjoomerMapAddress.class);\n\t\t\t\t\t\tstartActivityForResult(intent, GET_ADDRESS_FROM_MAP);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else if (field.get(TYPE).equals(SELECT)) {\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrSpin));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tfinal Spinner spn;\n\t\t\t\tspn = ((Spinner) layout.findViewById(R.id.txtValue));\n\t\t\t\tspn.setAdapter(IjoomerUtilities.getSpinnerAdapter(field));\n\t\t\t\tif (field.get(NAME).equalsIgnoreCase(getString(R.string.country))) {\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tAddress address = IjoomerUtilities.getAddressFromLatLong(0, 0);\n\t\t\t\t\t\tString country = address.getCountryName();\n\t\t\t\t\t\tint selectedIndex = 0;\n\t\t\t\t\t\tJSONArray jsonArray = null;\n\n\t\t\t\t\t\tjsonArray = new JSONArray(field.get(OPTIONS));\n\t\t\t\t\t\tint optionSize = jsonArray.length();\n\t\t\t\t\t\tfor (int k = 0; k < optionSize; k++) {\n\t\t\t\t\t\t\tJSONObject options = (JSONObject) jsonArray.get(k);\n\n\t\t\t\t\t\t\tif (options.getString(VALUE).equalsIgnoreCase(country)) {\n\t\t\t\t\t\t\t\tselectedIndex = k;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tspn.setSelection(selectedIndex);\n\t\t\t\t\t} catch (Throwable e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\tspn.setSelection(0);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if (field.get(TYPE).equals(DATE)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tedit.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(final View v) {\n\t\t\t\t\t\tIjoomerUtilities.getDateDialog(((IjoomerEditText) v).getText().toString(), true, new CustomClickListner() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onClick(String value) {\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setText(value);\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setError(null);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else if (field.get(TYPE).equals(TIME)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tedit.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(final View v) {\n\t\t\t\t\t\tIjoomerUtilities.getTimeDialog(((IjoomerEditText) v).getText().toString(), new CustomClickListner() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onClick(String value) {\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setText(value);\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setError(null);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else if (field.get(TYPE).equals(MULTIPLESELECT)) {\n\t\t\t\tfinal IjoomerEditText edit;\n\t\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable));\n\t\t\t\tlayout.setVisibility(View.VISIBLE);\n\t\t\t\tedit = ((IjoomerEditText) layout.findViewById(R.id.txtValue));\n\t\t\t\tedit.setOnClickListener(new OnClickListener() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(final View v) {\n\t\t\t\t\t\tIjoomerUtilities.getMultiSelectionDialog(field.get(NAME), field.get(OPTIONS), ((IjoomerEditText) v).getText().toString(), new CustomClickListner() {\n\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void onClick(String value) {\n\t\t\t\t\t\t\t\t((IjoomerEditText) v).setText(value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (field.get(REQUIRED).equalsIgnoreCase(\"1\")) {\n\t\t\t\t((IjoomerTextView) layout.findViewById(R.id.txtLable)).setText(field.get(NAME) + \" *\");\n\t\t\t} else {\n\t\t\t\t((IjoomerTextView) layout.findViewById(R.id.txtLable)).setText(field.get(NAME));\n\t\t\t}\n\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrEdit)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrEditArea)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrSpin)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrEditClickable)).setVisibility(View.GONE);\n\t\t\t((LinearLayout) fieldView.findViewById(R.id.lnrLabel)).setVisibility(View.GONE);\n\n\t\t\tlayout = ((LinearLayout) fieldView.findViewById(R.id.lnrReadOnly));\n\t\t\tlayout.setVisibility(View.VISIBLE);\n\n\t\t\t((IjoomerTextView) layout.findViewById(R.id.txtLable)).setText(field.get(NAME));\n\t\t\t((IjoomerEditText) layout.findViewById(R.id.txtValue)).setText(field.get(VALUE));\n\t\t\tfieldView.setTag(field);\n\t\t\tlnr_form.addView(fieldView, params);\n\t\t}\n\t}", "public Formulario() {\n initComponents();\n }", "private void createSubject(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n // Formulareingaben prüfen\n String name = request.getParameter(\"name\");\n\n Subject subject = new Subject(name);\n List<String> errors = this.validationBean.validate(subject);\n\n // Neue Kategorie anlegen\n if (errors.isEmpty()) {\n this.subjectBean.saveNew(subject);\n }\n\n // Browser auffordern, die Seite neuzuladen\n if (!errors.isEmpty()) {\n FormValues formValues = new FormValues();\n formValues.setValues(request.getParameterMap());\n formValues.setErrors(errors);\n\n HttpSession session = request.getSession();\n session.setAttribute(\"subjects_form\", formValues);\n }\n\n response.sendRedirect(request.getRequestURI());\n }", "private void submitForm(){\n String toast_message;\n\n int time = getValueOfField(R.id.at_editTextNumberSigned_timeValue);\n int easyNumber = getValueOfField(R.id.at_editTextNumberSigned_levelEasyValue);\n int mediumNumber = getValueOfField(R.id.at_editTextNumberSigned_levelMiddleValue);\n int highNumber = getValueOfField(R.id.at_editTextNumberSigned_levelHighValue);\n int hardcoreNumber = getValueOfField(R.id.at_editTextNumberSigned_levelExpertValue);\n\n // if time is between 0 and 1440 min\n if (time > 0){\n if(time < 24*60){\n // if numbers are positives\n if (easyNumber >= 0 && mediumNumber >= 0 && highNumber >= 0 && hardcoreNumber >= 0){\n\n // save data\n int id = this.controller.getLastIdTraining() + 1;\n\n ArrayList<Level> listLevel = new ArrayList<>();\n listLevel.add(new Level(\"EASY\", easyNumber));\n listLevel.add(new Level(\"MEDIUM\", mediumNumber));\n listLevel.add(new Level(\"HIGHT\", highNumber));\n listLevel.add(new Level(\"HARDCORE\", hardcoreNumber));\n\n Training training = new Training(id, inputCalendar.getTime(), time, listLevel);\n\n this.controller.AddTraining(training);\n\n // init values of Form\n initForm(null);\n\n // redirection to stats page\n Navigation.findNavController(getActivity(),\n R.id.nav_host_fragment).navigate(R.id.navigation_list_training);\n\n toast_message = \"L'entrainement a bien été ajouté !\";\n }else toast_message = \"Erreur:\\nToutes les valeurs de voies ne sont pas positive !\";\n }else toast_message = \"La durée ne doit pas exceder 1440 min.\";\n }else toast_message = \"La durée doit être supérieur à 0 min.\\n\";\n\n // Send alert\n Toast.makeText(getContext(), toast_message, Toast.LENGTH_LONG).show();\n }", "public DisciplinaForm() {\n initComponents();\n }", "public MostraVenta(String idtrasp, Object[][] clienteM1, Object[][] vendedorM1, String idmarc, String responsable,ListaTraspaso panel)\n{\n this.padre = panel;\n this.clienteM = clienteM1;\n this.vendedorM = vendedorM1;\n this.idtraspaso= idtrasp;\n this.idmarca=idmarc;\n//this.tipoenvioM = new String[]{\"INGRESO\", \"TRASPASO\"};\n String tituloTabla =\"Detalle Venta\";\n // padre=panel;\n String nombreBoton1 = \"Registrar\";\n String nombreBoton2 = \"Cancelar\";\n // String nombreBoton3 = \"Eliminar Empresa\";\n\n setId(\"win-NuevaEmpresaForm1\");\n setTitle(tituloTabla);\n setWidth(400);\n setMinWidth(ANCHO);\n setHeight(250);\n setLayout(new FitLayout());\n setPaddings(WINDOW_PADDING);\n setButtonAlign(Position.CENTER);\n setCloseAction(Window.CLOSE);\n setPlain(true);\n\n but_aceptar = new Button(nombreBoton1);\n but_cancelar = new Button(nombreBoton2);\n // addButton(but_aceptarv);\n addButton(but_aceptar);\n addButton(but_cancelar);\n\n formPanelCliente = new FormPanel();\n formPanelCliente.setBaseCls(\"x-plain\");\n //formPanelCliente.setLabelWidth(130);\n formPanelCliente.setUrl(\"save-form.php\");\n formPanelCliente.setWidth(ANCHO);\n formPanelCliente.setHeight(ALTO);\n formPanelCliente.setLabelAlign(Position.LEFT);\n\n formPanelCliente.setAutoWidth(true);\n\n\ndat_fecha1 = new DateField(\"Fecha\", \"d-m-Y\");\n fechahoy = new Date();\n dat_fecha1.setValue(fechahoy);\n dat_fecha1.setReadOnly(true);\n\ncom_vendedor = new ComboBox(\"Vendedor al que enviamos\", \"idempleado\");\ncom_cliente = new ComboBox(\"Clientes\", \"idcliente\");\n//com_tipo = new ComboBox(\"Tipo Envio\", \"idtipo\");\n initValues1();\n\n\n\n formPanelCliente.add(dat_fecha1);\n// formPanelCliente.add(com_tipo);\n// formPanelCliente.add(tex_nombreC);\n// formPanelCliente.add(tex_codigoBarra);\n // formPanelCliente.add(tex_codigoC);\nformPanelCliente.add(com_vendedor);\n formPanelCliente.add(com_cliente);\n add(formPanelCliente);\nanadirListenersTexfield();\n addListeners();\n\n }", "private void initialize() {\r\n\t\tfrmTelaCadastro = new JFrame();\r\n\t\tfrmTelaCadastro.getContentPane().setBackground(Color.WHITE);\r\n\t\tfrmTelaCadastro.getContentPane().setLayout(null);\r\n\r\n\t\tconsultaagua = new CadastroAguaDAO();\r\n\r\n\t\tpanel = new JPanel();\r\n\t\tpanel.setBounds(80, 24, 832, 94);\r\n\t\tpanel.setLayout(null);\r\n\t\tfrmTelaCadastro.getContentPane().add(panel);\r\n\r\n\t\ttextField = new JTextField();\r\n\t\ttextField.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextField.setColumns(10);\r\n\t\ttextField.setBounds(64, 37, 242, 20);\r\n\t\tpanel.add(textField);\r\n\r\n\t\ttextField_1 = new JTextField();\r\n\t\ttextField_1.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextField_1.setColumns(10);\r\n\t\ttextField_1.setBounds(414, 34, 347, 20);\r\n\t\tpanel.add(textField_1);\r\n\r\n\t\ttextField_4 = new JTextField();\r\n\t\ttextField_4.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextField_4.setColumns(10);\r\n\t\ttextField_4.setBounds(105, 60, 112, 20);\r\n\t\tpanel.add(textField_4);\r\n\r\n\t\tlblNome = new JLabel(\"Nome:\");\r\n\t\tlblNome.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblNome.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tlblNome.setBounds(10, 32, 65, 28);\r\n\t\tpanel.add(lblNome);\r\n\r\n\t\tlblEndereco = new JLabel(\"Endereco:\");\r\n\t\tlblEndereco.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tlblEndereco.setBounds(356, 29, 65, 28);\r\n\t\tpanel.add(lblEndereco);\r\n\r\n\t\tlblhidrometro = new JLabel(\"Hidr\\u00F4metro:\");\r\n\t\tlblhidrometro.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblhidrometro.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tlblhidrometro.setBounds(20, 55, 75, 28);\r\n\t\tpanel.add(lblhidrometro);\r\n\r\n\t\tJButton btnNewButton = new JButton(\"Consultar\");\r\n\t\tbtnNewButton.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\r\n\t\t\t\tList<CadastroAgua> cadagua = new ArrayList<CadastroAgua>();\r\n\r\n\t\t\t\tCadastroAgua c = new CadastroAgua();\r\n\t\t\t\tcadagua = consultaagua.getCadastroAgua(\"8\");\r\n\t\t\t\tfor (int i = 0; i < cadagua.size(); i++)\r\n\r\n\t\t\t\t{\r\n\t\t\t\t\tc = (CadastroAgua) cadagua.get(i);\r\n\r\n\t\t\t\t\ttextRGI.setText(c.getContaAguaRGI());\r\n\t\t\t\t\ttextGrupo.setText(c.getContaAguaGrupo());\r\n\t\t\t\t\ttextNConta.setText(c.getContaAguaNConta());\r\n\t\t\t\t\ttextGrupo.setText(c.getContaAguaGrupo());\r\n\t\t\t\t\ttextMesRef.setText(c.getContaAguaMesRef());\r\n\t\t\t\t\ttextTipoLig.setText(c.getContaAguaTipoLigacao());\r\n\t\t\t\t\ttextTipoFat.setText(c.getContaAguaTipoFaturamento());\r\n\t\t\t\t\ttextConsumo.setText(c.getContaAguaConsumo());\r\n\t\t\t\t\ttextDataAtual.setText(c.getContaAguaDataLeituraAtual());\r\n\t\t\t\t\ttextLeituraAtual.setText(c.getContaAguaLeituraAtual());\r\n\t\t\t\t\ttextDataAnterior.setText(c.getContaAguaDataLeituraAnterior());\r\n\t\t\t\t\ttextLeituraAnterior.setText(c.getContaAguaLeituraAnterior());\r\n\t\t\t\t\ttextObs.setText(c.getContaAguaObservacao());\r\n\t\t\t\t\ttxtValorAgua.setText(c.getContaAguaValorAgua());\r\n\t\t\t\t\ttxtValorEsgoto.setText(c.getContaAguaValorEsgoto());\r\n\t\t\t\t\ttextValorTotal.setText(c.getContaAguaValorTotal());\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t});\r\n\t\tbtnNewButton.setBounds(414, 65, 89, 23);\r\n\t\tpanel.add(btnNewButton);\r\n\r\n\t\ttabbedPane = new JTabbedPane(JTabbedPane.TOP);\r\n\t\ttabbedPane.setBounds(80, 144, 832, 425);\r\n\t\tfrmTelaCadastro.getContentPane().add(tabbedPane);\r\n\r\n\t\tpanel1 = new JPanel();\r\n\t\ttabbedPane.addTab(\"Dados Conta\", null, panel1, null);\r\n\t\tpanel1.setLayout(null);\r\n\r\n\t\ttextNConta = new JTextField();\r\n\t\ttextNConta.setBounds(193, 54, 155, 20);\r\n\t\ttextNConta.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextNConta.setColumns(10);\r\n\t\tpanel1.add(textNConta);\r\n\r\n\t\tlblNDaConta = new JLabel(\"N\\u00BA da Conta:\");\r\n\t\tlblNDaConta.setBounds(215, 26, 97, 28);\r\n\t\tlblNDaConta.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblNDaConta.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblNDaConta);\r\n\r\n\t\tlblGrupo = new JLabel(\"Grupo:\");\r\n\t\tlblGrupo.setBounds(358, 26, 97, 28);\r\n\t\tlblGrupo.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblGrupo.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblGrupo);\r\n\r\n\t\ttextGrupo = new JTextField();\r\n\t\ttextGrupo.setBounds(384, 54, 45, 20);\r\n\t\ttextGrupo.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextGrupo.setColumns(10);\r\n\t\tpanel1.add(textGrupo);\r\n\r\n\t\tlblCodIdentificador_3 = new JLabel(\"RGI:\");\r\n\t\tlblCodIdentificador_3.setBounds(52, 26, 97, 28);\r\n\t\tlblCodIdentificador_3.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblCodIdentificador_3.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblCodIdentificador_3);\r\n\r\n\t\ttextRGI = new JTextField();\r\n\t\ttextRGI.setBounds(30, 54, 155, 20);\r\n\t\ttextRGI.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextRGI.setColumns(10);\r\n\t\tpanel1.add(textRGI);\r\n\r\n\t\tlblMesRef = new JLabel(\"M\\u00EAs Refer\\u00EAncia:\");\r\n\t\tlblMesRef.setBounds(484, 26, 97, 28);\r\n\t\tlblMesRef.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblMesRef.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblMesRef);\r\n\r\n\t\ttextMesRef = new JTextField();\r\n\t\ttextMesRef.setBounds(455, 54, 155, 20);\r\n\t\ttextMesRef.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextMesRef.setColumns(10);\r\n\t\tpanel1.add(textMesRef);\r\n\r\n\t\tlblCodIdentificador_1 = new JLabel(\"Tipo de Liga\\u00E7\\u00E3o:\");\r\n\t\tlblCodIdentificador_1.setBounds(658, 26, 97, 28);\r\n\t\tlblCodIdentificador_1.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblCodIdentificador_1.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblCodIdentificador_1);\r\n\r\n\t\ttextTipoLig = new JTextField();\r\n\t\ttextTipoLig.setBounds(636, 54, 155, 20);\r\n\t\ttextTipoLig.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextTipoLig.setColumns(10);\r\n\t\tpanel1.add(textTipoLig);\r\n\r\n\t\tlblTipFat = new JLabel(\"Tipo de Faturamento:\");\r\n\t\tlblTipFat.setBounds(215, 100, 120, 28);\r\n\t\tlblTipFat.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblTipFat.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblTipFat);\r\n\r\n\t\ttextTipoFat = new JTextField();\r\n\t\ttextTipoFat.setBounds(198, 128, 155, 20);\r\n\t\ttextTipoFat.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextTipoFat.setColumns(10);\r\n\t\tpanel1.add(textTipoFat);\r\n\r\n\t\ttextConsumo = new JTextField();\r\n\t\ttextConsumo.setBounds(455, 128, 155, 20);\r\n\t\ttextConsumo.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextConsumo.setColumns(10);\r\n\t\tpanel1.add(textConsumo);\r\n\r\n\t\tlblConsumoM = new JLabel(\"Consumo m\\u00B3:\");\r\n\t\tlblConsumoM.setBounds(472, 100, 120, 28);\r\n\t\tlblConsumoM.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblConsumoM.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblConsumoM);\r\n\r\n\t\tlblLeitAtual = new JLabel(\"Leitura Atual:\");\r\n\t\tlblLeitAtual.setBounds(203, 223, 120, 28);\r\n\t\tlblLeitAtual.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblLeitAtual.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblLeitAtual);\r\n\r\n\t\ttextDataAtual = new JTextField();\r\n\t\ttextDataAtual.setBounds(312, 227, 120, 20);\r\n\t\ttextDataAtual.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextDataAtual.setColumns(10);\r\n\t\tpanel1.add(textDataAtual);\r\n\r\n\t\tJLabel lblData = new JLabel(\"Data\");\r\n\t\tlblData.setBounds(314, 185, 120, 28);\r\n\t\tlblData.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblData.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblData);\r\n\r\n\t\tJLabel lblApresentao = new JLabel(\"Apresenta\\u00E7\\u00E3o\");\r\n\t\tlblApresentao.setBounds(205, 185, 120, 28);\r\n\t\tlblApresentao.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblApresentao.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblApresentao);\r\n\r\n\t\tJSeparator separator = new JSeparator();\r\n\t\tseparator.setBounds(130, 202, 0, 35);\r\n\t\tpanel1.add(separator);\r\n\r\n\t\tJSeparator separator_1 = new JSeparator();\r\n\t\tseparator_1.setBounds(232, 214, 355, 2);\r\n\t\tpanel1.add(separator_1);\r\n\r\n\t\tJLabel lblLeitura = new JLabel(\"Leitura\");\r\n\t\tlblLeitura.setBounds(461, 185, 120, 28);\r\n\t\tlblLeitura.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblLeitura.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblLeitura);\r\n\r\n\t\tJLabel lblLeituraAnterior = new JLabel(\"Leitura Anterior:\");\r\n\t\tlblLeituraAnterior.setBounds(203, 250, 120, 28);\r\n\t\tlblLeituraAnterior.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblLeituraAnterior.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tpanel1.add(lblLeituraAnterior);\r\n\r\n\t\ttextDataAnterior = new JTextField();\r\n\t\ttextDataAnterior.setBounds(312, 254, 120, 20);\r\n\t\ttextDataAnterior.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextDataAnterior.setColumns(10);\r\n\t\tpanel1.add(textDataAnterior);\r\n\r\n\t\ttextLeituraAnterior = new JTextField();\r\n\t\ttextLeituraAnterior.setBounds(461, 254, 120, 20);\r\n\t\ttextLeituraAnterior.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextLeituraAnterior.setColumns(10);\r\n\t\tpanel1.add(textLeituraAnterior);\r\n\r\n\t\ttextLeituraAtual = new JTextField();\r\n\t\ttextLeituraAtual.setBounds(461, 227, 120, 20);\r\n\t\ttextLeituraAtual.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextLeituraAtual.setColumns(10);\r\n\t\tpanel1.add(textLeituraAtual);\r\n\r\n\t\tlblObservacao = new JLabel(\"Observa\\u00E7\\u00E3o:\");\r\n\t\tlblObservacao.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblObservacao.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tlblObservacao.setBounds(358, 288, 120, 28);\r\n\t\tpanel1.add(lblObservacao);\r\n\r\n\t\ttextObs = new JTextField();\r\n\t\ttextObs.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextObs.setColumns(10);\r\n\t\ttextObs.setBounds(35, 314, 767, 20);\r\n\t\tpanel1.add(textObs);\r\n\r\n\t\tJSeparator separator_2 = new JSeparator();\r\n\t\tseparator_2.setBounds(444, 211, 0, 78);\r\n\t\tpanel1.add(separator_2);\r\n\t\tJLabel lblValorAgua = new JLabel(\"Valor \\u00C1gua\");\r\n\t\tlblValorAgua.setBounds(130, 345, 149, 28);\r\n\t\tpanel1.add(lblValorAgua);\r\n\t\tlblValorAgua.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblValorAgua.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\ttxtValorAgua = new JTextField();\r\n\t\ttxtValorAgua.setBounds(151, 366, 106, 20);\r\n\t\tpanel1.add(txtValorAgua);\r\n\t\ttxtValorAgua.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttxtValorAgua.setColumns(10);\r\n\t\ttxtValorEsgoto = new JTextField();\r\n\t\ttxtValorEsgoto.setBounds(352, 366, 106, 20);\r\n\t\tpanel1.add(txtValorEsgoto);\r\n\t\ttxtValorEsgoto.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttxtValorEsgoto.setColumns(10);\r\n\t\tJLabel lblValorEsgoto = new JLabel(\"Valor Esgoto\");\r\n\t\tlblValorEsgoto.setBounds(331, 345, 149, 28);\r\n\t\tpanel1.add(lblValorEsgoto);\r\n\t\tlblValorEsgoto.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblValorEsgoto.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\t\tJLabel lblValorTotal = new JLabel(\"Valor Total\");\r\n\t\tlblValorTotal.setBounds(524, 345, 149, 28);\r\n\t\tpanel1.add(lblValorTotal);\r\n\t\tlblValorTotal.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\tlblValorTotal.setFont(new Font(\"Tahoma\", Font.PLAIN, 12));\r\n\r\n\t\ttextValorTotal = new JTextField();\r\n\t\ttextValorTotal.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextValorTotal.setColumns(10);\r\n\t\ttextValorTotal.setBounds(547, 366, 106, 20);\r\n\t\tpanel1.add(textValorTotal);\r\n\r\n\t\tJButton btnCadastro = new JButton(\"Cadastro\");\r\n\t\tbtnCadastro.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\r\n\t\t\t\tCadastroAgua cadaguadao = new CadastroAgua();\r\n\r\n\t\t\t\tcadaguadao.setContaAguaRGI(textRGI.getText());\r\n\t\t\t\tcadaguadao.setContaAguaNConta(textNConta.getText());\r\n\t\t\t\tcadaguadao.setContaAguaGrupo(textGrupo.getText());\r\n\t\t\t\tcadaguadao.setContaAguaMesRef(textMesRef.getText());\r\n\t\t\t\tcadaguadao.setContaAguaTipoLigacao(textTipoLig.getText());\r\n\t\t\t\tcadaguadao.setContaAguaTipoFaturamento(textTipoFat.getText());\r\n\t\t\t\tcadaguadao.setContaAguaConsumo(textConsumo.getText());\r\n\t\t\t\tcadaguadao.setContaAguaDataLeituraAtual(textDataAtual.getText());\r\n\t\t\t\tcadaguadao.setContaAguaLeituraAtual(textLeituraAtual.getText());\r\n\t\t\t\tcadaguadao.setContaAguaDataLeituraAnterior(textDataAnterior.getText());\r\n\t\t\t\tcadaguadao.setContaAguaLeituraAnterior(textLeituraAnterior.getText());\r\n\t\t\t\tcadaguadao.setContaAguaObservacao(textObs.getText());\r\n\t\t\t\tcadaguadao.setContaAguaValorAgua(txtValorAgua.getText());\r\n\t\t\t\tcadaguadao.setContaAguaValorEsgoto(txtValorEsgoto.getText());\r\n\t\t\t\tcadaguadao.setContaAguaValorTotal(textValorTotal.getText());\r\n\r\n\t\t\t\tif ((textRGI.getText().isEmpty()) || (textNConta.getText().isEmpty()) || (textGrupo.getText().isEmpty())\r\n\t\t\t\t\t\t|| (textMesRef.getText().isEmpty()) || (textTipoLig.getText().isEmpty())\r\n\t\t\t\t\t\t|| (textTipoFat.getText().isEmpty()) || (textConsumo.getText().isEmpty())\r\n\t\t\t\t\t\t|| (textDataAtual.getText().isEmpty()) || (textLeituraAtual.getText().isEmpty())\r\n\t\t\t\t\t\t|| (textDataAnterior.getText().isEmpty()) || (textLeituraAnterior.getText().isEmpty())\r\n\t\t\t\t\t\t|| (textObs.getText().isEmpty()) || (txtValorAgua.getText().isEmpty())\r\n\t\t\t\t\t\t|| (txtValorEsgoto.getText().isEmpty()) || (textValorTotal.getText().isEmpty())) {\r\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Os campos não podem estar vazios\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\telse {\r\n\r\n\t\t\t\t\tCadastroAguaDAO cadagua = new CadastroAguaDAO();\r\n\t\t\t\t\tcadagua.adiciona(cadaguadao);\r\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Conta registrada com sucesso! \");\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttextRGI.setText(\"\");\r\n\t\t\t\ttextNConta.setText(\"\");\r\n\t\t\t\ttextGrupo.setText(\"\");\r\n\t\t\t\ttextMesRef.setText(\"\");\r\n\t\t\t\ttextTipoLig.setText(\"\");\r\n\t\t\t\ttextTipoFat.setText(\"\");\r\n\t\t\t\ttextConsumo.setText(\"\");\r\n\t\t\t\ttextDataAtual.setText(\"\");\r\n\t\t\t\ttextLeituraAtual.setText(\"\");\r\n\t\t\t\ttextDataAnterior.setText(\"\");\r\n\t\t\t\ttextLeituraAnterior.setText(\"\");\r\n\t\t\t\ttextObs.setText(\"\");\r\n\t\t\t\ttxtValorAgua.setText(\"\");\r\n\t\t\t\ttxtValorEsgoto.setText(\"\");\r\n\t\t\t\ttextValorTotal.setText(\"\");\r\n\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tbtnCadastro.setBounds(423, 623, 107, 23);\r\n\t\tfrmTelaCadastro.getContentPane().add(btnCadastro);\r\n\r\n\t\tJLabel lblNewLabel_1_1 = new JLabel(\"New label\");\r\n\t\tlblNewLabel_1_1.setIcon(new ImageIcon(\"C:\\\\Users\\\\assen\\\\eclipse-workspace\\\\TecSus\\\\img\\\\IconAgua.png\"));\r\n\t\tlblNewLabel_1_1.setBounds(10, 11, 30, 30);\r\n\t\tfrmTelaCadastro.getContentPane().add(lblNewLabel_1_1);\r\n\r\n\t\tJButton lblNewLabel_3 = new JButton(\"New label\");\r\n\t\tlblNewLabel_3.addActionListener(new ActionListener() {\r\n\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\tMenuEnergia window = new MenuEnergia();\r\n\t\t\t\twindow.frmMenuEnergia.setVisible(true);\r\n\t\t\t}\r\n\t\t});\r\n\t\tlblNewLabel_3.setIcon(new ImageIcon(\"C:\\\\Users\\\\assen\\\\eclipse-workspace\\\\TecSus\\\\img\\\\IconReturn.png\"));\r\n\t\tlblNewLabel_3.setForeground(Color.WHITE);\r\n\t\tlblNewLabel_3.setBackground(Color.WHITE);\r\n\t\tlblNewLabel_3.setBounds(31, 611, 60, 54);\r\n\t\tfrmTelaCadastro.getContentPane().add(lblNewLabel_3);\r\n\t\ttextField_5 = new JTextField();\r\n\t\ttextField_5.setHorizontalAlignment(SwingConstants.CENTER);\r\n\t\ttextField_5.setColumns(10);\r\n\t\ttextField_5.setBounds(292, 702, 106, 20);\r\n\t\tfrmTelaCadastro.getContentPane().add(textField_5);\r\n\t\tfrmTelaCadastro.setResizable(false);\r\n\t\tfrmTelaCadastro.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tfrmTelaCadastro.setForeground(Color.WHITE);\r\n\t\tfrmTelaCadastro.setTitle(\"TELA CADASTRO \\u00C1GUA\");\r\n\t\tfrmTelaCadastro.setBounds(100, 100, 960, 720);\r\n\t\tfrmTelaCadastro.setLocationRelativeTo(null);\r\n\r\n\t\timageIcon = new ImageIcon(\"img/IconAgua.png\");\r\n\r\n\t}", "public void crearProgramaFormacion(String nombre, String descripcion, Date fechaI, Date fechaF, Date fechaA, String url) throws ProgramaFormacionExcepcion;", "public CreateTremaDbDialogForm(AnActionEvent event) {\n this.event = event;\n this.windowTitle = \"New Trema XML database file\";\n init();\n }", "public ServerskaForma() {\n initComponents();\n \n \n \n }", "public AddForensicsForm()\r\n\t{\r\n\t\t//sets the layout to border layout as the default layout for a jpanel is flow.\r\n\t\tthis.setLayout(new BorderLayout());\r\n\t\t\r\n\t\t//creates the number format that stops letters being entered into certain textfields\r\n\t\tnumForm = NumberFormat.getIntegerInstance();\r\n\t\tnumForm.setGroupingUsed(false);\r\n\t\tnumForm.setMinimumIntegerDigits(0);\r\n\t\t\r\n\t\t/* Creates the form panel that will hold all the labels and text fields for the form.\r\n\t\t * It is given a grid layout so that each row will be a different section of the form e.g \r\n\t\t * what case it is a part of then on the next line the ID number of the forensic file etc.*/\r\n\t\tform = new JPanel();\r\n\t\tform.setLayout(new GridLayout(0,2,5,5));\r\n\t\tform.setBorder(new CompoundBorder(new EmptyBorder(5,5,5,5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5,5,5,5))));\r\n\t\t\r\n\t\t/* this is the label and textfield that is used to link the forensic file to the case, this has to be\r\n\t\t * done manually as new forensic files could be added for older cases as well as newer and there is no\r\n\t\t * way to predetermine what case the file is for. */\r\n\t\tevidenceLabel = new JLabel(\"Forensic File for case: \");\r\n\t\tevidenceID = new JFormattedTextField(numForm);\r\n\t\tform.add(evidenceLabel);\r\n\t\tform.add(evidenceID);\r\n\t\t\r\n\t\t/* This is the label and text field that holds the information for the ID of the forensics file\r\n\t\t * as this is unique and assigned automatically the field is set to uneditable by default\r\n\t\t * the assignID method in the forensic class is used to assign a unique ID to the forensic file*/\r\n\t\tforensicLabel = new JLabel(\"Forensics ID: \");\r\n\t\tforensicID = new JFormattedTextField();\r\n\t\tforensicID.setEditable(false);\r\n\t\tf1.assignID();\r\n\t\tforensicID.setText(String.valueOf(f1.getForensicID()));\r\n\t\tform.add(forensicLabel);\r\n\t\tform.add(forensicID);\r\n\t\t\r\n\t\t/* This is the label and combobox for biological evidence, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\tbioLabel = new JLabel(\"Presence of Biological Evidence:\");\r\n\t\tbioBox = new JComboBox(confirmation);\r\n\t\tform.add(bioLabel);\r\n\t\tform.add(bioBox);\r\n\t\t\r\n\t\t/* This is the label and combobox for print evidence e.g finger prints and toe prints, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\tprintsLabel = new JLabel(\"Presence of Finger Prints:\");\r\n\t\tprintsBox = new JComboBox(confirmation);\r\n\t\tform.add(printsLabel);\r\n\t\tform.add(printsBox);\r\n\t\t\r\n\t\t/* This is the label and combobox for Track evidence e.g boot and tire, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\ttracksLabel = new JLabel(\"Presence of Vehicle/Foot Tracks:\");\r\n\t\ttracksBox = new JComboBox(confirmation);\r\n\t\tform.add(tracksLabel);\r\n\t\tform.add(tracksBox);\r\n\t\t\r\n\t\t/* This is the label and combobox for digital evidence e.g phones and tablets, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\tdigitalLabel = new JLabel(\"Presence of Digital Evidence: \");\r\n\t\tdigitalBox = new JComboBox(confirmation);\r\n\t\tform.add(digitalLabel);\r\n\t\tform.add(digitalBox);\r\n\t\t\r\n\t\t/* This is the label and combobox for tool mark evidence, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\ttoolMarkLabel = new JLabel(\"Presence of tool marks\");\r\n\t\ttoolMarkBox = new JComboBox(confirmation);\r\n\t\tform.add(toolMarkLabel);\r\n\t\tform.add(toolMarkBox);\r\n\t\t\t\t\r\n\t\t/* This is the label and combobox for narcotic evidence, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\tnarcoticLabel = new JLabel(\"Presence of Narcotics: \");\r\n\t\tnarcoticBox = new JComboBox(confirmation);\r\n\t\tform.add(narcoticLabel);\r\n\t\tform.add(narcoticBox);\r\n\t\t\r\n\t\t/* This is the label and combobox for firearm evidence, it uses the confirmation\r\n\t\t * array to give it the values for the combobox*/\r\n\t\tfirearmLabel = new JLabel(\"Presence of Firearms: \");\r\n\t\tfirearmBox = new JComboBox(confirmation);\r\n\t\tform.add(firearmLabel);\r\n\t\tform.add(firearmBox);\r\n\t\t\r\n\t\t/* these are the buttons to cancel and sumbit and the panel that holds them\r\n\t\t * Submit uses the inner class listener to perform a function\r\n\t\t * and the cancel button is used by the window handler class to\r\n\t\t * return to the previous menu*/\r\n\t\tbuttons = new JPanel();\r\n\t\tsubmit = new JButton(\"Submit\");\r\n\t\tsubmit.addActionListener(this);\r\n\t\tcancel = new JButton(\"Cancel\");\r\n\t\tbuttons.add(submit);\r\n\t\tbuttons.add(cancel);\r\n\t\t\r\n\t\t//this is the container that holds both the button and form panel.\r\n\t\tcontainer = new JPanel();\r\n\t\tcontainer.setLayout(new GridLayout(0,1));\r\n\t\tcontainer.setBorder(new EmptyBorder(200, 0, 0, 0));\r\n\t\tcontainer.add(form);\r\n\t\tcontainer.add(buttons);\r\n\t\t\r\n\t\t//adds the container to the main panel.\r\n\t\tadd(container, BorderLayout.CENTER);\r\n\t}", "public abstract Anuncio creaAnuncioGeneral();", "Documento createDocumento();", "public void eventoFiltrar() {\n if (index >= 0) {\n if (tipoLista == 0) {\n tipoLista = 1;\n }\n RequestContext context = RequestContext.getCurrentInstance();\n infoRegistro = \"Cantidad de registros : \" + filtrarListFormulasProcesos.size();\n context.update(\"form:informacionRegistro\");\n }\n }", "public ViewCreatePagamento() {\n initComponents();\n clientesDAO cDAO = DaoFactory.createClientesDao(); \n matriculaDAO mDAO = DaoFactory.createMatriculaDao();\n \n cmbIDClientes.addItem(null);\n cDAO.findAll().forEach((p) -> {\n cmbIDClientes.addItem(p.getNome());\n });\n \n \n txtDataAtual.setText(DateFormat.getDateInstance().format(new Date()));\n }", "public frmAdministracion() {\n initComponents();\n skin();\n DaoAdministracion da = new DaoAdministracion();\n da.setAdministracion(txtMedioAdministracion.getText());\n tblAdministracion.setModel(da.listar());\n\n }", "@Override\n\tprotected BaseSearchForm devuelveFormBusqueda() throws Exception {\n\t\tMantenimientoCRAMatrizDiasSearchForm form = new MantenimientoCRAMatrizDiasSearchForm();\n\t\treturn form;\n\t}", "@Override\n\tpublic void onFormCreate(AbstractForm arg0, DataMsgBus arg1) {\n\t}", "@GetMapping(\"/form\")\n public String form(@RequestParam(name = \"id\", required = false, defaultValue = \"0\") int id, Model model) {\n Categoria categoria = new Categoria();\n if (id != 0) {\n categoria = categoriaService.findById(id);\n }\n model.addAttribute(\"categoria\", categoria);\n return FORM_VIEW;\n }", "public S2SSubmissionDetailForm() {\r\n initComponents();\r\n }", "private void loadForm() {\n CodingProxy icd9 = problem.getIcd9Code();\n \n if (icd9 != null) {\n txtICD.setText(icd9.getProxiedObject().getCode());\n }\n \n String narr = problem.getProviderNarrative();\n \n if (narr == null) {\n narr = icd9 == null ? \"\" : icd9.getProxiedObject().getDisplay();\n }\n \n String probId = problem.getNumberCode();\n \n if (probId == null || probId.isEmpty()) {\n probId = getBroker().callRPC(\"BGOPROB NEXTID\", PatientContext.getActivePatient().getIdElement().getIdPart());\n }\n \n String pcs[] = probId.split(\"\\\\-\", 2);\n lblPrefix.setValue(pcs[0] + \" - \");\n txtID.setValue(pcs.length < 2 ? \"\" : pcs[1]);\n txtNarrative.setText(narr);\n datOnset.setValue(problem.getOnsetDate());\n \n if (\"P\".equals(problem.getProblemClass())) {\n radPersonal.setSelected(true);\n } else if (\"F\".equals(problem.getProblemClass())) {\n radFamily.setSelected(true);\n } else if (\"I\".equals(problem.getStatus())) {\n radInactive.setSelected(true);\n } else {\n radActive.setSelected(true);\n }\n \n int priority = NumberUtils.toInt(problem.getPriority());\n cboPriority.setSelectedIndex(priority < 0 || priority > 5 ? 0 : priority);\n loadNotes();\n }" ]
[ "0.68342185", "0.63620484", "0.631992", "0.62986314", "0.6168679", "0.5969771", "0.5953243", "0.5836324", "0.5809637", "0.5799005", "0.5766754", "0.57650626", "0.575674", "0.5698205", "0.56220263", "0.5576227", "0.557526", "0.5568608", "0.55589235", "0.5551799", "0.55468893", "0.5520263", "0.55041474", "0.5499333", "0.54945415", "0.54927814", "0.5480973", "0.54784465", "0.54443264", "0.54013205", "0.54012966", "0.5390642", "0.5354727", "0.5354028", "0.53357893", "0.5303706", "0.5302365", "0.53015727", "0.52914846", "0.5264198", "0.5263948", "0.5256718", "0.5250958", "0.52243567", "0.52093714", "0.5207461", "0.5207108", "0.5204865", "0.5202996", "0.520197", "0.51991373", "0.5196706", "0.5194994", "0.5194746", "0.51933736", "0.5192152", "0.51856476", "0.5185181", "0.51847804", "0.518134", "0.5174357", "0.51619446", "0.51609755", "0.5160698", "0.5155712", "0.5154707", "0.5153398", "0.5152915", "0.5150864", "0.51508003", "0.5149864", "0.5143635", "0.5131369", "0.5129624", "0.51244557", "0.511712", "0.51165867", "0.51157576", "0.5112458", "0.51119727", "0.5104622", "0.5097261", "0.5095028", "0.5090481", "0.50871956", "0.50749534", "0.50736654", "0.50714713", "0.5071366", "0.50700206", "0.50688785", "0.5061117", "0.50604737", "0.5060345", "0.5058968", "0.5058968", "0.5057869", "0.5054491", "0.5053175", "0.5050812", "0.50435174" ]
0.0
-1
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); list1 = org.jdesktop.observablecollections.ObservableCollections.observableList(new LinkedList<neo.table.deskriptif>()); jScrollPane2 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); setLayout(new java.awt.GridLayout(2, 0)); jTable2.setAutoCreateRowSorter(true); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list1, jTable2); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${nameDesc}")); columnBinding.setColumnName("Name Desc"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${n}")); columnBinding.setColumnName("N"); columnBinding.setColumnClass(Long.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${min}")); columnBinding.setColumnName("Min"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${quartal1}")); columnBinding.setColumnName("Quartal1"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${quartal2}")); columnBinding.setColumnName("Quartal2"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${quartal3}")); columnBinding.setColumnName("Quartal3"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${max}")); columnBinding.setColumnName("Max"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${mean}")); columnBinding.setColumnName("Mean"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${modeValue}")); columnBinding.setColumnName("Mode"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${sum}")); columnBinding.setColumnName("Sum"); columnBinding.setColumnClass(Double.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${standardDeviation}")); columnBinding.setColumnName("Standard Deviation"); columnBinding.setColumnClass(Double.class); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane2.setViewportView(jTable2); if (jTable2.getColumnModel().getColumnCount() > 0) { jTable2.getColumnModel().getColumn(2).setResizable(false); jTable2.getColumnModel().getColumn(3).setResizable(false); } add(jScrollPane2); jTable1.setAutoCreateRowSorter(true); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jScrollPane1.setViewportView(jTable1); add(jScrollPane1); bindingGroup.bind(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Form() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public frmRectangulo() {\n initComponents();\n }", "public form() {\n initComponents();\n }", "public AdjointForm() {\n initComponents();\n setDefaultCloseOperation(HIDE_ON_CLOSE);\n }", "public FormListRemarking() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n \n }", "public FormPemilihan() {\n initComponents();\n }", "public GUIForm() { \n initComponents();\n }", "public FrameForm() {\n initComponents();\n }", "public TorneoForm() {\n initComponents();\n }", "public FormCompra() {\n initComponents();\n }", "public muveletek() {\n initComponents();\n }", "public Interfax_D() {\n initComponents();\n }", "public quanlixe_form() {\n initComponents();\n }", "public SettingsForm() {\n initComponents();\n }", "public RegistrationForm() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public Soru1() {\n initComponents();\n }", "public FMainForm() {\n initComponents();\n this.setResizable(false);\n setLocationRelativeTo(null);\n }", "public soal2GUI() {\n initComponents();\n }", "public EindopdrachtGUI() {\n initComponents();\n }", "public MechanicForm() {\n initComponents();\n }", "public AddDocumentLineForm(java.awt.Frame parent) {\n super(parent);\n initComponents();\n myInit();\n }", "public BloodDonationGUI() {\n initComponents();\n }", "public quotaGUI() {\n initComponents();\n }", "public Customer_Form() {\n initComponents();\n setSize(890,740);\n \n \n }", "public PatientUI() {\n initComponents();\n }", "public myForm() {\n\t\t\tinitComponents();\n\t\t}", "public Oddeven() {\n initComponents();\n }", "public intrebarea() {\n initComponents();\n }", "public Magasin() {\n initComponents();\n }", "public RadioUI()\n {\n initComponents();\n }", "public NewCustomerGUI() {\n initComponents();\n }", "public ZobrazUdalost() {\n initComponents();\n }", "public FormUtama() {\n initComponents();\n }", "public p0() {\n initComponents();\n }", "public INFORMACION() {\n initComponents();\n this.setLocationRelativeTo(null); \n }", "public ProgramForm() {\n setLookAndFeel();\n initComponents();\n }", "public AmountReleasedCommentsForm() {\r\n initComponents();\r\n }", "public form2() {\n initComponents();\n }", "public MainForm() {\n\t\tsuper(\"Hospital\", List.IMPLICIT);\n\n\t\tstartComponents();\n\t}", "public LixeiraForm() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public kunde() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n setRequestFocusEnabled(false);\n setVerifyInputWhenFocusTarget(false);\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 465, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 357, Short.MAX_VALUE)\n );\n }", "public MusteriEkle() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public DESHBORDPANAL() {\n initComponents();\n }", "public GUIForm() {\n initComponents();\n inputField.setText(NO_FILE_SELECTED);\n outputField.setText(NO_FILE_SELECTED);\n progressLabel.setBackground(INFO);\n progressLabel.setText(SELECT_FILE);\n }", "public frmVenda() {\n initComponents();\n }", "public Botonera() {\n initComponents();\n }", "public FrmMenu() {\n initComponents();\n }", "public OffertoryGUI() {\n initComponents();\n setTypes();\n }", "public JFFornecedores() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n setBackground(new java.awt.Color(255, 255, 255));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());\n getContentPane().setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 983, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 769, Short.MAX_VALUE)\n );\n\n pack();\n }", "public EnterDetailsGUI() {\n initComponents();\n }", "public vpemesanan1() {\n initComponents();\n }", "public Kost() {\n initComponents();\n }", "public FormHorarioSSE() {\n initComponents();\n }", "public UploadForm() {\n initComponents();\n }", "public frmacceso() {\n initComponents();\n }", "public HW3() {\n initComponents();\n }", "public Managing_Staff_Main_Form() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n getContentPane().setLayout(null);\n\n pack();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 300, Short.MAX_VALUE)\n );\n }", "public sinavlar2() {\n initComponents();\n }", "public P0405() {\n initComponents();\n }", "public IssueBookForm() {\n initComponents();\n }", "public MiFrame2() {\n initComponents();\n }", "public Choose1() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n\n String oldAuthor = prefs.get(\"AUTHOR\", \"\");\n if(oldAuthor != null) {\n this.authorTextField.setText(oldAuthor);\n }\n String oldBook = prefs.get(\"BOOK\", \"\");\n if(oldBook != null) {\n this.bookTextField.setText(oldBook);\n }\n String oldDisc = prefs.get(\"DISC\", \"\");\n if(oldDisc != null) {\n try {\n int oldDiscNum = Integer.parseInt(oldDisc);\n oldDiscNum++;\n this.discNumberTextField.setText(Integer.toString(oldDiscNum));\n } catch (Exception ex) {\n this.discNumberTextField.setText(oldDisc);\n }\n this.bookTextField.setText(oldBook);\n }\n\n\n }", "public GUI_StudentInfo() {\n initComponents();\n }", "public Lihat_Dokter_Keseluruhan() {\n initComponents();\n }", "public JFrmPrincipal() {\n initComponents();\n }", "public bt526() {\n initComponents();\n }", "public Pemilihan_Dokter() {\n initComponents();\n }", "public Ablak() {\n initComponents();\n }", "@Override\n\tprotected void initUi() {\n\t\t\n\t}", "@SuppressWarnings(\"unchecked\")\n\t// <editor-fold defaultstate=\"collapsed\" desc=\"Generated\n\t// Code\">//GEN-BEGIN:initComponents\n\tprivate void initComponents() {\n\n\t\tlabel1 = new java.awt.Label();\n\t\tlabel2 = new java.awt.Label();\n\t\tlabel3 = new java.awt.Label();\n\t\tlabel4 = new java.awt.Label();\n\t\tlabel5 = new java.awt.Label();\n\t\tlabel6 = new java.awt.Label();\n\t\tlabel7 = new java.awt.Label();\n\t\tlabel8 = new java.awt.Label();\n\t\tlabel9 = new java.awt.Label();\n\t\tlabel10 = new java.awt.Label();\n\t\ttextField1 = new java.awt.TextField();\n\t\ttextField2 = new java.awt.TextField();\n\t\tlabel14 = new java.awt.Label();\n\t\tlabel15 = new java.awt.Label();\n\t\tlabel16 = new java.awt.Label();\n\t\ttextField3 = new java.awt.TextField();\n\t\ttextField4 = new java.awt.TextField();\n\t\ttextField5 = new java.awt.TextField();\n\t\tlabel17 = new java.awt.Label();\n\t\tlabel18 = new java.awt.Label();\n\t\tlabel19 = new java.awt.Label();\n\t\tlabel20 = new java.awt.Label();\n\t\tlabel21 = new java.awt.Label();\n\t\tlabel22 = new java.awt.Label();\n\t\ttextField6 = new java.awt.TextField();\n\t\ttextField7 = new java.awt.TextField();\n\t\ttextField8 = new java.awt.TextField();\n\t\tlabel23 = new java.awt.Label();\n\t\ttextField9 = new java.awt.TextField();\n\t\ttextField10 = new java.awt.TextField();\n\t\ttextField11 = new java.awt.TextField();\n\t\ttextField12 = new java.awt.TextField();\n\t\tlabel24 = new java.awt.Label();\n\t\tlabel25 = new java.awt.Label();\n\t\tlabel26 = new java.awt.Label();\n\t\tlabel27 = new java.awt.Label();\n\t\tlabel28 = new java.awt.Label();\n\t\tlabel30 = new java.awt.Label();\n\t\tlabel31 = new java.awt.Label();\n\t\tlabel32 = new java.awt.Label();\n\t\tjButton1 = new javax.swing.JButton();\n\n\t\tlabel1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel1.setText(\"It seems that some of the buttons on the ATM machine are not working!\");\n\n\t\tlabel2.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel2.setText(\"Unfortunately these numbers are exactly what Professor has to use to type in his password.\");\n\n\t\tlabel3.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel3.setText(\n\t\t\t\t\"If you want to eat tonight, you have to help him out and construct the numbers of the password with the working buttons and math operators.\");\n\n\t\tlabel4.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tlabel4.setText(\"Denver's Password: 2792\");\n\n\t\tlabel5.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel5.setText(\"import java.util.Scanner;\\n\");\n\n\t\tlabel6.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel6.setText(\"public class ATM{\");\n\n\t\tlabel7.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel7.setText(\"public static void main(String[] args){\");\n\n\t\tlabel8.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel8.setText(\"System.out.print(\");\n\n\t\tlabel9.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel9.setText(\" -\");\n\n\t\tlabel10.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel10.setText(\");\");\n\n\t\ttextField1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\ttextField1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tlabel14.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel14.setText(\"System.out.print( (\");\n\n\t\tlabel15.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel15.setText(\"System.out.print(\");\n\n\t\tlabel16.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel16.setText(\"System.out.print( ( (\");\n\n\t\tlabel17.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel17.setText(\")\");\n\n\t\tlabel18.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel18.setText(\" +\");\n\n\t\tlabel19.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel19.setText(\");\");\n\n\t\tlabel20.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel20.setText(\" /\");\n\n\t\tlabel21.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel21.setText(\" %\");\n\n\t\tlabel22.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel22.setText(\" +\");\n\n\t\tlabel23.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel23.setText(\");\");\n\n\t\tlabel24.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel24.setText(\" +\");\n\n\t\tlabel25.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel25.setText(\" /\");\n\n\t\tlabel26.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel26.setText(\" *\");\n\n\t\tlabel27.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));\n\t\tlabel27.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel27.setText(\")\");\n\n\t\tlabel28.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel28.setText(\")\");\n\n\t\tlabel30.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel30.setText(\"}\");\n\n\t\tlabel31.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel31.setText(\"}\");\n\n\t\tlabel32.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel32.setText(\");\");\n\n\t\tjButton1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tjButton1.setText(\"Check\");\n\t\tjButton1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\tjButton1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tjavax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n\t\tlayout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(28).addGroup(layout\n\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING).addComponent(getDoneButton()).addComponent(jButton1)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, 774, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addGap(92).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15, GroupLayout.PREFERRED_SIZE, 145,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(2)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(37))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(174)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(7)))\n\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label23, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20).addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(23).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16, GroupLayout.PREFERRED_SIZE, 177,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));\n\t\tlayout.setVerticalGroup(\n\t\t\t\tlayout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap()\n\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup().addGroup(layout.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(19)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(78)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(76)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(75)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tShort.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(27))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel23,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(29)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))))\n\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t.addGap(30)\n\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(25)\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(26).addComponent(jButton1).addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(getDoneButton()).addContainerGap(23, Short.MAX_VALUE)));\n\t\tthis.setLayout(layout);\n\n\t\tlabel16.getAccessibleContext().setAccessibleName(\"System.out.print( ( (\");\n\t\tlabel17.getAccessibleContext().setAccessibleName(\"\");\n\t\tlabel18.getAccessibleContext().setAccessibleName(\" +\");\n\t}", "public Pregunta23() {\n initComponents();\n }", "public FormMenuUser() {\n super(\"Form Menu User\");\n initComponents();\n }", "public AvtekOkno() {\n initComponents();\n }", "public busdet() {\n initComponents();\n }", "public ViewPrescriptionForm() {\n initComponents();\n }", "public Ventaform() {\n initComponents();\n }", "public Kuis2() {\n initComponents();\n }", "public CreateAccount_GUI() {\n initComponents();\n }", "public POS1() {\n initComponents();\n }", "public Carrera() {\n initComponents();\n }", "public EqGUI() {\n initComponents();\n }", "public JFriau() {\n initComponents();\n this.setLocationRelativeTo(null);\n this.setTitle(\"BuNus - Budaya Nusantara\");\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setBackground(new java.awt.Color(204, 204, 204));\n setMinimumSize(new java.awt.Dimension(1, 1));\n setPreferredSize(new java.awt.Dimension(760, 402));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 750, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n }", "public nokno() {\n initComponents();\n }", "public dokter() {\n initComponents();\n }", "public ConverterGUI() {\n initComponents();\n }", "public hitungan() {\n initComponents();\n }", "public Modify() {\n initComponents();\n }", "public frmAddIncidencias() {\n initComponents();\n }", "public FP_Calculator_GUI() {\n initComponents();\n \n setVisible(true);\n }" ]
[ "0.73191476", "0.72906625", "0.72906625", "0.72906625", "0.72860986", "0.7248112", "0.7213479", "0.72078276", "0.7195841", "0.71899796", "0.71840525", "0.7158498", "0.71477973", "0.7092748", "0.70800966", "0.70558053", "0.69871384", "0.69773406", "0.69548076", "0.69533914", "0.6944929", "0.6942576", "0.69355655", "0.6931378", "0.6927896", "0.69248974", "0.6924723", "0.69116884", "0.6910487", "0.6892381", "0.68921053", "0.6890637", "0.68896896", "0.68881863", "0.68826133", "0.68815064", "0.6881078", "0.68771756", "0.6875212", "0.68744373", "0.68711984", "0.6858978", "0.68558776", "0.6855172", "0.6854685", "0.685434", "0.68525875", "0.6851834", "0.6851834", "0.684266", "0.6836586", "0.6836431", "0.6828333", "0.68276715", "0.68262815", "0.6823921", "0.682295", "0.68167603", "0.68164384", "0.6809564", "0.68086857", "0.6807804", "0.6807734", "0.68067646", "0.6802192", "0.67943805", "0.67934304", "0.6791657", "0.6789546", "0.6789006", "0.67878324", "0.67877173", "0.6781847", "0.6765398", "0.6765197", "0.6764246", "0.6756036", "0.6755023", "0.6751404", "0.67508715", "0.6743043", "0.67387456", "0.6736752", "0.67356426", "0.6732893", "0.6726715", "0.6726464", "0.67196447", "0.67157453", "0.6714399", "0.67140275", "0.6708251", "0.6707117", "0.670393", "0.6700697", "0.66995865", "0.66989213", "0.6697588", "0.66939527", "0.66908985", "0.668935" ]
0.0
-1
End of variables declaration//GENEND:variables
public void Reset() { this.list1.clear(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void lavar() {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}", "public void mo38117a() {\n }", "@Override\r\n\tpublic void initVariables() {\n\t\t\r\n\t}", "private void assignment() {\n\n\t\t\t}", "private void kk12() {\n\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "public void mo21779D() {\n }", "public final void mo51373a() {\n }", "protected boolean func_70041_e_() { return false; }", "public void mo4359a() {\n }", "public void mo21782G() {\n }", "private void m50366E() {\n }", "public void mo12930a() {\n }", "public void mo115190b() {\n }", "public void method_4270() {}", "public void mo1403c() {\n }", "public void mo3376r() {\n }", "public void mo3749d() {\n }", "public void mo21793R() {\n }", "protected boolean func_70814_o() { return true; }", "public void mo21787L() {\n }", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo21780E() {\n }", "public void mo21792Q() {\n }", "public void mo21791P() {\n }", "public void mo12628c() {\n }", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "public void mo97908d() {\n }", "public void mo21878t() {\n }", "public void mo9848a() {\n }", "public void mo21825b() {\n }", "public void mo23813b() {\n }", "public void mo3370l() {\n }", "public void mo21879u() {\n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "public void mo21785J() {\n }", "public void mo21795T() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void m23075a() {\n }", "public void mo21789N() {\n }", "@Override\n\tpublic void einkaufen() {\n\t}", "public void mo21794S() {\n }", "public final void mo12688e_() {\n }", "@Override\r\n\tvoid func04() {\n\t\t\r\n\t}", "private Rekenhulp()\n\t{\n\t}", "public void mo6944a() {\n }", "public static void listing5_14() {\n }", "public void mo1405e() {\n }", "public final void mo91715d() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "public void mo9137b() {\n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "public void func_70295_k_() {}", "void mo57277b();", "public void mo21877s() {\n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "public void Tyre() {\n\t\t\r\n\t}", "void berechneFlaeche() {\n\t}", "public void mo115188a() {\n }", "public void mo21880v() {\n }", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "public void mo21784I() {\n }", "private stendhal() {\n\t}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "public void mo56167c() {\n }", "public void mo44053a() {\n }", "public void mo21781F() {\n }", "public void mo2740a() {\n }", "public void mo21783H() {\n }", "public void mo1531a() {\n }", "double defendre();", "private zzfl$zzg$zzc() {\n void var3_1;\n void var2_-1;\n void var1_-1;\n this.value = var3_1;\n }", "public void stg() {\n\n\t}", "void m1864a() {\r\n }", "private void poetries() {\n\n\t}", "public void skystonePos4() {\n }", "public void mo2471e() {\n }", "@Override\n\tprotected void getExras() {\n\n\t}", "private void yy() {\n\n\t}", "@Override\n\tpublic void verkaufen() {\n\t}", "@AnyLogicInternalCodegenAPI\n private void setupPlainVariables_Main_xjal() {\n }", "static void feladat4() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "public void init() { \r\n\t\t// TODO Auto-generated method\r\n\t }", "public void furyo ()\t{\n }", "public void verliesLeven() {\r\n\t\t\r\n\t}", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "protected void mo6255a() {\n }" ]
[ "0.6359434", "0.6280371", "0.61868024", "0.6094568", "0.60925734", "0.6071678", "0.6052686", "0.60522056", "0.6003249", "0.59887564", "0.59705925", "0.59680873", "0.5967989", "0.5965816", "0.5962006", "0.5942372", "0.5909877", "0.5896588", "0.5891321", "0.5882983", "0.58814824", "0.5854075", "0.5851759", "0.58514243", "0.58418584", "0.58395296", "0.5835063", "0.582234", "0.58090156", "0.5802706", "0.5793836", "0.57862717", "0.5784062", "0.5783567", "0.5782131", "0.57758564", "0.5762871", "0.5759349", "0.5745087", "0.57427835", "0.573309", "0.573309", "0.573309", "0.573309", "0.573309", "0.573309", "0.573309", "0.57326084", "0.57301426", "0.57266665", "0.57229686", "0.57175463", "0.5705802", "0.5698347", "0.5697827", "0.569054", "0.5689405", "0.5686434", "0.56738997", "0.5662217", "0.56531453", "0.5645255", "0.5644223", "0.5642628", "0.5642476", "0.5640595", "0.56317437", "0.56294966", "0.56289655", "0.56220204", "0.56180173", "0.56134313", "0.5611337", "0.56112075", "0.56058615", "0.5604383", "0.5602629", "0.56002104", "0.5591573", "0.55856615", "0.5576992", "0.55707216", "0.5569681", "0.55570376", "0.55531484", "0.5551123", "0.5550893", "0.55482954", "0.5547471", "0.55469507", "0.5545719", "0.5543553", "0.55424106", "0.5542057", "0.55410767", "0.5537739", "0.55269134", "0.55236584", "0.55170715", "0.55035424", "0.55020875" ]
0.0
-1
it works on a principle of rotation , the outer loop will run the gcd of array length and number of rotation inner loop will run until every element in the set which is decided by gcd is placed in right location
private static void rotateArray(int[] arr, int gcd, int k) { // gcd is the set length for which the rotation will happen int len = arr.length; for (int i = 0; i < gcd; i++) { int temp = arr[i]; int j = i; int l = -1; while (true) { l = ((j + k) % len); if (l == i) { break; } arr[j] = arr[l]; j = l; } arr[j] = temp; } for (int i = 0; i < len; i++) { System.out.print(arr[i] + " "); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void solution() {\n for (int i = 0; i < n; i++) {\n Coord here = coords[i]; // start, end, dir, gen\n for (int j = 0; j < here.gen; j++) {\n // Rotate degree of 90.\n List<Pair> changed = rotate(here.coord, here.endPoint);\n boolean first = true;\n for(Pair p: changed){\n if(first) {\n here.endPoint = new Pair(p.x, p.y);\n first = false;\n }\n here.coord.add(new Pair(p.x, p.y));\n }\n }\n }\n // count the number of squares enclosing all angles with dragon curve\n for (int i = 0; i < n; i++) {\n for(Pair p: coords[i].coord)\n board[p.y][p.x] = true;\n }\n int cnt = 0;\n for (int i = 0; i < 100; i++)\n for (int j = 0; j < 100; j++)\n if(board[i][j] && board[i + 1][j] && board[i][j + 1] && board[i + 1][j + 1])\n cnt += 1;\n System.out.println(cnt);\n }", "public static void main (String[] args) \n { \n int arr[] = {1, 2, 3, 4, 5, 6, 7}; \n int n = arr.length; \n int d = 2; \n \n // in case the rotating factor is \n // greater than array length \n d = d % n; \n leftRotate(arr, 2, 7); // Rotate array by d \n printArray(arr); \n }", "private static int[] cycliRotation(int[] A, int K) {\n\t\tfor(int i = 0; i < K; i++)\n\t\t{\n\t\t\t//Variable\n\t\t\tint tempStorage = 0;\n\t\t\tint nextCounter = 1;\n\t\t\tint currentCounter = 0;\n\t\t\t\n\t\t\tfor(int j=0;j<A.length;j++)\n\t\t\t{\n\t\t\t\tif(nextCounter > A.length)\n\t\t\t\t{\n\t\t\t\t\ttempStorage = A[j];\n\t\t\t\t\t\n\t\t\t\t\tA[j] = A[currentCounter];\n\t\t\t\t\t\n\t\t\t\t\tA[currentCounter] = tempStorage;\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(j == A.length-1)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\ttempStorage = A[nextCounter]; // Move the next element to a temporary storage\n\t\t\t\t\t\n\t\t\t\t\tA[nextCounter] = A[currentCounter]; // Swap the position of the next element with the first\n\t\t\t\t\t\n\t\t\t\t\tA[currentCounter] = tempStorage;\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\tnextCounter++;\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn A;\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int T= sc.nextInt();\n for(int i=0;i<T; i++){\n System.out.println(\"Number of test cases are :\" + T);\n int size = sc.nextInt();\n System.out.println(size);\n System.out.println(\"Array size is \" + size);\n int[] arr = new int[size];\n for(int j=0;j<size;j++)\n {\n arr[j] = sc.nextInt();\n }\n System.out.println(\"Input array is :\");\n for(int k=0;k<size;k++)\n System.out.print(arr[k] + \" \");\n\n int rotation_size = sc.nextInt();\n System.out.println(rotation_size);\n System.out.println(rotateArray(arr,rotation_size,size-1));\n\n }\n\n }", "private void go(int i) {\n\t\tcol[i] = 1;\r\n\t\tint j = f[i];\r\n\t\tint cnt = 0;\r\n\t\tint delAll = 0;\r\n\t\tint[][] cd = new int[1000][3];\r\n\t\tint sa = 0;\r\n\t\tint sb = 0;\r\n\t\tint m1 = Integer.MAX_VALUE;\r\n\t\tint m2 = Integer.MAX_VALUE;\r\n\t\tint m1a = 0;\r\n\t\tint m2a = 0;\r\n\t\tint m1b = 0;\r\n\t\tint m2b = 0;\r\n\t\twhile (j != -1) {\r\n\t\t\tif (col[e[j]] == 0) {\r\n\t\t\t\tgo(e[j]);\r\n\t\t\t\tdelAll += a[e[j]];\r\n\t\t\t\tint dif = b[e[j]] - a[e[j]];\r\n\t\t\t\tif (dif < m1) {\r\n\t\t\t\t\tm2 = m1;\r\n\t\t\t\t\tm2b = m1b;\r\n\t\t\t\t\tm2a = m1a;\r\n\t\t\t\t\tm1 = dif;\r\n\t\t\t\t\tm1a = a[e[j]];\r\n\t\t\t\t\tm1b = b[e[j]];\r\n\t\t\t\t} else if (dif < m2) {\r\n\t\t\t\t\tm2 = dif;\r\n\t\t\t\t\tm2a = a[e[j]];\r\n\t\t\t\t\tm2b = b[e[j]];\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tsa += a[e[j]];\r\n\t\t\t\tsb += a[e[j]];\r\n\t\t\t\tcd[cnt][0] = a[e[j]];\r\n\t\t\t\tcd[cnt][1] = b[e[j]];\r\n\t\t\t\tcd[cnt][2] = b[e[j]] - a[e[j]];\r\n\t\t\t\tcnt++;\r\n\t\t\t}\r\n\t\t\tj = next[j];\r\n\t\t}\r\n\t\tif (cnt == 0) {\r\n\t\t\ta[i] = 1;\r\n\t\t\tb[i] = 0;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tArrays.sort(cd, new Comparator<int[]>() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic int compare(int[] o1, int[] o2) {\r\n\t\t\t\t// TODO Auto-generated method stub\t\t\t\t\r\n\t\t\t\treturn o1[2] - o2[2];\r\n\t\t\t}\r\n\t\t});\r\n\t\ta[i] = delAll + 1;\r\n\t\t//leave 0 or 2\r\n\t\tint cost1 = 0;\r\n\t\tint cost = 0;\r\n\t\tfor (j = 2; j < cnt; j++)\r\n\t\t\tcost1 += cd[j][0];\r\n\t\tif (cnt >= 2) {\r\n\t\t\tcost += m1b + m2b + sa - m1a - m2a;\r\n\t\t\tcost1 += cd[0][1] + cd[1][1];\r\n\t\t} else {\r\n\t\t\tcost += sa;\r\n\t\t\tcost1 += cd[0][0];\r\n\t\t}\r\n\t\tif (cost1 != cost)\r\n\t\t\tSystem.err.println(\"FUCK\");\r\n\t\tb[i] = cost;\r\n\t}", "static int[] circularArrayRotation(int[] a, int[] m) {\n k = a.length - (k % a.length);\n int first = 0;\n int runner = 0;\n int aux = a[first];\n\n for (int i = 0; i < a.length; i++) {\n if (adjInd(runner + k, a.length) == first) {\n a[runner] = aux;\n first = adjInd(++first, a.length);\n runner = first;\n aux = a[first];\n }\n else {\n a[runner] = a[adjInd(runner + k, a.length)];\n runner = adjInd(runner + k, a.length);\n }\n }\n\n int[] result = new int[m.length];\n for (int i = 0; i < m.length; i++) {\n result[i] = a[m[i]];\n }\n\n return result;\n }", "public static void main(String[] args) {\n Rotate rotate = new Rotate();\n /* int[] arr = new int[] {1,2,3,4,5,6,7};\n rotate.printArray(arr);\n System.out.println(\" \");*/\n /*rotate.rotateWithNewArray(arr, arr.length,3);\n System.out.println(\" \");\n rotate.rotateWithNewArrayBetter(arr, arr.length,3);\n System.out.println(\" \");\n int[] arr1 = new int[] {1,2,3,4,5,6,7};\n rotate.rotateLeftWithJugglingSolution(arr1, 3, 7);*/\n\n int[] arr2 = new int[] {1,2,3,4,5};\n rotate.printArray(arr2);\n System.out.println(\" \");\n rotate.rotateLeftWithReverse(arr2,5,2);\n }", "@Test\n public void testRotate90Degrees1(){\n double[][] a = new double[5][5];\n for(int i = 0 ; i < a.length ; i++){\n for(int j = 0 ; j < a[0].length ; j++){\n a[i][j] = Math.random();\n }\n }\n double[][] newA = HarderArrayProblems.rotateArray90(a);\n checkRotate(a, newA);\n }", "@Test\n public void testRotate90Degrees2(){\n double[][] a = new double[2][3];\n for(int i = 0 ; i < a.length ; i++){\n for(int j = 0 ; j < a[0].length ; j++){\n a[i][j] = Math.random();\n }\n }\n double[][] newA = HarderArrayProblems.rotateArray90(a);\n checkRotate(a, newA);\n }", "public static void main(String[] args) {\n // write your code here\n initialize();\n\n\n Sort(profile.getProfile());\n Integer[][][] mas = new Integer[11][11][1];\n\n R.add(Q.pollFirst());\n\n for (Integer[] e : Q) {\n if (DiskCover(e, R, Rant)) {\n R.add(e);\n // Rtmp.add(Q.pollFirst());\n }\n }\n\n FindMaxAngle(R, 0);\n\n Rg = R;\n //Rtmp-R add Q\n list_r.add(R);\n int j = 0;\n boolean flag = false;\n while (!Q.isEmpty()) {\n\n\n list_r.add(FindMaxPolygonCover(Rg));\n\n }\n\n MakePolygon(list_r);\n\n boolean work = true;\n\n do {\n R.clear();\n Gr.getEdge().clear();\n // algorithmConnectivity.setMarketVertexFirst();\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n\n AlgorithmConnectivity algorithmConnectivity = new AlgorithmConnectivity();\n algorithmConnectivity.initializated(Gr.getVertex().size());\n algorithmConnectivity.setMarketVertexFirst();\n algorithmConnectivity.setMarketVertexSecond(i);\n while (algorithmConnectivity.findSecond() != 100) {\n //int a= iterator.next();\n int index = algorithmConnectivity.findSecond();\n algorithmConnectivity.setMarketVertexThird(index);\n algorithmConnectivity = MakeConnection(index, algorithmConnectivity);\n }\n R.add(algorithmConnectivity.getMarket());\n }\n if (!checkConnectionGraf(R)) {\n //MakeConnection(Gr);\n ArrayList<Integer[]> result = new ArrayList<Integer[]>();\n ArrayList<Integer> ver = new ArrayList<Integer>();\n ArrayList<ArrayList<Integer>> v = new ArrayList<ArrayList<Integer>>();\n for (Integer[] p : R) {\n ArrayList<Integer> res = new ArrayList<Integer>();\n ver.clear();\n for (int i = 0; i < p.length; i++) {\n if (p[i] != 1) {\n ver.add(Gr.getVertex().get(i));\n }\n }\n if (ver.size() != 1) {\n // result.add(AddNewRoute(ver));\n // v.add(ver);\n result.addAll(AddNewRoute(ver));\n }\n }\n int minumum = 1000;\n Integer[] place = new Integer[3];\n for (int i = 0; i < result.size(); i++) {\n Integer[] ma = result.get(i);\n if (ma[2] == null) {\n System.out.print(\"\");\n }\n if ((minumum > ma[2]) && (ma[2]) != 0) {\n minumum = ma[2];\n place = ma;\n }\n }\n if (minumum == 1000) {\n for (Integer[] p : R) {\n ver.clear();\n for (int i = 0; i < p.length - 1; i++) {\n if (p[i] == 1) {\n ver.add(Gr.getVertex().get(i));\n }\n }\n result.addAll(AddNewRoute(ver));\n // result.add(AddNewRoute(ver));\n for (int i = 0; i < result.size(); i++) {\n Integer[] ma = result.get(i);\n if (ma[2] == null) {\n System.out.print(\"\");\n }\n if ((minumum > ma[2]) && (ma[2]) != 0) {\n minumum = ma[2];\n place = ma;\n }\n }\n AddNewVertex(place);\n }\n } else {\n AddNewVertex(place);\n }\n } else {\n work = false;\n }\n\n } while (work);\n\n MobileProfile prof = new MobileProfile();\n prof.initialization(Gr.getVertex().size());\n int sum = 0;\n int[][][] massive = profile.getProfile();\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n // sum=sum+massive;\n }\n\n\n zcd = new ZCD();\n\n zcd.setGraphR(Gr);\n\n Iterator<Edges> it = Gr.getEdgeses().iterator();\n boolean fla = false;\n while (it.hasNext()) {\n Edges d = it.next();\n LinkedList<Integer[]> graph_edges = g.getSort_index();\n\n for (int i = 0; i < graph_edges.size(); i++) {\n Integer[] mass = graph_edges.get(i);\n if (checkLine(g.getCoordinate().get(mass[0]), g.getCoordinate().get(mass[1]), Gr.getCoordinate().get(d.getX()), Gr.getCoordinate().get(d.getY()))) {\n if (!fla) {\n Integer[] wr = new Integer[3];\n wr[0] = d.getX();\n wr[1] = d.getY();\n wr[2] = mass[2];\n fla = true;\n zcd.addWrEdges(wr);\n }\n }\n }\n if (!fla) {\n\n Integer[] wr = new Integer[3];\n wr[0] = d.getX();\n wr[1] = d.getY();\n wr[2] = 2;\n\n zcd.addWrEdges(wr);\n\n }\n fla = false;\n }\n\n Edges e = null;\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n int sumwr = 0;\n HashSet<Edges> item = Gr.getEdgeses();\n Iterator<Edges> iterator = item.iterator();\n for (int k = 0; k < zcd.getWrEdges().size(); k++) {\n\n e = iterator.next();\n if (e.checkEdge(i)) {\n Integer[] m = zcd.getWrEdges().get(k);\n sumwr = sumwr + m[2];\n\n }\n\n }\n wr.add(sumwr);\n\n }\n\n int max = 0;\n int count = 0;\n for (int i = 0; i < wr.size(); i++) {\n if (max < wr.get(i)) {\n max = wr.get(i);\n count = i;\n }\n }\n Integer[] a = new Integer[2];\n a[0] = count;\n a[1] = max;\n zcd.setRoot_vertex(a);\n\n\n int number_vertex = 5;\n //ZTC ztc = new ZTC();\n neig = new int[Gr.getVertex().size()][Gr.getVertex().size()];\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n HashSet<Edges> item = Gr.getEdgeses();\n Iterator<Edges> iterator = item.iterator();\n while (iterator.hasNext()) {\n e = iterator.next();\n if (e.checkEdge(i)) {\n\n neig[i][e.getY()] = 1;\n }\n }\n }\n ztc.setNeigboor(neig);\n ztc.addTVertex(a[0]);\n Integer[] zero = new Integer[3];\n zero[0] = a[0];\n zero[1] = 0;\n zero[2] = 0;\n verLmtest.add(zero);\n vertex_be = new boolean[Gr.getVertex().size()];\n int root_number = 5;\n while (ztc.getTvertex().size() != Gr.getVertex().size()) {\n\n LinkedList<Edges> q = new LinkedList<Edges>();\n\n\n count_tree++;\n\n\n LinkedList<Integer> vertext_t = new LinkedList<Integer>(ztc.getTvertex());\n while (vertext_t.size() != 0) {\n // for(int i=0; i<count_tree;i++){\n\n number_vertex = vertext_t.pollFirst();\n weight_edges.clear();\n if (!vertex_be[number_vertex]) {\n vertex_be[number_vertex] = true;\n } else {\n continue;\n }\n\n // if(i<vertext_t.size())\n\n\n HashSet<Edges> item = Gr.getEdgeses();\n Iterator<Edges> iterator = item.iterator();\n // while (iterator.hasNext()) {\n for (int k = 0; k < item.size(); k++) {\n e = iterator.next();\n\n if (e.checkEdge(number_vertex)) {\n\n weight_edges.add(zcd.getWrEdges().get(k));\n q.add(e);\n }\n\n if (q.size() > 1)\n q = sort(weight_edges, q);\n\n\n while (!q.isEmpty()) {\n e = q.pollFirst();\n Integer[] lm = new Integer[3];\n\n\n lm[0] = e.getY();\n lm[1] = 1;\n lm[2] = 0;\n boolean add_flag = true;\n for (int i = 0; i < verLmtest.size(); i++) {\n Integer[] mess = verLmtest.get(i);\n if (e.getY() == mess[0]) {\n add_flag = false;\n }\n }\n if (add_flag) {\n for (int i = 0; i < verLmtest.size(); i++) {\n Integer[] mess = verLmtest.get(i);\n if (e.getX() == mess[0]) {\n mess[2] = mess[2] + 1;\n /* if (e.getX() == root_number) {\n mess[1] = 1;\n } else {\n mess[1] = mess[1] + 1;\n lm[1]=mess[1];\n\n }*/\n verLmtest.set(i, mess);\n break;\n }\n\n }\n for (int i = 0; i < verLmtest.size(); i++) {\n Integer[] mess = verLmtest.get(i);\n if (e.getX() == mess[0]) {\n lm[1] = mess[1] + 1;\n }\n\n }\n\n verLmtest.add(lm);\n } else {\n continue;\n }\n // }\n if (ztc.getTvertex().size() == 1) {\n edgesesTestHash.add(e);\n int x = e.getX();\n int y = e.getY();\n Edges e1 = new Edges(y, x);\n edgesesTestHash.add(e1);\n\n ztc.addEdges(e);\n ztc.addEdges(e1);\n\n ztc.addTVertex(lm[0]);\n // q.removeFirst();\n\n\n } else {\n // edgesTest.add(e);\n int x = e.getX();\n int y = e.getY();\n Edges e1 = new Edges(y, x);\n // disable.add(e);\n // disable.add(e1);\n\n edgesesTestHash.add(e1);\n edgesesTestHash.add(e);\n\n int[][] ad = getNeighboor();\n\n\n if (checkLegal(e, ad)) {\n ztc.addEdges(e);\n ztc.addEdges(e1);\n\n ztc.addTVertex(lm[0]);\n\n // if(q.size()!=0)\n // q.removeFirst();\n } else {\n // q.removeFirst();\n\n Iterator<Edges> edgesIterator = edgesesTestHash.iterator();\n while (edgesIterator.hasNext()) {\n Edges eo = edgesIterator.next();\n if ((eo.getY() == e.getY()) && (eo.getX() == e.getX())) {\n edgesIterator.remove();\n }\n if ((eo.getY() == e1.getY()) && (eo.getX() == e1.getX())) {\n edgesIterator.remove();\n }\n }\n\n verLmtest.removeLast();\n }\n\n\n }\n\n\n }\n\n\n }\n }\n }\n\n ztc.setEdgesesTree(edgesesTestHash);\n ztc.setGr(Gr);\n ConvertDataToJs convertDataToJs=new ConvertDataToJs();\n try {\n convertDataToJs.save(ztc);\n } catch (FileNotFoundException e1) {\n e1.printStackTrace();\n }\n\n System.out.print(\"\");\n\n }", "public int orangesRotting(int[][] grid) {\n /**\n 经典的bfs 队列模拟\n 要注意的是 记录层数即为times的消耗 用queue.size 来遍历 每次先记录queue的大小 若size减为0 则说明当前层遍历完\n\n 这题要注意几个corner case\n 1.有永远新鲜的水果 1的周围都是0\n 2.原本就没有水果 全是空格0\n\n **/\n int time=0;\n if(grid==null||grid.length==0)return 0;\n\n Queue<int[]> queue=new LinkedList<>();\n\n\n int flag=0;\n for(int i=0;i<grid.length;i++){\n for(int j=0;j<grid[0].length;j++){\n if(grid[i][j]==2)\n queue.add(new int[]{i,j});\n if(grid[i][j]==1)\n flag=1;\n }\n }\n if(queue.isEmpty()&&flag==0)return 0;\n\n int dir[][]={{0,1},{0,-1},{1,0},{-1,0}};\n\n\n\n while(!queue.isEmpty()){\n int size=queue.size();\n while(size>0){\n int[] cur=queue.poll();\n\n for(int i=0;i<4;i++){\n int x=cur[0]+dir[i][0];\n int y=cur[1]+dir[i][1];\n if(x<0||x>=grid.length||y<0||y>=grid[0].length)continue;\n if(grid[x][y]==1){\n grid[x][y]=2;\n queue.add(new int[]{x,y});\n }\n\n }\n size--;\n }\n\n time++;\n\n }\n\n for(int i=0;i<grid.length;i++){\n for(int j=0;j<grid[0].length;j++){\n if(grid[i][j]==1)\n return -1;\n }\n }\n\n\n return time-1;\n }", "public void sort() {\r\n int k = start;\r\n for (int i = 0; i < size - 1; i++) {\r\n int p = (k + 1) % cir.length;\r\n for (int j = i + 1; j < size; j++) {\r\n if ((int) cir[p] < (int) cir[k % cir.length]) {\r\n Object temp = cir[k];\r\n cir[k] = cir[p];\r\n cir[p] = temp;\r\n }\r\n p = (p + 1) % cir.length;\r\n }\r\n k = (k + 1) % cir.length;\r\n }\r\n }", "private static void rotate(int[][] a, start, end){\n for (int current = 0; start+current < end; current++){\n int temp = a[start][start+current]; // save the top \n a[start][start+current] = a[end-current][start]; // left to top moveing left elemnt to top\n a[end-current][start] = a[end][end-current]; // bottom element to left \n a[end][end-current] = a[start+current][end]; // right element to bottom \n a[start+current][end] = temp; // top elemrnt to right\n }\n}", "private void fillRots() {\n for (int joint=0;joint<numObjects;joint++){\n // 1) Find first non-null rotation of joint <code>joint</code>\n int start;\n for (start=0;start<keyframes.size();start++){\n if (((PointInTime)keyframes.get(start)).usedRot.get(joint)) break;\n }\n if (start==keyframes.size()){ // if they are all null then fill with identity\n for (int i=0;i<keyframes.size();i++)\n ((PointInTime)keyframes.get(i)).look[joint].setRotationQuaternion(new Quaternion());\n continue; // we're done so lets break\n }\n if (start!=0){ // if there -are- null elements at the begining, then fill with first non-null\n \n ((PointInTime)keyframes.get(start)).look[joint].getRotation(unSyncbeginRot);\n for (int i=0;i<start;i++)\n ((PointInTime)keyframes.get(i)).look[joint].setRotationQuaternion(unSyncbeginRot);\n }\n int lastgood=start;\n for (int i=start+1;i<keyframes.size();i++){\n if (((PointInTime)keyframes.get(i)).usedRot.get(joint)){\n fillQuats(joint,lastgood,i); // fills gaps\n lastgood=i;\n }\n }\n // fillQuats(joint,lastgood,keyframes.size()-1); // fills tail\n ((PointInTime)keyframes.get(lastgood)).look[joint].getRotation(unSyncbeginRot);\n \n for (int i=lastgood+1;i<keyframes.size();i++){\n ((PointInTime)keyframes.get(i)).look[joint].setRotationQuaternion(unSyncbeginRot);\n }\n }\n }", "public static void permute()\n\t{\n\t\t/* INITIALIZE FOR PERMUTATION TESTING */\n\t\t//int l, r, s, T, K;\n\t\t//Random random = new Random();\n\t\tRandom random = new Random(13);\n\n\t\tclade = clad[k];\n\t\tclade.chiPvalue = 0;\n\n\t\tfor(int l = 0; l < 2; l++)\n\t\t{\n\t\t\tclade.ITcPvalue[l] = 0;\n\t\t\tclade.ITnPvalue[l] = 0;\n\t\t\tclade.corrDcWPvalue[l] = 0;\n\t\t\tclade.corrDnWPvalue[l] = 0;\n\t\t \n\t\t for(i = 0; i < clade.numSubClades; i++)\n\t\t\t{\n\t\t\t\tclade.DcPvalue[i][l] = 0;\n\t\t\t\tclade.DnPvalue[i][l] = 0;\n\t\t\t}\n\t\t}\n\n\n\t/*\n\t\tfprintf(stderr, \"\\n\\n\"); \n\t\tfor (i=0; i<numSubClades; i++)\n\t\tfprintf(stderr,\" rowTotal(%d):%d \", i, rowTotal[i]);\n\t\tfprintf(stderr, \"\\n\"); \n\t\tfor (j=0; j<numCladeLocations; j++)\n\t\tfprintf(stderr,\" columnTotal(%d):%d \", j, columnTotal[j]);\n\t\tfprintf(stderr, \"\\n\\n\");\n\t\t\n\t\tfprintf(stderr,\"\\n\\n Permuting %s\", title);\n\t\tfprintf(stderr,\"\\n 0 %d permutations\\n \",numPermutations);\n*/\t\t\n\t\tfor (int K = 0; K < GeoDis.numPermutations; K++)\n\t\t{\t\n\t\t\t\t\n\t\t\tprogress++;\n\t\t\tpercentage = ((double)progress * 100)/((double)numPermutations*(double)numClades); \n\t\n\t\t\trandObsChi = 0;\n\n\t\t\tfor(int l = 0; l < clade.totaNumObs; l++)\n\t\t\t\tclade.RBMatrix[l][0] = random.nextInt(); /* 0 - 32767\t*/\t\n\t\t\t \n\t\t\tclade.cumColTotal = 0; /* cumColTotal is the cumulative column total */\n\n\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t{\t\n\t\t\t\tif (j == 0)\n\t\t\t\t\tclade.cumColTotal = 0;\n\t\t\t\telse\t\t\t\t\n\t\t\t\tclade.cumColTotal = clade.cumColTotal + clade.columnTotal[j-1];\n\t\t\t\t\n\t\t\t\tfor (int s = 0; s < clade.columnTotal[j]; s++)\n\t\t\t\t{\n\t\t\t\t\tint l = s + clade.cumColTotal;\n\t\t\t\t\tclade.RBMatrix[l][1] = j+1;\n\t\t\t\t}\n\t\t\t}\n\t\t/*for (l=0; l<totaNumObs; l++)\n\t\t\t\tfprintf(stderr,\"\\nB: %6d %d\", RBMatrix[l][0], RBMatrix[l][1]);*/\n\n\n\n\t\t\t/* * * ORDER BY RANDOM NUMBERS * * */\n\t\t\tfor(int l = 0; l < (clade.totaNumObs - 1); l++)\n\t\t\t{\t\n\t\t\t\tfor(int r = l +1; r < clade.totaNumObs; r++)\n\t\t\t \t{\t\t\t\n\t\t\t\t\tif(clade.RBMatrix[r][0] < clade.RBMatrix[l][0])\n\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t\t\n\t\t\t\t\t//else\n\t\t\t\t\t{\t\n\t\t\t\t\t\tint T = clade.RBMatrix[r][0];\n\t\t\t\t\t\tclade.RBMatrix[r][0] = clade.RBMatrix[l][0];\n\t\t\t\t\t\tclade.RBMatrix[l][0] = T;\n\t\t\t\t\t\tT = clade.RBMatrix[r][1];\n\t\t\t\t\t\tclade.RBMatrix[r][1] = clade.RBMatrix[l][1];\n\t\t\t\t\t\tclade.RBMatrix[l][1] = T;\n\t\t\t \t\t}\n\t\t\t \t}\n\t\t \t}\n\t/*for (l=0; l<totaNumObs; l++)\n\t\t\tfprintf(stderr,\"\\nAfter: %6d %d\", RBMatrix[l][0], RBMatrix[l][1]);*/\n\n\n\t\t\t/* * * CALCULATE RANDOM OBSERVATIONS * * */\n\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t\t\tclade.randMatrix[i][j] = 0;\n\n\t\t\t \n\t\t\tclade.cumRowTotal = 0; /* cumulative row totals */\n\t\t\t\t\n\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t{\n\t\t\t\tif (i == 0)\n\t\t\t\tclade.cumRowTotal = 0;\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\tclade.cumRowTotal += clade.rowTotal[i-1];\t\n\t\t\t\t\n\t\t\t\t/*fprintf(stderr, \"\\n\\nRow %d: rowTotal[i]:%d\",i, rowTotal[i]); */\n\t\t\t\t\n\t\t\t\tfor(int s = 0; s < clade.rowTotal[i]; s++)\n\t\t\t\t{\n\t\t\t\t\tint l = s + clade.cumRowTotal;\n\t\t\t\t\tindex = clade.RBMatrix[l][1]-1;\n\t\t\t\t\t/*fprintf(stderr, \"rowTotal= %d index=%d s=%d \",rowTotal[i], index, s); */\n\t\t\t\t\tclade.randMatrix[i][index]++;\n\t\t\t\t}\n\t\t\t}\n\n\n\n\n\t\t/* prints the randomized table of contingency\n\t\t\t\tfor(i = 0; i < numSubClades; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tfprintf(stderr, \"\\n\");\n\t\t\t\t\t\tfor(j = 0; j < numCladeLocations; j++)\n\t\t\t\t\t\t\tfprintf(stderr, \"%d \", randMatrix[i][j]);\n\t\t\t\t\t}\n\t\t*/\t\t\n\n\n\t\t\t/* * CALCULATE RANDOM CHI - SQUARE STATISTIC * */\n\t\t\trandObsChi = 0;\n\t\t\n\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t\t\trandObsChi += Math.pow( (double) clade.randMatrix[i][j] - clade.expObsMatrix[i][j], 2) / clade.expObsMatrix[i][j];\n\t\t\t\t\t\n\t\t\t/*fprintf(fpout,\"\\n%f \", randObsChi);\t\t*/\n\t\t\t\t\t\n\t\t\tif(randObsChi - clade.obsChi >= ROUNDING_ERROR)\n\t\t\t\tclade.chiPvalue++;\n\n\n\t\t\tif (doingDistances)\n\t\t\t{\n\t\t\t\tfor(c=0; c<clade.numSubClades; c++)\n\t\t\t\t{\n\t\t\t\t\tclade.randDc[c]=0.0;\n\t\t\t\t\tclade.randDn[c]=0.0;\n\t\t\t\t\t//clade.varDc[c]=0;\n\t\t\t\t\t//clade.varDn[c]=0;\n\t\t\t\t\tsum1 = sum2 = sum3 = 0.0;\n\t\t\t\t\tsumc1 = sumc2 = sumc3 = 0.0;\n\n\t\t\t\t\tfor(i=0; i<clade.numCladeLocations; i++) \t\n\t\t\t\t\t{\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tsum2 += clade.randMatrix[c][i] * (clade.randMatrix[c][i]-1) / 2 ;\n\t\t\t\t\t\tsumc2 += (clade.randMatrix[c][i] * (clade.randMatrix[c][i]-1) / 2) + \n\t\t\t\t\t (clade.randMatrix[c][i] * (clade.columnTotal[i] - clade.randMatrix[c][i]));\t\n\t\t\t\t\t\n\t\t\t\t\t\tfor (j=0; j<clade.numCladeLocations; j++)\n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\tpopA = clade.cladeLocIndex[i];\n\t\t\t\t\t\t\tpopB = clade.cladeLocIndex[j];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (j != i)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tsum1 += (double) clade.randMatrix[c][i] * clade.randMatrix[c][j] * distance[popA-1][popB-1];\n\t\t\t\t\t\t\t\tsum3 += clade.randMatrix[c][i] * clade.randMatrix[c][j];\t\t\t\n\t\t\t\t\t\t\t\tsumc1 += (double) clade.randMatrix[c][i] * clade.columnTotal[j] * distance[popA-1][popB-1];\t\n\t\t\t\t\t\t\t\tsumc3 += clade.randMatrix[c][i] * clade.columnTotal[j];\n\t\t\t\t\t\t\t\t//System.err.println(\"\\npopA = \" + popA + \" popB = \" + popB + \" dist= \" + distance[popA-1][popB-1]);\n\t\t\t\t\t\t\t\t//System.err.println(\"sumc1: \" + clade.randMatrix[c][i] + \" * \" + clade.columnTotal[j] +\" * \" + distance[popA-1][popB-1] + \" = \" + sumc1); \n\t\t\t\t\t\t\t\t//System.err.println(\"\\nROBS[\" + c +\"][\" + i+ \"]= \" + clade.randMatrix[c][i]); \n\t\t\t\t\t\t\t\t//System.err.println(\"\\nCT[\" + j +\"]= \" + clade.columnTotal[j]); \n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\n\t\t\t\t\t\t//System.err.println(\"\\nOBS[\" + c +\"][\" + i+ \"]= \" + clade.obsMatrix[c][i]); \n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif (sum3 == 0)\n\t\t\t\t\t\tclade.randDc[c] = 0;\n\t\t\t\t\telse\n\t\t\t\t\t\tclade.randDc[c] = sum1 / (sum2 + sum3);\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\tif (sumc3 == 0)\n\t\t\t\t\t\tclade.randDn[c] = 0;\n\t\t\t\t\telse\n\t\t\t\t\t\tclade.randDn[c] = sumc1 / (sumc2 + sumc3);\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t//System.err.println(\"\\nClade \" + clade.cladeName + \" subclade \" + c + \n\t // \" Dc= \" + clade.Dc[c] + \" Dn= \" + clade.Dn[c]); \t\t\n\t\t\n\t\t\t\t\t//System.err.println(\"sum1= \" + sum1 + \" sum2= \" + sum2 + \" sum3= \" + sum3); \n\t\t\t\t\t//System.err.println(\"sumc1= \" + sumc1 + \" sumc2= \" + sumc2 + \" sumc3= \" + sumc3); \n\n\n\t\t\t\t\tif(clade.Dc[c] - clade.randDc[c] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DcPvalue[c][0]++;\n\n\t\t\t\t\tif(clade.randDc[c] - clade.Dc[c] >= ROUNDING_ERROR )\n\t\t\t\t\t\tclade.DcPvalue[c][1]++;\n\n\t\t\t\t\tif(clade.Dn[c] - clade.randDn[c] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DnPvalue[c][0]++;\n\n\t\t\t\t\tif(clade.randDn[c] - clade.Dn[c] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DnPvalue[c][1]++;\n\n\n\t\t\t\n\t\t\t\t}\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\t/* * CALCULATE DISTANCE TEST STATISTIC * */\n\n\t\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t\t{\n\t\t\t\t\tclade.randMeanLatitude[i] = 0;\n\t\t\t\t\tclade.randMeanLongitude[i] = 0;\n\t\t\t\t\tclade.randDc[i] = 0;\n\t\t\t\t\tclade.randDn[i] = 0;\n\t\t\t\t\tclade.subCladeSum[i] = 0;\n\t\t\t\t\n\t\t\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tindex = clade.cladeLocIndex[j] - 1;\n\t\t\t\t\t\tclade.absFreq[i][j] = (double) clade.randMatrix[i][j] / (double) sampleSize[index];\t\t\n\t\t\t\t\t\tclade.subCladeSum[i] = clade.subCladeSum[i] + clade.absFreq[i][j];\n\t\t\t\t\t}\t\n\n\t\t\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t\t\t\tclade.relFreq[i][j] = clade.absFreq[i][j]/clade.subCladeSum[i];\n\t\t\t\t}\n\t\t/*\t\t\n\t\t\t\tfor(i = 0; i < numSubClades; i++)\n\t\t\t\t{\n\t\t\t\t\tfprintf(stderr,\"\\n\");\n\t\t\t\t\tfor(j = 0; j < numCladeLocations; j++)\n\t\t\t\t\t\tfprintf(stderr,\"Asim: %f \", relFreq[i][j]);\n\t\t\t\t}\n\t\t*/\n\t\t\t\t\n\t\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t\t{\t\n\t\t\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tindex = clade.cladeLocIndex[j]-1;\n\t\t\t\t\t\tclade.randMeanLatitude[i] = clade.randMeanLatitude[i] + clade.relFreq[i][j] * Latitude[index];\n\t\t\t\t\t\tclade.randMeanLongitude[i] = clade.randMeanLongitude[i] + clade.relFreq[i][j] * Longitude[index];\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfor(j = 0; j < clade.numCladeLocations; j++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (clade.relFreq[i][j] == 0)\n\t\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t\tindex = clade.cladeLocIndex[j] - 1;\n\t\t\t\t\t\tif (Latitude[index] == clade.randMeanLatitude[i] && Longitude[index] == clade.randMeanLongitude[i]) \n\t\t\t\t\t\t\tZ = 1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tZ = Math.sin(Latitude[index]) * Math.sin(clade.randMeanLatitude[i]) + Math.cos(Latitude[index]) * \n\t\t\t\t\t\t\tMath.cos(clade.randMeanLatitude[i]) * Math.cos(clade.randMeanLongitude[i] - Longitude[index]);\n\t\t\t\t\t\n\t\t\t\t\t\tif (Math.abs(Z) < 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tRVZ = RADIUS * Math.acos (Z); \n\t\t\t\t\t\t\tclade.randDc[i] += clade.relFreq[i][j] * RVZ;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (Latitude[index] == clade.meanLatNest && Longitude[index] == clade.meanLonNest) \n\t\t\t\t\t\t\tZB = 1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tZB = Math.sin(Latitude[index]) * Math.sin(clade.meanLatNest) + Math.cos(Latitude[index]) * \n\t\t\t\t\t\t\tMath.cos(clade.meanLatNest) * Math.cos(clade.meanLonNest - Longitude[index]);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (Math.abs(ZB) < 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tRVZ = RADIUS * Math.acos (ZB);\n\t\t\t\t\t\t\tclade.randDn[i] += clade.relFreq[i][j] * RVZ;\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(clade.Dc[i] - clade.randDc[i] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DcPvalue[i][0]++;\n\n\t\t\t\t\tif(clade.randDc[i] - clade.Dc[i] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DcPvalue[i][1]++;\n\n\t\t\t\t\tif(clade.Dn[i] - clade.randDn[i] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DnPvalue[i][0]++;\n\n\t\t\t\t\tif(clade.randDn[i] - clade.Dn[i] >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.DnPvalue[i][1]++;\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t/* * TEST STATISTICS FOR POSITION VS. INTERIOR * */\n\n\t\t\trandTipDistance = 0;\n\t\t\trandIntDistance = 0;\n\t\t\trandTipDisNested = 0;\n\t\t\trandIntDisNested = 0;\n\t\t\t\n\t\t\tif(clade.check != (double) clade.numSubClades && clade.check != 0)\n\t\t\t{\t\n\t\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t\t{\n\t\t\t\t\trandTipDistance += clade.Position[i] * clade.randDc[i] * (double) clade.rowTotal[i] / (double) clade.indTipClades;\n\t\t\t\t\trandTipDisNested += clade.Position[i] * clade.randDn[i] * (double) clade.rowTotal[i] / (double) clade.indTipClades;\n\t\t\t\t\trandIntDistance += (1 - clade.Position[i]) * clade.randDc[i] * (double) clade.rowTotal[i] / (double) clade.indIntClades;\n\t\t\t\t\trandIntDisNested += (1 - clade.Position[i]) * clade.randDn[i] * (double) clade.rowTotal[i] / (double) clade.indIntClades;\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\tif(clade.tipIntDistance - (randIntDistance - randTipDistance) >= ROUNDING_ERROR)\n\t\t\t\t\tclade.ITcPvalue[0]++;\n\n\t\t\t\tif((randIntDistance - randTipDistance) - clade.tipIntDistance >= ROUNDING_ERROR)\n\t\t\t\t \tclade.ITcPvalue[1]++;\n\n\t\t\t\tif(clade.tipIntDisNested - (randIntDisNested - randTipDisNested) >= ROUNDING_ERROR)\n\t\t\t\t\tclade.ITnPvalue[0]++;\n\t\t\t\t\n\t\t\t\tif((randIntDisNested - randTipDisNested) - clade.tipIntDisNested >= ROUNDING_ERROR)\n\t\t\t\t\tclade.ITnPvalue[1]++;\n\t\t\t\t\n\t\t\t}\n\n\t\t\tif(!weights){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t//{\n\t\t\t\t/* * CORRELATION TESTS OF DISTANCE WITH OUTGROUP WEIGHTS * */\n\n\t\t\t\t //double c, n, w;\n\t\t\t\t \n\t\t\t\t clade.meanDc = 0;\n\t\t\t\t clade.meanDn = 0;\n\t\t\t\t clade.sumDcxWeight = 0;\n\t\t\t\t clade.sumDnxWeight = 0;\n\t\t\t\t clade.sumDcSq = 0;\n\t\t\t\t clade.sumDnSq = 0;\n\n\t\t\t\tfor(i = 0; i < clade.numSubClades; i++)\n\t\t\t\t\t{\n\t\t\t\t \tclade.meanDc += clade.randDc[i] / (double) clade.numSubClades;\n\t\t\t\t \tclade.meanDn += clade.randDn[i] / (double) clade.numSubClades;\n\t\t\t\t \tclade.sumDcxWeight += clade.randDc[i] * clade.weight[i];\n\t\t\t\t \tclade.sumDnxWeight += clade.randDn[i] * clade.weight[i];\n\t\t\t\t \tclade.sumDcSq += Math.pow(clade.randDc[i],2); \n\t\t\t\t \tclade.sumDnSq += Math.pow(clade.randDn[i],2);\n\t\t\t\t\t}\n\t\t\t\t\n\t \t\tdouble c = clade.sumDcSq - (double) clade.numSubClades * Math.pow(clade.meanDc,2);\n\t \t\tdouble n = clade.sumDnSq - (double) clade.numSubClades * Math.pow(clade.meanDn,2);\n\t \t\t\tdouble w = clade.sumWeightSq - (double) clade.numSubClades * Math.pow(clade.meanWeight,2); \n\n\t\t\t\tif (clade.corrDcWeights != NA && c > 0 && w > 0)\n\t\t\t\t\t//;\n\t\t\t\t//else\n\t\t\t\t \t{\n\t\t\t\t \tclade.randCorrDcWeights = (clade.sumDcxWeight - (double) clade.numSubClades * clade.meanDc * clade.meanWeight)/ \n\t\t\t\t \t(Math.sqrt(c*w));\n\n\t\t\t\t\tif(clade.randCorrDcWeights > 1)\n\t\t\t\t\t\t\tclade.randCorrDnWeights = 1;\n\t\t\t\t\t\n\t\t\t\t\tif(clade.randCorrDcWeights < -1)\n\t\t\t \t\tclade.randCorrDcWeights = -1;\n\t\t\t\t\n\t\t\t\t\tif(clade.corrDcWeights - clade.randCorrDcWeights >= ROUNDING_ERROR)\n\t\t\t\t \t\tclade.corrDcWPvalue[0]++;\n\t\t\t\t\t \n\t\t\t\t\tif(clade.randCorrDcWeights - clade.corrDcWeights >= ROUNDING_ERROR)\n\t\t\t\t \tclade.corrDcWPvalue[1]++;\n\t\t\t\t\t}\n\n\n\t\t\t\tif (clade.corrDnWeights == NA || n <= 0 || w <= 0)\n\t\t\t\t\tcontinue;\t\t\n\t\t\t\t//else\n\t\t\t\t\t//{\n\t\t\t\t \tclade.randCorrDnWeights = (clade.sumDnxWeight - (double) clade.numSubClades * clade.meanDn * clade.meanWeight)/ \n\t\t\t\t \t(Math.sqrt(n*w));\n\t\t\t\t\n\t\t\t\t\tif(clade.randCorrDnWeights > 1)\n\t\t\t\t\t\tclade.randCorrDnWeights = 1;\n\n\t\t\t\t\tif(clade.randCorrDnWeights < -1)\n\t\t\t\t\t\tclade.randCorrDnWeights = -1;\n\n\t\t\t\t\tif(clade.corrDnWeights - clade.randCorrDnWeights >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.corrDnWPvalue[0]++;\n\n\t\t\t\t\tif(clade.randCorrDnWeights - clade.corrDnWeights >= ROUNDING_ERROR)\n\t\t\t\t\t\tclade.corrDnWPvalue[1]++;\n\t\t\t\t\t//}\n\t\t\t\t//}\n\t} // end of 1 replicate\n\n\n\t\tclade.chiPvalue /= (double) GeoDis.numPermutations;\n\n\t\tfor(int l = 0; l < 2; l++)\n\t\t{\n\t\t\tclade.ITcPvalue[l] /= (double) GeoDis.numPermutations;\n\t\t\tclade.ITnPvalue[l] /= (double) GeoDis.numPermutations;\n\t\t\tclade.corrDcWPvalue[l] /= (double) GeoDis.numPermutations;\n\t\t\tclade.corrDnWPvalue[l] /= (double) GeoDis.numPermutations;\n\n\t\t\tfor (i =0; i < clade.numSubClades; i++)\n\t\t\t{\n\t\t\t clade.DcPvalue[i][l] /= (double) GeoDis.numPermutations;\n\t\t\t clade.DnPvalue[i][l] /= (double) GeoDis.numPermutations;\n\t\t\t}\n\t\t}\n\n\t}", "public static boolean checkPath(int[][] bs, int i) {\n ArrayList<Integer> temp_cP = new ArrayList<Integer>();\r\n Set<Integer> temp_setcP = new HashSet<Integer>();\r\n boolean denoter = true;\r\n while (i == 3) {\r\n for (int k = 0; k < i; k++) {\r\n for (int e = 0; e < 3; e++) {\r\n temp_cP.add(e, bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n temp_cP.clear();\r\n temp_setcP.clear();\r\n\r\n for (int k = 0; k < i; k++) {\r\n for (int e = 3; e < 6; e++) {\r\n temp_cP.add(bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n while (i == 6) {\r\n\r\n for (int k = 3; k < i; k++) {\r\n for (int e = 0; e < 3; e++) {\r\n temp_cP.add(e, bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n temp_cP.clear();\r\n temp_setcP.clear();\r\n\r\n for (int k = 3; k < i; k++) {\r\n for (int e = 3; e < 6; e++) {\r\n temp_cP.add(bs[k][e]);\r\n }\r\n }\r\n temp_setcP = new HashSet<Integer>(temp_cP);\r\n if (temp_cP.size() > temp_setcP.size()) {\r\n denoter = false;\r\n break;\r\n\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n }\r\n return denoter;\r\n }", "@Test\n public void testRecoverRotatedSortedArray() {\n System.out.println(\"recoverRotatedSortedArray\");\n ArrayList<Integer> nums = null;\n RecoverRotatedSortedArray instance = new RecoverRotatedSortedArray();\n instance.recoverRotatedSortedArray(nums);\n \n ArrayList<Integer> nums2 = new ArrayList<Integer>();\n nums2.add(4);\n nums2.add(5);\n nums2.add(1);\n nums2.add(2);\n nums2.add(3);\n instance.recoverRotatedSortedArray(nums2);\n assertEquals(1, (long)nums2.get(0));\n assertEquals(2, (long)nums2.get(1));\n assertEquals(3, (long)nums2.get(2));\n assertEquals(4, (long)nums2.get(3));\n assertEquals(5, (long)nums2.get(4));\n \n ArrayList<Integer> nums3 = new ArrayList<Integer>();\n for (int i = 0; i < 9; i++) {\n nums3.add(1);\n }\n nums3.add(-1);\n for (int i = 0; i < 11; i++) {\n nums3.add(1);\n }\n instance.recoverRotatedSortedArray(nums3);\n assertEquals(-1, (long)nums3.get(0));\n assertEquals(1, (long)nums3.get(1));\n assertEquals(1, (long)nums3.get(2));\n assertEquals(1, (long)nums3.get(9));\n }", "public void rotateold2(int[] a, int k) {\n\n\t\tif (a == null || a.length == 0)\n\t\t\treturn;\n\n\t\tint jump = 0, len = a.length, cur = a[0], next, count = 0;\n\n\t\tk %= len; \n\t\tif (k == 0) return;\n\n\t\tif (len % k != 0 || k == 1)\n\t\t{ \n\t\t\tint i = 0;\n\t\t\twhile (i < len)\n\t\t\t{\n\t\t\t\tjump = (jump + k) % len;\n\t\t\t\tnext = a[jump];\n\t\t\t\ta[jump] = cur;\n\t\t\t\tcur = next;\n\t\t\t\ti++;\n\t\t\t} \n\t\t} \n\t\telse\n\t\t{\n\t\t\tfor (int i = 0; i <= len/k; i ++)\n\t\t\t{\n\t\t\t\tint start = 0;\n\t\t\t\tjump = i;\n\t\t\t\tnext = a[jump];\n\t\t\t\tcur = a[i];\n\t\t\t\twhile (start <= len/k)\n\t\t\t\t{\n\t\t\t\t\tjump = (jump + k) % len;\n\t\t\t\t\tnext = a[jump];\n\t\t\t\t\ta[jump] = cur;\n\t\t\t\t\tcur = next;\n\t\t\t\t\tstart++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) {\n // put your code here\n Scanner readIn = new Scanner(System.in);\n String[] arrayOfValues = readIn.nextLine().split(\" \");\n int rotate = readIn.nextInt();\n int length = arrayOfValues.length;\n int newIndex = 0; //the next index to place the values in\n int count = 0; //used to count the\n int runCount = 0; //loop the array length times to get all values swapped.\n\n //Store the start value which is the value at index 0\n String tempA = arrayOfValues[count];\n //run the loop length - 1 times\n while (runCount++ < length) {\n newIndex = (newIndex + rotate) % length; //Circular Buffer type\n String tempB = arrayOfValues[newIndex]; //Keep a copy of the old value\n arrayOfValues[newIndex] = tempA; //replace the new Index with the the previous value\n tempA = tempB; //The new temp value is now going to be replace for the next iteration.\n //count = newIndex; //Reset the count for the next iteration.\n }\n Arrays.asList(arrayOfValues).forEach(element -> System.out.print(element + \" \"));\n }", "private static void rotate(int[][] a) {\n\t\tint len = a.length;\n\t\tint k,l=0;\n\t\tint b[][] = new int[len][len];\n\t\tfor(int i=len-1;i>=0;i--)\n\t\t{\n\t\t\tk=0;\n\t\t\tfor(int j=0;j<len && k<3 && l<3;j++)\n\t\t\t{\n\t\t\t b[k][l]=a[i][j];\n\t\t\t k++;\n\t\t\t if(k>2)\n\t\t\t \t l++;\n\t }\n\t\t}\n\t\tfor(int c[]:b) {\n\t\t\tfor( int d : c) {\n\t\t\t\tSystem.out.print(d + \" \");\n\t\t\t}\n\t\tSystem.out.println();\n\t}\n\t\t\n\t}", "static int[] rotLeft(int[] a, int d) {\r\n // Gets length of input array\r\n int size = a.length;\r\n \r\n // Creates output array\r\n int[] result = new int[size];\r\n \r\n // We start cycling through the input array with index d instead of the very beginning\r\n int index = d;\r\n \r\n // Cycles through the input array\r\n for (int i = 0; i < size; i++) {\r\n // If the index is bigger than the size of the array, it starts again from 0 in order to not overflow\r\n if (index >= size) {\r\n index = 0;\r\n }\r\n result[i] = a[index]; // We save the current value in result\r\n index += 1; // We refresh the index\r\n }\r\n \r\n return result;\r\n}", "public static void main(String[] args) {\n Scanner kb=new Scanner(System.in);\n System.out.println(\"Enter the number of elements in array\");\n int n=kb.nextInt();\n int arr[]=new int[n];\n for(int i=0;i<n;i++)\n {\n System.out.println(\"Enter the number\");\n arr[i]=kb.nextInt();\n \n }\n \n System.out.println(\"Enter the amount of rotation\");\n int rotation= kb.nextInt();\n for(int i=rotation;i<n;i++)\n {\n System.out.println(arr[i]);\n }\n for(int i=0;i<rotation;i++)\n {\n System.out.println(arr[i]);\n }\n \n \n \n \n }", "public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int t = in.nextInt();\n for (int iT = 0; iT < t; iT++) {\n String answer = \"YES\";\n \n int n = in.nextInt();\n int[] a = new int[n];\n int[] pos = new int [n+1];\n for (int iA = 0; iA < n; iA++) {\n a[iA] = in.nextInt();\n pos[a[iA]] = iA;\n }\n \n for (int iPos = 1; iPos <= n; iPos++) {\n if (pos[iPos] != iPos - 1) {\n if (iPos == n-1) {\n answer = \"NO\";\n break;\n } else {\n while (pos[iPos] != iPos - 1) {\n //rotate at pos[iPos] as center\n int index = pos[iPos];\n \n if (index < n-1) {\n rotate(a, pos, index);\n } else {\n rotate(a, pos, index - 1);\n }\n }\n }\n }\n }\n \n System.out.println(answer);\n }\n }", "public List<Integer> rotate(List<Integer> a, int k, List<Integer> queries) {\n\n List<Integer> arrAfterRotation = new ArrayList<>(a);\n\n List<Integer> lastArrAfterRotation = new ArrayList<>(a);\n\n //Set the last one after rotation equal to provided array at initialization\n lastArrAfterRotation = a;\n\n for(int i=0; i<k; i++) {\n arrAfterRotation.set(0,lastArrAfterRotation.get(lastArrAfterRotation.size()-1));\n int counter=1;\n for (int elem=1; elem<lastArrAfterRotation.size();elem++ ) {\n arrAfterRotation.set(counter++, lastArrAfterRotation.get(elem-1));\n }\n List<Integer> tempList = new ArrayList<>(arrAfterRotation);\n lastArrAfterRotation= tempList;\n }\n printList(lastArrAfterRotation);\n\n List<Integer> returnList = new ArrayList<>(lastArrAfterRotation);\n\n for (int i : queries) {\n returnList.set(i,lastArrAfterRotation.get(i));\n }\n\n return returnList;\n\n }", "public static void main(String[] args){\n int[] testNumbers = {12, 4, 12, 5, -16, 14, 0}; \n for(int i = 1; i < testNumbers.length; i++)\n System.out.println(gcdRecursive(testNumbers[i-1], testNumbers[i]));\n for(int i = 1; i < testNumbers.length; i++)\n System.out.println(gcdLoop(testNumbers[i-1], testNumbers[i])); \n \n }", "public static int[] decomposeToBECC(int[][] g) {\n// this part of code is taken from uwi submissions\n int n = g.length;\n boolean[] visited = new boolean[n];\n int[] ord = new int[n];\n int[] low = new int[n];\n\n int[] ids = new int[n];\n int[] inds = new int[n];\n int[] parct = new int[n];\n int pos = 0;\n for (int i = 0; i < n; i++) {\n if (!visited[i]) {\n ids[0] = i;\n inds[0] = 0;\n int sp = 1;\n while (sp > 0) {\n int cur = ids[sp - 1];\n if (inds[sp - 1] == 0) {\n visited[cur] = true;\n ord[cur] = low[cur] = pos++;\n parct[sp - 1] = 0;\n }\n if (inds[sp - 1] == g[cur].length) {\n if (sp - 2 >= 0) {\n low[ids[sp - 2]] = Math.min(low[ids[sp - 2]], low[cur]);\n }\n sp--;\n continue;\n }\n int next = g[cur][inds[sp - 1]];\n if (!visited[next]) {\n ids[sp] = next;\n inds[sp] = 0;\n inds[sp - 1]++;\n sp++;\n continue;\n } else if (sp - 2 >= 0 && (next != ids[sp - 2] || ++parct[sp - 1] >= 2)) {\n low[cur] = Math.min(low[cur], ord[next]);\n }\n inds[sp - 1]++;\n }\n }\n }\n\n int[] clus = new int[n];\n Arrays.fill(clus, -1);\n int[] q = new int[n];\n int cnum = 0;\n for (int i = 0; i < n; i++) {\n if (clus[i] == -1) {\n int p = 0;\n q[p++] = i;\n clus[i] = cnum++;\n for (int r = 0; r < p; r++) {\n int cur = q[r];\n for (int next : g[cur]) {\n if (clus[next] == -1) {\n clus[next] = ord[cur] < low[next] ? cnum++ : clus[cur];\n q[p++] = next;\n }\n }\n }\n }\n }\n return clus;\n }", "private static void rightRotate(int[] nums, int k) {\r\n\t if (nums.length == 0) return;\r\n\t \r\n\t k %= nums.length;\r\n\t \r\n\t if (k == 0) return;\r\n\t \r\n\t int left=0, right=nums.length-1, tmp;\r\n\t \r\n\t while(left < right) {\r\n\t tmp = nums[left];\r\n\t nums[left] = nums[right];\r\n\t nums[right] = tmp;\r\n\t \r\n\t left++;\r\n\t right--;\r\n\t }\r\n\t \r\n\t left=0;\r\n\t right=k-1;\r\n\t \r\n\t while(left < right) {\r\n\t \ttmp = nums[left];\r\n\t \tnums[left] = nums[right];\r\n\t \tnums[right] = tmp;\r\n\t \t \r\n\t \tleft++;\r\n\t \tright--;\r\n\t }\r\n\t \r\n\t left=k;\r\n\t right=nums.length-1;\r\n\t \r\n\t while(left < right) {\r\n\t \ttmp = nums[left];\r\n\t \tnums[left] = nums[right];\r\n\t \tnums[right] = tmp;\r\n\t \t \r\n\t \tleft++;\r\n\t \tright--;\r\n\t }\r\n\t }", "public void rotate(){\n\t\tint oneLoop = 0;\r\n\t\tmotherLoop: while(oneLoop == 0){\r\n\t\t\toneLoop = 1;\r\n\t\t// tworze i zeruje macierz 4x4\r\n\t\tint d = type == 1 ? 4 : 3;\t// dla podłużnego będzie klatka 4x4, dla reszty: 3x3\r\n\t\tif(type != 2 ){\t// a dla kwadratowego nic nie trzeba obracac\r\n\t\t\t// tworze macierz i przerzucam do niej klocka:\r\n\t\t\t// tworze i zeruje macierz dxd\r\n\t\t\tint[][] matrix = new int[d][d];\r\n\t\t\tfor(int i = 0 ; i < d ; i++)\r\n\t\t\t\tfor(int j = 0 ; j < d ; j++)\r\n\t\t\t\t\tmatrix[i][j] = 0;\r\n\t\t\t// wyznaczam najmniejsze X i Y z tablic X[] i Y[]\r\n\t\t\tint minX = X[0], minY = Y[0];\r\n\t\t\tfor(int i = 1 ; i < d ; i++){\r\n\t\t\t\tif(X[i] < minX)\tminX = X[i];\r\n\t\t\t\tif(Y[i] < minY)\tminY = Y[i];\r\n\t\t\t}\r\n\t\t\t// przepisuje do czystej macierzy klocka, odejmujac najmniejsze X i Y\r\n\t\t\t// dzieki temu przystaje on do lewej i gornej krawedzi macierzy.\r\n\t\t\tfor(int i = 0 ; i < 4 ; i++)\r\n\t\t\t\tmatrix[Y[i]-minY][X[i]-minX] = 1;\r\n\t\t\t\r\n\t\t\t// dla przypadkow przy scianie przerywam calosc:\r\n\t\t\tif(minX + d > Board.getWidth()){\r\n\t\t\t\tSystem.out.println(\"Protestuje, bo: minX+d=\" +(minX+d)+ \", a Board.getWidth()=\" + Board.getWidth());\r\n\t\t\t\tbreak motherLoop;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(d==4){\t// dla dlugiego przycinam jeszcze raz\r\n\t\t\t\tif(matrix[3][0] == 1){\t// jest pionowo\r\n\t\t\t\t\tfor(int i = 0 ; i < 4 ; i++){\r\n\t\t\t\t\t\tmatrix[i][0] = 0;\r\n\t\t\t\t\t\tmatrix[i][1] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}else{\t// jest poziomo\r\n\t\t\t\t\tfor(int i = 0 ; i < 4 ; i++){\r\n\t\t\t\t\t\tmatrix[0][i] = 0;\r\n\t\t\t\t\t\tmatrix[1][i] = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// nowa macierz to macierz z klockiem obrocona o 90 stopni\r\n\t\t\tint[][] newMatrix = new int[d][d];\r\n\t\t\tfor(int i = 0 ; i < d ; i++){\r\n\t\t\t\tfor(int j = 0 ; j < d ; j++){\r\n\t\t\t\t\tnewMatrix[i][j] = matrix[j][d-i-1];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tboolean isFree = true;\t// sprawdzam czy nowy klocek nie naruszy statycznych klockow\r\n\t\t\tint index = 0;\r\n\t\t\tfor(int i = 0 ; i < d ; i++){\r\n\t\t\t\tfor(int j = 0 ; j < d ; j++){\r\n\t\t\t\t\tif(i+minY < Board.getHeight() && j+minX < Board.getWidth()){\r\n\t\t\t\t\t\tif(motherBoard.getField(j+minX, i+minY).getContent() == 2){\r\n\t\t\t\t\t\t\tisFree = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(isFree){\r\n\t\t\t\tindex = 0;\r\n\t\t\t\tfor(int i = 0 ; i < d ; i++){\r\n\t\t\t\t\tfor(int j = 0 ; j < d ; j++){\r\n\t\t\t\t\t\tif( minY >= 0 && j+minX < Board.getWidth() && i+minY < Board.getHeight()){\t// wymiary sie beda zgadzac z plansza.\r\n\t\t\t\t\t\t\tif(newMatrix[i][j] == 1){\r\n\t\t\t\t\t\t\t\tX[index] = j+minX;\r\n\t\t\t\t\t\t\t\tY[index] = i+minY;\r\n\t\t\t\t\t\t\t\tindex++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t}", "private static void rotateMatrix(int[][] matrix) {\n\n\t\t// Assume: the elements are integer, and are unique values so that the result\n\t\t// can be tested for correctness.\n\t\t// Question: are the dimensions square? i.e. row and column count are the same?\n\t\t// Assume Yes.\n\t\t// Question: Which direction should the array be rotated - Assume clockwise\n\n\t\t// Iterate from counter min to max - 1\n\t\t// Copy top row first cell into a temp variable.\n\t\t// Copy each corner into the next corner. Use temp variable to fill the last\n\t\t// corner\n\t\t// Decrement counter and perform for next set of cells\n\t\t// Repeat for inner layers.\n\n\t\t// Bounding Co-ordinates: matrix[min][min], matrix[min, max], matrix[max, max],\n\t\t// matrix[max, min]\n\t\t// Initially: min = 0, max = N-1 (i.e. 0 based array positions)\n\t\t// pos = min\n\t\t// While pos < max\n\t\t// temp = matrix[min][pos]\n\t\t// matrix[min][pos] = matrix[max - pos + min][min]\n\t\t// matrix[max - pos + min][min] = matrix[max][max - pos + min]\n\t\t// matrix[max][max - pos + min] = matrix[pos][max]\n\t\t// matrix[pos][max] = temp\n\t\t// Increment pos\n\t\t// Increment min and decrement max\n\t\t// Break when min >= max\n\t\t// For even N, the last grid will be a 2 X 2 matrix, for odd N, the last grid\n\t\t// will be a single cell\n\n\t\t// T.C. N/2 iterations of the while loop (for even N)\n\t\t// T.C. = (N - 1) + (N-3) + .. 1\n\t\t// [first calls executes 5 for loops, each N-1 times. last call executes 2*2\n\t\t// matrix. i.e. N-1 = 1]\n\t\t// = (N-1 + N-3 + .. + 1) = (N-1 + N-3 + ... + N-(N-1))\n\t\t// = (N*N/2 - (1 + 3 + .. + N-1))\n\t\t// Sum of n even no.s = n(n+1)\n\t\t// Sum of n odd no.s = N(N+1)/2 - n(n+1). Where N = Max of odd no. + 1\n\t\t// T.C. = (N*N/2 - (N(N+1)/2 - N/2 * (N/2 + 1)))\n\t\t// = ( N*N/2 - (N*N/2 + N/2 - N*N/4 - N/2)) = (N*N/4)\n\t\t// T.C = O(N*N), this is the best possible T.C as each element needs to be\n\t\t// visited once.\n\t\t// S.C. O(1)\n\n\t\tif (matrix == null || matrix.length == 0)\n\t\t\treturn;\n\n\t\tif (matrix.length != matrix[0].length)\n\t\t\tthrow new NotASquareMatrixException(\"Not a square matrix. Cannot be rotated in place.\");\n\n\t\tint min = 0;\n\t\tint max = matrix.length - 1;\n\t\tprint(matrix);\n\n\t\twhile (min < max) {\n\t\t\trotateCellsInALayer(matrix, min, max);\n\t\t\tprint(matrix);\n\t\t\tmin++;\n\t\t\tmax--;\n\t\t}\n\t}", "@Override\n\tpublic void algorithm() {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t\t\n\t\tint change = 2;\n\t\t\n\t\tfor(int i=0; i<this.getGridGame().getGridRow(); i++) {\n\t\t\t\n\t\t\tfor(int j=0; j<this.getGridGame().getGridCol(); j++) {\n\t\t\t\t\n\t\t\t\tif(j > 0 && j < this.getGridGame().getGridCol()) {\n\t\t\t\t\t\n\t\t\t\t\tif(this.getGridGame().getPattern(i,j-1) != this.getGridGame().getPattern(i,j)) {\n\t\t\t\t\t\n\t\t\t\t\t\tchange--;\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(change > 0) {\n\t\t\t\t\t\n\t\t\t\t\tthis.getArray()[i][0] += this.getGridGame().getPattern(i,j);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\tthis.getArray()[i][1] += this.getGridGame().getPattern(i,j);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t//System.out.println(change + \" \");\n\t\t\tchange = 2;\n\t\t\t\n\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0; i<this.getGridGame().getGridRow(); i++) {\n\t\t\t\n\t\t\tif(this.getArray()[i][1] == 0) {\n\t\t\t\t\n\t\t\t\tthis.getArray()[i][1] = this.getArray()[i][0];\n\t\t\t\tthis.getArray()[i][0] = 0;\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0; i<this.getGridGame().getGridRow(); i++) {\n\t\t\t\n\t\t\tfor(int j=0; j<2; j++) {\n\t\t\t\n\t\t\t\tSystem.out.print(this.getArray()[i][j] + \" \");\n\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println(\" \");\n\t\t\t\n\t\t}\n\t\t\n\t\n\t}", "static void leftRotate(int arr[], int d, int n) \n\t{\n\t\tint i, j;\n\t\tif (d == 0 || d == n)\n\t\t\treturn;\n\t\ti = d;\n\t\tj = n - d;\n\t\twhile (i != j) {\n\t\t\tif (i < j) /* A is shorter */\n\t\t\t{\n\t\t\t\tswap(arr, d - i, d + j - i, i);\n\t\t\t\tj -= i;\n\t\t\t} else /* B is shorter */\n\t\t\t{\n\t\t\t\tswap(arr, d - i, d, j);\n\t\t\t\ti -= j;\n\t\t\t}\n\t\t\t// printArray(arr, 7);\n\t\t}\n\t\t/* Finally, block swap A and B */\n\t\tswap(arr, d - i, d, i);\n\t}", "static long[] riddle(long[] arr) {\n \t\n \tint len = arr.length; \n \tlong[] a = new long[len]; \t\n\t\tfor (int t = 0; t < len; t++) {\n\t\t\tlong max = 0;\n\t\t\tfor (int i = 0; i < len; i++) {\t\t\t\t\n\t\t\t\tlong min = 0;\n\t\t\t\tSystem.out.println();\n\t\t\t\tfor (int j = 0; j <= i; j++) {\n\t\t\t\t\tif (min == 0) {\n\t\t\t\t\t\tmin = arr[j];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (min < arr[j]) {\n\t\t\t\t\t\t\tmin = arr[j];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.print(min + \" \" );\n\t\t\t\t}\n\t\t\t\tif (max == 0) {\n\t\t\t\t\tmax = min;\n\t\t\t\t} else {\n\t\t\t\t\tif (min > max) {\n\t\t\t\t\t\tmax = min;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ta[t] = max;\t\t\t\t\n\t\t\t}\n\t\t} \t\n \treturn a;\n }", "public static void main(String[] args) {\n \tlong[] fact = new long[MAXDOMINOES+1];\r\n \tfact[0] = 1;\r\n \tfor (int i=1; i<=MAXDOMINOES; i++)\r\n \t\tfact[i] = (fact[i-1]*i)%MOD;\r\n\r\n Scanner stdin = new Scanner(System.in);\r\n int numCases = stdin.nextInt();\r\n\r\n // Process each case.\r\n for (int loop=0; loop<numCases; loop++) {\r\n\r\n // Read in this case.\r\n n = stdin.nextInt();\r\n list = new int[n][2];\r\n for (int i=0; i<n; i++)\r\n for (int j=0; j<2; j++)\r\n list[i][j] = stdin.nextInt();\r\n\r\n // Special case - if all the dominoes are the same, all orderings work.\r\n if (same(list)) {\r\n \tSystem.out.println(fact[n]);\r\n \tcontinue;\r\n }\r\n\r\n // dp[mask][last][orientation] will store the number of permutations using the dominoes indicated by\r\n // mask, with the last domino last facing in the direction dictated by orientation. If orientation is 0,\r\n // this is the original input orientation, if it is 1, it's flipped.\r\n long[][][] dp = new long[1<<n][n][2];\r\n\r\n // Always 1 way to place one domino in a fixed orientation.\r\n for (int i=0; i<n; i++) {\r\n dp[1<<i][i][0] = 1;\r\n dp[1<<i][i][1] = 1;\r\n }\r\n\r\n // Outer DP loop, solve all problem instances for each subset of dominoes.\r\n for (int mask=3; mask<(1<<n); mask++) {\r\n\r\n // Now, try each domino as the last domino in mask.\r\n for (int last=0; last<n; last++) {\r\n\r\n // Not a valid state.\r\n if ((mask&(1<<last)) == 0) continue;\r\n\r\n int prevmask = mask - (1<<last);\r\n\r\n for (int i=0; i<n; i++) {\r\n\r\n if ((prevmask&(1<<i)) == 0) continue;\r\n\r\n // Both i and last are in regular orientation.\r\n if (list[i][1] == list[last][0])\r\n dp[mask][last][0] = (dp[mask][last][0]+dp[prevmask][i][0])%MOD;\r\n\r\n // Here i is flipped and last is regular.\r\n else if (list[i][0] == list[last][0])\r\n dp[mask][last][0] = (dp[mask][last][0]+dp[prevmask][i][1])%MOD;\r\n\r\n // i is regular but last is flipped.\r\n if (list[i][1] == list[last][1])\r\n dp[mask][last][1] = (dp[mask][last][1]+dp[prevmask][i][0])%MOD;\r\n\r\n // Both i and last are flipped.\r\n else if (list[i][0] == list[last][1])\r\n dp[mask][last][1] = (dp[mask][last][1]+dp[prevmask][i][1])%MOD;\r\n }\r\n } // end last loop\r\n } // end mask loop\r\n\r\n // Sum up result - all ways to place all dominoes over all possible last dominoes in either orientation.\r\n // Since we screened out our special case, no over-counting will occur here.\r\n long res = 0L;\r\n for (int last=0; last<n; last++) {\r\n \tres = (res + dp[(1<<n)-1][last][0])%MOD;\r\n \tif (list[last][0] != list[last][1])\r\n \t\tres = (res + dp[(1<<n)-1][last][1])%MOD;\r\n }\r\n System.out.println(res);\r\n }\r\n }", "@Test\n\tpublic void testDoRotaion() {\n\t\tresultlist = DoRotation.doRotaion(initialList, 0);\n\t\texpectedList = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6));\n\t\tassertNotNull(resultlist);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion of array 0\", resultlist.toArray(), expectedList.toArray());\n\t\t//Do rotaion of the arraylist using step value =1\n\t\t\n\t\t//Use same result of previous rotation and apply other rotation by step = 1\n\t\tresultlist = DoRotation.doRotaion(expectedList, 1);\n\t\texpectedList = new ArrayList<>(Arrays.asList(6, 1, 2, 3, 4, 5));\n\t\tassertNotNull(resultlist);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion of array 0\", resultlist.toArray(), expectedList.toArray());\n\t\t\n\t\t//Use same result of previous rotation and apply other rotation by step = 1\n\t\tresultlist = DoRotation.doRotaion(expectedList, 1);\n\t\texpectedList = new ArrayList<>(Arrays.asList(5, 6, 1, 2, 3, 4));\n\t\tassertNotNull(resultlist);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion of array 0\", resultlist.toArray(), expectedList.toArray());\n\t\t\n\t\t//this test must be the same if we use step = 2\n\t\tArrayList<Integer> resultlist_Step2 = DoRotation.doRotaion(initialList, 2);\n\t\texpectedList = new ArrayList<>(Arrays.asList(5, 6, 1, 2, 3, 4));\n\t\tassertNotNull(resultlist_Step2);assertNotNull(expectedList);\n\t\tassertArrayEquals(\"Do rotaion with step = 2\", resultlist_Step2.toArray(), expectedList.toArray());\n\t}", "static long[] riddle(long[] arr) {\n // complete this function\n return arr;\n }", "public static void rotate1 (int [] nums, int k ) {\n\t\tint n = nums.length;\n\t\tk = k % n ;\n\t\tif(k == 0) return ;\n\t\tint prev = 0, currIndex = 0, temp = 0, count = 0;\n\t\tfor(int start = 0 ; count < nums.length ; start++) {\n\t\t\tprev = nums[start];\n\t\t\tcurrIndex = start;\n\t\t\t// keep rotating till reach the initial point\n\t\t\tdo {\n\t\t\t\tint nextIndex = (currIndex + k) % n;\n\t\t\t\ttemp = nums[nextIndex];\n\t\t\t\tnums[nextIndex] = prev;\n\t\t\t\tprev = temp;\n\t\t\t\tcurrIndex = nextIndex;\n\t\t\t\tcount++;\n\t\t\t\t\n\t\t\t} while(start != currIndex);\n\t\t}\n\t}", "public Integer[] solution(Integer[] A, int K) {\n\n\t\tInteger[] new_array = new Integer[A.length]; // a new array\n\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tint new_position = (i + K) % A.length; // using \"mod\" to do Cyclic Rotation\n\t\t\tnew_array[new_position] = A[i]; // put A[i] to the new position\n\t\t}\n\n\t\treturn new_array; // return new array\n\t}", "int countRotation(int a[]) {\n\t\tint low = 0;\n\t\tint high = a.length - 1;\n\t\tint N = high;\n\n\t\twhile (low <= high) {\n\t\t\tint mid = (low + high) / 2;\n\t\t\t// array has not been rotated at all\n\t\t\tif (a[low] <= a[high]) {\n\t\t\t\treturn low;\n\t\t\t}\n\t\t\tint next = (mid + 1) % N;\n\t\t\tint prev = (mid + N - 1) % N;\n\t\t\t// We get the pivot point so return index\n\t\t\tif (a[prev] > a[mid] && a[mid] < a[next]) {\n\t\t\t\treturn mid;\n\t\t\t}\n\t\t\t// Ignore the search space which is sorted because pivot point will\n\t\t\t// not lie there\n\t\t\tif (a[low] < a[mid]) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else /* if (a[mid + 1] < a[high]) */ {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}", "void h(List<List<Integer>> r, List<Integer> t, int n, int s){ \n for(int i = s; i*i <= n; i++){\n if(n % i != 0) continue; \n t.add(i);\n t.add(n / i);\n r.add(new ArrayList<>(t));\n t.remove(t.size() - 1);\n h(r, t, n/i, i);\n t.remove(t.size() - 1);\n }\n }", "public void rotate(int[] nums, int k) {\n\t\tif(nums == null || nums.length == 0 || k <= 0){\n\t\t\treturn;\n\t\t}\n\t\tint n = nums.length, count = 0;\n\t\tk %= n;\n\t\tfor(int start = 0; count < n; start++){\n\t\t\tint cur = start;\n\t\t\tint prev = nums[start];\n\t\t\tdo{\n\t\t\t\tint next = (cur + k) % n;\n\t\t\t\tint temp = nums[next];\n\t\t\t\tnums[next] = prev;\n\t\t\t\tcur = next;\n\t\t\t\tprev = temp;\n\t\t\t\tcount++;\n\t\t\t}while(start != cur);\n\t\t}\n\t}", "public void linearize() {\r\n Object[] temp = new Object[size];\r\n int k = start;\r\n for (int i = 0; i < size; i++) {\r\n temp[i] = cir[k];\r\n k = (k + 1) % cir.length;\r\n }\r\n cir = temp;\r\n }", "public void rotate(int [] a, int k)\n\t{\n\t\tif (a == null || k == 0)\n\t\t\treturn;\n\n\t\tint [] b = new int[a.length];\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t{\n\t\t\tint jump = (i + k) % a.length;\n\t\t\tb[jump] = a[i];\n\t\t}\n\t\tfor (int i = 0; i <a.length;i++)\n\t\t{\n\t\t\ta[i] = b[i];\n\t\t}\n\t}", "public int searchRot(int[] nums, int targ) {\n //Find pivot\n int lo = 0;\n int hi = nums.length - 1;\n while (lo < hi) {\n int mid = (lo + hi) / 2;\n if (nums[mid] > nums[hi]) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n\n int piv = lo;\n lo = 0;\n hi = nums.length - 1;\n while (lo < hi) {\n int mid = (lo + hi) / 2;\n int realMid = (mid + piv) % nums.length;\n if (nums[realMid] == targ) {\n return realMid;\n } else if (nums[realMid] > targ) {\n hi = mid - 1;\n } else {\n lo = mid + 1;\n }\n }\n\n return -1;\n}", "public void OrdenarIndividuos(int izq, int der) {\n Individuo pivote = (Individuo) individuos.get(izq); // tomamos primer elemento como pivote\r\n int i = izq; // i realiza la búsqueda de izquierda a derecha\r\n int j = der; // j realiza la búsqueda de derecha a izquierda\r\n Individuo ind;\r\n int aux;\r\n\r\n while (i < j) { // mientras no se crucen las búsquedas\r\n while (individuos.get(i).getEvaluacion() <= pivote.getEvaluacion() && i < j) {\r\n i++; // busca elemento mayor que pivote\r\n }\r\n while (individuos.get(j).getEvaluacion() > pivote.getEvaluacion()) {\r\n j--; // busca elemento menor que pivote\r\n }\r\n if (i < j) {\r\n ind = (Individuo) individuos.get(i); // si no se han cruzado \r\n //aux= A[i]; // los intercambia\r\n individuos.set(i, individuos.get(j));\r\n //A[i]=A[j];\r\n individuos.set(j, ind);\r\n //A[j]=aux;\r\n }\r\n }\r\n individuos.set(izq, individuos.get(j));\r\n //A[izq]=A[j]; // se coloca el pivote en su lugar de forma que tendremos\r\n individuos.set(j, pivote);\r\n //A[j]=pivote; // los menores a su izquierda y los mayores a su derecha\r\n if (izq < j - 1) {\r\n OrdenarIndividuos(izq, j - 1); // ordenamos subarray izquierdo\r\n }\r\n if (j + 1 < der) {\r\n OrdenarIndividuos(j + 1, der); // ordenamos subarray derecho\r\n } \r\n }", "public int[] cyclic_rot(int i, int[] D) {\n int L = D.length;\n\n int[] doubled_D = new int[2 * L];\n int[] return_D = new int[L];\n\n for (int j = 0; j < L; j++)\n doubled_D[j] = D[j];\n\n for (int j = 0; j < L; j++)\n doubled_D[j + L] = D[j];\n\n int shift = i % L;\n for (int j = 0; j < L; j++)\n return_D[j] = doubled_D[j + shift];\n\n return return_D;\n }", "static void hashTestCase(int givArr[]) {\n\t\tfor (int i = 0; i < m; i++) {\n\t\t\tint mod = givArr[i] % m;\n\t\t\tarray[mod] = givArr[i];\n\t\t}\n\t}", "public void rotation(){\n\n double x=Double.parseDouble(rotationx.getText());\n double y=Double.parseDouble(rotationy.getText());\n double z=Double.parseDouble(rotationz.getText());\n if (checkbox.isSelected()){\n cls_zahnrad.rotieren(x,y,z);\n return;\n }\n Triangle[] dreiecke = t1.getFlaechen();\n x=2*Math.PI/360*x;\n y=2*Math.PI/360*y;\n z=2*Math.PI/360*z;\n double[] A,B,C;\n\n double pktx=0,pkty=0,pktz=0;\n\n if (radio12.isSelected()){\n pktx = Double.parseDouble(rotationpktx.getText());\n pkty = Double.parseDouble(rotationpkty.getText());\n pktz = Double.parseDouble(rotationpktz.getText());\n }\n\n for (Triangle i :dreiecke){\n for (int j=0; j<3;j++){\n double xtemp,ytemp,ztemp;\n xtemp=i.getTriangle()[j].getPoint()[0]-pktx;\n ytemp=i.getTriangle()[j].getPoint()[1]-pkty;\n ztemp=i.getTriangle()[j].getPoint()[2]-pktz;\n i.getTriangle()[j].setPoint(xtemp,ytemp,ztemp);\n }\n }\n\n for (Triangle t1 : dreiecke){\n A=t1.getTriangle()[0].getPoint();\n B=t1.getTriangle()[1].getPoint();\n C=t1.getTriangle()[2].getPoint();\n double[][]punkte={A,B,C};\n\n for (int i=0; i<punkte.length; i++){\n double temp0,temp1,temp2;\n\n //Rotation um Parallele der X-Achse durch das Rotationszentrum\n if (x!=0){\n temp1=punkte[i][1]*Math.cos(x)-punkte[i][2]*Math.sin(x);\n temp2=punkte[i][1]*Math.sin(x)+punkte[i][2]*Math.cos(x);\n punkte[i][1]=temp1;\n punkte[i][2]=temp2;\n }\n\n //Rotation um Parallele der Y-Achse durch das Rotationszentrum\n if (y!=0){\n temp0=punkte[i][0]*Math.cos(y)+punkte[i][2]*Math.sin(y);\n temp2=-punkte[i][0]*Math.sin(y)+punkte[i][2]*Math.cos(y);\n punkte[i][0]=temp0;\n punkte[i][2]=temp2;\n }\n\n //Rotation um Parallele der Z-Achse durch das Rotationszentrum\n if (z!=0){\n temp0=punkte[i][0]*Math.cos(z)-punkte[i][1]*Math.sin(z);\n temp1=punkte[i][0]*Math.sin(z)+punkte[i][1]*Math.cos(z);\n punkte[i][0]=temp0;\n punkte[i][1]=temp1;\n }\n }\n A=punkte[0];\n B=punkte[1];\n C=punkte[2];\n t1.getTriangle()[0].setPoint(A[0],A[1],A[2]);\n t1.getTriangle()[1].setPoint(B[0],B[1],B[2]);\n t1.getTriangle()[2].setPoint(C[0],C[1],C[2]);\n }\n for (Triangle i :dreiecke){\n for (int j=0; j<3;j++){\n double xtemp,ytemp,ztemp;\n xtemp=i.getTriangle()[j].getPoint()[0]+pktx;\n ytemp=i.getTriangle()[j].getPoint()[1]+pkty;\n ztemp=i.getTriangle()[j].getPoint()[2]+pktz;\n i.getTriangle()[j].setPoint(xtemp,ytemp,ztemp);\n }\n }\n redraw();\n /*\n System.out.println(\"A \"+Arrays.toString(t1.getTetraeder()[0].getPoint()));\n System.out.println(\"B \"+Arrays.toString(t1.getTetraeder()[1].getPoint()));\n System.out.println(\"C \"+Arrays.toString(t1.getTetraeder()[2].getPoint()));\n System.out.println(\"D \"+Arrays.toString(t1.getTetraeder()[3].getPoint()));\n System.out.println(Arrays.toString(Mittelpunkt));\n */\n }", "public static void main(String[] args) {\n\n\n int b[] = ArrayHelper.generateSequenceArray(10);\n ArrayHelper.printArray(b);\n rotate(b,6);\n ArrayHelper.printArray(b);\n\n\n\n }", "void nextGeneration(int my2dArray[][], int R, int C)\r\n\t\t{\r\n\t\t\tint[][] future = new int[R][C];\r\n\r\n\t\t\t\tfor (int k = 1; k < R - 1; k++) // going trough the array \r\n\t\t\t\t{\r\n\t\t\t\t\tfor (int l = 1; l < C - 1; l++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint n = 0;// saves the nummber of neighbours for every cells. \r\n\t\t\t\t\t\tfor (int i = -1; i <= 1; i++)\r\n\t\t\t\t\t\t\tfor (int j = -1; j <= 1; j++)\r\n\t\t\t\t\t\t\t\t\tn += my2dArray[k + i][l + j];\r\n\t\t\t\t\t\t\t\t\tn -= my2dArray[k][l];\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif ((my2dArray[k][l] == 1) && (n < 2))\r\n\t\t\t\t\t\t\t\tfuture[k][l] = 0;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\telse if ((my2dArray[k][l] == 1) && (n > 3))\r\n\t\t\t\t\t\t\t\t\tfuture[k][l] = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t\telse if ((my2dArray[k][l] == 0) && (n == 3))\r\n\t\t\t\t\t\tfuture[k][l] = 1;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\tfuture[k][l] = my2dArray[k][l];\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//prints the next generation\r\n\t\t\t\tSystem.out.println();\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"Next Generation\");\r\n\t\t\t\tfor (int i = 0; i < R; i++)\r\n\t\t\t\t{\r\n\t\t\t\tfor (int j = 0; j < C; j++)\r\n\t\t\t\t{\r\n\t\t\t\tif (future[j][i] == 0)\r\n\t\t\t\tSystem.out.print(\"O\");\r\n\t\t\t\telse\r\n\t\t\t\tSystem.out.print(\"X\");\r\n\t\t\t\tSystem.out.print(\" \");\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tSystem.out.println();\r\n\t\t\t\t}\r\n\r\n\t\t\t}", "static long countTriplets(List<Long> arr, long r) {\n List<List<Long>> candidates;\n List<List<Long>> triplets = new ArrayList<>();\n for (int i = 0; i < arr.size(); i++) {\n long root = arr.get(i);\n candidates = new ArrayList<>();\n\n for (int j = i + 1; j < arr.size(); j++) {\n long value = arr.get(j);\n\n candidates.forEach(candidate -> {\n long current = candidate.get(1);\n if (value / r == current) {\n List<Long> triplet = new ArrayList<>(candidate);\n triplet.add(value);\n triplets.add(triplet);\n }\n });\n\n if (value / r == root) {\n List<Long> candidate = new ArrayList<>();\n candidate.add(root);\n candidate.add(value);\n candidates.add(candidate);\n }\n }\n\n // List<Long> sig = new ArrayList<>();\n // for (int j = 0; j < arr.size(); j++) {\n // sig.set(j, j < i ? arr.get(i) : arr.get(i) / r);\n // }\n }\n\n return triplets.size();\n }", "public void rotate() {\n\t\t\tfor(int i=0; i<4; i++)\n\t\t\t\tfor(int j=0; j<4; j++)\n\t\t\t\t\ttmp_grid[i][j] = squares[i][j];\n\t\t\t// copy back rotated 90 degrees\n\t\t\tfor(int i=0; i<4; i++)\n\t\t\t\tfor(int j=0; j<4; j++)\n\t\t\t\t\tsquares[j][i] = tmp_grid[i][3-j];\n \n //log rotation\n LogEvent(\"rotate\");\n\t\t}", "static void rotate_right(int[] arr, int rotate){\n for (int j = 0; j < rotate; j++) {\n int temp = arr[j];\n for (int i = j; i < arr.length+rotate; i+=rotate) {\n if(i-rotate < 0)\n temp = arr[i];\n else if(i >= arr.length)\n arr[i-rotate] = temp;\n else\n arr[i-rotate] = arr[i]; \n }\n }\n }", "void rotatePolygon() {\n\t\tfor (int i = 0; i < amount; i++)\n\t\t\tpoint[i].rotate();\n\t}", "private void shufflePositions() {\r\n\r\n // Inizializzo con il progressivo delle posizioni\r\n for (int i = 0; i < shufflePositions.length; i++) {\r\n shufflePositions[i] = i;\r\n }\r\n\r\n int lastIndex ;\r\n int tempIndex = 0;\r\n int tempVal = 0;\r\n\r\n// // Tecnica 1 - Knuth (gli indici da scambiare sono scelti dall'inizio in un insieme decrescente in cardinalità)\r\n// int lastIndex = shufflePositions.length;\r\n// for (int i = 0; i < shufflePositions.length-1; i++) {\r\n// tempIndex = i+secureRandom.nextInt(lastIndex); // Randomizzo le posizioni del random buffer da cui prendo i valori casuali\r\n// tempVal=shufflePositions[tempIndex];\r\n// shufflePositions[tempIndex]=shufflePositions[i];\r\n// shufflePositions[i] = tempVal; \r\n// lastIndex--;\r\n// } \r\n \r\n //Tecnica 2 - Knuth GAB Modification (gli indici casuali sono scelti dal fondo in un insieme decrescente in cardinalità)\r\n lastIndex = shufflePositions.length-1;\r\n for (int i = 0; i < shufflePositions.length - 1; i++) {\r\n tempIndex = secureRandom.nextInt(lastIndex); // Randomizzo le posizioni del random buffer da cui prendo i valori casuali\r\n tempVal = shufflePositions[tempIndex];\r\n shufflePositions[tempIndex] = shufflePositions[lastIndex];\r\n shufflePositions[lastIndex] = tempVal;\r\n lastIndex--;\r\n }\r\n \r\n// // Tecnica 3 - Algoritmo standard delle collections\r\n// Integer[]tempArray = new Integer[MaxBufferLength];\r\n// for (int i=0;i<MaxBufferLength;i++){\r\n// tempArray[i]=i;\r\n// \r\n// }\r\n// List<Integer> tempList = Arrays.asList(tempArray);\r\n//\r\n// Collections.shuffle(tempList, secureRandom);\r\n// tempArray= (Integer[]) tempList.toArray();\r\n// for (int i=0;i<shufflePositions.length;i++){\r\n// shufflePositions[i]=tempArray[i];\r\n// }\r\n }", "public static int[]reparacion(int[] hijo,int ttablero){\n int []hijor=new int[ttablero];\n int falta;\n int cont=0;\n int aux;\n int repite;\n ArrayList<Integer> repetidos = new ArrayList<>();\n ArrayList<Integer> faltantes = new ArrayList<>();\n for(int i=0;i<=ttablero;i++){\n aux=hijo[i];\n for(int j=0;j<=ttablero;j++){\n if(aux==hijo[j]){\n cont=cont+1;\n // System.out.println(\"contador \"+cont+\" se repite el hijo \" +hijo[j]);\n }\n if (cont>=2) {\n repite=hijo[j];\n repetidos.add(repite);\n // System.out.println(\"se repite el numero \"+repite );\n cont=0; \n } \n \n }\n cont=0; \n }\n \n //limpiar de repetidos el array repetidos\n for (int i = 0; i<repetidos.size(); i++) {\n int auxi=repetidos.get(i);\n //System.out.println(\"aux \"+ auxi );\n for (int j = i+1;j<repetidos.size() ; j++) {\n if (auxi==repetidos.get(j)) {\n //System.out.println(\"repetidos \"+ repetidos.get(i) );\n repetidos.remove(j);\n \n }\n \n }\n \n }\n \n for (int i = 0; i <repetidos.size(); i++) {\n // System.out.println(\"repetidos finalmente \"+ repetidos.get(i) );\n }\n int a=0;\n for (int i = 0; i <=ttablero; i++) {\n int auxx=i;\n for (int j = 0; j<=ttablero; j++) {\n \n }\n }\n int [] auscio=new int [ttablero];\n for (int i = 0; i <ttablero; i++) {\n auscio[i]=0;\n // System.out.println(\"auscio \"+auscio[i]);\n }\n \n for (int i = 0; i <ttablero; i++) {\n // int amp=i;\n for (int j = 0; j<ttablero; j++) {\n if (i==hijo[j]) {\n auscio[i]=1;\n }\n }\n }\n \n for (int i = 0; i <ttablero; i++) {\n // System.out.print(\"\"+auscio[i]);\n }\n for (int i = 0; i <ttablero; i++) {\n if (auscio[i]==0) {\n // System.out.println(\"falta el numero \"+(i));\n faltantes.add(i);\n }\n }\n \n return hijor;\n }", "void rotate () {\n final int rows = currentPiece.height;\n final int columns = currentPiece.width;\n int[][] rotated = new int[columns][rows];\n\n for (int i = 0; i < rows; i++)\n for (int j = 0; j < columns; j++)\n rotated[j][i] = currentPiece.blocks[i][columns - 1 - j];\n\n Piece rotatedPiece = new Piece(currentPiece.color, rotated);\n int kicks[][] = {\n {0, 0},\n {0, 1},\n {0, -1},\n //{0, -2},\n //{0, 2},\n {1, 0},\n //{-1, 0},\n {1, 1},\n //{-1, 1},\n {1, -1},\n //{-1, -1},\n };\n for (int kick[] : kicks) {\n if (canMove(currentRow + kick[0], currentColumn + kick[1], rotatedPiece)) {\n //System.out.println(\"Kicking \" + kick[0] + \", \" + kick[1]);\n currentPiece = rotatedPiece;\n currentRow += kick[0];\n currentColumn += kick[1];\n updateView();\n break;\n }\n }\n }", "static int[] rotLeft(int[] a, int d) {\r\n if (d<=0) {return a;}\r\n int n = a.length;\r\n int[] subArrayBack = new int[d];\r\n int[] subArrayFront = new int[n-d]; \r\n for ( int i = 0; i < d; i++){\r\n subArrayBack[i] = a[i];\r\n } \r\n for( int i = 0; i < n-d; i++){\r\n subArrayFront[i] = a[i+d];\r\n } \r\n int[] newArray = new int[n];\r\n for(int i = 0; i < subArrayFront.length; i++){\r\n newArray[i] = subArrayFront[i];\r\n }\r\n for(int i = 0; i < subArrayBack.length; i++){\r\n newArray[n-d+i] = subArrayBack[i];\r\n }\r\n return newArray;\r\n }", "public static void main(String[] args) throws Exception {\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint tc = scn.nextInt();\r\n\t\tfor(int t=1; t<=tc; t++) {\r\n\t\t\tint n = scn.nextInt();\r\n\t\t\tint k = scn.nextInt();\r\n\t\t\tString str = scn.next();\r\n\t\t\tString arr[] = new String[n];\r\n\t\t\tarr = str.split(\"\");\r\n\t\t\tLinkedList<String> list = new LinkedList<>();\r\n\t\t\tLinkedList<Integer> result = new LinkedList<>();\r\n\t\t\tfor(int i=0; i<n; i++) {\r\n\t\t\t\tlist.add(arr[i]);\r\n\t\t\t}\r\n\t\t\tint comeback = 0;\r\n\t\t\twhile(comeback<4) {\r\n\t\t\t\tint cnt = 0;\r\n\t\t\t\tcomeback = 0;\r\n\t\t\t\tString st = \"\";\r\n\t\t\t\tfor(int i=0; i<n; i++) {\r\n\t\t\t\t\tif(cnt==(n/4)-1) {\r\n\t\t\t\t\t\tcnt = 0;\r\n\t\t\t\t\t\tst += list.get(i);\r\n\t\t\t\t\t\tint tmp = Integer.parseInt(st, 16);\r\n\t\t\t\t\t\tif(!isHave(result,tmp) && (result.size()>0)) {\r\n\t\t\t\t\t\t\tresult.add(tmp);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(result.size() == 0){\r\n\t\t\t\t\t\t\tresult.add(tmp);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tcomeback++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tst = \"\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tst+= list.get(i);\r\n\t\t\t\t\t\tcnt++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\trotate(list);\r\n\t\t\t}\r\n\t\t\tCollections.sort(result);\r\n\t\t\tint cnt = 0;\r\n\t\t\tSystem.out.println(\"#\"+t+\" \"+result.get(result.size()-k));\t\t\t\r\n\t\t}\r\n\t}", "public static int[] RotateByGivenNumber(int[] num, int k) \n\t{\n\t\tif(num == null || num.length == 0 || k < 0)\n\t\t\tthrow new IllegalArgumentException(\"Illegal argument!\");\n\t\t// This will take care of the value of k greater then the length of array\n\t\tif(k > num.length)\n\t\t\tk = k % num.length;\n\t\tint div = num.length - k; // get the remaining segment of the array.\n\t\t//Reverse(num,0,num.length-1); // rotate left side\n\t\tReverse(num,0,div-1); // rotate right side\n\t\tReverse(num,div,num.length-1); // keep in middle to rotate right and left\n\t\tReverse(num,0,num.length-1); // rotate right side\n\t\t//Reverse(num,0,div-1); // rotate left side\n\t\t//for(int e : Reverse(num,0,num.length-1))\n\t\t//\tSystem.out.println(e);\n\t\t\n\t\treturn num;\n\t}", "private static void longestIncPath(int[][] matrix) {\n\t\t \n\t\t int total_elem = matrix.length * (matrix[0].length);\n\t ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>();\n\t int[] outdegree = new int[total_elem];\n\t int[][] dp = new int[matrix.length][matrix[0].length];\n\t int m = matrix[0].length;\n\t \n\t for(int i=0;i<matrix.length;i++){\n\t for(int j=0;j<matrix[0].length;j++){\n\t \tg.add(new ArrayList<Integer>());\n\t }\n\t }\n\t \n\t for(int i=0;i<matrix.length;i++){\n\t for(int j=0;j<matrix[0].length;j++){\n\t \n\t int left=-1;\n\t int right=-1;\n\t int up=-1;\n\t int down=-1;\n\t int curr = matrix[i][j];\n\t if(j-1>=0)\n\t left = matrix[i][j-1]; \n\t if(j+1<matrix[0].length)\n\t right = matrix[i][j+1];\n\t if(i-1>=0)\n\t up=matrix[i-1][j];\n\t if(i+1<matrix.length)\n\t down=matrix[i+1][j];\n\t \n\t if(left!=-1 && curr>left)\n\t addedge(g,(m*i+(j-1)),(m*i+j),outdegree);\n\t if(right!=-1 && curr>right)\n\t addedge(g,(m*i+(j+1)),(m*i+j),outdegree);\n\t if(up!=-1 && curr>up)\n\t addedge(g,(m*(i-1)+j),(m*i+j),outdegree);\n\t if(down!=-1 && curr>down)\n\t addedge(g,(m*(i+1)+j),(m*i+j),outdegree);\n\t \n\t \n\t }\n\t }\n\t \n\t Queue<Integer> q = new LinkedList<Integer>();\n\t \n\t for(int i:outdegree){\n\t if(i==0)\n\t q.add(i);\n\t }\n\t \n\t \n\t while(!q.isEmpty()){\n\t int temp = q.poll();\n\t int r = temp/m;\n\t int c = temp - r*m;\n\t int max=0;\n\t \n\t for(int i:g.get(temp)){\n\t int row = i/m;\n\t int col = i - r*m;\n\t max=Math.max(max,dp[row][col]+1);\n\t outdegree[i]--;\n\t if(outdegree[i]==0)\n\t q.add(i);\n\t }\n\t \n\t dp[r][c]=max;\n\t }\n\t \n\t\t\n\t}", "private static List<List<Integer>> getPermutation(List<Integer> array){\n List<List<Integer>> result = new ArrayList<List<Integer>>();\n getPermutation(array,new ArrayList<>(),result);\n return result;\n }", "private int getGCD(int[] a) {\r\n\r\n int gcd = a[0];\r\n\r\n for (int i = 1; i < a.length; i++) {\r\n gcd = getGCD(gcd, a[i]);\r\n }\r\n return gcd;\r\n }", "@SuppressWarnings(\"unlikely-arg-type\")\r\n\tpublic static void main(String[] args) throws InterruptedException, ExecutionException, IOException {\r\n\t\t// TODO Auto-generated method stub\r\n\r\n\t\t// System.out.println(\"what\");\r\n\t\tint k = 7;\r\n\r\n\t\tchar[] set = { 'a', 'b', 'c' };\r\n\t\tchar[] str = new char[k];\r\n \r\n\t\tenumeratePaths(k, set, str, 0); // call function to generate the paths\r\n\t back_Up();// function to back up set of paths\r\n\t\t\t\t\t\t// information\r\n\t\t \r\n\r\n\t\tint[] lb = new int[R];// lower bound\r\n\t\tint[] ub = new int[R];// upper bound\r\n\r\n\t\tfor (int j = 0; j < R; j++) { // the sample range of integers is between 1 and 100\r\n\t\t\tlb[j] = -1000; // lower bound\r\n\t\t\tub[j] = 1000; // upper bound\r\n\r\n\t\t}\r\n\r\n\t\tfor (int run = 0; run < RUN; run++) {\r\n\r\n\t\t\tint[][] x = new int[pop_num][R];\r\n\t\t\tint[][] v = new int[pop_num][R];\r\n\t\t\t //id = 0;\r\n\t\t\t\r\n\t\t\t//paths.put(new String(str) , false);\r\n\t\t\tobj_total = 0;\r\n\t\t\t group_1_count = 0;\r\n\t\t group_2_count = 0;\r\n\t\t\t group_3_count = 0;\r\n\t\t\t group_4_count = 0;\r\n\t\t\t group_5_count = 0;\r\n\t\t\t group_6_count = 0;\r\n\t\t\t group_7_count = 0;\r\n\t\t\t group_8_count = 0;\r\n\t\t\t group_9_count = 0;\r\n\t\t\t\r\n\t\t\t group_10_count = 0;\r\n\t\t\t group_11_count = 0;\r\n\t\t\t group_12_count = 0;\r\n\t\t\t group_13_count = 0;\r\n\t\t\t group_14_count = 0;\r\n\t\t\t group_15_count = 0;\r\n\t\t\t group_16_count = 0;\r\n\t\t\t group_17_count = 0;\r\n\t\t\t group_18_count = 0;\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t// pick_counter_1 = 0;\r\n\t\t\t \r\n\t\t\t group_19_count = 0;\r\n\t\t\t group_20_count = 0;\r\n\t\t\t group_21_count = 0;\r\n\t\t\t group_22_count = 0;\r\n\t\t\t group_23_count = 0;\r\n\t\t\t group_24_count = 0;\r\n\t\t\t group_25_count = 0;\r\n\t\t\t group_26_count = 0;\r\n\t\t\t group_27_count = 0;\r\n\t\t\t\r\n\t\t\t group_28_count = 0;\r\n\t\t\t group_29_count = 0;\r\n\t\t\t group_30_count = 0;\r\n\t\t\t group_31_count = 0;\r\n\t\t\t group_32_count = 0;\r\n\t\t\t group_33_count = 0;\r\n\t\t\t group_34_count = 0;\r\n\t\t\t group_35_count = 0;\r\n\t\t\t group_36_count = 0;\r\n\t\t\t\r\n\t\t\t group_37_count = 0;\r\n\t group_38_count = 0;\r\n\t\t\t group_39_count = 0;\r\n\t\t\t group_40_count = 0;\r\n\t\t\t group_41_count = 0;\r\n\t\t\t group_42_count = 0;\r\n\t\t\t group_43_count = 0;\r\n\t\t\t group_44_count = 0;\r\n\t\t\t group_45_count = 0;\r\n\t\t\t\r\n\t\t group_46_count = 0;\r\n\t\t\t group_47_count = 0;\r\n\t\t\t group_48_count = 0;\r\n\t\t\t group_49_count = 0;\r\n\t\t\t group_50_count = 0;\r\n\t\t group_51_count = 0;\r\n\t\t\t group_52_count = 0;\r\n\t\t\t group_53_count = 0;\r\n\t\t\t group_54_count = 0;\r\n\t\t\t\r\n\t\t\t group_55_count = 0;\r\n\t\t\t group_56_count = 0;\r\n\t\t\t group_57_count = 0;\r\n\t\t\t group_58_count = 0;\r\n\t\t\t group_59_count = 0;\r\n\t\t\t group_60_count = 0;\r\n\t\t\t group_61_count = 0;\r\n\t\t group_62_count = 0;\r\n\t\t\t group_63_count = 0;\r\n\t\t group_64_count = 0;\r\n\t\t\t\r\n\t\t solution_1 = new int[500][R];\r\n\t\t\t\tsolution_2 = new int[500][R];\r\n\t\t\t\tsolution_3 = new int[500][R];\r\n\t\t\t\tsolution_4 = new int[500][R];\r\n\t\t\t\tsolution_5 = new int[500][R];\r\n\t\t\t\tsolution_6 = new int[500][R];\r\n\t\t\t\tsolution_7 = new int[500][R];\r\n\t\t\t\tsolution_8 = new int[500][R];\r\n\t\t\t\tsolution_9 = new int[500][R];\r\n\t\t\t\tsolution_10 = new int[500][R];\r\n\t\t\t\tsolution_11 = new int[500][R];\r\n\t\t\t\tsolution_12 = new int[500][R];\r\n\t\t\t\tsolution_13 = new int[500][R];\r\n\t\t\t\tsolution_14 = new int[500][R];\r\n\t\t\t\tsolution_15 = new int[500][R];\r\n\t\t\t\tsolution_16 = new int[500][R];\r\n\t\t\t\tsolution_17 = new int[500][R];\r\n\t\t\t\tsolution_18 = new int[500][R];\r\n\t\t\t\tsolution_19 = new int[500][R];\r\n\t\t\t\tsolution_20 = new int[500][R];\r\n\t\t\t\tsolution_21 = new int[500][R];\r\n\t\t\t\tsolution_22 = new int[500][R];\r\n\t\t\t\tsolution_23 = new int[500][R];\r\n\t\t\t\tsolution_24 = new int[500][R];\r\n\t\t\t\tsolution_25 = new int[500][R];\r\n\t\t\t\tsolution_26 = new int[500][R];\r\n\t\t\t\tsolution_27 = new int[500][R];\r\n\t\t\t\tsolution_28 = new int[500][R];\r\n\t\t\t\tsolution_29 = new int[500][R];\r\n\t\t\t\tsolution_30 = new int[500][R];\r\n\t\t\t\tsolution_31 = new int[500][R];\r\n\t\t\t\tsolution_32 = new int[500][R];\r\n\t\t\t\tsolution_33 = new int[500][R];\r\n\r\n\t\t\t\tsolution_34 = new int[500][R];\r\n\t\t\t\tsolution_35 = new int[500][R];\r\n\t\t\t\tsolution_36 = new int[500][R];\r\n\t\t\t\tsolution_37 = new int[500][R];\r\n\t\t\t\tsolution_38 = new int[500][R];\r\n\t\t\t\tsolution_39 = new int[500][R];\r\n\t\t\t\tsolution_40 = new int[500][R];\r\n\t\t\t\tsolution_41 = new int[500][R];\r\n\t\t\t\tsolution_42 = new int[500][R];\r\n\t\t\t\tsolution_43 = new int[500][R];\r\n\t\t\t\tsolution_44 = new int[500][R];\r\n\t\t\t\tsolution_45 = new int[500][R];\r\n\t\t\t\tsolution_46 = new int[500][R];\r\n\t\t\t\tsolution_47 = new int[500][R];\r\n\t\t\t\tsolution_48 = new int[500][R];\r\n\t\t\t\tsolution_49 = new int[500][R];\r\n\t\t\t\tsolution_50 = new int[500][R];\r\n\t\t\t\tsolution_51 = new int[500][R];\r\n\t\t\t\tsolution_52 = new int[500][R];\r\n\t\t\t\tsolution_53 = new int[500][R];\r\n\t\t\t\tsolution_54 = new int[500][R];\r\n\t\t\t\tsolution_55 = new int[500][R];\r\n\t\t\t\tsolution_56 = new int[500][R];\r\n\t\t\t\tsolution_57 = new int[500][R];\r\n\t\t\t\tsolution_58 = new int[500][R];\r\n\t\t\t\tsolution_59 = new int[500][R];\r\n\t\t\t\tsolution_60 = new int[500][R];\r\n\t\t\t\tsolution_61 = new int[500][R];\r\n\t\t\t\tsolution_62 = new int[500][R];\r\n\t\t\t\tsolution_63 = new int[500][R];\r\n\t\t\t\tsolution_64 = new int[500][R];\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t crossover_count = 0;\r\n boolean statusChecker =false;\r\n\t\t\tLinkedHashMap<String, List<Double>> parent_maps = new LinkedHashMap<String, List<Double>>();\r\n\t\t\t\r\n\t\t\tLinkedHashMap<String, List<Double>> offspring_maps = new LinkedHashMap<String, List<Double>>();\r\n\t\t\t\r\n\t\t\tLinkedHashMap<String, List<Double>> combined_maps = new LinkedHashMap<String, List<Double>>();\r\n\t\t//\tLinkedHashMap<String, List<Double>> fitnessmaps = new LinkedHashMap<String, List<Double>>();\r\n\r\n\t\t\tLinkedHashMap<String, Integer> setrank1 = new LinkedHashMap<String, Integer>();\r\n\t\t\r\n\r\n\t\t\tList<String> updated_population = new ArrayList<String>();\r\n\t\t\t\r\n\t\t\tList<String> combined_population = new ArrayList<String>();\r\n\t\t\tList<String> offspring_population = new ArrayList<String>();\r\n\t\t\t//List<String> parent_population = new ArrayList<String>();\r\n\t\t\tList<String> single_population = new ArrayList<String>();\r\n\r\n\t\t\tList<String> combined_population_list = new ArrayList<String>();\r\n\t\t\t\r\n\t\t\tList<String> temporary_path_holder = new ArrayList<String>();\r\n\t\t\t\r\n\t\t\tList<String> parents_population = new ArrayList<String>();\r\n\t\t\t\r\n\t\t\tList<String> parents_population_copy = new ArrayList<String>();\r\n\t\t\t\r\n\t\t//\tString traverse_template;\r\n\r\n\t\t\t// the 2d arrays below hold the solutions to each respective group\r\n\t\t\tint [][] solution = new int[500][R];\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t//\tboolean [] statu = new boolean [PATHNUM];\r\n\t\t\t\t\r\n\r\n\t\t\tint totalpathcounter = 0;\r\n\r\n\t\t\tint obj_total = 0;\r\n\r\n\t\t\tString getfinalpath = null;\r\n\t\t\t//String getfinalpath;\r\n\r\n\t\t\tif (run > 0) { // in each run reset the number counter of the paths covered in each group\r\n\r\n\t\t\t\treset_All();\r\n\t\t\t\tpaths.clear();\r\n\t\t\t\tupdated_population.clear();\r\n\t\t\t\tcombined_population.clear();\r\n\t\t\t\toffspring_population.clear();\r\n\t\t\t\tsingle_population.clear();\r\n\t\t\t\toffspring_maps.clear();\r\n\t\t\t\tsetrank1.clear();\r\n\t\t\t\t//setrank2.clear();\r\n\t\t\t\t//offspring_maps.clear();\r\n\t\t\t\tparents_population_copy.clear();\r\n\t\t\t\tcombined_maps.clear();\r\n\t\t\t\tparent_maps.clear();\r\n\t\t\t\tpaths.putAll(temporay_paths); \r\n\t\t\t}\r\n\r\n\t\t\tfor (int i = 0; i < pop_num; i++) // initialize the population with the dimension of R values/inputs\r\n\t\t\t{\r\n\r\n\t\t\t\tfor (int j = 0; j < R; j++) {\r\n\t\t\t\t\r\n\t\t\t\t\tx[i][j] = (int)(Math.random()*((ub[j] - lb[j])+1))+ lb[j];\r\n\r\n\t\t\t\t} //initial random population\r\n\r\n\t\t\t\tgetfinalpath = pathnum(x[i]); \r\n\t\t\t\t//archiving( String check_path_group , int num, int[][] offspring)\r\n int pickPaths= 0;\r\n\t\t\t\t\r\n\t\t\t\tSet<String> keyz = paths.keySet();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tfor (String key : keyz) {\r\n\r\n\t\t\t\t\tif (pickPaths < 50) { //pick subset of N paths\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttarget_subset.put(key + \" \" + \"new\", false);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tpickPaths++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\r\n\t\t\t\tparents_population.add(\"parent\" + \" \" + i);\r\n\t\t\t\t//record covered path and find group where it belongs\r\n\t\t\t\t//save test case in corresponding path group\r\n\t\t\t\tarchiving( getfinalpath , i, x);\r\n\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\tparents_population_copy.addAll(parents_population);\r\n\t\t\t\r\n\t\t\tcombined_population_list.addAll(parents_population_copy);\t\r\n\t\t\t///offspring_population.addAll(parents_population_copy);\r\n\t\t\t//Cycle[run] = 1;\r\n\r\n\t\t\t\tlong start_time = System.currentTimeMillis();\r\n\t\t\t\tlong wait_time = 1518750;\r\n\t\t\t\tlong end_time = start_time + wait_time;\r\n\t\t\t\tList<Double> temp_2 = new ArrayList<Double>();\r\n\t\t\t\t\r\n\t\t\t // int generation = 0;\r\n\t\t\t\t\r\n\t\t\t\twhile ((System.currentTimeMillis() < end_time) && obj_total < PATHNUM_NUMBER) // not exceeded the set\r\n\r\n\t\t\t\t{\r\n\t\t\t\t//LinkedHashMap<String, List<Double>> parent_maps_init = new LinkedHashMap<String, List<Double>>(); \r\n\t\t\t\t//initial random population tournament selection\r\n\t\t\t\r\n\t\t\t\t\t//List<Double> temp = new ArrayList<Double>();\r\n\t\t\t\t\tif (crossover_count == 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tRandom random = new Random();\r\n\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (int i = 0; i < 25; i++) {\r\n\t\t\t\t\r\n\t\t\t\t\t\t//pick two parents to cross\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tString randomKey_1 = parents_population_copy.get( random.nextInt(parents_population_copy.size())) ;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tparents_population_copy.remove(randomKey_1);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tString randomKey_2 = parents_population_copy.get( random.nextInt(parents_population_copy.size())) ;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tparents_population_copy.remove(randomKey_2);\r\n\t\t\t\t\t\t//access parent via parent_maps_init\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//split the string\r\n\t\t\t\t\t\t//parents_population.add(\"parent\" + \" \" + i);\r\n\t\t\t\t\t\tString [] parent_1_string = randomKey_1.split(\" \");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tString par_1;\r\n\r\n\t\t\t\t\t\tint pos_1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tpar_1 = parent_1_string[0];\r\n\t\t\t\t\t\tpos_1 = Integer.parseInt(parent_1_string[1]);\r\n\t\t\t\t\t\t\r\n // String [] parent_2_string = randomKey_2.split(\" \");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tString [] parent_2_string = randomKey_1.split(\" \");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tString par_2;\r\n\r\n\t\t\t\t\t\tint pos_2;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tpar_2 = parent_2_string[0];\r\n\t\t\t\t\t\tpos_2 = Integer.parseInt(parent_2_string[1]);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t //System.out.println(\"Random number 1 : \"+Math.random()\r\n\t\t\t\t\t\t//crossover nbased on probability\r\n\t\t\t\t \tRandom rand = new Random();\r\n\t\t\t\t\t//\tdouble rdm = rand.nextDouble();\t\t \r\n\t\t\t\t\t\tdouble rdm = Math.random();\r\n\t\t\t\t\t\t if(rdm < 0.75) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//single-point crossover\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \t//randomly find a position and exchange the tails\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\tint parent_1_random = rand.nextInt(R);\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t int new_point = parent_1_random; \r\n\t\t\t\t\t\t //exchange elements with parent_2\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t //\tint[][] temporal = new int[pop_num][R];\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t for (int j = 0 ; j < R; j++) {\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t \tv[pos_1][j] = x[pos_1][j];\r\n\t\t\t\t\t\t \tv[pos_2][j] = x[pos_2][j];\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t}\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t\t int g = new_point;\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t // for (int g = new_point ; new_point < R; new_point++) {\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \twhile (g <= R){\t\r\n\t\t\t\t\t \t\t//switch the tails of parent one and parent two\r\n\t\t\t\t\t\t \tv[pos_1][g] = x[pos_2][g];\r\n\t\t\t\t\t\t \tv[pos_2][g] = x[pos_1][g];\r\n\r\n\t\t\t\t\t \t g++;\r\n\t\t\t\t\t \t}\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tdouble mutate = Math.random();\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t if(mutate < (1/R)) { \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t int child_1 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \tint child_2 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \tv[pos_1][child_1] = (int)(Math.random()*((ub[child_1] - lb[child_1])+1))+ lb[child_1];\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_1);\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \tv[pos_2][child_2] = (int)(Math.random()*((ub[child_2] - lb[child_2])+1))+ lb[child_2]; \r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_2);\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t else {\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t offspring_population.add(\"child\" + \" \" + pos_1);\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t offspring_population.add(\"child\" + \" \" + pos_2);\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t \t\r\n\t\t\t\t\t \t\tfor (int j = 0 ; j < R; j++) {\r\n\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t \t\tv[pos_1][j] = x[pos_1][j];\r\n\t\t\t\t\t\t \t\tv[pos_2][j] = x[pos_2][j];\r\n\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t \t}\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\t//mutate\r\n\t\t\t\t\t \t\t\r\n\r\n\t\t\t\t\t \t// Random mut = new Random();\r\n\t\t\t\t\t\t\t\tdouble mutate = Math.random();\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t if(mutate < (1/R)) { \r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t int child_1 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \tint child_2 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \tv[pos_1][child_1] = (int)(Math.random()*((ub[child_1] - lb[child_1])+1))+ lb[child_1];\r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_1);\r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \tv[pos_2][child_2] = (int)(Math.random()*((ub[child_2] - lb[child_2])+1))+ lb[child_2]; \r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_2);\r\n\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n //mutation (1/size of test case input vector)\r\n\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//get path traversed by offsprings\r\n\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (int i = 0; i < offspring_population.size(); i++) {// initialize the population with the dimension of R values/inputs\r\n\t\t\t\t\r\n\t\t\t\t String [] get_index = offspring_population.get(i).split(\" \");\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t String off_1;\r\n\r\n\t\t\t\t\tint index_1;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\toff_1 = get_index[0];\r\n\t\t\t\t\tindex_1 = Integer.parseInt(get_index[1]);\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tgetfinalpath = pathnum(v[index_1]);\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\tarchiving( getfinalpath , index_1, v);\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\telse {\r\n\t\t\t\t\t \r\n\t\t\t\t\t\r\n\t\t\t\t\t // if ()\r\n\t\t\t\t\t\r\n\t\t\t\t \t\tRandom random = new Random();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//\tLinkedHashMap<String, Boolean> changed_status = new LinkedHashMap<String, Boolean>();\r\n\t\t\t\t\t\t\t//\tLinkedHashMap<String, Boolean> child_status = new LinkedHashMap<String, Boolean>();\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t \t\tparents_population_copy.clear();\r\n\t\t\t\t \t\tfor (int i = 0; i < 50; i++) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tparents_population_copy.add( \"parent\" + \" \" + i);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t \t\t\r\n\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\tfor (int i = 0; i < 25; i++) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tString randomKey_1 = parents_population_copy.get( random.nextInt(parents_population_copy.size())) ;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tparents_population_copy.remove(randomKey_1);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tString randomKey_2 = parents_population_copy.get( random.nextInt(parents_population_copy.size())) ;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tparents_population_copy.remove(randomKey_2);\r\n\t\t\t\t\t\t\t\t\t//access parent via parent_maps_init\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t//split the string\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tString [] parent_1_string = randomKey_1.split(\" \");\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tString par_1;\r\n\r\n\t\t\t\t\t\t\t\t\tint pos_1;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tpar_1 = parent_1_string[0];\r\n\t\t\t\t\t\t\t\t\tpos_1 = Integer.parseInt(parent_1_string[1]);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t // String [] parent_2_string = randomKey_2.split(\" \");\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tString par_2;\r\n\r\n\t\t\t\t\t\t\t\t\tint pos_2;\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tString [] parent_2_string = randomKey_2.split(\" \");\r\n\t\t\t\t\t\t\t\t\tpar_2 = parent_2_string[0];\r\n\t\t\t\t\t\t\t\t\tpos_2 = Integer.parseInt(parent_2_string[1]);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t//crossover nbased on probability\r\n\t\t\t\t\t\t\t\t\tRandom rand = new Random();\r\n\t\t\t\t\t\t\t\t\tdouble rdm = Math.random();\t\t \r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t if(rdm < 0.75) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//single-point crossover\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \t//randomly find a position nad exchange the tails\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\tint parent_1_random = rand.nextInt(R);\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t int single_point = parent_1_random; \r\n\t\t\t\t\t\t\t\t\t //exchange elements with parent_2\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t //\tint[][] temporal = new int[pop_num][R];\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t for (int j = 0 ; j < R; j++) {\r\n\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t\t \tv[pos_1][j] = x[pos_1][j];\r\n\t\t\t\t\t\t\t\t\t \tv[pos_2][j] = x[pos_2][j];\r\n\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t \t}\r\n\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t int s = single_point;\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t while (s <= R) {\r\n\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t \t\t//switch the tails of parent one and parent two\r\n\t\t\t\t\t\t\t\t\t \tv[pos_1][s] = x[pos_2][s];\r\n\t\t\t\t\t\t\t\t\t \tv[pos_2][s] = x[pos_1][s];\r\n\r\n\t\t\t\t\t\t\t\t \t s++;\r\n\t\t\t\t\t\t\t\t \t}\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t \t Random mut = new Random();\r\n\t\t\t\t\t\t\t\t\t\tdouble mutate = Math.random();\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t if(mutate < (1/R)) { \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t int child_1 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \tint child_2 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \tv[pos_1][child_1] = (int)(Math.random()*((ub[child_1] - lb[child_1])+1))+ lb[child_1];\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_1);\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \tv[pos_2][child_2] = (int)(Math.random()*((ub[child_2] - lb[child_2])+1))+ lb[child_2]; \r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_2);\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t else {\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t offspring_population.add(\"child\" + \" \" + pos_1);\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t offspring_population.add(\"child\" + \" \" + pos_2);\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t \t\tfor (int j = 0 ; j < R; j++) {\r\n\t\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t\t \t\tv[pos_1][j] = x[pos_1][j];\r\n\t\t\t\t\t\t\t\t\t \t\tv[pos_2][j] = x[pos_2][j];\r\n\t\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t\t \t}\r\n\t\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t\tdouble mutate = Math.random();\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t if(mutate < (1/R)) { \r\n\t\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t int child_1 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t \tint child_2 = (int) (Math.random() * R);\r\n\t\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t \tv[pos_1][child_1] = (int)(Math.random()*((ub[child_1] - lb[child_1])+1))+ lb[child_1];\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_1);\r\n\t\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t \tv[pos_2][child_2] = (int)(Math.random()*((ub[child_2] - lb[child_2])+1))+ lb[child_2]; \r\n\t\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t \toffspring_population.add(\"child\" + \" \" + pos_2);\r\n\t\t\t\t\t\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t \t}\r\n\t\t\t\r\n\t\t\t\t\t \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor (int i_ = 0; i_ < offspring_population.size(); i_++) {// initialize the population with the dimension of R values/inputs\r\n\t\t\t\t\t\r\n\t\t\t\t\t String [] get_index = offspring_population.get(i_).split(\"\");\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t String off_1;\r\n\r\n\t\t\t\t\t\tint index_1;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\toff_1 = get_index[0];\r\n\t\t\t\t\t\tindex_1 = Integer.parseInt(get_index[1]);\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t \r\n\t\t\t\t\t\tgetfinalpath = pathnum(v[index_1]); //get path traversed by offspring test case \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tarchiving( getfinalpath , i_, v);//add test case to archive\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t //match the paths traversed\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t}\t\r\n\t\t\t\t\tcrossover_count++;\r\n\t\t\t\t\r\n\t\t\t\t\t//combined_population_list.addAll(parents_population_copy);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (int i = 0; i < offspring_population.size(); i++) // add all offpsings to parent and form final combined population\r\n\t\t\t\t\t{\r\n\t\t\t\r\n\t\t\t\t\t\t\tcombined_population_list.add(offspring_population.get(i));\r\n\t\t\t\t }\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tList<String> final_combined_population = new ArrayList<String>();\r\n\r\n\t\t\t\t\t// temp.clear();\r\n\r\n\t\t\t\t\tfinal_combined_population.addAll(combined_population_list);\t\r\n\t\t\t\t\t\r\n\t\t\t\t//fit.add(target_path_+ \" \" + path_status +\" \" + nonsimple_unmatched2);\r\n\t\t\t\t//evaluate parent and child population\r\n\t\t\t\t\tArrayList <String> offspring_fitness = new ArrayList<String>();\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (int i = 0; i < final_combined_population.size(); i++) // contains both parent and offspring test cases\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n String checkString = final_combined_population.get(i);\t\r\n \r\n String [] getType = checkString.split(\" \");\r\n \r\n\t\t\t\t\t\tString typeName = getType[0];\r\n\r\n\t\t\t\t\t\tint typeId = Integer.parseInt(getType[1]);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//\tfit.add(target_path_+ \" \" + path_status +\" \" + nonsimple_unmatched2);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (typeName.equals(\"parent\")) {\r\n\r\n\t\t\t\t\t \toffspring_fitness = benchmarkfunction(x[typeId]);\r\n\t\t\t\t\t \t//extract path and fitness\r\n\t\t\t\t\t \tcheck_fitness.put( \"parent\" + \" \" + typeId , offspring_fitness);\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t \t//static LinkedHashMap<String, ArrayList<String>> check_fitness = new LinkedHashMap<String, ArrayList<String>>();\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t \r\n\t\t\t\t\t\telse {\r\n//\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//fit.add(target_path_+ \" \" + path_status +\" \" + nonsimple_unmatched2);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\toffspring_fitness = benchmarkfunction(v[typeId]);\r\n\t\t\t\t\t\t\tcheck_fitness.put( \"child\" + \" \" + typeId , offspring_fitness);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tint colum_sizes = 0;\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor ( String get_keys : check_fitness.keySet() ) {\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcolum_sizes = ( check_fitness.get(get_keys).size());\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//process remove_objective_routine\r\n\t\t\t\t\t//process map first\r\n\t\t\t\t\t//static LinkedHashMap<String, ArrayList<String>> check_fitness = new LinkedHashMap<String, ArrayList<String>>();\r\n\t\t\t\t\tList<String> average_calculator = new ArrayList<String>();\r\n\t\t\t\t\t\r\n\t\t\t\t//\tint offspring_fitness_size = offspring_fitness.size();\r\n\t\t\t\t\r\n\t\t\t\t//\tIterator<Map.Entry<String, ArrayList<String>>> iteration_ = check_fitness.entrySet()\r\n\t\t\t\t\t\t\t//.iterator();\r\n\t\t\t\t\tString actualpath = \"\";\r\n\t\t\t\t\tString process_1 = \"\";\r\n\t\t\t\t\tString process_2 = \"\";\r\n\t\t\t\t\t\r\n\t\t\t\t\t//String updated_value_2 = \"\";\r\n\t\t\t\t\t//\"child\" + \" \" + typeId , offspring_fitness\r\n\t\t\t\t\t//String updated_value = \"\";\r\n\t\t\t\t\t\r\n//\t\t\t\t\tfit.add(target_path_+ \" \" + path_status +\" \" + nonsimple_unmatched2);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\tint pid = 0;\t\t\r\n\t\t\t\t\t\r\n\t\t\tfor (int i = 0 ; i < colum_sizes; i++ )\t{\r\n\t\t\t\t\t\r\n\t\t\t\tdouble add_objective_scores = 0.0;\r\n\t\t\t\tdouble sum_at_column = 0.0;\r\n\r\n\t\t\t\tfor ( String get_keys : check_fitness.keySet() ) {\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n // int pid = 0;\r\n \r\n\t\t\t\t\t\t//Map.Entry<String, ArrayList<String>> entry = iteration_.next();\r\n\r\n\t\t\t\t\t\taverage_calculator = check_fitness.get(get_keys);\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//entry.getValue();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tString get_objective_score = average_calculator.get(i);\r\n\t\t\t \r\n\t\t\t //calculate average fitness\r\n\t\t\t \r\n\t\t\t\t\t\t//\tupdated_population.add(entry.getKey());\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//50 is the number of test cases\r\n\t\t\t\t\t\t//while (pid < 50) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t///String checkString = final_combined_population.get(i);\t\r\n\t \r\n\t String [] getDetails = get_objective_score.split(\" \");\r\n\t\t\t\t\t\t actualpath = getDetails[0];\r\n double objective_scores = Double.parseDouble(getDetails[1]);\r\n \r\n add_objective_scores = add_objective_scores + objective_scores ;\r\n \r\n //total fitness at colum i\r\n sum_at_column = (add_objective_scores / check_fitness.size());\r\n //get total fitness \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//int old_value = remove_objective[actualpath]\r\n\t\t\t\t\t//if(remove_objective.contiansKey(actualpath))\r\n\t\t\t\t\t\r\n\t\t\t\r\n\t\t\t\t\tfor ( String entry_1 : target_subset.keySet() ) {\t//update path status\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif (entry_1.equals(actualpath)) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t String [] processPath = actualpath.split(\" \");\r\n\t\t\t\t\t\t\t process_1 = processPath[0];\r\n\t\t\t\t\t\t\t process_2 = processPath[1];\r\n\t\t\t\t\t\t\t \r\n\t //Double objective_scores = Double.parseDouble(getDetails[1]);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (process_2.equals(\"new\")) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\ttarget_subset.put(process_1 + \" \" + \"old\" , false );\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tremove_objective.put( actualpath, sum_at_column);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//remove_objective.put( actualpath, max_1 + \" \" + add_objective_scores );\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tdouble previous_value = remove_objective.get(actualpath);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//double get_First = Double.parseDouble(get_Path[0]);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//double get_Second = Double.parseDouble(get_Path[1]);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif ( previous_value > sum_at_column ) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tremove_objective.put( actualpath, sum_at_column);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t// Update status to true\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\ttemporary_path_holder.add(actualpath); \r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tpaths.put(actualpath, true);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\ttarget_subset.remove(actualpath);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t//\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t}\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tArrayList<String> remove_objectives_1 = new ArrayList<String>();\r\n\t\t\t\r\n\t\t\tfor ( String entry_2 : check_fitness.keySet() ) {\t//process test case // update their fitness vectors by deleting the removed objectives\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\tString [] process_to_remove = entry_2.split(\" \");\r\n\t\t\t\t\r\n\t\t\t\tString processes_1 = process_to_remove[0];\r\n\t\t\t\tint index_2 = Integer.parseInt(process_to_remove[1]);\r\n\t\t\t\t\r\n\t\t\t\tremove_objectives_1 = check_fitness.get(entry_2);\r\n\t\t\t\t\r\n\t\t\t\tfor (int i = 0; i < remove_objectives_1.size(); i++) // process the fitness vector and delete the worst values\r\n\t\t\t\t{\r\n\t\t\t\t\t//fit.add(target_path_+ \" \" + path_status +\" \" + nonsimple_unmatched2);\r\n\t\t\t\t\t\r\n\t\t\t\t\t//target_subset.remove(actualpath);\r\n\t\t\t\t\t//temporary_path_holder.add(actualpath); \r\n\t\t\t\t\t\r\n\t\t\t\t\tString [] process_paths_to_remove = remove_objectives_1.get(i).split(\" \");\r\n\t\t\t\t\t\r\n\t\t\t\t\tString process_path_1 = process_paths_to_remove[0];\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (temporary_path_holder.contains(process_path_1) ) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tremove_objectives_1.remove(process_path_1);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tcheck_fitness.put( processes_1 + \" \" + index_2, remove_objectives_1);\r\n\t\t\t\t\r\n\t\t\t\tremove_objectives_1.clear( );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t//target_subset.put(process_1 + \" \" + \"old\" , false );\r\n\t\t\t\r\n\t\t\t Set<String> remainingPath = target_subset.keySet();\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\tfor (String keyss : remainingPath) {\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\t\t String [] get_Remaining = keyss.split(\" \");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t String remaining_1 = get_Remaining[0];\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t still_remaining_targets.add(remaining_1); //back-up set of remaining targets\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t \r\n\t\t\t\t\t\r\n\t\t\t\tif (target_subset.size()!=0)\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tif ((obj_total) == PATHNUM_NUMBER ) { // if all paths covered break out of while loop\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t if ((obj_total) < PATHNUM_NUMBER ) { // if not all paths covered perform\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t if ((target_subset.size() == 1)) { \r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t \t\r\n\t\t\t\t \t LinkedHashMap<String, ArrayList<Double>> updated_maps_ = new LinkedHashMap<String, ArrayList<Double>>();\r\n\t\t\t\t \t\r\n\t\t\t\t\t ArrayList<String> updated_fit_ = new ArrayList<String>();\t\r\n\t\t\t\t\t \r\n\t\t\t\t\t ArrayList<Double> updated_1 = new ArrayList<Double>();\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t \tfor ( String key_10 : check_fitness.keySet() ) {\r\n\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_fit_ = check_fitness.get(key_10);\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tfor (int r= 0; r < updated_fit_.size(); r++) {\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t String [] get_list = updated_fit_.get(r).split(\" \");\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t double objective_score = Double.parseDouble(get_list[2]);\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t updated_1.add(objective_score);\r\n\t\t\t\t\t \t\t}\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_maps_.put(key_10, updated_1);\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_fit_.clear();\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_1.clear();\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t \t\r\n\t\t\t\t \t\r\n\t\t\t\t \tint counter = 0;\r\n\t\t\t\t\t\t\twhile (counter < 50) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t List<Double> value_holder = new ArrayList<Double>();\r\n\t\t\t\t\t\t\t\t List<String> keys = new ArrayList<String>(updated_maps_.keySet());\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t Random rand = new Random();\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t String key_ss = keys.get(rand.nextInt(keys.size()));\r\n\t\t\t\t\t\t\t\t String key_holder = null;\r\n\t\t\t\t\t\t\t\t value_holder.addAll(updated_maps_.get(key_ss));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t double min = value_holder.get(0);\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t value_holder.clear();\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t for (int i = 1 ; i < 10; i++) {\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t String key = keys.get(rand.nextInt(keys.size()));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t value_holder.addAll(updated_maps_.get(key));\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t double checker = value_holder.get(0);\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t if (checker < min) {\r\n\t\t\t\t\t\t min = checker;\r\n\t\t\t\t\t\t key_holder = key;\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t value_holder.clear();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t parents_population_copy.add(key_holder);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t} \r\n\t\t\t\t \t\r\n\t\t\t\t \t\r\n\t\t\t\t\t\r\n\t\t\t\t\t statusChecker = true;\r\n\t\t\t\t }//if only one uncovered path\r\n\t\t\t\t\t\t\r\n\t\t\t\t else { \r\n\t\t\t\t\t if (target_subset.size() > 1) { //if many remaining uncovered paths\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t LinkedHashMap<String, ArrayList<Double>> updated_maps = new LinkedHashMap<String, ArrayList<Double>>();\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t ArrayList<String> updated_fit = new ArrayList<String>();\t\r\n\t\t\t\t\t \r\n\t\t\t\t\t ArrayList<Double> updated_ = new ArrayList<Double>();\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t \tfor ( String key_10 : check_fitness.keySet() ) {\r\n\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_fit = check_fitness.get(key_10);\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tfor (int r= 0; r < updated_fit.size(); r++) {\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t\t\t\t\t String [] get_list = updated_fit.get(r).split(\" \");\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t double objective_score = Double.parseDouble(get_list[2]);\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t updated_.add(objective_score);\r\n\t\t\t\t\t \t\t}\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_maps.put(key_10, updated_);\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_fit.clear();\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\tupdated_.clear();\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t \t\t\r\n\t\t\t\t\t\t\t\t}\t\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t //updated_maps.put(key_10, updated_); perform preference sorting on this map\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t \tint updated_sizes = 0;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tfor ( String get_keys : updated_maps.keySet() ) {\t\r\n\t\t\t\t\t\t\t\t\t updated_sizes = ( updated_maps.get(get_keys).size());\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t} \t\r\n\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\tDouble[][] offspring_fitness_full = new Double[final_combined_population\r\n\t\t\t\t\t\t\t\t\t.size()][updated_sizes]; // n x m matrix of combined parents and offspring test cases\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tint updates = 0;\r\n\r\n\t\t\t\t\t\t\t// List<String> traverse_group = new ArrayList<String>();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//List<String> best_column = new ArrayList<String>();\r\n\t\t\t\t\t\t\tint fitss = 0;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twhile (updates < final_combined_population.size()) {\r\n\r\n\t\t\t\t\t\t\t\tList<Double> fitness_objectives_updated = new ArrayList<Double>();\r\n\t\t\t\t\t\t\t\t// fitness_objectives_updated.clear();\r\n\r\n\t\t\t\t\t\t\t\tfitness_objectives_updated = (updated_maps.get(final_combined_population.get(updates)));\r\n\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\tList<Double> temp_3 = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t// temp.clear();\r\n\r\n\t\t\t\t\t\t\t\ttemp_3.addAll(fitness_objectives_updated);\r\n\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tfor (int ups = 0; ups < temp_3.size(); ups++) {\r\n\r\n\t\t\t\t\t\t\t\t\toffspring_fitness_full[updates][ups] = fitness_objectives_updated.get(ups);\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tfitness_objectives_updated.clear();\r\n\t\t\t\t\t\t\t\tupdates++;\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t \t//check if paths is covered , plus check replaced status\r\n\t\t\t \t// average objective score calculation.....\r\n\t\t\t\t\t\t\t// removing objectives\r\n\t\t\t\t\t\t\t// check current generation vs previous generation\r\n\t\t\t \t// update replaced status in main set of uncovered paths\r\n\t\t\t \r\n\t\t\t \t\r\n\t\t\t \t// update population by replacing the other targets\r\n\t\t\t \t\r\n\t\t\t \t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tList<String> best_column = new ArrayList<String>();\r\n\t\t\t\t\r\n\t\t\t\t\t\t\tint sizes = temp_2.size();\r\n\r\n\t\t\t\t\t\t\t//double row_fit;\r\n\t\t\t\t\t\t\tint colums = 0;\r\n\t\t\t\t\t\t\tString test_case;\r\n\t\t\t\t\t\t\tdouble fit_rowfit;\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\tLinkedHashMap<String, Double> row_getter = new LinkedHashMap<String, Double>();\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twhile (colums < sizes) {\r\n\r\n\t\t\t\t\t\t\t\tfor (int get_row = 0; get_row < (final_combined_population.size()); get_row++) {\r\n\r\n\t\t\t\t\t\t\t\t\tfit_rowfit = (offspring_fitness_full[get_row][colums]);\r\n\r\n\t\t\t\t\t\t\t\t\tdouble row_fitter = fit_rowfit;\r\n\r\n\t\t\t\t\t\t\t\t\trow_getter.put(final_combined_population.get(get_row), row_fitter);\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tMap<String, Double> result = row_getter.entrySet().stream() //get test case with minimum objective score for each objective\r\n\t\t\t\t\t\t\t\t\t\t.sorted(Map.Entry.comparingByValue())\r\n\t\t\t\t\t\t\t\t\t\t.collect(toMap(Map.Entry::getKey, Map.Entry::getValue,\r\n\t\t\t\t\t\t\t\t\t\t\t\t(oldValue, newValue) -> oldValue, LinkedHashMap::new));\r\n\t\t\t\t\t\t\t\t// System.out.println(\"Map yino\" +result );\r\n\r\n\t\t\t\t\t\t\t\tIterator<Map.Entry<String, Double>> best_col = result.entrySet().iterator();\r\n\r\n\t\t\t\t\t\t\t\twhile (best_col.hasNext()) {\r\n\r\n\t\t\t\t\t\t\t\t\tMap.Entry<String, Double> entry = best_col.next();\r\n\r\n\t\t\t\t\t\t\t\t\ttest_case = entry.getKey();\r\n\r\n\t\t\t\t\t\t\t\t\tif (!best_column.contains(test_case)) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tbest_column.add(test_case);\r\n\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tresult.clear();\r\n\t\t\t\t\t\t\t\trow_getter.clear();\r\n\t\t\t\t\t\t\t\tcolums++;\r\n\r\n\t\t\t\t\t\t\t}\r\n \r\n\t\t\t\t\t\t\t//Go straight to computing crowding distance for Font 0\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tint distance_zero;\r\n\r\n\t\t\t\t\t\t\t/************************************************************************************************************************************************************/\r\n\r\n\t\t\t\t\t\t\tdouble[][] distance_matrix_zero = new double[best_column.size()][best_column.size()];\r\n\r\n\t\t\t\t\t\t\tif ((best_column.size()) > 1) {\r\n\r\n\t\t\t\t\t\t\t\tfor (int best = 0; best < (best_column.size()); best++) {\r\n\r\n\t\t\t\t\t\t\t\t\tList<Double> front_0_1 = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\tfront_0_1 = updated_maps.get(best_column.get(best));\r\n\r\n\t\t\t\t\t\t\t\t\tfor (int ind_d = 0; ind_d < best_column.size(); ind_d++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (!((best_column.get(best).equals(best_column.get(ind_d))))) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tList<Double> front_0_2 = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfront_0_2 = updated_maps.get(best_column.get(ind_d));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tdistance_zero = get_count(front_0_1, front_0_2);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tint temp_dis = distance_zero;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tdistance_matrix_zero[best][ind_d] = temp_dis;\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tLinkedHashMap<String, Double> setdistance_zero_2 = new LinkedHashMap<String, Double>();\r\n\r\n\t\t\t\t\t\t\t\tfor (int font_ = 0; font_ < best_column.size(); font_++) {\r\n\r\n\t\t\t\t\t\t\t\t\tdouble zeros = 0.0;\r\n\r\n\t\t\t\t\t\t\t\t\tsetdistance_zero_2.put(best_column.get(font_), zeros);\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tfor (int font_i = 0; font_i < (best_column.size()); font_i++) {\r\n\r\n\t\t\t\t\t\t\t\t\tfor (int font_j = 0; font_j < best_column.size(); font_j++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (!((best_column.get(font_i).equals(best_column.get(font_j))))) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif (setdistance_zero_2.get(best_column\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.get(font_i)) < distance_matrix_zero[font_i][font_j]) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tdouble dis = (distance_matrix_zero[font_i][font_j]);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetdistance_zero_2.put(best_column.get(font_i), dis);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tMap<String, Double> result = setdistance_zero_2.entrySet().stream()\r\n\t\t\t\t\t\t\t\t\t\t.sorted(Map.Entry.comparingByValue())\r\n\t\t\t\t\t\t\t\t\t\t.collect(toMap(Map.Entry::getKey, Map.Entry::getValue,\r\n\t\t\t\t\t\t\t\t\t\t\t\t(oldValue, newValue) -> oldValue, LinkedHashMap::new));\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tfor (Map.Entry<String, Double> entry : result.entrySet()) {\r\n\r\n\t\t\t\t\t\t\t\t\tif (updated_population.size() < pop_num) { //updated_population holds the selected population for next generation\r\n\t\t\t\t\t\t\t\t\t\tupdated_population.add(entry.getKey());\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tresult.clear();\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//updated population has best performing test cases sorted in descending order\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\telse { // process the only item in the best set\r\n\r\n\t\t\t\t\t\t\t\tif (!best_column.isEmpty()) {\r\n\r\n\t\t\t\t\t\t\t\t\tString item_one = best_column.get(0);\r\n\r\n\t\t\t\t\t\t\t\t\tif (updated_population.size() < pop_num) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tupdated_population.add(item_one);\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t//Establish other fonts\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tList<String> fitness_objectives_comparator = new ArrayList<String>();\r\n\t\t\t\t\t\t\t// List<Double> fitness_objectives_p = new ArrayList<Double>();\r\n\t\t\t\t\t\t\t// List<Double> fitness_objectives_q= new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\tfor (int next_front = 0; next_front < final_combined_population.size(); next_front++) {\r\n\r\n\t\t\t\t\t\t\t\tif (!best_column.contains(final_combined_population.get(next_front))) {\r\n\r\n\t\t\t\t\t\t\t\t\tfitness_objectives_comparator.add(final_combined_population.get(next_front));\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ((fitness_objectives_comparator.size()) > 1) {\r\n\r\n\t\t\t\t\t\t\t\tint[] dominateMe = new int[fitness_objectives_comparator.size()];\r\n\r\n\t\t\t\t\t\t\t\t// front[i] contains the list of individuals belonging to the front i\r\n\t\t\t\t\t\t\t\t@SuppressWarnings(\"unchecked\")\r\n\t\t\t\t\t\t\t\tList<Integer>[] front = new List[(fitness_objectives_comparator.size() + 1)];\r\n\r\n\t\t\t\t\t\t\t\t// iDominate[k] contains the list of solutions dominated by k\r\n\r\n\t\t\t\t\t\t\t\t@SuppressWarnings(\"unchecked\")\r\n\t\t\t\t\t\t\t\tList<Integer>[] iDominate = new List[fitness_objectives_comparator.size()];\r\n\r\n\t\t\t\t\t\t\t\tint flagDominate;\r\n\r\n\t\t\t\t\t\t\t\tfor (int i = 0; i < ((front.length)); i++) {\r\n\t\t\t\t\t\t\t\t\tfront[i] = new LinkedList<Integer>();\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tfor (int p = 0; p < fitness_objectives_comparator.size(); p++) {\r\n\t\t\t\t\t\t\t\t\t// Initialize the list of individuals that i dominate and the number\r\n\t\t\t\t\t\t\t\t\t// of individuals that dominate me\r\n\t\t\t\t\t\t\t\t\tiDominate[p] = new LinkedList<Integer>();\r\n\t\t\t\t\t\t\t\t\tdominateMe[p] = 0;\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t// int secondary_size =0 ;\r\n\t\t\t\t\t\t\t\tint N = fitness_objectives_comparator.size();\r\n\t\t\t\t\t\t\t\t// int[][] dominanceChecks = new int[N][N];\r\n\r\n\t\t\t\t\t\t\t\tfor (int p = 0; p < (N - 1); p++) {\r\n\r\n\t\t\t\t\t\t\t\t\tList<Double> fitness_temporary_p = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\tfitness_temporary_p = updated_maps.get((fitness_objectives_comparator.get(p)));\r\n\r\n\t\t\t\t\t\t\t\t\t// secondary_size = fitness_temporary_p.size();\r\n\r\n\t\t\t\t\t\t\t\t\tfor (int q = p + 1; q < N; q++) {\r\n\t\t\t\t\t\t\t\t\t\t// if (p != q) {\r\n\t\t\t\t\t\t\t\t\t\tList<Double> fitness_temporary_q = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\tfitness_temporary_q = updated_maps\r\n\t\t\t\t\t\t\t\t\t\t\t\t.get((fitness_objectives_comparator.get(q)));\r\n\r\n\t\t\t\t\t\t\t\t\t\tflagDominate = frontdominace_Comparison(fitness_temporary_p,\r\n\t\t\t\t\t\t\t\t\t\t\t\tfitness_temporary_q);\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (flagDominate == -1) {\r\n\t\t\t\t\t\t\t\t\t\t\t// System.out.println(\"p---dominates>>>>>\" );\r\n\t\t\t\t\t\t\t\t\t\t\tiDominate[p].add(q);\r\n\t\t\t\t\t\t\t\t\t\t\tdominateMe[q]++;\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\telse if (flagDominate == 1) {\r\n\t\t\t\t\t\t\t\t\t\t\t// System.out.println(\"q---dominates>>>>>\" );\r\n\t\t\t\t\t\t\t\t\t\t\tiDominate[q].add(p);\r\n\t\t\t\t\t\t\t\t\t\t\tdominateMe[p]++;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tList<Double> fitness_temporary_qq = new ArrayList<Double>();\r\n\t\t\t\t\t\t\t\t\t\t\tList<Double> fitness_temporary_pp = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tCollections.sort(fitness_temporary_p);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfitness_temporary_pp.addAll(fitness_temporary_p);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tCollections.sort(fitness_temporary_q);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfitness_temporary_qq.addAll(fitness_temporary_q);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif (fitness_temporary_pp.get(0) < fitness_temporary_qq.get(0)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t// System.out.println(\"p---dominates>>>>>\" );\r\n\t\t\t\t\t\t\t\t\t\t\t\tiDominate[p].add(q);\r\n\t\t\t\t\t\t\t\t\t\t\t\tdominateMe[q]++;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\telse if (fitness_temporary_qq.get(0) < fitness_temporary_pp.get(0)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t// System.out.println(\"q---dominates>>>>>\" );\r\n\t\t\t\t\t\t\t\t\t\t\t\tiDominate[q].add(p);\r\n\t\t\t\t\t\t\t\t\t\t\t\tdominateMe[p]++;\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tfor (int p = 0; p < ((fitness_objectives_comparator.size())); p++) {\r\n\r\n\t\t\t\t\t\t\t\t\tif (dominateMe[p] == 0) {\r\n\t\t\t\t\t\t\t\t\t\tfront[0].add(p);\r\n\r\n\t\t\t\t\t\t\t\t\t\t// setrank.put(Integer.parseInt(fitness_objectives_comparator.get(p)), 1);\r\n\t\t\t\t\t\t\t\t\t\tint val = 0;\r\n\t\t\t\t\t\t\t\t\t\tsetrank1.put(fitness_objectives_comparator.get(p), val);\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\r\n/*****************************************************************************************************************************************************************************************/\r\n\r\n\t\t\t\t\t\t\t\tint font_s = 0;\r\n\t\t\t\t\t\t\t\t// if((front[font_s].size() != 0)) {\r\n\r\n\t\t\t\t\t\t\t\tIterator<Integer> it1, it2; // Iterators\r\n\t\t\t\t\t\t\t\twhile (front[font_s].size() != 0) {\r\n\t\t\t\t\t\t\t\t\t/// System.out.println(\"we got here\" + front[font_s]);\r\n\t\t\t\t\t\t\t\t\tfont_s++;\r\n\t\t\t\t\t\t\t\t\tit1 = front[font_s - 1].iterator();\r\n\t\t\t\t\t\t\t\t\twhile (it1.hasNext()) {\r\n\t\t\t\t\t\t\t\t\t\tit2 = iDominate[(it1.next())].iterator();\r\n\t\t\t\t\t\t\t\t\t\twhile (it2.hasNext()) {\r\n\t\t\t\t\t\t\t\t\t\t\tint index = it2.next();\r\n\t\t\t\t\t\t\t\t\t\t\tdominateMe[index]--;\r\n\t\t\t\t\t\t\t\t\t\t\tif (dominateMe[index] == 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tfront[font_s].add(index);\r\n\t\t\t\t\t\t\t\t\t\t\t\t// System.out.println(\"Block_1: \" +front[font_s]);\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetrank1.put(fitness_objectives_comparator.get(index), font_s);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tLinkedHashMap<String, Double> setdistance = new LinkedHashMap<String, Double>();\r\n\r\n\t\t\t\t\t\t\t\tLinkedHashMap<String, Double> setdistance_one = new LinkedHashMap<String, Double>();\r\n\r\n\t\t\t\t\t\t\t\tMap<Integer, ArrayList<String>> reverseMap = new HashMap<>();\r\n\r\n\t\t\t\t\t\t\t\tfor (Map.Entry<String, Integer> entry : setrank1.entrySet()) {\r\n\t\t\t\t\t\t\t\t\tif (!reverseMap.containsKey(entry.getValue())) {\r\n\t\t\t\t\t\t\t\t\t\treverseMap.put(entry.getValue(), new ArrayList<>());\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tArrayList<String> keys = reverseMap.get(entry.getValue());\r\n\t\t\t\t\t\t\t\t\tkeys.add(entry.getKey());\r\n\t\t\t\t\t\t\t\t\treverseMap.put(entry.getValue(), keys);\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t// process fonts\r\n\r\n\t\t\t\t\t\t\t\tint smaller;\r\n\t\t\t\t\t\t\t\tint smaller_one;\r\n\t\t\t\t\t\t\t//\tint remaining;\r\n\t\t\t\t\t\t\t\t// int smaller_two;\r\n\r\n\t\t\t\t\t\t\t\tint fronts = 0;\r\n\t\t\t\t\t\t\t\t// System.out.println(\"map's size\" + reverseMap.size());\r\n\t\t\t\t\t\t\t\twhile (fronts < (reverseMap.size())) {\r\n\r\n\t\t\t\t\t\t\t\t\t// if (updated_population.size()== pop_num) {\r\n\t\t\t\t\t\t\t\t\t// break;\r\n\t\t\t\t\t\t\t\t\t// }\r\n\r\n\t\t\t\t\t\t\t\t\tif (fronts != (reverseMap.size() - 1)) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tList<String> front_list = new ArrayList<String>();\r\n\r\n\t\t\t\t\t\t\t\t\t\tfront_list = reverseMap.get(fronts);\r\n\r\n\t\t\t\t\t\t\t\t\t\tif ((front_list.size()) > 1) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tdouble[][] distance_matrix = new double[front_list.size()][front_list\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.size()];\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (int ind_d = 0; ind_d < (front_list.size()); ind_d++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tList<Double> front_getter1 = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tfront_getter1 = updated_maps.get((front_list.get(ind_d)));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tfor (int d = 0; d < front_list.size(); d++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (!(front_list.get(ind_d).equals(front_list.get(d)))) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tList<Double> front_getter2 = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfront_getter2 = updated_maps.get((front_list.get(d)));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsmaller = get_count(front_getter1, front_getter2);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tint sma = smaller;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdistance_matrix[ind_d][d] = sma;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (int font_ = 0; font_ < front_list.size(); font_++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tdouble valz = 0.0;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tsetdistance.put(front_list.get(font_), valz);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t// all distances set\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (int font_i = 0; font_i < (front_list.size()); font_i++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t// distance_matrix\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tfor (int font_j = 0; font_j < front_list.size(); font_j++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (!(front_list.get(font_i).equals(front_list.get(font_j)))) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (setdistance.get(front_list\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.get(font_i)) < distance_matrix[font_i][font_j]) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdouble dist = (distance_matrix[font_i][font_j]);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetdistance.put(front_list.get(font_i), dist);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tMap<String, Double> result = setdistance.entrySet().stream()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.sorted(Map.Entry.comparingByValue())\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.collect(toMap(Map.Entry::getKey, Map.Entry::getValue,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(oldValue, newValue) -> oldValue, LinkedHashMap::new));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tIterator<Map.Entry<String, Double>> iteration = result.entrySet()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.iterator();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\twhile (iteration.hasNext()) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tMap.Entry<String, Double> entry = iteration.next();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (updated_population.size() < pop_num) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdated_population.add(entry.getKey());\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tresult.clear();\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tString best_1;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tbest_1 = front_list.get(0);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif (updated_population.size() < (pop_num)) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tupdated_population.add(best_1);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\tif (fronts == (reverseMap.size() - 1)) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tList<String> front_list_one = new ArrayList<String>();\r\n\r\n\t\t\t\t\t\t\t\t\t\tfront_list_one = reverseMap.get(reverseMap.size() - 1);\r\n\r\n\t\t\t\t\t\t\t\t\t\t// System.out.println(\"hahahq\" +front_list_one);\r\n\r\n\t\t\t\t\t\t\t\t\t\tdouble[][] distance_matrix_one = new double[front_list_one\r\n\t\t\t\t\t\t\t\t\t\t\t\t.size()][front_list_one.size()];\r\n\r\n\t\t\t\t\t\t\t\t\t\tfor (int ind_w = 0; ind_w < (front_list_one.size()); ind_w++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tList<Double> front_getter_one = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfront_getter_one = updated_maps.get((front_list_one.get(ind_w)));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (int dw = 0; dw < front_list_one.size(); dw++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (!(front_list_one.get(ind_w).equals(front_list_one.get(dw)))) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tList<Double> front_getter_two = new ArrayList<Double>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfront_getter_two = updated_maps.get((front_list_one.get(dw)));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsmaller_one = get_count(front_getter_one, front_getter_two);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tint sm = smaller_one;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tdistance_matrix_one[ind_w][dw] = sm;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tfor (int font_ = 0; font_ < front_list_one.size(); font_++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tdouble dit = 0.0;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tsetdistance_one.put(front_list_one.get(font_), dit);\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t// all distances set\r\n\r\n\t\t\t\t\t\t\t\t\t\tfor (int font_i = 0; font_i < (front_list_one.size()); font_i++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (int font_j = 0; font_j < front_list_one.size(); font_j++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (!(front_list_one.get(font_i)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.equals(front_list_one.get(font_j)))) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (setdistance_one.get(front_list_one\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.get(font_i)) < distance_matrix_one[font_i][font_j]) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdouble dst = (distance_matrix_one[font_i][font_j]);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetdistance_one.put(front_list_one.get(font_i), dst);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\tint remaining_ = (pop_num - updated_population.size());\r\n\r\n\t\t\t\t\t\t\t\t\t\tif (setdistance_one.size() <= remaining_) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tMap<String, Double> result = setdistance_one.entrySet().stream()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.sorted(Map.Entry.comparingByValue())\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.collect(toMap(Map.Entry::getKey, Map.Entry::getValue,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(oldValue, newValue) -> oldValue, LinkedHashMap::new));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tIterator<Map.Entry<String, Double>> iteration = result.entrySet()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.iterator();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\twhile (iteration.hasNext()) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tMap.Entry<String, Double> entry = iteration.next();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (updated_population.size() < pop_num) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdated_population.add(entry.getKey());\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t// System.out.println( \"remaining---\" +remaining);\r\n\t\t\t\t\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tMap<String, Double> sortedByValueDesc = setdistance_one.entrySet()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.stream()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.sorted(Map.Entry.<String, Double>comparingByValue().reversed())\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.collect(toMap(Map.Entry::getKey, Map.Entry::getValue,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(e1, e2) -> e1, LinkedHashMap::new));\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tList<String> front_remove = new ArrayList<String>();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tSet<String> keytest = sortedByValueDesc.keySet();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tint final_size = sortedByValueDesc.size();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t// while(sortedByValueDesc.size() > remaining) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (String keysss : keytest) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (final_size > remaining_) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfront_remove.add(keysss);\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\telse {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\tfinal_size--;\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t// System.out.println( \"sorted map after---\" +sortedByValueDesc.size());\r\n\t\t\t\t\t\t\t\t\t\t\tSet<String> keytests = sortedByValueDesc.keySet();\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tfor (String key_sss : keytests) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (updated_population.size() < pop_num) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (!front_remove.contains(key_sss)) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdated_population.add(key_sss);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\tsetdistance.clear();\r\n\t\t\t\t\t\t\t\t\tsetdistance_one.clear();\r\n\r\n\t\t\t\t\t\t\t\t\tfronts++;\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tif (!fitness_objectives_comparator.isEmpty()) {\r\n\r\n\t\t\t\t\t\t\t\t\tif (updated_population.size() < pop_num) {\r\n\r\n\t\t\t\t\t\t\t\t\t\tString get_item = (fitness_objectives_comparator.get(0));\r\n\r\n\t\t\t\t\t\t\t\t\t\tupdated_population.add(get_item);\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n}\r\n}\r\n}}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t \t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tcatch(IndexOutOfBoundsException e) {}\r\n\r\n\t\t\t\t\t\t\t//updated_population.clear();\r\n\t\t\t\t\t\t\tcombined_population.clear();\r\n\t\t\t\t\t\t\t//combined_population2.clear();\r\n\t\t\t\t\t\t\tsetrank1.clear();\r\n\t\t\t\t\t\t\t//setrank2.clear();\r\n\t\t\t\t\t\t\t//setrank3.clear();\r\n\t\t\t\t\t\t\tcombined_maps.clear();\r\n\t\t\t\t\t\t\t//child_maps.clear();\r\n\r\n\t\t\t\t\t\t\r\n Set<String> add_target = paths.keySet();\r\n\t \t\r\n\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t \tint true_count = 0;\r\n\t \t// get status of removal\r\n\t \tfor (String key_ss : add_target) { \r\n\t \t\r\n\t \t//pick path whose status is false\r\n\t \t\tif ( paths.get(key_ss) ){\r\n\t \t\t\t\r\n\t \t\t\t true_count++;\r\n\t \t\t}\r\n\t \t\t\r\n\t \t\telse {\r\n\t \t\t\t\r\n\t \t\t\tbreak;\r\n\t \t\t}\r\n\t \t \t \r\n\t \t} \r\n\t \t\r\n\t \tif ( true_count == paths.size() ) {\r\n\t \t\t\r\n\t \t\t//if all paths have true as replaced status\r\n\t \t\t\r\n\t \t\t//set them to false\r\n\t \t\t\r\n\t \t\t//pick subset of paths not previously removed at previous generation\r\n\t \t\r\n\t \t\tSet<String> add_new_entry = paths.keySet();\r\n\t \t \t\r\n\t \t \t//replaced_status_2.put(id + new String(str), false);\r\n\t \t \tint entry_count = 0;\r\n\t \t \t// get status of removal\r\n\t \t \tfor (String enrty_ss : add_new_entry ) { \r\n\t \t\t\r\n\t \t \t\t paths.put(enrty_ss , false);\r\n\t \t \t\t\r\n\t \t \t}\r\n\t \t \t\r\n\t \t \tif (paths.size() > 50) {\r\n\t \t \t\r\n\t \t \tint counter_add_paths = 0;\r\n\t \t \t\t\r\n Set<String> add_target_from_Path_1 = paths.keySet();\r\n\t\t \t\r\n\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t \t\r\n\t\t \t// get status of removal\r\n\t\t \t for (String from_Path_1: add_target_from_Path_1) {\r\n\t \t \t\r\n\t \t \t\r\n\t \t \t\r\n\t \t\t if (still_remaining_targets.contains(from_Path_1) ) {\r\n\t \t \t\t\r\n\t \t \t\t continue;\r\n\t \t \t }\r\n\t \t\t\r\n\t \t\t else {\r\n\t \t\t\t \r\n\t \t\t\t \r\n\t \t\t\t if (counter_add_paths < 50) {\r\n\t \t\t\t\r\n\t \t\t\t if ( !temporary_path_holder.contains(from_Path_1) ){\r\n\t \t \t \t\t\r\n\t \t\t\t\t target_subset.put(from_Path_1 + \" \" + \"new\", false);\r\n\t\t \t \t\t\t\r\n\t \t\t\t\t counter_add_paths++;\r\n\t \t\t\t\t \r\n\t \t\t\t\t// retrieve test case from archive\r\n\t\t \t \t\t\t//updatePopulation(from_Path_1)..//return test case not previously added to temporary population\r\n\t \t\t\t\t \r\n\t\t \t \t\t}\r\n\t \t\t\t\r\n\t \t\t\t }\r\n\t \t\t\r\n\t \t\t\t\r\n\t \t\t\t\r\n\t \t\t }\r\n\t \t\t \r\n\t\t \t \r\n\t\t \t }\r\n\t \t \t}\r\n\t\t \t \r\n\t\t \t else {\r\n\t\t \t \t \r\n\t\t \t \t \r\n\t\t \t \tSet<String> add_target_from_Path_7 = paths.keySet();\r\n\t\t\t \t\r\n\t\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t\t \t\r\n\t\t\t \t// get status of removal\r\n\t\t\t \t for (String from_Path_7: add_target_from_Path_7) { // contains(Object)\r\n\t\t\t \t\r\n\t\t\t \t //get current path set..the paths already in subset should not be picked again....\r\n\t\t\t \t\t\r\n\t\t\t \t \t//\ttarget_subset.put(key + \" \" + \"new\", false);\t\r\n\t\t\t \t \t\r\n\t\t\t if (still_remaining_targets.contains(from_Path_7) ) {\r\n\t\t\t\t\t \t \t\t\r\n\t\t\t\t\t \t \t\tcontinue;\r\n\t\t\t\t\t \t \t}\r\n\t\t\t else { \r\n\t \t \t\tif ( !temporary_path_holder.contains(from_Path_7) ){\r\n\t \t \t\t\t\r\n\t \t \t\t\ttarget_subset.put(from_Path_7 + \" \" + \"new\", false);\r\n\t \t \t\t\t\r\n\t \t \t\t\t// retrieve test case from archive\r\n\t \t \t\t// retrieve test case from archive\r\n\t \t \t\t\t//updatePopulation(from_Path_7)..//return test case not previously added to temporary population\r\n\t \t \t\t}}\r\n\t\t \t \t \r\n\t\t\t \t }\t \r\n\t\t \t \t \r\n\t\t \t \t \r\n\t\t \t }\r\n\t }\r\n\t \t\t\r\n\t \telse {\r\n\t \t\t\r\n\t \t\t// pick paths with false status and add them to subset of targets\r\n\t \t\t\r\n\t \t\tint path_to_add_counter = 0;\r\n\t \t\t\r\n\t \tif (paths.size() > 50) {\r\n\t \t\tSet<String> add_target_from_Path = paths.keySet();\r\n\t\t \t\r\n\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t \t\r\n\t\t \t// get status of removal\r\n\t\t \t for (String from_Path: add_target_from_Path) { // contains(Object)\r\n\t\t \t\r\n\t\t \t //get current path set..the paths already in subset should not be picked again....\r\n\t\t \t\t\r\n\t\t \t \t//\ttarget_subset.put(key + \" \" + \"new\", false);\t\r\n\t\t \t \t\r\n\t\t \t \t\tif (still_remaining_targets.contains(from_Path) ) {\r\n\t\t\t\t \t \t\t\r\n\t\t\t\t \t \t\tcontinue;\r\n\t\t\t\t \t \t}\r\n\t\t \t \t\t\telse {\t\r\n\t\t \t \t\t\r\n\t\t \t \t\t if (path_to_add_counter < 50) {\r\n\t\t \t \t\t \r\n\t\t \t \t if ( !paths.get(from_Path) && (!temporary_path_holder.contains(from_Path) ) ){\r\n\t\t \t \t\t\r\n\t\t \t \t\t target_subset.put(from_Path + \" \" + \"new\", false);\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\tpath_to_add_counter++;\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t// retrieve test case from archive\r\n\t\t \t \t\t// retrieve test case from archive\r\n\t\t \t \t\t\t//updatePopulation(from_Path)..//return test case not previously added to temporary population\r\n\t\t \t \t\t }\r\n\t\t \t \t\t \r\n\t\t \t \t\t \r\n\t\t \t \t\t}\r\n\t\t \t \t\t\t}\r\n\t\t \t \t}\r\n\t \t}\r\n\t \t\r\n\t \t\r\n\t\t \t else {\r\n\t\t \t \t\t \r\n\t\t \t \t\tSet<String> add_target_from_Path_4 = paths.keySet();\r\n\t\t\t\t \t\r\n\t\t\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t\t\t \t\r\n\t\t\t\t \t// get status of removal\r\n\t\t\t\t \t for (String from_Path_4: add_target_from_Path_4) { // contains(Object)\r\n\t\t\t\t \t\r\n\t\t\t\t \t //get current path set..the paths already in subset should not be picked again....\r\n\t\t\t\t \t\t\r\n\t\t\t\t \t \t//\ttarget_subset.put(key + \" \" + \"new\", false);\t\r\n\t\t\t\t \t \t\r\n\t\t\t\t \r\n\t\t\t\t \t \t\t\tif (still_remaining_targets.contains(from_Path_4) ) {\r\n\t\t\t\t\t\t \t \t\t\r\n\t\t\t\t\t\t \t \t\tcontinue;\r\n\t\t\t\t\t\t \t \t}\r\n\t\t \t \t\t \r\n\t\t\t\t \t \t\t\telse {\r\n\t\t \t \t\t\t\r\n\t\t \t \t\tif ( !paths.get(from_Path_4) && (!temporary_path_holder.contains(from_Path_4) ) ){\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\ttarget_subset.put(from_Path_4 + \" \" + \"new\", false);\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t// retrieve test case from archive\r\n\t\t \t \t\t\t//updatePopulation(from_Path_4)..//return test case not previously added to temporary population\r\n\t\t \t \t\t}}\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t}\r\n\t\t \t \t}\r\n\t\t \t\r\n\t \t}\r\n\t \t\r\n\t \t\r\n\t \tparents_population_copy.clear();\r\n\t \t\r\n\t \tfor (int i = 0; i < 50 ; i++) // updated population \r\n\t \t\t\t{\r\n\r\n\t \t\t\t\t//for (int j = 0; j < R; j++) {\r\n\t \t\t\t\t\r\n\t \t\t\t\t//\tx[i][j] = (int)(Math.random()*((ub[j] - lb[j])+1))+ lb[j];\r\n\r\n\t \t\t\t\t//update set x\r\n\t \t\t\t\tparents_population_copy.add(\"parent\" + \" \" + i);\r\n\t \t\r\n\t \t\r\n\t \t\r\n\t \t\r\n\t\t\t\t}\r\n\t \t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\telse { //proceed to add paths if subset of target objectives is empty\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n Set<String> add_target = paths.keySet();\r\n\t \t\r\n\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t \tint true_count = 0;\r\n\t \t// get status of removal\r\n\t \tfor (String key_ss : add_target) { \r\n\t \t\r\n\t \t//pick path whose status is false\r\n\t \t\tif ( paths.get(key_ss) ){\r\n\t \t\t\t\r\n\t \t\t\t true_count++;\r\n\t \t\t}\r\n\t \t\t\r\n\t \t\telse {\r\n\t \t\t\t\r\n\t \t\t\tbreak;\r\n\t \t\t}\r\n\t \t \t \r\n\t \t} \r\n\t \t\r\n\t \tif ( true_count == paths.size() ) {\r\n\t \t\t\r\n\t \t\t//if all paths have true as replaced status\r\n\t \t\t\r\n\t \t\t//set them to false\r\n\t \t\t\r\n\t \t\t//pick subset of paths not previously removed at previous generation\r\n\t \t\r\n\t \t\tSet<String> add_new_entry = paths.keySet();\r\n\t \t \t\r\n\t \t \t//replaced_status_2.put(id + new String(str), false);\r\n\t \t \tint entry_count = 0;\r\n\t \t \t// get status of removal\r\n\t \t \tfor (String enrty_ss : add_new_entry ) { \r\n\t \t\t\r\n\t \t \t\t paths.put(enrty_ss , false);\r\n\t \t \t\t\r\n\t \t \t}\r\n\t \t \t\r\n\t \t \tif (paths.size() > 50) {\r\n\t \t \t\r\n\t \t \tint counter_add_paths = 0;\r\n\t \t \t\t\r\n Set<String> add_target_from_Path_1 = paths.keySet();\r\n\t\t \t\r\n\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t \t\r\n\t\t \t// get status of removal\r\n\t\t \t for (String from_Path_1: add_target_from_Path_1) {\r\n\t \t \t\r\n\t \t \t\r\n\t \t \t\r\n\t \t\t if (still_remaining_targets.contains(from_Path_1) ) {\r\n\t \t \t\t\r\n\t \t \t\t continue;\r\n\t \t \t }\r\n\t \t\t\r\n\t \t\t else {\r\n\t \t\t\t \r\n\t \t\t\t \r\n\t \t\t\t if (counter_add_paths < 50) {\r\n\t \t\t\t\r\n\t \t\t\t if ( !temporary_path_holder.contains(from_Path_1) ){\r\n\t \t \t \t\t\r\n\t \t\t\t\t target_subset.put(from_Path_1 + \" \" + \"new\", false);\r\n\t\t \t \t\t\t\r\n\t \t\t\t\t counter_add_paths++;\r\n\t \t\t\t\t \r\n\t \t\t\t\t// retrieve test case from archive\r\n\t\t \t \t\t\t//updatePopulation(from_Path_1)..//return test case not previously added to temporary population\r\n\t \t\t\t\t \r\n\t\t \t \t\t}\r\n\t \t\t\t\r\n\t \t\t\t }\r\n\t \t\t\r\n\t \t\t\t\r\n\t \t\t\t\r\n\t \t\t }\r\n\t \t\t \r\n\t\t \t \r\n\t\t \t }\r\n\t \t \t}\r\n\t\t \t \r\n\t\t \t else {\r\n\t\t \t \t \r\n\t\t \t \t \r\n\t\t \t \tSet<String> add_target_from_Path_7 = paths.keySet();\r\n\t\t\t \t\r\n\t\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t\t \t\r\n\t\t\t \t// get status of removal\r\n\t\t\t \t for (String from_Path_7: add_target_from_Path_7) { // contains(Object)\r\n\t\t\t \t\r\n\t\t\t \t //get current path set..the paths already in subset should not be picked again....\r\n\t\t\t \t\t\r\n\t\t\t \t \t//\ttarget_subset.put(key + \" \" + \"new\", false);\t\r\n\t\t\t \t \t\r\n\t\t\t if (still_remaining_targets.contains(from_Path_7) ) {\r\n\t\t\t\t\t \t \t\t\r\n\t\t\t\t\t \t \t\tcontinue;\r\n\t\t\t\t\t \t \t}\r\n\t\t\t else { \r\n\t \t \t\tif ( !temporary_path_holder.contains(from_Path_7) ){\r\n\t \t \t\t\t\r\n\t \t \t\t\ttarget_subset.put(from_Path_7 + \" \" + \"new\", false);\r\n\t \t \t\t\t\r\n\t \t \t\t\t// retrieve test case from archive\r\n\t \t \t\t// retrieve test case from archive\r\n\t \t \t\t\t//updatePopulation(from_Path_7)..//return test case not previously added to temporary population\r\n\t \t \t\t}}\r\n\t\t \t \t \r\n\t\t\t \t }\t \r\n\t\t \t \t \r\n\t\t \t \t \r\n\t\t \t }\r\n\t }\r\n\t \t\t\r\n\t \telse {\r\n\t \t\t\r\n\t \t\t// pick paths with false status and add them to subset of targets\r\n\t \t\t\r\n\t \t\tint path_to_add_counter = 0;\r\n\t \t\t\r\n\t \tif (paths.size() > 50) {\r\n\t \t\tSet<String> add_target_from_Path = paths.keySet();\r\n\t\t \t\r\n\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t \t\r\n\t\t \t// get status of removal\r\n\t\t \t for (String from_Path: add_target_from_Path) { // contains(Object)\r\n\t\t \t\r\n\t\t \t //get current path set..the paths already in subset should not be picked again....\r\n\t\t \t\t\r\n\t\t \t \t//\ttarget_subset.put(key + \" \" + \"new\", false);\t\r\n\t\t \t \t\r\n\t\t \t \t\tif (still_remaining_targets.contains(from_Path) ) {\r\n\t\t\t\t \t \t\t\r\n\t\t\t\t \t \t\tcontinue;\r\n\t\t\t\t \t \t}\r\n\t\t \t \t\t\telse {\t\r\n\t\t \t \t\t\r\n\t\t \t \t\t if (path_to_add_counter < 50) {\r\n\t\t \t \t\t \r\n\t\t \t \t if ( !paths.get(from_Path) && (!temporary_path_holder.contains(from_Path) ) ){\r\n\t\t \t \t\t\r\n\t\t \t \t\t target_subset.put(from_Path + \" \" + \"new\", false);\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\tpath_to_add_counter++;\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t// retrieve test case from archive\r\n\t\t \t \t\t// retrieve test case from archive\r\n\t\t \t \t\t\t//updatePopulation(from_Path)..//return test case not previously added to temporary population\r\n\t\t \t \t\t }\r\n\t\t \t \t\t \r\n\t\t \t \t\t \r\n\t\t \t \t\t}\r\n\t\t \t \t\t\t}\r\n\t\t \t \t}\r\n\t \t}\r\n\t \t\r\n\t \t\r\n\t\t \t else {\r\n\t\t \t \t\t \r\n\t\t \t \t\tSet<String> add_target_from_Path_4 = paths.keySet();\r\n\t\t\t\t \t\r\n\t\t\t\t \t//replaced_status_2.put(id + new String(str), false);\r\n\t\t\t\t \t\r\n\t\t\t\t \t// get status of removal\r\n\t\t\t\t \t for (String from_Path_4: add_target_from_Path_4) { // contains(Object)\r\n\t\t\t\t \t\r\n\t\t\t\t \t //get current path set..the paths already in subset should not be picked again....\r\n\t\t\t\t \t\t\r\n\t\t\t\t \t \t//\ttarget_subset.put(key + \" \" + \"new\", false);\t\r\n\t\t\t\t \t \t\r\n\t\t\t\t \r\n\t\t\t\t \t \t\t\tif (still_remaining_targets.contains(from_Path_4) ) {\r\n\t\t\t\t\t\t \t \t\t\r\n\t\t\t\t\t\t \t \t\tcontinue;\r\n\t\t\t\t\t\t \t \t}\r\n\t\t \t \t\t \r\n\t\t\t\t \t \t\t\telse {\r\n\t\t \t \t\t\t\r\n\t\t \t \t\tif ( !paths.get(from_Path_4) && (!temporary_path_holder.contains(from_Path_4) ) ){\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\ttarget_subset.put(from_Path_4 + \" \" + \"new\", false);\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t// retrieve test case from archive\r\n\t\t \t \t\t\t//updatePopulation(from_Path_4)..//return test case not previously added to temporary population\r\n\t\t \t \t\t}}\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t\t\r\n\t\t \t \t\t}\r\n\t\t \t \t}\r\n\t\t \t\r\n\t \t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t \t\r\n\t \t\r\n\t\t\t\tString updated_id;\r\n\r\n\t\t\t\tint updated_val;\r\n\r\n\t\t\t\t// int rem;\r\n\r\n\t\t\t\tfor (int pop = 0; pop < updated_population.size(); pop++) {\r\n\r\n\t\t\t\t\tif (pop == 50) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tString[] updated_pop = (updated_population.get(pop).split(\" \"));\r\n\t\t\t\t\tupdated_id = updated_pop[0];\r\n\t\t\t\t\tupdated_val = Integer.parseInt(updated_pop[1]);\r\n\r\n\t\t\t\t\tif (updated_id.equals(\"parent\")) {\r\n\t\t\t\t\t\tfor (int update_parent = 0; update_parent < R; update_parent++) {\r\n\t\t\t\t\t\t\t// x[i][j] = v[i][j] ;\r\n\r\n\t\t\t\t\t\t\tx[pop][update_parent] = x[updated_val][update_parent];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (updated_id.equals(\"child\")) {\r\n\t\t\t\t\t\tfor (int update_child = 0; update_child < R; update_child++) {\r\n\t\t\t\t\t\t\t// x[i][j] = v[i][j] ;\r\n\r\n\t\t\t\t\t\t\tx[pop][update_child] = v[updated_val][update_child];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t \t\r\n\t \t\r\n\t\t\t\t} \t\r\n\t // \tremoved_at_previous_iteration.clear();\r\n\t\t\t\t//}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t//\tfor (Map.Entry<String, ArrayList<String>> entry : names.entrySet()) {\r\n\t\t\t\t//\tString key = entry.getKey();\r\n\t\t\t\t//\tArrayList<String> value = entry.getValue();\r\n\t\t\t\t//\t}\r\n\r\n\t\t\t\r\n\t\t//\tSystem.out.println(\"NO. of cycles=\" + (Cycle[run] - 1)); // ���Number of Cycle\r\n\t\t\tcoverage[run] = obj_total * 100 / PATHNUM_NUMBER ; // percentage of paths covered per run\r\n\t\t\tSystem.out.println(\"Path coverage=\" + coverage[run] + \"%\");\r\n\t\t\tSystem.out.println(\"The optimal solution is\");\r\n\t\t\tSystem.out.println(\"template 1(bbbb): \");\r\n\t\t\t/*for (int a = 0; a < PATHNUM; a++) // Output the result\r\n\t\t {\r\n\t\t\t\tif (statu[a]) {\r\n\t\t\t\t\tSystem.out.print(\"path\" + a + \":\");\r\n\t\t\t\t\tfor (int j = 0; j < R; j++)\r\n\t\t\t\t\t\tSystem.out.print(solution[a][j] + \" \");\r\n\t\t\t\t\tSystem.out.println();\r\n\t\t\t\t} else\r\n\t\t\t\t\tSystem.out.println(\"path\" + a + \"Not covered.\");\r\n\t\t\t}*/\r\n\r\n\t\t\t \r\n\r\n\t\t} \r\n\r\n\t\tdouble time_sum = 0, time_average;\r\n\t\tfloat coverage_sum = 0, coverage_average, cycle_sum = 0, cycle_average, case_average;\r\n\t\tint case_sum = 0;\r\n\t\tfor (int run = 0; run < RUN; run++) {\r\n\t\t\ttime_sum = time_sum + runtime[run];\r\n\t\t//\tcycle_sum = cycle_sum + (Cycle[run] - 1);\r\n\t\t//\tcase_sum = case_sum + total_case_num[run];\r\n\t\t\tcoverage_sum = coverage_sum + coverage[run];\r\n\t\t }\r\n\t\t\r\n\t\ttime_average = time_sum / RUN;\r\n\t\tcycle_average = cycle_sum / RUN;\r\n\t\tcase_average = case_sum / RUN;\r\n\t\tcoverage_average = coverage_sum / RUN;\r\n\r\n\t\tSystem.out.println(\"time_sum = \" + time_sum + \"ms\");\r\n\t\tSystem.out.println(\"time_average = \" + time_average + \"ms\");\r\n\t\tSystem.out.println(\"cycle_sum = \" + cycle_sum);\r\n\t\tSystem.out.println(\"cycle_average = \" + cycle_average);\r\n\t\tSystem.out.println(\"case_sum = \" + case_sum);\r\n\t\tSystem.out.println(\"case_average = \" + case_average);\r\n\t\tSystem.out.println(\"coverage_sum = \" + coverage_sum + \"%\");\r\n\t\tSystem.out.println(\"coverage_average = \" + coverage_average + \"%\");\r\n\r\n\t\r\n\t\t\r\n\t\t//test case number statistics\r\n\t\ttry \r\n\t\t{ \r\n//\t\t\tWritableWorkbook wbook= \r\n//\t\t\tWorkbook.createWorkbook(new File(\"E:/result0106.xls\")); \r\n//\t\t\t//生成名为“Ramdom”的工作表,参数0表示这是第一页 \r\n//\t\t\tWritableSheet sheet=wbook.createSheet(\"DE1\",0); \r\n\t\t\t\r\n\t\t\tFile file = new java.io.File(\"C:/Users/scybe/eclipse-workspace/TestData/Test_whole.xls\"); \r\n\t\t\tWorkbook book = Workbook.getWorkbook(file); \r\n\t\t\tWritableWorkbook wbook = Workbook.createWorkbook(file, book); \r\n \t WritableSheet sheet = wbook.getSheet(0); // 写入数据 sheet \r\n\t\t\t\r\n\t\t\tfor(int run=0 ; run<RUN; run++)\r\n\t\t\t{\r\n\t\t\t\tint q = run;\r\n\t\t\t\tjxl.write.Number number = new jxl.write.Number(col, q,total_case_num[run]); \r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tsheet.addCell(number); \r\n\t\t\t\tSystem.out.println(total_case_num[run]);\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//total_case_num[run]\r\n\t\t\t\r\n\t\t \tdouble case_ave = getAverage(total_case_num , RUN);\r\n\t\t\tjxl.write.Number number1 = new jxl.write.Number(col, 25 ,case_ave); \r\n\t\t\tsheet.addCell(number1);\r\n\t\t\t\r\n\t\t\t \t\t\r\n\t\t\twbook.write(); \t\r\n\t\t\twbook.close();\r\n\t\t\t \r\n\t\t}catch(Exception e) \r\n\t\t{ \r\n\t\tSystem.out.println(e); \r\n\t\t} \r\n\t\t\t\t\t\t\r\n\t\t\r\n\t\t//coverage statistics \r\n\t\t\r\n\t\t//test case number statistics\r\n\t\t\t\t\r\n\t\t\r\n\t\t\r\n\t\ttry \r\n\t\t\t{ \r\n//\t\t\t\t\t\r\n\t\t\t\t\tFile file = new java.io.File(\"C:/Users/scybe/eclipse-workspace/TestData/Coverage_whole.xls\"); \r\n\t\t\t\t\tWorkbook book = Workbook.getWorkbook(file); \r\n\t\t\t\t\tWritableWorkbook wbook = Workbook.createWorkbook(file, book); \r\n\t\t \t WritableSheet sheet = wbook.getSheet(0); // 写入数据 sheet \r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(int run=0 ; run<RUN; run++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tint q=run;\r\n\t\t\t\t\t\tjxl.write.Number number = new jxl.write.Number(col, q,coverage[run]); \r\n\t\t\t\t\t\tsheet.addCell(number); \r\n\t\t\t\t\t\t\r\n \r\n\t\t\t\t\t\t//写入数据并关闭文件 \t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t//total_case_num[run]\r\n\t\t\t\t\t\r\n\t\t\t\t\tdouble case_ave = getAverages(coverage , RUN);\r\n\t\t\t\t\tjxl.write.Number number1 = new jxl.write.Number(col,25,case_ave); \r\n\t\t\t\t\tsheet.addCell(number1);\r\n\t\t\t\t\t\r\n\t\t\t\t\twbook.write(); \t\r\n\t\t\t\t\twbook.close();\r\n\t\t\t\t\t \r\n\t\t\t\t}catch(Exception e) \r\n\t\t\t\t{ \r\n\t\t\t\tSystem.out.println(e); \r\n\t\t\t\t} \r\n\t\t\t\t\r\n\t\t\r\n\r\n\t}", "@Override\n\tpublic void rotateRight(int numberOfTurns) {\n\t\tint[] array = numbers();\n\t\t//converts the array into a new Squarelotron\n\t\tSquarelotron copySquarelotron = makeSquarelotron(array);\n\t\tint[][] arrayCopy = copySquarelotron.squarelotron;\n\t\tfor(int i = 0; i <=size-1; i++){\n\t\t\tfor(int j = 0; j<=size-1; j++){\n\t\t\t\t//checks for each rotation to account for repeats and negatives and rotates accordingly\n\t\t\t\tif((numberOfTurns-1)%4==0){\n\t\t\t\t\tarrayCopy[i][j]=this.squarelotron[size-j-1][i];\n\t\t\t\t}\n\t\t\t\telse if((numberOfTurns-2)%4==0){\n\t\t\t\t\tarrayCopy[i][j]=this.squarelotron[size-i-1][size-j-1];\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse if((numberOfTurns-3)%4==0){\n\t\t\t\t\tarrayCopy[i][j]=this.squarelotron[j][size-i-1];\t\n\t\t\t\t}\t\n\t\t\t}\n\t\t}\n\t\tthis.squarelotron = arrayCopy;\n\t}", "private void doFinalOrientation(Graph graph) {\n discrimGraphs.clear();\n Set<Graph> currentDiscrimGraphs = new HashSet<>();\n currentDiscrimGraphs.add(graph);\n while (changeFlag) {\n changeFlag = false;\n currentDiscrimGraphs.addAll(discrimGraphs);\n discrimGraphs.clear();\n for (Graph newGraph : currentDiscrimGraphs) {\n doubleTriangle(newGraph);\n awayFromColliderAncestorCycle(newGraph);\n if (!discrimPaths(newGraph)) {\n if (changeFlag) {\n discrimGraphs.add(newGraph);\n } else {\n finalResult.add(newGraph);\n }\n }\n }\n currentDiscrimGraphs.clear();\n }\n changeFlag = true;\n }", "private static int[] rotateArray(int a[],int d) {\n int len = a.length;\n int a2[] = new int[len];\n int i=0;\n while(i<len-d) {\n a2[i] = a[d+i];\n i++;\n }\n int j=0;\n while(j<d && i < a.length) {\n a2[i] = a[j];\n j++;\n i++;\n }\n return a2;\n }", "private boolean calculateMaximumLengthBitonicSubarray() {\n\n boolean found = false; // does any BSA found\n\n boolean directionChange = false; //does direction numberOfWays increase to decrease\n\n int countOfChange = 0;\n\n int i = 0;\n directionChange = false;\n int start = i;\n i++;\n for (; i < input.length; i++) {\n if (countOfChange != 0 && countOfChange % 2 == 0) {\n if (this.length < (i - 2 - start + 1)) {\n this.i = start;\n this.j = i - 2;\n this.length = this.j - this.i + 1;\n }\n start = i - 2;\n countOfChange = 0;\n }\n\n if (input[i] > input[i - 1]) {\n if (directionChange == true) {\n countOfChange++;\n }\n directionChange = false;\n }\n if (input[i] < input[i - 1]) {\n if (directionChange == false) {\n countOfChange++;\n }\n directionChange = true;\n }\n\n\n }\n\n if (directionChange == true) {\n if (this.length < (i - 1 - start + 1)) {\n this.i = start;\n this.j = i - 1;\n this.length = this.j - this.i + 1;\n }\n }\n return directionChange;\n }", "static void updatePossible(int[][] G, int[][][] P){\n //only makes changes to possibility array\n \n int k;\n \n for(int i=1; i<G.length; i++){\n for (int j=1; j<G[i].length; j++){\n if (G[i][j]>0) {\n int m = G[i][j]; //this is the candidate # being removed from P[][][]\n \n //remove m as candidate, from P[i][j][m] for rows\n for(int ii=1; ii<G.length; ii++){\n if (ii!=i){ //skip the current box\n if (P[ii][j][0]>1 && P[ii][j][m]>0){ //only change candidate values if it's not filled\n P[ii][j][m] = 0; //set candidate value to 0\n P[ii][j][0] -= 1; //subtract 1 from total candidates for this cell\n }\n }\n }\n \n //remove m from P[i][j][m] for columns\n for(int jj=1; jj<G.length; jj++){\n if (jj!=j){ //skip the current box\n if (P[i][jj][0]>1 && P[i][jj][m]>0){ //only change candidate values if it's not filled\n P[i][jj][m] = 0; //set candidate value to 0\n P[i][jj][0] -= 1; //subtract 1 from total candidates for this cell\n }\n }\n }\n \n //remove m from P[i][j][m] for box!\n int I = getAnchor(i);\n int J = getAnchor(j);\n for(int s=I; s<=I+2; s++){\n for(int t=J; t<=J+2; t++){\n if((s!=i)||(t!=j)){\n if (P[s][t][0]>1 && P[s][t][m]>0){ //only change candidate values if it's not filled\n P[s][t][m] = 0; //set candidate value to 0\n P[s][t][0] -= 1; //subtract 1 from total candidates for this cell\n }\n }\n }\n }\n \n }\n }\n }\n }", "void resDiagonale(){ \r\n for (int i = 0; i<N; i=i+nCarre) \r\n \tresCarre(i, i); \r\n }", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int noOfElements = sc.nextInt();\n int[] arr = new int[noOfElements];\n int[] arr1 = new int[noOfElements];\n int diff = Integer.MAX_VALUE;\n int sIndex = 0;\n int j = 0;\n for (int i = 0; i < noOfElements; i++) {\n arr[i] = sc.nextInt();\n }\n for (int j1 = 1; j1 < noOfElements; j1++) {\n int i = j1 - 1;\n int key = arr[j1];\n while (i >= 0 && key < arr[i]) { // 1 2 3\n arr[i + 1] = arr[i];\n i--;\n }\n arr[i + 1] = key;\n }\n //Arrays.sort(arr);\n for (int i = 0; i < noOfElements - 1; i++) {\n int temp = Math.abs(arr[i] - arr[i + 1]);\n if (temp <= diff) {\n diff=temp;\n }\n\n }\n\n for (int i = 0; i < noOfElements - 1; i++) {\n if (Math.abs(arr[i] - arr[i+1]) == diff) {\n System.out.print(arr[i] + \" \" + arr[i+1] + \" \");\n }\n }\n// for (int a = 0; a < j; a++) {\n//\n// System.out.print(arr[arr1[a]] + \" \" + arr[arr1[a]+1] + \" \");\n// }\n\n }", "public Set<List<String>> getCombination(int[] inHand) {\n Set<List<String>> result = new HashSet<>();\n for (int i = 0; i < inHand.length; i++) {\n if (inHand[i] < 1) continue;\n int[] copyHand = copyArray(inHand);\n //possibility of A AA AAA\n for (int j = 1; j <= inHand[i]; j++) {\n if (j == 1) {\n String cSet = \"\";\n\n for (int seq = i; seq <= i + 2; seq++) {\n if (seq >= inHand.length || copyHand[seq] < 1) continue;\n cSet += seq;\n copyHand[seq] -= 1;\n }\n// System.out.println(\"i: \" + i + \" j: \" + j+\"inhand: \" + arrayToString\n// (inHand));\n\n Set<List<String>> a = getCombination(copyHand);\n Set<List<String>> newA = new HashSet<>();\n for (List<String> s : a) {\n s.add(cSet);\n s.sort(Comparator.naturalOrder());\n if (s.equals(\"\")) continue;\n newA.add(s);\n }\n result.addAll(newA);\n continue;\n }\n\n String currentSet = \"\";\n int[] copyOfInHand = copyArray(inHand);\n for (int t = 0; t < j; t++) {\n currentSet += i;\n }\n\n copyOfInHand[i] -= j;\n Set<List<String>> after = getCombination(copyOfInHand);\n Set<List<String>> newAfter = new HashSet<>();\n for (List<String> s : after) {\n s.add(currentSet);\n s.sort(Comparator.naturalOrder());\n newAfter.add(s);\n }\n result.addAll(newAfter);\n }\n }\n if (result.isEmpty()) result.add(new ArrayList<>());\n int min = result.stream().map(set -> set.size()).min(Comparator\n .naturalOrder()).get();\n Set<List<String>> minSets = result.stream().filter(set -> set.size() == min)\n .collect(Collectors\n .toSet());\n// combinationCache.put(inHand, minSets);\n return minSets;\n }", "public void rotate(int[] nums, int k) {\n int[] tmp = new int[nums.length];\n for (int i = 0; i < nums.length; ++i) {\n tmp[(i + k) % nums.length] = nums[i];\n }\n\n for (int i = 0; i < nums.length; ++i) {\n nums[i] = tmp[i];\n }\n }", "public static void main(String[] args) throws Exception {\n int arr[]= {7,9,88,-33,2,12,6,1};\n Arrays.sort(arr);\n /*for(int i=0; i<arr.length; i++)\n \t System.out.print(arr[i]+\", \");\n System.out.println(\"\\n DESC\");\n System.out.print(\"{ \");\n for(int i=arr.length-1; i>=0; i--) {\n \t if(arr[i]==arr[0])\n \t System.out.print(arr[i]);\n \t else \n \t\t System.out.print(arr[i]+\", \");\n }*/\n // System.out.print(\" }\");\n \n int[] ar= {6,2,2,5,2,2,1};\n int startIndex=0;\n int lastIndex=ar.length-1;\n //a is sumRight,b = sumLeft\n int a=0,b=0;\n /* while(true) {\n \t \n \t if(b>a) \n \t\t //1+2+2=+5\n \t\t a+=ar[lastIndex--];\n \t else \n \t\t //6+2+2\n \t\t\t b+=ar[startIndex++];\n \t\tif(startIndex>lastIndex) {\n \t\t\tSystem.out.println(startIndex);\n \t\t\tif(a==b)\n \t\t\t\tbreak;\n \t\t\t else\n \t\t\t throw new Exception(\"not a valid array\");\n \t\t\t\n \t\t}\n \t\t\t \n \t\t\n }\n System.out.println(lastIndex);\n */\n \n \n while(true) {\n \t \n \t if(b>a)\n \t\t a+= ar[lastIndex--];\n \t else\n b+=ar[startIndex++];\n \t if(startIndex>lastIndex) {\n \t\t if(a==b)\n \t\t\t break;\n \t }\n }\n System.out.println(lastIndex);\n\t}", "private int[][] llenarAsignacion(int asignacion[][], int maximos[][], int disponibles[])\r\n {\r\n \r\n //Variables para llenar la matriz asignacion\r\n int max, disp, random;\r\n int asignados[][] = asignacion;\r\n int maxarr[][] = maximos;\r\n int disparr[] = disponibles;\r\n \r\n for(int j = 0; j < asignacion[0].length; j++){\r\n //Extraer la cantidad de tipo de recurso disponible\r\n disp = disparr[j];\r\n for(int i = 0; i < asignacion.length; i++){\r\n \r\n if(disp > 0){ //Si la cantidad de tipo recurso disponibles es 0, asignar 0\r\n \r\n //Extraer valor maximo de tipo de recurso que requiere el proceso\r\n max = maxarr[i][j];\r\n \r\n //Si el proceso requiere mas recursos de los disponibles, limitar los recursos asignables a los disponibles\r\n if(max > disp)\r\n {\r\n max = disp;\r\n }\r\n \r\n //Asignar una cantidad aleatoria del tipo de recurso, entre 0 y la cantidad maxima posible\r\n random = ThreadLocalRandom.current().nextInt(0, max + 1);\r\n asignados[i][j] = random;\r\n \r\n //System.out.println(\"as \"+asignados[i][j]);\r\n \r\n //Actualizar la cantidad de tipo de recurso disponible\r\n disp = disp - random;\r\n } \r\n else \r\n {\r\n asignados[i][j] = disp;\r\n }\r\n }\r\n }\r\n return asignados;\r\n }", "public static void main(String[] args) {\n int a[] = {12,11,10,5,6,2,30};\n // smaller greater approach with 3 passes can be used to find total number of triplet subsequences in array \n int smaller[] = new int[a.length];\n int greater[] = new int[a.length];\n \n for(int i=0;i<a.length;i++) {\n smaller[i] = greater[i] = -1;\n }\n // smaller fill up\n int min = a[0];\n for(int i=1;i<a.length;i++) {\n if (a[i] > min) {\n smaller[i] = 1;\n } else if ( a[i] < min) {\n min = a[i];\n }\n }\n \n int max = a[a.length-1];\n for(int i=a.length-2;i>=0;i--) {\n if (a[i] < max) {\n greater[i] = 1;\n } else if ( a[i] > max) {\n max = a[i];\n }\n }\n \n for(int i=1;i<a.length-1;i++) {\n if (smaller[i] == greater[i] && greater[i] == 1) {\n System.out.println(\"Triplet found, mid is at -> \" + i + \" : \" + a[i]);\n }\n }\n System.out.println(\"Do we have increasing triplet ?? \" + increasingTripletOnePass(a));\n }", "static void rotateArrayOnce(int[] arr) {\n int temp = 0;\n for (int i = arr.length -1 ; i > 0; i++) {\n temp = arr[i];\n arr[i] = arr[i - 1];\n arr[i -1] = temp;\n }\n\n }", "@Test\n\tpublic void rotateArrayUsingCalculatePositionAlgorithm_rotateLeftTwoItems() {\n\t\tint[] nums = prepareInputArray(5);\n\t\tint[] rotatedArray = ArrayLeftRotation.rotateArray(nums, 2);\n\t\tassertThat(rotatedArray[0], equalTo(3));\n\t\tassertThat(rotatedArray[1], equalTo(4));\n\t\tassertThat(rotatedArray[2], equalTo(5));\n\t\tassertThat(rotatedArray[3], equalTo(1));\n\t\tassertThat(rotatedArray[4], equalTo(2));\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int q = sc.nextInt();\n\n for(int k = 0; k < q; k++) {\n int m = sc.nextInt();\n int n = sc.nextInt();\n\n // indicate number of pieces\n long x = 1;\n long y = 1;\n \n ArrayList<Long> c_y = new ArrayList<Long>();\n for(int i = 0; i < m - 1; i++) {\n c_y.add(sc.nextLong());\n }\n \n ArrayList<Long> c_x = new ArrayList<Long>();\n for(int i = 0; i < n - 1; i++) {\n c_x.add(sc.nextLong());\n }\n\n Collections.sort(c_y, Collections.reverseOrder());\n Collections.sort(c_x, Collections.reverseOrder());\n\n // cut: most expensive = cut first\n int index_X = 0;\n int index_Y = 0;\n long totalCost = 0;\n\n while(!(x == n && y == m)) {\n if(x < n && y < m) {\n // compare cost to decide whether cut horizontally or vertically\n if(c_y.get(index_Y) >= c_x.get(index_X)) {\n totalCost += c_y.get(index_Y) * x;\n y++;\n index_Y++;\n } else if(c_y.get(index_Y) < c_x.get(index_X)) {\n totalCost += c_x.get(index_X) * y;\n x++;\n index_X++; \n }\n } else if(x == n && y < m) {\n totalCost += c_y.get(index_Y) * x;\n index_Y++;\n y++;\n } else if(x < n && y == m) {\n totalCost += c_x.get(index_X) * y;\n index_X++;\n x++;\n }\n }\n\n totalCost = totalCost % (long)(Math.pow(10, 9) + 7);\n System.out.println(totalCost );\n }\n }", "public void combinationUtil(int arr[], int data[], int start, \n int end, int index, int r) \n {\n if (index == r) \n { \n int c_arr[] = new int[r];\n for (int j=0; j<r; j++){ \n if(data[j]!=0){\n // System.out.print(data[j]+\" \");\n c_arr[j] = data[j]; \n }\n else{\n c_arr = new int[0];\n break;\n } \n }\n if(c_arr.length>0){\n // System.out.println(\"-----\"); \n combinations.add(c_arr);\n }\n\n return; \n } \n for (int i=start; i<=end && end-i+1 >= r-index; i++) \n { \n data[index] = arr[i]; \n combinationUtil(arr, data, i+1, end, index+1, r); \n } \n }", "public void rotateCCW(){\n rotState = (rotState + 3) % 4;\n for (int i = 0; i < tiles.length; ++i){\n tiles[i] = new Point(tiles[i].y , -tiles[i].x);\n }\n }", "public static boolean checkPath(int[][] bs, int i) {\n\t\tArrayList<Integer> temp_cP = new ArrayList<Integer>();\n\t\tSet<Integer> temp_setcP = new HashSet<Integer>();\n\t\tboolean denoter = true;\n\t\twhile (i == 3) {\n\t\t\tfor (int k = 0; k < i; k++) {\n\t\t\t\tfor (int e = 0; e < 3; e++) {\n\t\t\t\t\ttemp_cP.add(e, bs[k][e]);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\tdenoter = false;\n\t\t\t\tbreak;\n\n\t\t\t} else {\n\t\t\t\ttemp_cP.clear();\n\t\t\t\ttemp_setcP.clear();\n\n\t\t\t\tfor (int k = 0; k < i; k++) {\n\t\t\t\t\tfor (int e = 3; e < 6; e++) {\n\t\t\t\t\t\ttemp_cP.add(bs[k][e]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\t\tdenoter = false;\n\t\t\t\t\tbreak;\n\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\twhile (i == 6) {\n\n\t\t\tfor (int k = 3; k < i; k++) {\n\t\t\t\tfor (int e = 0; e < 3; e++) {\n\t\t\t\t\ttemp_cP.add(e, bs[k][e]);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\tdenoter = false;\n\t\t\t\tbreak;\n\n\t\t\t} else {\n\t\t\t\ttemp_cP.clear();\n\t\t\t\ttemp_setcP.clear();\n\n\t\t\t\tfor (int k = 3; k < i; k++) {\n\t\t\t\t\tfor (int e = 3; e < 6; e++) {\n\t\t\t\t\t\ttemp_cP.add(bs[k][e]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttemp_setcP = new HashSet<Integer>(temp_cP);\n\t\t\t\tif (temp_cP.size() > temp_setcP.size()) {\n\t\t\t\t\tdenoter = false;\n\t\t\t\t\tbreak;\n\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn denoter;\n\t}", "public int[] a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)\r\n/* 11: */ {\r\n/* 12:13 */ int i = paramInt1 - 1;\r\n/* 13:14 */ int j = paramInt2 - 1;\r\n/* 14:15 */ int k = paramInt3 + 2;\r\n/* 15:16 */ int m = paramInt4 + 2;\r\n/* 16:17 */ int[] arrayOfInt1 = this.a.a(i, j, k, m);\r\n/* 17: */ \r\n/* 18:19 */ int[] arrayOfInt2 = boy.a(paramInt3 * paramInt4);\r\n/* 19:20 */ for (int n = 0; n < paramInt4; n++) {\r\n/* 20:21 */ for (int i1 = 0; i1 < paramInt3; i1++)\r\n/* 21: */ {\r\n/* 22:22 */ int i2 = c(arrayOfInt1[(i1 + 0 + (n + 1) * k)]);\r\n/* 23:23 */ int i3 = c(arrayOfInt1[(i1 + 2 + (n + 1) * k)]);\r\n/* 24:24 */ int i4 = c(arrayOfInt1[(i1 + 1 + (n + 0) * k)]);\r\n/* 25:25 */ int i5 = c(arrayOfInt1[(i1 + 1 + (n + 2) * k)]);\r\n/* 26:26 */ int i6 = c(arrayOfInt1[(i1 + 1 + (n + 1) * k)]);\r\n/* 27:27 */ if ((i6 != i2) || (i6 != i4) || (i6 != i3) || (i6 != i5)) {\r\n/* 28:28 */ arrayOfInt2[(i1 + n * paramInt3)] = arm.w.az;\r\n/* 29: */ } else {\r\n/* 30:30 */ arrayOfInt2[(i1 + n * paramInt3)] = -1;\r\n/* 31: */ }\r\n/* 32: */ }\r\n/* 33: */ }\r\n/* 34:35 */ return arrayOfInt2;\r\n/* 35: */ }", "public void symmetric() {\n\t\tint i,j,segment=0;\n\t\tint symmetry = _geneticCode.getSymmetry();\n\t\tint mirror = _geneticCode.getMirror();\n\t\tint sequence = _segments / symmetry;\n\t\tint left=0, right=0, top=0, bottom=0;\n\t\tint centerX, centerY;\n\t\tdouble cx, cy;\n\n\t\tfor (i=0; i<symmetry; i++) {\n\t\t\tfor (j=0; j<sequence; j++,segment++) {\n\t\t\t\t// Here, we take the vector that forms the segment, scale it depending on\n\t\t\t\t// the relative size of the organism and rotate it depending on the\n\t\t\t\t// symmetry and mirroring.\n\t\t\t\tv.setModulus(_geneticCode.getGene(j).getLength()/Utils.scale[_growthRatio-1]);\n\t\t\t\tif (j==0) {\n\t\t\t\t\t_startPointX[segment] = 0;\n\t\t\t\t\t_startPointY[segment] = 0;\n\t\t\t\t\tif (mirror == 0 || i%2==0)\n\t\t\t\t\t\tv.setTheta(_geneticCode.getGene(j).getTheta()+i*2*FastMath.PI/symmetry);\n\t\t\t\t\telse {\n\t\t\t\t\t\tv.setTheta(_geneticCode.getGene(j).getTheta()+(i-1)*2*FastMath.PI/symmetry);\n\t\t\t\t\t\tv.invertX();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (_geneticCode.getGene(j).getBranch() == -1) {\n\t\t\t\t\t\t_startPointX[segment] = _endPointX[segment - 1];\n\t\t\t\t\t\t_startPointY[segment] = _endPointY[segment - 1];\n\t\t\t\t\t\tif (mirror == 0 || i%2==0)\n\t\t\t\t\t\t\tv.addDegree(_geneticCode.getGene(j).getTheta());\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tv.addDegree(-_geneticCode.getGene(j).getTheta());\n\t\t\t\t\t} else {\n\t\t\t\t\tif (_geneticCode.getGene(j).getBranch() == 0) {\n\t\t\t\t\t\t_startPointX[segment] = 0;\n\t\t\t\t\t _startPointY[segment] = 0;\n\t\t\t\t\t if (mirror == 0 || i%2==0)\n\t\t\t\t\t\t\tv.addDegree(_geneticCode.getGene(j).getTheta());\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tv.addDegree(-_geneticCode.getGene(j).getTheta());\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_startPointX[segment] = _endPointX[(i * sequence) + _geneticCode.getGene(j).getBranch() - 1];\n\t\t\t\t\t _startPointY[segment] = _endPointY[(i * sequence) + _geneticCode.getGene(j).getBranch() - 1];\n\t\t\t\t\t if (mirror == 0 || i%2==0)\n\t\t\t\t\t\t\tv.addDegree(_geneticCode.getGene(j).getTheta());\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tv.addDegree(-_geneticCode.getGene(j).getTheta());\n\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Apply the vector to the starting point to get the ending point.\n\t\t\t\t_endPointX[segment] = (int) FastMath.round(v.getX() + _startPointX[segment]);\n\t\t\t\t_endPointY[segment] = (int) FastMath.round(v.getY() + _startPointY[segment]);\n\t\t\t // Calculate the bounding rectangle of this organism\n\t\t\t left = Math.min(left, _endPointX[segment]);\n\t\t\t right = Math.max(right, _endPointX[segment]);\n\t\t\t top = Math.min(top, _endPointY[segment]);\n\t\t\t bottom = Math.max(bottom, _endPointY[segment]);\n\t\t\t}\n\t\t}\n\t\t_sizeRect.setBounds(left, top, right-left+1, bottom-top+1);\n\t\t// image center\n\t\tcenterX = (left+right)>>1;\n\t\tcenterY = (top+bottom)>>1;\n\t\t_mass = 0;\n\t\t_I = 0;\n\t\tfor (i=0; i<_segments; i++) {\n\t\t\t// express points relative to the image center\n\t\t\t_startPointX[i]-=centerX;\n\t\t\t_startPointY[i]-=centerY;\n\t\t\t_endPointX[i]-=centerX;\n\t\t\t_endPointY[i]-=centerY;\n\t\t\t// calculate points distance of the origin and modulus\n\t\t\t_m1[i] = FastMath.sqrt(_startPointX[i]*_startPointX[i]+_startPointY[i]*_startPointY[i]);\n\t\t\t_m2[i] = FastMath.sqrt(_endPointX[i]*_endPointX[i]+_endPointY[i]*_endPointY[i]);\n\t\t\t_m[i] = FastMath.sqrt(FastMath.pow(_endPointX[i]-_startPointX[i],2) +\n FastMath.pow(_endPointY[i]-_startPointY[i],2));\n\t\t\t_mass += _m[i];\n\t\t\t_mphoto[i] = (0.6 + (0.48 / (double)sequence) + (1.44 / (double)symmetry)) * _m[i];\n\t\t\t// calculate inertia moment\n\t\t\t// the mass center of a segment is its middle point\n\t\t\tcx = (_startPointX[i] + _endPointX[i]) / 2d;\n\t\t\tcy = (_startPointY[i] + _endPointY[i]) / 2d;\n\t\t\t// add the effect of this segment, following the parallel axis theorem\n\t\t\t_I += FastMath.pow(_m[i],3)/12d +\n\t\t\t\t_m[i] * cx*cx + cy*cy;// mass * length^2 (center is at 0,0)\n\t\t}\n\t}", "static void combinationUtil(int arr[], int data[], int start, \n\t\t\tint end, int index, int r,ArrayList<ArrayList<Integer>> setOfIntArrays) \n\t{ \n\t\t// Current combination is ready to be printed, print it \n\t\tif (index == r) { \n\t\t//System.out.println(\"\\n\");\n\t\tArrayList<Integer> lineArray = new ArrayList<Integer>();\n\t\t\n\t\t\t\tfor (int j=0; j<r; j++) {\n\t\t\t\t\t//System.out.print(data[j]); \n\t\t\t\t\t//System.out.println(\"\\n\\n\"); \n\t\t\t\t\tlineArray.add(new Integer(data[j]));\n\t\t\t\t\t}\n\t\t\t\tsetOfIntArrays.add(lineArray);\n\t\t\t\treturn; \n\t\t\t} \n\t\t// replace index with all possible elements. The condition \n\t\t// \"end-i+1 >= r-index\" makes sure that including one element \n\t\t// at index will make a combination with remaining elements \n\t\t// at remaining positions \n\t\tfor (int i=start; i<=end && end-i+1 >= r-index; i++) \n\t\t{ \n\t\t\tdata[index] = arr[i]; \n\t\t\tcombinationUtil(arr, data, i+1, end, index+1, r,setOfIntArrays); \n\t\t} \n\n\t}", "@Test\n\tpublic void rotateArrayUsingCalculatePositionAlgorithm_rotateLeftOneItem() {\n\t\tint[] nums = prepareInputArray(5);\n\t\tint[] rotatedArray = ArrayLeftRotation.rotateArray(nums, 1);\n\t\tassertThat(rotatedArray[0], equalTo(2));\n\t\tassertThat(rotatedArray[1], equalTo(3));\n\t\tassertThat(rotatedArray[2], equalTo(4));\n\t\tassertThat(rotatedArray[3], equalTo(5));\n\t\tassertThat(rotatedArray[4], equalTo(1));\n\t}", "int calDeg(int u){\n int ans=0;\n for (int i=0;i<n;i++){\n ans+=a[u][i];\n }\n return ans;\n }", "private void buildArray() throws VerificationException\n {\n \tindices = new int[length];\n \tcommonality = new int[length];\n \n \tcommonality[0] = -1;\n \tfor( int i=0; i<indices.length; i++ ){\n \t indices[i] = i;\n \t}\n \n sort();\n }", "public static void runGeneration(){\r\n adjust = generationSize*generation;\r\n //Send out the ants to their start points\r\n for (int i = generationSize -1; i>0; i--) {\r\n colony.get(i + adjust).startPositions(sets);\r\n }\r\n //initialises the latch with a counter for each ant in a generation\r\n latch = new CountDownLatch(generationSize);\r\n //move the ants out until they have found a valid solution or seen all nodes\r\n //create a new thread for each ant in the generation\r\n for (int i = 0; i<generationSize;i++) {\r\n Generation temp = new Generation(i);\r\n //starts the new thread\r\n temp.start();\r\n }\r\n try {\r\n //wait until all the ants in a generation have completed their paths\r\n latch.await();\r\n }\r\n catch(Exception e)\r\n {\r\n System.out.println(\"error in latch.await\");\r\n }\r\n\r\n //Create the pheremone trail\r\n for (int i = 0; i<generationSize;i++) {\r\n Ant a = colony.get(i + adjust);\r\n for (Integer k: a.Path) {\r\n pheremones.set(k, pheremones.get(k) + 1);\r\n visited.set(k, visited.get(k) + 1);\r\n }\r\n }\r\n\r\n generation++;\r\n //degrade the pheremone trail\r\n if(generation > 1){\r\n for (int i = 0; i < pheremones.size(); i++){\r\n pheremones.set(i, pheremones.get(i) - degrade);\r\n if (pheremones.get(i) < 0) pheremones.set(i, 0);\r\n }\r\n }\r\n\r\n }", "static void rotate(int[][] matrix) {\n int n = matrix.length;\n for (int i = 0; i < (n + 1) / 2; i++) {\n for (int j = 0; j < n / 2; j++) {\n int temp = matrix[n - 1 - j][i];\n matrix[n - 1 - j][i] = matrix[n - 1 - i][n - j - 1];\n matrix[n - 1 - i][n - j - 1] = matrix[j][n - 1 - i];\n matrix[j][n - 1 - i] = matrix[i][j];\n matrix[i][j] = temp;\n }\n }\n }", "private static int[] remainder(int[] x, int[] y)\n {\n int xStart = 0;\n while (xStart < x.length && x[xStart] == 0)\n {\n ++xStart;\n }\n\n int yStart = 0;\n while (yStart < y.length && y[yStart] == 0)\n {\n ++yStart;\n }\n\n int xyCmp = compareNoLeadingZeroes(xStart, x, yStart, y);\n\n if (xyCmp > 0)\n {\n int yBitLength = calcBitLength(1, yStart, y);\n int xBitLength = calcBitLength(1, xStart, x);\n int shift = xBitLength - yBitLength;\n\n int[] c;\n int cStart = 0;\n int cBitLength = yBitLength;\n if (shift > 0)\n {\n c = shiftLeft(y, shift);\n cBitLength += shift;\n }\n else\n {\n int len = y.length - yStart; \n c = new int[len];\n System.arraycopy(y, yStart, c, 0, len);\n }\n\n for (;;)\n {\n if (cBitLength < xBitLength\n || compareNoLeadingZeroes(xStart, x, cStart, c) >= 0)\n {\n subtract(xStart, x, cStart, c);\n\n while (x[xStart] == 0)\n {\n if (++xStart == x.length)\n {\n return x;\n }\n }\n\n xyCmp = compareNoLeadingZeroes(xStart, x, yStart, y);\n\n if (xyCmp <= 0)\n {\n break;\n }\n\n //xBitLength = bitLength(xStart, x);\n xBitLength = 32 * (x.length - xStart - 1) + bitLen(x[xStart]);\n }\n\n shift = cBitLength - xBitLength;\n\n if (shift < 2)\n {\n shiftRightOneInPlace(cStart, c);\n --cBitLength;\n }\n else\n {\n shiftRightInPlace(cStart, c, shift);\n cBitLength -= shift;\n }\n\n// cStart = c.length - ((cBitLength + 31) / 32);\n while (c[cStart] == 0)\n {\n ++cStart;\n }\n }\n }\n\n if (xyCmp == 0)\n {\n for (int i = xStart; i < x.length; ++i)\n {\n x[i] = 0;\n }\n }\n\n return x;\n }", "public ArrayList<float[]> getSolutions( LockScreen problem ) {\n\t\t\n\t\tArrayList<float[]> solutions = new ArrayList<float[]>();\n\t\tint pbSize = problem._disks.size();\n\t\t\n\t\t// init all to -PI\n\t\tfor (LockDisk disk : problem._disks) {\n\t\t\tdisk.reset();\n\t\t\tdisk._rotAngle = - MathUtils.PI;\t\n\t\t}\n\t\t// Solution\n\t\tSystem.out.println( \"****** Cherche Solution pour\");\n\t\tfor (LockDisk d : problem._disks) {\n\t\t\tSystem.out.println( \"Disk \"+d._id+ \" ang=\"+d._rotAngle*MathUtils.radDeg);\n\t\t}\n\t\tboolean fgSol = evaluateSolution(problem);\n\t\tif (fgSol) {\n\t\t\tfloat[] oneSolution = new float[pbSize];\n\t\t\tfor (int i = 0; i < oneSolution.length; i++) {\n\t\t\t\toneSolution[i] = problem._disks.get(i)._rotAngle;\n\t\t\t}\n\t\t\tsolutions.add( oneSolution );\n\t\t}\n\t\t\n\t\t// increment while not finished\n\t\tboolean fgFinished = false;\n\t\twhile ( !fgFinished ) {\n\t\t\t// CHECK if SOLUTION\n\t\t\t// INCREMENT\n\t\t\tboolean fgNeedIncrement = true;\n\t\t\tLockDisk disk = problem._disks.get(problem._disks.size()-1);\n\t\t\twhile (fgNeedIncrement == true && disk != null) {\n\t\t\t\tdisk._rotAngle += ANG_INCREMENT;\n\t\t\t\n\t\t\t\t// If over PI -> will try to increment next disk\n\t\t\t\tif (disk._rotAngle >= MathUtils.PI) {\n\t\t\t\t\tdisk._rotAngle = - MathUtils.PI;\n\t\t\t\t\tdisk = disk._nextDisk;\n\t\t\t\t}\n\t\t\t\t// else ok, increment is finished\n\t\t\t\telse {\n\t\t\t\t\tfgNeedIncrement = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Finished if disk=null and still need increment\n\t\t\tif (fgNeedIncrement == true && disk == null ) {\n\t\t\t\tfgFinished = true;\n\t\t\t\tSystem.out.println(\">>>>>>> FINISHED <<<<<<\");\n\t\t\t}\n\t\t\t// else, do we have a solution\n\t\t\telse {\n\t\t\t\t// Solution\n\t\t\t\tSystem.out.println( \"****** Cherche Solution pour\");\n\t\t\t\tfor (LockDisk d : problem._disks) {\n\t\t\t\t\tSystem.out.println( \"Disk \"+d._id+ \" ang=\"+d._rotAngle*MathUtils.radDeg);\n\t\t\t\t}\n\t\t\t\tfgSol = evaluateSolution(problem);\n\t\t\t\tif (fgSol) {\n\t\t\t\t\tfloat[] oneSolution = new float[pbSize];\n\t\t\t\t\tfor (int i = 0; i < oneSolution.length; i++) {\n\t\t\t\t\t\toneSolution[i] = problem._disks.get(i)._rotAngle;\n\t\t\t\t\t}\n\t\t\t\t\tsolutions.add( oneSolution );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println( \"**** SOLUTIONS ****\");\n\t\tString solStr = \"\";\n\t\tfor (float[] fs : solutions) {\n\t\t\tsolStr += \" (\";\n\t\t\tfor (int i = 0; i < fs.length; i++) {\n\t\t\t\tsolStr += (fs[i]*MathUtils.radDeg)+\", \";\n\t\t\t}\n\t\t\tsolStr += \"),\";\n\t\t}\n\t\tSystem.out.println(solStr);\n\t\t\n\t\t\n\t\treturn solutions;\n\t}", "public static void main(String args[]) {\n Scanner input = new Scanner(System.in);\n System.out.println(\"Enter the number of testcases you want to run\");\n int testcases = input.nextInt();\n int arr[] = {1,2,3,4,5,6,7,8};\n int n = arr.length;\n while(testcases != 0) {\n System.out.println(\"Enter the rotation (i.e value of d) you want to perform\");\n int d = input.nextInt();\n leftRotate(arr,n,d);\n testcases--;\n }\n }", "public void solucioInicial2() {\n int grupsRecollits = 0;\n for (int i=0; i<numCentres*helisPerCentre; ++i) {\n Helicopter hel = new Helicopter();\n helicopters.add(hel);\n }\n int indexHelic = 0;\n int indexGrup = 0;\n int places = 15;\n while (indexGrup < numGrups) {\n int trajecte[] = {-1,-1,-1};\n for (int i=0; i < 3 && indexGrup<numGrups; ++i) {\n Grupo grup = grups.get( indexGrup );\n if (places - grup.getNPersonas() >= 0) {\n places -= grup.getNPersonas();\n trajecte[i] = indexGrup;\n indexGrup++;\n\n }\n else i = 3;\n }\n Helicopter helicopter = helicopters.get( indexHelic );\n helicopter.addTrajecte( trajecte, indexHelic/helisPerCentre );\n places = 15;\n indexHelic++;\n if (indexHelic == numCentres*helisPerCentre) indexHelic = 0;\n }\n }", "public static void main(String[] args) {\n\t\tint array[]={2,3,4,6};\n\t\tint n=array.length;\n\t\tint maximum=Integer.MIN_VALUE;\n\t\tint minimum=Integer.MAX_VALUE;\n\t\tfor(int i:array)\n\t\t{\n\t\t\tif(i>maximum)\n\t\t\t\tmaximum=i;\n\t\t\tif(i<minimum)\n\t\t\t\tminimum=i;\n\t\t}\n\t\t\n\t\tint mark[]=new int[maximum+2];\n\t\tint value[]=new int[maximum+2];\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tmark[array[i]]=1; // marking ki exist karta hai no need to search in the array.\n\t\t\tvalue[array[i]]=1; //har value se ek fbt to banega hi (1 node ka)\n\t\t}\n\t\tint ans=0;\n\t\tfor(int i=minimum;i<=maximum;i++){\n\t\t\tif(mark[i]==1) // element is present in the array.// we have found the first factor now find 2nd factor.\n\t\t\t{\n\t\t// find the multiples of arr[i] which are less than max value and also less than its square\n\t\t\tfor(int j=i+i ;j<=maximum && j/i<=i;j=j+i)\n\t\t\t{\n\t\t\t\tif(mark[j]==1 && mark[j/i]==1) // i is the first factor and j/i is the 2nd factor.j is the product that serves as root.\n\t\t\t\t{\n\t\t\t\t\t// value =all combination of left child with right child.\n\t\t\t\t\tvalue[j]=value[j] + (value[i] * value[j/i]);\n\t\t\t\t\t\n\t\t\t\t\t// if the 2 child are not same then one more orientation.\n\t\t\t\t\tif(i!=(j/i))\n\t\t\t\t\t\tvalue[j]=value[j] + (value[i] * value[j/i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t}\n\t\t\tans=ans+value[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}", "public void solve() throws IOException {\r\n int T = nextInt();\r\n for (int t = 1; t <= T; t++) {\r\n int N = nextInt();\r\n int J = nextInt();\r\n \r\n out.format(\"Case #%d:%n\", t);\r\n \r\n boolean[] bitmask = new boolean[N - 2];\r\n int count = 0;\r\n while (count < J) {\r\n BigInteger[] factors = new BigInteger[9];\r\n boolean success = true;\r\n for (int base = 2; base <= 10; base++) {\r\n BigInteger value = BigInteger.ONE;\r\n BigInteger biBase = BigInteger.valueOf(base);\r\n \r\n for (int i = 0; i < N - 2; i++) {\r\n if (bitmask[i]) {\r\n value = value.add(biBase.pow(i + 1));\r\n }\r\n }\r\n value = value.add(biBase.pow(N - 1));\r\n \r\n if (value.isProbablePrime(10)) {\r\n success = false;\r\n break;\r\n } else {\r\n // Pollard rho\r\n BigInteger x = BigInteger.valueOf(2);\r\n BigInteger y = BigInteger.valueOf(2);\r\n BigInteger d = BigInteger.ONE;\r\n while (d.compareTo(BigInteger.ONE) == 0) {\r\n x = x.pow(2).add(BigInteger.ONE).mod(value);\r\n y = y.pow(2).add(BigInteger.ONE).mod(value)\r\n .pow(2).add(BigInteger.ONE).mod(value);\r\n d = x.subtract(y).gcd(value);\r\n }\r\n if (d.compareTo(value) != 0) {\r\n factors[base - 2] = d;\r\n } else {\r\n success = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (success) {\r\n count++;\r\n StringBuilder sb = new StringBuilder(\"1\");\r\n for (int i = N - 3; i >= 0; i--) {\r\n if (bitmask[i]) {\r\n sb.append(1);\r\n } else {\r\n sb.append(0);\r\n }\r\n }\r\n sb.append(1);\r\n \r\n System.out.println(sb.toString() + \" \" + count);\r\n out.print(sb.toString());\r\n for (int i = 0; i < 9; i++) {\r\n out.print(\" \");\r\n out.print(factors[i].toString());\r\n }\r\n out.println();\r\n }\r\n \r\n // Increment bitmask\r\n for (int i = 0; i < N - 2; i++) {\r\n if (!bitmask[i]) {\r\n bitmask[i] = true;\r\n break;\r\n } else {\r\n bitmask[i] = false;\r\n }\r\n }\r\n }\r\n }\r\n }", "public static void rotate(int num) {\n for (int s = 0; s < num; s++) {\n int up = s; // 0 , 1\n int down = N - 1 - s;\n int left = s;\n int right = M - 1 - s;\n\n int tmp = map[s][s];\n for (int i = left; i < right; i++){ // 위\n map[up][i] = map[up][i + 1];\n }\n for (int i = up; i < down; i++){ // 오른쪽\n map[i][right] = map[i + 1][right];\n }\n for (int i = right; i > left; i--){ // 아래\n map[down][i] = map[down][i - 1];\n }\n for (int i = down; i > up; i--){ // 왼쪽\n map[i][left] = map[i - 1][left];\n }\n map[up + 1][left] = tmp;\n }\n }", "public static boolean solution(int[][] key, int[][] lock) {\n boolean answer = true;\n\n int over_idx = key.length-1; \n int nArrlen= over_idx*2+lock.length;\n int [][] newArray = new int [nArrlen][nArrlen];\n List num = new ArrayList<>();\n int count=0; //회전 카운트\n //새로운 lock 배열 만들기 \n\n \n for (int i = 0; i < lock.length; i++) {\n\t\t\tfor (int j = 0; j < lock[i].length; j++) {\n\t\t\t\tnewArray[i+over_idx][j+over_idx] =lock[i][j];\t\n\n\t\t\t}\n\t\t}\n \n while(count<4) {\n \t if(count !=0) {\n \t\t key = rotation(key);\n \t }\n \t \n \t answer = search(key, newArray, lock);\n \t count++;\n }\n \n \n System.out.println(\"??\");\n \n return answer;\n }", "public static Set<Set<Polyomino>> tilings(ArrayList<Polyomino> polyominos_list,Polyomino P, boolean use_all_once, boolean rotations, boolean reflections) {\r\n\t\t\r\n\t\tHashMap<Integer, Square> hmap_P = new HashMap<Integer, Square>();\r\n\t\tSet<Integer> X= new HashSet<Integer>();\r\n\t\tSet<Set<Integer>> C= new HashSet<Set<Integer>>();\t\r\n\t\tSet<Set<Polyomino>> tilings = new HashSet<Set<Polyomino>>();\r\n\t\t\r\n\t\tif (use_all_once) {//quick check to see if there is a tiling of P using each tile exactly once: ( sum of area(tile) ) == area(P)\r\n\t\t\tint total_area=0;\r\n\t\t\tfor (Polyomino q: polyominos_list) total_area+=q.area;\r\n\t\t\tif (!(total_area==P.area)) return tilings;\r\n\t\t}\r\n\t\t\t\t\t\r\n\t\t//index squares of P\r\n\t\tfor (int i=0; i<P.vertices.size();i++) {\r\n\t\t\thmap_P.put(i+1,P.vertices.get(i));\r\n\t\t\tX.add(i+1);\r\n\t\t}\r\n\t\tif (use_all_once) {//we add extra elements to the ground set to ensure each polyomino is used exactly once\r\n\t\t\tfor (int j=0;j<polyominos_list.size();j++) {\r\n\t\t\t\tX.add(P.vertices.size()+j+1);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\t//we now define C\r\n\t\t//if A= set of (fixed/one-sided/free) polyominos of area n\r\n\t\t//C= union over Q in A of union of S subset of X corresponding to indices of squares of P covered by some translate of Q\r\n\t\t//to generate C, we iterate over the polyominos Q in A and we see, for each possible translation of Q,\r\n\t\t//if Q fits in P, in which case we record the indices of the squares of P it covers\r\n\t\t\r\n\t\tfor (int k=0; k<polyominos_list.size();k++) {\r\n\t\t\tPolyomino tile=polyominos_list.get(k);\r\n\t\t\t\r\n\t\t\tArrayList<Polyomino> orientations_of_tile=new ArrayList<Polyomino>();\r\n\t\t\tif (rotations && reflections) orientations_of_tile=tile.distinct_symmetries();\r\n\t\t\telse if (rotations) orientations_of_tile=tile.rotations();\r\n\t\t\telse if (reflections) orientations_of_tile=tile.reflections();\r\n\t\t\telse orientations_of_tile.add(tile);//if no rotations, the only possible orientation is the tile as it was given\r\n\t\t\r\n\t\t\tfor (Polyomino Q: orientations_of_tile) {\r\n\t\t\t\t//for each VALID translation of Q, we calculate the indices of squares of P which Q occupies, and add this to C\r\n\t\t\t\t//we choose some square of Q, which we will \"nail\" to the squares of P and see if Q fits in in P in that position\r\n\t\t\t\tSquare nail = Q.vertices.get(0);\r\n\t\t\t\tfor (Square s: P.vertices) {\r\n\t\t\t\t Set<Integer> indices_Q_translated= new HashSet<Integer>();\r\n\t\t\t\t boolean Q_fits_inP=true;\r\n\t\t\t\t\tfor (Square q: Q.vertices) {//lets check if this translation of Q fits in P\r\n\t\t\t\t\t\tSquare translated_q=new Square (q.x+s\r\n\t\t\t\t\t\t\t\t.x-nail.x,q.y+s.y-nail.y);\r\n\t\t\t\t\t\tif (!P.contains(translated_q)) {//check if square translated_q fits is in P\r\n\t\t\t\t\t\t\tQ_fits_inP=false;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\thmap_P.forEach((key, value) -> {//get index of square translated_q\r\n\t\t\t\t\t\t if (value.equals(translated_q)) {\r\n\t\t\t\t\t\t \tindices_Q_translated.add(key);\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (Q_fits_inP) {\r\n\t\t\t\t\t\t//we add an element which corresponds to putting a one in a dummy column in the exact cover matrix\r\n\t\t\t\t\t\tif (use_all_once) indices_Q_translated.add(k+P.vertices.size()+1); \r\n\t\t\t\t\t\tC.add(indices_Q_translated);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Initialization step complete, with complexity at least |polyominos_list|*4*area(P)*area(Q)*area(P)\r\n\t\t\r\n\t\tif(!(C.size()==0)) {\r\n\t\t\t\r\n\t\t\tint[][] M=Exact_cover.sets_to_matrix(X,C);\r\n\t\t\r\n\t\t\t//we add n columns (initialized to all zeros) to M where n=polyominos_list.size().\r\n\t\t\t//Each row of M corresponds to some translation of a polyomino Pk in polyominos_list-{P1,...,Pn}\r\n\t\t\t//in a such a row we place a 1 in the column k\r\n\t\t\t//any exact cover of M must then use each Pk exactly once \r\n\r\n\t\t\tDancingLinks dl = new DancingLinks(M);\r\n\t\t\tSet<Set<data_object>> exact_covers_data_objects=dl.exactCover(dl.master_header);\r\n\t\t\t\r\n\t\t\tfor (Set<data_object> cover_data_objects: exact_covers_data_objects) {\r\n\t\t\t\t\r\n\t\t\t\tSet<Set<Integer>> cover_sets=new HashSet<Set<Integer>>();\r\n\t\t\t\tfor (data_object t: cover_data_objects) cover_sets.add(dl.set_of_row.get(t.row_id));\r\n\t\t\t\t\r\n\t\t\t\tSet<Polyomino> T = new HashSet<Polyomino>();//a tiling, i.e a set of polyominos\r\n\t\t\t\t\r\n\t\t\t\tfor (Set<Integer> indices: cover_sets) {\r\n\t\t\t\t\tArrayList<Square> vertices= new ArrayList<Square>();\r\n\t\t\t\t\t//convert indices to corresponding squares of P, \r\n\t\t\t\t\t//and add the corresponding Polyomino R to T\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor (int index: indices) {\r\n\t\t\t\t\t\tif (index<P.vertices.size()+1) {//if not a dummy index (in the case of use_all_once polyominos)\r\n\t\t\t\t\t\t\tvertices.add(hmap_P.get(index));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tT.add(new Polyomino(vertices,\"R\"));\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\ttilings.add(T);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn tilings;\r\n\t}", "public static void modgcd (int a[], int b[], int gcd[]) {\n\t\tif (isZero(a)) { assign (gcd, a); return; }\n\t\tif (isZero(b)) { assign (gcd, b); return; }\n\t\t\n\t\t// align a and b to have same number of digits and work on copies\n\t\ta = copy(normalize(a, b.length));\n\t\tb = copy(normalize(b, a.length));\n\t\t\n\t\t// ensure that a is greater than b. Also return trivial gcd.\n\t\tint rc = compareTo(a,b);\n\t\tif (rc == 0) { assign (gcd, a); return; }\n\t\tif (rc < 0) {\n\t\t\tint t[] = b;\n\t\t\tb = a;\n\t\t\ta = t;\n\t\t}\n\t\t\n\t\tint quot[] = new int[a.length];\n\t\tint remainder[] = new int[a.length];\n\t\twhile (!isZero(b)) {\n\t\t\tint t[] = copy (b);\n\t\t\tdivide (a, b, quot, remainder);\n\t\t\tassign (b, remainder);\t\t\t\n\t\t\tassign (a, t);\n\t\t}\n\n\t\t// value held in a is the computed gcd of (a,b).\n\t\tassign (gcd, a);\n\t}", "private void arretes_fG(){\n\t\tthis.cube[31] = this.cube[28]; \n\t\tthis.cube[28] = this.cube[30];\n\t\tthis.cube[30] = this.cube[34];\n\t\tthis.cube[34] = this.cube[32];\n\t\tthis.cube[32] = this.cube[31];\n\t}" ]
[ "0.61965626", "0.60911155", "0.60740817", "0.58289987", "0.58200496", "0.58195263", "0.57485646", "0.5732344", "0.5723807", "0.56875616", "0.5672855", "0.56712914", "0.56043565", "0.55951554", "0.559127", "0.5571939", "0.5529849", "0.552482", "0.550317", "0.5500876", "0.5488195", "0.5478809", "0.54642135", "0.5461559", "0.54477024", "0.5432391", "0.54160315", "0.539957", "0.53905165", "0.538994", "0.5388076", "0.5385254", "0.53819513", "0.53744566", "0.5356989", "0.53543955", "0.5324092", "0.5301892", "0.52976286", "0.52919596", "0.52911425", "0.527766", "0.5258398", "0.52502626", "0.5244613", "0.5233394", "0.52319604", "0.5228553", "0.52131677", "0.52076715", "0.5207174", "0.5200256", "0.5182728", "0.51822823", "0.5180415", "0.5176898", "0.51753354", "0.5172556", "0.5148604", "0.51475924", "0.5134792", "0.5116843", "0.5110125", "0.51091367", "0.5106216", "0.51007587", "0.51003045", "0.5097786", "0.5093554", "0.5090452", "0.5088866", "0.5086921", "0.50858635", "0.507956", "0.50717604", "0.5069019", "0.50684726", "0.5064918", "0.5062782", "0.5061308", "0.5055581", "0.50549036", "0.5051026", "0.5038333", "0.50350094", "0.50239146", "0.50238913", "0.5022963", "0.5014441", "0.5012562", "0.50079936", "0.5007256", "0.5002926", "0.49962276", "0.49912673", "0.49911106", "0.4989221", "0.49891704", "0.49875167", "0.49863282" ]
0.67966014
0
This method finds the dcs of two elements
private static int findGcd(int a, int b) { int low = a < b ? a : b; int high = a < b ? b : a; if (high % low == 0) { return low; } else { return findGcd(high, high % low); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int distanceBetweenNodes(Node node, int d1, int d2){\r\n ArrayList<Integer> path1 = nodeToRootPath(node, d1);\r\n ArrayList<Integer> path2 = nodeToRootPath(node, d2);\r\n \r\n //Traverse from behind to avoid time complexity\r\n int i = path1.size() - 1;\r\n int j = path2.size() - 1;\r\n \r\n //Check for valid iterations and till the time data is common, first occurence of diff data in arraulist is the time to stop\r\n while(i>=0 && j>=0 && path1.get(i) == path2.get(j)){\r\n i--; j--;\r\n }\r\n \r\n //Here returning i+1 and j+1 means there are i+1 elements left and j+1 elements left which are not common in \r\n //both ArrayList so answer will be addition of these, it will give us the distance between two nodes\r\n //+1 is two times for two edges between i to LCA and j to LCA\r\n return (i+1) + (j+1);\r\n }", "public static int lca(Node node, int d1, int d2){\r\n ArrayList<Integer> path1 = nodeToRootPath(node, d1);\r\n ArrayList<Integer> path2 = nodeToRootPath(node, d2);\r\n \r\n //Traverse from behind to avoid time complexity\r\n int i = path1.size() - 1;\r\n int j = path2.size() - 1;\r\n \r\n //Check for valid iterations and till the time data is common, first occurence of diff data in arraylist is the time to stop\r\n while(i>=0 && j>=0 && path1.get(i) == path2.get(j)){\r\n i--; j--;\r\n }\r\n \r\n //Return the last common element from behind in ArrayList\r\n return path1.get(i+1);\r\n }", "public static int lca(Node node, int d1, int d2) {\n ArrayList<Integer> al1=nodeToRootPath(node,d1);\n ArrayList<Integer> al2=nodeToRootPath(node,d2);\n\n\n int l1=al1.size()-1;\n int l2=al2.size()-1;\n\n while(l1>=0 && l2>=0){\n if(al1.get(l1)==al2.get(l2))\n {\n l1--;\n l2--;\n continue;\n }\n else\n break;\n }\n if(l1==al1.size()-1)\n return -1;\n return al1.get(l1+1);\n }", "static int lcs(int x, int y, String s1, String s2)\n {\n // your code here\n \n int len1 = x;\n \n int len2 = y;\n \n int dp[][] = new int[len1+1][len2+1];\n \n for(int i=0;i<=len1;i++){\n dp[i][0] = 0;\n }\n \n for(int i=0;i<=len2;i++){\n dp[0][i] = 0;\n }\n \n for(int i=1;i<=len1;i++){\n for(int j=1;j<=len2;j++){\n \n if(s1.charAt(i-1)==s2.charAt(j-1)){\n dp[i][j]=1+dp[i-1][j-1];\n }\n else {\n dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]);\n }\n \n }\n }\n \n return dp[len1][len2];\n }", "@Override\r\n\t\t\tpublic int compare(DjikstraPair o1, DjikstraPair o2) {\n\t\t\t\treturn o2.csf - o1.csf;\r\n\t\t\t}", "public static int distanceBetweenNodes(Node node, int d1, int d2){\n ArrayList<Integer> al1= nodeToRootPath(node,d1);\n ArrayList<Integer> al2=nodeToRootPath(node,d2);\n\n if(al1.size()==0 || al2.size()==0)\n return -1;\n int l1=al1.size()-1;\n int l2=al2.size()-1;\n\n while(l1>=0 && l2>=0)\n {\n if(al1.get(l1)==al2.get(l2))\n {\n l1--;l2--;continue;\n }\n else break;\n }\n return l1+l2+2;\n }", "public static Node cccc_combination(LinkedList list1, LinkedList list2) {\n\n Node Katlyn1 = list1.head;\n Node Katlyn2 = list2.head;\n Node nodethaniel = new Node(0);\n Node tail = nodethaniel;\n\n while (true) {\n if (Katlyn1 == null) {\n tail.next = Katlyn2;\n break;\n }\n if (Katlyn2 == null) {\n tail.next = Katlyn1;\n break;\n }\n // Arrow function in Java?\n if (Katlyn1.valueData <= Katlyn2.valueData) {\n tail.next = Katlyn1;\n Katlyn1 = Katlyn1.next;\n } else {\n tail.next = Katlyn2;\n Katlyn2 = Katlyn2.next;\n }\n tail = tail.next;\n }\n return nodethaniel.next;\n }", "private double calculateDistance(Example first, Example second) {\n\t\tdouble distance = 0;\n\t\tfor (Attribute attribute : first.getAttributes()) {\n\t\t\tdouble diff = first.getValue(attribute) - second.getValue(attribute);\n\t\t\tdistance += diff * diff;\n\t\t}\n\t\treturn Math.sqrt(distance);\n\t}", "private Point[] d(Point[] left, Point[] right){\n\t\tif(left == null | right == null){\r\n\t\t\tif(left == null)\r\n\t\t\t\treturn right;\r\n\t\t\telse\r\n\t\t\t\treturn left;\r\n\t\t}\r\n\r\n\t\tdouble dLeft = Math.sqrt(Math.pow(left[0].getX()-left[1].getX(), 2) + Math.pow(left[0].getY()-left[1].getY(), 2));\r\n\t\tdouble dRight = Math.sqrt(Math.pow(right[0].getX()-right[1].getX(), 2) + Math.pow(right[0].getY()-right[1].getY(), 2));\r\n\t\t\r\n\t\tdouble minD = Math.min(dLeft, dRight);\r\n\t\tif(dLeft == minD)\r\n\t\t\treturn left;\r\n\t\telse \r\n\t\t\treturn right;\r\n\t}", "private static List<Integer> getCommonElementsAlgo1(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> list1 = new ArrayList<Integer>();\n\t\tfor (int i : arr1) {\n\t\t\tlist1.add(i);\n\t\t}\n\t\tList<Integer> list2 = new ArrayList<Integer>();\n\t\tfor (int i : arr2) {\n\t\t\tlist2.add(i);\n\t\t}\n\t\tif (list1.size() > list2.size()) {\n\t\t\tlist1.retainAll(list2);\n\t\t\treturn list1;\n\t\t}\n\t\telse {\n\t\t\tlist2.retainAll(list1);\n\t\t\treturn list2;\n\t\t}\n\t\t\n\t}", "private int lcs(String word1, String word2) {\n int m = word1.length();\n int n = word2.length();\n int[][] dp = new int[m + 1][n + 1];\n //mem[i][j] means the LCS length formed by A[:i] and B[:j]\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n if (word1.charAt(i) == word2.charAt(j)) {\n dp[i + 1][j + 1] = dp[i][j] + 1;\n } else {\n dp[i + 1][j + 1] = Math.max(dp[i + 1][j], dp[i][j + 1]);\n }\n }\n }\n return dp[m][n];\n }", "static private double dist(double[] a, double[] b) {\n\t\treturn new gov.pnnl.jac.geom.distance.Euclidean().distanceBetween(a, b);\n }", "private double vectDist(double[] a,double[] b) {\n\t\tdouble out = Double.NEGATIVE_INFINITY;\n\t\tfor (int i = 0; i <a.length;i++) {\n\t\t\tdouble diff = Math.abs(a[i]-b[i]);\n\t\t\tif (diff > out)\n\t\t\t\tout = diff;\n\t\t}\n\t\treturn out;\n\t}", "public int getDistance(int i,int j)\n\t{\n\t\tif (i<j)\n\t\t{\n\t\t\tint tem=i;\n\t\t\ti=j;\n\t\t\tj=tem;\t\n\t\t}\n\t\telse if(i==j)\n\t\t\treturn 0;\n\t\tDNode tem=first;\n\t\tif(tem.indX==i&&tem.indY==j)\n\t\t\treturn tem.distance;\n\t\twhile(tem.nextDNode!=null)\n\t\t{\n\t\t\ttem=tem.nextDNode;\n\t\t\tif(tem.indX==i&&tem.indY==j)\n\t\t\t\treturn tem.distance;\n\t\t}\n\t\treturn 0;\n\t}", "private static List<List<Integer[]>> getDIOCrossConnect() {\n List<List<Integer[]>> pairs = new ArrayList<List<Integer[]>>();\n List<Integer[]> setA =\n Arrays.asList(\n new Integer[][] {\n {DIOCrossConnectA1, DIOCrossConnectA2},\n {DIOCrossConnectA2, DIOCrossConnectA1}\n });\n pairs.add(setA);\n\n List<Integer[]> setB =\n Arrays.asList(\n new Integer[][] {\n {DIOCrossConnectB1, DIOCrossConnectB2},\n {DIOCrossConnectB2, DIOCrossConnectB1}\n });\n pairs.add(setB);\n // NOTE: IF MORE DIOCROSSCONNECT PAIRS ARE ADDED ADD THEM HERE\n return pairs;\n }", "static int countCommon(Node a, Node b) {\n\t\tint count = 0;\n\n\t\t// loop to count coomon in the list starting\n\t\t// from node a and b\n\t\tfor (; a != null && b != null; a = a.next, b = b.next)\n\n\t\t\t// increment the count for same values\n\t\t\tif (a.data == b.data)\n\t\t\t\t++count;\n\t\t\telse\n\t\t\t\tbreak;\n\n\t\treturn count;\n\t}", "private static double getDISSIM(ArrayList<Point> r, ArrayList<Point> s, long t1, long tn){\n\t\tif(r.size() < 2 || s.size() < 2){\n\t\t\treturn INFINITY;\n\t\t}\n\t\t\n\t\tArrayList<Double> dist_t = new ArrayList<Double>();\n\t\tint index_r = 0, index_s = 0;\n\t\tfor(long t = t1; t <= tn; t += TIME_INCREMENT){\n\t\t\tPoint r_p1 = r.get(index_r);\n\t\t\tPoint r_p2 = r.get(index_r+1);\n\t\t\tPoint s_p1 = s.get(index_s);\n\t\t\tPoint s_p2 = s.get(index_s+1);\n\t\t\t\n\t\t\t// get the 'distance' between the two trajectories at time t\n\t\t\tdist_t.add(getDistance(r_p1, r_p2, s_p1, s_p2, t));\n\t\t\t\n\t\t\t// current time reached the time of the next point\n\t\t\tif(t > r_p2.timeLong && index_r < r.size()-2){\n\t\t\t\tindex_r++;\n\t\t\t}\n\t\t\tif(t > s_p2.timeLong && index_s < s.size()-2){\n\t\t\t\tindex_s++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tdouble dissim = 0;\n\t\tfor(int i=0; i<dist_t.size()-1; i++) {\n\t\t\tdissim += (dist_t.get(i) + dist_t.get(i+1))*TIME_INCREMENT;\n\t\t}\n\t\t\n\t\treturn dissim/2;\n\t}", "public double computeDistance(cluster c1, cluster c2) {\n\t\tdouble closest = 4000;\n\t\tfor (point p1 : c1.getPoints()) {\n\t\t\tfor (point p2 : c2.getPoints()) {\n\t\t\t\tdouble dist = Math.sqrt(Math.pow( (p1.x() - p2.x()) , 2) + Math.pow( (p1.y() - p2.y()) , 2));\n\t\t\t\tif (dist < closest) {\n\t\t\t\t\tclosest = dist;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn closest;\n\t}", "private static List<Integer> getCommonElementsAlgo2(int [] arr1, int [] arr2) {\n\t\t\n\t\tList<Integer> duplicates = new ArrayList<>();\n\t\t\n\t\tHashtable<Integer, Integer> table = new Hashtable<>();\n\t\t\n\t\tfor (int i : arr1) {\n\t\t\tif (table.containsKey(i)) {\n\t\t\t\ttable.put(i, table.get(i) + 1);\n\t\t\t}\n\t\t\ttable.put(i, 1);\n\t\t}\n\t\t\n\t\tfor (int j : arr2) {\n\t\t\tif (table.containsKey(j)) {\n\t\t\t\tduplicates.add(j);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn duplicates;\n\t\t\n\t}", "private static int commonChild(String s1, String s2) {\n //reduce of iterations\n //make strings shorter\n //TreeMap to keep order\n Map<Integer, Character> map1 = new TreeMap<>();\n Map<Integer, Character> map2 = new TreeMap<>();\n StringBuilder stringBuilder = new StringBuilder();\n for (int i = 0; i < s1.length(); i++) {\n for (int j = 0; j < s2.length(); j++) {\n char charOfS1 = s1.charAt(i);\n char charOfS2 = s2.charAt(j);\n if (charOfS1 == charOfS2) {\n map1.put(i, charOfS1);\n map2.put(j, charOfS2);\n }\n }\n }\n for (Map.Entry<Integer, Character> entry : map1.entrySet()) {\n stringBuilder.append(entry.getValue());\n }\n s1 = stringBuilder.toString();\n stringBuilder = new StringBuilder();\n for (Map.Entry<Integer, Character> entry : map2.entrySet()) {\n stringBuilder.append(entry.getValue());\n }\n s2 = stringBuilder.toString();\n /*\n ------------------------------------------------\n */\n int lengthS1 = s1.length();\n int lengthS2 = s2.length();\n int[][] arr = new int[lengthS1+1][lengthS2+1];\n for (int i = 1; i <= lengthS1; i++) {\n for (int j = 1; j <= lengthS2; j++) {\n char charI = s1.charAt(i - 1); //from 0\n char charJ = s2.charAt(j - 1); //from 0\n arr[i][j] = (charI==charJ) ?\n arr[i-1][j-1] + 1 :\n Math.max(arr[i-1][j],arr[i][j-1]);\n }\n }\n\n return arr[lengthS1][lengthS2];\n }", "void djcalc(LinkedList<Edge> l[],int cn, int visited[],Nodedj n[],int sn, LinkedList<Integer> path[]){\n\t\n\t\tLinkedList<Nodedj> neighbour = new LinkedList<Nodedj>();\n\t\tIterator<Edge> it1 = l[sn].iterator();\n\t\tn[sn].cost = 0;\n\t\twhile(it1.hasNext())\n\t\t{\n\t\t\tEdge e= (Edge)it1.next();\n\t\t\tn[e.adjIndex].cost = e.cost;\n\t\t\tneighbour.add(n[e.adjIndex]);\n\t\t\tvisited[sn] = 1;\n\t\t\tpath[e.adjIndex].add(e.adjIndex);\n\n\t\t}\n\t\n\t\t/*The sort function is implemented in the Nodedj class*/\n\t\n\t\tCollections.sort(neighbour);\n\t\twhile(!neighbour.isEmpty()){\n\n\t\t\t/*Used for adding nodes into the neghbor list depending on its distance*/\n\t\n\t\t\tNodedj tempn = neighbour.remove();\n\t\t\tIterator<Edge> it2 = l[tempn.index].iterator();\n\t\t\tvisited[tempn.index] = 1;\n\t\t\twhile(it2.hasNext())\n\t\t\t{\n\t\t\t\tEdge e= (Edge)it2.next();\n\t\t\t\tif(visited[e.adjIndex]!=1 && !neighbour.contains(n[e.adjIndex])){\n\t\t\t\t\tneighbour.add(n[e.adjIndex]);\n\n\t\t\t\t}\n\t\t\t\tdouble tempcost;\n\t\t\t\ttempcost= e.cost+n[tempn.index].cost;\n\t\t\t\tif(tempcost < n[e.adjIndex].cost){\n\t\t\t\t\tn[e.adjIndex].cost = tempcost;\n\t\t\t\t\tpath[e.adjIndex].clear();\n\t\t\t\t\tfor(int i=0; i < path[tempn.index].size(); i++){\n\t\t\t\t\t\tpath[e.adjIndex].add(path[tempn.index].get(i));\n\t\t\t\t\t}\n\t\t\t\t\tpath[e.adjIndex].add(e.adjIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t\tCollections.sort(neighbour);\n\t\t}\n\n\t}", "public int getGreatestCommonDivisor(int first, int second) {\n\t\t// TODO Write an implementation for this method declaration\n\t\tint GCD = 0;\n\t\tboolean found = false;\n\t\tArrayList<Integer> firstDivisor = new ArrayList<Integer>();\n\t\tArrayList<Integer> secondDivisor = new ArrayList<Integer>();\n\t\tif(first < 10 || second < 10) {\n\t\t\tGCD = -1;\n\t\t}\n\t\telse {\n\t\t\tfor(int i = 1; i <= first; i++) {\n\t\t\t\tif(first % i == 0) {\n\t\t\t\t\tfirstDivisor.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i = 1; i <= second; i++) {\n\t\t\t\tif(second % i ==0) {\n\t\t\t\t\tsecondDivisor.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n//\t\t\tfor(Integer i: firstDivisor) {\n//\t\t\t\tSystem.out.println(i);\n//\t\t\t}\n//\t\t\tfor(Integer i: secondDivisor) {\n//\t\t\t\tSystem.out.println(i);\n//\t\t\t}\n\t\t\t\n\t\t\tif(firstDivisor.size() >= secondDivisor.size()) {\n\t\t\t\tGCD = firstDivisor.get(0);\n\t\t\t\tfor(int i =0; i < firstDivisor.size(); i++) {\n\t\t\t\t\tfor(int j =0; j < secondDivisor.size(); j++) {\n\t\t\t\t\t\tif(secondDivisor.get(j)==firstDivisor.get(i)) {\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(found == true) {\n\t\t\t\t\t\tif(firstDivisor.get(i) >= GCD) {\n\t\t\t\t\t\t\tGCD = firstDivisor.get(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfound = false;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(secondDivisor.size() >= firstDivisor.size()) {\n\t\t\t\tGCD = secondDivisor.get(0);\n\t\t\t\tfor(int i =0; i < secondDivisor.size(); i++) {\n\t\t\t\t\tfor(int j =0; j < firstDivisor.size(); j++) {\n\t\t\t\t\t\tif(firstDivisor.get(j)==secondDivisor.get(i)) {\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(found == true) {\n\t\t\t\t\t\tif(secondDivisor.get(i) >= GCD) {\n\t\t\t\t\t\t\tGCD = secondDivisor.get(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfound = false;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\n\t\t}\n\t\t//System.out.println(GCD);\n\t\treturn GCD;\n\t}", "private final static void dddivd(final double[] a, final double b, double[] c) {\n\tdouble t1 = a[0] / b;\n\tdouble cona = t1 * SPLIT;\n\tdouble conb = b * SPLIT;\n\tdouble a1 = cona - (cona - t1);\n\tdouble b1 = conb - (conb - b);\n\tdouble a2 = t1 - a1;\n\tdouble b2 = b - b1;\n\tdouble t12 = t1 * b;\n\tdouble t22 = (((a1 * b1 - t12) + a1 * b2) + a2 * b1) + a2 * b2;\n\tdouble t11 = a[0] - t12;\n\tdouble e = t11 - a[0];\n\tdouble t21 = ((-t12 - e) + (a[0] - (t11 - e))) + a[1] - t22;\n\tdouble t2 = (t11 + t21) / b;\n\tdouble s1 = t1 + t2;\n\tc[0] = s1;\n\tc[1] = t2 - (s1 - t1);\n\treturn;\n }", "private double dist(double [] v1, double [] v2){\n \t\tdouble sum=0;\n \t\tfor (int i=0; i<nDimensions; i++){\n \t\t\tdouble d = v1[i]-v2[i];\n \t\t\tsum += d*d;\n \t\t}\n \t\treturn Math.sqrt(sum);\n \t}", "public static List<Integer> lcs(List<Integer> arr1, List<Integer> arr2) {\r\n ArrayList empty = new ArrayList();\r\n /* BEFORE WE ALLOCATE ANY DATA STORAGE, VALIDATE ARGS */\r\n if (null == arr1 || 0 == arr1.size())\r\n return empty;\r\n if (null == arr2 || 0 == arr2.size())\r\n return empty;\r\n\r\n if (equalLists(arr1, arr2)) {\r\n return arr1;\r\n }\r\n\r\n /* ALLOCATE VARIABLES WE'LL NEED FOR THE ROUTINE */\r\n ArrayList<Integer> bestMatch = new ArrayList<Integer>();\r\n ArrayList<Integer> currentMatch = new ArrayList<Integer>();\r\n ArrayList<List<Integer>> dataSuffixList = new ArrayList<List<Integer>>();\r\n ArrayList<List<Integer>> lineSuffixList = new ArrayList<List<Integer>>();\r\n\r\n /* FIRST, COMPUTE SUFFIX ARRAYS */\r\n for (int i = 0; i < arr1.size(); i++) {\r\n dataSuffixList.add(arr1.subList(i, arr1.size()));\r\n }\r\n for (int i = 0; i < arr2.size(); i++) {\r\n lineSuffixList.add(arr2.subList(i, arr2.size()));\r\n }\r\n\r\n /* STANDARD SORT SUFFIX ARRAYS */\r\n IntegerListComparator comp = new IntegerListComparator();\r\n Collections.sort(dataSuffixList, comp);\r\n Collections.sort(lineSuffixList, comp);\r\n\r\n /* NOW COMPARE ARRAYS MEMBER BY MEMBER */\r\n List<?> d = null;\r\n List<?> l = null;\r\n List<?> shorterTemp = null;\r\n int stopLength = 0;\r\n int k = 0;\r\n boolean match = false;\r\n\r\n bestMatch.retainAll(empty);\r\n bestMatch.addAll(currentMatch);\r\n for (int i = 0; i < dataSuffixList.size(); i++) {\r\n d = (List) dataSuffixList.get(i);\r\n for (int j = 0; j < lineSuffixList.size(); j++) {\r\n l = (List) lineSuffixList.get(j);\r\n if (d.size() < l.size()) {\r\n shorterTemp = d;\r\n } else {\r\n shorterTemp = l;\r\n }\r\n\r\n currentMatch.retainAll(empty);\r\n k = 0;\r\n stopLength = shorterTemp.size();\r\n match = (l.get(k).equals(d.get(k)));\r\n while (k < stopLength && match) {\r\n if (l.get(k).equals(d.get(k))) {\r\n currentMatch.add((Integer) shorterTemp.get(k));\r\n k++;\r\n } else {\r\n match = false;\r\n }\r\n }\r\n if (currentMatch.size() > bestMatch.size()) {\r\n bestMatch.retainAll(empty);\r\n bestMatch.addAll(currentMatch);\r\n }\r\n }\r\n }\r\n return bestMatch;\r\n }", "public static double getDist(int id1, int id2) {\n\t\tArrayList<Double> gA1 = geneAttributes.get(id1);\n\t\tArrayList<Double> gA2 = geneAttributes.get(id2);\n\t\tdouble dist = 0;\n\t\tfor(int i=0;i<gA1.size();i++) {\n\t\t\tdist += ( (gA1.get(i) - gA2.get(i)) * (gA1.get(i) - gA2.get(i)) );\n\t\t}\n\t\tdist = Math.sqrt(dist);\n\t\treturn dist;\n\t}", "public ArrayList<RdV> afficherRdV(LocalDate d1, LocalDate d2) {\n ArrayList<RdV> plage_RdV = new ArrayList();\n if (this.getAgenda() != null) {\n for (RdV elem_agenda : this.getAgenda()) {\n //si le rdv inscrit dans l'agenda est compris entre d1 et d2\n //d1<elem_agenda<d2 (OU d2<elem_agenda<d1 si d2<d1)\n if ((elem_agenda.getDate().isAfter(d1) && elem_agenda.getDate().isBefore(d2))\n || (elem_agenda.getDate().isAfter(d2) && elem_agenda.getDate().isBefore(d1))) {\n plage_RdV.add(elem_agenda);\n }\n }\n //on print la liste de rdv avant tri\n System.out.print(plage_RdV);\n //on print la liste de rdv avant tri\n System.out.print(\"\\n\");\n Collections.sort(plage_RdV);\n System.out.print(plage_RdV);\n\n }\n\n return plage_RdV;\n\n }", "private Similarity getSimilarity(DisjointSets<Pixel> ds, int root1, int root2)\n {\n return null; //TODO: remove and replace this line\n }", "private static double calculaDistancia(double[] param1, double[] param2){\n\t\tdouble res1= Math.pow((param1[0]-param2[0]), 2);\n\t\tdouble res2= Math.pow((param1[1]-param2[1]), 2);\n\t\tdouble res3= Math.pow((param1[2]-param2[2]), 2);\n\t\tdouble res4= res1 + res2 + res3;\n\t\tdouble res5= res4/3;\n\t\tdouble res6= Math.sqrt(res5);\n\t\treturn res6;\n\t}", "private double intersect(double start0, double end0, double start1, double end1)\n {\n double length = Double.min(end0, end1) - Double.max(start0, start1);\n return Double.min(Double.max(0, length), 1.0);\n }", "void calculateDistance()\t{\n\t\t\t\t\t\t\t\t\t\n\t\tfor (String substringOne : setOne)\t{\n\t\t\t\tif (setTwo.contains(substringOne))\n\t\t\t\t\toverlapSubstringCount++;\n\t\t}\t\t\t\t\t\t\t\n\n\t\tsubstringCount = (length1 - q) + (length2 - q) + 2 - overlapSubstringCount; \n\t\tdistance = (double)overlapSubstringCount/(substringCount - overlapSubstringCount);\t\n\t}", "public static double distance(int first, int second){\n\t\treturn first-second;\n\t\t\n\t}", "public List<List<Object>> getElementaryCycles()\n {\n this.cycles = new Vector<>();\n this.blocked = new boolean[this.adjList.length];\n this.B = new Vector[this.adjList.length];\n this.stack = new Vector<>();\n StrongConnectedComponents sccs = new StrongConnectedComponents(this.adjList);\n int s = 0;\n\n while (true) {\n SCCResult sccResult = sccs.getAdjacencyList(s);\n if (sccResult != null && sccResult.getAdjList() != null) {\n Vector[] scc = sccResult.getAdjList();\n s = sccResult.getLowestNodeId();\n for (int j = 0; j < scc.length; j++) {\n if ((scc[j] != null) && (scc[j].size() > 0)) {\n this.blocked[j] = false;\n this.B[j] = new Vector();\n }\n }\n\n this.findCycles(s, s, scc);\n s++;\n }\n else {\n break;\n }\n }\n\n return this.cycles;\n }", "public abstract double calculateDistance(double[] x1, double[] x2);", "public static void main(String[] args) {\n\t\tString vertex=\"abcdefghij\";\n\t\tString edge=\"bdegachiabefbc\";\n\t\tchar[] vc=vertex.toCharArray();\n\t\tchar[] ec=edge.toCharArray();\n\t\tint[] v=new int[vc.length];\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tv[i]=vc[i]-'a'+1;\n\t\t}\n\t\tint[] e=new int[ec.length];\n\t\tfor (int i = 0; i < e.length; i++) {\n\t\t\te[i]=ec[i]-'a'+1;\n\t\t}\t\t\n\t\t\n\t\tDS_List ds_List=new DS_List(v.length);\n//\t\tfor (int i = 0; i < v.length; i++) {\n//\t\t\tds_List.make_set(v[i]);\n//\t\t}\n//\t\tfor (int i = 0; i < e.length; i=i+2) {\n//\t\t\tif (ds_List.find_set(e[i])!=ds_List.find_set(e[i+1])) {\n//\t\t\t\tds_List.union(e[i], e[i+1]);\n//\t\t\t}\n//\t\t}\n\t\tds_List.connect_components(v, e);\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tSystem.out.print(ds_List.find_set(v[i])+\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ds_List.same_component(v[1], v[2]));\n\t}", "public static double computeDistance (double[] arr1, double[] arr2, int d) {\n\t\tif (arr1.length < d || arr2.length < d)\n\t\t\treturn -1;\n\n\t\tdouble sum = 0;\n\t\tfor (int i=0; i<d; i++) {\n\t\t\tsum += (arr1[i] - arr2[i]) * (arr1[i] - arr2[i]);\n\t\t}\n\t\treturn sum;\n\t}", "public double jaccardDistance(TreeSet<String> other) {\n\t\tif(other.isEmpty()||this.isEmpty()||this.first().length()!=other.first().length()){\n\t\t\treturn 0;\n\t\t}\n\t\tShingleSet intersection = new ShingleSet(other.first().length());\n\t\tShingleSet union = new ShingleSet(other.first().length());\n\t\tintersection.addAll(other);\n\t\tunion.addAll(other);\n//\t\tSystem.out.println(this.toString()+other.toString());\n\t\tintersection.retainAll(this);\n\t\tunion.addAll(this);\n//\t\tSystem.out.println(intersection.toString()+union.toString());\n//\t\tSystem.out.println(intersection.size()+\" \"+union.size());\t\t\n\t\treturn 1 - (double) intersection.size()/ (double) union.size(); \n\t}", "int lcs(int x, int y, string s1, string s2,int[][] str){\n \n if(text1.length()==0||text2.length()==0) {\n return 0;\n }\n \n if(str[x][y]!=0) {\n return str[x][y];\n }\n \n int ans =0;\n \n if(text1.charAt(0)== text2.charAt(0)) {\n \n \n \n ans = 1 + longestCommonSubsequence(x+1,y+1,ros1, ros2,str);\n \n \n }\n else {\n \n int first = longestCommonSubsequence(x,y+1,ros1, text2,str);\n int second = longestCommonSubsequence(x+1,y,text1, ros2,str);\n \n ans = Math.max(first,second);\n \n \n \n }\n \n str[x][y] = ans;\n return ans;\n \n \n \n \n \n}", "public int compare(Object nodes1, Object nodes2) {\r\n\t\tdouble w1 = 0.0;\r\n\t\tIterator it = ((Set)nodes1).iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tDouble v = ((Node) it.next()).getWeightValueUnsynchronized(\"value\");\r\n\t\t\tw1 += (v==null ? 1.0 : v.doubleValue());\r\n\t\t}\r\n\t\tdouble w2 = 0.0;\r\n\t\tit = ((Set)nodes2).iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tDouble v = ((Node) it.next()).getWeightValueUnsynchronized(\"value\");\r\n\t\t\tw2 += (v==null ? 1.0 : v.doubleValue());\r\n\t\t}\r\n\t\tint res = Double.compare(w2, w1);\r\n\t\tif (res==0) { // oops, must figure out how they differ\r\n\t\t\tSet ns1 = (Set) nodes1;\r\n\t\t\tSet ns2 = (Set) nodes2;\r\n\t\t\tint ns1sz = ns1.size();\r\n\t\t\tint ns2sz = ns2.size();\r\n\t\t\tif (ns1sz>ns2sz) return -1; // more nodes, the better\r\n\t\t\telse if (ns1sz<ns2sz) return 1;\r\n\t\t\t// go through the *very* expensive nodes discrimination\r\n\t\t\tIterator it1 = ns1.iterator();\r\n\t\t\tIntSet nis1 = new IntSet();\r\n\t\t\twhile (it1.hasNext()) {\r\n\t\t\t\tNode n = (Node) it1.next();\r\n\t\t\t\tnis1.add(new Integer(n.getId()));\r\n\t\t\t}\r\n\t\t\tIterator it2 = ns2.iterator();\r\n\t\t\tIntSet nis2 = new IntSet();\r\n\t\t\twhile (it2.hasNext()) {\r\n\t\t\t\tNode n = (Node) it2.next();\r\n\t\t\t\tnis2.add(new Integer(n.getId()));\r\n\t\t\t}\r\n\t\t\treturn nis2.compareTo(nis1);\r\n\t\t}\r\n\t\treturn res;\r\n\t}", "static int lcs(int p, int q, String s1, String s2){\n int [][]t=new int[p+1][q+1];\n for(int i=0;i<p+1;i++){\n for(int j=0;j<q+1;j++){\n if(i==0||j==0){\n t[i][j]=0;\n }\n }\n }\n for(int i=1;i<p+1;i++){\n for(int j=1;j<q+1;j++){\n if(s1.charAt(i-1)==s2.charAt(j-1)){\n t[i][j]=1+t[i-1][j-1];\n }\n else{\n t[i][j]=Math.max(t[i-1][j],t[i][j-1]);\n }\n }\n }\n return t[p][q];\n }", "public int[] findClusterCorrespondence(int[] idx1, int[] idx2) {\n\t\tint n = idx1.length;\n\t\tif (n != idx2.length) {\n\t\t\tSystem.out.println(\"Cluster Utils: findClusterCorrespondence: idx1 and idx2 has to have same number of elements\");\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\t// find unique values in idx1 and idx2\n\t\tUniqueResult<Integer> ur_idx1 = utils.findUnique(idx1);\n\t\tUniqueResult<Integer> ur_idx2 = utils.findUnique(idx2);\n\t\tif (ur_idx1.domain.length != ur_idx2.domain.length) {\n\t\t\tSystem.out.println(\"Cluster Utils: findClusterCorrespondence: idx1 and idx2 has different number of clusters\");\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\t// find Jaccard coefficient\n\t\tdouble[][] J = findJaccardIndex(idx1, idx2);\n\t\t\n\t\t// use Hungarian method - use any kind of Hungarian algorithm\n\t\tHungarianAlgorithm h = new HungarianAlgorithm();\n\t\t@SuppressWarnings(\"static-access\")\n\t\tint[][] match = h.hgAlgorithm(J, \"max\");\n\t\t\n\t\t// print match matrix\n\t\tif (verbose) {\n\t\t\tSystem.out.println(\"Hunguarian Cost Matrix\");\n\t\t\tutils.printMatrix(match);\n\t\t}\n\t\t\n\t\t// relabel the idx2\n\t\tif (verbose) System.out.println(\"Class correspondents matrix:\");\n\t\tint[] target = idx1.clone();\n\t\tfor (int i = 0; i < match.length; i++) {\n\t\t\tint idx1_index = ur_idx1.domain[match[i][0]];\n\t\t\tint idx2_index = ur_idx2.domain[match[i][1]];\n\t\t\tif (verbose) System.out.printf(\"%d\\t%d\", idx1_index, idx2_index);\t\t\t\n\t\t\tif (idx1_index != idx2_index) {\n\t\t\t\tif (verbose) System.out.printf(\"\\t(will replace all %d in idx2 by %d)\", idx2_index, idx1_index);\n\t\t\t\tboolean[] index = utils.getIndexByValue(idx2, idx2_index);\n\t\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\t\tif (index[j]) target[j] = idx1_index;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (verbose) System.out.printf(\"\\n\");\n\t\t}\n\t\t\n\t\tif (verbose) {\n\t\t\tint v_tt = 15;\n\t\t\tif (target.length < v_tt) v_tt = target.length;\n\t\t\tSystem.out.printf(\"Printing first %d elements of input and output arrays\\n\", v_tt);\n\t\t\tSystem.out.printf(\"IDX1\\tIDX2\\tFINAL IDX\\n\");\n\t\t\tfor (int i = 0; i < v_tt; i++) System.out.printf(\"%d\\t%d\\t%d\\n\", idx1[i], idx2[i], target[i]);\n\t\t}\n\t\t\n\t\treturn target;\n\t}", "public double calcDist(double lat2, double lon2, ArrayList<Record> cCentres)\n {\n double dist = 0;\n if (lat1==lat2 && lon1==lon2)\n dist = 0;\n else {\n double theta = lon1 - lon2;\n dist = Math.sin(Math.toRadians(lat1)) * Math.sin(Math.toRadians(lat2)) + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) * Math.cos(Math.toRadians(theta));\n dist = Math.acos(dist);\n dist = Math.toDegrees(dist);\n dist = dist * 60 * 1.1515;\n dist = dist * 1.609344; //km\n }\n return (dist);\n }", "public static double euclideanDistance(Prototype one, Prototype two)\r\n {\r\n return d(one, two);\r\n }", "public static void main(String[] args) {\n\n\t\tString s1 = \"dabc\"; int l1 = s1.length();\n\t\tString s2 = \"abcd\"; int l2 = s2.length();\n//\t\tSystem.out.println(findED(s1, s2, l1, l2));\n\t\tSystem.out.println(findEDdp(s1, s2));\n\t}", "private double intersection(HardClustering hard1, int comm1,\n HardClustering hard2, int comm2) {\n final TIntArrayList duplicate = new TIntArrayList(hard1.members(comm1));\n duplicate.retainAll(hard2.members(comm2));\n\n return duplicate.size();\n }", "public double distance(DataInstance d1, DataInstance d2, List<Attribute> attributeList);", "@Test\n public void codonCompare2(){\n //these list are already sorted\n AminoAcidLL first = AminoAcidLL.createFromRNASequence(c);\n AminoAcidLL second = AminoAcidLL.createFromRNASequence(d);\n int expected = 1;\n assertEquals(expected, first.codonCompare(second));\n\n }", "private Set<Integer>[] getKernelDAG(List<Integer>[] adjacent) {\n Set<Integer>[] adjacentComponents = (HashSet<Integer>[]) new HashSet[sccCount];\n for (int i = 0; i < adjacentComponents.length; i++) {\n adjacentComponents[i] = new HashSet<>();\n }\n\n for (int vertexId = 0; vertexId < adjacent.length; vertexId++) {\n int currentComponent = sccIds[vertexId];\n\n for (int neighbor : adjacent[vertexId]) {\n if (currentComponent != sccIds[neighbor]) {\n adjacentComponents[currentComponent].add(sccIds[neighbor]);\n }\n }\n }\n return adjacentComponents;\n }", "private final static void ddsub(final double[] a, final double[] b, double[] c) {\n\tdouble t1 = a[0] - b[0];\n\tdouble e = t1 - a[0];\n\tdouble t2 = ((-b[0] - e) + (a[0] - (t1 - e))) + a[1] - b[1];\n\tdouble s1 = t1 + t2;\n\tc[0] = s1;\n\tc[1] = t2 - (s1 - t1);\n\treturn;\n }", "public int compare(Dataset object1, Dataset object2){\n if(object1.getAttributeCount() != candidate.getAttributeCount() ||\n object2.getAttributeCount() != candidate.getAttributeCount()){\n return 0;\n }\n\n double dist1 = 0.0, dist2 = 0.0;\n double tmp1 = 0.0, tmp2 = 0.0;\n\n for(int i = 0; i < candidate.getAttributeCount(); i++){\n if(candidate.getOutputColumnCount() == (i+1)){\n continue;\n }\n\n Attribute ac = candidate.getAttribute(i);\n Attribute a1 = object1.getAttribute(i);\n Attribute a2 = object2.getAttribute(i);\n\n if(ac.getType() == AttributeTypes.TEXT){\n dist1 += DatasetEuklidianComparator.unlimitedCompare((String)ac.getValue(), (String)a1.getValue());\n dist2 += DatasetEuklidianComparator.unlimitedCompare((String)ac.getValue(), (String)a2.getValue());\n }else{\n /*\n double acDouble = 0.0;\n double a1Double = 0.0;\n double a2Double = 0.0;\n switch(ac.getType()){\n case INTEGER: acDouble = (double)((Integer)ac.getValue()).intValue(); break;\n case DECIMAL: acDouble = (double)ac.getValue();\n }\n switch(a1.getType()){\n case INTEGER: a1Double = (double)((Integer)a1.getValue()).intValue(); break;\n case DECIMAL: a1Double = (double)a1.getValue();\n }\n switch(a2.getType()){\n case INTEGER: a2Double = (double)((Integer)a2.getValue()).intValue(); break;\n case DECIMAL: a2Double = (double)a2.getValue();\n }*/\n double acDouble = (double)ac.getValue();\n double a1Double = (double)a1.getValue();\n double a2Double = (double)a2.getValue();\n\n tmp1 += Math.pow(a1Double-acDouble, 2);\n tmp2 += Math.pow(a2Double-acDouble, 2);\n }\n }\n\n dist1 += Math.sqrt(tmp1);\n dist2 += Math.sqrt(tmp2);\n\n if (dist1 > dist2) {\n return 1;\n }\n if (dist1 < dist2) {\n return -1;\n }\n return 0;\n }", "private int distance(int[] a, int[] b) {\n return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]);\n }", "public int pgcdByDE(int a, int b) throws Exception{\n if(a <1 || b <1){\n throw new Exception(\"a et b doivent etre >= 1\");\n }\n int reste = a > b ? a % b : b % a;\n if(reste == 0)\n return a > b ? b : a;\n if(a > b){\n a = reste;\n }else b = reste;\n return pgcdByDE(a,b);\n }", "private void calculerBordsDomaine() {\n\t\tfor (Contrainte c : contraintes) {\n\t\t\tbords.add(new Bord(this, c));\n\t\t}\n\t}", "public static int gcds(int n, int d) {\n\tint min;\n\tint max;\n\tint stor;\n\tif ((n == 0) || (d == 0)){\n\t return 0;\n\t}\n\telse {\n\t if ( n >= d ) {\n\t\tmax = n;\n\t\tmin = d;\n\t }\n\t else {\n\t\tmax = d;\n\t\tmin = n;\n\t }\n\t while (min != 0){\n\t stor = min;\n\t\tmin = max % min;\n\t\tmax = stor;\n\t }\n\t return max;\n\t}\n }", "static int[] connectedCities(int n, int g, int[] originCities, int[] destinationCities) {\n Map<Integer, TreeSet<Integer>> m1 = new HashMap<>();\n\n Map<Integer, TreeSet<Integer>> m2 = new HashMap<>();\n\n for (int i = 0; i <originCities.length ; i++) {\n TreeSet<Integer> s1 = new TreeSet<>();\n int c=originCities[i];\n for (int j = c; j>=1 ; j--) {\n if(c%j==0)\n s1.add(j);\n }\n m1.put(c,s1);\n }\n\n\n for (int i = 0; i <destinationCities.length ; i++) {\n TreeSet<Integer> s1 = new TreeSet<>();\n int c=destinationCities[i];\n for (int j = c/2; j>=1 ; j--) {\n if(c%j==0)\n s1.add(j);\n }\n m2.put(c,s1);\n }\n\n\n int result [] = new int[originCities.length];\n for (int i = 0; i <originCities.length ; i++) {\n\n int max1 =m1.get(originCities[i]).last();\n\n int max2 =m2.get(destinationCities[i]).last();\n if(max1 <=g)\n result[i]=0;\n else if(max2 <=g)\n result[i]=0;\n else{\n TreeSet<Integer> s1 =m1.get(originCities[i]);\n TreeSet<Integer> s2 =m2.get(destinationCities[i]);\n for (Integer x: s1) {\n if(s2.contains(x)) {\n result[i] = 1;\n break;\n }\n\n }\n }\n\n }\n\n return result;\n\n }", "public static void main(String[] args) {\n\t\tint[] arr1 = {4,7,3,9,2};\r\n\t int[] arr2 = {3,2,12,9,40,32,4};\r\n\t \r\n\t for(int i = 0;i < arr1.length; i++) {\r\n\t for(int j = 0; j < arr2.length; j++) {\r\n\t if(arr1[i] == arr2[j]) { \r\n\t System.out.print(\"common values are:\"+arr1[i]);\r\n\t \r\n\t } \r\n\t } \r\n\t}\r\n\r\n\t}", "private int twoCitySchedCostSorting(int[][] costs) {\n Comparator<int[]> comparator = Comparator.comparingInt(o -> (o[0] - o[1]));\n Arrays.sort(costs, comparator);\n int sum = 0;\n for (int i = 0; i < costs.length / 2; i++) {\n sum += costs[i][0];\n sum += costs[costs.length / 2 + i][1];\n }\n return sum;\n }", "private double findDistance(int[] pos1, int[] pos2) {\n return sqrt((pos1[0]-pos2[0])*(pos1[0]-pos2[0])+\n (pos1[1]-pos2[1])*(pos1[1]-pos2[1]));\n }", "private int commonLength( int i0, int i1 )\n {\n \tint n = 0;\n \twhile( (text[i0] == text[i1]) && (text[i0] != STOP) ){\n \t i0++;\n \t i1++;\n \t n++;\n \t}\n \treturn n;\n }", "public static int lcs(String s1, String s2, int i, int j) {\n\n if (i < 0 || j < 0)\n return 0;\n if (s1.charAt(i) == s2.charAt(j)) {\n // System.out.println(s1.charAt(i) + \" \" + v++);\n return (1 + lcs(s1, s2, i - 1, j - 1));\n } else {\n // System.out.println(v++);\n return (Math.max(lcs(s1, s2, i, j - 1), lcs(s1, s2, i - 1, j)));\n }\n\n }", "@Test\n\tpublic void evalCrispDistanceWithCrisp1(){\n\t\tFuzzySet res = (CrispSet)cs1.distance(cs2);\n\t\tassertTrue(res instanceof CrispSet);\n\t\tCrispSet resCrisp = (CrispSet)res;\n\t\t//Puntos limite\t\t\n\t\tassertTrue(resCrisp.getLeftBoundary()==3);\n\t\tassertTrue(resCrisp.getRightBoundary()==6);\n\t\t//Valores extremos\n\t\tassertTrue(resCrisp.getMembershipValue(0)==0);\n\t\tassertTrue(resCrisp.getMembershipValue(3)==1);\n\t\tassertTrue(resCrisp.getMembershipValue(4)==1);\n\t\tassertTrue(resCrisp.getMembershipValue(4.5)==1);\n\t\tassertTrue(resCrisp.getMembershipValue(5)==1);\n\t\tassertTrue(resCrisp.getMembershipValue(6)==1);\n\t\tassertTrue(resCrisp.getMembershipValue(6.01)==0);\n\t}", "private int dist(int city1, int city2){\n\t\treturn this.getGraph().getWeight(city1, city2);\n\t}", "public Set<V> findCycles()\n {\n // ProbeIterator can't be used to handle this case,\n // so use StrongConnectivityAlgorithm instead.\n StrongConnectivityAlgorithm<V, E> inspector =\n new KosarajuStrongConnectivityInspector<>(graph);\n List<Set<V>> components = inspector.stronglyConnectedSets();\n\n // A vertex participates in a cycle if either of the following is\n // true: (a) it is in a component whose size is greater than 1\n // or (b) it is a self-loop\n\n Set<V> set = new LinkedHashSet<>();\n for (Set<V> component : components) {\n if (component.size() > 1) {\n // cycle\n set.addAll(component);\n } else {\n V v = component.iterator().next();\n if (graph.containsEdge(v, v)) {\n // self-loop\n set.add(v);\n }\n }\n }\n\n return set;\n }", "public static double getEuclideanDistance(DblArray1SparseVector x, \r\n\t\t DblArray1SparseVector y) {\r\n if (x==null || y==null) \r\n\t\t\tthrow new IllegalArgumentException(\"at least one arg null\");\r\n if (x.getNumCoords()!=y.getNumCoords()) \r\n\t\t\tthrow new IllegalArgumentException(\"args of different dimensions\");\r\n\t\tfinal int n = x.getNumCoords();\r\n double dist = 0.0;\r\n\t\tif (Double.compare(x.getDefaultValue(),y.getDefaultValue())==0) {\r\n\t\t\tfinal int xs_nz = x.getNumNonZeros();\r\n\t\t\tfinal int ys_nz = y.getNumNonZeros();\r\n\t\t\tfinal double defVal = x.getDefaultValue();\r\n\t\t\tint x_ind = 0;\r\n\t\t\tint y_ind = 0;\r\n\t\t\twhile (x_ind<xs_nz || y_ind<ys_nz) {\r\n\t\t\t\tint x_pos = x_ind < xs_nz ? x.getIthNonZeroPos(x_ind) : \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tInteger.MAX_VALUE;\r\n\t\t\t\tint y_pos = y_ind < ys_nz ? y.getIthNonZeroPos(y_ind) :\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tInteger.MAX_VALUE;\r\n\t\t\t\tif (y_pos < x_pos) {\r\n\t\t\t\t\tdouble yi = y.getIthNonZeroVal(y_ind)-defVal;\r\n\t\t\t\t\tdist += yi*yi;\r\n\t\t\t\t\ty_ind++;\r\n\t\t\t\t}\r\n\t\t\t\telse if (x_pos < y_pos) {\r\n\t\t\t\t\tdouble xi = x.getIthNonZeroVal(x_ind)-defVal;\r\n\t\t\t\t\tdist += xi*xi;\r\n\t\t\t\t\tx_ind++;\r\n\t\t\t\t}\r\n\t\t\t\telse { // x_pos==y_pos\r\n\t\t\t\t\tdouble xmyi = y.getIthNonZeroVal(y_ind)-x.getIthNonZeroVal(x_ind);\r\n\t\t\t\t\tdist += xmyi*xmyi;\r\n\t\t\t\t\tx_ind++;\r\n\t\t\t\t\ty_ind++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn Math.sqrt(dist);\r\n\t\t}\r\n for (int i=0; i<n; i++) {\r\n double xi = x.getCoord(i);\r\n double yi = y.getCoord(i);\r\n dist += (xi-yi)*(xi-yi);\r\n }\r\n return Math.sqrt(dist);\t\t\r\n\t}", "public static void main(String[] args) throws Exception {\n \n Scanner scn=new Scanner(System.in);\n int n1=scn.nextInt();\n \n int[] a1=new int[n1];\n for(int i=0;i<a1.length;i++){\n a1[i]=scn.nextInt();\n }\n \n int n2=scn.nextInt();\n int[] a2=new int[n2];\n for(int i=0;i<a2.length;i++){\n a2[i]=scn.nextInt();\n }\n \n int[] diff=new int[n2];\n int c=0;\n \n int i=a1.length-1;\n int j=a2.length-1;\n int k=diff.length-1;\n \n while(k >= 0){\n int d=0;\n int a1v= i >= 0? a1[i]: 0;\n \n if(a2[j] +c >= a1v){\n d= a2[j] + c -a1v;\n c=0;\n }else{\n d= a2[j] + c + 10 -a1v;\n c=-1;\n }\n \n diff[k] = d;\n \n i--;\n j--;\n k--;\n }\n \n int idx = 0;\n while(idx < diff.length){\n if(diff[idx] == 0){\n idx++;\n }else{\n break;\n }\n }\n \n while(idx < diff.length){\n System.out.println(diff[idx]);\n idx++;\n }\n \n\n \n \n}", "@Test\n\tpublic void evalCrispDistanceWithFuzzyNumberOverlap2(){\n\t\tFuzzySet res = cs4.distance(dfn3);\n\t\tassertTrue(res instanceof FuzzyInterval);\n\t\tFuzzyInterval fuzzyRes = (FuzzyInterval)res;\n\t\t//Puntos limite\n\t\tassertTrue(fuzzyRes.getMembershipValue(0)==1);\n\t\tassertTrue(fuzzyRes.getMembershipValue(1)==1);\n\t\tassertTrue(fuzzyRes.getMembershipValue(2)==0);\n\t\t//Valores exteriores\n\t\tassertTrue(fuzzyRes.getMembershipValue(3)==0);\n\t\tassertTrue(fuzzyRes.getMembershipValue(-1)==0);\n\t}", "public static void main(String[] args) {\n int[] listA = {4,1,8,4,5};\n int[] listB = {5,0,1,8,4,5};\n int intersectVal = 8;\n int skipA = 2, skipB = 3;\n ListNode headA = new ListNode(listA[0]);\n ListNode headB = new ListNode(listB[0]);\n ListNode nodeA = headA;\n for (int i = 1; i < skipA; i++) {\n nodeA.next = new ListNode(listA[i]);\n nodeA = nodeA.next;\n }\n ListNode nodeB = headB;\n for (int i = 1; i < skipB; i++) {\n nodeB.next = new ListNode(listB[i]);\n nodeB = nodeB.next;\n }\n\n nodeA.next = new ListNode(listA[skipA]);\n nodeB.next = nodeA.next;\n nodeA = nodeA.next;\n for (int i = skipA + 1; i < listA.length; i++) {\n nodeA.next = new ListNode(listA[i]);\n nodeA = nodeA.next;\n }\n\n\n ListNode intersectionNode = getIntersectionNode(headA, headB);\n System.out.println(intersectionNode.val);\n }", "public static int findCommon4(int[] in1, int[] in2) {\r\n\t\tint common = 0;\r\n\t\t//mlogn\r\n\t\tArrays.sort(in1);\r\n\t\t//nlogn\r\n\t\tArrays.sort(in2);\r\n\t\t//m+n-1 (as one element will remain uncompared in the end)\r\n\t\tint i=0,j=0;\r\n\t\twhile (i < in1.length && j < in2.length) {\r\n\t\t\tif (in1[i] == in2[j]) {\r\n\t\t\t\t++common;\r\n\t\t\t\t++i;\r\n\t\t\t\t++j;\r\n\t\t\t} else if (in1[i] < in2[j]) {\r\n\t\t\t\t++i;\r\n\t\t\t} else {\r\n\t\t\t\t++j;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn common;\r\n\t}", "private static long gcd(long n, long d) {\n\t long n1 = Math.abs(n);\n\t long n2 = Math.abs(d);\n\t int gcd = 1;\n\t \n\t for (int k = 1; k <= n1 && k <= n2; k++) {\n\t if (n1 % k == 0 && n2 % k == 0) \n\t gcd = k;\n\t }\n\n\t return gcd;\n\t }", "private void calculateNDCG(List<ScoreRetrieval> results,List<QuerieDocRelevance> querieRelevance){\n List<Double> ndcgResultsQuery = new ArrayList<>();\n List<Double> realdcgResults = new ArrayList<>();\n List<Double> idealDcgResults = new ArrayList<>();\n ScoreRetrieval resultT = results.get(0);\n Optional<QuerieDocRelevance> docMatch = querieRelevance.stream().filter(q -> resultT.getDocId()==q.getDocID()).findFirst();\n QuerieDocRelevance doc = docMatch.orElse(null); \n \n \n Collections.sort(querieRelevance);\n \n idealDcgResults.add((double) querieRelevance.get(0).getRelevance());\n \n if (doc != null) {\n realdcgResults.add((double)doc.getRelevance());\n } else {\n realdcgResults.add(0.0);\n }\n \n if(!(realdcgResults.isEmpty()) && !(idealDcgResults.isEmpty())){\n ndcgResultsQuery.add(realdcgResults.get(0)/idealDcgResults.get(0));\n }\n \n \n for(int i = 1;i<results.size() && i<querieRelevance.size();i++){\n ScoreRetrieval result = results.get(i);\n docMatch = querieRelevance.stream().filter(q -> result.getDocId()==q.getDocID()).findFirst();\n doc = docMatch.orElse(null);\n \n if(doc != null){\n realdcgResults.add(realdcgResults.get(i-1)+(double)doc.getRelevance()/(Math.log(i+1)/Math.log(2)));\n }else{\n realdcgResults.add(realdcgResults.get(i-1));\n }\n \n\n idealDcgResults.add(idealDcgResults.get(i-1)+(double) querieRelevance.get(i).getRelevance()/(Math.log(i+1)/Math.log(2)));\n\n \n ndcgResultsQuery.add(realdcgResults.get(i)/idealDcgResults.get(i));\n \n } \n \n \n ndcgResults.add(ndcgResultsQuery);\n \n }", "private int findGCD(int n1, int n2) {\n //n1 and n2 must always be positive for this GCD algorithm\n n1 = Math.abs(n1);\n n2 = Math.abs(n2);\n\n //continue through the loop if n2 is greater than 0\n while (n2 > 0) {\n int remainder = n1 % n2;\n //n1 will keep track of the GCD value\n n1 = n2;\n //n2 will keep track of the remainder\n n2 = remainder;\n }\n //setting n1 is the gcd value\n return n1;\n }", "private double jaccardIndexCross(Object m1, Object m2) \n\t{\n\t\treturn 0;\n\t}", "private static void commonNodesInOrdSuc(Node r1, Node r2)\n {\n Node n1 = r1, n2 = r2;\n \n if(n1==null || n2==null)\n return;\n \n while(n1.left != null)\n n1 = n1.left;\n \n while(n2.left!= null)\n n2 = n2.left;\n \n while(n1!=null && n2!=null)\n {\n if(n1.data < n2.data)\n n1 = inOrdSuc(n1);\n \n else if(n1.data > n2.data)\n n2 = inOrdSuc(n2);\n \n else\n {\n System.out.print(n1.data+\" \"); n1 = inOrdSuc(n1); n2 = inOrdSuc(n2);\n }\n }\n \n System.out.println();\n }", "public HashMap getClusterDiameter() {\n double maxEuclideanDistance = 0;\n double maxCorrelationDistance = 0;\n\n Set probeIDSet = points.keySet();\n Iterator probeIt = probeIDSet.iterator();\n \n int comparisonIndex = 0;\n \n while (probeIt.hasNext()) {\n int probeID = (Integer) probeIt.next();\n double[] pointA = (double[]) points.get(probeID);\n\n Set probeIDSet2 = points.keySet();\n Iterator probeIt2 = probeIDSet2.iterator();\n while (probeIt2.hasNext()) {\n int probeID2 = (Integer) probeIt2.next();\n double[] pointB = (double[]) points.get(probeID2);\n \n HashMap distances = KMeans.getDistances(pointA, pointB);\n double eucDist = (Double) distances.get(\"euclidean\");\n double correlDist = (Double) distances.get(\"correlation\");\n \n if (comparisonIndex == 0) { // First distance\n maxEuclideanDistance = eucDist;\n maxCorrelationDistance = correlDist;\n } else if (eucDist > maxEuclideanDistance) {\n maxEuclideanDistance = eucDist;\n } else if ( Math.abs(correlDist) < maxCorrelationDistance) {\n maxCorrelationDistance = correlDist;\n }\n comparisonIndex++;\n }\n }\n \n HashMap<String, Double> distances = new HashMap<String, Double>();\n distances.put(\"euclidean\", maxEuclideanDistance);\n distances.put(\"correlation\", maxCorrelationDistance);\n return distances;\n }", "private void longestCommonSubsequence(String str1, String str2) {\n\tdp\t= new int[str1.length()+1][str2.length()+1];\t\r\n\tString lcs = \"\";\r\n\tint i=0,j=0;\r\n\tfor(i=0;i<str1.length();i++){\r\n\t\tfor(j=0;j<str2.length();j++){\r\n\t\t\r\n\t\t\tif(str1.charAt(i)==str2.charAt(j)){\r\n\t\t\t\tdp[i+1][j+1] = dp[i][j] + 1; \r\n\t\t\t\t\r\n\t\t\t}else{\r\n\t\t\t\tdp[i+1][j+1] =\r\n Math.max(dp[i+1][j], dp[i][j+1]);\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}\r\n\t\tSystem.out.println(dp[dp.length-1][dp[0].length-1]);\r\n\t\t\r\n\t}", "default double euclideanDistance(double[] a, double[] b) {\n checkLengthOfArrays(a, b);\n double sum = 0.0;\n for (int i = 0; i < a.length; i++) {\n final double d = a[i] - b[i];\n sum += d * d;\n }\n return Math.sqrt(sum);\n }", "public static double getDistance(int first[], int second[]) throws Exception {\r\n\t\t//Distance Value (w/ Default):\r\n\t\tdouble distance = 0;\r\n\r\n\t\t//Checks the Case:\r\n\t\tif (first.length == second.length) {\r\n\t\t\t//Loop Variable:\r\n\t\t\tint turns = 0;\r\n\r\n\t\t\t//Loops through Array:\r\n\t\t\tmainLoop: while (turns < first.length) {\r\n\t\t\t\t//Gets the Individual Distance:\r\n\t\t\t\tdistance += ((second[turns] - first[turns]) * (second[turns] - first[turns]));\r\n\r\n\t\t\t\tturns++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\telse {\r\n\t\t\t//Error Debugs:\r\n\t\t\tSystem.out.println(\"Invalid Array Lengths!\");\r\n\t\t}\r\n\r\n\t\t//Calculates the Overall Distance:\r\n\t\tdistance = Math.sqrt(distance);\r\n\r\n\t\t//Returns the Distance:\r\n\t\treturn distance;\r\n\t}", "public static ArrayList<Set<String>> getConnectedComponentsInDistrict(\n District district,\n HashMap<String, PrecinctNeighborRelation> precinctNeighborRelationMap) {\n // ( precinctGeoId : PrecinctNeighborRelation } pair in precinctNeighborRelationMap\n\n // first, build from -> to_list hash map\n HashMap<String, ArrayList<String>> fromToList = new HashMap<>();\n for(PrecinctNeighborRelation pnr : precinctNeighborRelationMap.values()) {\n ArrayList<NeighborData> ndList = pnr.getNeighborDataList();\n ArrayList<String> toGeoidList = new ArrayList<>();\n for(NeighborData nd : ndList)\n toGeoidList.add(nd.getToGeoId());\n fromToList.put(pnr.getFromGeoId(), toGeoidList);\n }\n\n Set<Precinct> precinctsOfDistrict = district.getPrecincts();\n\n ArrayList<String> pgeoidsOfDistrict = new ArrayList<>();\n ArrayList<Set<String>> connectedComponentList = new ArrayList<>();\n HashMap<String, Set<String>> referenceToItsSet = new HashMap<>();\n\n for(Precinct p : precinctsOfDistrict) {\n Set<String> connectedComponent = new HashSet<>();\n connectedComponent.add(p.getGeoId());\n connectedComponentList.add(connectedComponent);\n referenceToItsSet.put(p.getGeoId(), connectedComponent);\n pgeoidsOfDistrict.add(p.getGeoId());\n }\n\n for(Precinct p : precinctsOfDistrict) {\n ArrayList<String> toGeoidList = fromToList.get(p.getGeoId());\n Set<String> itsSet = referenceToItsSet.get(p.getGeoId());\n for(String neighborGeoid : toGeoidList) {\n // if the neighbor is in same district\n // if itsSet not yet contains the neighbor\n if(pgeoidsOfDistrict.contains(neighborGeoid)\n && !itsSet.contains(neighborGeoid)) {\n // neighbors set will be removed from the memory\n Set<String> neighborsSet = referenceToItsSet.get(neighborGeoid);\n for(String elementFromNeighborSet : neighborsSet) {\n referenceToItsSet.put(elementFromNeighborSet, itsSet);\n itsSet.add(elementFromNeighborSet);\n }\n connectedComponentList.remove(neighborsSet);\n }\n }\n }\n\n // stubbed\n// Set<Precinct> oneset = new HashSet<>();\n// ArrayList<Set<Precinct>> listSizeOne = new ArrayList<>();\n// listSizeOne.add(oneset);\n if(connectedComponentList.size() > 1) {\n //System.out.println(\"District: \" + district.getGeoId() + \" has \" + connectedComponentList.size() + \" components\");\n }\n return connectedComponentList;\n }", "@Override\n\tpublic double distanceDep(double[][] series1, double[][] series2, double bsf){\n\t\tif (dimensionsToUse == null){\n\t\t\tthrow new RuntimeException(\"Set dimensionsToUse before calling this method\");\n\t\t}\n\t\tdouble total = 0;\n\t\tint minLength = Math.min(series1[0].length, series2[0].length);\n\t\tfor (int i = 0; i < minLength & total <= bsf; i++){\n\t\t\tfor (int dimension : dimensionsToUse) {\n\t\t\t\ttotal += (series1[dimension][i] - series2[dimension][i]) * (series1[dimension][i] - series2[dimension][i]);\n\t\t\t}\n\t\t}\n\t\treturn total;\n\t}", "public static String[] common(String[] a, String[] b){\n int r = a.length;\n int c = b.length;\n int[][] dp = new int[r][c];\n int time = 0;\n for(int i = r-1;i>=0;i--){\n for(int j = c-1; j>=0;j--){\n if (a[i]==b[j]){\n time++;\n dp[i][j]=time;\n }else {\n time = 0;\n dp[i][j]=time;\n }\n }\n }\n return new String[]{\"\"};\n }", "private void clusterElements(int element1,int element2)\n\t{\n\t\tint index1 = getClusterIndex(element1);\n\t\tint index2 = getClusterIndex(element2);\n\t\t\n\t\t\n\t\tif (index1 != index2)\n\t\t\tif((index1 != -1) && (index2 != -1))\n\t\t\t\tcombineClusters(index1,index2);\n\t}", "public static EuclidianDictionary[] computeDistance(DaubechyColorSplitter query, List<DaubechyColorSplitter> daubechyColorSplitters) {\n //compute descriptor of query\n EuclidianDictionary euclidianDictionary[] = StandardDeviation.computeAll(query, daubechyColorSplitters);\n\n //perform euclidian on query and each descriptor element\n Arrays.sort(euclidianDictionary, (o1, o2) -> {\n if(o1.euclidian < o2.euclidian) {\n return -1;\n }else if(o2.euclidian > o1.euclidian) {\n return 1;\n }else{\n return 0;\n }\n });\n return euclidianDictionary;\n }", "public double getDistance(int index1, int index2) {\n int numPoints = getNumPoints();\n\n if (index1 < 0 || index1 > numPoints) {\n System.out.println(\"Dataset.getDistance() - index1: \" + index1\n + \" out of bounds\");\n\n // TODO throw exception\n return 0;\n } else if (index2 < 0 || index2 > numPoints) {\n System.out.println(\"Dataset.getDistance() - index2: \" + index2\n + \" out of bounds\");\n\n // TODO throw exception\n return 0;\n }\n\n if (index1 == index2) {\n return 0;\n } else if (index1 < index2) {\n int swap = index2;\n index2 = index1;\n index1 = swap;\n }\n\n double d = distances[getDistanceIndex(index1) + index2];\n\n if (d < 0) {\n return calculateDistance(index1, index2);\n } else {\n return d;\n }\n }", "public int[] commonElements(int[] arr1, int[] arr2) {\n arr1 = (arr1);\n arr2 = (arr2);\n\n int size1 = arr1.length;\n int size2 = arr2.length;\n\n int[] temp = new int[size1 < size2 ? size1 : size2];\n\n int i = 0;\n int i1 = 0;\n int i2 = 0;\n\n while ((i1 < size1) && (i2 < size2)) {\n if (arr1[i1] == arr2[i2]) {\n temp[i] = arr1[i1];\n i1++;\n i2++;\n i++;\n } else if (arr1[i1] < arr2[i2]) {\n i1++;\n } else if (arr1[i1] > arr2[i2]) {\n i2++;\n }\n }\n\n int[] arr = new int[i];\n for (int j = 0; j < arr.length; j++) {\n arr[j] = temp[j];\n }\n\n return arr;\n }", "private Vector combinationAlgorithm(Stroke theStroke){\n\t\tCurvatureBasedDetection cbd = new CurvatureBasedDetection();\n\t\tSpeedBasedDetection sbd = new SpeedBasedDetection();\n\t\tCommonSegmentPts = new Vector();\n\t\tCurvPts = cbd.getCurvatureData();\n\t\tdouble SpeedPts[][] = sbd.getSpeedData();\n\t\tCurvPtCount = cbd.getIndex();\n\t\tint SpeedPtCount = sbd.getIndex();\n\t\tint index ;\n\t\tCurvVector = new Vector();\n\t\t//copy the speed and curvature data in two vectors\n\t\tfor (index = 0; index < CurvPtCount ; index++){\n\t\t\tDouble obj = CurvPts[index][0];\n\t\t\tCurvVector.add(new Integer(obj.intValue()));\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Curvature Indices\");\n\t\tprintValues(CurvVector);\n\t\t\n\t\tSpeedVector = new Vector();\n\t\tfor (index = 0; index < SpeedPtCount ; index++){\n\t\t\tDouble obj = SpeedPts[index][0];\n\t\t\tSpeedVector.add(new Integer(obj.intValue()));\n\t\t}\n\t\tSystem.out.println(\"Speed Indices\");\n\t\tprintValues(SpeedVector);\n\t\tSort sort = new Sort();\n\t\tint ElementIndex;\n\t\t// find common points (intersection of speed and curvature) and put it in CommonSegmentPts vector\n\t\t\n\t\tboolean flag = false;\n\t\tfor(index = 0; index < SpeedVector.size(); index++ ){\n\t\t\t\n\t\t\tElementIndex = sort.linearSearch(CurvVector, (Integer)SpeedVector.elementAt(index));\n\t\t\t\n\t\t\tif(ElementIndex != -1){\n\t\t\t\tCommonSegmentPts.add((Integer)(CurvVector.elementAt(ElementIndex)));\n\t\t\t\tCurvVector.remove(ElementIndex);\n\t\t\t\tSpeedVector.remove(index --); // point is removed from vectors\n\t\t\t\t\n\t\t\t}\t\t\n\t\t}\n\t\tSystem.out.println(\"Common Points\");\n\t\tprintValues(CommonSegmentPts);\n\t\tint ElemAtIndex;\n\t\t// Find the curvature based segment points in the Tolerance Distance of speed based segment points \n\t\tfor(index = 0; index < SpeedVector.size(); index++ ){\n\t\t\tElementIndex = FindNearbyPts(CurvVector, (Integer)SpeedVector.elementAt(index), theStroke);\n\t\t\tif(ElementIndex != -1){\n\t\t\t\tElemAtIndex = ((Integer)CurvVector.elementAt(ElementIndex) + (Integer)SpeedVector.elementAt(index))/2;\n\t\t\t\tCommonSegmentPts.add(ElemAtIndex);\n\t\t\t\tCurvVector.remove(ElementIndex);\n\t\t\t\tSpeedVector.remove(index--);\n\t\t\t}\n\t\t}\n\t\t//printValues(CommonSegmentPts);\n\t\tremoveNearbyPixels(theStroke);\n\t\t//setNewScalingFactor(theStroke);\n\t\tCollections.sort(CommonSegmentPts);\n\t\tprintValues(CommonSegmentPts);\n\t\tdouble PrevIterError;\n\t\tdouble NewIterError;\n\t\tVector IterationPts = new Vector(); \n\t\t//System.out.println(\"Error \" + (PrevIterError = calculateError(CommonSegmentPts, theStroke)));\n\t\t// create a vector that stores segment points of each iteration\n\t\tIterWiseSegPts = new Vector();\n\t\t// for hybrid\n\t\tIterationPts = copyVector(IterationPts, CommonSegmentPts);\n\t\tdouble PrevError = calculateError(IterationPts, theStroke);\n\t\tif(PrevError > 10000.0){\t// if stroke consists of curves\n\t\t\terrorTolerance = 90.0;\n\t\t}\n\t\tIterationPts.add((double ) PrevError);\n\t\tIterWiseSegPts = appendVector(IterWiseSegPts,IterationPts);\n\t\tdouble NewError = -1;\n/*\t\tint vectorIndex = 0;\n\t\t\n\t\twhile(CurvVector.size()!=0 || SpeedVector.size()!=0){\n\t*/\t\t\n\t\t\t// code for accepting seg points uptil pts reduce the error by 100\n\t\t/*\n\t\t\tif(CurvVector.size()!=0){\n\t\t\t\tint CurvIndex = (Integer)CurvVector.get(0);\n\t\t\t\tCommonSegmentPts.add(CurvIndex);\n\t\t\t\tCurvVector.remove(0);\n\t\t\t\tCollections.sort(CommonSegmentPts);\n\t\t\t\tNewIterError = calculateError(CommonSegmentPts, theStroke);\n\t\t\t\tif((PrevIterError - NewIterError) > 100.0){\n\t\t\t\t\tvectorIndex++;\n\t\t\t\t\tIterWiseSegPts.add(CurvIndex);\n\t\t\t\t\tPrevIterError = NewIterError;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\twhile(CurvVector.size()!=0){\n\t\t\t\t\t\tCurvVector.remove(0);\n\t\t\t\t\t}\t\t\t\t\t//return IterWiseSegPts;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif(SpeedVector.size()!=0){\n\t\t\t\tint SpeedIndex = (Integer)SpeedVector.get(0);\n\t\t\t\tCommonSegmentPts.add(SpeedIndex);\n\t\t\t\tSpeedVector.remove(0);\n\t\t\t\tCollections.sort(CommonSegmentPts);\n\t\t\t\tNewIterError = calculateError(CommonSegmentPts, theStroke);\n\t\t\t\tSystem.out.println(\"New Error = \" + NewIterError);\n\t\t\t//CommonSegmentPts.add((Double)NewIterError);\n\t\t\t\tif((PrevIterError - NewIterError) > 100.0 ){\n\t\t\t\t\tvectorIndex++;\n\t\t\t\t\tIterWiseSegPts.add(SpeedIndex);\n\t\t\t\t\tPrevIterError = NewIterError;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\twhile(SpeedVector.size()!=0){\n\t\t\t\t\t\tSpeedVector.remove(0);\n\t\t\t\t\t}\t\t\n\t\t\t\t\t//return IterWiseSegPts;\n\t\t\t\t}\n\t\t\t\n\t\t\t\t\n\t\t\t}*/\n\t\t\t// my approach\n\t/*\t\t\n\t\t\tif(CurvVector.size()!=0){\n\t\t\t\tint Index = findMinimumErrorIndex(CurvVector,CommonSegmentPts,theStroke);\n\t\t\t\tif(Index != -1){\n\t\t\t\tint CurvIndex = (Integer)CurvVector.get(Index);\n\t\t\t\tCommonSegmentPts.add((Integer)CurvIndex);\n\t\t\t\tCurvVector.remove(Index);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tCurvVector = clearVector(CurvVector);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(SpeedVector.size()!=0){\n\t\t\t\tint Index = findMinimumErrorIndex(SpeedVector,CommonSegmentPts,theStroke);\n\t\t\t\tif(Index != -1){\n\t\t\t\tint SpeedIndex = (Integer)SpeedVector.get(Index);\n\t\t\t\tCommonSegmentPts.add((Integer)SpeedIndex);\n\t\t\t\tSpeedVector.remove(Index);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tSpeedVector = clearVector(SpeedVector);\n\t\t\t\t}\n\t\t\t}\n\t\t\tIterationPts = clearVector(IterationPts);\n\t\t\tIterationPts = copyVector(IterationPts, CommonSegmentPts);\n\t\t\tCollections.sort(IterationPts);\n\t\t\tIterError = calculateError(IterationPts, theStroke);\n\t\t\tIterationPts.add((double) IterError);\n\t\t\tIterWiseSegPts = appendVector(IterWiseSegPts,IterationPts);\n\t\t\tremoveNearbyPixels(theStroke);\n\n\t\t}\n\t\tCommonSegmentPts = clearVector(CommonSegmentPts);\n\t\tCommonSegmentPts = selectBestSegPtsSet(IterWiseSegPts);*/\n\t\t\n\t\t/*\tif(CurvVector.size()!=0){\n\t\tint Index = findMinimumErrorIndex(CurvVector,CommonSegmentPts,theStroke);\n\t\tif(Index != -1){\n\t\tint CurvIndex = (Integer)CurvVector.get(Index);\n\t\tCommonSegmentPts.add((Integer)CurvIndex);\n\t\tCurvVector.remove(Index);\n\t\t}\n\t\telse{\n\t\t\tCurvVector = clearVector(CurvVector);\n\t\t}\n\t}\n\tif(SpeedVector.size()!=0){\n\t\tint Index = findMinimumErrorIndex(SpeedVector,CommonSegmentPts,theStroke);\n\t\tif(Index != -1){\n\t\tint SpeedIndex = (Integer)SpeedVector.get(Index);\n\t\tCommonSegmentPts.add((Integer)SpeedIndex);\n\t\tSpeedVector.remove(Index);\n\t\t}\n\t\telse{\n\t\t\tSpeedVector = clearVector(SpeedVector);\n\t\t}\n\t}\n\tIterationPts = clearVector(IterationPts);\n\tIterationPts = copyVector(IterationPts, CommonSegmentPts);\n\tCollections.sort(IterationPts);\n\tIterError = calculateError(IterationPts, theStroke);\n\tIterationPts.add((double) IterError);\n\tIterWiseSegPts = appendVector(IterWiseSegPts,IterationPts);\n\tremoveNearbyPixels(theStroke);\n\n}\nCommonSegmentPts = clearVector(CommonSegmentPts);\nCommonSegmentPts = selectBestSegPtsSet(IterWiseSegPts);*/\n\t\t\n\t\t\n\t\t// hybrid fit approach\n\t\tint curvIndex = -1, speedIndex = -1;\n\t\tdouble curvError,speedError;\n\t\tVector curvPts = new Vector();\n\t\tVector speedPts = new Vector();\n\t\tVector changeInError = new Vector();\n\t\twhile((CurvVector.size() != 0) || (SpeedVector.size() != 0) ){\n\t\t\tcurvError = DEFAULT;\n\t\t\tspeedError = DEFAULT;\n\t\t\t\n\t\t\tif(CurvVector.size() != 0){\n\t\t\t\tclearVector(curvPts);\n\t\t\t\tcurvPts = copyVector(curvPts, CommonSegmentPts);\n\t\t\t\tcurvIndex = (Integer)CurvVector.get(0);\n\t\t\t\tcurvPts.add((Integer)curvIndex);\n\t\t\t\tCurvVector.remove(0);\n\t\t\t\tCollections.sort(curvPts);\n\t\t\t\tcurvError = calculateError(curvPts, theStroke);\n\t\t\t\tcurvPts.add((Double)curvError);\n\t\t\t}\n\t\t\t\n\t\t\tif(SpeedVector.size() != 0){\n\t\t\t\tclearVector(speedPts);\n\t\t\t\tspeedPts = copyVector(speedPts, CommonSegmentPts);\n\t\t\t\tspeedIndex = (Integer)SpeedVector.get(0);\n\t\t\t\tspeedPts.add((Integer)speedIndex);\n\t\t\t\tSpeedVector.remove(0);\n\t\t\t\tCollections.sort(speedPts);\n\t\t\t\tspeedError = calculateError(speedPts, theStroke);\n\t\t\t\tspeedPts.add((Double)speedError);\n\t\t\t}\n\t\t\t\n\t\t\tif((speedError <= curvError) || (curvError == DEFAULT)){\n\t\t\t\tNewError = speedError;\n\t\t\t\t//changeInError.add((Double)(NewError - PrevError));\n\t\t\t\tif((PrevError - NewError) > errorTolerance){\n\t\t\t\tIterWiseSegPts = appendVector(IterWiseSegPts, speedPts);\n\t\t\t\tCommonSegmentPts.add((Integer)speedIndex);\n\t\t\t\tchangeInError.add((Double)(PrevError - NewError));\n\t\t\t\tPrevError = NewError;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if((curvError < speedError) || (speedError == DEFAULT)){\n\t\t\t\tNewError = curvError;\n\t\t\t\tif((PrevError - NewError) > errorTolerance){\n\t\t\t\tIterWiseSegPts = appendVector(IterWiseSegPts, curvPts);\n\t\t\t\tCommonSegmentPts.add((Integer)curvIndex);\n\t\t\t\tchangeInError.add((Double)(PrevError - NewError));\n\t\t\t\tPrevError = NewError;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\t\n\t\t}\n\t\t\t\n\t\tCommonSegmentPts = clearVector(CommonSegmentPts);\n\t\tVector TempVect = new Vector();\n\t\tCommonSegmentPts = copyVectorIndex(IterWiseSegPts, TempVect, IterWiseSegPts.size() - 1);\n\t\t//TempVect = copyVectorIndex(IterWiseSegPts, TempVect, IterWiseSegPts.size() -1);\n\t\t/*index = 0;\n\t\twhile(index < (TempVect.size()-1)){\n\t\t\tCommonSegmentPts.add((Integer)TempVect.get(index++));\n\t\t}*/\n\t\t//CommonSegmentPts = selectBestSegPtsSet(IterWiseSegPts);\n\t\t\n\t\treturn CommonSegmentPts;\n\t}", "public static double distancia(Entidade e1,Entidade e2){\r\n\t\tdouble dx = e1.getPosicaoX() - e2.getPosicaoX();\r\n\t\tdouble dy = e1.getPosicaoY() - e2.getPosicaoY();\r\n\t\tdouble d = Math.sqrt(dx*dx + dy*dy);\r\n\t\treturn d;\r\n\t}", "public void dfs(LinkedList<Node>[] adjList){\n Set<Integer> visited = new HashSet<>();\n\n for(LinkedList<Node> node: adjList){\n Node curr = node.getFirst();\n if(!visited.contains(curr)){\n ArrayList<Integer> components = new ArrayList<>();\n components = getConnectedComponets(curr, visited, components);\n System.out.printf(\"do something %s\", components.toString());\n }\n }\n }", "private void treatCycles(SDFGraph graph) throws InvalidExpressionException {\r\n\t\tList<Set<SDFAbstractVertex>> cycles = new ArrayList<Set<SDFAbstractVertex>>();\r\n\t\tCycleDetector<SDFAbstractVertex, SDFEdge> detector = new CycleDetector<SDFAbstractVertex, SDFEdge>(\r\n\t\t\t\tgraph);\r\n\t\tList<SDFAbstractVertex> vertices = new ArrayList<SDFAbstractVertex>(\r\n\t\t\t\tgraph.vertexSet());\r\n\t\twhile (vertices.size() > 0) {\r\n\t\t\tSDFAbstractVertex vertex = vertices.get(0);\r\n\t\t\tSet<SDFAbstractVertex> cycle = detector\r\n\t\t\t\t\t.findCyclesContainingVertex(vertex);\r\n\t\t\tif (cycle.size() > 0) {\r\n\t\t\t\tvertices.removeAll(cycle);\r\n\t\t\t\tcycles.add(cycle);\r\n\t\t\t}\r\n\t\t\tvertices.remove(vertex);\r\n\t\t}\r\n\r\n\t\tfor (Set<SDFAbstractVertex> cycle : cycles) {\r\n\t\t\tint gcd = gcdOfVerticesVrb(cycle);\r\n\t\t\tif (gcd > 1 && !(graph instanceof PSDFGraph)) {\r\n\t\t\t\tcopyCycle(graph, cycle, gcd);\r\n\t\t\t} else if (!(graph instanceof PSDFGraph)) {\r\n\t\t\t\ttreatPSDFCycles(graph, cycle);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// SDFIterator sdfIterator = new SDFIterator(graph);\r\n\t\t// List<SDFAbstractVertex> orderedList = new\r\n\t\t// ArrayList<SDFAbstractVertex>();\r\n\t\t// while (sdfIterator.hasNext()) {\r\n\t\t// SDFAbstractVertex current = sdfIterator.next();\r\n\t\t// orderedList.add(current);\r\n\t\t// if (current instanceof SDFRoundBufferVertex) {\r\n\t\t// int nbTokens = 0;\r\n\t\t// for (SDFEdge edgeData : graph.outgoingEdgesOf(current)) {\r\n\t\t// nbTokens = edgeData.getProd().intValue();\r\n\t\t// }\r\n\t\t// for (int i = orderedList.size() - 1; i >= 0; i--) {\r\n\t\t// if (graph.getAllEdges(orderedList.get(i), current).size() == 1) {\r\n\t\t// if (nbTokens <= 0) {\r\n\t\t// graph.removeAllEdges(orderedList.get(i), current);\r\n\t\t// } else {\r\n\t\t// for (SDFEdge thisEdge : graph.getAllEdges(\r\n\t\t// orderedList.get(i), current)) {\r\n\t\t// nbTokens = nbTokens\r\n\t\t// - thisEdge.getProd().intValue();\r\n\t\t// }\r\n\t\t// }\r\n\t\t// }\r\n\t\t// }\r\n\t\t// // traiter le roundBuffer pour le supprimer\r\n\t\t// if (graph.incomingEdgesOf(current).size() == 1\r\n\t\t// && graph.outgoingEdgesOf(current).size() == 1) {\r\n\t\t// SDFAbstractVertex source = ((SDFEdge) graph\r\n\t\t// .incomingEdgesOf(current).toArray()[0]).getSource();\r\n\t\t// SDFEdge oldEdge = ((SDFEdge) graph.incomingEdgesOf(current)\r\n\t\t// .toArray()[0]);\r\n\t\t// SDFAbstractVertex target = ((SDFEdge) graph\r\n\t\t// .outgoingEdgesOf(current).toArray()[0]).getTarget();\r\n\t\t// SDFEdge refEdge = ((SDFEdge) graph.outgoingEdgesOf(current)\r\n\t\t// .toArray()[0]);\r\n\t\t// SDFEdge newEdge = graph.addEdge(source, target);\r\n\t\t// newEdge.copyProperties(refEdge);\r\n\t\t// graph.removeEdge(refEdge);\r\n\t\t// graph.removeEdge(oldEdge);\r\n\t\t// graph.removeVertex(current);\r\n\t\t// orderedList.remove(current);\r\n\t\t// } else if (graph.incomingEdgesOf(current).size() == 1\r\n\t\t// && graph.outgoingEdgesOf(current).size() > 1) {\r\n\t\t//\r\n\t\t// } else if (graph.incomingEdgesOf(current).size() > 1\r\n\t\t// && graph.outgoingEdgesOf(current).size() == 1) {\r\n\t\t//\r\n\t\t// }\r\n\t\t// }\r\n\t\t// }\r\n\t\t/*\r\n\t\t * { CycleDetector<SDFAbstractVertex, SDFEdge> detect = new\r\n\t\t * CycleDetector<SDFAbstractVertex, SDFEdge>( graph);\r\n\t\t * List<SDFAbstractVertex> vert = new ArrayList<SDFAbstractVertex>(\r\n\t\t * graph.vertexSet()); while (vert.size() > 0) { SDFAbstractVertex\r\n\t\t * vertex = vert.get(0); Set<SDFAbstractVertex> cycle = detect\r\n\t\t * .findCyclesContainingVertex(vertex); if (cycle.size() > 0) {\r\n\t\t * vert.removeAll(cycle); cycles.add(cycle); } vert.remove(vertex); } }\r\n\t\t */\r\n\r\n\t\treturn;\r\n\t}", "public static double jaccard (Set<String> values1, Set<String> values2) {\t\n\t\t\n\t\tfinal int termsInString1 = values1.size();\t\t\n\t\tfinal int termsInString2 = values2.size();\n\t\t\t\t\n\t\t//now combine the sets\n\t\tvalues1.addAll(values2);\n\t\tfinal int commonTerms = (termsInString1 + termsInString2) - values1.size();\n\t\t\n\t\t//return JaccardSimilarity\n\t\treturn (double) (commonTerms) / (double) (values1.size());\n\t}", "private static double dif(Color one, Color two) {\n\t\treturn Math.abs(one.getRed() - two.getRed()) + Math.abs(one.getGreen() - two.getGreen()) + Math.abs(one.getBlue() - two.getBlue());\n\t}", "Set<TributarySlot> findCommonTributarySlotsOnCps(ConnectPoint src, ConnectPoint dst) {\n Set<TributarySlot> forward = findTributarySlotsOnCp(src);\n Set<TributarySlot> backward = findTributarySlotsOnCp(dst);\n return Sets.intersection(forward, backward);\n }", "private static double calcDcc(Integer queryResId, Map<Integer, Double> annualDepreciationMap)\r\n\t\t\tthrows ClassNotFoundException, SQLException, IOException {\r\n\t\tDouble dccScoreTotal = 0.0;\r\n\t\tMap<Integer, Integer> citationDistMap = PersistenceController2.fetchCitationDistForQueryRes(queryResId);\r\n\t\tIterator<Integer> it = citationDistMap.keySet().iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tInteger year = it.next();\r\n\t\t\tInteger annualCitationCount = citationDistMap.get(year);\r\n\t\t\tDouble depreciationPercent = annualDepreciationMap.get(year);\r\n\t\t\tDouble annualDccScore = depreciationPercent * annualCitationCount;\r\n\t\t\tdccScoreTotal += annualDccScore;\r\n\t\t}\r\n\t\treturn dccScoreTotal;\r\n\t}", "void bellford(ArrayList<Integer> nlist){\n\n int stval = nlist.get(0);\n dlist.get(stval).setval(stval);\n dlist.get(stval).setDist(0);\n\n for(int i = 0; i < nlist.size()-1; i++){\n for(int key: nlist){\n LinkedList<Node> alist = grp.getOrDefault(key, null);\n if(alist != null){\n for(Node node: alist){\n int val = node.getval();\n int we = node.getDist();\n int ddist = dlist.get(val).getDist();\n int odist = dlist.get(key).getDist();\n if(odist != Integer.MAX_VALUE && ddist > odist+we){\n dlist.get(val).setval(key);\n dlist.get(val).setDist(odist+we);\n }\n }\n }\n }\n }\n for(int key: dlist.keySet()){\n System.out.println(key+\" dist:\"+dlist.get(key).getDist()+\" prev:\"+dlist.get(key).getval());\n }\n System.out.println(\"Negative cycles at:\");\n //iisue should run n-1 times:\n for(int key: nlist){\n LinkedList<Node> alist = grp.getOrDefault(key, null);\n if(alist != null){\n for(Node node: alist){\n int val = node.getval();\n int we = node.getDist();\n int ddist = dlist.get(val).getDist();\n int odist = dlist.get(key).getDist();\n if(odist != Integer.MAX_VALUE && ddist > odist+we){\n dlist.get(val).setval(-999);\n dlist.get(val).setDist(odist+we);\n System.out.println(val);\n }\n }\n }\n }\n }", "int dijkstras(Node src, Node last) {\n\t\tPriorityQueue<Node> pq = new PriorityQueue<>((a, b) -> (a.getPrev().getDistance()) - (b.getPrev().getDistance()));\n\t\tsrc.getPrev().setDistance(0);\n\t\tlast.setFinished(true);\n\t\tpq.add(src);\n\t\tint count = 0;\n\t\t\n\t\twhile (!pq.isEmpty()) {\n\t\t\tNode n = pq.poll();\n\t\t\tcount++;\n\t\t\tif (n.isFinished()) return count;\n\t\t\tfor (Edge edge = n.getEdge(); edge != null; edge = edge.getNextEdge()) {\n\t\t\t\t\n\t\t\t\t//Checks to see if a path is shorter than the current one\n\t\t\t\tif (edge.getTo().getPrev().getDistance() > n.getPrev().getDistance() + edge.getWeight()) {\n\t\t\t\t\tedge.getTo().getPrev().setDistance(n.getPrev().getDistance() + edge.getWeight());\n\t\t\t\t\tedge.getTo().getPrev().setLast(n);\n\t\t\t\t\tpq.add(edge.getTo());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}", "public int getDifference(DaysBetween dt1, DaysBetween dt2)\n {\n // COUNT TOTAL NUMBER OF DAYS BEFORE FIRST DATE 'dt1'\n \n // initialize count using years and day\n int n1 = dt1.y * 365 + dt1.d;\n \n // Add days for months in given date\n for (int i = 0; i < dt1.m - 1; i++) \n {\n n1 += monthDays[i];\n }\n \n // Since every leap year is of 366 days,\n // Add a day for every leap year\n n1 += countLeapYears(dt1);\n \n // SIMILARLY, COUNT TOTAL NUMBER OF DAYS BEFORE 'dt2'\n int n2 = dt2.y * 365 + dt2.d;\n for (int i = 0; i < dt2.m - 1; i++)\n {\n n2 += monthDays[i];\n }\n n2 += countLeapYears(dt2);\n \n // return difference between two counts\n return (n2 - n1);\n }", "public ContratOffreDTO getCdd(){\n\t\tcdd = null;\n\t\tList<ContratOffreDTO> l = getNomenclatureDomainService().getContrats();\n\t\tfor(ContratOffreDTO c : l){\n\t\t\tif(c.getCodeCtrl().equalsIgnoreCase(DonneesStatic.CONTRAT_OFFRE_CODE_CTRL_CDD)){\n\t\t\t\tcdd=c;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn cdd;\n\t}", "@Test(testName = \"duplicateElementsFromTwoArrays\")\n\t public static void commonElementsFromArrays(){\n\t int[] arr1 = {4,7,3,9,2};\n\t int[] arr2 = {3,2,12,9,40,32,4};\n\t for(int i=0;i<arr1.length;i++){\n\t for(int j=0;j<arr2.length;j++){\n\t if(arr1[i]==arr2[j]){\n\t System.out.println(arr1[i]);\n\t }\n\t }\n\t }\n\t }", "private int getcd(){\r\n\t\tswitch(type){\r\n\t\tcase single: return new peashooter(pointer).getcd();\r\n\t\tcase sunflower:return new sunflower(pointer).getcd();\r\n\t\tcase nutwall: return new nutwall(pointer).getcd();\r\n\t\tcase cherry: return new cherry(pointer).getcd();\r\n\t\t}\r\n\t\treturn 0;\r\n\t}", "private static Direction case2Dir(CasePourDijkstra c1,CasePourDijkstra c2){\n\t\tif (c1.l-c2.l==1){\n\t\t\treturn Direction.NORD;\n\t\t}\n\t\tif (c1.l-c2.l==-1){\n\t\t\treturn Direction.SUD;\n\t\t}\n\t\tif (c1.c-c2.c==1){\n\t\t\treturn Direction.OUEST;\n\t\t}\n\t\tif (c1.c-c2.c==-1){\n\t\t\treturn Direction.EST;\n\t\t}\n\t\t\n\t\treturn null;//only accessible in error case\n\n\t}", "private static List<Integer> getCommonElementsIterativeMethod(int [] arr1, int [] arr2) {\n\t\tList<Integer> duplicates = new ArrayList<Integer>();\n\t\t\n\t\t// Iterate through both arrays and find common elements. (O(n2) steps!)\n\t\tfor (int i=0; i< arr1.length; i++) {\n\t\t\tfor (int j=0; j < arr2.length; j++) {\n\t\t\t\tif (arr1[i] == arr2[j]) {\n\t\t\t\t\tduplicates.add(arr1[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn duplicates;\n\t\t\n\t}" ]
[ "0.63233787", "0.6164322", "0.5749052", "0.56546223", "0.5651658", "0.55740374", "0.5513102", "0.5477532", "0.5370039", "0.5358599", "0.5349207", "0.53327084", "0.532837", "0.5261797", "0.5254487", "0.52483934", "0.5231811", "0.5219272", "0.52178323", "0.52103627", "0.5206902", "0.5186664", "0.5161", "0.5159424", "0.5157806", "0.5147506", "0.51419866", "0.51407236", "0.513675", "0.5112232", "0.5109889", "0.5108571", "0.50657743", "0.50583464", "0.50512904", "0.5048724", "0.5041287", "0.50346965", "0.5029297", "0.5017354", "0.5008951", "0.5007166", "0.49929327", "0.49888688", "0.498811", "0.4985869", "0.49854904", "0.49805698", "0.49651036", "0.49362773", "0.4935966", "0.49304575", "0.4925477", "0.49225524", "0.49212807", "0.49212223", "0.49166256", "0.49164668", "0.4914864", "0.4913058", "0.49128893", "0.49124876", "0.48991767", "0.4897423", "0.48969588", "0.48903397", "0.48864806", "0.48748258", "0.48689577", "0.48653552", "0.48639384", "0.48632577", "0.48624665", "0.486098", "0.48606807", "0.48538718", "0.485179", "0.48476472", "0.48473853", "0.48464438", "0.48445788", "0.4844502", "0.4840678", "0.4840251", "0.48305082", "0.48290992", "0.48261893", "0.48225778", "0.48207158", "0.48178512", "0.4813768", "0.481285", "0.48128358", "0.48062044", "0.48058078", "0.4805393", "0.4798653", "0.47933102", "0.47925657", "0.47912073" ]
0.5279665
13
Checks to see if a side if allowed. Note that this may return true even though a later handler might disallow a side, so you should only use this to skip checking a side (for example a diamond pipe might not check the filters for a specific side if its already been disallowed)
public boolean isAllowed(EnumFacing side) { return allowed.contains(side); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean hasSide() {\n return ((bitField0_ & 0x00000004) == 0x00000004);\n }", "public boolean hasSide() {\n return ((bitField0_ & 0x00000004) == 0x00000004);\n }", "boolean isValidSide(IBlockAccess access, BlockPos pos, EnumFacing facing);", "boolean hasSide();", "boolean isPossible() {\n return (sideOne + sideTwo > sideThree) && (sideTwo + sideThree > sideOne) && (sideThree + sideOne > sideTwo);\n }", "@Override\n public boolean isGoodForSides()\n {\n return false;\n }", "@Override\n\tpublic boolean isAWin(int side) {\n\t\treturn false;\n\t}", "public void sideCheck() {\n /*Be careful when creating tiles, especially ones that allow Sonic's bottom and middle sensors to intersect \n the same tile*/\n mLCollide = false;\n mRCollide = false;\n if(grounded) {\n if(groundSpeed > 0) {\n sideCollision(middleRight);\n }\n else if(groundSpeed < 0) {\n sideCollision(middleLeft);\n } \n }\n else if(!grounded) {\n if(xSpeed < 0) {\n sideCollision(middleLeft);\n }\n else if(xSpeed > 0) {\n sideCollision(middleRight);\n }\n }\n }", "private boolean isValidSide(int row, int col) {\n\t\treturn (col >= (super.currentPlayer % 2) * 10 && col < ((super.currentPlayer % 2) + 1) * 10 &&\n\t\t\t\tsuper.getGridPieces()[row][col] == null);\n\t}", "@Override\n @SideOnly(Side.CLIENT)\n public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {\n return false;\n }", "public static boolean check_scalene_triangle(int [] side) {\n\t\treturn !check_isosceles_tri(side) && !check_equ_tri(side) && isTri(side);\n\t}", "public boolean istrianglevalid() {\n //if all of the sides are valid, then return true, else return false\n if (sideA > 0 && sideB > 0 && sideC > 0) {\n return true;\n } else {\n return false;\n }\n }", "public boolean isSideField(Field field) {\n if (field.getX() == 0 || field.getX() == boardSize - 1) {\n return true;\n }\n if (field.getY() == 0 || field.getY() == boardSize - 1) {\n return true;\n } else {\n return false;\n }\n }", "@Override\n\tpublic boolean shouldSideBeRendered(IBlockAccess world, int x, int y ,int z, int side)\n\t{\n\t\tint meta = world.getBlockMetadata(x+(side==4?1:side==5?-1:0),y+(side==0?1:side==1?-1:0),z+(side==2?1:side==3?-1:0));\n\t\tif((meta==META_scaffolding||meta==META_scaffolding2||meta==META_aluminiumScaffolding||meta==META_aluminiumScaffolding2)&&world.getBlock(x, y, z)==this)\n\t\t{\n\t\t\tint meta2 = world.getBlockMetadata(x,y,z);\n\t\t\treturn !(meta2==META_scaffolding||meta2==META_scaffolding2||meta2==META_aluminiumScaffolding||meta2==META_aluminiumScaffolding2);\n\t\t}\n\t\tif(meta==META_fence||meta==META_aluminiumFence)\n\t\t\treturn true;\n\t\treturn super.shouldSideBeRendered(world, x, y, z, side);\n\t}", "public boolean isScalene() {\n\t\t\tif(sideOne != sideTwo && sideTwo != sideThree && sideOne != sideThree) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)\n\t{\n\t\treturn true;\n\t}", "public boolean canPlayHere(short side, short position) {\r\n\treturn this.currentSide == side && this.territory[side][position] != 0;\r\n }", "boolean hasHingeOnRightSide() throws RuntimeException;", "public static boolean onBorderOf(Rectangle2D side, Rectangle2D rect) {\n return (\n (side.getWidth() == 0 &&\n (side.getX() == rect.getMinX() || side.getX() == rect.getMaxX()) &&\n side.getMinY() >= rect.getMinY() && side.getMaxY() <= rect.getMaxY()) ||\n (side.getHeight() == 0 &&\n (side.getY() == rect.getMinY() || side.getY() == rect.getMaxY()) &&\n side.getMinX() >= rect.getMinX() && side.getMaxX() <= rect.getMaxX())\n );\n }", "public boolean hitSide()\n {\n if(accel.getAcceleration(ADXL345_I2C.Axes.kX)>0)\n return true;\n else\n return false;\n }", "public void setSide(String side) {\n\t\tthis.side = side;\n\t}", "@Override\n\tpublic boolean isSideSolid( IBlockAccess world, int x, int y, int z, ForgeDirection side )\n\t{\n\t\treturn true;\n\t}", "public boolean isScalene() {\n\t\t\tif (this.sideOne != this.sideTwo && this.sideOne != this.sideThree && this.sideTwo != this.sideThree) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "boolean isRight() {\r\n\t\tint maxlength;\r\n\t\tmaxlength = Math.max(Math.max(side1, side2), side3);\r\n\t\treturn (maxlength * maxlength == (side1 * side1) + (side2 * side2) + (side3 * side3) - (maxlength * maxlength));\r\n\t}", "@Override\n\tpublic boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)\n\t{\n\t\tBlockPos offSetPos = pos.offset(face);\n\t\tIBlockState offSetState = world.getBlockState(offSetPos);\n\n\t\tMaterial offSetMaterial = offSetState.getMaterial();\n\n\t\tif (!offSetMaterial.isOpaque())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public void setRightSide(boolean side) {\n this.rightSide = side;\n }", "boolean hasMove(Piece side) {\r\n List<Move> listOfLegalMoves = legalMoves(side);\r\n return listOfLegalMoves != null;\r\n }", "public boolean hasFourSides() { return hasNMarkedSides(4); }", "public boolean isRightSide() {\n return rightSide;\n }", "public abstract boolean ComputeSide( Communicator comm);", "private boolean hitSides() {\n if (b.numY + 60 >= BOX_HEIGHT || (b.numY - 60 <= 0)) {\n return true;\n } else {\n return false;\n }\n }", "public boolean onHorizontalEdge() {\n\t\treturn horizontal != Side.None;\n\t}", "public void disallow(EnumFacing... sides) {\n for (EnumFacing side : sides) {\n allowed.remove(side);\n }\n }", "public boolean hasThreeSides() { return hasNMarkedSides(3); }", "public boolean isSidePlayerOpen() {\n return this.sidePlayer;\n }", "public boolean isLegalMove (int row, int col, BoardModel board, int side) {\n\t\t\n\t\tboolean valid = false;\n\t\t//look if the position is valid\n\t\tif(board.getBoardValue(row, col) == 2) {\n\t\t\t//look for adjacent position\n\t\t\tfor(int[] surround : surroundingCoordinates(row, col)) {\n\t\t\t\t//the adjacent poision has to be of the opponent\n\t\t\t\tif(board.getBoardValue(surround[0], surround[1]) == getOpponent(side)){\n\t\t\t\t\t//now check if we come across with a color of ourselves\n\t\t\t\t\tint row_diff = surround[0] - row;\n\t\t\t\t\tint col_diff = surround[1] - col;\t\t\t\t\t\n\t\t\t\t\tif(!valid && checkNext((row+row_diff), (col+col_diff), row_diff, col_diff, side, board) ){\n\t\t\t\t\t\tvalid = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn valid;\n\t}", "public boolean isIsosceles() {\n\t\t\tif(sideOne == sideTwo || sideTwo == sideThree || sideOne == sideThree) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "protected boolean canUseOtherDirection() {\n return false;\n }", "public String getSide() {\r\n return side;\r\n }", "public boolean canAddCover(int side, int cover)\r\n/* 124: */ {\r\n/* 125:104 */ if (side > 5) {\r\n/* 126:104 */ return false;\r\n/* 127: */ }\r\n/* 128:105 */ int n = cover >> 8;\r\n/* 129:106 */ if ((n != 0) && (n != 1) && (n != 3) && (n != 4)) {\r\n/* 130:106 */ return false;\r\n/* 131: */ }\r\n/* 132:107 */ if ((this.CoverSides & 1 << side) > 0) {\r\n/* 133:107 */ return false;\r\n/* 134: */ }\r\n/* 135:108 */ return true;\r\n/* 136: */ }", "public String getSide() {\n\t\treturn side;\n\t}", "public boolean onSide(int face) {\n for (int i = 0; i <= 5; i++) {\n if ((i - 3 == face && i < 3) || (i - 2 == face && i >= 3)) {\n for (int j : allColors[i]) {\n if (j == loc) {\n return true;\n }\n }\n }\n }\n return false;\n }", "public boolean isIsosceles() {\n\t\t\tif((this.sideOne == this.sideTwo & this.sideOne != this.sideThree) || (this.sideOne == this.sideThree & this.sideOne != this.sideTwo) || (this.sideTwo == this.sideThree & this.sideTwo != this.sideOne)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "public static boolean check_isosceles_tri(int [] side) {\n\t\treturn (side[0] == side[1])^(side[0] == side[2])^(side[1] == side[2]) && !(check_equ_tri(side)) && isTri(side);\n\t}", "public Side getSide() {\r\n\t\treturn side;\r\n\t}", "public static boolean check_right_angled_tri(int [] side) {\n\t\tint a_sqr = side[0]*side[0];\n\t\tint b_sqr = side[1]*side[1];\n\t\tint c_sqr = side[2]*side[2];\n\t\t\n\t\t// boolean isIsosceles = check_isosceles_tri(a_side, b_side, c_side);\n\t\treturn ((a_sqr == b_sqr + c_sqr) || (b_sqr == a_sqr + c_sqr) || (c_sqr == a_sqr+b_sqr)) && isTri(side) ;\n\t}", "public static boolean checkWhichSideCorrect(DotsPair dotsPair, int blockMode) {\n boolean yesCorrect = false;\n if (dotsPair.getDotSetOne().getTotalNumDots() > dotsPair.getDotSetTwo().getTotalNumDots()) {\n yesCorrect = true;\n } else {\n yesCorrect = false;\n }\n return yesCorrect;\n }", "public static boolean check_equ_tri(int [] side) {\n\t\treturn ((side[0] == side[1]) && (side[1] == side[2])) && isTri(side) ;\n\t}", "public static boolean isValid(double side1, double side2, double side3) {\n\t boolean isValid = side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1 ;\n\t return isValid;\n\t}", "public boolean canPlaceRoad(Player p, Edge e){\r\n for(Corner c: e.getConnectingCorners()){\r\n if(c.getOwner()==p) return true;\r\n }\r\n return false;\r\n }", "com.cantor.drop.aggregator.model.CFTrade.Side getSide();", "boolean checkValidity(int side1, int side2, int side3);", "public boolean canCastle(PieceColor color, boolean kingSide) {\n \tif(color == PieceColor.White) {\n \t\tif(kingSide) return castle[0];\n \t\telse return castle[1];\n \t}\n \telse if(color == PieceColor.Black) {\n \t\tif(kingSide) return castle[2];\n \t\telse return castle[3];\n \t}\n \treturn false;\n }", "public com.cantor.drop.aggregator.model.CFTrade.Side getSide() {\n com.cantor.drop.aggregator.model.CFTrade.Side result = com.cantor.drop.aggregator.model.CFTrade.Side.valueOf(side_);\n return result == null ? com.cantor.drop.aggregator.model.CFTrade.Side.BUY : result;\n }", "public com.cantor.drop.aggregator.model.CFTrade.Side getSide() {\n com.cantor.drop.aggregator.model.CFTrade.Side result = com.cantor.drop.aggregator.model.CFTrade.Side.valueOf(side_);\n return result == null ? com.cantor.drop.aggregator.model.CFTrade.Side.BUY : result;\n }", "public boolean isFire() {\n return side;\n }", "public boolean isAllowed() {\n \t\treturn isAllowed;\n \t}", "public boolean isRight () {\r\n\t\tif (((Math.pow(startSide1, 2) + Math.pow(startSide2, 2) == Math.pow(startSide3, 2)) || \r\n\t\t\t(Math.pow(startSide2, 2) + Math.pow(startSide3, 2) == Math.pow(startSide1, 2)) ||\r\n\t\t\t(Math.pow(startSide3, 2) + Math.pow(startSide1, 2) == Math.pow(startSide2, 2)))\r\n\t\t\t&& isTriangle () == true && isEquilateral () == false) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "public boolean canInsertItem(int slot, ItemStack item, int side)\n {\n return this.isItemValidForSlot(slot, item) && this.getAccessibleSlotsFromSide(side)[0] == slot;\n }", "public boolean checkIfBlocked(){\n\t\tsetNextXY();\n\t\t/*if(Physics.hitWall(this, game.wi)){\n\t\t\tblocked=true;\n\t\t}\n\t\telse{\n\t\t\tblocked=false;\n\t\t}\n\t\t*/\n\t\t\n\t\ttry{\n\t\t\tif(game.getController().wallArray[lastX][lastY]||game.getController().wallArray[nextX][nextY]){\n\t\t\t\treturn true;\n\t\t\t}\t\n\t\t}catch(IndexOutOfBoundsException x){\n\t\t\t\n\t\t\n\t\t}\n\t\treturn false;\n\t\t\n\t}", "@Override\n\tprotected SideWiseType determineSideWiseType(final List<Double> sides) {\n\t\tSideWiseType shapeType = super.determineSideWiseType(sides);\t// first see what superclass found out\n\t\t\n\t\tif (SideWiseType.EQUILATERAL.equals(shapeType)) {\n\t\t\t// determined as equilateral by superclass: this is the most specific side-wise type for a triangle so use it\n\t\t\treturn shapeType;\n\t\t}\n\t\t\n\t\t// not equilateral, must be either isosceles or scalene\n\t\tSet<Double> sidesByLength = sides.stream().collect(Collectors.toSet());\n\t\tif (sidesByLength.size() == 2) {\n\t\t\t// two sides of the same length, one of another length -> isosceles\n\t\t\treturn SideWiseType.ISOSCELES;\n\t\t} \n\t\t\n\t\t// neither equilateral nor isosceles: it is scalene\n\t\treturn SideWiseType.SCALENE;\n\t}", "public boolean canFrameConnectIn(int dir)\r\n/* 35: */ {\r\n/* 36: 27 */ return (this.StickySides & 1 << dir) > 0;\r\n/* 37: */ }", "public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) {\n\t\treturn canPlaceBlockAt(par1World, par2, par3, par4);\n\t}", "public int getSideId() {\r\n return sideId;\r\n }", "public boolean canExtractItem(int slot, ItemStack item, int side)\n {\n return this.getAccessibleSlotsFromSide(side)[0] == slot && item.getItem() == waterjetStacks[slot].getItem();\n }", "public static short getAdversarySide(short side) {\r\n\treturn (short) Math.abs(side - 1);\r\n }", "private boolean collisionWithHorizontalWall() {\n return (xPos + dx > RIGHT_BORDER || xPos + dx < 0);\n }", "public boolean isProhibited() {\n return getFlow().isProhibited();\n }", "public boolean mayPass(Level level, int x, int y, Entity e) {\n\t\treturn e.canSwim(); // If the entity can swim (which only the player can), then it will allow that entity to pass.\n\t}", "public double getSide()\n\t{\n\t\treturn this.side;\n\t}", "public boolean hasSameSides(Property prop) {\n // this code provided by Dave Houtman [2020] personal communication\n return this.getXLength() == prop.getXLength() && this.getYWidth() == prop.getYWidth();\n }", "public boolean isAllowed() {\n return isAllowed;\n }", "public void setSideId(int value) {\r\n this.sideId = value;\r\n }", "private boolean checkOtherSide(Point2D p, Node n, Node originN) {\n if (n == null) return true;\n double pointDist = p.distanceTo(n.p);\n double lineDist2 = plDist(p, originN);\n if (lineDist2 < pointDist) {\n return true;\n } else return false;\n }", "@Override\n public boolean func_102008_b(int slot, ItemStack itemstack, int sideordinal)\n \t{\n \t\tif(sideordinal > 5) return false;\n \t\treturn _isSideOutput[sideordinal];\n \t}", "public boolean isSecondBallAllowed() {\n\t\treturn !isStrike() || isBonusShotAllowed();\n\t}", "public boolean canFrameConnectOut(int dir)\r\n/* 40: */ {\r\n/* 41: 31 */ return (this.StickySides & 1 << dir) > 0;\r\n/* 42: */ }", "public boolean istrianglevalid(double semiPer) {\n //declare variables\n boolean checkA = true;\n boolean checkB = true;\n boolean checkC = true;\n \n if (semiPer >= sideA && semiPer >= sideB && semiPer >= sideC) {\n return true;\n } else {\n return false;\n }\n }", "public boolean isFacingLeft(){\r\n\t\tif(facingLeft == true){\r\n\t\t\treturn true;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "private boolean canTakeControl(String[] procIds)\n\t{\n\t\tIServerProxy proxy = (IServerProxy) ServiceManager.get(IServerProxy.class);\n\t\tif (proxy.getCurrentServer().getRole().equals(ServerRole.MONITORING)) return false;\n\t\t// Ensure that all are uncontrolled.\n\t\tfor (String procId : procIds)\n\t\t{\n\t\t\tif (s_procMgr.isLocallyLoaded(procId))\n\t\t\t{\n\t\t\t\tIProcedure proc = s_procMgr.getProcedure(procId);\n\t\t\t\t// If local and already controlled by me\n\t\t\t\tIExecutionInformation info = proc.getRuntimeInformation();\n\t\t\t\t\n\t\t\t\t// Do not allow in certain procedure status\n\t\t\t\tExecutorStatus st = info.getStatus();\n\t\t\t\tswitch(st)\n\t\t\t\t{\n\t\t\t\tcase LOADED:\n\t\t\t\tcase RELOADING:\n\t\t\t\tcase UNINIT:\n\t\t\t\tcase UNKNOWN:\n\t\t\t\t\treturn false;\n\t\t\t\tdefault: break;\n\t\t\t\t}\n\n\t\t\t\t// Do not allow if we are already the controller\n\t\t\t\tIProcedureClient client = info.getControllingClient();\n\t\t\t\tif (client != null)\n\t\t\t\t{\n\t\t\t\t\tString cClient = client.getKey();\n\t\t\t\t\tif (cClient.equals(s_proxy.getClientKey())) { return false; }\n\t\t\t\t}\n\n\t\t\t\t// If local and being monitored by me\n\t\t\t\tIProcedureClient[] mClients = info.getMonitoringClients();\n\t\t\t\tif (mClients != null)\n\t\t\t\tfor (IProcedureClient mclient : mClients)\n\t\t\t\t{\n\t\t\t\t\tif (mclient.getKey().equals(s_proxy.getClientKey())) { return false; }\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When it is remote or it is not already controlled by my gui\n\t\t\t// allow to take control \n\t\t}\n\t\treturn true;\n\t}", "private static boolean isFullHex(Position p, int side) {\n int x = p.getX();\n int y = p.getY();\n // ensure the left bottom corner is in range\n if (x >= 0 && x <= WIDTH && y >= 0 && y <= HEIGHT) {\n // ensure the right bottom corner is in range\n return ((x + 3 * side - 2) <= WIDTH) && (y + side * 2 <= HEIGHT);\n }\n return false;\n }", "public void motorSafetyCheck() {\r\n if (leftMotor_0.getMotorType() == MotorType.kBrushed\r\n || leftMotor_1.getMotorType() == MotorType.kBrushed\r\n || leftMotor_2.getMotorType() == MotorType.kBrushed\r\n || rightMotor_0.getMotorType() == MotorType.kBrushed\r\n || rightMotor_1.getMotorType() == MotorType.kBrushed\r\n || rightMotor_2.getMotorType() == MotorType.kBrushed) {\r\n System.out.println(\"Brushed motor selected\");\r\n System.exit(0);\r\n }\r\n }", "@Override\n public boolean isValidSecondaryFacing(int dir) {\n int rotate = dir - getFacing();\n if (canChangeSecondaryFacing()) {\n if (getQuirks().booleanOption(\"ext_twist\")) {\n return (rotate == 0) || (rotate == 1) || (rotate == 2) || (rotate == -1) || (rotate == -2) || (rotate == -5) || (rotate == -4) || (rotate == 5) || (rotate == 4);\n }\n return (rotate == 0) || (rotate == 1) || (rotate == -1) || (rotate == -5) || (rotate == 5);\n }\n return rotate == 0;\n }", "@Override\r\n\tpublic boolean isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {\r\n\t\tint meta = world.getBlockMetadata(x, y, z);\r\n\t\treturn getStateFromMeta(meta) > 0;\r\n\t}", "public Side longerSide() {\n throw new UnsupportedOperationException(\"Waiting to be implemented.\");\n }", "public void setSideLength(double sideLength) {\n\t\tthis.sideLength = sideLength;\n\t}", "public static boolean isSecurityPartialRestrictedActions() {\r\n return (isSecurityPartialRestrictedActions);\r\n }", "@Override\r\n public boolean isShapeForbidden (Shape shape)\r\n {\r\n return (forbiddenShapes != null) && forbiddenShapes.contains(shape);\r\n }", "public boolean activeHandCanDouble() {\n Seat s = this.getSeat(this.seatPlaying);\n if (s.hasPlayer()) {\n Human h = (Human) s.getPlayer();\n Hand hand = h.getHands().get(0);\n \n return h.canDouble() && hand.getCards().size() == 2;\n } else {\n return false;\n }\n }", "Side getSide();", "public boolean canSplit() {\r\n if (cards.size() == 2 && cards.get(0).getValue().equals(cards.get(1).getValue())) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "public boolean hitSide(int xLow, int xHigh, int yLow, int yHigh)\n\t{\n\t\tif ((x + frogSize >= xHigh) || (x <= xLow))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t\t\n\t\tif ((y <= yLow) || (y + frogSize >= yHigh))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\n\t\tprotected boolean condition() {\n\t\t\tWhichSide whichSide = VisionUtil.getPositionOfGearTarget();\n\t\t\tSystem.err.println(\"Position of gear target: \"+whichSide);\n\t\t\tif (whichSide == WhichSide.RIGHT)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}", "private boolean hasLeftWall(View v){\n\t\tswitch(this.facingDirection){\n\t\tcase NORTH:\n\t\t\treturn !v.mayMove(Direction.WEST);\n\t\tcase SOUTH:\n\t\t\treturn !v.mayMove(Direction.EAST);\n\t\tcase WEST:\n\t\t\treturn !v.mayMove(Direction.SOUTH);\n\t\tcase EAST:\n\t\t\treturn !v.mayMove(Direction.NORTH);\n\t\tdefault: return false;\n\t\t}\n\t}", "@JSProperty(\"side\")\n @Nullable\n Chart3dFrameSideOptions getSide();", "public boolean isTwoHanded()\n/* 84: */ {\n/* 85:75 */ return false;\n/* 86: */ }", "public boolean isScalene () {\r\n\t\tif ((startSide1 != startSide2 && startSide1 != startSide3 && startSide2 != startSide3) && isTriangle () == true) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\telse return false;\r\n\t}", "public boolean isRightSideInverted() {\n return rightSideMultiplier == -1.0;\n }", "@Override\n\tpublic int getNumSides() {\n\t\treturn DEAFAULT_NUMSIDE;\n\t}", "int getSides()\n\t\t{\n\t\t\treturn sides;\n\t\t}" ]
[ "0.68003964", "0.67432237", "0.66945904", "0.65964", "0.63554776", "0.63552064", "0.63038117", "0.59227955", "0.58643216", "0.58377796", "0.5808804", "0.5798254", "0.577047", "0.57398015", "0.56687963", "0.5652073", "0.5649716", "0.5578839", "0.5536717", "0.551411", "0.54966664", "0.54914457", "0.54352117", "0.54008704", "0.5392767", "0.538845", "0.53795004", "0.5378383", "0.5338175", "0.53052485", "0.53029716", "0.5291369", "0.52893084", "0.5259677", "0.5230769", "0.5219552", "0.5212496", "0.5212017", "0.52035105", "0.51663345", "0.5162234", "0.5158074", "0.5153623", "0.5110661", "0.51095563", "0.5102541", "0.5099407", "0.50826883", "0.50724363", "0.5062446", "0.5043932", "0.5037633", "0.5024945", "0.49897125", "0.49822673", "0.49811506", "0.49628842", "0.49549213", "0.49389485", "0.4903389", "0.48995897", "0.48971742", "0.48768333", "0.48739725", "0.4867808", "0.48446152", "0.48445204", "0.4840821", "0.48401466", "0.48368427", "0.48308733", "0.48301476", "0.4824565", "0.48040238", "0.4789134", "0.4783455", "0.47831538", "0.47805202", "0.47751787", "0.47748", "0.47740358", "0.47695962", "0.47559887", "0.4735261", "0.47300276", "0.47257096", "0.47250146", "0.47202036", "0.471668", "0.47047594", "0.4702923", "0.46921587", "0.468517", "0.46825093", "0.46811387", "0.46706027", "0.46631888", "0.4663048", "0.46530318", "0.46416873" ]
0.73480296
0
Disallows the specific side(s) from being a destination for the item. If no sides are allowed, then the fluid will stay in the current pipe section.
public void disallow(EnumFacing... sides) { for (EnumFacing side : sides) { allowed.remove(side); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void preventMovementInOppositeDirection() {\n\t\tif(currentDirection == Direction.RIGHT && \n\t\t\t\tsnakeDirection == Direction.LEFT) {\n\t\t\t\n\t\t\tcurrentDirection = Direction.LEFT;\n\t\t} else if(currentDirection == Direction.LEFT && \n\t\t\t\tsnakeDirection == Direction.RIGHT) {\n\t\t\t\n\t\t\tcurrentDirection = Direction.RIGHT;\n\t\t} else if(currentDirection == Direction.DOWN && \n\t\t\t\tsnakeDirection == Direction.UP) {\n\t\t\t\n\t\t\tcurrentDirection = Direction.UP;\n\t\t} else if(currentDirection == Direction.UP && \n\t\t\t\tsnakeDirection == Direction.DOWN) {\n\t\t\t\n\t\t\tcurrentDirection = Direction.DOWN;\n\t\t}\n\t}", "@Override\n public boolean isGoodForSides()\n {\n return false;\n }", "@Override\n\tpublic boolean isAWin(int side) {\n\t\treturn false;\n\t}", "protected boolean canUseOtherDirection() {\n return false;\n }", "boolean isValidSide(IBlockAccess access, BlockPos pos, EnumFacing facing);", "@Override\n @SideOnly(Side.CLIENT)\n public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {\n return false;\n }", "public void directionRestriction(){\n \t\n }", "@Override\n\tpublic boolean canDrain(ForgeDirection from, Fluid fluid) {\n\t\treturn false;\n\t}", "public abstract boolean dropMaterial(ShortPoint2D pos, EMaterialType materialType, boolean offer, boolean forced);", "@Override\n\tpublic boolean isSideSolid( IBlockAccess world, int x, int y, int z, ForgeDirection side )\n\t{\n\t\treturn true;\n\t}", "public boolean istrianglevalid() {\n //if all of the sides are valid, then return true, else return false\n if (sideA > 0 && sideB > 0 && sideC > 0) {\n return true;\n } else {\n return false;\n }\n }", "public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)\n\t{\n\t\treturn true;\n\t}", "public boolean isSideField(Field field) {\n if (field.getX() == 0 || field.getX() == boardSize - 1) {\n return true;\n }\n if (field.getY() == 0 || field.getY() == boardSize - 1) {\n return true;\n } else {\n return false;\n }\n }", "@Override\r\n public boolean onPlace(BlockPlaceEvent event, BlockVector vector) {\n BlockVector doubleDoor = DoorHelper.getSecondIronDoor(vector);\r\n if (doubleDoor == null) {\r\n return false;\r\n }\r\n \r\n // check if there is a protection\r\n Protection protection = Core.protectionManager.getProtection(doubleDoor);\r\n if (protection == null) {\r\n return false;\r\n }\r\n \r\n // check permissions\r\n if (!protection.canEdit(event.getPlayer())) {\r\n PlayerUtils.sendError(event.getPlayer(), Core.NAME, \"You cannot place a door here.\");\r\n PlayerUtils.sendInfo(event.getPlayer(), \"The neighbour is a protected door.\");\r\n event.setCancelled(true);\r\n return true;\r\n }\r\n \r\n // send info\r\n PlayerUtils.sendInfo(event.getPlayer(), Core.NAME, \"Subprotection created.\");\r\n \r\n // return true to abort the event\r\n return true;\r\n }", "@Override\n public void removeConnection(World world, BlockPos pos, Direction direction) {\n for(int i = 0; i < connections.size(); i++) {\n FluidConnection conn = connections.get(i);\n if(conn.direction == direction) {\n if(conn.type == FLUID_IN) conn.type = FLUID_IN_OUT;\n else if(conn.type == FLUID_IN_OUT) conn.type = FLUID_OUT;\n else connections.remove(i);\n return;\n }\n }\n }", "boolean hasSide();", "@Override\n\tpublic boolean shouldSideBeRendered(IBlockAccess world, int x, int y ,int z, int side)\n\t{\n\t\tint meta = world.getBlockMetadata(x+(side==4?1:side==5?-1:0),y+(side==0?1:side==1?-1:0),z+(side==2?1:side==3?-1:0));\n\t\tif((meta==META_scaffolding||meta==META_scaffolding2||meta==META_aluminiumScaffolding||meta==META_aluminiumScaffolding2)&&world.getBlock(x, y, z)==this)\n\t\t{\n\t\t\tint meta2 = world.getBlockMetadata(x,y,z);\n\t\t\treturn !(meta2==META_scaffolding||meta2==META_scaffolding2||meta2==META_aluminiumScaffolding||meta2==META_aluminiumScaffolding2);\n\t\t}\n\t\tif(meta==META_fence||meta==META_aluminiumFence)\n\t\t\treturn true;\n\t\treturn super.shouldSideBeRendered(world, x, y, z, side);\n\t}", "boolean isPossible() {\n return (sideOne + sideTwo > sideThree) && (sideTwo + sideThree > sideOne) && (sideThree + sideOne > sideTwo);\n }", "private void disableIfDissatisfied() {\n \t\tif ( !this.satisfiesPolygon() ) {\n \t\t\tthis.area.setEnabled( false );\n \t\t}\n \t}", "@Override\n\tpublic boolean canFill(ForgeDirection from, Fluid fluid) {\n\t\treturn false;\n\t}", "public void sideCheck() {\n /*Be careful when creating tiles, especially ones that allow Sonic's bottom and middle sensors to intersect \n the same tile*/\n mLCollide = false;\n mRCollide = false;\n if(grounded) {\n if(groundSpeed > 0) {\n sideCollision(middleRight);\n }\n else if(groundSpeed < 0) {\n sideCollision(middleLeft);\n } \n }\n else if(!grounded) {\n if(xSpeed < 0) {\n sideCollision(middleLeft);\n }\n else if(xSpeed > 0) {\n sideCollision(middleRight);\n }\n }\n }", "public void setRightSide(boolean side) {\n this.rightSide = side;\n }", "private boolean isValidSide(int row, int col) {\n\t\treturn (col >= (super.currentPlayer % 2) * 10 && col < ((super.currentPlayer % 2) + 1) * 10 &&\n\t\t\t\tsuper.getGridPieces()[row][col] == null);\n\t}", "public void setCanStop() {\n \tleftCanMotor.set(0.0);\n \trightCanMotor.set(0.0); \n\t}", "public void allowDragOut(boolean allowed) {\n group.setDragOutAllowed(allowed);\n }", "@Override\n public boolean canMove(double x, double y) {\n return !getOwner().isDead();\n }", "public boolean isItemNotSoluble(Item item) {\n return !isItemSoluble(item);\n }", "public void dontMove() {\r\n\t\tspeed = 0;\r\n\t\tif(!playerNear().equals(\"n\")) {\r\n\t\t\tif(playerNear().equals(\"left\")) {\r\n\t\t\t\tsetIcon(leftImage);\r\n\t\t\t}\r\n\t\t\telse if(playerNear().equals(\"right\")) {\r\n\t\t\t\tsetIcon(rightImage);\r\n\t\t\t}\r\n\t\t\trepaint();\r\n\t\t}\r\n\t}", "public boolean hasSide() {\n return ((bitField0_ & 0x00000004) == 0x00000004);\n }", "public void pipeCheck(int x, int y, Building pipe) {\t\r\n\t\tif(pipe.getInputItem(0)!=null) {\r\n\r\n\r\n\t\t\t//make variable for item in pipe\r\n\t\t\tItem pipeItem=pipe.getInputItem(0);\r\n\r\n\t\t\t//If the pipes output is upwards\r\n\t\t\tif(((Pipe) pipe).getOutput().equals(\"left\")) {\r\n\r\n\t\t\t\t//error check\r\n\t\t\t\tif(x-1>=0) {\r\n\t\t\t\t\t//Check if it can send items up and if its a pipe\r\n\t\t\t\t\tif((tileMap[x-1][y].getBuilding() instanceof Pipe)) {\r\n\r\n\t\t\t\t\t\tBuilding m=tileMap[x-1][y].getBuilding();\r\n\t\t\t\t\t\t//Only go into the other pipe if its input is down\r\n\t\t\t\t\t\tif(((Pipe) m).getInput().equals(\"right\")) {\r\n\r\n\t\t\t\t\t\t\t//Only add item if there is space or item is already in the pipe\r\n\t\t\t\t\t\t\tif(m.getInputItem(0)==null || (m.getInputItem(0).getClass().equals(pipe.getInputItem(0).getClass()))) {\r\n\r\n\t\t\t\t\t\t\t\t//add the item to the building\r\n\t\t\t\t\t\t\t\ttileMap[x-1][y].getBuilding().addInputItem(pipe.getInputItem(0));\r\n\t\t\t\t\t\t\t\ttileMap[x][y].getBuilding().removeInputItem(0);\r\n\t\t\t\t\t\t\t} //end of if checking items\r\n\t\t\t\t\t\t} //end of if checking the pipes input\r\n\t\t\t\t\t\t//if the building isnt a pipe then try to put item into building\r\n\t\t\t\t\t}else if( (tileMap[x-1][y].getBuilding()!=null) && (tileMap[x-1][y].getBuilding().getInputInventorySize()>0)) {\r\n\t\t\t\t\t\tboolean check=false;\r\n\t\t\t\t\t\t//for loop to find a spot to put into building\r\n\t\t\t\t\t\tfor(int i=0;i<tileMap[x-1][y].getBuilding().getInputInventorySize();i++) {\r\n\r\n\t\t\t\t\t\t\t//if item wasnt added already only add if there is space or it exists in the building\r\n\t\t\t\t\t\t\tif( !(check) && ( (tileMap[x-1][y].getBuilding().getInputItem(i).getClass().equals(pipeItem.getClass())) || (tileMap[x][y+1].getBuilding().getInputItem(i)==null))) {\r\n\t\t\t\t\t\t\t\tcheck=true; //change to true so it doesnt add anymore items\r\n\t\t\t\t\t\t\t\ttileMap[x-1][y].getBuilding().addInputItem(pipeItem); //adds item to the building\r\n\t\t\t\t\t\t\t}\t//end of adding check if\r\n\t\t\t\t\t\t} //end of for loop \t\r\n\t\t\t\t\t}\t//end of building add if\r\n\t\t\t\t} //end of error check if\r\n\t\t\t} //end of pipe if\r\n\r\n\t\t\t//If the pipes output is downwards\r\n\t\t\tif(((Pipe) pipe).getOutput().equals(\"right\")) {\r\n\r\n\t\t\t\tif(x+1<201){\r\n\t\t\t\t\t//Check if it can send items down and if its a pipe\r\n\t\t\t\t\tif((tileMap[x+1][y].getBuilding() instanceof Pipe)) {\r\n\r\n\t\t\t\t\t\tBuilding m=tileMap[x+1][y].getBuilding();\r\n\t\t\t\t\t\t//Only go into the other pipe if its input is up\r\n\t\t\t\t\t\tif(((Pipe) m).getInput().equals(\"left\")) {\r\n\r\n\t\t\t\t\t\t\t//Only add item if there is space or item is already in the pipe\r\n\t\t\t\t\t\t\tif(m.getInputItem(0)==null || (m.getInputItem(0).getClass().equals(pipe.getInputItem(0).getClass()))) {\r\n\r\n\t\t\t\t\t\t\t\t//add the item to the building\r\n\t\t\t\t\t\t\t\ttileMap[x+1][y].getBuilding().addInputItem(pipe.getInputItem(0));\r\n\t\t\t\t\t\t\t\ttileMap[x][y].getBuilding().removeInputItem(0);\r\n\r\n\t\t\t\t\t\t\t} //end of if checking items\r\n\t\t\t\t\t\t} //end of if checking the pipes input\r\n\r\n\t\t\t\t\t\t//if the building isnt a pipe then try to put item into building\r\n\t\t\t\t\t}else if( (tileMap[x+1][y].getBuilding()!=null) && (tileMap[x+1][y].getBuilding().getInputInventorySize()>0)) {\r\n\r\n\t\t\t\t\t\tboolean check=false;\r\n\t\t\t\t\t\t//for loop to find a spot to put into building\r\n\t\t\t\t\t\tfor(int i=0;i<tileMap[x+1][y].getBuilding().getInputInventorySize();i++) {\r\n\r\n\t\t\t\t\t\t\t//if item wasnt added already only add if there is space or it exists in the building\r\n\t\t\t\t\t\t\tif( !(check) && ( (tileMap[x+1][y].getBuilding().getInputItem(i).getClass().equals(pipeItem.getClass())) || (tileMap[x+1][y].getBuilding().getInputItem(i)==null))) {\r\n\t\t\t\t\t\t\t\tcheck=true; //change to true so it doesnt add anymore items\r\n\t\t\t\t\t\t\t\ttileMap[x+1][y].getBuilding().addInputItem(pipeItem); //adds item to the building\r\n\t\t\t\t\t\t\t}\t//end of adding check if\r\n\t\t\t\t\t\t} //end of for loop \t\r\n\t\t\t\t\t}\t//end of building add if\r\n\t\t\t\t} //end of error check if\r\n\t\t\t} //end of pipe if\r\n\r\n\r\n\t\t\t//If the pipes output is left\r\n\t\t\tif(((Pipe) pipe).getOutput().equals(\"up\")) {\r\n\r\n\r\n\t\t\t\tif (y-1>=0){\r\n\t\t\t\t\t//Check if it can send items down and if its a pipe\r\n\t\t\t\t\tif((tileMap[x][y-1].getBuilding() instanceof Pipe)) {\r\n\r\n\t\t\t\t\t\tBuilding m=tileMap[x][y-1].getBuilding();\r\n\t\t\t\t\t\t//Only go into the other pipe if its input is down\r\n\t\t\t\t\t\tif(((Pipe) m).getInput().equals(\"down\")) {\r\n\r\n\t\t\t\t\t\t\t//Only add item if there is space or item is already in the pipe\r\n\t\t\t\t\t\t\tif(m.getInputItem(0)==null || (m.getInputItem(0).getClass().equals(pipe.getInputItem(0).getClass()))) {\r\n\r\n\t\t\t\t\t\t\t\t//add the item to the building\r\n\t\t\t\t\t\t\t\ttileMap[x][y-1].getBuilding().addInputItem(pipe.getInputItem(0));\r\n\t\t\t\t\t\t\t\ttileMap[x][y].getBuilding().removeInputItem(0);\r\n\t\t\t\t\t\t\t} //end of if checking items\r\n\t\t\t\t\t\t} //end of if checking the pipes input\r\n\r\n\t\t\t\t\t\t//if the building isnt a pipe then try to put item into building\r\n\t\t\t\t\t}else if( (tileMap[x][y-1].getBuilding()!=null) && (tileMap[x][y-1].getBuilding().getInputInventorySize()>0)) {\r\n\r\n\t\t\t\t\t\tboolean check=false;\r\n\t\t\t\t\t\t//for loop to find a spot to put into building\r\n\t\t\t\t\t\tfor(int i=0;i<tileMap[x][y-1].getBuilding().getInputInventorySize();i++) {\r\n\r\n\t\t\t\t\t\t\t//if item wasnt added already only add if there is space or it exists in the building\r\n\t\t\t\t\t\t\tif( !(check) && ( (tileMap[x][y-1].getBuilding().getInputItem(i).getClass().equals(pipeItem.getClass())) || (tileMap[x][y-1].getBuilding().getInputItem(i)==null))) {\r\n\t\t\t\t\t\t\t\tcheck=true; //change to true so it doesnt add anymore items\r\n\t\t\t\t\t\t\t\ttileMap[x][y-1].getBuilding().addInputItem(pipeItem); //adds item to the building\r\n\t\t\t\t\t\t\t}\t//end of adding check if\r\n\t\t\t\t\t\t} //end of for loop \t\r\n\t\t\t\t\t}\t//end of building add if\r\n\t\t\t\t} //end of error check if\r\n\t\t\t} //end of pipe if\r\n\r\n\t\t\t//If the pipes output is downwards\r\n\t\t\tif(((Pipe) pipe).getOutput().equals(\"down\")) {\r\n\r\n\r\n\t\t\t\tif(y+1<201){\r\n\t\t\t\t\t//Check if it can send items down and if its a pipe\r\n\t\t\t\t\tif((tileMap[x][y+1].getBuilding() instanceof Pipe)) {\r\n\r\n\t\t\t\t\t\tBuilding m=tileMap[x][y+1].getBuilding();\r\n\t\t\t\t\t\t//Only go into the other pipe if its input is down\r\n\t\t\t\t\t\tif(((Pipe) m).getInput().equals(\"up\")) {\r\n\t\t\t\t\t\t\tSystem.out.println(\"ffound pipe\");\r\n\r\n\t\t\t\t\t\t\t//Only add item if there is space or item is already in the pipe\r\n\t\t\t\t\t\t\tif(m.getInputItem(0)==null || (m.getInputItem(0).getClass().equals(pipe.getInputItem(0).getClass()))) {\r\n\r\n\t\t\t\t\t\t\t\t//add the item to the building\r\n\t\t\t\t\t\t\t\ttileMap[x][y+1].getBuilding().addInputItem(pipe.getInputItem(0));\r\n\t\t\t\t\t\t\t\ttileMap[x][y].getBuilding().removeInputItem(0);\r\n\t\t\t\t\t\t\t} //end of if checking items\r\n\t\t\t\t\t\t} //end of if checking the pipes input\r\n\r\n\t\t\t\t\t\t//if the building isnt a pipe then try to put item into building\r\n\t\t\t\t\t}else if( (tileMap[x][y+1].getBuilding()!=null) && (tileMap[x][y+1].getBuilding().getInputInventorySize()>0)) {\r\n\r\n\t\t\t\t\t\tboolean check=false;\r\n\t\t\t\t\t\t//for loop to find a spot to put into building\r\n\t\t\t\t\t\tfor(int i=0;i<tileMap[x][y+1].getBuilding().getInputInventorySize();i++) {\r\n\r\n\t\t\t\t\t\t\t//if item wasnt added already only add if there is space or it exists in the building\r\n\t\t\t\t\t\t\tif( !(check) && ( (tileMap[x][y+1].getBuilding().getInputItem(i).getClass().equals(pipeItem.getClass())) || (tileMap[x][y+1].getBuilding().getInputItem(i)==null))) {\r\n\t\t\t\t\t\t\t\tcheck=true; //change to true so it doesnt add anymore items\r\n\t\t\t\t\t\t\t\ttileMap[x][y+1].getBuilding().addInputItem(pipeItem); //adds item to the building\r\n\t\t\t\t\t\t\t}\t//end of adding check if\r\n\t\t\t\t\t\t} //end of for loop \t\r\n\t\t\t\t\t}\t//end of building add if\r\n\t\t\t\t} //end of error check if\r\n\t\t\t} //end of pipe if\r\n\t\t}//end of null item if\r\n\t}", "boolean canPlaceRoad(EdgeLocation edgeLoc, boolean free);", "public Builder clearSide() {\n bitField0_ = (bitField0_ & ~0x00000004);\n side_ = 0;\n onChanged();\n return this;\n }", "protected void dropIfShould(World worldIn, BlockPos pos, IBlockState state){\n if(!canStay(worldIn, pos)){\n this.dropBlockAsItem(worldIn, pos, state, 0);\n worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);\n }\n }", "public boolean isDirectional() {\n return false;\n }", "@Override\n\tpublic boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)\n\t{\n\t\tBlockPos offSetPos = pos.offset(face);\n\t\tIBlockState offSetState = world.getBlockState(offSetPos);\n\n\t\tMaterial offSetMaterial = offSetState.getMaterial();\n\n\t\tif (!offSetMaterial.isOpaque())\n\t\t{\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}", "public boolean hasSide() {\n return ((bitField0_ & 0x00000004) == 0x00000004);\n }", "private void changeDirectionIfReachedPacingAreaMax()\n {\n int totalDistance = Math.abs(xTotalDistance);\n\n if (totalDistance > this.currentDistance)\n {\n this.nextDirection();\n //this.isFollowLimitedByTerrain = false;\n }\n }", "public void setSide(String side) {\n\t\tthis.side = side;\n\t}", "public boolean isDrooping() {\n return ((((this.leftTheta % 360) + 360) % 360) > 180)\n || ((((this.rightTheta % 360) + 360) % 360) > 180) \n || this.left.isDrooping()\n || this.right.isDrooping(); \n }", "public abstract void hideSidebar(Player player);", "public boolean canPlaceRoad(Player p, Edge e){\r\n for(Corner c: e.getConnectingCorners()){\r\n if(c.getOwner()==p) return true;\r\n }\r\n return false;\r\n }", "public FluidCuboid getSideFlow(boolean out) {\n\t\t\treturn this.fluids.get(out ? ChannelModelPart.SIDE_OUT : ChannelModelPart.SIDE_IN);\n\t\t}", "@Override\r\n\tpublic boolean canMove() {\r\n\t\treturn false;\r\n\t}", "boolean isAllOnDestination(){\n\n if(player.getCurrentX()-player.getDestinationX()!=0 || player.getCurrentY()-player.getDestinationY()!=0)\n return false;\n\n for(int i = 0; i < boxes.size(); i++){\n Box item = boxes.get(i);\n if(item.getCurrentX()-item.getDestinationX()!=0 || item.getCurrentY()-item.getDestinationY()!=0)\n return false;\n }\n return true;\n }", "private void blockedPathNoBeepers() {\n\t\twhile (frontIsBlocked() && noBeepersPresent()) {\n\t\t\tturnLeft();\n\t\t\tturnLeft();\n\t\t} \n\t\tmove();\n\t\tturnRight();\n\t}", "public void stopMovement() {\r\n this.canMove = false;\r\n }", "private boolean hitSides() {\n if (b.numY + 60 >= BOX_HEIGHT || (b.numY - 60 <= 0)) {\n return true;\n } else {\n return false;\n }\n }", "public boolean isAllowed(EnumFacing side) {\n return allowed.contains(side);\n }", "public boolean isMultiDirectional() {\n return false;\n }", "private boolean isBlocked(View v){\n\t\treturn !v.mayMove(facingDirection);\n\t}", "public boolean isDrooping() {\n return false;\n }", "private boolean checkDownSpace(Position p, int len,\n int leftWid, int rightWid) {\n int x = p.x;\n int y = p.y;\n for (int j = y; j > y - len; j -= 1) {\n for (int i = x - rightWid; i < x + leftWid + 1; i += 1) {\n if (j < 0) {\n return false;\n }\n if (i < 0 || i >= worldWidth) {\n return false;\n }\n if (!world[i][j].equals(Tileset.NOTHING)) {\n return false;\n }\n }\n }\n return true;\n }", "protected boolean isMovementNoisy() {\n/* 1861 */ return (!this.abilities.flying && (!this.onGround || !isDiscrete()));\n/* */ }", "public int tryRemoveCover(int side)\r\n/* 172: */ {\r\n/* 173:136 */ if ((this.CoverSides & 1 << side) == 0) {\r\n/* 174:136 */ return -1;\r\n/* 175: */ }\r\n/* 176:137 */ this.CoverSides &= (1 << side ^ 0xFFFFFFFF);\r\n/* 177:138 */ int tr = this.Covers[side];this.Covers[side] = 0;\r\n/* 178:139 */ rebuildSticky();\r\n/* 179:140 */ updateBlockChange();\r\n/* 180:141 */ return tr;\r\n/* 181: */ }", "public boolean isDropper() {\n return this.type == Type.DROPPER;\n }", "public void removeWrongDestination (int button)\n {\n if (button==0)\n a.setEnabled(false);\n else if (button==1)\n b.setEnabled(false);\n else\n c.setEnabled(false);\n feedbackLabel.setVisible(true);\n }", "public boolean canFrameConnectOut(int dir)\r\n/* 40: */ {\r\n/* 41: 31 */ return (this.StickySides & 1 << dir) > 0;\r\n/* 42: */ }", "@Test(expected = InvalidWaypointsException.class)\n public void pipeDrawerMisPlacedPoints() {\n Point2D[] waypoints = {\n new Point2D(1, 1),\n new Point2D(2, 2)\n };\n new PipeDrawer(waypoints, null, 1);\n }", "void unsetDirection();", "@Override\n public boolean CanArmor() {\n return false;\n }", "public void restrictVelocity() {\n\t\tif (velocity.x > MAX_VELOCITY.x)\r\n\t\t\tvelocity.x = MAX_VELOCITY.x;\r\n\t\tif (velocity.y > MAX_VELOCITY.y)\r\n\t\t\tvelocity.y = MAX_VELOCITY.y;\r\n\t\t\r\n\t\tif (velocity.x < -MAX_VELOCITY.x)\r\n\t\t\tvelocity.x = -MAX_VELOCITY.x;\r\n\t\tif (velocity.y < -MAX_VELOCITY.y)\r\n\t\t\tvelocity.y = -MAX_VELOCITY.y;\r\n\t}", "public boolean isScalene() {\n\t\t\tif(sideOne != sideTwo && sideTwo != sideThree && sideOne != sideThree) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "public void setRestricted(boolean restricted) {\n _restricted = (restricted && _dropType == DropType.ITEM);\n }", "@Override\r\n\tprotected boolean canDropLoot() {\r\n\t\treturn false;\r\n\t}", "public abstract boolean canRemoveItem(Player player, Item item, int slot);", "@Override\n\tprotected void dropFewItems(boolean par1, int par2) {\n\t\tsuper.dropFewItems(par1, par2);\n\n\t\t// drop saddle if equipped\n\t\tif (isSaddled()) {\n\t\t\tdropItem(Items.SADDLE, 1);\n\t\t}\n\t}", "@Override\n\tpublic boolean canBeLeft() {\n\t\treturn true;\n\t}", "public boolean shouldPreventFlow(Block b) {\n\t\treturn !b.hasMetadata(\"flow\");\n\t}", "@Override\n public void handleCollision(Pellet pellet)\n {\n if(!isMovingToPoint())\n {\n if (mirror.getColor().a > Toggle.fadealpha)\n {\n\n float mirOX = getPosX() + getWidth() / 2;\n float mirOY = getPosY() + getHeight() / 2;\n\n if (acceptedDirs.equals(\"dl\"))\n {\n\n if (pellet.direction == 'u')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'r';\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'l';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"dr\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'l';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2) + 1 / PlayScreen.PPM);\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2) - 1 / PlayScreen.PPM);\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'r';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"ur\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'l';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'r';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n else if (acceptedDirs.equals(\"ul\"))\n {\n if (pellet.direction == 'u')\n {\n pellet.direction = 'r';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'd')\n {\n pellet.direction = 'u';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n }\n else if (pellet.direction == 'l')\n {\n pellet.direction = 'd';\n pellet.pellet.setX(mirOX - (pellet.pellet.getWidth() / 2));\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n else if (pellet.direction == 'r')\n {\n pellet.direction = 'l';\n pellet.pellet.setY(mirOY - (pellet.pellet.getHeight() / 2));\n }\n }\n //Draw the pellet at the origin of the mirror\n pellet.collided = false;\n }\n }\n }", "@Model\n\tprotected boolean noObjectMovementBlocking(List<Object> list) {\n\t\tif (this instanceof Plant) return true;\n\t\t\n\t\tfor(Object element : list) {\n\t\t\tif (!(element instanceof Plant)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "private void turnToNoWall(Navigation.Turn direction) {\r\n\t\tnavigation.rotate(direction);\r\n\t\tdoneTurning=false;\r\n\t\t\r\n\t\twhile(!doneTurning) {\r\n\t\t\tif(usSensor.rawDistance()>WALL_THRESHOLD) {\r\n\t\t\t filterControl++;\r\n\t\t\t\tif(filterControl>=NO_WALL_FILTER) {\r\n\t\t\t\t\tfilterControl=0;\r\n\t\t\t\t\tdoneTurning=true;\r\n\t\t\t\t\tnavigation.stopMotors();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tfilterControl=0;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void able()\n {\n // Enable all the buttons one by one\n for (int col = 0; col < COLUMNS; col++ )\n {\n // If the column is full, disable the corresponding button\n if (chessBoard[0][col] != 0)\n {\n drop[col].setEnabled(false);\n }\n // Else enable the button\n else\n {\n drop[col].setEnabled(true);\n }\n }\n }", "@Override\n\tpublic boolean shouldDismiss(int position, int direction) {\n\t\treturn direction == SwipeDirections.DIRECTION_NORMAL_LEFT;\n\t}", "private void implicitDestinationFieldsEnabled(boolean isImplictDestSelected) {\r\n\r\n // implicit dest fields\r\n pageNumberTextField.setEnabled(isImplictDestSelected);\r\n implicitDestTypeComboBox.setEnabled(isImplictDestSelected);\r\n leftTextField.setEnabled(isImplictDestSelected);\r\n topTextField.setEnabled(isImplictDestSelected);\r\n zoomTextField.setEnabled(isImplictDestSelected);\r\n\r\n }", "@EventHandler(ignoreCancelled = true)\n public void denyCropDupe(PlayerInteractEvent event) {\n if (!settings.isCropDupe()) return;\n\n // Do nothing if player is right clicking.\n if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;\n\n // Do nothing if player has permission.\n Player player = event.getPlayer();\n if (player.hasPermission(Perm.AntiGlitch.CROP_DUPE)) return;\n\n // Do nothing if player is not holding an exploitable material.\n if (!BukkitUtils.hasItemsSelected(player, settings.getCropDupeDenyBlocks())) return;\n\n // Iterate through all blocks surrounding block attempted to be placed.\n Block block = event.getClickedBlock().getRelative(event.getBlockFace());\n for (int x = -radius; x <= radius; x++) {\n for (int y = -radius; y <= radius; y++) {\n for (int z = -radius; z <= radius; z++) {\n // Do nothing if block cannot be duped.\n Material material = block.getRelative(x, y, z).getType();\n if (!settings.getCropDupeCropBlocks().contains(material)) continue;\n\n // Deny placing the block.\n player.updateInventory();\n event.setCancelled(true);\n\n // Send player a message.\n MessageUtils.sendMessage(player, settings.getCropDupeMessage());\n return;\n }\n }\n }\n }", "public boolean canCollide() {\n\t\treturn false;\r\n\t}", "boolean isRight() {\r\n\t\tint maxlength;\r\n\t\tmaxlength = Math.max(Math.max(side1, side2), side3);\r\n\t\treturn (maxlength * maxlength == (side1 * side1) + (side2 * side2) + (side3 * side3) - (maxlength * maxlength));\r\n\t}", "public Side longerSide() {\n throw new UnsupportedOperationException(\"Waiting to be implemented.\");\n }", "public boolean canShift() {\n\t\treturn marker < getRhs().length;\n\t}", "public boolean canBeSwappedOut();", "public void bounceOffEdge()\n {\n int margin = 2;\n\n if (getX() <= margin || getX() >= getWorld().getWidth() - margin) //left or right side\n {\n turn(180);\n }\n if (getY() <= margin || getY() >= getWorld().getHeight() - margin) //top or bottom side\n {\n turn(180);\n }\n }", "public void switchSides() {\n\t\tint temp = 0;\r\n\t\ttemp = leftValue;\r\n\t\tleftValue = rightValue;\r\n\t\trightValue = temp;\r\n\t}", "@Override\r\n public int move(Field f) throws CannotPerformAction {\r\n\r\n if(field.hasNeighbour(f)){\r\n this.replace(f);\r\n return 1;\r\n }\r\n\r\n if(this.field.hasStation() && f.hasStation()){\r\n this.replace(f);\r\n return 1;\r\n }\r\n\r\n if(field.hasStation()){\r\n if(hand.getCards().size() > 1) throw new AmbigousAction(\"Choose the card you'd like to discard\");\r\n hand.drop(hand.getCards().get(0));\r\n replace(f);\r\n return 1;\r\n }\r\n\r\n Card c1 = hand.hasCard(this.field);\r\n Card c2 = hand.hasCard(f);\r\n\r\n if(c1 != null && c2 != null) throw new AmbigousAction(\"You can take either private or public plane\");\r\n\r\n if(c1 != null) {\r\n replace(f);\r\n hand.drop(c1);\r\n return 1;\r\n }\r\n\r\n if(c2 != null){\r\n replace(f);\r\n hand.drop(c2);\r\n return 1;\r\n }\r\n throw new CannotPerformAction(\"You are not available to move to \" + f.getName());\r\n }", "@Override\n public boolean func_102008_b(int slot, ItemStack itemstack, int sideordinal)\n \t{\n \t\tif(sideordinal > 5) return false;\n \t\treturn _isSideOutput[sideordinal];\n \t}", "public abstract boolean canClip();", "protected static boolean canAccomodateItemDrop(Block block) {\n return block.isPassable() || Util.isNotFullBlock(block.getType());\n }", "public void loopThroughEdge()\n {\n int margin = 2;\n\n if (getX() < margin) //left side\n { \n setLocation(getWorld().getWidth()+ margin, getY());\n }\n else if (getX() > getWorld().getWidth() - margin) //right side\n {\n setLocation(margin, getY());\n }\n\n if (getY() < margin) //top side\n { \n setLocation(getX(), getWorld().getHeight() - margin);\n }\n else if(getY() > getWorld().getHeight() - margin) //bottom side\n { \n setLocation(getX(), margin);\n }\n }", "public int[] getAccessibleSlotsFromSide(int side)\n {\n return side == 0 ? slotsBottom : slotsTopSides;\n }", "@Override\n void setRoute() throws ItemTooHeavyException {\n deliveryItem = tube.pop();\n if (deliveryItem.weight > itemWeightLimit) throw new ItemTooHeavyException();\n // Set the destination floor\n destination_floor = deliveryItem.getDestFloor();\n }", "public boolean canExtractItem(int slot, ItemStack item, int side)\n {\n return this.getAccessibleSlotsFromSide(side)[0] == slot && item.getItem() == waterjetStacks[slot].getItem();\n }", "public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) {\n\t\treturn canPlaceBlockAt(par1World, par2, par3, par4);\n\t}", "public void checkEdge()\n {\n if(getX() < 10 || getX() > getWorld().getWidth() - 10)\n {\n speed *= -1;\n }\n }", "public void setSideId(int value) {\r\n this.sideId = value;\r\n }", "private void stopPlaceingShips() {\n\t\tSystem.out.println(\"[DEBUG] Schiffe setzen [ENDE]\");\n\t\tthis.setzeSchiffe = false;\n\t}", "protected void buildDoorway(World world, ICoords coords, Direction direction, Direction doubleSide) {\n\t\tint touching = 0;\n\t\tint x =0;\n\t\tint z = 0;\n\t\tint dx = 0;\n\t\tint dz = 0;\n\t\tint failSafe = 0;\n\n\t\t// setup the side that double side will remove\n\t\tswitch(doubleSide) {\n\t\tcase NORTH:\n\t\t\tdz--;\n\t\t\tbreak;\n\t\tcase EAST:\n\t\t\tdx++;\n\t\t\tbreak;\n\t\tcase SOUTH:\n\t\t\tdz++;\n\t\t\tbreak;\n\t\tcase WEST:\n\t\t\tdx--;\n\t\t\tbreak;\n\t\tdefault:\n\t\t}\n\n\t\tdo {\n\t\t\ttouching = 0;\n\n\t\t\t// carve \"regular\" doorway\n\t\t\tworld.setBlockState(coords.add(x, 1, z).toPos(), Blocks.AIR.getDefaultState(), 3);\n\t\t\tworld.setBlockState(coords.add(x, 2, z).toPos(), Blocks.AIR.getDefaultState(), 3);\n\t\t\t// carve double-side doorway\n\t\t\tworld.setBlockState(coords.add(dx, 1, dz).toPos(), Blocks.AIR.getDefaultState(), 3);\n\t\t\tworld.setBlockState(coords.add(dx, 2, dz).toPos(), Blocks.AIR.getDefaultState(), 3);\n\n\t\t\t// check in all four directions and add 1 to value\n\t\t\tBlockPos pos = coords.add(dx, 1, dz).toPos();\n\t\t\tif (world.getBlockState(pos.north()) == Blocks.AIR.getDefaultState()) touching++;\n\t\t\tif (world.getBlockState(pos.south()) == Blocks.AIR.getDefaultState()) touching++;\n\t\t\tif (world.getBlockState(pos.east()) == Blocks.AIR.getDefaultState()) touching++;\n\t\t\tif (world.getBlockState(pos.west()) == Blocks.AIR.getDefaultState()) touching++;\n\n\t\t\t// move to next block\n\t\t\tswitch(direction) {\n\t\t\tcase NORTH:\n\t\t\t\tz--;\n\t\t\t\tdz--;\n\t\t\t\tbreak;\n\t\t\tcase EAST:\n\t\t\t\tx++;\n\t\t\t\tdx++;\n\t\t\t\tbreak;\n\t\t\tcase SOUTH:\n\t\t\t\tz++;\n\t\t\t\tdz++;\n\t\t\t\tbreak;\n\t\t\tcase WEST:\n\t\t\t\tx--;\n\t\t\t\tdx--;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t}\n\t\t\tfailSafe++;\n\t\t} while (touching < 3 && failSafe < 5);\t\t\n\t}", "@Override\n public void moveTowards(int destination) throws FragileItemBrokenException {\n if(delaying){\n delaying = false;\n } else {\n super.moveTowards(destination);\n delaying = true;\n }\n }", "public void setSidesToGenerate(final boolean doLeft, final boolean doRight) {\n this.doLeft = doLeft;\n this.doRight = doRight;\n }", "public void setDropped(boolean dropped);", "public void allowDragIn(boolean allowed) {\n group.setDragInAllowed(allowed);\n }", "private boolean shouldHideInCorner(GameInfo intel) {\n return intel.getNumPlayers() > 2;\n }" ]
[ "0.6335399", "0.62316996", "0.58810115", "0.5833913", "0.5737216", "0.5625863", "0.5552845", "0.552169", "0.548517", "0.5443688", "0.5255187", "0.52357495", "0.5218719", "0.521314", "0.5208553", "0.51922226", "0.51831686", "0.5179123", "0.51084566", "0.50861466", "0.5082819", "0.5055236", "0.50533545", "0.4989387", "0.49627787", "0.49611714", "0.4960796", "0.49510565", "0.49360216", "0.4927049", "0.49144945", "0.4914381", "0.49142137", "0.49077037", "0.48973152", "0.48843145", "0.48716795", "0.4859143", "0.48478183", "0.48433003", "0.4828633", "0.4827626", "0.48238274", "0.4820046", "0.48152903", "0.48021638", "0.48001605", "0.47951737", "0.47945306", "0.47939393", "0.47862196", "0.47856662", "0.47720537", "0.47697252", "0.47596902", "0.47594008", "0.4757583", "0.47565544", "0.47553906", "0.47547135", "0.47419554", "0.47309628", "0.4730798", "0.47228497", "0.4702587", "0.46998566", "0.4688124", "0.46816984", "0.4679898", "0.46767965", "0.46631962", "0.46518102", "0.4651756", "0.46507388", "0.4638178", "0.46354917", "0.46329397", "0.4624339", "0.46212864", "0.46189848", "0.4618347", "0.46156502", "0.4614672", "0.46102756", "0.46090838", "0.46070272", "0.4606747", "0.4605808", "0.45921937", "0.45899585", "0.4586686", "0.45849013", "0.45805642", "0.4577383", "0.4577178", "0.45761162", "0.4573599", "0.4567625", "0.45658493", "0.45612377" ]
0.6073642
2
Let's use a single instance for all tests, to increase chance of seeing failures
protected void setUp() { typeResolver = new TypeResolver(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void instanceTest() {\n // TODO: test instance\n }", "@Test\n public void testGetInstance() {\n System.out.println(\"getInstance\");\n Fabrica expResult = Fabrica.getInstance();\n Fabrica result = Fabrica.getInstance();\n assertEquals(expResult, result);\n \n }", "@Test\n public void startApp2Do(){\n }", "void start() throws TestFailed\n {\n this.startSkeletons();\n }", "@Test\n public void testStartup() {}", "protected TestBench() {}", "@Test\n void one() {\n System.out.println(\"Executing Test 1.\");\n }", "@Test\n public void testStart() throws Exception {\n }", "public static void runAllTests() {\n\t\trunClientCode(SimpleRESTClientUtils.getCToFServiceURL());\n\t\trunClientCode(SimpleRESTClientUtils.getCToFServiceURL(new String [] {\"100\"}));\n\t}", "@Test\n public void shouldStartupIfGlobalShutdownDisabledAndReuseDisabledAndCloseOnFailEnabled() {\n when(this.config.shutDownWebdriver()).thenReturn(false);\n when(this.config.reuseWebDriver()).thenReturn(false);\n when(this.config.closeVisualWebDriveronFail()).thenReturn(true);\n\n this.context.setFailed();\n this.std.basePreScenarioSetup();\n\n verify(this.factory).createWebDriver();\n }", "@Test\n public void testProcess() throws Exception {\n }", "@RepeatedTest(value = Integer.MAX_VALUE)\n @Disabled\n void test() {\n\n long start = System.currentTimeMillis();\n\n SimpleClientImpl client = new SimpleClientImpl(Config.HOST, Config.PORT);\n\n assertNotNull(client);\n\n logger.info(\"Request Success : \" + counter.incrementAndGet() + \" \"\n + (System.currentTimeMillis() - start));\n\n }", "@Override\n\tpublic void homeTestRun() {\n\t\t\n\t}", "@Test\n public void questionIfNotAlreadyAccusedTest() throws Exception {\n\n }", "@BeforeClass\n public static void oneTimeSetUp() {\n\n }", "@Test\n public void serverStarts() {\n }", "@Test\n void run() throws Exception {\n setupDefaultAsPerProperties();\n\n JUnitUI UI = new JUnitUI();\n DiskWorker worker = new DiskWorker(UI);\n\n assertTrue(worker.run());\n }", "@Test(enabled =true, groups={\"fast\",\"window.One\",\"unix.One\",\"release1.one\"})\n\tpublic void testOne(){\n\t\tSystem.out.println(\"In TestOne\");\n\t}", "@Test\n public void testTimelyTest() {\n }", "public void runBare() throws Throwable {\n Throwable exception= null;\n setUp();\n try {\n runTest();\n } catch (Throwable running) {\n exception= running;\n }\n finally {\n try {\n tearDown();\n } catch (Throwable tearingDown) {\n if (exception == null) exception= tearingDown;\n }\n }\n if (exception != null) throw exception;\n }", "@Test\n public void trainWithMasterSplinterTest() {\n\n }", "@Test public void runCommonTests() {\n\t\trunAllTests();\n\t}", "protected TeststepRunner() {}", "@Test\n public void simpleUse(){\n }", "public TestResult run() {\n TestResult result= createResult();\n run(result);\n return result;\n }", "public void testGetInstance() throws Exception {\n System.out.println(\"getInstance\");\n \n TaskManagerFactory expResult = null;\n TaskManagerFactory result = TaskManagerFactory.getInstance();\n assertNotNull(\"TaskManagerFactory should not be null\", result);\n \n \n }", "private StressTestHelper() {\n // Empty constructor.\n }", "public static void runAllTheTests() {\n\t\ttestConstructorAndGetters();\n\t}", "public static void runAllTheTests() {\n\t\ttestConstructorAndGetters();\n\t}", "@Test\r\n\tpublic void testSanity() {\n\t}", "@Test\n public void testitFailNeverSingleThread() throws Exception {\n File testDir = ResourceExtractor.simpleExtractResources(getClass(), \"/mng-0095\");\n\n Verifier verifier = newVerifier(testDir.getAbsolutePath());\n verifier.setAutoclean(false);\n verifier.deleteDirectory(\"target\");\n verifier.deleteDirectory(\"subproject1/target\");\n verifier.deleteDirectory(\"subproject2/target\");\n verifier.deleteDirectory(\"subproject3/target\");\n verifier.addCliArgument(\"--fail-never\");\n verifier.setLogFileName(\"log-fn-mt1.txt\");\n verifier.addCliArgument(\"-Dmaven.threads.experimental=1\");\n verifier.addCliArgument(\"org.apache.maven.its.plugins:maven-it-plugin-touch:touch\");\n verifier.execute();\n\n verifier.verifyFilePresent(\"target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject1/target/touch.txt\");\n verifier.verifyFilePresent(\"subproject2/target/touch.txt\");\n verifier.verifyFilePresent(\"subproject3/target/touch.txt\");\n }", "@Test\n\tpublic void testMain() {\n\t}", "@Before\n public void setUp() {\n start(fakeApplication(inMemoryDatabase(), fakeGlobal()));\n }", "@Before\r\n\tpublic void doThisEveryTime() {\n\t}", "@SuppressWarnings(\"serial\")\n @Before\n public void setUp() throws Exception {\n testInstance = new ClientsPrepopulatingBaseAction() {\n };\n }", "@Test\n public void testitFailNeverTwoThreads() throws Exception {\n File testDir = ResourceExtractor.simpleExtractResources(getClass(), \"/mng-0095\");\n\n Verifier verifier = newVerifier(testDir.getAbsolutePath());\n verifier.setAutoclean(false);\n verifier.deleteDirectory(\"target\");\n verifier.deleteDirectory(\"subproject1/target\");\n verifier.deleteDirectory(\"subproject2/target\");\n verifier.deleteDirectory(\"subproject3/target\");\n verifier.addCliArgument(\"--fail-never\");\n verifier.setLogFileName(\"log-fn-mt2.txt\");\n verifier.addCliArgument(\"-Dmaven.threads.experimental=2\");\n verifier.addCliArgument(\"org.apache.maven.its.plugins:maven-it-plugin-touch:touch\");\n verifier.execute();\n\n verifier.verifyFilePresent(\"target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject1/target/touch.txt\");\n verifier.verifyFilePresent(\"subproject2/target/touch.txt\");\n verifier.verifyFilePresent(\"subproject3/target/touch.txt\");\n }", "@Test\n public void testGetInstance() {\n System.out.println(\"getInstance test ---\");\n ChannelController expResult = ChannelController.getInstance();\n ChannelController result = ChannelController.getInstance();\n assertTrue(expResult == result);\n }", "abstract void setUp() throws Exception;", "@Override\n\t@Ignore\n\t@Test\n\tpublic void testLaunch() throws Throwable {\n\t}", "@Test\n public void testitFailFastSingleThread() throws Exception {\n File testDir = ResourceExtractor.simpleExtractResources(getClass(), \"/mng-0095\");\n\n Verifier verifier = newVerifier(testDir.getAbsolutePath());\n verifier.setAutoclean(false);\n verifier.deleteDirectory(\"target\");\n verifier.deleteDirectory(\"subproject1/target\");\n verifier.deleteDirectory(\"subproject2/target\");\n verifier.deleteDirectory(\"subproject3/target\");\n verifier.addCliArgument(\"--fail-fast\");\n verifier.setLogFileName(\"log-ff-mt1.txt\");\n verifier.addCliArgument(\"-Dmaven.threads.experimental=1\");\n\n try {\n verifier.addCliArgument(\"org.apache.maven.its.plugins:maven-it-plugin-touch:touch\");\n verifier.execute();\n verifier.verifyErrorFreeLog();\n } catch (VerificationException e) {\n // expected\n }\n\n verifier.verifyFilePresent(\"target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject1/target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject2/target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject3/target/touch.txt\");\n }", "@Test\n public void testDAM30103001() {\n // settings as done for testDAM30102001 are identical\n testDAM30102001();\n }", "@Test\n public void testProcessRetries() throws Exception {\n System.out.println(\"processRetries\");\n // has null pointer issues if run standalone without the listen\n instance.listen();\n instance.processRetries();\n }", "public void run() {\n RandomizedContext current = RandomizedContext.current();\n try {\n current.push(c.randomness);\n runSingleTest(notifier, c);\n } catch (Throwable t) {\n Rethrow.rethrow(augmentStackTrace(t)); \n } finally {\n current.pop();\n }\n }", "@Test public void singletonResolutionInFunctions() {\n fail( \"Not yet implemented\" );\n }", "@Test\n public void testServerApp() throws InterruptedException {\n\n }", "@Test\n public void testGetInstance() {\n System.out.println(\"getInstance\");\n ConnectionManager result = ConnectionManager.getInstance();\n assertNotNull(result);\n assertEquals(instance,result);\n }", "@Test\n public void testCheckin() throws Exception {\n }", "public static void main(String... a) throws Exception {\n TestBase test = TestBase.createCaller().init();\n test.config.lockTimeout = 120000;\n test.config.memory = true;\n test.test();\n }", "@BeforeClass\n\tpublic static void setUp() {\n\t\texecutor = new RESTManager(URL);\n\t}", "@Test\n public void testGetInstance() throws Exception {\n HealthRecordController copy1 = HealthRecordController.getInstance();\n assert(HealthRecordController.getInstance() != null);\n assert(copy1 == HealthRecordController.getInstance());\n }", "@Test\n public void testNextWaiting() {\n }", "@Test\r\n\tpublic void smokeTest() throws Exception {\r\n\t\tcheckSite();\r\n\t}", "@Test\n public void testSingleton() throws InterruptedException{\n Singleton[] results = new Singleton[threadNumber];\n\n for(int i=0; i<threadNumber; i++) {\n final int finalI = i;\n executor.execute(() -> {\n try {\n long threadId = Thread.currentThread().getId();\n logger.info(\"[Thread-\" + threadId + \"] is running\");\n results[finalI] = Singleton.getInstance();\n logger.info(\"[Thread-\" + threadId + \"] is finished\");\n }\n catch (Throwable t) {\n logger.error(t, t.getCause());\n }\n });\n }\n executor.shutdown();\n executor.awaitTermination(10, TimeUnit.SECONDS);\n\n long count = Arrays.stream(results).distinct().count();\n assertEquals(\"Instance number supposed to be only one, but you got \" + count, expectInstances, count);\n }", "@Test\n public void main() {\n run(\"TEST\");\n }", "@Before\n public void setUp() throws Exception {\n cut = new LightScheduler();\n// spyLedController = new SpyLedController();\n// fakeTimeService = new FakeTimeService();\n }", "@Test\n public void test() {\n\n testBookExample();\n // testK5();\n // testK3_3();\n }", "@Before\n\tpublic void setUp() throws Exception {\n\t\trand = new Random();\n\t\tlong seed = rand.nextLong();\n\t\tmockTG = mock(TrapGrid.class);\n\t\ttestSimRunner1 = new SimulationRunner(mockTG, numDays, numFlies, diffCoeff, \n\t\t\t\tstepSize, stepsPerDay, turnAngleStdev, useMDD, seed, 5);\n\t\tmockSim1 = mock(Simulation.class);\n\t\ttestSimRunner2 = spy(new SimulationRunner(mockTG, numDays, numFlies, diffCoeff, \n\t\t\t\tstepSize, stepsPerDay, turnAngleStdev, useMDD, seed, 2));\n\t\tdoReturn(mockSim1)\n\t\t\t.when(testSimRunner2)\n\t\t\t.createSimulation( any( TrapGrid.class), any ( Outbreak.class));\n\t\tSimulationResultsHolder mockSimResults = mock(SimulationResultsHolder.class);\n\t\tdoReturn(mockSimResults)\n\t\t\t.when(mockSim1)\n\t\t\t.runSimulation();\n\t\tString outbreakFile = \"foo.outbreak\";\n\t\ttestSimRunner3 = new SimulationRunner(mockTG, outbreakFile, numDays, numFlies, diffCoeff, \n\t\t\t\tstepSize, stepsPerDay, turnAngleStdev, useMDD, seed);\n\t}", "@Test\r\n\tpublic void client2() {\n\t}", "@Before\n\tpublic void setUp() throws Exception {\n\t\truntimeConfig = ConfigLoader.load(\n\t\t\t\tnew File(resourcesDir,\n\t\t\t\t\t\t\"benchmark_config_with_ls_specific_settings.conf\").getAbsolutePath());\n\t\t\n\t\tscenario = new Scenario(\"animals\", \"mammal\");\n\t\t\n\t\ttmpDir = Files.createTempDir();\n\t\ttmpDir.mkdirs();\n\t\t\n\t\tfileFinder = new FileFinder(new File(\".\").getAbsolutePath(), scenario);\n\t\t// arbitrarily set to tmpDir\n\t\tfileFinder = fileFinder.updateWorkDir(tmpDir);\n\t\t\n\t\texamples = new PosNegExamples();\n\t\texamples.put(Constants.ExType.POS, Sets.newHashSet(\"one\", \"two\", \"three\"));\n\t\texamples.put(Constants.ExType.NEG, Sets.newHashSet(\"four\", \"five\", \"six\", \"seven\"));\n\t\tlog = new BenchmarkLog();\n\t}", "public void setUp() {\n instance = new Task();\n }", "@Test\n public void testImprimeFactura() throws Exception {\n \n }", "@BeforeClass\n public static void setup() {\n stall_till_cloudsize(1);\n }", "@Test\n public void sustainMassiveDamage() {\n }", "@Test\r\n\tpublic void client() {\n\t}", "@Test\n\tpublic void getWorksTest() throws Exception {\n\t}", "private void runSingleTest(final RunNotifier notifier, final TestCandidate c) {\n notifier.fireTestStarted(c.description);\n \n if (isIgnored(c)) {\n notifier.fireTestIgnored(c.description);\n return;\n }\n \n Set<Thread> beforeTestSnapshot = threadsSnapshot();\n Object instance = null;\n try {\n // Get the test instance.\n if (c.instance instanceof DeferredInstantiationException) {\n throw ((DeferredInstantiationException) c.instance).getCause();\n } else {\n instance = c.instance;\n }\n \n // Run @Before hooks.\n for (Method m : getTargetMethods(Before.class))\n invoke(m, instance);\n \n // Collect rules and execute wrapped method.\n runWithRules(c, instance);\n } catch (Throwable e) {\n boolean isKilled = runnerThreadGroup.isKilled(Thread.currentThread());\n \n // Check if it's the runner trying to kill the thread. If so,\n // there is no point in reporting such an exception back. Also,\n // if the thread's been killed, we will not run any hooks (this is\n // pretty much a situation in which the world ends).\n if (isKilled && (e instanceof ThreadDeath)) {\n // TODO: System.exit() wouldn't run any post-cleanup on hooks. A better\n // way to resolve this would be to mark a global condition to ignore\n // all the remaining tests (fail with an assumption exception saying\n // there's a boogieman around or something).\n return;\n }\n \n // Augment stack trace and inject a fake stack entry with seed information.\n if (!isKilled) {\n e = augmentStackTrace(e);\n if (e instanceof AssumptionViolatedException) {\n notifier.fireTestAssumptionFailed(new Failure(c.description, e));\n } else {\n notifier.fireTestFailure(new Failure(c.description, e));\n }\n }\n }\n \n // Run @After hooks if an instance has been created.\n if (instance != null) {\n for (Method m : getTargetMethods(After.class)) {\n try {\n invoke(m, instance);\n } catch (Throwable t) {\n t = augmentStackTrace(t);\n notifier.fireTestFailure(new Failure(c.description, t));\n }\n }\n }\n \n // Dispose of resources at test scope.\n RandomizedContext.current().closeResources(\n new ResourceDisposal(notifier, c.description), LifecycleScope.TEST);\n \n // Check for run-away threads at the test level.\n ThreadLeaks tl = onElement(ThreadLeaks.class, defaultThreadLeaks, c.method, suiteClass);\n checkLeftOverThreads(notifier, LifecycleScope.TEST, tl, c.description, beforeTestSnapshot);\n \n // Process uncaught exceptions, if any.\n runnerThreadGroup.processUncaught(notifier, c.description);\n }", "@Test\n\tpublic void testInheritance() throws Exception {\n\t\ttestWith(TestClassSubClass.getInstance());\n\t}", "@Test\n public void testGetInstance()\n {\n System.out.println(\"TEST: getInstance\");\n TomTomReader result = TomTomReader.getInstance();\n assertNotEquals(null, result);\n }", "@Test\n public void request() throws Exception {\n\n\n }", "@Test\n public void accuseSuccesTest() throws Exception {\n }", "public void testSoThatTestsDoNotFail() {\n\n }", "private ProtomakEngineTestHelper() {\r\n\t}", "@Test\n public void test2() {\n }", "public static void start() {\n\t\t\n\t\ttestEmptyConstructors();\n\t\ttestConstructors();\n\n\t}", "@AfterClass\n public static void stop() {\n }", "@Test\r\n public void test1() {\n }", "@Before\n public void setUp() throws Exception {\n StoreDefinition.createAllTables(injector.getInstance(StructuredTableAdmin.class));\n cConf.setBoolean(Constants.Tethering.TETHERING_SERVER_ENABLED, true);\n cConf.setInt(Constants.Tethering.CONNECTION_TIMEOUT_SECONDS, 1);\n\n List<Permission> tetheringPermissions = Arrays.asList(InstancePermission.TETHER);\n InMemoryAccessController inMemoryAccessController = new InMemoryAccessController();\n inMemoryAccessController.grant(\n Authorizable.fromEntityId(InstanceId.SELF),\n MASTER_PRINCIPAL,\n Collections.unmodifiableSet(new HashSet<>(tetheringPermissions)));\n ContextAccessEnforcer contextAccessEnforcer =\n new DefaultContextAccessEnforcer(new AuthenticationTestContext(), inMemoryAccessController);\n AuthenticationTestContext.actAsPrincipal(MASTER_PRINCIPAL);\n\n service =\n new CommonNettyHttpServiceBuilder(\n CConfiguration.create(),\n getClass().getSimpleName(),\n new NoOpMetricsCollectionService())\n .setHttpHandlers(\n new TetheringServerHandler(\n cConf,\n tetheringStore,\n messagingService,\n contextAccessEnforcer,\n messagingProgramStatePublisher),\n new TetheringHandler(cConf, tetheringStore, messagingService, profileService))\n .build();\n service.start();\n config =\n ClientConfig.builder()\n .setConnectionConfig(\n ConnectionConfig.builder()\n .setHostname(service.getBindAddress().getHostName())\n .setPort(service.getBindAddress().getPort())\n .setSSLEnabled(false)\n .build())\n .build();\n }", "public static void run() {\n testAlgorithmOptimality();\n// BenchmarkGraphSets.testMapLoading();\n //testAgainstReferenceAlgorithm();\n //countTautPaths();\n// other();\n// testLOSScan();\n //testRPSScan();\n }", "@Test\n public void publicInstanceTest() {\n // TODO: test publicInstance\n }", "protected void setUp() throws Exception {\r\n super.setUp();\r\n this.testedInstances = new ManagerHelper[2];\r\n this.testedInstances[0] = new ManagerHelper();\r\n this.testedInstances[1] = new ManagerHelper(TestDataFactory.MANAGER_HELPER_NAMESPACE);\r\n }", "@Test\n public void testitFailAtEndSingleThread() throws Exception {\n File testDir = ResourceExtractor.simpleExtractResources(getClass(), \"/mng-0095\");\n\n Verifier verifier = newVerifier(testDir.getAbsolutePath());\n verifier.setAutoclean(false);\n verifier.deleteDirectory(\"target\");\n verifier.deleteDirectory(\"subproject1/target\");\n verifier.deleteDirectory(\"subproject2/target\");\n verifier.deleteDirectory(\"subproject3/target\");\n verifier.addCliArgument(\"--fail-at-end\");\n verifier.setLogFileName(\"log-fae-mt1.txt\");\n verifier.addCliArgument(\"-Dmaven.threads.experimental=1\");\n try {\n verifier.addCliArgument(\"org.apache.maven.its.plugins:maven-it-plugin-touch:touch\");\n verifier.execute();\n verifier.verifyErrorFreeLog();\n } catch (VerificationException e) {\n // expected\n }\n\n verifier.verifyFilePresent(\"target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject1/target/touch.txt\");\n verifier.verifyFilePresent(\"subproject2/target/touch.txt\");\n verifier.verifyFileNotPresent(\"subproject3/target/touch.txt\");\n }", "@Test\n public void shouldStartupIfGlobalShutdownEnabledAndReuseDisabledAndCloseOnFailEnabled() throws InvocationTargetException, IllegalAccessException {\n when(this.config.shutDownWebdriver()).thenReturn(true);\n when(this.config.reuseWebDriver()).thenReturn(false);\n when(this.config.closeVisualWebDriveronFail()).thenReturn(true);\n\n this.context.setFailed();\n\n boolean rtn = (Boolean)shouldStartupMethod.invoke(this.std, this.context);\n\n Assert.assertThat(\"shouldStartupIfGlobalShutdownEnabledAndReuseDisabledAndCloseOnFailEnabled\", rtn, is(true));\n\n\n }", "@Test\n public void testReuseforkstrue() throws Exception {\n String testName = \"reuseforkstrue\";\n EkstaziPaths.removeEkstaziDirectories(getClass(), testName);\n executeCleanTestStep(testName, 0, 1);\n }", "@Test \r\n\tpublic void testMultipleLogins() throws Exception {\r\n\t\tHttpClientHelper.setGlobalConnectionTimeout(DefaultHttpClientSingleton.getInstance(), 100000);\r\n\t\tHttpClientHelper.setGlobalSocketTimeout(DefaultHttpClientSingleton.getInstance(), 100000);\r\n\t\tcreateUsers();\r\n\t\tfor (int i : new int[]{35}) {\r\n//\t\tfor (int i : new int[]{1,2,3,4,5,6}) {\r\n\t\t\ttestMultipleLogins(i);\r\n\t\t}\r\n\t}", "@Test\n\tvoid test() {\n\t\t\n\t}", "protected void runBeforeTest() {}", "@Test\n public void test2(){\n }", "@Test\r\n public void testRentOut() {\r\n }", "protected void runAfterTest() {}", "@Test\n public void testBeer() {\n // TODO: test Beer\n }", "@org.junit.Test\n public void testRun() {\nSystem.out.println(\"run\");\n final TwitterFeedTask instance = new TwitterFeedTask();\n \n instance.run();\n }", "@Before\n public void setup() throws Exception {\n jenkins = mock(Jenkins.class);\n jenkinsMockedStatic = mockStatic(Jenkins.class);\n jenkinsMockedStatic.when(Jenkins::getInstanceOrNull).thenReturn(jenkins);\n\n mockGerritNotifierFactoryMockedStatic = mockStatic(GerritNotifierFactory.class);\n pluginMockedStatic = mockStatic(PluginImpl.class);\n mockNotificationFactory = mock(GerritNotifierFactory.class);\n plugin = mock(PluginImpl.class);\n mockNotifier = mock(GerritNotifier.class);\n server = mock(GerritServer.class);\n doReturn(mockNotifier).when(mockNotificationFactory)\n .createGerritNotifier(any(GerritCmdRunner.class), any(String.class));\n mockGerritNotifierFactoryMockedStatic.when(\n GerritNotifierFactory::getInstance).thenReturn(mockNotificationFactory);\n pluginMockedStatic.when(PluginImpl::getInstance).thenReturn(plugin);\n when(plugin.getServer(PluginImpl.DEFAULT_SERVER_NAME)).thenReturn(server);\n when(server.getName()).thenReturn(PluginImpl.DEFAULT_SERVER_NAME);\n }", "@BeforeClass(enabled = true)\n\tpublic void oneTimeSetup() {\n\t\ttry {\n\t\t\tFile resultsDirectory = new File(AppConstants.TEST_RESULTS_DIRECTORY);\n\t\t\tif (!resultsDirectory.isDirectory()) {\n\t\t\t\tFileUtils.forceMkdir(resultsDirectory);\n\t\t\t} else {\n\t\t\t\tFileUtils.cleanDirectory(resultsDirectory);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\tLOG.debug(\"Error cleaning the results directory\");\n\t\t}\n\t}", "@Before\n public void setUp() throws Exception {\n\n }", "protected void setUp() throws Exception {\r\n super.setUp();\r\n StressTestHelper.clearConfig();\r\n StressTestHelper.loadConfig(\"stress.xml\");\r\n StressTestHelper.loadConfig(\"com.topcoder.util.log\", \"logging.xml\");\r\n services = new DefaultUploadExternalServices();\r\n\r\n ManagersProvider managersProvider = (ManagersProvider) TestHelper.getFieldValue(TestHelper.getFieldValue(services,\r\n \"uploadServices\"), \"managersProvider\");\r\n uploadManager = (MockUploadManager) managersProvider.getUploadManager();\r\n screeningManager = (MockScreeningManager) managersProvider.getScreeningManager();\r\n\r\n // create a big file\r\n File file = new File(\"test_files/stress.jar\");\r\n if (file.exists()) {\r\n file.delete();\r\n }\r\n file.createNewFile();\r\n BufferedWriter bw = new BufferedWriter(new FileWriter(file));\r\n for (int i = 0; i < 1000; i++) {\r\n for (int j = 0; j < 1000; j++) {\r\n bw.write(\"111111111111111111111111111111111111111111111\");\r\n }\r\n }\r\n bw.flush();\r\n bw.close();\r\n\r\n }", "public void selfTest() {\n \n \n \n /**\n * TESTING CONFIGURATION RIGHT HERE:\n */\n int total = 1; //How many tests should we run\n int start = 0; //The first test to run\n //TestStubs.storePrints(); //store prints until the end\n TestStubs.displayDebugWhileTesting(false); //shows all the debug prints (with context switches) if set to true\n \n \n //MemoryMap.selfTest();\n //Swap.selfTest();\n \n UserProcess.testing = true;\n TestStubs.debugPrint(\"SELF TESTING VMKERNEL!\");\n \n int passed = 0;\n \n for (int i = 0; i < total; i++) {\n if (runTest(i+start))\n passed += 1;\n }\n \n if (passed != total) {\n TestStubs.debugPrint(\"SOME TESTS FAILED! \" + passed + \"/\" + total + \" passed.\");\n } else {\n TestStubs.debugPrint(\"ALL TESTS PASSED! \" + passed + \"/\" + total + \" passed.\");\n }\n \n UserProcess.testing = false;\n \n\n \n //System.out.println(TestStubs.getStoredPrints());\n //TestStubs.clearAndDontStorePrints();\n \n if (passed != total) {\n System.out.flush();\n /// kernel.terminate();\n }\n \n TestStubs.disable();\n \n }", "@Test\n public void lowHealthWarningTest() {\n }", "@Test\n public void testPuery(){\n }", "@Test\n public void fightShredderTest() {\n }", "@Test(timeout = 4000)\n public void test1() throws Throwable {\n Hw1 hw1_0 = new Hw1();\n }", "@Test(timeout = 10000)\n public void testMultipleCallsReturnTheSameObjectInDifferentThreads() throws Exception {\n\n // Create 10000 tasks and inside each callable instantiate the singleton class\n final List<Callable<S>> tasks = new ArrayList<>();\n for (int i = 0; i < 10000; i++) {\n tasks.add(this.singletonInstanceMethod::get);\n }\n\n // Use up to 8 concurrent threads to handle the tasks\n final ExecutorService executorService = Executors.newFixedThreadPool(8);\n final List<Future<S>> results = executorService.invokeAll(tasks);\n\n // wait for all of the threads to complete\n final S expectedInstance = this.singletonInstanceMethod.get();\n for (Future<S> res : results) {\n final S instance = res.get();\n assertNotNull(instance);\n assertSame(expectedInstance, instance);\n }\n\n // tidy up the executor\n executorService.shutdown();\n\n }" ]
[ "0.70052075", "0.65446866", "0.65339977", "0.6490601", "0.6452612", "0.6420246", "0.6410375", "0.63956517", "0.63944995", "0.6342584", "0.6319801", "0.6314513", "0.63093275", "0.6293455", "0.6271117", "0.62561", "0.62531227", "0.62460876", "0.6233082", "0.6192173", "0.6186583", "0.61770105", "0.61767244", "0.61714137", "0.6171399", "0.61688185", "0.6166634", "0.61664075", "0.61664075", "0.6162508", "0.6159475", "0.6129619", "0.6118629", "0.6117273", "0.6100706", "0.6091766", "0.6073277", "0.60731494", "0.607", "0.6068869", "0.60542715", "0.60538524", "0.60485744", "0.6047552", "0.6040963", "0.6038551", "0.6031902", "0.6024985", "0.6014953", "0.6013434", "0.60056573", "0.6000811", "0.5999419", "0.59985507", "0.5993705", "0.5979388", "0.5978552", "0.5970019", "0.5963454", "0.5959505", "0.59591097", "0.5957238", "0.59569013", "0.59526604", "0.5949206", "0.5943981", "0.5942398", "0.5930923", "0.59207994", "0.5920577", "0.5913773", "0.59109676", "0.59089136", "0.59056306", "0.5901997", "0.5901931", "0.59011143", "0.5899945", "0.5894098", "0.5884044", "0.58821255", "0.58800685", "0.5871763", "0.58699286", "0.58687055", "0.5868104", "0.58680475", "0.58662575", "0.586603", "0.58564925", "0.5852025", "0.5851878", "0.5851508", "0.5850118", "0.58499503", "0.58492225", "0.5847743", "0.58467025", "0.5846398", "0.58450484", "0.5844082" ]
0.0
-1
/ / Unit tests
public void testSelfReferencesSimple() { TypeResolver typeResolver = new TypeResolver(); MemberResolver memberResolver = new MemberResolver(typeResolver); ResolvedType type = typeResolver.resolve(MyComparable.class); ResolvedMethod[] resolvedMethods = memberResolver.resolve(type, null, null).getMemberMethods(); assertEquals(1, resolvedMethods.length); assertEquals(Comparable.class, resolvedMethods[0].getReturnType().getErasedType()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\t\t\tpublic void test() {\n\t\t\t}", "@Test\r\n\tpublic void testSanity() {\n\t}", "private void test() {\n\n\t}", "public void testGetBasedata() {\n }", "@Test\n public void testWalkForPduTarget() throws Exception {\n//TODO: Test goes here... \n }", "@Test\n public void testAddACopy() {\n }", "@Test\n public void simpleUse(){\n }", "@Test\n\tpublic void testMain() {\n\t\t// TODO: test output streams for various IO methods, emulating a user's\n\t\t// input - kinda like Joel did for CSSE2310\n\t\tAssert.fail();\n\t}", "@Test\n\tpublic void testMain() {\n\t}", "public void testBidu(){\n\t}", "@Override\n public void runTest() {\n }", "@Test\r\n\tpublic void test() {\r\n\t}", "@Override\n\tpublic void test() {\n\t\t\n\t}", "@Test\r\n public void elCerdoNoSePuedeAtender() {\n }", "public void testCheckOxyEmpty() {\n }", "public void testSetBasedata() {\n }", "@Test\n public void testDAM30203001() {\n testDAM30102001();\n }", "@Test\r\n\tpublic void contents() throws Exception {\n\t}", "@Test\n public void main() {\n // App.main(null);\n // assertEquals(\"Hello world\", outContent.toString());\n }", "protected TestBench() {}", "@Test\n\tvoid test() {\n\t\t\n\t}", "private ProtomakEngineTestHelper() {\r\n\t}", "private test5() {\r\n\t\r\n\t}", "@Test\n\tpublic void test() {\n\t}", "@Test\n\tpublic void test() {\n\t}", "@org.junit.Test\r\n\tpublic void test() {\n\t\t\t\t\r\n\t}", "public void testAddEntry(){\n }", "public void test() {\n\t}", "@Override\n public void test() {\n \n }", "@Test\n public void testOncoKBInfo() {\n // TODO: test OncoKBInfo\n }", "public void testDummy() {\n }", "@Test\n\tvoid searchTest() {\n\t}", "static void testCaculator(){\n }", "@Test\n public void testingTheTwoPlane2016Order() {\n }", "public void testaReclamacao() {\n\t}", "@Test\n public void testDAM30402001() {\n testDAM30101001();\n }", "public void testDummy() {\n }", "public void testOperation();", "@Override\n public void setUp() {\n }", "@Before\n\t public void setUp() {\n\t }", "@Test\n public void sourceTest() {\n // TODO: test source\n }", "@Test\n public void sourceTest() {\n // TODO: test source\n }", "@Test\n\tpublic void testTotalPuzzleGenerated() {\n\t}", "@Test\n public void matchCorrect() {\n }", "@Test\n\tpublic void testNormalPuzzleGeneration() {\n\t}", "@Test\n public void testQuickMapList() {\n//TODO: Test goes here... \n }", "@Test\n\tpublic void test(){\n\t}", "public static void dummyTest(){}", "public static void dummyTest(){}", "@Test\r\n\tpublic void acreditar() {\r\n\t}", "@Test\n public void testDAM30601001() {\n testDAM30102001();\n }", "@Test\n public void testGetProductInfo() throws Exception {\n }", "@Test\n public void searchesTest() {\n // TODO: test searches\n }", "@Test\n\tpublic void testVersionCheck() throws Exception{\n\t}", "public void testDummy()\n {\n }", "public static void main(String[] args) {\n // PUT YOUR TEST CODE HERE\n }", "@Test\n public void shouldProcessData() throws Exception {\n }", "public void testGetInsDyn() {\n }", "@Override\r\n protected void setUp() {\r\n // nothing yet\r\n }", "@Override\r\n\tpublic void setUp() {\n\t\t\r\n\t}", "public StrandUnitTest()\n {\n }", "@Test\n public void Tester_UI_when_find_contact_not_added() throws Exception{System.out.println(\"TODO\") ;}", "@Test\n\tpublic void testEvilPuzzleGeneration() {\n\t}", "@Test\n public void request() throws Exception {\n\n\n }", "@Test\n public void testAdd() {\n }", "@Test\n public void testAdd() {\n }", "@Test\n public void testCarregarUex() {\n }", "@Test\n public void testDAM30903001() {\n testDAM30802001();\n }", "@Test\r\n\tpublic void client() {\n\t}", "public void testGitHub() {\n\t}", "@Override\n @Before\n public void setUp() throws IOException {\n }", "@Test\n public void testLunce() throws IOException {\n }", "@Test\n public void accuseSuccesTest() throws Exception {\n }", "@Override\n\tpublic void testEngine() {\n\t\t\n\t}", "@Override\r\n\tpublic void setUp() {\n\r\n\t}", "public void testWriteOrders() throws Exception {\n }", "@Test\npublic void testCal() throws Exception {\n\tsearchText();\n}", "@Test public void testNode() {\n \n }", "@Override\n public void setUp() throws Exception {}", "public void setUp() {\n\n\t}", "@Test\r\n public void testAddition() {\n }", "@Test\n void loadData() {\n }", "@Test\n public void testQueryList(){\n }", "@Test\r\n public void testRentOut() {\r\n }", "@Test\n public void testGetAnalyzedData() {\n System.out.println(\"getAnalyzedData\");\n \n }", "@Test\n public void testGetAuthor() {\n }", "@Before\n\tpublic void setUp() {\n\t}", "@Test\n public void _objectTest() {\n // TODO: test _object\n }", "@Test\n public void testProgramElementsType() {\n // TODO: test ProgramElementsType\n }", "@Test\n public void testCreate() {\n\n }", "@Test\n public void getIndex(){\n\n }", "@Test\r\n public void testFindAll() throws Exception {\r\n }", "public void testAltaVehiculo(){\r\n\t}", "public void testDumbJUnit() {\n }", "public void testGetURI() {\n }", "@Test\n void list() {\n }", "@Test\n public void testCarregarTrimestre() {\n }", "@Test\n\tpublic void testHardPuzzleGeneration() {\n\t}", "@Test\n public void testQuery(){\n }", "public void testFindByCatalogo() {\n }", "@Test\n\tpublic void something() {\n\t}" ]
[ "0.7355159", "0.7325804", "0.716326", "0.69676787", "0.6856734", "0.68330264", "0.67875546", "0.67856336", "0.6780918", "0.67565066", "0.67538905", "0.6710163", "0.66945297", "0.6680416", "0.66691494", "0.66664547", "0.66647923", "0.66565835", "0.6650082", "0.66489613", "0.66392016", "0.6637638", "0.6634353", "0.66296554", "0.66296554", "0.66188693", "0.66147065", "0.6611264", "0.66079164", "0.6603872", "0.6590251", "0.65866834", "0.6578233", "0.65604717", "0.65600944", "0.6554555", "0.65510577", "0.65341663", "0.6531199", "0.65253556", "0.6524919", "0.6524919", "0.65207314", "0.6518796", "0.65177673", "0.65139747", "0.650652", "0.64941365", "0.64941365", "0.649107", "0.64890474", "0.64876944", "0.6486095", "0.64823896", "0.64715546", "0.64651084", "0.6463402", "0.6462393", "0.6452331", "0.64400667", "0.6434883", "0.64235115", "0.64175415", "0.6412548", "0.6396781", "0.6396781", "0.6396693", "0.6394189", "0.6392016", "0.6390128", "0.63894874", "0.63887435", "0.6387448", "0.63833064", "0.6380141", "0.637266", "0.6372036", "0.6367936", "0.6363229", "0.6361259", "0.63603824", "0.63602173", "0.63540155", "0.63505954", "0.6344174", "0.63433415", "0.6342847", "0.6342429", "0.6341299", "0.6339663", "0.6339494", "0.6332568", "0.6330235", "0.63281393", "0.6317413", "0.63173556", "0.6315206", "0.63093865", "0.63044035", "0.63001347", "0.6295035" ]
0.0
-1
do nothing here since we had to write the status before the stream was written
@Override public void onNext(Void aVoid) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void sendStatus() throws IOException {\n\t\tWriteStatus status = new WriteStatus.Builder().build();\n\t\tstatus.writeTo(out);\n\t\tout.flush();\n\t}", "@Override\n protected void writeStreamHeader() throws IOException {\n reset();\n }", "@Override\n public void flush() throws IOException {\n checkStreamState();\n flushIOBuffers();\n }", "static void send(OutputStream out, int status) throws IOException {\n\t\tsend(out, status, new Headers(), List.of(), null, 0, null);\n\t}", "@Override\r\n\tpublic int write() throws Exception {\n\t\treturn 0;\r\n\t}", "private void clearStatuses () {\n\tstatus = \"Reading request\";\n\tstarted = System.currentTimeMillis ();\n\trequest = null;\n\tkeepalive = true;\n\tmeta = false;\n\tchunk = true;\n\tmayUseCache = true;\n\tmayCache = true;\n\tmayFilter = true;\n\tmustRevalidate = false;\n\taddedINM = false;\n\taddedIMS = false;\n\tuserName = null;\n\tpassword = null;\n\trequestLine = \"?\";\n\tstatusCode = \"200\";\n\textraInfo = null;\n\tcontentLength = \"-\";\n\tclientResourceHandler = null;\n }", "public void flush(){\n\t\ttry{\n\t\t\tse.write(buffer, 0, bufferPos);\n\t\t\tbufferPos = 0;\n\t\t\tse.flush();\n\t\t}catch(IOException ioex){\n\t\t\tfailures = true;\n\t\t}\n\t}", "@Override\n protected void writeStreamHeader() throws IOException {\n // metodo honek ez du ezer egiten\n }", "@Override\n public boolean isCommitted() {\n return false;\n }", "@Override\n public Status getStatus() throws IOException;", "private static DownloadStatus statusOn(OutputStream target, DownloadStatus status, FileReader reader) {\n \t\tif (reader != null) {\n \t\t\tFileInfo fi = reader.getLastFileInfo();\n \t\t\tif (fi != null) {\n \t\t\t\tstatus.setFileSize(fi.getSize());\n \t\t\t\tstatus.setLastModified(fi.getLastModified());\n \t\t\t\tstatus.setTransferRate(fi.getAverageSpeed());\n \t\t\t}\n \t\t}\n \t\tif (target instanceof IStateful)\n \t\t\t((IStateful) target).setStatus(status);\n \t\treturn status;\n \t}", "public void writeLeft(PrintWriter out, RequestProperties reqState) \n throws IOException\n {\n // ignore\n }", "private void getStatus() {\n\t\t\n\t}", "@Override\n\t\tprotected void writeStreamHeader() throws IOException {\n\t\t}", "private void setStatus(com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n status_ = value;\n }", "private void flushWrite() throws IOException, BadDescriptorException {\n if (reading || !modes.isWritable() || buffer.position() == 0) return; // Don't bother\n \n int len = buffer.position();\n buffer.flip();\n int n = descriptor.write(buffer);\n \n if(n != len) {\n // TODO: check the return value here\n }\n buffer.clear();\n }", "@Override\n\tpublic synchronized boolean writeHeader() {\n\t\tif(!trailerWritten) \n\t\t{\n\t\t\tlong startTime = System.currentTimeMillis();\n\t\t\tsuper.writeHeader();\n\t\t\tlong diff = System.currentTimeMillis() - startTime;\n\t\t\tlogger.info(\"write header takes {} for rtmp:{}\", diff, getOutputURL());\n\t\t\t\n\t\t\theaderWritten = true;\n\t\t\tsetStatus(IAntMediaStreamHandler.BROADCAST_STATUS_BROADCASTING);\n\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\tlogger.warn(\"Trying to write header after writing trailer\");\n\t\t\treturn false;\n\t\t}\n\t}", "@Override\r\n public void flush ()\r\n {\r\n }", "@Override\n\t\tpublic void setStatus(int status) {\n\t\t\t\n\t\t}", "@Override\r\n\tpublic void write() {\n\t\t\r\n\t}", "@Override\n public void onRead() {\n /*\n * It should be an error that the remote send something before we\n * pre-write.\n */\n throw new IllegalStateException();\n }", "@Override\r\n\t\t\tpublic void progressMade() {\n\t\t\t\twriteReadSemaphore.refreshWriteLock(lockKey, finalWriteToken, lockTimeoutSec);\r\n\t\t\t}", "@Override\n public void flush() throws IOException {\n byteBufferStreamOutput.flush();\n }", "@Override\n\t\tpublic void flush() throws IOException {\n\t\t\twriteBlock(true);\n\t\t\tout.flush();\n\n\t\t\t// it's a bit nasty if an exception is thrown from the log,\n\t\t\t// but ignoring it can be nasty as well, so it is decided to\n\t\t\t// let it go so there is feedback about something going wrong\n\t\t\t// it's a bit nasty if an exception is thrown from the log,\n\t\t\t// but ignoring it can be nasty as well, so it is decided to\n\t\t\t// let it go so there is feedback about something going wrong\n\t\t\tif (debug) {\n\t\t\t\tlog.flush();\n\t\t\t}\n\t\t}", "@Override\n public void flush() throws IOException {\n }", "@Override\n public void flush() {\n }", "@Override\n public void flush() {\n }", "@Override\n public void flush() {\n }", "public void writeDeviceLost(boolean status)\n\t{\n\t\tString writeStatement = (User + \", \" +\n\t\t\t\t\t\t\t UserPassword + \", \" +\n\t\t\t\t\t\t\t Device_ID + \", \");\n\t\t\n\t\t//System.out.println(\"\\nWRITE Statement: \" + writeStatement);\n\t\twriteStatement += (status) ? (1) : (0);\n\t\t// System.out.println(\"\\nWRITE Statement: \" + writeStatement);\n\n\t\t//Write Area Below Start\n\t\ttry {\n\t\t\t\n\t\t\t//THIS WORKS DONT TOUCH IT. or at least save copies.\n\t\t\tFile fileToBeModified = new File(filename);\n\t \n\t String oldContent = \"\";\n\t \n\t BufferedReader reader = null;\n\t \n\t FileWriter writer = null;\n\t \n reader = new BufferedReader(new FileReader(fileToBeModified));\n \n String line = reader.readLine();\n \n while (line != null) \n {\n oldContent = oldContent + line + System.lineSeparator();\n \n line = reader.readLine();\n }\n \n //Replacing oldString with newString in the oldContent\n \n String newContent = oldContent.replaceAll(user_line, writeStatement);\n \n //Rewriting the input text file with newContent\n \n writer = new FileWriter(fileToBeModified);\n \n writer.write(newContent);\n reader.close();\n \n writer.close();\n \n } catch (IOException e) \n\t\t{\n e.printStackTrace();\n }\n\t}", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "public void setStatus(Byte status) {\r\n this.status = status;\r\n }", "@Override\n public final boolean isStreaming() {\n return false;\n }", "@Override\npublic int writingBenches() {\n\treturn 200;\n}", "@SuppressWarnings(\"GuardedByChecker\")\n private void sendFlushDataLocked() {\n assert mWriteState == State.WAITING_FOR_FLUSH;\n int size = mFlushData.size();\n ByteBuffer[] buffers = new ByteBuffer[size];\n int[] positions = new int[size];\n int[] limits = new int[size];\n for (int i = 0; i < size; i++) {\n ByteBuffer buffer = mFlushData.poll();\n buffers[i] = buffer;\n positions[i] = buffer.position();\n limits[i] = buffer.limit();\n }\n assert mFlushData.isEmpty();\n assert buffers.length >= 1;\n mWriteState = State.WRITING;\n mRequestHeadersSent = true;\n if (!CronetBidirectionalStreamJni.get().writevData(mNativeStream,\n CronetBidirectionalStream.this, buffers, positions, limits,\n mEndOfStreamWritten && mPendingData.isEmpty())) {\n // Still waiting on flush. This is just to have consistent\n // behavior with the other error cases.\n mWriteState = State.WAITING_FOR_FLUSH;\n throw new IllegalArgumentException(\"Unable to call native writev.\");\n }\n }", "public void testFlush_NoOutputStream() {\n StreamHandler h = new StreamHandler();\n h.flush();\n }", "public void flush() throws Exception{\r\n\tout.flush();\r\n}", "@Override\n public void write() {\n\n }", "@Override\n\tpublic void flush() {\n\t\t\n\t}", "@Override\n\tpublic void flush() {\n\t\t\n\t}", "@Override\n\tpublic void flush() {\n\t\t\n\t}", "@Override\n\tpublic void flush() {\n\t\t\n\t}", "public void setStatus(Byte status) {\r\n\t\tthis.status = status;\r\n\t}", "@Override\n\tpublic boolean isCommitted() {\n\t\treturn false;\n\t}", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "public void setStatus(Byte status) {\n this.status = status;\n }", "@Override\n public void update(ActorRef actor, Status status) {\n try (Writer w = Files.newBufferedWriter(progressPath, Charset.defaultCharset(), StandardOpenOption.APPEND);\n ProgressWriter log = new ProgressWriter(w)) {\n log.write(actor, status);\n } catch (IOException e) {\n DebugUIFactory.log.error(\"IOError on appending to progress file\", e);\n }\n }", "@Override\n\tpublic void setStatus(int status);", "@Override\n protected boolean continueOnWriteError() {\n return true;\n }", "public void flush() {\n wasFlushed = true;\n }", "public synchronized void setStatus(Status stat) {\n if (!isMutable()) {\n throw new IllegalStateException(\n \"This TestResult is no longer mutable!\");\n }\n\n if (stat == null) {\n throw new IllegalArgumentException(\n \"TestResult status cannot be set to null!\");\n }\n\n // close out message section\n sections[0].setStatus(null);\n\n execStatus = stat;\n\n if (execStatus == inProgress) {\n execStatus = interrupted;\n }\n\n // verify integrity of status in all sections\n for (Section section : sections) {\n if (section.isMutable()) {\n section.setStatus(incomplete);\n }\n }\n\n props = PropertyArray.put(props, SECTIONS,\n StringArray.join(getSectionTitles()));\n props = PropertyArray.put(props, EXEC_STATUS,\n execStatus.toString());\n\n // end time now required\n // mainly for writing in the TRC for the Last Run Filter\n if (PropertyArray.get(props, END) == null) {\n props = PropertyArray.put(props, END, formatDate(new Date()));\n }\n\n // this object is now immutable\n notifyCompleted();\n }", "@Override\r\n public synchronized void flush() throws IOException {\r\n\t\tif ( count != 0 ) {\r\n\t\t writeBuffer(buf, 0, count );\r\n\t\t count = 0;\r\n\t\t}\r\n\t}", "@Override\n public void flushBuffer() throws IOException {\n\n }", "public void setStatus(byte[] status) {\r\n this.status = status;\r\n }", "public int flush()\n/* */ {\n/* 145 */ return 0;\n/* */ }", "@Override\n\tpublic void getStatus() {\n\t\t\n\t}", "public void setStatus(boolean stat) {\n\t\tstatus = stat;\n\t}", "public abstract void resetBytesWritten();", "protected void finish() {\n writerServerTimingHeader();\n\n try {\n\n // maybe nobody ever call getOutputStream() or getWriter()\n if (bufferedOutputStream != null) {\n\n // make sure the writer flushes everything to the underlying output stream\n if (bufferedWriter != null) {\n bufferedWriter.flush();\n }\n\n // send the buffered response to the client\n bufferedOutputStream.writeBufferTo(getResponse().getOutputStream());\n\n }\n\n } catch (IOException e) {\n throw new IllegalStateException(\"Could not flush response buffer\", e);\n }\n\n }", "@Override\n\t\tpublic int getStatus() {\n\t\t\treturn 0;\n\t\t}", "@Override\r\n\tpublic void flush() {\n\t\t\r\n\t}", "public void setStatus(Byte status) {\n\t\tthis.status = status;\n\t}", "public void setStatus(Byte status) {\n\t\tthis.status = status;\n\t}", "protected boolean continueOnWriteError() {\n/* 348 */ return true;\n/* */ }", "private void doWrite() throws IOException {\n\t\t\tbb.flip();\n\t\t\tsc.write(bb);\n\t\t\tbb.compact();\n\n\t\t\tupdateInterestOps();\n\t\t}", "private void produceOutputWire(final NHttpClientEventHandler handler) {\n if (getContext() == null) {\n return;\n }\n SynapseWireLogHolder logHolder = null;\n if (getContext().getAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY) != null) {\n logHolder = (SynapseWireLogHolder) getContext().getAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY);\n } else {\n logHolder = new SynapseWireLogHolder();\n }\n synchronized (logHolder) {\n logHolder.setPhase(SynapseWireLogHolder.PHASE.TARGET_REQUEST_READY);\n getContext().setAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY, logHolder);\n try {\n if (this.status == ACTIVE) {\n if (this.contentEncoder == null) {\n handler.requestReady(this);\n }\n if (this.contentEncoder != null) {\n handler.outputReady(this, this.contentEncoder);\n if (this.contentEncoder.isCompleted()) {\n resetOutput();\n }\n }\n }\n if (this.outbuf.hasData()) {\n final int bytesWritten = this.outbuf.flush(this.session.channel());\n if (bytesWritten > 0) {\n this.outTransportMetrics.incrementBytesTransferred(bytesWritten);\n }\n }\n if (!this.outbuf.hasData()) {\n if (this.status == CLOSING) {\n this.session.close();\n this.status = CLOSED;\n resetOutput();\n }\n if (this.contentEncoder == null && this.status != CLOSED) {\n //This is the place where it ends wrting the back end request to the wire\n if (getContext().getAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY) != null) {\n logHolder = (SynapseWireLogHolder) getContext().getAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY);\n logHolder.setPhase(SynapseWireLogHolder.PHASE.TARGET_REQUEST_DONE);\n getContext().setAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY, logHolder);\n }\n this.session.clearEvent(EventMask.WRITE);\n }\n }\n } catch (final Exception ex) {\n handler.exception(this, ex);\n } finally {\n if (getContext().getAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY) != null) {\n logHolder = (SynapseWireLogHolder) getContext().getAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY);\n logHolder.setPhase(SynapseWireLogHolder.PHASE.TARGET_REQUEST_DONE);\n getContext().setAttribute(SynapseDebugInfoHolder.SYNAPSE_WIRE_LOG_HOLDER_PROPERTY, logHolder);\n }\n // Finally set the buffered output flag\n this.hasBufferedOutput = this.outbuf.hasData();\n }\n }\n }", "@Override\r\n\t\t\tpublic void progressMade() {\n\t\t\t\twriteReadSemaphore.refreshReadLock(lockKey, readToken, lockTimeoutSec);\r\n\t\t\t}", "@Override\n public void flush()\n {\n }", "public void status(boolean b) {\n status = b;\n }", "@Override\r\n\tpublic void flush() {\n\t}", "@Override\n public void onWrite() {\n onChannelPreWrite();\n }", "public void postStatusAsByte(byte[] status) throws SAPIException{\t\t\t\t\r\n\t\t\tstatusMap.PutDataAsInt8(statusMap.GetIndex(\"Status\"), status);\r\n\t\t\tlocal_src.Flush(statusMap); \t\r\n\t\t}", "@Override\n\tpublic void flush() {\n\t}", "@Override\n\tpublic void flushBuffer() throws IOException {\n\t}", "@Override\n\tpublic boolean status() {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean status() {\n\t\treturn false;\n\t}", "public void setStatus(String stat)\n {\n status = stat;\n }", "@Override\n public synchronized void flushBin(Empty request, StreamObserver<OperationStatusResponse> responseObserver) {\n bin.flush();\n notifyObservers();\n responseObserver.onNext(OperationStatusResponse.newBuilder()\n .setResult(OperationStatusResponse.OperationStatus.SUCCESS).build());\n responseObserver.onCompleted();\n }", "public void onStatus(Status status) {\n \t\t\t\t_receivedStatus++;\n \t\t\t\tif(!_statusQueue.offer(status)){\n \t\t\t\t\t_lostStatus++; \n \t\t\t\t}\t\t\t\n \t\t\t}", "public boolean checkpoint() {\n\t\ttry {\n\t\t\toutputStream.flush();\n\t\t} catch (IOException e) {\n\t\t\tif (RTS_COMMON.Option.VERBOSE)\n\t\t\t\te.printStackTrace();\n\t\t\treturn (false);\n\t\t}\n\t\treturn (true);\n\t}", "@Override\n public void progress(FileStatus status) {\n progressReporter.progress();\n }", "public void switchStatus() {\n if (ioStatus.get() == EdgeStatus.INPUT) {\n ioStatus.set(EdgeStatus.OUTPUT);\n } else {\n ioStatus.set(EdgeStatus.INPUT);\n }\n }", "private void updateUnitStatus() {\r\n\t\tint b1 = Sense_NotReady;\r\n\t\tif (this.tapeIo != null) {\r\n\t\t\tb1 = Sense_Ready;\r\n\t\t\tb1 |= (this.currentBlock == this.headLimit) ? Sense_AtLoadPoint : 0;\r\n\t\t\tb1 |= (this.isReadonly) ? Sense_FileProtected : 0;\r\n\t\t}\r\n\t\tthis.senseBytes[1] = (byte)((b1 >> 16) & 0xFF);\r\n\t\t\r\n\t\tint b4 = (this.currentBlock == this.tailLimit) ? Sense_EndOfTape : 0;\r\n\t\tthis.senseBytes[4] = (byte)( ((b4 >> 8) & 0xF0) | (this.senseBytes[4] & 0x0F) );\r\n\t}", "private void maybeOnSucceededOnExecutor() {\n synchronized (mNativeStreamLock) {\n if (isDoneLocked()) {\n return;\n }\n if (!(mWriteState == State.WRITING_DONE && mReadState == State.READING_DONE)) {\n return;\n }\n mReadState = mWriteState = State.SUCCESS;\n // Destroy native stream first, so UrlRequestContext could be shut\n // down from the listener.\n destroyNativeStreamLocked(false);\n }\n try {\n mCallback.onSucceeded(CronetBidirectionalStream.this, mResponseInfo);\n } catch (Exception e) {\n Log.e(CronetUrlRequestContext.LOG_TAG, \"Exception in onSucceeded method\", e);\n }\n mInflightDoneCallbackCount.decrement();\n }", "@Override public void onStatus(Status status) {\n\t\t\tif (Calendar.getInstance().getTime().before( shutdownTime.getTime() )) {\r\n\t\t\t\ttweets.add(status);\t\t\t\t\r\n\t\t\t} else {\r\n\t\t\t\tLOGGER.log(Level.FINE, \"Shutting down Twitter stream..\");\r\n\t\t\t\tclearLists();\r\n\t\t\t\tshutdown = true;\r\n\t\t\t\ttwitterStream.shutdown();\r\n\t\t\t}\r\n\t\t}", "@Override public void onStatus(Status status) {\n\t\t\tif (Calendar.getInstance().getTime().before( shutdownTime.getTime() )) {\r\n\t\t\t\ttweets.add(status);\t\t\r\n\t\t\t} else {\r\n\t\t\t\tLOGGER.log(Level.FINE, \"Shutting down Twitter stream..\");\r\n\t\t\t\tclearLists();\r\n\t\t\t\tshutdown = true;\r\n\t\t\t\ttwitterStream.shutdown();\r\n\t\t\t}\r\n\t\t}" ]
[ "0.7138123", "0.6347387", "0.6347217", "0.62185246", "0.60643315", "0.6011556", "0.600249", "0.5998157", "0.59826225", "0.5918651", "0.59173", "0.5907595", "0.5906705", "0.58704525", "0.58496433", "0.5841215", "0.58184075", "0.58145374", "0.5805453", "0.5802931", "0.5797117", "0.57823044", "0.5780464", "0.57710415", "0.57703793", "0.5728259", "0.5728259", "0.5728259", "0.57260334", "0.57230264", "0.57230264", "0.57230264", "0.57230264", "0.57230264", "0.57230264", "0.57230264", "0.57177126", "0.57082933", "0.57067704", "0.57052255", "0.5697125", "0.5694466", "0.568467", "0.568467", "0.568467", "0.568467", "0.56807804", "0.5678431", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5675382", "0.5673276", "0.56716865", "0.56676126", "0.56659514", "0.56659114", "0.5663432", "0.56613445", "0.5660577", "0.56551325", "0.56542575", "0.5652703", "0.56441975", "0.5638927", "0.5635209", "0.56300426", "0.5628766", "0.5628766", "0.5616182", "0.5616098", "0.5602446", "0.56016886", "0.56013423", "0.5597596", "0.5585882", "0.55730855", "0.55662304", "0.5560412", "0.5560184", "0.55527407", "0.55527407", "0.5547228", "0.5545012", "0.5541852", "0.55337477", "0.5529471", "0.55262357", "0.5516636", "0.55148196", "0.55141765", "0.55131596" ]
0.0
-1
Suma un plus al salario del empleado si el empleado tiene una comision menor que 50
public boolean plus (double sueldoPlus) { boolean aumento = false; if (comision<50) { salario= salario + sueldoPlus; aumento = true; } return aumento; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public double calculaSalario() \n {\n double resultado = valor_base - ((acumulado * 0.05) * valor_base);\n resultado += auxilioProcriacao();\n //vale-coxinha\n resultado += 42;\n return resultado;\n }", "public void sumaPuntos() {\r\n int rojo = 0;\r\n int azul = 0;\r\n for (int i = 1; i < 10; i++) {\r\n\r\n if (tablero[1][i].getTipo().equals(\"Rojo\")) {\r\n rojo += tablero[1][i].getValor();\r\n }\r\n\r\n if (tablero[8][i].getTipo().equals(\"Azul\")) {\r\n azul += tablero[8][i].getValor();\r\n }\r\n\r\n }\r\n if (rojo > azul) {\r\n this.setResultado(\"Rojo\");\r\n this.agregarVictoria(jugadorRojo);\r\n }\r\n if (azul > rojo) {\r\n this.setResultado(\"Azul\");\r\n this.agregarVictoria(jugadorAzul);\r\n }\r\n \r\n this.setReplay(true);\r\n }", "public void calcularSalario(){\n // 1% do lucro mensal\n double percentagemLucro = 0.01 * lucroMensal;\n // valor fixo igual ao dobro do dos empregados sem especialização, acrescido\n //de um prémio que corresponde a 1% do lucro mensal nas lojas da região.\n setSalario(1600 + percentagemLucro);\n\n }", "public static Double obtenerPromedioDeLosSalariosDeTodosLosEmpleados( )\r\n\t{\r\n\t\tDouble promedio = 0.0 ;\r\n\t\tfor(Empleado empleado : listaDeEmpleados)\r\n\t\t{\r\n\t\t\tpromedio = promedio + empleado.getSalario();\r\n\t\t}\r\n\t\treturn promedio / listaDeEmpleados.size();\r\n\t}", "public static void sueldoTotal(int hora, int sueldo){\n int resultado = 0;\r\n if(hora<=40){\r\n resultado = hora*sueldo;\r\n }\r\n if(hora>40 || hora<48){\r\n resultado = (40*sueldo)+(hora-40)*(sueldo*2);\r\n }\r\n if (hora>=48){\r\n resultado =(40*sueldo)+8*(sueldo*2)+(hora-48)*(sueldo*3);\r\n }\r\n System.out.println(\"El sueldo es de \"+ resultado);//Se muestra el sueldo total\r\n \r\n \r\n \r\n }", "public double calcularIncremento(){\n double incremento=0.0;\n \n if (this.edad>=18&&this.edad<50){\n incremento=this.salario*0.05;\n }\n if (this.edad>=50&&this.edad<60){\n incremento=this.salario*0.10;\n }\n if (this.edad>=60){\n incremento=this.salario*0.15;\n }\n return incremento;\n }", "@Override\n\tpublic double calcularSalario() {\n\n\t\tdouble salario = 0;\n\n\t\tdouble porcentajeAnios = calcularPorcentajePorAntiguedad();\n\t\tporcentajeAnios = this.sueldoBasico* (porcentajeAnios / 100);\n\t\tsalario = this.sueldoBasico + porcentajeAnios;\n\t\treturn salario;\n\t}", "double getTotalProfit();", "protected void incrementarSalario(){\n this.setSalario(getSalario() * 1.5);\n\n }", "@Override\n public double calculateSalary(){\n return this.horas_trabajadas*EmployeeByHours.VALOR_HORA;\n }", "public double insalubridadeDez(double salario) {\n\t\tsalario = salario * 0.1;\r\n\t\t// atribui o valor de 10% ao salario e somando eles.\r\n\t\t// salarioTotal += salario;\r\n\t\treturn salario; // so atribuir esse valor ao salario\r\n\t}", "public void calculateEarnings(){\n if (wages.size() > expenses.size()){\n //check size difference\n int sizeUp = wages.size() - expenses.size();\n for(int i = 0; i < sizeUp; i++){\n //add zero(s) to expenses to match up(this assumes no expenses for the week(s))\n expenses.add(BigDecimal.ZERO);\n }\n }\n\n if(expenses.size() > wages.size()){\n //check size difference\n int sizeUp = expenses.size() - wages.size();\n for(int i = 0; i < sizeUp; i++){\n //add zero(s) to expenses to match up(this assumes no income for the week(s))\n wages.add(BigDecimal.ZERO);\n }\n }\n for(int i=0; i < wages.size(); i++){\n BigDecimal profits;\n profits = wages.get(i).subtract(expenses.get(i));\n BigDecimal roundUp = profits.setScale(2, RoundingMode.HALF_UP);\n earningsList.add(roundUp);\n }\n }", "public Double darTiempoTotal(){\n\t\treturn tiempoComputacionalGrasp+tiempoComputacionalSetCovering;\n\t}", "public double getEarnings() {\n//\t\tif (hoursWorked > 40) {\n//\t\t\treturn (40 * hoursWorked) + \n//\t\t\t\t\t((hoursWorked - 40) * wagePerHour * 1.5);\n//\t\t} else {\n//\t\t\treturn hoursWorked * wagePerHour;\n//\t\t}\n\t\t\t\t// condition \n\t\treturn hoursWorked > 40 ? \n\t\t\t\t// condition true \n\t\t\t(40 * wagePerHour) + ((hoursWorked - 40) * wagePerHour * 1.5) \n\t\t\t\t// condition false\n\t\t\t: hoursWorked * wagePerHour;\t\n\t}", "private double calculeSalaires() {\n return salaireHoraire * heures;\n }", "Double getTotalSpent();", "@Override\n public double earnings() {\n return salary + commission + quantity;\n }", "public BigDecimal getTotalEarnings() {\n totalEarnings = new BigDecimal(0);\n for(BigDecimal earnings: earningsList){\n totalEarnings = totalEarnings.add(earnings);\n }\n return totalEarnings.setScale(2, RoundingMode.HALF_UP);\n }", "public void addMoney(double profit){\n money+=profit;\n }", "double getSum();", "double getSum();", "public BigDecimal getSumOfOutstanding(){\n\t\t BigDecimal a = new BigDecimal(0);\r\n//\t\t int outstandingIndex = 0;\r\n//\t\t for (int i=0 ; i<mColumnNames.length ; i++){\r\n//\t\t\t if (mColumnNames[i].equals(DBService.OUTSTANDING)){\r\n//\t\t\t\t outstandingIndex = i;\r\n//\t\t\t\t break;\r\n//\t\t\t }\r\n//\t\t }\r\n\t\t \r\n\t\t for (int i=0 ; i<getRowCount() ; i++){\r\n\t\t\t float value = (Float)getValueAt(i, 11);\r\n\t\t\t \r\n\t\t\t if (value != 0){\r\n\t\t\t\t BigDecimal b = new BigDecimal(value);\r\n\t\t\t\t a = a.add(b);\r\n\t\t\t }\r\n\t\t }\r\n\t\t \r\n\t\t return a;\r\n\t }", "@Override\n public double annualSalary(){\n double bonus = 0.00;\n\n if(currentStockPrice > 50){\n bonus = 30000;\n }\n\n return (super.annualSalary() + bonus);\n }", "public double getSalario() {\r\n\t\treturn super.getSalario()-10000;\r\n\t}", "@Override\r\n\tpublic int getPayCheque() {\n\t\treturn profit+annuelSalary;\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\t int codigoFuncionario;\n\t\t int numeroHorasTrabalhadas = 0;\n\t\t double excesso = 0.0;\n final double VALOR_HORA_TRABALHADA = 10.00; \n final double VALOR_HORA_EXCEDENTE = 20.00;\n final int LIMITE_HORAS = 50;\n\t\t double salarioTotal = 0.00, salarioExcedente = 0.00;\n Scanner leia = new Scanner (System.in);\n\n System.out.println(\"Digite o codigo do funcionario: \");\n codigoFuncionario = leia.nextInt();\n\n System.out.println(\"Digite o numero de horas trabalhadas: \");\n numeroHorasTrabalhadas = leia.nextInt();\n\n\t\tif (numeroHorasTrabalhadas <= LIMITE_HORAS){ \n salarioTotal =numeroHorasTrabalhadas * VALOR_HORA_TRABALHADA;\n \n\t\t \n\t}else {\n\n\t\texcesso = (numeroHorasTrabalhadas - LIMITE_HORAS)*VALOR_HORA_EXCEDENTE;\n\t\tsalarioTotal = LIMITE_HORAS*VALOR_HORA_TRABALHADA + excesso;\n\t\t\n\t\t\n\t\t}\n\t\n\t\n\tSystem.out.println(\"Salario total: \"+salarioTotal);\n\n\n\t}", "public void calculoSalarioBruto(){\n salarioBruto = hrTrabalhada * valorHr;\n }", "private int sum(AFormula o1){\n\t\t\t\t\n\t\t\t\treturn o1.calculate(customerType, weekdayCount, weekendCount);\n\t\t\t\t\n\t\t\t}", "private void sumaApostado() {\n\t\tapostado.set(apostado.get() + 1.0);\n\t\tdiruField.setText(String.format(\"%.2f\", apostado.get()));\n\t\tactualizaPremio();\n\t}", "public void engordar(double peso){\r\n\t\tthis.peso = this.peso + peso;\r\n\t}", "public double earnings() {\r\n double earnings;\r\n double overtime;\r\n double overtimeRate = hourlyRate * 1.5;\r\n\r\n // if hours, hourlyRate, or salary is negative (default numerical values are -1) earnings is -1\r\n if (hours < 0 || hourlyRate < 0 || salary < 0) {\r\n earnings = -1;\r\n }\r\n else if (hours > 40) {\r\n overtime = (hours - 40) * overtimeRate;\r\n earnings = overtime + salary;\r\n }\r\n else {\r\n earnings = salary;\r\n }\r\n\r\n return earnings;\r\n }", "public double calcTotalEarnings() {\n double total = 0;\n for (int i = 0; i < numRegions; i++) {\n total += regionList[i].calcEarnings();\n }\n return total;\n }", "public static void sumarSuma(int valor) {\n\t\tsuma += valor;\n\t}", "public static Double obtenerSumatoriaDeSalariosPorAntiguedad(Integer antiguedad)\r\n\t{\r\n\t\tDouble sumatoriaDeSalarios = 0.0 ;\r\n\t\tfor(Empleado empleado : listaDeEmpleados)\r\n\t\t{\r\n\t\t\tif(empleado.getAntiguedad() > antiguedad)\r\n\t\t\t\tsumatoriaDeSalarios = sumatoriaDeSalarios + empleado.getSalario() ;\r\n\t\t}\r\n\t\treturn sumatoriaDeSalarios;\r\n\t}", "@Override\n public double earnings() {\n if (getHours() < 40)\n return getWage() * getHours();\n else\n return 40 * getWage() + ( getHours() - 40 ) * getWage() * 1.5;\n }", "public double isss(double salario) {\n double isss = 0;\n if (salario >= 1000) {\n isss = 30;\n } else if (salario > 0 && salario < 1000) {\n isss = salario * 0.03;\n }\n return isss;\n }", "static int sumOf1To100nos() {\r\n\t\t \r\n\t\t int sum =0;\r\n\t\t \r\n\t\t for(int i=1; i<=100;i++) {\r\n\t\t\t sum+=i;\r\n\t\t }\r\n\t\t \r\n\t\t return sum;\r\n\t }", "public static double calculateTotals(double[] money) {\n int element = 0; //The element to add\n double total = 0; //The total sales/commissions\n \n while (element < money.length) { //Add each element\n total += money[element];\n element++;\n }\n \n //Return total\n return total;\n }", "private int syuneri_gumar(ArrayList<Integer> syun) {\n int summa = 0;\n for (int i = 0; i < syun.size(); i++)\n summa += syun.get(i);\n return summa;\n }", "public BigDecimal sumGoodwillTotal(MaintenanceRequest po){\n\t\tBigDecimal total = new BigDecimal(0.00).setScale(2);\n\t\t\n\t\tfor(MaintenanceRequestTask task : po.getMaintenanceRequestTasks()){\n\t\t\ttotal = total.add(MALUtilities.isEmpty(task.getGoodwillCost()) ? new BigDecimal(0) : task.getGoodwillCost());\n\t\t}\n\t\t\n\t\treturn total;\t\t\n\t}", "public Integer calculateSum() {\n logger.debug(\"Calculating and returning the sum of expenses.\");\n return listOfTargets.stream().map(T::getAmount).reduce(0, Integer::sum);\n }", "@Test\n\tvoid calcularSalarioConMasCuarentaHorasPagoPositivoTest() {\n\t\tEmpleadoPorComision empleadoPorComision = new EmpleadoPorComision(\"Eiichiro oda\", \"p33\", 400000, 500000);\n\t\tdouble salarioEsperado = 425000;\n\t\tdouble salarioEmpleadoPorComision = empleadoPorComision.calcularSalario();\n\t\tassertEquals(salarioEsperado, salarioEmpleadoPorComision);\n\n\t}", "public double sumMoney(){\n\t\tdouble result = 0;\n\t\tfor(DetailOrder detail : m_DetailOrder){\n\t\t\tresult += detail.calMoney();\n\t\t}\n\t\tif(exportOrder == true){\n\t\t\tresult = result * 1.1;\n\t\t}\n\t\treturn result;\n\t}", "@Override\n\tpublic double sumMoney() {\n\t\treturn ob.sumMoney();\n\t}", "BigDecimal getTotal();", "BigDecimal getTotal();", "@Override\n public double salario() {\n return 2600 * 1.10;\n }", "public void sumarUnidad() {\r\n\t\tcantidad++;\r\n\t}", "int main()\n{\n int week[7], t = 0, sum = 0;\n for(int i = 0; i < 7; i++) {\n cin >> week[i];\n t += week[i];\n }\n t = t - week[0] - week[6];\n for (int i = 1; i < 6; i++) {\n if (week[i] <= 8)\n sum += week[i] * 100;\n else\n sum += week[i] * 100 + (week[i] - 8) * 15;\n }\n sum += week[0] * 150;\n sum += week[6] * 125;\n if(t > 40)\n sum += (t - 40) * 25;\n \n cout << sum;\n}", "private static int getBonus(int sales) {\n if (sales > 5000) {\n\n return sales / 10;\n\n }\n return 0;\n }", "public void salary() {\n System.out.print(\"Wage: \");\n double wage = in.nextDouble();\n System.out.print(\"Hours: \");\n double hours = in.nextDouble();\n final double REG_HOURS = 40;\n final double OVERTIME_MULTIPLIER = 0.5;\n\n double salary = wage * hours;\n if (hours > REG_HOURS) {\n salary += (hours - REG_HOURS) * wage * OVERTIME_MULTIPLIER;\n }\n\n System.out.printf(\"\\nYou'll make $%,.2f this week.\\n\\n\", salary);\n }", "public void determinarEstadoSalud(){\n \n for (int i = 0; i < listaEmpleados.size(); i++) {\n //Este for chequea si tiene alguna enfermedad preexistente -> asigna puntajes de acuerdo\n for (int j = 0; j < factoresRiesgo.length; j++) {\n \n if(listaEmpleados.get(i).getFactoresRiesgo().contains(factoresRiesgo[j])){ \n listaEmpleados.get(i).setEstadoSalud(30);\n }\n }\n //Verifica el rango de edad de la persona -> asigna puntajes de acuerdo\n if(listaEmpleados.get(i).getEdad() >= 70){\n listaEmpleados.get(i).setEstadoSalud(listaEmpleados.get(i).getEstadoSalud()+50);\n }\n if(listaEmpleados.get(i).getEdad() >= 40 && listaEmpleados.get(i).getEdad() < 70 ){\n listaEmpleados.get(i).setEstadoSalud(listaEmpleados.get(i).getEstadoSalud()+30);\n }\n if(listaEmpleados.get(i).getEdad() >= 20 && listaEmpleados.get(i).getEdad() < 40 ){\n listaEmpleados.get(i).setEstadoSalud(listaEmpleados.get(i).getEstadoSalud()+10);\n }\n //Los hombre tienen mas probabilidades de morir por la mayoria de enfermedad, incluyendo el covid-19\n if(listaEmpleados.get(i).getSexo().equals(\"hombre\")){\n listaEmpleados.get(i).setEstadoSalud(listaEmpleados.get(i).getEstadoSalud()+15);\n \n }\n //Verifica los diferentes puntajes y almacena los empleados en diferentes arraylist dependiendo su prioridad\n \n if(listaEmpleados.get(i).getEstadoSalud() >= 80){\n EmpleadosPrioridadAlta.add(listaEmpleados.get(i)); \n }\n \n if(listaEmpleados.get(i).getEstadoSalud() >= 60 && listaEmpleados.get(i).getEstadoSalud() < 80){\n EmpleadosPrioridadMediaAlta.add(listaEmpleados.get(i));\n }\n \n if(listaEmpleados.get(i).getEstadoSalud() >= 35 && listaEmpleados.get(i).getEstadoSalud() < 60){\n EmpleadosPrioridadMedia.add(listaEmpleados.get(i));\n }\n \n if(listaEmpleados.get(i).getEstadoSalud() >= 0 && listaEmpleados.get(i).getEstadoSalud() < 35){\n EmpleadosPrioridadBaja.add(listaEmpleados.get(i));\n }\n \n } \n \n }", "@Test\n\tvoid calcularSalarioSinVentasPagoPositivoTest() {\n\t\tEmpleadoPorComision empleadoPorComision = new EmpleadoPorComision(\"Hiromu Arakawa\", \"p24\", 400000, 0);\n\t\tdouble salarioEsperado = 400000;\n\t\tdouble salarioEmpleadoPorComision = empleadoPorComision.calcularSalario();\n\t\tassertEquals(salarioEsperado, salarioEmpleadoPorComision);\n\n\t}", "public void calculateSalary() {\n if (hours < 0 || hourlyRate < 0) {\r\n salary = -1;\r\n }\r\n else if (hours > 40) {\r\n salary = 40 * hourlyRate;\r\n }\r\n else {\r\n salary = hours * hourlyRate;\r\n }\r\n }", "private static void recalculateSummary(Sheet sheet, Payment payment) {\r\n BigDecimal income =(BigDecimal) sheet.getCellAt(\"B1\").getValue();\r\n BigDecimal expense = (BigDecimal) sheet.getCellAt(\"B2\").getValue();\r\n BigDecimal sum = (BigDecimal) sheet.getCellAt(\"B3\").getValue();\r\n \r\n if (payment.getType() == PaymentType.INCOME){\r\n sum = sum.add(payment.getAmount());\r\n income = income.add(payment.getAmount());\r\n } else if (payment.getType() == PaymentType.EXPENSE){\r\n sum = sum.subtract(payment.getAmount());\r\n expense = expense.add(payment.getAmount());\r\n }\r\n \r\n sheet.getCellAt(\"B1\").setValue(income);\r\n sheet.getCellAt(\"B2\").setValue(expense);\r\n sheet.getCellAt(\"B3\").setValue(sum);\r\n }", "public boolean calcularTotal() {\r\n double dou_debe = 0;\r\n double dou_haber = 0;\r\n for (int i = 0; i < tab_tabla2.getTotalFilas(); i++) {\r\n try {\r\n if (tab_tabla2.getValor(i, \"ide_cnlap\").equals(p_con_lugar_debe)) {\r\n dou_debe += Double.parseDouble(tab_tabla2.getValor(i, \"valor_cndcc\"));\r\n } else if (tab_tabla2.getValor(i, \"ide_cnlap\").equals(p_con_lugar_haber)) {\r\n dou_haber += Double.parseDouble(tab_tabla2.getValor(i, \"valor_cndcc\"));\r\n }\r\n } catch (Exception e) {\r\n }\r\n }\r\n eti_suma_debe.setValue(\"TOTAL DEBE : \" + utilitario.getFormatoNumero(dou_debe));\r\n eti_suma_haber.setValue(\"TOTAL HABER : \" + utilitario.getFormatoNumero(dou_haber));\r\n\r\n double dou_diferencia = Double.parseDouble(utilitario.getFormatoNumero(dou_debe)) - Double.parseDouble(utilitario.getFormatoNumero(dou_haber));\r\n eti_suma_diferencia.setValue(\"DIFERENCIA : \" + utilitario.getFormatoNumero(dou_diferencia));\r\n if (dou_diferencia != 0.0) {\r\n eti_suma_diferencia.setStyle(\"font-size: 14px;font-weight: bold;color:red\");\r\n } else {\r\n eti_suma_diferencia.setStyle(\"font-size: 14px;font-weight: bold\");\r\n return true;\r\n }\r\n return false;\r\n }", "public float calculate_salary() {\r\n\t\tfloat calculate = 1000 + this.calculate_benefits();\r\n\t\treturn calculate;\r\n\t}", "public double periculosidade(double salario) {\n\t\t\tsalario = salario * 0.3;\r\n\t\t\t// atribui o valor de 30% ao salario e somando eles.\r\n\t\t\t// salarioTotal = salario + salarioTotal;\r\n\r\n\t\t\treturn salario; // So atribuir esse valor no salario\r\n\t\t\r\n\t}", "public int getTotalEarnings() {\r\n\t\tint total = 0;\r\n\t\tfor (int i = 0; i < this.receiptissued.size(); i++) {\r\n\t\t\ttotal = total + this.receiptissued.get(i).getPrice();\r\n\t\t}\r\n\t\treturn total;\r\n\r\n\t}", "public int probabilidadesHastaAhora(){\n return contadorEstados + 1;\n }", "private Boolean calculateTotalEmission() {\n\t\ttry {\n\n\t\t\tfoodCO2E = Double.valueOf(JTFFood.getText().isEmpty() ? \"0.0\" : JTFFood.getText())\n\t\t\t\t\t* energySourceDetail.get(FoodIntake).get(JCBFoodUnit.getSelectedItem().toString());\n\n\t\t\tlandfillingFoodWasteCO2E = Double\n\t\t\t\t\t.valueOf(JTFLandfillingFoodWaste.getText().isEmpty() ? \"0.0\" : JTFLandfillingFoodWaste.getText())\n\t\t\t\t\t* energySourceDetail.get(LandfillingFoodWaste)\n\t\t\t\t\t\t\t.get(JCBLandfillingFoodWasteUnit.getSelectedItem().toString());\n\n\t\t\tcompostingFoodWasteCO2E = Double\n\t\t\t\t\t.valueOf(JTFCompostingFoodWaste.getText().isEmpty() ? \"0.0\" : JTFCompostingFoodWaste.getText())\n\t\t\t\t\t* energySourceDetail.get(CompostingFoodWaste)\n\t\t\t\t\t\t\t.get(JCBCompostingFoodWasteUnit.getSelectedItem().toString());\n\n\t\t} catch (NumberFormatException ne) {\n\t\t\tSystem.out.println(\"Number Format Exception while calculating House Hold Emission\" + ne);\n\t\t\treturn false;\n\t\t}\n\t\t//\n\t\ttotalFoodCO2E = foodCO2E + landfillingFoodWasteCO2E + compostingFoodWasteCO2E;\n\t\ttotalFoodCO2E = Math.round(totalFoodCO2E * 100D) / 100D;\n\t\treturn true;\n\t}", "private void sumarTotalVenta(int cantidad, double precioProducto) {\r\n\t\tdouble valorProductos = cantidad * precioProducto;\r\n\t\ttotalVenta += valorProductos;\r\n\t}", "public void sueldo(){\n if(horas <= 40){\n sueldo = horas * cuota;\n }else {\n if (horas <= 50) {\n sueldo = (40 * cuota) + ((horas - 40) * (cuota * 2));\n } else {\n sueldo = ((40 * cuota) + (10 * cuota * 2)) + ((horas - 50) + (cuota * 3));\n }\n }\n\n }", "int getChestsAmount();", "int getSuma();", "double getTodaysExpenditureAmount() {\n Long time = new Date().getTime();\n Date date = new Date(time - time % (DAY_DURATION));\n return getExpenditureAmount(date.getTime(), date.getTime() + (DAY_DURATION));\n }", "public int totalEffetInventaire() {\n\t\tint limiteInventaire = 0;\n\t\tif (bonusForce >0) limiteInventaire+= bonusForce;\n\t\tif (bonusDefense >0) limiteInventaire+= bonusDefense;\n\t\tif (bonusVie >0) limiteInventaire+= bonusVie;\n\t\tif (bonusEsquive >0) limiteInventaire+= bonusEsquive;\n\t\tif (bonusInventaire >0) limiteInventaire+= bonusInventaire;\n\t\treturn limiteInventaire*3/4;\n\t}", "private void increment() {\r\n salary = (int) (salary + salary * 0.2);\r\n }", "public Double retornaSubTotal(Double totalGeral,Double desconto){\n return totalGeral - (totalGeral*(desconto/100));\n}", "public void hallarPerimetroEscaleno() {\r\n this.perimetro = this.ladoA+this.ladoB+this.ladoC;\r\n }", "public int tiempoTotal() {\r\n\r\n\t\tint duracionTotal = 0;\r\n\t\tfor (int i = 0; i < misCanciones.size(); i++) {\r\n\t\t\tduracionTotal = duracionTotal + misCanciones.get(i).getDuracionS();\r\n\t\t}\r\n\t\t\r\n\t\treturn duracionTotal;\r\n\r\n\t}", "@Override\n\tpublic double totalSalario() {\n\t\treturn this.precio;\n\t}", "public int sumEquipmentPrice(){\n int sum = 0;\n for (Equipment e: equipment){\n sum += e.getPrice();\n }\n return sum;\n }", "@Override\n public void calcularIntGanado() {\n intGanado = saldo;\n for(int i = 0; i < plazoInv; i++){\n intGanado += inve * 12;\n intGanado += intGanado * (intAnual / 100);\n }\n intGanado = intGanado - (inve + saldo);\n }", "public void calcularTotalGastos(FormularioRegistrarCorte formularioRegistrarCorte) {\n Double suma = 0.0;\n try {\n for (int i = 0; i < formularioRegistrarCorte.getTablaSlidas().getRowCount(); i++) {\n suma = suma + (Double.valueOf(formularioRegistrarCorte.getTablaSlidas().getValueAt(i, 2).toString()));\n }\n formularioRegistrarCorte.getTxtTotalGastos().setText(new OperacionesUtiles().formatoDouble(suma));\n } catch (Exception e) {\n showMessageDialog(null, \"Ocurrio un error al intenetar calcular total salidas\");\n }\n\n }", "@Override\n\tpublic Double calcular(Produto produto) {\n\t\treturn (produto.getValorUnitario()) - (produto.getValorUnitario() * 0.25);\n\t}", "public double sum() {\n double resultat = 0;\n for (int i = 0; i < tab.size(); i++) {\n resultat += CalculatorArray.sum(tab.get(i));\n }\n System.out.println(\"Sum colonne:\" + resultat);\n return resultat;\n }", "public double precioFinal(){\r\n \r\n double plus = 0;\r\n \r\n switch(consumoElectrico){\r\n case 'A':\r\n plus +=100;\r\n break;\r\n case 'B':\r\n plus += 80;\r\n break;\r\n case 'C':\r\n plus +=60;\r\n break;\r\n case 'D':\r\n plus +=50;\r\n break;\r\n case 'E':\r\n plus+=30;\r\n break;\r\n case 'F':\r\n plus+=10;\r\n break;\r\n \r\n }\r\n \r\n \r\n if(peso>=0 && peso<=19){\r\n plus+=10;\r\n }else if(peso >=20 && peso<= 49){\r\n plus+=50;\r\n }else if(peso >= 50 && peso<=79){\r\n plus+=80;\r\n }else if(peso>=80){\r\n plus+=100;\r\n }\r\n return precioBase+plus;\r\n }", "public void setSUM(double value) {\n this.sum = value;\n }", "@Override\n public double total() {\n return 2500;\n }", "@Override\n\tpublic double totalPresentase(UUID idPemb) {\n\t\tQuery query = sessionFactory.getCurrentSession().createQuery(\"SELECT sum(k.persentase_komponen) as res \"\n\t\t\t\t+ \"FROM komponen_nilai k WHERE id_pemb='\" + idPemb + \"'\");\n\t\tList<Object[]> results = (List<Object[]>)query.list();\n\t\tfor (Object[] result : results) {\n\t\t\tdouble res = (Double) result[0];\n\t\t\tSystem.out.println(res);\n\t\t}\n\t\treturn 0;\n\t}", "public void calculateCommission(){\r\n commission = (sales) * 0.15;\r\n //A sales Person makes 15% commission on sales\r\n }", "public double totalInsuranceCost(){\n double cost=0;\n for(InsuredPerson i: insuredPeople){\n cost+=i.getInsuranceCost();\n\n }\n return cost;\n\n }", "public void calculoPersonal(){\n ayudantes = getAyudantesNecesarios();\n responsables = getResponsablesNecesarios();\n \n //Calculo atencion al cliente (30% total trabajadores) y RRPP (10% total trabajadores):\n \n int total = ayudantes + responsables;\n \n atencion_al_cliente = (total * 30) / 100;\n \n RRPP = (total * 10) / 100;\n \n //Creamos los trabajadores\n \n gestor_trabajadores.crearTrabajadores(RRPP, ayudantes,responsables,atencion_al_cliente);\n \n }", "BigDecimal getSumaryTechoCveFuente(BudgetKeyEntity budgetKeyEntity);", "int getSumaAdunata();", "public double getAmountEarned(){\r\n return getSalary() + getBonus() + getCommission() * getNumSales();\r\n }", "private void processOnLoanData(long phAwal, long premiAmountSumUpCurrentValue){\n long count = phAwal+premiAmountSumUpCurrentValue;\n //LogUtility.logging(TAG,LogUtility.infoLog,\"processOnLoanData\",\"count\",count+\"\");\n pokokHutang.add(count);\n }", "@Override\r\n public int calculateSalary()\r\n {\r\n return weeklySalary*4;\r\n }", "double getTodaysIncomeAmount() {\n Long time = new Date().getTime();\n Date date = new Date(time - time % (DAY_DURATION));\n return getIncomeAmount(date.getTime(), date.getTime() + DAY_DURATION);\n }", "public void testSumAtSelectionOnOthersAccount() {\r\n addAccount();\r\n addAccount2();\r\n solo.pressSpinnerItem(0, 1);\r\n addOp();\r\n tools.printCurrentTextViews();\r\n assertTrue(solo.getText(FIRST_SUM_AT_SEL_IDX).getText().toString().contains(Formater.getSumFormater().format(2000.50 - 10.50)));\r\n }", "private static double totalPrice(double price_interest, double dwnpymnt) {\n \treturn price_interest + dwnpymnt;\n }", "private int CalcHandSum(Player player, List<Card> hand) {\n int sum = 0;\n int aceCounter = 0;\n\n for (Card card : hand) {\n if (card.cardRank == CardRank.ACE) {\n aceCounter++;\n }\n sum += card.cardValue;\n if (sum > 21 && card.cardRank == CardRank.ACE) {\n sum -= 10;\n aceCounter--;\n }\n }\n return sum;\n }", "double getYesterdaysExpenditureAmount() {\n Long time = new Date().getTime();\n Date date = new Date(time - time % (DAY_DURATION));\n return getExpenditureAmount(date.getTime() - DAY_DURATION, date.getTime());\n }", "public void sumValues(){\n\t\tint index = 0;\n\t\tDouble timeIncrement = 2.0;\n\t\tDouble timeValue = time.get(index);\n\t\tDouble packetValue;\n\t\twhile (index < time.size()){\n\t\t\tDouble packetTotal = 0.0;\n\t\t\twhile (timeValue < timeIncrement && index < packets.size()){\n\t\t\t\ttimeValue = time.get(index);\n\t\t\t\tpacketValue = packets.get(index);\n\t\t\t\tpacketTotal= packetTotal + packetValue;\n\t\t\t\tindex = index + 1;\n\t\t\t}\n\t\t\tArrayList<Double> xy = new ArrayList<Double>();\n\t\t\txy.add(timeIncrement);\n\t\t\txy.add(packetTotal);\n\t\t\ttotalIncrements.add(xy);\n\t\t\t// to get max and min need separate arrays\n\t\t\ttimeIncrements.add(timeIncrement);\n\t\t\tbyteIncrements.add(packetTotal);\n\t\t\ttimeIncrement = timeIncrement + 2.0;\t\n\t\t}\n\t\treturn;\n\n\t}", "public int getTotalRecaudado()\n {\n return maquina1.getTotal() + maquina2.getTotal();\n }", "public int fondMagasin(){\n\tint total =this.jeton;\n\tfor(Caisse c1 : this.lesCaisses){\n\ttotal = c1.getTotal()+total;\n\t}\n\treturn total;\n}", "public double total(){\n\tdouble total=0;\n\tfor(Map.Entry<String, Integer> pro:proScan.getProducts().entrySet()){\n\t\tString proName=pro.getKey();\n\t\tint quantity=pro.getValue();\n\t\tProductCalculator proCal=priceRule.get(proName);\n\t\tif(proCal==null)\n\t\t\tthrow new MissingProduct(proName);\n\t\t\n\t\tProductCalculator cal=priceRule.get(proName);\n\t\tdouble subtotal=cal.getTotal(quantity);\n\t\ttotal+=subtotal;\n\t\t//System.out.println(total);\n\t}\n\t//round the total price to two digit\n\treturn round(total, 2);\n}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint trabaj, horas, salario, x=0, horas_ex, horas_obli=40;\n\t\tdouble salario_ex, salario_fin1, salario_fin2, acum=0;\n\t\t\n\t\tSystem.out.println(\"Dime cuantos trabajadores hay: \");\n\t\ttrabaj = sc.nextInt();\n\t\t\n\t\tSystem.out.println(\"Dime el salario/horas: \");\n\t\tsalario = sc.nextInt();\n\t\t\n\t\tsalario_ex = (salario * 1.5);\n\t\t\n\t\twhile (x < trabaj) {\n\t\t\tSystem.out.println(\"Dime las horas que trabajas: \");\n\t\t\thoras = sc.nextInt();\n\t\t\t\n\t\t\thoras_ex = (horas - horas_obli);\n\t\t\tsalario_fin1=((horas_ex * salario_ex) + (salario * horas_obli));\n\t\t\tsalario_fin2=(salario * horas);\n\t\t\t\n\t\t\tif (horas > horas_obli) {\n\t\t\t\tSystem.out.println(\"Tienes que cobrar un 50% más, tu sueldo será: \" + salario_fin1);\n\t\t\t\tacum=(salario_fin1 + acum);\n\t\t\t\tx=(x+1);\n\t\t\t}\n\t\t\t\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"Tu sueldo será de: \" + salario_fin2);\n\t\t\t\tacum=(salario_fin2 + acum);\n\t\t\t\tx=(x+1);\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(\" \");\n\t\t}\n\t\tSystem.out.println(\"El salario total del grupo es: \" + acum);\n\t\tsc.close();\n\t}", "public double sumTransactions() {\n\t\treturn checkIfTransactionsExist(true);\n\t}" ]
[ "0.6093075", "0.6041032", "0.5872609", "0.5868868", "0.58517313", "0.5823453", "0.58232933", "0.5820955", "0.57712823", "0.5759694", "0.5754604", "0.5752233", "0.5737", "0.5730412", "0.5701209", "0.569391", "0.5690032", "0.564614", "0.5595776", "0.5594667", "0.5594667", "0.5589634", "0.556954", "0.5560399", "0.55447906", "0.5536834", "0.55330944", "0.55204034", "0.5510026", "0.5485208", "0.5485135", "0.54784065", "0.5476984", "0.5457924", "0.5456582", "0.54550457", "0.54497266", "0.54345006", "0.54329455", "0.5429459", "0.5417157", "0.5414948", "0.5404517", "0.5404399", "0.5392822", "0.5392822", "0.53880596", "0.5387773", "0.5386853", "0.5369827", "0.53693515", "0.5367686", "0.53576964", "0.53502613", "0.53386354", "0.53352857", "0.53301454", "0.5322584", "0.53125817", "0.5291847", "0.52895284", "0.52892846", "0.5289188", "0.5283817", "0.52819514", "0.5279674", "0.52548796", "0.5254482", "0.5250634", "0.5246746", "0.52459157", "0.52435887", "0.5243232", "0.52431566", "0.52420974", "0.5235914", "0.5212896", "0.5211201", "0.5208319", "0.5206984", "0.5205416", "0.5204946", "0.5201923", "0.5194501", "0.5194332", "0.5188809", "0.51864624", "0.51839995", "0.5180599", "0.5172842", "0.5172089", "0.51715726", "0.51694304", "0.516621", "0.51639456", "0.51613975", "0.51606685", "0.5157538", "0.5154664", "0.5153735" ]
0.5300952
59
Constructor con 5 para metros
public Comercial(String nombre, String apellido, int edad, double salario, double comision) { super(nombre, apellido, edad, salario); this.comision=comision; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Constructor() {\r\n\t\t \r\n\t }", "private void __sep__Constructors__() {}", "public tn(String paramString, ho paramho)\r\n/* 12: */ {\r\n/* 13:11 */ super(paramString, paramho);\r\n/* 14: */ }", "public Card() { this(12, 3); }", "public Constructor(){\n\t\t\n\t}", "public Test05() {\n this(0);\n n2 = \"n2\";\n n4 = \"n4\";\n }", "public Tbdtokhaihq3() {\n super();\n }", "Constructor(int i,String n ,int x){ //taking three parameters which shows that it is constructor overloaded\r\n\t\t id = i; \r\n\t\t name = n; \r\n\t\t marks =x; \r\n\t\t }", "private GrupoCuenta(String nombre, int operacion)\r\n/* 11: */ {\r\n/* 12:31 */ this.nombre = nombre;\r\n/* 13:32 */ this.operacion = operacion;\r\n/* 14: */ }", "public Pitonyak_09_02() {\r\n }", "public Troop() //make a overloaded constructor \n\t{\n\t\ttroopType = \"light\"; \n\t\tname = \"Default\";\n\t\thp = 50;\n\t\tatt = 20;\n\t}", "public Methods() { // ini adalah sebuah construktor kosong tidak ada parameternya\n System.out.println(\"Ini adalah Sebuah construktor \");\n }", "public CampoModelo(String valor, String etiqueta, Integer longitud)\n/* 10: */ {\n/* 11:17 */ this.valor = valor;\n/* 12:18 */ this.etiqueta = etiqueta;\n/* 13:19 */ this.longitud = longitud;\n/* 14: */ }", "public Pasien() {\r\n }", "public Method(String name, String desc) {\n/* 82 */ this.name = name;\n/* 83 */ this.desc = desc;\n/* */ }", "public Chauffeur() {\r\n\t}", "public Tbdcongvan36() {\n super();\n }", "public ConstructorsDemo() \n\t {\n\t x = 5; // Set the initial value for the class attribute x\n\t }", "public Ov_Chipkaart() {\n\t\t\n\t}", "public PotionEffect(int paramInt1, int paramInt2, int paramInt3)\r\n/* 21: */ {\r\n/* 22: 32 */ this(paramInt1, paramInt2, paramInt3, false, true);\r\n/* 23: */ }", "public Comprador(String e, String n, String p, String d, String m) {\n // initialise instance variables\n super(1,e,n,p,d,m);\n favoritos = new ArrayList<String>();\n }", "public Clade() {}", "defaultConstructor(){}", "public Kitten(String s, int a)\n {\n // initialise instance variables\n super(s, a);\n }", "public DTLZ5_2D() {\r\n super(12, 2);\r\n }", "public ContasCorrentes(){\n this(0,\"\",0.0,0.0,0);\n }", "ConstuctorOverloading(int num){\n\t\tSystem.out.println(\"I am contructor with 1 parameter\");\n\t}", "private void addConstructors() {\n\t\tthis.rootBindingClass.getConstructor().body.line(\"super({}.class);\\n\", this.name.getTypeWithoutGenerics());\n\t\tGMethod constructor = this.rootBindingClass.getConstructor(this.name.get() + \" value\");\n\t\tconstructor.body.line(\"super({}.class);\", this.name.getTypeWithoutGenerics());\n\t\tconstructor.body.line(\"this.set(value);\");\n\t}", "public AntrianPasien() {\r\n\r\n }", "private Instantiation(){}", "public Cgg_jur_anticipo(){}", "Petunia() {\r\n\t\t}", "private TMCourse() {\n\t}", "public OnionooParser() {\n\n\t}", "ConstuctorOverloading(){\n\t\tSystem.out.println(\"I am non=argument constructor\");\n\t}", "private UsineJoueur() {}", "public AbstractT602()\n {\n }", "public Achterbahn() {\n }", "public Mitarbeit() {\r\n }", "Data() {\n\t\t// dia = 01;\n\t\t// mes = 01;\n\t\t// ano = 1970;\n\t\tthis(1, 1, 1970); // usar um construtor dentro de outro\n\t}", "public ahr(aqu paramaqu)\r\n/* 20: */ {\r\n/* 21: 34 */ super(paramaqu);\r\n/* 22: 35 */ a(0.25F, 0.25F);\r\n/* 23: */ }", "public ListElement()\n\t{\n\t\tthis(null, null, null); //invokes constructor with 3 arguments\n\t}", "private TIPO_REPORTE(String nombre)\r\n/* 55: */ {\r\n/* 56: 58 */ this.nombre = nombre;\r\n/* 57: */ }", "public Field(){\n\n // this(\"\",\"\",\"\",\"\",\"\");\n }", "public Mannschaft() {\n }", "public Overview() {\n\t\t// It will work whenever i create object with using no parameter const\n\t\tSystem.out.println(\"This is constructor\");\n\t}", "public Student() {\n//\t\tname = \"\";\n//\t\tage = 0;\n\t\t\n\t\t\n\t\t//call constructors inside of other constructors\n\t\tthis(999,0);\n\t}", "public Perro() {\n// super(\"No define\", \"NN\", 0); en caso el constructor de animal tenga parametros\n this.pelaje = \"corto\";\n }", "private GetMyInfo()\r\n/* 13: */ {\r\n/* 14:13 */ super(new APITag[] { APITag.INFO }, new String[0]);\r\n/* 15: */ }", "public Identity()\n {\n super( Fields.ARGS );\n }", "public Generic(){\n\t\tthis(null);\n\t}", "public bwq(String paramString1, String paramString2)\r\n/* 10: */ {\r\n/* 11: 9 */ this.a = paramString1;\r\n/* 12:10 */ this.f = paramString2;\r\n/* 13: */ }", "public AI(String n) {//constructor for super class\n super(n);\n }", "Paranormal(String name, String origin, int dangerrating, String foodType, int foodAmt){\n super(name, origin, dangerrating);\n foodType = \"meat\";\n foodAmt = 5;\n }", "private Vect3() {\n\t\tthis(0.0,0.0,0.0);\n\t}", "public ctq(File paramFile, String paramString, oa paramoa, ckh paramckh)\r\n/* 22: */ {\r\n/* 23: 33 */ super(paramoa);\r\n/* 24: 34 */ this.i = paramFile;\r\n/* 25: 35 */ this.j = paramString;\r\n/* 26: 36 */ this.k = paramckh;\r\n/* 27: */ }", "public bsm(PlayerStat paramtq)\r\n/* 7: */ {\r\n/* 8: 9 */ super(paramtq.e);\r\n/* 9:10 */ this.j = paramtq;\r\n/* 10: */ }", "public TebakNusantara()\n {\n }", "@Test\n public void goalCustomConstructor_isCorrect() throws Exception {\n\n int goalId = 11;\n int userId = 1152;\n String name = \"Test Name\";\n int timePeriod = 1;\n int unit = 2;\n double amount = 1000.52;\n\n\n //Create goal\n Goal goal = new Goal(goalId, userId, name, timePeriod, unit, amount);\n\n // Verify Values\n assertEquals(goalId, goal.getGoalId());\n assertEquals(userId, goal.getUserId());\n assertEquals(name, goal.getGoalName());\n assertEquals(timePeriod, goal.getTimePeriod());\n assertEquals(unit, goal.getUnit());\n assertEquals(amount, goal.getAmount(),0);\n }", "public DetArqueoRunt () {\r\n\r\n }", "public Cohete() {\n\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "protected Asignatura()\r\n\t{}", "public TTau() {}", "public Tiempo2( int h, int m ) { \n this( h, m, 0 ); // invoca al constructor de Tiempo2 con tres argumentos\n }", "public Tass4Reader ( ) {\r\n\t\tsuper();\r\n\t}", "public Dog ()\n {\n super (\"Dog\", \"Hi! My name is Snoop Dawg\");\n this.x = \"A bone\";\n /*\n * This dog has many features to it\n * Do not provoke it or else it will bite!\n * Otherwise, It's a nice dog so have fun!\n */\n \n \n }", "public Moto( String nome , float valor , int ano ){\n super( nome , valor ); //define ser uma subclasse\n this.marca = \"Honda\";\n this.ano = ano;\n }", "public Generador(Generic generic) {\r\n this.generic = generic;\r\n this.Num_Atributes = this.generic.getClass().getDeclaredFields().length;\r\n this.SuperDeclaredFields = this.generic.getClass().getSuperclass().getDeclaredFields();\r\n this.DeclaredFields = this.generic.getClass().getDeclaredFields();\r\n }", "public Time(int hour, int minute, int second){ //method in the initializer block\n setHour(hour);\n setMinute(minute);\n setSecond(second);\n}", "public Propuestas() {}", "public Entity(int n, O thing, String... a) throws ThingsException {\t\r\n\t\t\r\n\t\t// Set fields\r\n\t\tnumeric = n;\r\n\t\tmyThing = thing;\r\n\t\tmyPriority = Priority.ROUTINE;\r\n\t\tmyType = Type.GENERIC;\r\n\t\tmyId = cachedNobody;\r\n\t\tmyCreatorId = cachedNobody;\r\n\t\t\r\n\t\t// Stamp the time.\r\n\t\tstamp = System.currentTimeMillis();\r\n\t\t\r\n\t\t// Attributes\r\n\t\tif (a==null) throw new ThingsException(\"Cannot set attribute object as null.\", ThingsException.DATA_ATTRIBUTE_OBJECT_NULL);\r\n\t\tReadWriteableAttributes tempAttributes = new ReadWriteableAttributes();\r\n\t\ttempAttributes.addMultiAttributes(a);\r\n\t\tattributes = tempAttributes;\r\n\t}", "public Curso() {\r\n }", "public Supercar() {\r\n\t\t\r\n\t}", "public As21Id27()\n\t{\n\t\tsuper() ;\n\t}", "public Parametros() {\r\n semilla = SEMILLA_DEFECTO;\r\n numeroPistas = NUMERO_PISTAS_DEFECTO;\r\n duracionSlot = DURACION_SLOT_DEFECTO;\r\n frecuencia = FRECUENCIA_DEFECTO;\r\n duracionMedia = DURACION_MEDIA_DEFECTO;\r\n duracionDesviacion = DURACION_DESVIACION_DEFECTO;\r\n duracionMinima = DURACION_MINIMA_DEFECTO;\r\n demoraMedia = DEMORA_MEDIA_DEFECTO;\r\n demoraDesviacion = DEMORA_DESVIACION_DEFECTO;\r\n }", "public Message(){\n this(\"Not Specified\",\"Not Specified\");\n }", "public ChaCha()\n\t{\n\t\tsuper();\n\t}", "public void Constructor(String name, Integer age) {\r\n this.name = name;\r\n this.age = age;\r\n }", "public CpFldMemo() { super(10010, 5); }", "void DefaultConstructor(){}", "public DefaultTip(String name, Object tip)\n/* */ {\n/* 39 */ this.name = name;\n/* 40 */ this.tip = tip;\n/* */ }", "public Caso_de_uso () {\n }", "protected PickaxeItem(Tier debug1, int debug2, float debug3, Item.Properties debug4) {\n/* 100 */ super(debug2, debug3, debug1, DIGGABLES, debug4);\n/* */ }", "public Lanceur() {\n\t}", "public BaseParameters(){\r\n\t}", "public Alojamiento() {\r\n\t}", "public Tiempo2( int h ) { \n this( h, 0, 0 ); // invoca al constructor de Tiempo2 con tres argumentos\n }", "protected ParameterList(){\n //title = t;\n //cellWorld = cw;\n }", "public Goodsinfo() {\n super();\n }", "public Stack() {\r\n this(20);\r\n }", "public Construct() {\n\tprefixes = new StringBuilder();\n\tvariables = new StringBuilder();\n\twheres = new StringBuilder();\n }", "public SimOI() {\n super();\n }", "MotifLearner(){\n notes = new ArrayList<>();\n times = new ArrayList<>();\n }", "public User(String n, int a) { // constructor\r\n name = n;\r\n age = a;\r\n }", "public Phl() {\n }", "public prueba()\r\n {\r\n }", "public _355() {\n\n }", "public Methods() {\n // what is this doing? -PMC\n }", "public aed(World paramaqu)\r\n/* 9: */ {\r\n/* 10: 24 */ super(paramaqu);\r\n/* 11: */ }", "@Override\n\t\tpublic void init() {\n\t\t}" ]
[ "0.66565186", "0.66148555", "0.65107006", "0.63943577", "0.63170594", "0.63088757", "0.6194715", "0.61200637", "0.6108032", "0.61020386", "0.609386", "0.6091358", "0.605528", "0.60522777", "0.60475904", "0.6013921", "0.5994313", "0.5983478", "0.5971637", "0.5965408", "0.59545195", "0.5946995", "0.59448", "0.59399426", "0.5938205", "0.5935023", "0.5927787", "0.59250444", "0.59246236", "0.5921798", "0.59180117", "0.59030217", "0.58945924", "0.58911186", "0.5887587", "0.5885592", "0.58833766", "0.5873394", "0.58730173", "0.5861924", "0.5860963", "0.586033", "0.5858621", "0.58562165", "0.5841817", "0.58385885", "0.58377624", "0.5836281", "0.5833405", "0.58311325", "0.582128", "0.58212113", "0.5817904", "0.58106005", "0.58056104", "0.5792479", "0.5789341", "0.5788622", "0.5785234", "0.57842064", "0.5781011", "0.57774603", "0.5773865", "0.57734364", "0.5772648", "0.5772444", "0.57663167", "0.5764195", "0.57626593", "0.57621175", "0.5760882", "0.5759737", "0.57573825", "0.5755723", "0.57545173", "0.5753669", "0.5751436", "0.5751302", "0.57504636", "0.5746784", "0.57463086", "0.5746037", "0.57450217", "0.57394", "0.57365584", "0.57309854", "0.5729023", "0.5728549", "0.57230866", "0.571939", "0.5716897", "0.57147133", "0.5708678", "0.57047737", "0.5689682", "0.56894726", "0.56874657", "0.5686799", "0.5682902", "0.5678855", "0.56758183" ]
0.0
-1
Recalibrates the time based on the GPS timestamps.
public void calibrateTime(TimeCalibrator calibrator) { timestamp = calibrator.getCalibratedTime(timestamp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void refreshTime(@Nullable Location location) {\n String provider = location == null ? \"\" : location.getProvider();\n String lat = location == null ? \"\" : formatCoordinate(location.getLatitude());\n String lon = location == null ? \"\" : formatCoordinate(location.getLongitude() * -1);\n\n Log.i(TAG, provider + \" \" + lat + \" \" + lon);\n setTime(lat, lon);\n }", "private void updateTime() {\n timer.update();\n frametime = timer.getTimePerFrame();\n }", "public void updateAlarmTime (){\r\n\t\tint newHour, newMinut;\r\n\t\t\r\n\t\tif (relative) { //Before\r\n\t\t\tnewMinut = reference.getMinutes() - alarmMinutes;\r\n\t\t\tnewHour = reference.getHours() - alarmHours - ((newMinut<0)?1:0);\r\n\t\t\tnewMinut = (newMinut<0)?newMinut+60:newMinut;\r\n\t\t\tnewHour = (newHour<0)?newHour+24:newHour;\r\n\t\t} else {\r\n\t\t\tnewMinut = reference.getMinutes() + alarmMinutes;\r\n\t\t\tnewHour = reference.getHours() + alarmHours + ((newMinut>=60)?1:0);\r\n\t\t\tnewMinut = (newMinut>=60)?newMinut-60:newMinut;\r\n\t\t\tnewHour = (newHour>=240)?newHour-24:newHour;\r\n\t\t}\r\n\r\n\t\tthis.alarmTime.setHours(newHour);\r\n\t\tthis.alarmTime.setMinutes(newMinut);\r\n\t}", "public static void calTime() {\n time = new Date().getTime() - start;\n }", "private void UI_RefreshSensorData ()\r\n\t{\r\n\t\t\t\t\r\n\t\tlong now = System.currentTimeMillis();\r\n\t\t\r\n\t\tif (now-ts_last_rate_calc>1000)\r\n\t\t{\r\n\t\t\tsensor_event_rate=last_nAccVal/((now-ts_last_rate_calc)/1000.0);\r\n\t\t\tts_last_rate_calc=now;\r\n\t\t}\r\n\t}", "private String timeConversion() {\n Calendar local = Calendar.getInstance();\n Calendar GMT = Calendar.getInstance(TimeZone.getTimeZone(\"GMT\"));\n\n //Time from the PINPoint\n int hours, minutes, seconds, day, month, year;\n hours = (record[10] & 0xF8) >> 3;\n minutes = ((record[10] & 0x07) << 3) + ((record[11] & 0xE0) >> 5);\n seconds = ((record[11] & 0x1F) << 1) + ((record[12] & 0x80) >> 7);\n seconds += (record[12] & 0x7F) / 100;\n day = (record[13] & 0xF8) >> 3;\n month = ((record[13] & 0x07) << 1) + ((record[14] & 0x80) >> 7);\n year = (record[14] & 0x7F) + 2000;\n \n month--; //Months in java are 0-11, PINPoint = 1-12;\n\n //Set GMTs time to be the time from the PINPoint\n GMT.set(Calendar.DAY_OF_MONTH, day);\n GMT.set(Calendar.MONTH, month);\n GMT.set(Calendar.YEAR, year);\n GMT.set(Calendar.HOUR_OF_DAY, hours);\n GMT.set(Calendar.MINUTE, minutes);\n GMT.set(Calendar.SECOND, seconds);\n\n //Local is set to GMTs time but with the correct timezone\n local.setTimeInMillis(GMT.getTimeInMillis());\n\n //Set Local time to be the time converted from GMT\n int lHours, lMinutes, lSeconds, lDay, lMonth, lYear;\n lHours = local.get(Calendar.HOUR_OF_DAY);\n lMinutes = local.get(Calendar.MINUTE);\n lSeconds = local.get(Calendar.SECOND);\n lDay = local.get(Calendar.DAY_OF_MONTH);\n lMonth = local.get(Calendar.MONTH);\n\n lMonth++; //Months in java are 0-11, humans read 1-12\n\n lYear = local.get(Calendar.YEAR);\n\n return hR(lMonth) + \"/\" + hR(lDay) + \"/\" + lYear + \" \" + hR(lHours) + \":\" + hR(lMinutes) + \":\" + hR(lSeconds);\n }", "private void updateLocation(Location l){\n\n //Check if we are due an update (the difference between now and the last update must be more than the frequency of updates)\n long time = System.currentTimeMillis();\n l.setTime(time); //Use the time from the device TODO Do we need this step?\n long timeSinceUpdate = time - lastUpdate;\n\n\n //If an update is required\n if(timeSinceUpdate >= frequency) {\n\n //Update last update time\n lastUpdate = time;\n\n NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();\n //If connected to the internet then we can either initialize or upload our location\n if (netInfo != null && netInfo.isConnected()) {\n //If initialized upload the location\n if (initialized) {\n //Upload location the current location and tie up any loose ends\n uploadLocation(l);\n tieUpLooseEnds();\n }\n //If not initialized then initialize and add location to loose ends\n else {\n //Initialize\n init();\n //Add to loose ends\n looseEnds.add(l);\n }\n }\n //If not connected then add the location to our list of loose ends\n else {\n looseEnds.add(l);\n }\n }\n //If no update is due\n else{\n //No update - update time ago on the notification\n String updateTime = AbstractTrackerActivity.niceTime(timeSinceUpdate);\n notificationBuilder.setContentText(String.format(getString(R.string.notification_time_ago), updateTime));\n notificationManager.notify(AbstractTrackerActivity.NOTIFICATION_ID, notificationBuilder.build());\n }\n }", "public long refineTimestamp(long timestamp) {\n long time = (timestamp / windowSlotSize) * windowSlotSize;\n return time;\n }", "public LocalTime calcArrivalTime() {\n if (StaticData.TravelTime[Location.valueOf(this.dLocation).getIndex()][Location.valueOf(this.aLocation).getIndex()] != 0)\n return this.getDTime().plusMinutes(StaticData.delay + StaticData.TravelTime[Location.valueOf(this.dLocation).getIndex()][Location.valueOf(this.aLocation).getIndex()]);\n else\n return this.getDTime().plusMinutes(StaticData.delay + StaticData.TravelTime[Location.valueOf(this.aLocation).getIndex()][Location.valueOf(this.dLocation).getIndex()]);\n\n }", "public abstract void updateTime(int currentTime);", "private void updatePointSpeeds() {\n\t\tfor (int i = 0; i < locations.size(); i++) {\n\t\t\tLocationStructure loc = locations.get(i);\t\t\n\t\t\tDouble dist = Double.MIN_VALUE;\n\t\t\tDouble lat1 = loc.getLatitude().doubleValue();\n\t\t\tDouble lon1 = loc.getLongitude().doubleValue();\n\t\t\t\n\t\t\tDate d = times.get(i);\n\t\t\t\n\t\t\tif( i+1 < locations.size()) {\n\t\t\t\tloc = locations.get(i+1);\n\t\t\t\tDouble lat2 = loc.getLatitude().doubleValue();\n\t\t\t\tDouble lon2 = loc.getLongitude().doubleValue();\n\t\t\t\tdist = calculateDistance(lat1, lon1, lat2, lon2);\n\t\t\t\t\n\t\t\t\tDate d1 = times.get(i+1);\n\t\t\t\tDateTime dt1 = new DateTime(d);\n\t\t\t\tDateTime dt2 = new DateTime(d1);\n\t\t\t\tint seconds = Seconds.secondsBetween(dt1, dt2).getSeconds();\t\t\t\n\t\t\t\tDouble pd = (dist/seconds)*60;\n\t\t\t\tif(!pd.isNaN()) {\n\t\t\t\t\tpointSpeed.add(pd);\t\t\n\t\t\t\t\tSystem.out.println(\"BUS STATE-- Added point speed of \"+ (dist/seconds)*60 + \" for \" +this.vehicleRef);\n\t\t\t\t}\n\t\t\t} else break;\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t}", "public void caltotaltraveltime()\n {\n \t\n \t switch(this.mLegs.size())\n \t {\n \t case 0:\n \t {\n \t\t this.mTravelTime=0;\n \t\t break;\n \t }\n \t case 1:\n \t { \n \t\t this.mTravelTime=this.mLegs.get(0).flighttime();\n \t\t break;\n \t }\n \t case 2:\n \t {\n \t\t Date arrivalt = this.mLegs.get(1).arrivaldate();\n \t\t Date departt = this.mLegs.get(0).departuredate();\n \t\t long diff = (arrivalt.getTime() - departt.getTime())/60000;\n \t\t this.mTravelTime=diff;\n \t\t break;\n \t }\n \t case 3:\n \t {\n \t Date arrivalt = this.mLegs.get(2).arrivaldate();\n \t Date departt = this.mLegs.get(0).departuredate();\n \t long diff = (arrivalt.getTime() - departt.getTime())/60000;\n \t this.mTravelTime=diff;\n \t break;\n \t }\n \t }\n }", "public void refresh() {\n\t\tTimeStampApp ts = this.getCurrentTime();\n\t\tString period = \"am\";\n\t\tif (ts.getHour() > 12 || ts.getHour() == 0) {\n\t\t\tperiod = \"pm\";\n\t\t\tts.setHour(ts.getHour()%13 + 1);\n\t\t}\n\t\t\n\t\tTicTac(ts.getHour() + period + \":\" + ts.getMinute() + \" \" + ts.getSecond() + \"s\");\n\t\t\n\t}", "public void updateTime() {\n\t\tthis.currentTime = System.currentTimeMillis();\n\t}", "public void updateTime(double time){\n\t\t//System.out.println(\"Updating time at \"+time);\n\t\tif(drivefirst)\n\t\t\tupdateTimeDF(time);\n\t\telse\n\t\t\tupdateTimeWF(time);\n\t}", "private void scheduleUpdateTimer() {\n\t\tassert completionUpdateTimer == null : \"Timer object was created\";\n\n\t\tfinal TimerTask timerTask = new TimerTask() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tif (deviceUnderDisplay != null) {\n\t\t\t\t\tfinal int timeToFinish = deviceUnderDisplay.getDriver()\n\t\t\t\t\t\t\t.getTimeToCompletion();\n\t\t\t\t\tif (timeToFinish > 0) {\n\t\t\t\t\t\tif (isInforming) {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * Inform elapsed time\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\treportTime(DeviceUI.ReportKind.FINISHING,\n\t\t\t\t\t\t\t\t\ttimeToFinish);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * We are starting.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\treportTime(DeviceUI.ReportKind.STARTING,\n\t\t\t\t\t\t\t\t\ttimeToFinish);\n\t\t\t\t\t\t\tisInforming = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (isInforming) {\n\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t * The task has just finished\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\treportTime(DeviceUI.ReportKind.FINISHING, 0);\n\t\t\t\t\t\t\tisInforming = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tcompletionUpdateTimer.scheduleAtFixedRate(timerTask, 0,\n\t\t\t\tUPDATE_TIMER_REFRESH_RATE);\n\t}", "private long updateBaseTime(final long timestamp) {\n // We force the starting timestamp to be on a MAX_TIMESPAN boundary\n // so that all TSDs create rows with the same base time. Otherwise\n // we'd need to coordinate TSDs to avoid creating rows that cover\n // overlapping time periods.\n final long base_time = timestamp - (timestamp % Const.MAX_TIMESPAN);\n // Clone the row key since we're going to change it. We must clone it\n // because the HBase client may still hold a reference to it in its\n // internal datastructures.\n row = Arrays.copyOf(row, row.length);\n Bytes.setInt(row, (int) base_time, tsdb.metrics.width());\n tsdb.scheduleForCompaction(row, (int) base_time);\n return base_time;\n }", "public void updateTime()\n {\n lblStatus.setText(\"Up: \" + time);\n\n if (time.getTimeRan() >= 60)\n {\n lblRPM.setText(\"Avg RPM: \"\n + (int) (recoveryAttempts\n / (time.getTimeRan() / 60)));\n ti.setToolTip(\"AR v4 - \"\n + (int) (recoveryAttempts\n / (time.getTimeRan() / 60)) + \" rpm\");\n }\n }", "public static String[] makeRelativeTimes(int[] timeIndices,\n float timeInc) {\n\n GregorianCalendar utcCalendar =\n new GregorianCalendar(TimeZone.getTimeZone(\"GMT\"));\n String currentDate = null;\n String times = null;\n List timesList = new ArrayList();\n\n Date now = new Date();\n int minInc = (int) (60 * timeInc);\n int minutes = minInc % 60;\n int hours = minInc / 60;\n utcCalendar.setTime(now);\n int curHour = utcCalendar.get(utcCalendar.HOUR_OF_DAY);\n int curMin = utcCalendar.get(utcCalendar.MINUTE);\n // normalize for time inc\n // int diff = curHour- (curHour / timeInc) * timeInc; \n /*\n int diff = curHour % hourInc;\n // System.err.println(\"cur hour:\" + curHour + \" diff:\" + diff);\n utcCalendar.add(utcCalendar.HOUR_OF_DAY, -diff);\n */\n int hdiff = (hours == 0)\n ? 0\n : curHour % hours;\n int mdiff = (minutes == 0)\n ? curMin\n : curMin % minutes;\n // System.err.println(\"cur hour:\" + curHour + \" diff:\" + hdiff);\n // System.err.println(\"cur min:\" + curMin + \" diff:\" + mdiff);\n utcCalendar.add(utcCalendar.HOUR_OF_DAY, -hdiff);\n utcCalendar.add(utcCalendar.MINUTE, -mdiff);\n now = utcCalendar.getTime();\n for (int i = 0; i < timeIndices.length; i++) {\n //Reset the date to now.\n utcCalendar.setTime(now);\n //Go back timeIndices*increment hours\n //utcCalendar.add(utcCalendar.HOUR_OF_DAY,\n // -timeIndices[i] * hourInc);\n utcCalendar.add(utcCalendar.MINUTE, -timeIndices[i] * minInc);\n int newMin = utcCalendar.get(utcCalendar.MINUTE);\n int newHour = utcCalendar.get(utcCalendar.HOUR_OF_DAY);\n int newDay = utcCalendar.get(utcCalendar.DAY_OF_YEAR);\n int newYear = utcCalendar.get(utcCalendar.YEAR);\n String thisDate = \"\" + newYear + StringUtil.padZero(newDay, 3);\n //Do we have a new day\n if ( !Misc.equals(currentDate, thisDate)) {\n if (currentDate != null) {\n //if not the first time through then add it to the list\n timesList.add(makeDateUrl(currentDate, times.toString()));\n }\n currentDate = thisDate;\n times = \"\";\n }\n\n //Append the time \n if (times.length() > 0) {\n times = times + \",\";\n }\n times = times + newHour + \":\" + StringUtil.padZero(newMin, 2);\n }\n\n //add the last one to the list\n if (currentDate != null) {\n timesList.add(makeDateUrl(currentDate, times));\n }\n\n return (String[]) timesList.toArray(new String[timesList.size()]);\n\n }", "public abstract double sensingTime();", "void setTime(){\n gTime += ((float)millis()/1000 - millisOld)*(gSpeed/4);\n if(gTime >= 4) gTime = 0;\n millisOld = (float)millis()/1000;\n }", "public abstract double calculateStartTime();", "private void updateTime(){\n currentTime = System.currentTimeMillis();\n float tp = previousTime;\n previousTime = (float)(currentTime - startingTime);\n dt = previousTime - tp;\n fps = 1000f/dt;\n }", "private long getTimeIni(ArrayList<Point> r, ArrayList<Point> s){\n\t\t// Get the trajectory with latest first point\n\t\tlong t1 = s.get(0).timeLong > r.get(0).timeLong ? \n\t\t\t\ts.get(0).timeLong : r.get(0).timeLong;\n\t\treturn t1;\n\t}", "public void startUpdate(){ \n stimer.getTimer().scheduleAtFixedRate(new TimerTask()\n {\n @Override\n public void run(){updateShareRates();}\n }, 2000, 1000);\n }", "public void updateGameTime() {\n\t\tGameTime = Timer.getMatchTime();\n\t}", "private void updateTimer (float time){\n\t\tsecs = (long)(time/1000);\n\t\tmins = (long)((time/1000)/60);\n\t\thrs = (long)(((time/1000)/60)/60);\n\t\t\n\t\t/* Convert the seconds to String \n\t\t * and format to ensure it has\n\t\t * a leading zero when required\n\t\t */\n\t\tsecs = secs % 60;\n\t\tseconds=String.valueOf(secs);\n \tif(secs == 0){\n \t\tseconds = \"00\";\n \t}\n \tif(secs <10 && secs > 0){\n \t\tseconds = \"0\"+seconds;\n \t}\n \t\n\t\t/* Convert the minutes to String and format the String */\n \t\n \tmins = mins % 60;\n\t\tminutes=String.valueOf(mins);\n \tif(mins == 0){\n \t\tminutes = \"00\";\n \t}\n \tif(mins <10 && mins > 0){\n \t\tminutes = \"0\"+minutes;\n \t}\n\t\t\n \t/* Convert the hours to String and format the String */\n \t\n \thours=String.valueOf(hrs);\n \tif(hrs == 0){\n \t\thours = \"00\";\n \t}\n \tif(hrs <10 && hrs > 0){\n \t\thours = \"0\"+hours;\n \t}\n \t \t\n\t\t/* Setting the timer text to the elapsed time */\n\t\t((TextView)findViewById(R.id.timer)).setText(hours + \":\" + minutes + \":\" + seconds);\n\t}", "public void ResetDailyData(long _new_ref_time) {\n reference_time = _new_ref_time;\n\n last_acc_timestamp = 0;\n last_gyro_timestamp = 0;\n\n last_acc_x = 0;\n last_gyro_x = 0;\n\n velocity_x = 0;\n angle_z = 0;\n\n DailyDistanceCoveredFw = 0;\n DailyDistanceCoveredBw = 0;\n DailyAngleCoveredR = 0;\n DailyAngleCoveredL = 0;\n\n acc_data_counter = 0;\n gyro_data_counter = 0;\n\n acc_data_counter_calibration = 0;\n gyro_data_counter_calibration = 0;\n\n //TODO: verificare se serve resettare anche questi\n HourlyAngleCovered = 0;\n HourlyDistanceCovered = 0;\n\n\n //TODO: verificare se sia eventualmente necessario azzerare il tutto\n if (false) {\n for (int i = 0; i < NUM_OF_SAMPLES; i++) {\n AccXDataArray[i] = 0;\n AccYDataArray[i] = 0;\n AccZDataArray[i] = 0;\n\n GyroXDataArray[i] = 0;\n GyroYDataArray[i] = 0;\n GyroZDataArray[i] = 0;\n\n AccTimestampArray[i] = 0;\n GyroTimestampArray[i] = 0;\n }\n }\n }", "private void handleUpdateTimeMessage() {\n invalidate();\n if (shouldTimerBeRunning()) {\n long timeMs = System.currentTimeMillis();\n long delayMs = INTERACTIVE_UPDATE_RATE_MS - (timeMs % INTERACTIVE_UPDATE_RATE_MS);\n mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);\n }\n }", "private void handleUpdateTimeMessage() {\n invalidate();\n if (shouldTimerBeRunning()) {\n long timeMs = System.currentTimeMillis();\n long delayMs = INTERACTIVE_UPDATE_RATE_MS\n - (timeMs % INTERACTIVE_UPDATE_RATE_MS);\n mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);\n }\n }", "private void handleUpdateTimeMessage() {\n invalidate();\n if (shouldTimerBeRunning()) {\n long timeMs = System.currentTimeMillis();\n long delayMs = INTERACTIVE_UPDATE_RATE_MS\n - (timeMs % INTERACTIVE_UPDATE_RATE_MS);\n mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);\n }\n }", "private void handleUpdateTimeMessage() {\n invalidate();\n if (shouldTimerBeRunning()) {\n long timeMs = System.currentTimeMillis();\n long delayMs = INTERACTIVE_UPDATE_RATE_MS\n - (timeMs % INTERACTIVE_UPDATE_RATE_MS);\n mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);\n }\n }", "private void handleUpdateTimeMessage() {\n invalidate();\n if (shouldTimerBeRunning()) {\n long timeMs = System.currentTimeMillis();\n long delayMs = INTERACTIVE_UPDATE_RATE_MS\n - (timeMs % INTERACTIVE_UPDATE_RATE_MS);\n mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);\n }\n }", "private void handleUpdateTimeMessage() {\n invalidate();\n if (shouldTimerBeRunning()) {\n long timeMs = System.currentTimeMillis();\n long delayMs = INTERACTIVE_UPDATE_RATE_MS\n - (timeMs % INTERACTIVE_UPDATE_RATE_MS);\n mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs);\n }\n }", "abstract protected void refresh(long time);", "private void updateTimeDF(double time){\n\t\tif(visits.size()>1 && departureTimes.get(0)==-1.0){\n\t\t\tdepartureTimes.set(0, Math.max(0,time));\n\t\t}\n\t\t\n\t\t// Update the timings for all other visits\n\t\tfor(int i=1; i<visits.size(); i++){\n\t\t\t// Check if we have information to set a new departure time for a locked visit\n\t\t\tif(locked.get(i) && departureTimes.get(i)==-1 && i<visits.size()-1){\n\t\t\t\tdepartureTimes.set(i, Math.max(Math.max(arrivalTimes.get(i),time),visits.get(i).getTwStart()));\n\t\t\t}\n\t\t\t\n\t\t\t// If the visit is not locked, it's arrival time must be updated\n\t\t\tif(!locked.get(i)){\n\t\t\t\tdouble travelTime = visits.get(i-1).getDistance(visits.get(i))/speed;\n\t\t\t\tarrivalTimes.set(i, departureTimes.get(i-1)+travelTime);\n\t\t\t\t\n\t\t\t\tif(i<visits.size()-1){ // Do we know where to go after the visit?\n\t\t\t\t\tdepartureTimes.set(i, Math.max(arrivalTimes.get(i),visits.get(i).getTwStart()));\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\tif(i==visits.size()-1){ // If we are at the last visit, wait\n\t\t\t\tdepartureTimes.set(i, -1.0);\n\t\t\t}\n\t\t}\t\t\n\t}", "public static void updateCalendar() {\n time = Calendar.getInstance();\n hour = time.get(Calendar.HOUR_OF_DAY);\n minute = time.get(Calendar.MINUTE);\n day = time.get(Calendar.DAY_OF_MONTH);\n month = time.get(Calendar.MONTH) + 1; \n year = time.get(Calendar.YEAR);\n\n }", "private void updateTimeTxtV()\n {\n String timeFormat =\"hh:mm aaa\";//12:08 PM\n SimpleDateFormat stf = new SimpleDateFormat(timeFormat, Locale.CANADA);\n timeStr = stf.format(cal.getTime());\n timeTxtV.setText(timeStr);\n\n //unix datetime for saving in db\n dateTimeUnix = cal.getTimeInMillis() / 1000L;\n }", "public void updateChangedTime(int hour, int minute);", "public void setTimeInNs(long r1) {\n /*\n // Can't load method instructions: Load method exception: bogus opcode: 00e7 in method: android.location.GpsClock.setTimeInNs(long):void, dex: \n */\n throw new UnsupportedOperationException(\"Method not decompiled: android.location.GpsClock.setTimeInNs(long):void\");\n }", "public static void update() \r\n {\r\n lastTime = currentTime; \r\n currentTime = getTime(); \r\n }", "private void updateRecordingTime() {\n if (!mMediaRecorderRecording) {\n return;\n }\n long now = SystemClock.uptimeMillis();\n mCurrentRecordedDuration = now - mRecordingStartTime;\n\n mProgressView.setProgress(mRecordedDuration + mCurrentRecordedDuration);\n\n mHandler.sendEmptyMessageDelayed(\n UPDATE_RECORD_TIME, 10);\n }", "protected void speedRefresh() {\r\n\t\t\ttStartTime = System.currentTimeMillis();\r\n\t\t\ttDownloaded = 0;\r\n\t\t}", "double getTransitAltitude(Coordinates coord, long time) throws AstrometryException;", "Date getUpdateTime();", "private void switchTimeBase()\n {\n currentFrame.size = 0L;\n currentFrame.completeTimeMs = -1L;\n currentFrame.timestamp = -1L;\n prevFrame.copy(currentFrame);\n }", "long getTsUpdate();", "private void updateUI() {\n if (mCurrentLocation != null) {\n mLatitudeTextView.setText(String.valueOf(mCurrentLocation.getLatitude()));\n mLongitudeTextView.setText(String.valueOf(mCurrentLocation.getLongitude()));\n mLastUpdateTimeTextView.setText(mLastUpdateTime);\n\n localLatitude = Double.parseDouble(mLatitudeTextView.getText().toString());\n localLongtitude = Double.parseDouble(mLongitudeTextView.getText().toString());\n double newDistance = Math.round(gps2m(previousLatitude, previousLongitude, localLatitude, localLongtitude) * 100) / 100.0;\n\n /*\n if (!mStartUpdatesButton.isEnabled()) {\n mMoveTextView.setText(String.valueOf(newDistance) + \" m\");\n totalDistance += newDistance;\n\n mTotalDistanceTextView.setText(String.valueOf(totalDistance) + \"m\");\n }\n previousLatitude = localLatitude != 0 ? localLatitude : previousLongitude;\n previousLongitude = localLongtitude != 0 ? localLongtitude : previousLatitude;\n\n\n if (!mStartUpdatesButton.isEnabled()) {\n double speed = Double.parseDouble(timeToSpeed());\n\n timeslots.add(System.currentTimeMillis());\n userspeeds.add((float) speed);\n float randomspeed = (float)Math.random()*6;\n compspeeds.add(randomspeed);\n mSpeedTextView.setText(String.valueOf(speed) + \"km/h\");\n\n //TODO: change weight\n double calValue = calorieCalculator(weight, timeSingleValue / 3600, speed);\n calValue = Math.round(calValue * 100) / 100;\n calValue = calValue < 0 ? 0 : calValue;\n calValue = calValue > 100 ? 100 : calValue;\n calValue = calValue / 1000;\n mCalTextView.setText(String.valueOf(calValue));\n compDistance += 5*randomspeed/3600*1000;\n int predictedCalories = (int) Math.round((calValue / timeSingleValue)) * 3600;\n mCalPredictTextView.setText(String.valueOf(predictedCalories));\n\n\n if (compDistance > totalDistance) {\n if (status == 0 || status == 1) {\n MediaPlayer mediaPlayer1 = MediaPlayer.create(getApplicationContext(), R.raw.tooslow);\n mediaPlayer1.start();\n status = 2;\n }\n } else {\n if (status == 0 || status == 2) {\n MediaPlayer mediaPlayer2 = MediaPlayer.create(getApplicationContext(), R.raw.toofast);\n mediaPlayer2.start();\n status = 1;\n }\n }\n }\n */\n if (!mStartUpdatesButton.isEnabled()) {\n mMoveTextView.setText(String.valueOf(newDistance) + \" m\");\n totalDistance += newDistance;\n double totalDistanceOutput = Math.round(totalDistance * 100) / 100.0;\n totalDistanceOutput = totalDistanceOutput < 0 ? 0 : totalDistanceOutput;\n mTotalDistanceTextView.setText(String.valueOf(totalDistanceOutput) + \"m\");\n }\n previousLatitude = localLatitude != 0 ? localLatitude : previousLongitude;\n previousLongitude = localLongtitude != 0 ? localLongtitude : previousLatitude;\n if (!mStartUpdatesButton.isEnabled()) {\n double speed = Double.parseDouble(timeToSpeed());\n timeslots.add(System.currentTimeMillis());\n userspeeds.add((float) speed);\n float randomspeed = (float) Math.random() * 2;\n compspeeds.add(randomspeed);\n mSpeedTextView.setText(String.valueOf(speed) + \" km/h\");\n double calValue = calorieCalculator(weight, timeSingleValue / 3600, speed);\n calValue = calValue < 0 ? 0 : calValue;\n calValue = calValue > 100 ? 100 : calValue;\n calValue = calValue / 1000.0 * 60;\n calValue = Math.round(calValue * 100) / 100.0;\n mCalTextView.setText(String.valueOf(calValue) + \" kCal/m\");\n compDistance += 5 * randomspeed / 3600 * 1000;\n double predictedCalories = (calValue / timeSingleValue) * 60;\n predictedCalories = (predictedCalories < 0 || predictedCalories > 100000) ? 0 : predictedCalories;\n mCalPredictTextView.setText(\"~ \" + String.valueOf(predictedCalories) + \" kCal\");\n\n if (compDistance > totalDistance) {\n if (status == 0 || status == 1) {\n MediaPlayer mediaPlayer1 = MediaPlayer.create(getApplicationContext(), R.raw.tooslow);\n mediaPlayer1.start();\n status = 2;\n }\n } else {\n if (status == 0 || status == 2) {\n MediaPlayer mediaPlayer2 = MediaPlayer.create(getApplicationContext(), R.raw.toofast);\n mediaPlayer2.start();\n status = 1;\n }\n }\n }\n }\n }", "public void timer() {\r\n date.setTime(System.currentTimeMillis());\r\n calendarG.setTime(date);\r\n hours = calendarG.get(Calendar.HOUR_OF_DAY);\r\n minutes = calendarG.get(Calendar.MINUTE);\r\n seconds = calendarG.get(Calendar.SECOND);\r\n //Gdx.app.debug(\"Clock\", hours + \":\" + minutes + \":\" + seconds);\r\n\r\n buffTimer();\r\n dayNightCycle(false);\r\n }", "public void update() {\r\n\t\tlabel.setText(time / 60 + \":\" + ((time % 60 <= 9)? (\"0\" + time % 60) : (time % 60)));\r\n\t}", "void setTime() {\n\t\tCalendar now = Calendar.getInstance();\n\t\tangleHours = (270 + 30 * now.get(now.HOUR) + now.get(now.MINUTE) / 2 ) % 360;\n\t\tangleMinutes = (270 + 6 * now.get(now.MINUTE)) % 360;\n\t\tangleSeconds = (270 + 6 * now.get(now.SECOND)) % 360;\n\t}", "private void advanceTime(){\n\t minute++;\n\t while (minute > 59) {\n\t minute -= 60;\n\t hour++;\n\t }\n\t while (hour > 23) {\n\t hour -= 24;\n\t day++;\n\t }\n\t while (day > 6) {\n\t day -= 7;\n\t }\n\n\t }", "private void updateRegisters() {\r\n // calendar = elapsed + delta\r\n Calendar c = Calendar.getInstance();\r\n c.setTimeInMillis(platform.getMasterClock().getTotalElapsedTimePs() / MasterClock.PS_PER_MS + deltaMs);\r\n\r\n // Convert calendar to registers\r\n setRegistersFromCalendar(c);\r\n }", "@Override\r\n\tpublic void run() {\r\n\t\ttimer = new Timer();\r\n\t\ttimer.schedule(new TimerTask() {\r\n\t\t\t@Override\r\n public void run() {\r\n Main.myIntegratedSensorSuite.reinitializeRainData();\r\n }\r\n\t\t}, 0, 20000); //runs once initially then again every 20 seconds\r\n\t}", "private void updateDelta() {\r\n // Convert registers to calendar\r\n Calendar c = getCalendarFromRegisters();\r\n\r\n // delta = calendar - elapsed\r\n deltaMs = c.getTimeInMillis() - platform.getMasterClock().getTotalElapsedTimePs() / MasterClock.PS_PER_MS;\r\n }", "private void reactMain_region_digitalwatch_Display_refreshing_RefreshingChrono() {\n\t\tif (sCIButtons.topLeftPressed) {\n\t\t\tnextStateIndex = 1;\n\t\t\tstateVector[1] = State.$NullState$;\n\n\t\t\ttimer.unsetTimer(this, 3);\n\n\t\t\ttimer.setTimer(this, 2, 1 * 1000, false);\n\n\t\t\tsCIDisplay.operationCallback.refreshTimeDisplay();\n\n\t\t\tsCIDisplay.operationCallback.refreshDateDisplay();\n\n\t\t\tnextStateIndex = 1;\n\t\t\tstateVector[1] = State.main_region_digitalwatch_Display_refreshing_RefreshingTime_timeView_hideAlarm;\n\t\t} else {\n\t\t\tif (timeEvents[3]) {\n\t\t\t\tnextStateIndex = 1;\n\t\t\t\tstateVector[1] = State.$NullState$;\n\n\t\t\t\ttimer.unsetTimer(this, 3);\n\n\t\t\t\ttimer.setTimer(this, 3, 250, false);\n\n\t\t\t\tsCIDisplay.operationCallback.refreshChronoDisplay();\n\n\t\t\t\tsCILogicUnit.operationCallback.getChrono();\n\n\t\t\t\tnextStateIndex = 1;\n\t\t\t\tstateVector[1] = State.main_region_digitalwatch_Display_refreshing_RefreshingChrono;\n\t\t\t}\n\t\t}\n\t}", "protected synchronized void updateTimestamp() {\n\t\ttimestamp = System.currentTimeMillis();\n\t}", "@Override\n public void onSuccess(Location location) {\n if (location != null) {\n currentLocation = new float[]{(float)location.getLatitude(),(float)location.getLongitude()};\n\n Task<String> timeTask = getExtraTime(p.latOfPerson,p.lonOfPerson);\n if(timeTask!=null){\n timeTask.addOnCompleteListener(new OnCompleteListener<String>() {\n @Override\n public void onComplete(@NonNull Task<String> task) {\n if(task.isSuccessful()){\n String[] s = task.getResult().split(\",\");\n extraTime.setText(\"\"+((-Integer.parseInt(s[1])+Integer.parseInt(s[0])+Integer.parseInt(s[3]))/60)+\" Minutes Extra\");\n }\n }\n });\n }\n }\n }", "public void reapet(int interval) {\n Calendar calendar = Calendar.getInstance();\n calendar.setTimeInMillis(System.currentTimeMillis());\n defineAlartRepeat(calendar, interval, AlarmManager.ELAPSED_REALTIME_WAKEUP);\n }", "@Override\n\tpublic Date timeAdjust() throws ParseException {\n\t\treturn null;\n\t}", "@Override\n\tpublic Date timeAdjust() throws ParseException {\n\t\treturn null;\n\t}", "double getFullTime();", "private void updateSpeed(CLocation location) {\n try {\n\n i = i + 1;\n Log.i(\"111\", \"====updateSpeed=====i===\" + i);\n // Log.i(\"111\",\"====location=====getLongitude===\"+location.getLongitude());\n // Log.i(\"111\",\"====location=====getLatitude===\"+location.getLatitude());\n\n\n float nCurrentSpeed = 0;\n\n if (location != null) {\n location.setUseMetricunits(true);\n nCurrentSpeed = location.getSpeed();\n }\n\n Formatter fmt = new Formatter(new StringBuilder());\n fmt.format(Locale.US, \"%5.1f\", nCurrentSpeed);\n String strCurrentSpeed = fmt.toString();\n strCurrentSpeed = strCurrentSpeed.replace(' ', '0');\n\n String strUnits = \"miles/hour\";\n\n\n strLog = strLog +\n \"\\n--------------\\n \" +\n strCurrentSpeed + \" \" + strUnits +\n \"\\n--------------\\n \";\n\n tvData.append(\"\\n Speed2 = \" + strCurrentSpeed + \" \" + strUnits);\n\n /* float speed = Float.parseFloat(strCurrentSpeed);\n if(speed<100)\n mGaugeView.setTargetValue(speed);\n else\n {\n tvLog.setText(\"out of speed\"+strLog);\n }*/\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "public synchronized void rotateStatus()\n\t{\n\t\tlong now = System.currentTimeMillis();\n\n\t\tlong thisHour = now / 3600000L;\n\t\tlong lastHour = lastRotate / 3600000L;\n\n\t\tif (thisHour == lastHour)\n\t\t\t; // Do nothing\n\t\telse if (thisHour != lastHour)\n\t\t{\n\t\t\tif (thisHour == lastHour + 1)\n\t\t\t{\n\t\t\t\tmsgsLastHourHigh = msgsThisHourHigh;\n\t\t\t\tmsgsThisHourHigh = 0;\n\t\t\t\tfilesSentLastHourHigh = filesSentThisHourHigh;\n\t\t\t\tfilesSentThisHourHigh = 0;\n\t\t\t\tmsgsLastHourMedium = msgsThisHourMedium;\n\t\t\t\tmsgsThisHourMedium = 0;\n\t\t\t\tfilesSentLastHourMedium = filesSentThisHourMedium;\n\t\t\t\tfilesSentThisHourMedium = 0;\n\t\t\t\tmsgsLastHourLow = msgsThisHourLow;\n\t\t\t\tmsgsThisHourLow = 0;\n\t\t\t\tfilesSentLastHourLow = filesSentThisHourLow;\n\t\t\t\tfilesSentThisHourLow = 0;\n\t\t\t}\n\t\t\telse // more than 1 hour elapsed.\n\t\t\t{\n\t\t\t\tmsgsLastHourHigh = 0;\n\t\t\t\tmsgsThisHourHigh = 0;\n\t\t\t\tfilesSentLastHourHigh = 0;\n\t\t\t\tfilesSentThisHourHigh = 0;\n\t\t\t\tmsgsLastHourMedium = 0;\n\t\t\t\tmsgsThisHourMedium = 0;\n\t\t\t\tfilesSentLastHourMedium = 0;\n\t\t\t\tfilesSentThisHourMedium = 0;\n\t\t\t\tmsgsLastHourLow = 0;\n\t\t\t\tmsgsThisHourLow = 0;\n\t\t\t\tfilesSentLastHourLow = 0;\n\t\t\t\tfilesSentThisHourLow = 0;\n\t\t\t}\n\n\t\t\tlong thisDay = thisHour / 24;\n\t\t\tlong lastDay = lastHour / 24;\n\n\t\t\tif (thisDay != lastDay)\n\t\t\t{\n\t\t\t\tif (thisDay == lastDay + 1)\n\t\t\t\t{\n\t\t\t\t\tmsgsYesterdayHigh = msgsTodayHigh;\n\t\t\t\t\tmsgsTodayHigh = 0;\n\t\t\t\t\tfilesSentYesterdayHigh = filesSentTodayHigh;\n\t\t\t\t\tfilesSentTodayHigh = 0;\n\t\t\t\t\tmsgsYesterdayMedium = msgsTodayMedium;\n\t\t\t\t\tmsgsTodayMedium = 0;\n\t\t\t\t\tfilesSentYesterdayMedium = filesSentTodayMedium;\n\t\t\t\t\tfilesSentTodayMedium = 0;\n\t\t\t\t\tmsgsYesterdayLow = msgsTodayLow;\n\t\t\t\t\tmsgsTodayLow = 0;\n\t\t\t\t\tfilesSentYesterdayLow = filesSentTodayLow;\n\t\t\t\t\tfilesSentTodayLow = 0;\n\t\t\t\t}\n\t\t\t\telse // More than 1 day elapsed.\n\t\t\t\t{\n\t\t\t\t\tmsgsYesterdayHigh = 0;\n\t\t\t\t\tmsgsTodayHigh = 0;\n\t\t\t\t\tfilesSentYesterdayHigh = 0;\n\t\t\t\t\tfilesSentTodayHigh = 0;\n\t\t\t\t\tmsgsYesterdayMedium = 0;\n\t\t\t\t\tmsgsTodayMedium = 0;\n\t\t\t\t\tfilesSentYesterdayMedium = 0;\n\t\t\t\t\tfilesSentTodayMedium = 0;\n\t\t\t\t\tmsgsYesterdayLow = 0;\n\t\t\t\t\tmsgsTodayLow = 0;\n\t\t\t\t\tfilesSentYesterdayLow = 0;\n\t\t\t\t\tfilesSentTodayLow = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlastRotate = now;\n\t}", "private void renewTimes() {\n String time_morgens_new = time_prefs.getString(\"time_morgens\", getResources().getString(R.string.default_morgens));\n String time_mittags_new = time_prefs.getString(\"time_mittags\", getResources().getString(R.string.default_mittags));\n String time_abends_new = time_prefs.getString(\"time_abends\", getResources().getString(R.string.default_abends));\n String time_zur_nacht_new = time_prefs.getString(\"time_morgens\", getResources().getString(R.string.default_morgens));\n /*comparison of class local time variblaes with new Preferences\n deletes alarms affected medicines and creates new alarms for them\n */\n\n if (!time_morgens.equals(time_morgens_new)) {\n //list all affected Meds and iterate for each\n List<Meds> meds = Meds.find(Meds.class, \"time = ?\", \"Morgens\");\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n cancelAlarm(m.getId());\n }\n }\n\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n createAlarm(m.getDays(), m.getTime(), m.getId());\n }\n }\n }\n\n if (!time_mittags.equals(time_mittags_new)) {\n List<Meds> meds = Meds.find(Meds.class, \"time = ?\", \"Mittags\");\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n cancelAlarm(m.getId());\n }\n }\n\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n createAlarm(m.getDays(), m.getTime(), m.getId());\n }\n }\n }\n if (!time_abends.equals(time_abends_new)) {\n List<Meds> meds = Meds.find(Meds.class, \"time = ?\", \"Abends\");\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n cancelAlarm(m.getId());\n }\n }\n\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n createAlarm(m.getDays(), m.getTime(), m.getId());\n }\n }\n }\n if (!time_zur_nacht.equals(time_zur_nacht_new)) {\n List<Meds> meds = Meds.find(Meds.class, \"time = ?\", \"Morgens\");\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n cancelAlarm(m.getId());\n }\n }\n\n for (Meds m : meds) {\n if (!m.getDays().equals(\"\")) {\n createAlarm(m.getDays(), m.getTime(), m.getId());\n }\n }\n }\n }", "public static void advanceTimeTo(long millis) {\n\t\tClock clock = Clock.systemUTC();\n\t\tDuration offset = Duration.ofMillis(millis - clock.millis());\n\t\tTime.setClock(Clock.offset(clock, offset));\n\t}", "public void update()\n {\n // always roatating time by 7 for fixed point calculation\n x = (velocity*cos(theta) *time) >> 21;\n int yFirstPart = (int)(velocity*sin(theta)*time) >> 21;\n int ySecondPart = (int)((g*time*time) >> 15);\n y = yFirstPart - ySecondPart;\n y =initialY - y;\n x= x + initialX;\n time+= updateSpeed;\n if(lastY == -1)\n {\n lastY = y;\n }else{\n int direction = lastY - y;\n if(lastDirection == -1)\n {\n lastDirection = direction;\n }else{\n if(lastDirection != 0 && direction != 0)\n {\n \n int signOfDirection = lastDirection / Math.abs(lastDirection);\n int signOfLastDirection = direction / Math.abs(direction);\n if(signOfDirection != signOfLastDirection)\n {\n if(!reachedTop)\n {\n onTop();\n reachedTop = true;\n }\n \n setIsOnHalf(true);\n }\n }\n lastY = y;\n }\n \n }\n }", "public boolean calculate(long newTimestamp, float eventValues0 , float eventValues1, int newRotation) {\n final float xSmallRotateTH = 0.05f;\n //xSmallRotateTH indicating the threshold of max \"small\n //rotation\". This varible is determined by experiments\n //based on MT6575 platform. May be adjusted on other chips.\n float valueToUse = 0;\n if (mOrientation != newRotation) {\n // orientation has changed, reset calculations\n mOrientation = newRotation;\n mValue = 0;\n angle[0] = 0;\n angle[1] = 0;\n angle[2] = 0;\n mFirstTime = true;\n }\n switch (mOrientation) {\n case Surface.ROTATION_0:\n valueToUse = eventValues1;\n break;\n case Surface.ROTATION_90:\n // no need to re-map\n valueToUse = eventValues0;\n break;\n case Surface.ROTATION_180:\n // we do not have this rotation on our device\n valueToUse = -eventValues1;\n break;\n case Surface.ROTATION_270:\n valueToUse = -eventValues0;\n break;\n default:\n valueToUse = eventValues0;\n }\n mValue = valueToUse + OFFSET;\n if (timestamp != 0 && Math.abs(mValue) > TH) {\n final float dT = (newTimestamp - timestamp) * NS2S;\n\n angle[1] += mValue * dT * 180 / Math.PI;\n if (mFirstTime) {\n angle[0] = angle[1] - BASE_ANGLE;\n angle[2] = angle[1] + BASE_ANGLE;\n mFirstTime = false;\n } else if (angle[1] <= angle[0]) {\n angle[0] = angle[1];\n angle[2] = angle[0] + 2 * BASE_ANGLE;\n } else if (angle[1] >= angle[2]) {\n angle[2] = angle[1];\n angle[0] = angle[2] - 2 * BASE_ANGLE;\n }\n }\n float mAngle ;\n if (timestamp != 0 && QuickContactBadgeEx.mCount != 0) {\n mAngle = angle[1] - angle[0];\n } else {\n mAngle = UNUSABLE_ANGLE_VALUE;\n }\n timestamp = newTimestamp;\n \n if (mAngle != UNUSABLE_ANGLE_VALUE) {\n return onGyroPositionChanged(mAngle);\n } else { \n return false;\n }\n }", "public abstract void update(float time);", "TemporalService accountingForTransmissionTime();", "public double getRotRms() {\n\t\treturn 3600.0 * Math.sqrt(1000.0 * rotInt / (double) (updateTimeStamp - startTime));\n\t}", "private void Calculation() {\n\t\tint calStd = jetztStunde + schlafStunde;\n\t\tint calMin = jetztMinute + schlafMinute;\n\n\t\ttotalMin = calMin % 60;\n\t\ttotalStunde = calStd % 24 + calMin / 60;\n\n\t}", "void update(String time);", "private void alignRefreshInterval() {\n int totalCampaignDuration = 0;\n int externalCampaignDuration = 0;\n for (int i=0; i<tozAdCampaign.size(); i++) {\n totalCampaignDuration += tozAdCampaign.get(i).mAdDuration;\n if (i >= numInternalChildren) externalCampaignDuration += tozAdCampaign.get(i).mAdDuration;\n }\n AppyAdService.getInstance().debugOut(TAG,\"Current ad campaign has external ad duration of \"+externalCampaignDuration+\". Total total campaign duration is \"+totalCampaignDuration);\n\n if ((tozAdCampaignRetrievalInterval != null) && (tozAdCampaignRetrievalInterval > 0)) {\n int minRefresh = Math.max(totalCampaignDuration,AppyAdService.getInstance().MINIMUM_REFRESH_TIME);\n if (tozAdCampaignRetrievalInterval < minRefresh) {\n AppyAdService.getInstance().debugOut(TAG,\"Adjusting refresh interval upward to \"+minRefresh);\n tozAdCampaignRetrievalInterval = minRefresh;\n }\n if (tozAdCampaignRetrievalInterval > AppyAdService.getInstance().MAXIMUM_REFRESH_TIME) {\n AppyAdService.getInstance().debugOut(TAG,\"Adjusting refresh interval downward to \"+AppyAdService.getInstance().MAXIMUM_REFRESH_TIME);\n tozAdCampaignRetrievalInterval = AppyAdService.getInstance().MAXIMUM_REFRESH_TIME;\n }\n }\n }", "public void resetChronometer (View v){\n\n\n chronometer.setBase(SystemClock.elapsedRealtime());\n tempTime = totalTime;\n totalTime = 0;\n dateEnd = new Date();\n addTimer();\n grantTickets();\n\n\n\n }", "@Override\n\t\tpublic void onLocationChanged(Location args0) {\n\t\t\t mCurrentLocation = args0;\n\t mLastUpdateTime = DateFormat.getTimeInstance().format(new Date());\n\t updateUI();\n\n\t\t}", "public void update() {\n if (System.currentTimeMillis() >= currSampleTimeInMillis + sampleDuration) {\n lastSampleTimeInMillis = currSampleTimeInMillis;\n lastPositionInTicks = currPositionInTicks;\n currSampleTimeInMillis = System.currentTimeMillis();\n currPositionInTicks = motor.getCurrentPosition();\n }\n }", "public static void updateTimers() {\n\t\tfor (NameAndCaller nac : clocks.keySet().toArray(EMPTY_NAMEANDCALLER_ARRAY)) {\n\t\t\tif (hasExpired(nac.getName(), nac.getCaller())) {\n\t\t\t\tTimeable t = nac.getCaller();\n\t\t\t\tt.handleTimer(nac.getName());\n\t\t\t\tcancel(nac.getName(), nac.getCaller());\n\t\t\t}\n\t\t}\n\t}", "public void onPositionChanged() {\n\n latPeriodic = location.getLatitude();\n lonperiodic = location.getLongitude();\n\n }", "public void update(LocationStructure vehicleLocation, Date recordedAtTime) {\n\t\tif(locations.size()>1) {\n\t\t\tLocationStructure tail = locations.peekLast(); \n\t\t\ttraveledSoFar += calculateDistance(vehicleLocation.getLatitude().doubleValue(), vehicleLocation.getLongitude().doubleValue(), tail.getLatitude().doubleValue(), tail.getLongitude().doubleValue());\n\t\t}\n\t\tlocations.addLast(vehicleLocation);\n\t\ttimes.addLast(recordedAtTime);\n\t\tif(times.size()>K) {\n\t\t\tlocations.removeFirst();\n\t\t\ttimes.removeFirst();\t\t\n\t\t\taverageSpeed.removeFirst();\n\t\t}\n\t\tupdatePointSpeeds();\n\t\tcalculateAvgSpeed();\t \n\t}", "private void computeRotate() {\n time = Math.min(\n duration,\n time + MaterialWeatherView.WeatherAnimationImplementor.REFRESH_INTERVAL);\n rotationNow = (rotationEnd - rotationStart) * (1 - Math.pow(1 - 1.0 * time / duration, 2 * FACTOR))\n + rotationStart;\n if (time == duration) {\n // finish.\n rotating = false;\n }\n }", "@Override\n public void calculateTimeAndDist(String result) {\n //Create a calendar instance.\n Calendar date = Calendar.getInstance();\n long t = date.getTimeInMillis();\n\n String pattern = \"HH:mm\";\n\n // Create an instance of SimpleDateFormat used for formatting\n // the string representation of date according to the chosen pattern\n DateFormat df = new SimpleDateFormat(pattern);\n\n //Split the result returned by the Geotask.\n String res[] = result.split(\",\");\n// Double min = Double.parseDouble(res[0]) / 60;\n\n //Get the distance.\n Double dist = Double.parseDouble(res[1]) / 1000;\n\n\n //Get time to dest based on user's speed.\n Double d = Double.valueOf(dist);\n Double s = Double.valueOf(getAverageSpeed());\n int timeToDest = (int) ((d / s) * 60);\n\n //Add timeToDest to current time\n Date afterAddingTimeToDest = new Date(t + (timeToDest * ONE_MINUTE_IN_MILLIS));\n String todayAsString = df.format(afterAddingTimeToDest.getTime());\n\n //Set arrival txt to estimate arrival time.\n arrivalTxt.setText(todayAsString);\n\n }", "protected void apply(float interpolatedTime) {\n\t}", "@Override\r\n\tpublic void updateVariables(GregorianCalendar currentTime, Weather weather,\r\n\t\t\tint resolution) {\n\t}", "public void update(int time);", "void processScanCoordinates(List<Long> scanTimeStampList, String scanType){\n List<LatLng> scanCoordinates = new ArrayList<>();\n System.out.println(\"LENGTH BEFOREEEE\" + scanTimeStampList.size() + scanType);\n for(int i = 0; i < stepTimeStamp.size()-1;i++){\n long upperTimeBound = stepTimeStamp.get((i+1));\n long lowerTimeBound = stepTimeStamp.get(i);\n List<Integer> scanIndexWithinStep = new ArrayList<>();\n //Searches through the list of timestamps and adds the scan numbers that fall within the step to a list\n for(int j = 0; j < scanTimeStampList.size();j++){\n if(scanTimeStampList.get(j) <= upperTimeBound && scanTimeStampList.get(j)> lowerTimeBound){\n scanIndexWithinStep.add(j);\n }\n }\n if(scanIndexWithinStep.size()>0) {\n //Can loop through them as they will be sequential\n for (int k = scanIndexWithinStep.get(0); k <= scanIndexWithinStep.get(scanIndexWithinStep.size() - 1); k++) {\n //Run the algorithm for each scan that falls within the time range for each step\n double tempLat;\n double tempLong;\n //Formula from Dr. Zheng's paper\n // i here represents the number of steps as the index number in adaptiveTimeList is the step number\n if (xIncreasing) {\n tempLat = startLat + STEP_LENGTH * (i + (double) (scanTimeStampList.get(k) - lowerTimeBound) / (double) (upperTimeBound - lowerTimeBound)) * yCompMotion * degToMRatio;\n } else {\n tempLat = startLat - STEP_LENGTH * (i + (double) (scanTimeStampList.get(k) - lowerTimeBound) / (double) (upperTimeBound - lowerTimeBound)) * yCompMotion * degToMRatio;\n }\n if (yIncreasing) {\n tempLong = startLong + STEP_LENGTH * (i + (double) (scanTimeStampList.get(k) - lowerTimeBound) / (double) (upperTimeBound - lowerTimeBound)) * xCompMotion * degToMRatio;\n } else {\n tempLong = startLong - STEP_LENGTH * (i + (double) (scanTimeStampList.get(k) - lowerTimeBound) / (double) (upperTimeBound - lowerTimeBound)) * xCompMotion * degToMRatio;\n }\n scanCoordinates.add(new LatLng(tempLat, tempLong));\n }\n }\n\n }\n System.out.println(\"LENGTHHHH AFTER\" + scanCoordinates.size() + scanType);\n if(scanType == \"mag\"){\n magCoords = scanCoordinates;\n }\n else if(scanType == \"gyro\"){\n gyroCoords = scanCoordinates;\n }\n else if(scanType == \"accel\"){\n accelCoords = scanCoordinates;\n }\n else if(scanType == \"blue\"){\n blueGlobalCoords = scanCoordinates;\n }\n else if(scanType == \"red\"){\n redGlobalCoords = scanCoordinates;\n }\n }", "protected void processTimer(){\n if(timer != null){\n timer.cancel();\n timer = null;\n }\n // Verificamos si el partido esta en progreso\n if(match.status == Match.STATUS_PENDING || match.status == Match.STATUS_ENDED){\n return;\n }\n // Creamos temporizador 90 * 60 * 1000 = 5.400.000\n timer = new CountDownTimer(5400000, 1000) {\n @Override\n public void onTick(long l) {\n // Calcular los segundos que pasaron\n long seconds = (new Date().getTime() - matchDayLong) / 1000;\n // Calcular los minutos del partido\n long minutes = seconds / 60;\n //long minutes = TimeUnit.MILLISECONDS.toMinutes(uptime);\n if(minutes < 0){\n minutes = 0;\n seconds = 0;\n statusMedium.setText(\"PT\");\n }if(minutes > 45 && minutes < 60){\n minutes = 45;\n seconds = 60;\n }else if(minutes > 90){\n minutes = 90;\n seconds = 60;\n statusMedium.setText(\"ST\");\n }else if(minutes >= 60){\n minutes -= 15;\n statusMedium.setText(\"ST\");\n }else{\n statusMedium.setText(\"PT\");\n }\n\n statusTime.setText(String.format(\"%02d:%02d\", minutes, (seconds%60)));\n }\n\n @Override\n public void onFinish() {\n\n }\n }.start();\n }", "public void realTimeUpdate() {\n if ( millis() - lastTime >= 60000 ) {\n // *Load all_hour data\n eqData.init(hourURL);\n eqData.update(hour);\n println( \"all_hour data updated!\" );\n isHour = true;\n lastTime = millis();\n }\n}", "public void startTracking()\n\t{\n\t\tthisRoute.timeStart = System.currentTimeMillis();\n\t\t\n\t\tlocationManager.requestLocationUpdates(provider, gpsTimeFreq, 0, locListener);\n\t}", "private void startPeriodicUpdates() {\n\n\t\tmLocationClient.requestLocationUpdates(mLocationRequest, this);\n\t\tmConnectionState.setText(R.string.location_requested);\n\t}", "public double getTime(int timePt);", "@Override\n public void periodic() {\n m_odometry.update(\n Rotation2d.fromDegrees(m_gyro.getAngle()),\n new SwerveModulePosition[] {\n m_frontLeft.getPosition(),\n m_frontRight.getPosition(),\n m_rearLeft.getPosition(),\n m_rearRight.getPosition()\n });\n }", "public void updateGrade() throws SimulationStopException{\r\n /*if(realtime){\r\n double[] pos1 = gps.getPos();\r\n \r\n double []pos2 = gps.getPos();\r\n double product = (6378100)*Math.PI/18000;\r\n grade = (pos1[2]-pos2[2])/\r\n Math.sqrt(Math.pow((pos1[1]-pos2[1])*product,2) +\r\n Math.pow((pos1[0]-pos2[0])*product,2));\r\n }*/\r\n if(time.isRunning()){\r\n\r\n try {\r\n \t//calculate grade\r\n \tif(index!=0){\r\n grade = ((roadData[altIndex][index] - roadData[altIndex][index-1])/\r\n (roadData[distIndex][index] - roadData[distIndex][index-1]));\r\n \t}\r\n \r\n // calculate orientation (used for wind and turns)\r\n /* Understandable version...\r\n * product = 60/0.5399555*1000\r\n *\r\n * distLat = (tempLat - lat)*product;\r\n * distLon = (tempLon - lon)*product*Math.cos((tempLat + lat)/2*Math.PI/180);\r\n * carAngle = atan(distLon/distLat) + PI/2\r\n * */\r\n \r\n carAngle = Math.atan((roadData[lonIndex][index]-roadData[lonIndex][index+1])\r\n \t\t*Math.cos((roadData[latIndex][index]+roadData[latIndex][index+1])/2*Math.PI/180)/\r\n (roadData[latIndex][index]-roadData[latIndex][index+1])) + Math.PI/2;\r\n while(carAngle>Math.PI*2){\r\n \tcarAngle-=Math.PI*2;\r\n }\r\n\r\n index++;\r\n segsLeft--;\r\n // if we hit a control point, stop for ctrlTimeLength seconds of time\r\n if(roadData[distIndex][index]>ctrlPts[ctrlIndex]&&ctrlIndex<=ctrlPts.length){\r\n time.ctrlPointHit(ctrlTimeLength);\r\n System.out.println(\"Control Point: \" + roadData[distIndex][index]);\r\n ctrlIndex++;\r\n }\r\n }\r\n catch (IndexOutOfBoundsException e) {\r\n throw new SimulationStopException(\"Simulation stopped at control point \"+ctrlIndex);\r\n // Is this message right!?\r\n }\r\n }\r\n }", "public PulseTransitTime() {\n currPTT = 0.0;\n hmPeakTimes = new ArrayList<>();\n //maf = new MovingAverage(WINDOW_SIZE);\n }", "public void setARRIVAL_AT_LOC_TIME(java.sql.Time value)\n {\n if ((__ARRIVAL_AT_LOC_TIME == null) != (value == null) || (value != null && ! value.equals(__ARRIVAL_AT_LOC_TIME)))\n {\n _isDirty = true;\n }\n __ARRIVAL_AT_LOC_TIME = value;\n }", "private void updateTimeStamp() {\n\t\tthis.timeStamp = new Timestamp(System.currentTimeMillis());\n\t}", "public void actualiser(){\n try{\n \t\n /* Memo des variables : horaireDepart tableau de string contenant l'heure de depart entree par l'user\n * heure = heure saisie castee en int, minutes = minutes saisie castee en Integer\n * tpsRest = tableau de string contenant la duree du cours en heure entree par l'user\n * minutage = format minutes horaire = format heure, ils servent a formater les deux variables currentTime qui recuperent l'heure en ms\n * tempsrestant = variable calculant le temps restant en minutes, heurerestante = variable calculant le nombre d'heure restantes\n * heureDuree = duree du cours totale en int minutesDuree = duree totale du cours en minute\n * tempsfinal = temps restant reel en prenant en compte la duree du cours\n * angle = temps radian engleu = temps en toDegrees\n */\n String[] horaireDepart = Reader.read(saisie.getText(), this.p, \"\\\\ \");\n \n //on check si le pattern est bon et si l'utilisateur n'est pas un tard\n if(Reader.isHour(horaireDepart)){\n \t\n int heure = Integer.parseInt(horaireDepart[0]);\n int minutes = Integer.parseInt(horaireDepart[2]);\n minutes += (heure*60);\n String[] tpsrest = Reader.read(format.getText(), this.p, \"\\\\ \");\n \n //conversion de la saisie en SimpleDateFormat pour les calculs\n SimpleDateFormat minutage = new SimpleDateFormat (\"mm\");\n SimpleDateFormat Horaire = new SimpleDateFormat (\"HH\");\n \n //recupere l'heure en ms\n Date currentTime_1 = new Date(System.currentTimeMillis());\n Date currentTime_2 = new Date(System.currentTimeMillis());\n \n //cast en int pour les calculs\n int tempsrestant = Integer.parseInt(minutage.format(currentTime_1));\n int heurerestante = Integer.parseInt(Horaire.format(currentTime_2))*60;\n tempsrestant += heurerestante;\n \n //pareil mais pour la duree\n if(Reader.isHour(tpsrest)){\n int heureDuree = Integer.parseInt(tpsrest[0]);\n int minutesDuree = Integer.parseInt(tpsrest[2]);\n minutesDuree += (heureDuree*60);\n tempsrestant -= minutes;\n int tempsfinal = minutesDuree - tempsrestant;\n \n //conversion du temps en angle pour l'afficher \n double angle = ((double)tempsfinal*2/(double)minutesDuree)*Math.PI;\n int engleu = 360 - (int)Math.toDegrees(angle);\n for(int i = 0; i < engleu; i++){\n this.panne.dessineLine(getGraphics(), i);\n }\n \n //conversion du temps en pi radiant pour l'affichage\n if(tempsfinal < minutesDuree){\n tempsfinal *= 2;\n for(int i = minutesDuree; i > 1; i--){\n if(tempsfinal % i == 0 && minutesDuree % i == 0){\n tempsfinal /= i;\n minutesDuree /= i;\n }\n }\n }\n \n //update l'affichage\n this.resultat.setText(tempsfinal + \"/\" + minutesDuree + \"π radiant\");\n this.resultat.update(this.resultat.getGraphics());\n }\n }\n }catch(FormatSaisieException fse){\n this.resultat.setText(fse.errMsg(this.p.toString()));\n }\n }", "private void UpdateTimeLines(RadioPlayer player)\n {\n String start = player.getStartTime();\n String end = player.getEndTime();\n\n //Not live, playing mp3 file. Calc progress from file progress instead\n if (isAdded()) {\n if (player.getUrl() != getString(R.string.url_live_radio)) {\n float pct = player.getProgress();\n int duration = player.getDuration();\n timeline.setProgress(pct);\n smallTimeLine.setProgress(pct);\n timeLineSeekBar.setProgress(pct);\n\n //start and end times\n int past = (int) (pct * duration);\n int left = duration - past;\n\n int s0 = (int) (past / 1000) % 60;\n int m0 = (int) ((past / (1000 * 60)) % 60);\n int s1 = (int) (left / 1000) % 60;\n int m1 = (int) ((left / (1000 * 60)) % 60);\n\n String elapsed = String.format(\"%02d\", m0) + \":\" + String.format(\"%02d\", s0);\n String remaining = \"-\" + String.format(\"%02d\", m1) + \":\" + String.format(\"%02d\", s1);\n\n startTimeLabel.setText(elapsed);\n endTimeLabel.setText(remaining);\n\n return;\n }\n }\n\n Date now = new Date();\n SimpleDateFormat sdfr = new SimpleDateFormat(\"HH:mm\");\n Date curr = DateUtils.timeStringToDate(sdfr.format(now));\n\n Date startDate = DateUtils.timeStringToDate(start);\n Date endDate = DateUtils.timeStringToDate(end);\n\n startTimeLabel.setText(start);\n endTimeLabel.setText(end);\n\n if(startDate != null && endDate != null && curr != null)\n {\n long t0 = startDate.getTime();\n long t1 = endDate.getTime();\n long t = curr.getTime();\n\n float duration = t1 - t0;\n float time = t - t0;\n\n //if(duration == 0)\n if(Math.signum(duration) == 0)\n {\n timeline.setProgress(0);\n smallTimeLine.setProgress(0);\n timeLineSeekBar.setProgress(0);\n }\n\n float pct = time/duration;\n\n //TODO: If we've reached pct = 1 (or something like 0.9999), then start checking for new live content\n //Log.i(\"PS\", \"UpdateTimeLines, pct: \"+pct);\n /*\n if(player.isLive())\n {\n Log.i(\"PS\",\"Live radio @ \"+pct);\n if(pct >= 1.0 && liveReloadCallback == null)//!isLoadingNewContent)\n {\n //isLoadingNewContent = true;//Set to false on backend respons IF content is updated\n reloadBroadcastData();\n }\n }\n */\n\n timeline.setProgress(pct);\n smallTimeLine.setProgress(pct);\n timeLineSeekBar.setProgress(pct);\n }\n }", "public String[] getStarDate2(){\n\t\tstardate = new String[3];\n\t\t\n\t\tCalendar originaldate = Calendar.getInstance(TimeZone.getTimeZone(\"gmt\"));\n\t\tCalendar instancedate = Calendar.getInstance(TimeZone.getTimeZone(\"gmt\"));\n\t\t\t\t\n\t\t//originaldate.set(2008, 8, 8, 0, 0, 0);\n\t\toriginaldate.set(2162, 0, 4, 0, 0, 0);\n\t\t\n\t\t/*instancedate.add(Calendar.HOUR, 7);\n\t\tinstancedate.add(Calendar.MINUTE, 33);\n\t\tinstancedate.add(Calendar.YEAR, 156);\n\t\tinstancedate.add(Calendar.HOUR, -6*24);\n\t\tinstancedate.add(Calendar.MONTH, -3);*/\n\t\t\n\t\t\n\t\t// Get the represented date in milliseconds\n\t\tlong milis1 = originaldate.getTimeInMillis();\n\t\tlong milis2 = instancedate.getTimeInMillis();\n\t\t\n\t\t// Calculate difference in milliseconds\n\t\tlong diff = milis2 - milis1;\n\t\t \n\t\t// Calculate difference in seconds\n\t\tlong diffSeconds = diff / 1000;\n\t\t \n\t\t// Calculate difference in minutes\n\t\t//long diffMinutes = diff / (60 * 1000);\n\t\t\n\t\t// Calculate difference in hours\n\t\t//long diffHours = diff / (60 * 60 * 1000);\n\t\t\n\t\t// Calculate difference in days\n\t\t//long diffDays = diff / (24 * 60 * 60 * 1000);\n\t\t\n\t\t//double dec = -280000 - ((double)diffSeconds / 17280.0f);\n\t\tdouble dec = ((double)diffSeconds / 17280.0f);\n\t\t\t\t\n\t\tint mantel = (int)Math.ceil(dec/10000.0f);\n\t\t\t\t\n\t\tdouble kropp = (dec + (-(mantel-1)*10000.0f));\n\t\t\n\t\tif(kropp >= 10000) mantel += 2; //Fixing rounding error\n\t\t\n\t\tdouble mantelkropp = ((mantel-1) * 10000.0f) - kropp;\n\t\t\n\t\t/*Log.v(TAG, \"Diff: \" + Long.toString(diff));\n\t\t\n\t\tLog.v(TAG, \"Diff: \" + Double.toString(dec));\n\t\t\n\t\tLog.v(TAG, \"Diff: \" + Integer.toString(mantel));\n\t\t\n\t\tLog.v(TAG, \"Diff: \" + Double.toString(kropp));\n\t\t\n\t\tLog.v(TAG, \"Diff: \" + Double.toString(mantelkropp));*/\n\t\t\n\t\tdec = mantelkropp;\n\t\t\n\t\tDecimalFormat maxDigitsFormatter;\n\t\tif(dec < 0)\n\t\t\tmaxDigitsFormatter = new DecimalFormat(\"#000000.0000\");\n\t\telse\n\t\t\tmaxDigitsFormatter = new DecimalFormat(\"0000000.0000\");\n \n try {\n\t stardate[0] = \"[\" + (maxDigitsFormatter.format(dec)).substring(0, 3) + \"]\";\n\t stardate[1] = \" 0\" + (maxDigitsFormatter.format(dec)).substring(3, 9);\n\t stardate[2] = \"\" + (maxDigitsFormatter.format(dec)).substring(9, 11);\n } catch(StringIndexOutOfBoundsException sbe) {\n \tif(DEBUG) Log.v(TAG, \"Could not format \" + sbe);\n \tif(DEBUG) Log.v(TAG, maxDigitsFormatter.format(dec));\n \tstardate[2] = \"--\"; \t \n }\n \n Log.v(TAG, \"Stardate: \" + stardate[0] + stardate[1] + stardate[2]);\n return stardate;\n\t\t\n\t}", "private void adjustStarData()\n\t{\n\t\tfor(int i = 0; i < starList.size(); i++)\n\t\t{\n\t\t\tStar aStar = starList.get(i);\n\t\t\tdouble rightAsc = aStar.getRA();\n\t\t\tdouble hourAngle = theCalculator.findHourAngle(rightAsc, userLocalTime);\n\t\t\taStar.setHourAngle(hourAngle);\n\t\t\tstarList.set(i, aStar);\n\t\t}\n\t}" ]
[ "0.54394275", "0.529834", "0.52802837", "0.5279336", "0.5237708", "0.51971745", "0.5106491", "0.5067023", "0.5041878", "0.50321215", "0.50101745", "0.4984988", "0.4976201", "0.49618334", "0.49429533", "0.4941119", "0.49383688", "0.4912497", "0.48919067", "0.4886182", "0.48852503", "0.48604608", "0.48494983", "0.48133966", "0.48133442", "0.48130247", "0.48064357", "0.4805421", "0.4797406", "0.47953275", "0.47953275", "0.47953275", "0.47953275", "0.47953275", "0.4792762", "0.4788721", "0.47857192", "0.47830668", "0.47761893", "0.47559562", "0.47499225", "0.47397694", "0.47386366", "0.47303006", "0.47302172", "0.47165883", "0.46856374", "0.46681353", "0.46633855", "0.46562177", "0.46536285", "0.46530423", "0.4638884", "0.46386918", "0.46375567", "0.46339896", "0.46216103", "0.46198508", "0.46151167", "0.46134743", "0.46134743", "0.46127605", "0.46098796", "0.46076414", "0.4603137", "0.45945048", "0.45939586", "0.45875326", "0.45850882", "0.45843685", "0.4578326", "0.4577083", "0.45754588", "0.45723653", "0.45675424", "0.45639482", "0.4558988", "0.45550737", "0.45505863", "0.45501095", "0.45451993", "0.45445696", "0.45382568", "0.45368937", "0.4535828", "0.45278883", "0.45276204", "0.4525078", "0.4523807", "0.45198622", "0.4519078", "0.45187175", "0.45106944", "0.45050403", "0.4493602", "0.44933614", "0.4492321", "0.4491173", "0.44882026", "0.4483788" ]
0.73244864
0
Returns the local time stamp. This is the value of the local system clock and obtained using System.currentTimeMillis().
public long getTimestamp() { return timestamp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public final long getLocalTimeStamp()\n {\n return getTimeStamp( TimeZone.getDefault());\n }", "public static LocalTime localTimeNow() {\n return TimeService.localTimeNow();\n }", "public static LocalTime UTCTimeNow() {\n return TimeService.UTCTimeNow();\n }", "public static Date getLocalUTCTime(){\r\n\t\tfinal Calendar cal=Calendar.getInstance();\r\n\t\tfinal int zoneOffset=cal.get(Calendar.ZONE_OFFSET);\r\n\t\tfinal int dstOffset=cal.get(Calendar.DST_OFFSET);\r\n\t\tcal.add(Calendar.MILLISECOND, -(zoneOffset+dstOffset));\r\n\t\treturn cal.getTime();\r\n\t}", "public static LocalDateTime localTimeDateNow() {\n return TimeService.localTimeDateNow();\n }", "public LocalDateTime getCurrentTime() {\n return clock.instant().atZone(ZoneId.systemDefault()).toLocalDateTime();\n }", "private String getcurrentTimeStamp() {\n\t\tDateTimeFormatter format = DateTimeFormatter\n\t\t\t\t.ofPattern(RidGeneratorPropertyConstant.TIMESTAMP_FORMAT.getProperty());\n\t\treturn LocalDateTime.now().format(format);\n\t}", "public String getSystemTime() {\n return DateFormat.getDateTimeInstance().format(new Date().getTime());\n }", "public static LocalDateTime getUtcNow() {\n return getNow().toLocalDateTime();\n }", "private long timeNow()\n {\n // The value of 3506716800000000L is the BAT as at midnight on\n // 1-Jan-1970, which is the base of the time that the system\n // gives us. It has to be adjusted for leap seconds though.\n return (System.currentTimeMillis() * 1000L) + DUTC.get() * 1000000L + 3506716800000000L;\n }", "public java.lang.String getTimeStamp(){\r\n return localTimeStamp;\r\n }", "private LocalDateTime nowLocalDateTime() {\n\t\tInstant instantNow = Instant.ofEpochMilli( System.currentTimeMillis() );\n\t\tLocalDateTime nowLocalDateTime = instantNow.atOffset(ZoneOffset.UTC).toLocalDateTime();\n\t\treturn nowLocalDateTime;\n\t}", "public static String fn_GetCurrentTimeStamp() {\n\t\tDate dte = new Date();\n\t\tDateFormat df = DateFormat.getDateTimeInstance();\n\t\tString strdte = df.format(dte);\n\t\tstrdte = strdte.replaceAll(\":\", \"_\");\n\t\treturn strdte;\n\t}", "public long getCurrentTimeMillis() {\n return System.currentTimeMillis();\n }", "public static String getCurrentTime() {\r\n\t\tDate date = new Date();\r\n\t\treturn date.toString();\r\n\t}", "public static String getCurrentTime()\n\t{\n\t\treturn getTime(new Date());\n\t}", "LocalTime getTime();", "public static String timestamp()\n\t{\n\t\t/**\n\t\t * Get the current time formatted as HH:mm:ss.\n\t\t */\t\t\n\t\treturn new SimpleDateFormat(\"HH:mm:ss\").format(new Date());\n\t}", "public static long getTime() {\r\n\t\treturn System.currentTimeMillis();\r\n\t}", "public static LocalTime hawaiiLocalTimeNow() {\n return TimeService.hawaiiLocalTimeNow();\n }", "public long getCurrentSystemTime() {\n return getSystemTime() - startSystemTimeNano;\n }", "public static LocalDateTime now(){\n return LocalDateTime.now();\n }", "public static Timestamp getNowTimestamp()\n {\n return new Timestamp(System.currentTimeMillis());\n }", "public int getSystemTime() {\n\t\treturn this.systemTime;\n\t}", "private static long getCurrentTime() {\n return (new Date()).getTime();\n }", "public long now() {\n return System.currentTimeMillis();\n }", "public String getCurrentTime() {\r\n DateTimeFormatter dtf = DateTimeFormatter.ofPattern(\"dd/MM/yyyy HH:mm:ss\"); //https://www.javatpoint.com/java-get-current-date\r\n LocalDateTime now = LocalDateTime.now();\r\n return dtf.format(now);\r\n }", "public static Timestamp getNowTimestamp() {\n return new Timestamp(System.currentTimeMillis());\n }", "protected long getCurrentTime() {\n return System.currentTimeMillis();\n }", "private String getCurrentTimestamp() {\n\n String mytime = java.text.DateFormat.getTimeInstance().format(Calendar.getInstance().getTime());\n String mydate =java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime());\n return mytime;\n }", "long getCurrentTimeMs() {\n return System.currentTimeMillis();\n }", "public static long time() {\n return date().getTime();\n }", "private static String currentTimestamp()\r\n {\n \r\n long currentTime = System.currentTimeMillis();\r\n sCalendar.setTime(new Date(currentTime));\r\n \r\n String str = \"\";\r\n str += sCalendar.get(Calendar.YEAR) + \"-\";\r\n \r\n final int month = sCalendar.get(Calendar.MONTH) + 1;\r\n if (month < 10)\r\n {\r\n str += 0;\r\n }\r\n str += month + \"-\";\r\n \r\n final int day = sCalendar.get(Calendar.DAY_OF_MONTH);\r\n if (day < 10)\r\n {\r\n str += 0;\r\n }\r\n str += day;\r\n \r\n str += \"T\";\r\n \r\n final int hour = sCalendar.get(Calendar.HOUR_OF_DAY);\r\n if (hour < 10)\r\n {\r\n str += 0;\r\n }\r\n str += hour + \":\";\r\n \r\n final int minute = sCalendar.get(Calendar.MINUTE);\r\n if (minute < 10)\r\n {\r\n str += 0;\r\n }\r\n str += minute + \":\";\r\n \r\n final int second = sCalendar.get(Calendar.SECOND);\r\n if (second < 10)\r\n {\r\n str += 0;\r\n }\r\n str += second + \".\";\r\n \r\n final int milli = sCalendar.get(Calendar.MILLISECOND);\r\n str += milli;\r\n \r\n str += \"Z\";\r\n \r\n return str;\r\n }", "public static long getSystemTime () {\n\n ThreadMXBean bean = ManagementFactory.getThreadMXBean();\n return bean.isCurrentThreadCpuTimeSupported()?\n (bean.getCurrentThreadCpuTime() - bean.getCurrentThreadUserTime()): 0L;\n }", "public static String getCurrentTimeStamp(){\n try {\n\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n\n // Find todays date\n String currentDateTime = dateFormat.format(new Date());\n\n return currentDateTime;\n } catch (Exception e) {\n e.printStackTrace();\n\n return null;\n }\n }", "public static String currentTimestamp()\n {\n \n long currentTime = System.currentTimeMillis();\n sCalendar.setTime(new Date(currentTime));\n \n String str = \"\";\n str += sCalendar.get(Calendar.YEAR) + \"-\";\n \n final int month = sCalendar.get(Calendar.MONTH) + 1;\n if (month < 10)\n {\n str += 0;\n }\n str += month + \"-\";\n \n final int day = sCalendar.get(Calendar.DAY_OF_MONTH);\n if (day < 10)\n {\n str += 0;\n }\n str += day;\n \n str += \"T\";\n \n final int hour = sCalendar.get(Calendar.HOUR_OF_DAY);\n if (hour < 10)\n {\n str += 0;\n }\n str += hour + \":\";\n \n final int minute = sCalendar.get(Calendar.MINUTE);\n if (minute < 10)\n {\n str += 0;\n }\n str += minute + \":\";\n \n final int second = sCalendar.get(Calendar.SECOND);\n if (second < 10)\n {\n str += 0;\n }\n str += second + \".\";\n \n final int milli = sCalendar.get(Calendar.MILLISECOND);\n str += milli;\n \n str += \"Z\";\n \n return str;\n }", "public static long getSystemTime( ) {\n ThreadMXBean bean = ManagementFactory.getThreadMXBean( );\n return bean.isCurrentThreadCpuTimeSupported( ) ?\n (bean.getCurrentThreadCpuTime( ) - bean.getCurrentThreadUserTime( )) : 0L;\n\n }", "public String getNow() {\n\t\treturn new Date().toString();\n\t}", "public String getTimeStamp()\n\t{\n\t\tString timeStamp = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\").format(Calendar.getInstance().getTime());\n\t\treturn timeStamp; \n\t}", "public String generateLocalDateTime() {\n LocalDateTime localDateTime = LocalDateTime.now();\n DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(\"yyyyMMddHHmmss\");\n String formatLocalDateTime = localDateTime.format(dateTimeFormatter);\n return formatLocalDateTime;\n }", "public static String timestamp() {\n\t\tString t = new SimpleDateFormat(\"yyyy-MM-dd HH-mm-ss\").format(new Date());\n\t\t// File f=new\n\t\t// File(String.format(\"%s.%s\",t,RandomStringUtils.randomAlphanumeric(8)));\n\t\tSystem.out.println(\"Time is :\" + t);\n\t\treturn t;\n\t}", "public static String getTimestamp() {\r\n\t\t\r\n\t\treturn new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\r\n\t}", "public static String getTimestamp() {\n\t\tCalendar cal = Calendar.getInstance();\n\t\t//define the format of time stamp\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n\t\treturn sdf.format(cal.getTime());\n\n\t}", "public long getSystemStartTime() {\n return (this.systemStartTime);\n }", "public static LocalTime TAITimeNow() {\n return TimeService.TAITimeNow();\n }", "long getCurrentDateTimeMillis() {\n return System.currentTimeMillis();\n }", "public static long now() {\n return System.nanoTime();\n }", "private long getSystemTime() {\n ThreadMXBean bean = ManagementFactory.getThreadMXBean();\n return bean.isCurrentThreadCpuTimeSupported() ? (bean.getCurrentThreadCpuTime() - bean.getCurrentThreadUserTime()) : 0L;\n }", "public static final String CurrentTime() {\n\t\t\n\t\tfinal SimpleDateFormat DF = new SimpleDateFormat(\"HH:mm:ss\");\n\t\treturn DF.format(new Date());\n\t}", "public Timestamp getCurrentDbTimestamp() {\n LOG.warn(\"getCurrentDbTimestamp(): Using local system timestamp.\");\n return new Timestamp(System.currentTimeMillis());\n }", "public static float getCurrentTime(){\n return (float)(System.currentTimeMillis()-t0)/1000.0f;\r\n }", "long getCurrentTimeMs();", "public float getCurrentTime()\r\n\t{\r\n\t\tcurrenttime = Calendar.getInstance();\r\n\t\treturn currenttime.getTimeInMillis();\r\n\t}", "public java.lang.String getSystemlogtime () {\n\t\treturn systemlogtime;\n\t}", "static long getDateTime(){\n return System.currentTimeMillis();\n }", "public long getTimeStamp() {\n return 1370918376296L;\n }", "public static String getCurrentMillisecondTime()\n\t{\n\t\treturn getMillisecondTime(new Date());\n\t}", "private long now() {\n\treturn System.currentTimeMillis();\n }", "public static String getDateTime() {\n Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(\"UTC\"));\n Date currentLocalTime = cal.getTime();\n SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSS\");\n df.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\n String date = df.format(currentLocalTime);\n return date;\n }", "public static String getNowTime(){\r\n\t\tDate date = new Date();\r\n\t\tDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\r\n\t\tString time = format.format(date);\r\n\t\treturn time;\r\n\t}", "private static String getTimeStamp()\r\n\t{\r\n\t\tDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd_HH.mm.ss\");\r\n\t\tDate date = new Date();\r\n\t\treturn dateFormat.format(date);\r\n\t}", "public static long getUserTime () {\n\n ThreadMXBean bean = ManagementFactory.getThreadMXBean();\n return bean.isCurrentThreadCpuTimeSupported()?\n bean.getCurrentThreadUserTime(): 0L;\n }", "public static String getTime() {\r\n\r\n\t\t//Gets current date and time\r\n\t\tDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\r\n\t\tDate date = new Date();\r\n\t\tcurrDateTime = dateFormat.format(date);\r\n\t\treturn currDateTime;\r\n\t}", "private static String getStamp() {\n\t\t\t return new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\r\n\t\t}", "private String getTimestamp() {\n return Calendar.getInstance().getTime().toString();\n }", "public static String getCurrentTime(){\n Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(\"Asia/Singapore\"));\n Date currentDate = calendar.getTime();\n return currentDate.toString();\n }", "public long getCurrentDate() {\n\t\treturn LocalDate.now().atStartOfDay(ZONE).toInstant().toEpochMilli();\n\t}", "public Date getCurrentTime() {\r\n return currentTime.getTime();\r\n }", "public String getTimeStamp() {\n return new SimpleDateFormat(\"dd.MM.yyyy HH.mm.ss\").format(new Date());\n }", "@ExecFunction(name = \"localtime\", argTypes = {}, returnType = \"DATETIME\")\n public static Expression localTime() {\n return DateTimeLiteral.fromJavaDateType(LocalDateTime.now(DateUtils.getTimeZone()));\n }", "public static LocalDateTime hawaiiLocalTimeDateNow() {\n return TimeService.hawaiiLocalTimeDateNow();\n }", "public static long getUserTime( ) {\n ThreadMXBean bean = ManagementFactory.getThreadMXBean( );\n return bean.isCurrentThreadCpuTimeSupported( ) ?\n bean.getCurrentThreadUserTime( ) : 0L;\n }", "public String getCurrentTime() {\n return currentTime;\n }", "long time() {\r\n\t\treturn System.currentTimeMillis();\r\n\t}", "@Override\n\tpublic long getCurrentTime() {\n\t\treturn 0;\n\t}", "public static long currentTimeInSecond() {\n return Instant.now().getEpochSecond();\n }", "public static String getCurrentDateTime()\n\t{\n\t\treturn getDateTime(new Date());\n\t}", "public long getStartSystemTime() {\r\n return startSystemTime;\r\n }", "@SimpleFunction(description = \"Gets the current time.\"\n + \"It is formatted correctly for iSENSE\")\n public String GetTime() {\n Calendar cal = Calendar.getInstance();\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\");\n return sdf.format(cal.getTime()).toString();\n }", "long getCurrentTime() {\n if (dm == null) {\n return -1;\n }\n return DLockService.getLockTimeStamp(dm);\n }", "public static String getTimeStamp() {\n\t\tDate date = new Date();\n\t\treturn date.toString().replaceAll(\":\", \"_\").replaceAll(\" \", \"_\");\n\n\t}", "private long getUserTime() {\n ThreadMXBean bean = ManagementFactory.getThreadMXBean();\n return bean.isCurrentThreadCpuTimeSupported() ? bean.getCurrentThreadUserTime() : 0L;\n }", "private static String dateFormatLocal(Long timestamp) {\n DateFormat df = dateFormatLocal.get(); \n if (timestamp == null) {\n timestamp = System.currentTimeMillis();\n }\n \n return df.format(new Date(timestamp));\n }", "private String getCurrentTime() {\n DateFormat dateFormat = new SimpleDateFormat(\"dd/MM/yyyy HH:mm:ss\");\n Date date = new Date();\n return dateFormat.format(date);\n }", "public long getSystemTime( ) {\n ThreadMXBean bean = ManagementFactory.getThreadMXBean( );\n return bean.isCurrentThreadCpuTimeSupported( ) ?\n (bean.getCurrentThreadCpuTime( ) - bean.getCurrentThreadUserTime( )) : 0L;\n}", "static long currentNTP(long localOffset) {\n long curr = System.currentTimeMillis() + OFFSET + localOffset;\n // this integer represents milliseconds. Need to move the\n // decimal point between seconds and fraction to pos 31/32\n long secs = curr / 1000L;\n double dFrac = (curr % 1000L) / 1000.0;\n long lfrac = (long) (dFrac * SCALE);\n return (secs << 32) | (lfrac & 0xFFFFFFFFL);\n //TODO: standard recommends filling low-end bits with random data.\n \n }", "public TimeStamp(){\n\t\tdateTime = LocalDateTime.now();\n\t}", "Long timestamp();", "public static String now() {\n return dateTimeFormatZ.format(new Date());\n }", "public static long getCurrentGMTTime() {\n\n\t\tTimeZone timezone = TimeZone.getTimeZone(STANDARD_TIME_ZONE);\n\t\tlong currentTime = System.currentTimeMillis();\n\t\treturn currentTime - timezone.getOffset(currentTime);\n\t}", "public static LocalDateTime UTCDateTimeNow() {\n return TimeService.UTCDateTimeNow();\n }", "public float getCurrentTime()\n\t{\n\t\treturn currentTime;\n\t}", "public static long getTime() \r\n {\r\n return System.nanoTime(); \r\n }", "public static long longTimestamp() {\n return now().getTime();\n }", "public long getCurrentTime() {\n return currentTime;\n }", "public static String getPrintToFileTime() {\n @SuppressLint(\"SimpleDateFormat\") SimpleDateFormat sdf = new SimpleDateFormat(\"yyyyMMdd_HHmmss\");\n return sdf.format(System.currentTimeMillis());\n }", "public static final LocalTime generateOrderTime() {\n return LocalTime.MIN.plusSeconds(RANDOM.nextLong());\n }", "String timeStamp() {\n\n\t\tCalendar now = Calendar.getInstance();\n\n\t\t String y = String.valueOf(now.get(now.YEAR));\n\t\t String mo = String.valueOf(now.get(now.MONTH)+1);\n\t\t String d = String.valueOf(now.get(now.DAY_OF_MONTH));\n\t\t String h = String.valueOf(now.get(now.HOUR_OF_DAY));\n\t\t String m = String.valueOf(now.get(now.MINUTE));\n\t\t String s = String.valueOf(now.get(now.SECOND));\n\t\t String ms = String.valueOf(now.get(now.MILLISECOND));\n\n\n\t return h + m + s + ms;\n\n\n\n }", "public static long getTime() {\n\t\treturn (Sys.getTime() * 1000) / Sys.getTimerResolution();\n\t}", "public Date getTimeNow() {\r\n return timeNow;\r\n }", "public String getTimeStamp() {\n Calendar instance = Calendar.getInstance();\n SimpleDateFormat sdf = new SimpleDateFormat(\"MMM-dd-yyyy-HH:mm:ss:ms\");\n return sdf.format(instance.getTime());\n }" ]
[ "0.8431468", "0.7840413", "0.7391434", "0.7288264", "0.7227305", "0.7178433", "0.7111921", "0.7049369", "0.7047194", "0.69986063", "0.6982459", "0.696252", "0.6948956", "0.69301146", "0.69062823", "0.6891254", "0.6883662", "0.68814236", "0.6845389", "0.6807724", "0.6799665", "0.6769091", "0.6757303", "0.6752733", "0.67506486", "0.67466944", "0.6728853", "0.6728444", "0.672545", "0.6675023", "0.6668369", "0.66613054", "0.66496897", "0.66460645", "0.66127485", "0.6604792", "0.6593603", "0.65814245", "0.6577531", "0.65733707", "0.6566054", "0.65627193", "0.65606904", "0.6555688", "0.65509546", "0.65476996", "0.6543906", "0.6514378", "0.6511031", "0.6509563", "0.6500808", "0.64909565", "0.64853364", "0.6477383", "0.6475992", "0.6474317", "0.6466174", "0.6451895", "0.6451473", "0.64470136", "0.64329374", "0.64307266", "0.6416798", "0.64096725", "0.6398937", "0.6398557", "0.6381683", "0.63773894", "0.63752973", "0.6373379", "0.63665646", "0.63654345", "0.6362246", "0.6359953", "0.6352414", "0.63339394", "0.63310146", "0.63306195", "0.6318792", "0.6311101", "0.63075393", "0.63053507", "0.6295042", "0.6291202", "0.6291136", "0.628563", "0.6264245", "0.62550694", "0.62409097", "0.62357545", "0.62295777", "0.62291646", "0.6229117", "0.6226923", "0.6223692", "0.62234974", "0.62222826", "0.6200914", "0.61944985", "0.6177774", "0.6171976" ]
0.0
-1
DADO QUE POSSUO UMA ARQUIVO DE 10KB E REALIZE A LEITURA PARA UMA LISTA DAS PALAVRAS
private void testePerformaceUtilizandoPesquisaLinear(String arquivo) { leituraDo(arquivo); // QUANDO EU EXECUTAR A PESQUISA LINEAR long tempoInicial = System.currentTimeMillis(); @SuppressWarnings("static-access") int posicaoPalavraPesquisada = algoritimoDePesquisa.pesquisaLinear(leitor.getConjuntoPalavrasArquivo(), "casa"); long tempoFinal = System.currentTimeMillis(); // ENTÃO ELE DEVE ACHAR A PALAVRA CHAVE E DEVO PRINTAR O TEMPO DE EXECUÇÃO NA TELA printResultado(arquivo, "Linear", posicaoPalavraPesquisada,tempoFinal - tempoInicial); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\r\n public void teamListTooLargeTest(){\r\n int tooBigListSize = 15;\r\n\r\n int expectedResult = extractor.extractXDriversOrTeams(tooBigListSize, \"table.msr_season_team_results\", \"td.msr_team\").size();\r\n\r\n assertEquals(\"expected results = \" + expectedResult, expectedResult, extractor.extractXDriversOrTeams(tooBigListSize, \"table.msr_season_team_results\", \"td.msr_team\").size());\r\n System.out.println(\"\");\r\n }", "private static List<Integer> initLista(int tamanho) {\r\n\t\tList<Integer> lista = new ArrayList<Integer>();\r\n\t\tRandom rand = new Random();\r\n\r\n\t\tfor (int i = 0; i < tamanho; i++) {\r\n\t\t\tlista.add(rand.nextInt(tamanho - (tamanho / 10) + 1)\r\n\t\t\t\t\t+ (tamanho / 10));\r\n\t\t}\r\n\t\treturn lista;\r\n\t}", "public List<String>top10Utilizadores() {\n Map<String,List<String>> utilizadorEncomendas = new HashMap<String,List<String>>();\n \n for(Encomenda e : this.encomendas.values()) {\n if(!utilizadorEncomendas.containsKey(e.getCodigoUtilizador())) {\n utilizadorEncomendas.put(e.getCodigoUtilizador(), new ArrayList<>());\n }\n utilizadorEncomendas.get(e.getCodigoUtilizador()).add(e.getCodigoEncomenda());\n }\n \n // a partir do primeiro map criar um segundo com codigo de utilizador e numero de encomendas\n // a razao de ser um double é porque o mesmo comparator é também utilizado no metodo List<String>top10Transportadores()\n Map<String,Double> utilizadoresNumeroEncs = new HashMap<>();\n \n Iterator<Map.Entry<String, List<String>>> itr = utilizadorEncomendas.entrySet().iterator(); \n \n while(itr.hasNext()) { \n Map.Entry<String, List<String>> entry = itr.next(); \n utilizadoresNumeroEncs.put(entry.getKey(), Double.valueOf(entry.getValue().size()));\n }\n \n MapStringDoubleComparator comparator = new MapStringDoubleComparator(utilizadoresNumeroEncs);\n \n // criar map ordenado (descending)\n TreeMap<String, Double> utilizadorNumeroEncsOrdenado = new TreeMap<String, Double>(comparator);\n \n utilizadorNumeroEncsOrdenado.putAll(utilizadoresNumeroEncs);\n \n // retornar a lista de codigos de utilizadores pretendida\n return utilizadorNumeroEncsOrdenado.keySet()\n .stream()\n .limit(10)\n .collect(Collectors.toList()); \n }", "public abstract long getCompleteListSize();", "public long problem2b(){\r\n LinkedList<String> linkList = new LinkedList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n linkList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis();\r\n return end - start; \r\n }", "@Test\r\n public void driverListTooLargeTest(){\r\n int tooBigListSize = 26;\r\n extractor.setElement(\"table.msr_season_driver_results\");\r\n int expectedListSize = extractor.getElement().select(\"td.msr_driver\").size();\r\n \r\n\r\n assertEquals(\"should default to the size of table\", expectedListSize, extractor.extractXDriversOrTeams(tooBigListSize, \"table.msr_season_driver_results\", \"td.msr_driver\" ).size());\r\n\r\n }", "private void testePerformaceUtilizandoPesquisaBinaria(String arquivo) {\n\t\tleituraDo(arquivo);\r\n\t\tleitor.ordenarComSort();\r\n\t\t\r\n\t\t// QUANDO EU EXECUTAR A PESQUISA LINEAR\r\n\t\tlong tempoInicial = System.currentTimeMillis(); \r\n\t\t@SuppressWarnings(\"static-access\")\r\n\t\tint posicaoPalavraPesquisada = algoritimoDePesquisa.pesquisaBinaria(leitor.getConjuntoPalavrasArquivo(), \"casa\");\r\n\t\tlong tempoFinal = System.currentTimeMillis(); \r\n\t\t\r\n\t\t// ENTÃO ELE DEVE ACHAR A PALAVRA CHAVE E DEVO PRINTAR O TEMPO DE EXECUÇÃO NA TELA\r\n\t\tprintResultado(arquivo, \"Binaria\", posicaoPalavraPesquisada,tempoFinal - tempoInicial);\r\n\t}", "private void getLargeOrderList(){\n sendPacket(CustomerTableAccess.getConnection().getLargeOrderList());\n \n }", "public static List<StronaWiersza> pobierzStronaWierszazBazy(StronaWiersza stronaWiersza, String wnma, StronaWierszaDAO stronaWierszaDAO, TransakcjaDAO transakcjaDAO) {\r\n List<StronaWiersza> listaStronaWierszazBazy =new ArrayList<>();\r\n// stare = pobiera tylko w walucie dokumentu rozliczeniowego \r\n// listaNowychRozrachunkow = stronaWierszaDAO.findStronaByKontoWnMaWaluta(stronaWiersza.getKonto(), stronaWiersza.getWiersz().getTabelanbp().getWaluta().getSymbolwaluty(), stronaWiersza.getWnma());\r\n// nowe pobiera wszystkie waluty \r\n listaStronaWierszazBazy = stronaWierszaDAO.findStronaByKontoWnMa(stronaWiersza.getKonto(), wnma);\r\n //stronaWierszaDAO.refresh(listaStronaWierszazBazy);\r\n if (listaStronaWierszazBazy != null && !listaStronaWierszazBazy.isEmpty()) {\r\n try {\r\n DateFormat formatter;\r\n formatter = new SimpleDateFormat(\"yyyy-MM-dd\");\r\n String datarozrachunku = null;\r\n if (stronaWiersza.getWiersz().getDataWalutyWiersza() != null) {\r\n datarozrachunku = stronaWiersza.getWiersz().getDokfk().getRok()+\"-\"+stronaWiersza.getWiersz().getDokfk().getMiesiac()+\"-\"+stronaWiersza.getWiersz().getDataWalutyWiersza();\r\n } else {\r\n datarozrachunku = stronaWiersza.getWiersz().getDokfk().getDatadokumentu();\r\n }\r\n Date dataR = formatter.parse(datarozrachunku);\r\n Iterator it = listaStronaWierszazBazy.iterator();\r\n while(it.hasNext()) {\r\n StronaWiersza stronaWierszaZbazy = (StronaWiersza) it.next();\r\n List<Transakcja> zachowaneTransakcje = transakcjaDAO.findByNowaTransakcja(stronaWierszaZbazy);\r\n for (Iterator<Transakcja> itx = stronaWierszaZbazy.getPlatnosci().iterator(); itx.hasNext();) {\r\n Transakcja transakcjazbazy = (Transakcja) itx.next();\r\n if (zachowaneTransakcje == null || zachowaneTransakcje.size() == 0) {\r\n itx.remove();\r\n } else if (!zachowaneTransakcje.contains(transakcjazbazy)) {\r\n itx.remove();\r\n }\r\n }\r\n for (Transakcja ta : zachowaneTransakcje) {\r\n if (!stronaWierszaZbazy.getPlatnosci().contains(ta)) {\r\n stronaWierszaZbazy.getPlatnosci().add(ta);\r\n }\r\n }\r\n if (Z.z(stronaWierszaZbazy.getPozostalo()) <= 0.0) {\r\n it.remove();\r\n } else {\r\n String dataplatnosci;\r\n if (stronaWierszaZbazy.getWiersz().getDataWalutyWiersza() != null) {\r\n dataplatnosci = stronaWierszaZbazy.getWiersz().getDokfk().getRok()+\"-\"+stronaWierszaZbazy.getWiersz().getDokfk().getMiesiac()+\"-\"+stronaWierszaZbazy.getWiersz().getDataWalutyWiersza();\r\n } else {\r\n dataplatnosci = stronaWierszaZbazy.getWiersz().getDokfk().getDatadokumentu();\r\n }\r\n Date dataP = formatter.parse(dataplatnosci);\r\n if (dataP.compareTo(dataR) > 0) {\r\n it.remove();\r\n }\r\n }\r\n }\r\n } catch (ParseException ex) {\r\n E.e(ex);\r\n }\r\n }\r\n List<StronaWiersza> stronywierszaBO = stronaWierszaDAO.findStronaByKontoWnMaBO(stronaWiersza.getKonto(), stronaWiersza.getWnma());\r\n if (stronywierszaBO != null && !stronywierszaBO.isEmpty()) {\r\n Iterator it = stronywierszaBO.iterator();\r\n while(it.hasNext()) {\r\n StronaWiersza p = (StronaWiersza) it.next();\r\n if (Z.z(p.getPozostalo()) <= 0.0) {\r\n it.remove();\r\n }\r\n }\r\n listaStronaWierszazBazy.addAll(stronywierszaBO);\r\n }\r\n if (listaStronaWierszazBazy == null) {\r\n return (new ArrayList<>());\r\n }\r\n return listaStronaWierszazBazy;\r\n //pobrano wiersze - a teraz z nich robie rozrachunki\r\n }", "public static void Auslesen()\r\n\t{\n\t\tLargeObjectManager lobj;\r\n\t\ttry {\r\n\t\t\tconn= DriverManager.getConnection(DB_URL,USER,PASS);\r\n\t\t\tlobj = ((org.postgresql.PGConnection)conn).getLargeObjectAPI();\r\n\t\t\tPreparedStatement ps = conn.prepareStatement(\"SELECT bild FROM bilder WHERE bild = ?\");\r\n\t\t\tps.setString(1, \"bild2.jpg\");\r\n\t\t\tResultSet rs = ps.executeQuery();\r\n\t\t\twhile (rs.next()) {\r\n\t\t\t // Open the large object for reading\r\n\t\t\t\tString name = rs.getString(1);\r\n\t\t\t int oid = rs.getInt(2);\r\n\t\t\t LargeObject obj = lobj.open(oid, LargeObjectManager.READ);\r\n\r\n\t\t\t // Read the data\r\n\t\t\t byte buf[] = new byte[obj.size()];\r\n\t\t\t obj.read(buf, 0, obj.size());\r\n\t\t\t // Do something with the data read here\r\n\t\t\t \r\n\t\t\t String pfad = \"C:/Temp\";\r\n\t\t\t\tFile file = createFile(pfad, \"bild2.jpg\");\r\n\t\t\t\tFiles.copy(obj.getInputStream(), file.toPath());\r\n\t\t\t\r\n\t\t\t \r\n\t\t\t // Close the object\r\n\t\t\t obj.close();\r\n\t\t\t}\r\n\t\t\trs.close();\r\n\t\t\tps.close();\r\n\t\t} catch (SQLException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\t\r\n\t}", "private List<ItemListaIntegracaoDTO> montarListaInstituicaoIdInstituicaoDTO(List<InstituicaoCooperativaSCIDTO> lista) {\n\t\tList<ItemListaIntegracaoDTO> listaVO = new ArrayList<ItemListaIntegracaoDTO>();\n\n\t\tfor(InstituicaoCooperativaSCIDTO instituicao:lista){\n\t\t\tString cooperativa = instituicao.getNumCooperativa().toString();\n\t\t\tif(instituicao.getNumCooperativa() == 300) {\n\t\t\t\tcooperativa = \"0300\";\n\t\t\t}\n\t\t\tItemListaIntegracaoDTO item = new ItemListaIntegracaoDTO(instituicao.getIdInstituicao().toString(), cooperativa + \" - \" + instituicao.getNome());\n\t\t\tlistaVO.add(item);\n\t\t}\n\t\t\n\t\tCollections.sort(listaVO, new Comparator<ItemListaIntegracaoDTO>() {\n\t\t\tpublic int compare(ItemListaIntegracaoDTO o1, ItemListaIntegracaoDTO o2){\n\t\t\t\t\treturn o1.getCodListaItem().compareTo(o2.getCodListaItem());\n\t\t\t\t} \n\t\t});\n\t\t\n\t\treturn listaVO;\t\t\n\t}", "@Test(timeout = 4000)\n public void test22() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n XSQLVAR[] xSQLVARArray0 = new XSQLVAR[0];\n FBResultSet fBResultSet0 = new FBResultSet(xSQLVARArray0, linkedList0);\n byte[][] byteArray0 = new byte[7][0];\n byte[] byteArray1 = new byte[7];\n byteArray1[0] = (byte) (-111);\n FileSystemHandling.appendLineToFile((EvoSuiteFile) null, \"!3eO>|kx{3s''g6%=\");\n byteArray1[1] = (byte) (-109);\n byteArray1[2] = (byte)31;\n linkedList0.add((byte[][]) null);\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, fBResultSet0);\n fBCachedFetcher0.next();\n fBCachedFetcher0.deleteRow();\n assertTrue(fBCachedFetcher0.isLast());\n }", "public static List<Integer> getIntegerList(){\n List<Integer> nums = new ArrayList<>();//ArrayList<Integer> list = new ArrayList<>();\n for(int i=0;i<=1_000_000;i++) {\n nums.add(i);\n }\n return nums;\n }", "public void listarCarpetas() {\n\t\tFile ruta = new File(\"C:\" + File.separator + \"Users\" + File.separator + \"ram\" + File.separator + \"Desktop\" + File.separator+\"leyendo_creando\");\n\t\t\n\t\t\n\t\tSystem.out.println(ruta.getAbsolutePath());\n\t\t\n\t\tString[] nombre_archivos = ruta.list();\n\t\t\n\t\tfor (int i=0; i<nombre_archivos.length;i++) {\n\t\t\t\n\t\t\tSystem.out.println(nombre_archivos[i]);\n\t\t\t\n\t\t\tFile f = new File (ruta.getAbsoluteFile(), nombre_archivos[i]);//SE ALMACENA LA RUTA ABSOLUTA DE LOS ARCHIVOS QUE HAY DENTRO DE LA CARPTEA\n\t\t\t\n\t\t\tif(f.isDirectory()) {\n\t\t\t\tString[] archivos_subcarpeta = f.list();\n\t\t\t\tfor (int j=0; j<archivos_subcarpeta.length;j++) {\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println(archivos_subcarpeta[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n Util_BinTreeNode<Integer> root = new Util_BinTreeNode<>();\n root.add(8);\n root.add(4); root.add(16);\n root.add(2); root.add(6); root.add(11); root.add(20);\n /*\n Caution. Adding the bellow nodes, causes the java.lang.OutOfMemoryError: GC overhead limit exceeded\n root.add(1); root.add(3); root.add(5); root.add(7);\n root.add(10); root.add(12); root.add(19); root.add(21);\n */\n System.out.println(java.time.LocalTime.now());\n ArrayList<LinkedList<Integer>> aofl = allSequences(root);\n System.out.println(java.time.LocalTime.now());\n\n for (LinkedList<Integer> list : aofl) {\n for (Integer i : list) {\n System.out.print(i + \",\");\n }\n System.out.println(\" \");\n }\n }", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int frames = 0, numPaginas = 0, cupoRevisado = 0, punteroExiste = -1, fallos = 0;\n boolean existe = false;\n String paginasIngresadas = \"\", accion = \"\";\n\n ArrayList paginas = new ArrayList();\n ArrayList bitPaginas = new ArrayList();\n ArrayList paginasAccedidas = new ArrayList();\n\n System.out.print(\"Ingrese numero de frames: \");\n frames = sc.nextInt();\n \n System.out.println(\"\");\n\n System.out.print(\"Ingrese cantidad de paginas: \");\n numPaginas = sc.nextInt();\n \n System.out.println(\"\");\n \n for (int i = 0; i < numPaginas; i++) {\n paginas.add((int)Math.floor(Math.random() * 20) + 1);\n }\n// System.out.print(\"Ingrese paginas separadas por coma (ej: 1,2,3,4): \");\n// paginasIngresadas = sc.next();\n\n// String[] paginasParseadas = paginasIngresadas.split(\",\");\n// numPaginas = paginasParseadas.length;\n//\n// for(int i = 0; i < paginasParseadas.length; i++) {\n// paginas.add(Integer.parseInt(paginasParseadas[i]));\n// }\n \n paginasAccedidas.add(paginas.get(0));\n bitPaginas.add(1);\n fallos++;\n\n accion = \"Se ingreso la pagina \" + paginasAccedidas.get(0) + \" con bit inicialzado en 1\";\n accion += \", fallos = \" + fallos;\n\n System.out.println(\"\");\n\n //Algoritmo de segunda oportunidad\n for(int i = 0; i < numPaginas; i++) {\n cupoRevisado = 0;\n existe = false;\n\n if(paginasAccedidas.size() == frames){\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)paginasAccedidas.get(j) == ((int)paginas.get(i)))){\n existe = true;\n if(((int)bitPaginas.get(j)) == 0) {\n bitPaginas.set(j, 1);\n accion = \"La pagina \" + paginasAccedidas.get(j) + \" ya existe en la tabla de paginas, su bit cambio de 0 a 1\";\n\n j = paginasAccedidas.size();\n }\n }\n }\n\n if(!existe){\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)bitPaginas.get(j)) == 0) {\n accion = \"Se reemplazo la pagina \" + paginasAccedidas.get(j) + \" con bit 0 por la pagina entrante \" + paginas.get(i) + \" inicializada con bit 1\";\n paginasAccedidas.set(j, paginas.get(i));\n fallos++;\n\n accion += \", fallos = \" + fallos;\n\n bitPaginas.set(j, 1);\n \n j = paginasAccedidas.size(); \n } else {\n cupoRevisado++;\n }\n }\n }\n\n if(cupoRevisado == frames) {\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n bitPaginas.set(j, 0);\n }\n\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)bitPaginas.get(j)) == 0) {\n accion = \"Todas las paginas son irremplazables, se cambiaron todos los bits de 1 a 0 y se reemplazo la pagina \" + paginasAccedidas.get(j) + \" por la pagina entrante \" + paginas.get(i);\n paginasAccedidas.set(j, paginas.get(i));\n fallos++;\n\n accion += \", fallos = \" + fallos;\n\n bitPaginas.set(j, 1);\n \n j = paginasAccedidas.size(); \n } else {\n cupoRevisado++;\n }\n }\n }\n } else {\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)paginasAccedidas.get(j) == ((int)paginas.get(i)))){\n existe = true;\n if(((int)bitPaginas.get(j)) == 0) {\n accion = \"La pagina \" + paginasAccedidas.get(j) + \" ya existe en la tabla de paginas, su bit cambio de 0 a 1\";\n bitPaginas.set(j, 1);\n\n j = paginasAccedidas.size();\n }\n } else {\n if(!existe) {\n paginasAccedidas.add(paginas.get(i));\n fallos++;\n\n accion = \"Se ingreso la pagina \" + paginas.get(i) + \" con bit inicializado en 1\";\n accion += \", fallos = \" + fallos;\n\n bitPaginas.add(1);\n\n j = paginasAccedidas.size();\n }\n }\n }\n }\n\n if(accion != \"\"){\n for(int j = 0; j < frames; j++){\n if(j < paginasAccedidas.size()){\n System.out.print(\" [ \" + paginasAccedidas.get(j) + \" ]\" + \"[ \" + bitPaginas.get(j) + \" ] \");\n } else {\n System.out.print(\" [ ][ ] \");\n }\n }\n \n System.out.println(\" Accion realizada: \" + accion);\n accion = \"\";\n\n System.out.println();\n } else {\n for(int j = 0; j < frames; j++){\n if(j < paginasAccedidas.size()){\n System.out.print(\" [ \" + paginasAccedidas.get(j) + \" ]\" + \"[ \" + bitPaginas.get(j) + \" ] \");\n } else {\n System.out.print(\" [ ][ ] \");\n }\n }\n \n System.out.println(\" Accion realizada: La pagina entrante \" + paginas.get(i) + \" ya existe en la tabla y su bit esta inicializado en 1\");\n accion = \"\";\n\n System.out.println();\n }\n }\n\n System.out.println(\"El numero de fallos fue: \" + fallos);\n \n }", "public static void main(String[] args) throws Exception {\n\t\tLista<Contato> vetor = new Lista<Contato>(20);\n\t\tLinkedList<Contato> listaEncadeada = new LinkedList<Contato>();\n\n\t\tContato c1 = new Contato(\"c1\", \"111-1111\", \"c1@email.com.br\");\n\t\tContato c2 = new Contato(\"c2\", \"222-2222\", \"c2@email.com.br\");\n\t\tContato c3 = new Contato(\"c3\", \"333-3333\", \"c3@email.com.br\");\n\t\tContato c4 = new Contato(\"c4\", \"444-2344\", \"c4@email.com.br\");\n\t\tContato c5 = new Contato(\"c5\", \"555-5585\", \"c5@email.com.br\");\n\t\tContato c6 = new Contato(\"c6\", \"111-1911\", \"c6@email.com.br\");\n\t\tContato c7 = new Contato(\"c7\", \"222-2322\", \"c7@email.com.br\");\n\t\tContato c8 = new Contato(\"c8\", \"333-3333\", \"c8@email.com.br\");\n\t\tContato c9 = new Contato(\"c9\", \"454-4644\", \"c9@email.com.br\");\n\t\tContato c10 = new Contato(\"c10\", \"515-5235\", \"c10@email.com.br\");\n\t\tContato c11 = new Contato(\"c11\", \"131-1411\", \"c11@email.com.br\");\n\t\tContato c12 = new Contato(\"c12\", \"252-2672\", \"c12@email.com.br\");\n\t\tContato c13 = new Contato(\"c13\", \"313-3433\", \"c13@email.com.br\");\n\t\tContato c14 = new Contato(\"c14\", \"433-4334\", \"c14@email.com.br\");\n\t\tContato c15 = new Contato(\"c15\", \"535-5355\", \"c15@email.com.br\");\n\t\tContato c16 = new Contato(\"c16\", \"161-1516\", \"c16@email.com.br\");\n\t\tContato c17 = new Contato(\"c17\", \"272-2272\", \"c17@email.com.br\");\n\t\tContato c18 = new Contato(\"c18\", \"383-3993\", \"c18@email.com.br\");\n\t\tContato c19 = new Contato(\"c19\", \"141-4949\", \"c19@email.com.br\");\n\t\tContato c20 = new Contato(\"c20\", \"565-5565\", \"c20@email.com.br\");\n\t\tContato c21 = new Contato(\"c21\", \"616-1611\", \"c21@email.com.br\");\n\t\tContato c22 = new Contato(\"c22\", \"212-2121\", \"c22@email.com.br\");\n\t\tContato c23 = new Contato(\"c23\", \"131-1331\", \"c23@email.com.br\");\n\t\tContato c24 = new Contato(\"c24\", \"424-4444\", \"c24@email.com.br\");\n\t\tContato c25 = new Contato(\"c25\", \"565-5555\", \"c25@email.com.br\");\n\t\tContato c26 = new Contato(\"c26\", \"111-1611\", \"c26@email.com.br\");\n\t\tContato c27 = new Contato(\"c27\", \"282-1252\", \"c27@email.com.br\");\n\t\tContato c28 = new Contato(\"c28\", \"323-3433\", \"c28@email.com.br\");\n\t\tContato c29 = new Contato(\"c29\", \"544-4464\", \"c29@email.com.br\");\n\t\tContato c30 = new Contato(\"c30\", \"155-5455\", \"c30@email.com.br\");\n\n\t\ttry {\n\t\t\t// ex5\n\t\t\tvetor.adiciona(c1);\n\t\t\tvetor.adiciona(c2);\n\t\t\tvetor.adiciona(c3);\n\t\t\tvetor.adiciona(c4);\n\t\t\tvetor.adiciona(c5);\n\t\t\tvetor.adiciona(c6);\n\t\t\tvetor.adiciona(c7);\n\t\t\tvetor.adiciona(c8);\n\t\t\tvetor.adiciona(c9);\n\t\t\tvetor.adiciona(c10);\n\t\t\tvetor.adiciona(c11);\n\t\t\tvetor.adiciona(c12);\n\t\t\tvetor.adiciona(c13);\n\t\t\tvetor.adiciona(c14);\n\t\t\tvetor.adiciona(c15);\n\t\t\tvetor.adiciona(c16);\n\t\t\tvetor.adiciona(c17);\n\t\t\tvetor.adiciona(c18);\n\t\t\tvetor.adiciona(c19);\n\t\t\tvetor.adiciona(c20);\n\t\t\tvetor.adiciona(c21);\n\t\t\tvetor.adiciona(c22);\n\t\t\tvetor.adiciona(c23);\n\t\t\tvetor.adiciona(c24);\n\t\t\tvetor.adiciona(c25);\n\t\t\tvetor.adiciona(c26);\n\t\t\tvetor.adiciona(c27);\n\t\t\tvetor.adiciona(c28);\n\t\t\tvetor.adiciona(c29);\n\t\t\tvetor.adiciona(c30);\n\t\t\t// ex3\n\t\t\tvetor.removerT(\"111-1111\");\n\t\t\t//ex4-vetor.RemoverTudo();\n\t\t\t\n\t\t\tSystem.out.println(vetor);\n\t\t\t// ex1\n\t\t\tSystem.out.println(\"Confirmar se o elemento na lista existe:\" + vetor.contem(c2));\n\t\t\t// ex2\n\t\t\tSystem.out.println(\"Retornar a posicao do elemento, se retornar -1 que dizer que o elemento não existe:\"\n\t\t\t\t\t+ vetor.indicio(c2));\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// ex6\n\t\tlistaEncadeada.add(c1);\n\t\tlistaEncadeada.add(c2);\n\t\tlistaEncadeada.add(c3);\n\t\tlistaEncadeada.add(c4);\n\t\tlistaEncadeada.add(c5);\n\t\tlistaEncadeada.add(c6);\n\t\tlistaEncadeada.add(c7);\n\t\tlistaEncadeada.add(c8);\n\t\tlistaEncadeada.add(c9);\n\t\tlistaEncadeada.add(c10);\n\t\tlistaEncadeada.add(c11);\n\t\tlistaEncadeada.add(c12);\n\t\tlistaEncadeada.add(c13);\n\t\tlistaEncadeada.add(c14);\n\t\tlistaEncadeada.add(c15);\n\t\tlistaEncadeada.add(c16);\n\t\tlistaEncadeada.add(c17);\n\t\tlistaEncadeada.add(c18);\n\t\tlistaEncadeada.add(c19);\n\t\tlistaEncadeada.add(c20);\n\t\tlistaEncadeada.add(c21);\n\t\tlistaEncadeada.add(c22);\n\t\tlistaEncadeada.add(c23);\n\t\tlistaEncadeada.add(c24);\n\t\tlistaEncadeada.add(c25);\n\t\tlistaEncadeada.add(c26);\n\t\tlistaEncadeada.add(c27);\n\t\tlistaEncadeada.add(c28);\n\t\tlistaEncadeada.add(c29);\n\t\tlistaEncadeada.add(c30);\n\n\t\tSystem.out.println(listaEncadeada);\n\n\t}", "private void caricaLista() {\n /** variabili e costanti locali di lavoro */\n ArrayList unaLista = null;\n CampoDati unCampoDati = null;\n CDBLinkato unCampoDBLinkato = null;\n //@todo da cancellare\n try { // prova ad eseguire il codice\n /* recupera il campo DB specializzato */\n unCampoDBLinkato = (CDBLinkato)unCampoParente.getCampoDB();\n\n /* recupera la lista dal campo DB */\n unaLista = unCampoDBLinkato.caricaLista();\n\n /* recupera il campo dati */\n unCampoDati = unCampoParente.getCampoDati();\n\n /* registra i valori nel modello dei dati del campo */\n if (unaLista != null) {\n unCampoDati.setValoriInterni(unaLista);\n// unCampoDatiElenco.regolaElementiAggiuntivi();\n } /* fine del blocco if */\n\n } catch (Exception unErrore) { // intercetta l'errore\n /* mostra il messaggio di errore */\n Errore.crea(unErrore);\n } /* fine del blocco try-catch */\n\n }", "@Test\r\n public void driverListSizeTest(){\r\n int listSize = 22;\r\n \r\n\r\n assertEquals(\"expected results = \" + listSize, listSize, extractor.extractXDriversOrTeams(listSize, \"table.msr_season_driver_results\", \"td.msr_driver\").size());\r\n\r\n }", "@Test\r\n\tpublic void testAcquistareBigliettiE4(){\r\n\t\tCartaDiCredito carta2 = new CartaDiCredito(\"2334549359434\",3232.8);\r\n\t\tCliente cliente2 = new Cliente(\"3\",\"Logan\",\"Peck\",\"logan@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"Logan92\",\"loganlogan\",\"loganlogan\",\"il tuo nome\",carta2);\r\n\t\tOfferta o = new Offerta(\"standard\", 10, 25.0);\r\n\t\tAbbonamento a = new Abbonamento(o);\r\n\t\tcliente2.setAbbonamento(a);\r\n\t\tcliente2.getAbbonamento().setNumeroBiglietti(0);\r\n\t\tint size2 = cliente2.getPrenotazioni().size();\r\n\t\tp1.acquistareBiglietti(3,\"abbonamento\", cliente2);\r\n\t\tassertEquals(size2,cliente2.getPrenotazioni().size());\r\n\t}", "private int getResourceListSize() {\n return dataList.getResourceEndIndex();\n }", "public static void main(String[] args) throws Exception {\n int B = 4096; //bytes max por pagina\n int M = 200; //cantidad de rectangulos tal que el nodo no pese mas que B\n\n int maxCord = 500000;\n int maxDelta = 100;\n\n Random rnd = new Random();\n\n int m = (M * 40) / 100; // m = 40% M\n\n int left = rnd.nextInt(maxCord);\n int bottom = rnd.nextInt(maxCord);\n int deltaX = rnd.nextInt(maxDelta);\n int deltaY = rnd.nextInt(maxDelta);\n\n Rectangle r = new Rectangle(left, left + deltaX, bottom + deltaY, bottom);\n DiskController diskController = new DiskController(M);\n long address = diskController.memoryAssigner();\n Node tree = new Root(m, M, r, diskController, address);\n\n diskController.saveNode(tree);\n long rootSize =diskController.getNodeSize(address);\n System.out.println(\"Tamaño de raiz : \" + rootSize + \" bytes\");\n\n int n=0;\n while (diskController.getNodeSize(address) < B){\n if(n==157) { break;}\n n++;\n Rectangle rn;\n left = rnd.nextInt(maxCord);\n bottom = rnd.nextInt(maxCord);\n deltaX = rnd.nextInt(maxDelta);\n deltaY = rnd.nextInt(maxDelta);\n rn = new Rectangle(left, left + deltaX, bottom + deltaY, bottom);\n tree.insert(rn, new LinearSplit());\n System.out.println(\"Rectangulos insertados : \" + n);\n }\n float nodeCoverage = diskController.nodeOcupation();\n System.out.println(\"Coverage : \"+nodeCoverage);\n System.out.println(\"Tamaño de raiz llena : \" + diskController.getNodeSize(address) + \" bytes, con \"+n+\" nodos insertados. Con raiz vacía de \"+rootSize+\" bytes\");\n //Tamaño de raiz llena : 4089 bytes, con 157 nodos insertados. Con raiz vacía de 478 bytes\n\n }", "public static List<Integer> czytanieMotorniczego(){\r\n int numerMotorniczego;\r\n int wiek=0;\r\n int doswiadczenie = 0;\r\n String line;\r\n OdczytZPliku plik = new OdczytZPliku();\r\n InputStream zawartosc = plik.pobierzZPliku(\"bazamotorniczych.txt\");\r\n String numerWStringu = String.valueOf( numerMotorniczego = (int) (Math.random() * 4));\r\n try (InputStreamReader odczyt = new InputStreamReader(zawartosc, StandardCharsets.UTF_8);\r\n BufferedReader czytaj = new BufferedReader(odczyt)) {\r\n while ((line = czytaj.readLine()) != null) {\r\n if (line.equals(numerWStringu)) {\r\n wiek = Integer.parseInt(czytaj.readLine());\r\n doswiadczenie = Integer.parseInt(czytaj.readLine());\r\n break;\r\n }\r\n else{\r\n for (int i = 0; i < 2; i++) {\r\n line = czytaj.readLine();\r\n }\r\n }\r\n }\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n return List.of(numerMotorniczego, wiek, doswiadczenie);\r\n }", "@Override\n public int size() {//por Niveles\n if (this.esArbolVacio()) {\n return 0; //Arbol Vacio\n }\n int cantidadDeNodos = 0;\n Queue<NodoBinario<T>> colaDeNodos = new LinkedList<>();\n colaDeNodos.offer(raiz);\n while (!colaDeNodos.isEmpty()) {\n NodoBinario<T> nodoActual = colaDeNodos.poll();\n cantidadDeNodos++;\n if (!nodoActual.esHijoIzquiedoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoIzquierdo());\n }\n if (!nodoActual.esHijoDerechoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoDerecho());\n }\n }\n return cantidadDeNodos; //Lista con los datos(En el orden de este recorrido)\n }", "private void getArquivo()\n {\n /*** Obtem o conteudo do pacote através do diretorio ***/\n File file = new File(caminho_origem);\n if (file.isFile())\n {\n try\n {\n /*** Lê o pacote e põe em um array de bytes ***/\n DataInputStream diStream = new DataInputStream(new FileInputStream(file));\n long len = (int) file.length();\n if (len > Utils.tamanho_maximo_arquivo)\n {\n System.out.println(Utils.prefixo_cliente + Utils.arquivo_muito_grande);\n System.exit(0);\n }\n Float numero_pacotes_ = ((float)len / Utils.tamanho_util_pacote);\n int numero_pacotes = numero_pacotes_.intValue();\n int ultimo_pacote = (int) len - (Utils.tamanho_util_pacote * numero_pacotes);\n int read = 0;\n /***\n 1500\n fileBytes[1500]\n p[512]\n p[512]\n p[476]len - (512 * numero_pacotes.intValue())\n ***/\n byte[] fileBytes = new byte[(int)len];\n while (read < fileBytes.length)\n {\n fileBytes[read] = diStream.readByte();\n read++;\n }\n int i = 0;\n int pacotes_feitos = 0;\n while ( pacotes_feitos < numero_pacotes)\n {\n byte[] mini_pacote = new byte[Utils.tamanho_util_pacote];\n for (int k = 0; k < Utils.tamanho_util_pacote; k++)\n {\n mini_pacote[k] = fileBytes[i];\n i++;\n }\n Pacote pacote_ = new Pacote();\n pacote_.setConteudo(mini_pacote);\n this.pacotes.add(pacote_);\n pacotes_feitos++;\n }\n byte[] ultimo_mini_pacote = new byte[ultimo_pacote];\n int ultimo_indice = ultimo_mini_pacote.length;\n for (int j = 0; j < ultimo_mini_pacote.length; j++)\n {\n ultimo_mini_pacote[j] = fileBytes[i];\n i++;\n }\n byte[] ultimo_mini_pacote2 = new byte[512];\n System.arraycopy(ultimo_mini_pacote, 0, ultimo_mini_pacote2, 0, ultimo_mini_pacote.length);\n for(int h = ultimo_indice; h < 512; h++ ) ultimo_mini_pacote2[h] = \" \".getBytes()[0];\n Pacote pacote_ = new Pacote();\n pacote_.setConteudo(ultimo_mini_pacote2);\n this.pacotes.add(pacote_);\n this.janela = new HashMap<>();\n for (int iterator = 0; iterator < this.pacotes.size(); iterator++) janela.put(iterator, new Estado());\n } catch (Exception e)\n {\n System.out.println(Utils.prefixo_cliente + Utils.erro_na_leitura);\n System.exit(0);\n }\n } else\n {\n System.out.println(Utils.prefixo_cliente + Utils.arquivo_inexistente);\n System.exit(0);\n }\n }", "private HashMap<Integer, Integer> tabuSizeTestWith(String taillardFilename) {\n Combination inComb = Combination.generateRandom(assignementProblem.getAssignmentData().getLength());\n assignementProblem.setInCombination(inComb);\n \n int[] sizes = {1, 2, 3, 10, 100, 1000, 10000};\n HashMap<Integer, Integer> optima = new HashMap<>(sizes.length);\n for (int size : sizes) {\n System.out.println(\"Tabu size \" + size);\n assignementProblem.tabuAlgortihm(SearchTestUtil.taillardOptima.get(TAILLARD_FILENAME), size); //parameter optima, to know the convergence\n optima.put(size, assignementProblem.getF().apply(assignementProblem.getOutCombination()));\n assignementProblem.printOutput();\n System.out.println();\n }\n \n return optima;\n }", "@Test(timeout = 4000)\n public void test21() throws Throwable {\n FileUtil fileUtil0 = new FileUtil();\n ArrayList<String> arrayList0 = new ArrayList<String>();\n FileInputStream fileInputStream0 = fileUtil0.fetchAccessories(\"bq,4~/{MxS* Ht9k\", arrayList0);\n assertNull(fileInputStream0);\n }", "private static byte[] m2539e(Context context) {\n Throwable th;\n int i = 0;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n byte[] bArr = new byte[0];\n String a = Log.m2547a(context, Log.f1857e);\n DiskLruCache diskLruCache = null;\n try {\n diskLruCache = DiskLruCache.m2767a(new File(a), 1, 1, 10240);\n File file = new File(a);\n if (file != null && file.exists()) {\n String[] list = file.list();\n int length = list.length;\n while (i < length) {\n String str = list[i];\n if (str.contains(\".0\")) {\n byteArrayOutputStream.write(StatisticsManager.m2535a(diskLruCache, str.split(\"\\\\.\")[0]));\n }\n i++;\n }\n }\n bArr = byteArrayOutputStream.toByteArray();\n if (byteArrayOutputStream != null) {\n try {\n byteArrayOutputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (diskLruCache != null) {\n try {\n diskLruCache.close();\n } catch (Throwable th2) {\n th = th2;\n }\n }\n } catch (IOException th3) {\n BasicLogHandler.m2542a(th3, \"StatisticsManager\", \"getContent\");\n if (byteArrayOutputStream != null) {\n try {\n byteArrayOutputStream.close();\n } catch (IOException e2) {\n e2.printStackTrace();\n }\n }\n if (diskLruCache != null) {\n diskLruCache.close();\n }\n } catch (Throwable th4) {\n th3 = th4;\n }\n return bArr;\n th3.printStackTrace();\n return bArr;\n }", "@Test\n public void whenAddOneHundredElement() {\n String testWord = \"Bong!\";\n for (int i = 0; i < 100; i++) {\n link.add(testWord);\n }\n assertThat(link.getSize(), is(100));\n }", "@Override\r\n public long problem2() {\r\n ArrayList<String> arrList = new ArrayList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n arrList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis(); \r\n return end - start; \r\n }", "public static void consultaEleicoesPassadas() {\n\t\tArrayList<Eleicao> lista;\n\t\t\n\t\tint check = 0;\n\t\tint tries = 0;\n\t\tdo {\n\t\t\ttry {\n\t\t\t\tlista = rmiserver.getEleicoesPassadas();\n\t\t\t\tif(lista.isEmpty()) {\n\t\t\t\t\tSystem.out.println(\"Nao existem eleicoes para mostrar.\");\n\t\t\t\t}else {\n\t\t\t\t\tfor(Eleicao x: lista) {\n\t\t\t\t\t\tSystem.out.println(\"\\nEleicao \"+x.titulo);\n\t\t\t\t\t\tSystem.out.println(\"\\tID: \"+x.id);\n\t\t\t\t\t\tSystem.out.println(\"\\tDescricao: \"+x.descricao);\n\t\t\t\t\t\tSystem.out.println(\"\\tData Inicio: \"+x.dataInicio.toString());\n\t\t\t\t\t\tSystem.out.println(\"\\tData Fim: \"+x.dataInicio.toString());\n\t\t\t\t\t\tSystem.out.println(\"Resultados: \");\n\t\t\t\t\t\tif(x.tipo == 1) {\n\t\t\t\t\t\t\tif(x.registoVotos.size()>0) {\n\t\t\t\t\t\t\t\tfor(Lista y: x.listaCandidaturas) {\n\t\t\t\t\t\t\t\t\tdouble perc = y.contagem/(double)x.registoVotos.size() * 100;\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tif(x.registoVotos.size()>0) {\n\t\t\t\t\t\t\t\tint alunos = 0, docentes = 0, funcs = 0;\n\t\t\t\t\t\t\t\tfor(Lista y:x.listaCandidaturas) {\n\t\t\t\t\t\t\t\t\tif(y.tipoLista.equals(\"1\")) {\n\t\t\t\t\t\t\t\t\t\talunos += y.contagem;\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"2\")) {\n\t\t\t\t\t\t\t\t\t\tfuncs += y.contagem;\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"3\")) {\n\t\t\t\t\t\t\t\t\t\tdocentes += y.contagem;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfor(Lista y: x.listaCandidaturas) {\n\t\t\t\t\t\t\t\t\tif(y.tipoLista.equals(\"1\")) {\n\t\t\t\t\t\t\t\t\t\tif(alunos>0) {\n\t\t\t\t\t\t\t\t\t\t\tdouble perc = (double)y.contagem/(double)alunos * 100;\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": 0% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"2\")) {\n\t\t\t\t\t\t\t\t\t\tif(funcs>0) {\n\t\t\t\t\t\t\t\t\t\t\tdouble perc = (double)y.contagem/(double)funcs * 100;\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": 0% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"3\")) {\n\t\t\t\t\t\t\t\t\t\tif(docentes>0) {\n\t\t\t\t\t\t\t\t\t\t\tdouble perc = (double)y.contagem/(double)docentes * 100;\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": 0% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"4\")) {\n\t\t\t\t\t\t\t\t\t\tdouble perc = y.contagem/(double)x.registoVotos.size() * 100;\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% sobre Total (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcheck = 1;\n\t\t\t} catch (RemoteException e1) {\n\t\t\t\t// Tratamento da Excepcao da chamada RMI addCandidatos\n\t\t\t\tif(tries == 0) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(6000);\n\t\t\t\t\t\t//faz novo lookup\n\t\t\t\t\t\trmiserver = (RMI_S_I) Naming.lookup(\"rmi://\"+registryIP+\":\"+registryPort+\"/rmi\");\n\t\t\t\t\t\trmiserver.subscribeConsola((ADMIN_C_I)consola);\n\t\t\t\t\t\ttries = 0;\n\t\t\t\t\t} catch (RemoteException | InterruptedException | MalformedURLException | NotBoundException e) {\n\t\t\t\t\t\t// FailOver falhou\n\t\t\t\t\t\ttries++;\n\t\t\t\t\t}\n\t\t\t\t}else if(tries > 0 && tries < 24) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(1000);\n\t\t\t\t\t\t//faz novo lookup\n\t\t\t\t\t\trmiserver = (RMI_S_I) Naming.lookup(\"rmi://\"+registryIP+\":\"+registryPort+\"/rmi\");\n\t\t\t\t\t\trmiserver.subscribeConsola((ADMIN_C_I)consola);\n\t\t\t\t\t\ttries = 0;\n\t\t\t\t\t} catch (RemoteException | InterruptedException | MalformedURLException | NotBoundException e) {\n\t\t\t\t\t\t// FailOver falhou\n\t\t\t\t\t\ttries++;\n\t\t\t\t\t}\n\t\t\t\t}else if(tries >= 24) {\n\t\t\t\t\tSystem.out.println(\"Impossivel realizar a operacao devido a falha tecnica (Servidores RMI desligados).\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}while(check==0);\n\t\tcheck = 0;\n\t\t\n\t\t\n\t}", "private int kiemtrasopt (List list){\n int dem = list.size();\n return dem;\n }", "private String creaElenco() {\n String testoTabella ;\n String riga = CostBio.VUOTO;\n ArrayList listaPagine = new ArrayList();\n ArrayList listaRiga;\n HashMap mappaTavola = new HashMap();\n String cognomeText;\n int num;\n int taglioPagine = Pref.getInt(CostBio.TAGLIO_COGNOMI_PAGINA);\n String tag = \"Persone di cognome \";\n ArrayList titoli = new ArrayList();\n titoli.add(LibWiki.setBold(\"Cognome\"));\n titoli.add(LibWiki.setBold(\"Voci\"));\n\n for (Map.Entry<String, Integer> mappa: mappaCognomi.entrySet()) {\n\n cognomeText = mappa.getKey();\n num = mappa.getValue();\n if (num >= taglioPagine) {\n cognomeText = tag + cognomeText + CostBio.PIPE + cognomeText;\n cognomeText = LibWiki.setQuadre(cognomeText);\n cognomeText = LibWiki.setBold(cognomeText);\n }// end of if cycle\n\n listaRiga = new ArrayList();\n listaRiga.add(cognomeText);\n listaRiga.add(num);\n listaPagine.add(listaRiga);\n\n }// end of for cycle\n mappaTavola.put(Cost.KEY_MAPPA_SORTABLE_BOOLEAN, true);\n mappaTavola.put(Cost.KEY_MAPPA_TITOLI, titoli);\n mappaTavola.put(Cost.KEY_MAPPA_RIGHE_LISTA, listaPagine);\n testoTabella = LibWiki.creaTable(mappaTavola);\n\n return testoTabella;\n }", "@Test\r\n\tpublic void testAcquistareBigliettiE2(){\r\n\t\tOfferta o = new Offerta(\"standard\", 10, 25.0);\r\n\t\tCartaDiCredito carta = new CartaDiCredito(\"2334549359434\",23353.89);\r\n\t\tAbbonamento a = new Abbonamento(o);\r\n\t\tCliente c2 = new Cliente(\"4\",\"Mario\",\"Rossi\",\"rossi.m@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"rossimario\",\"passw.\",\"passw.\",\"domanda segreta..\",carta);\r\n\t\tc2.setAbbonamento(a);\r\n\t\tp1.acquistareBiglietti(3,\"abbonamento\", c2);\r\n\t\t//i biglietti vengono inseriti nella lista prenotazioni e quindi ne\r\n\t\t//modificano la size\r\n\t\tassertEquals(3,c2.getPrenotazioni().size());\r\n\t}", "private static int getSize(double loadFactor){\n return (primeSize((int) (3739/loadFactor))); // 3739 is the number of entries from the lexicon list\n }", "public static void main(String[] args) {\n\t\tArrayList<Empleado>listaEmpleados = new ArrayList<Empleado>();\n\t\t//listaEmpleados.ensureCapacity(12); //USAMOS ESTE MÉTODO PARA NO CONSUMIR MÁS MEMORIA QUE 12 ELEMENTOS DEL ARRAYLIST\n\t\tlistaEmpleados.add(new Empleado(\"Bra\", 17,2800));\n\t\tlistaEmpleados.add(new Empleado(\"Pan\", 15,2500));\n\t\tlistaEmpleados.add(new Empleado(\"Giru\", 10,2000));\n\t\tlistaEmpleados.add(new Empleado(\"Bra\", 17,2800));\n\t\tlistaEmpleados.add(new Empleado(\"Pan\", 15,2500));\n\t\tlistaEmpleados.add(new Empleado(\"Giru\", 10,2000));\n\t\tlistaEmpleados.add(new Empleado(\"Bra\", 17,2800));\n\t\tlistaEmpleados.add(new Empleado(\"Pan\", 15,2500));\n\t\tlistaEmpleados.add(new Empleado(\"Giru\", 10,2000));\n\t\tlistaEmpleados.add(new Empleado(\"Bra\", 17,2800));\n\t\tlistaEmpleados.add(new Empleado(\"Pan\", 15,2500));\n\t\t//PARA ELEGIR LA POSICIÓN DONDE QUEREMOS INCLUIR ELEMENTO.\n\t\tlistaEmpleados.set(5,new Empleado(\"Androide18\", 10,2000));\n\t\t\n\t\t//CORTAMOS EL EXCESO DE MEMORIA QUE ESTÁ SIN USAR\n\t\t//listaEmpleados.trimToSize();\n\t\t\n\t\t//PARA IMPRIMIR UN ELEMENTO DE ARRAYLIST EN ESPECIAL\n\t\tSystem.out.println(listaEmpleados.get(4).dameEmpleados());\n\t\t\n\t\t//IMPRIMIMOS EL TAMAÑO DEL ARRAYLIST\n\t\tSystem.out.println(\"Elementos: \" + listaEmpleados.size());\n\t\t\n\t\t/*//BUCLE FOR-EACH\n\t\tSystem.out.println(\"Elementos: \" + listaEmpleados.size());\n\t\tfor(Empleado x : listaEmpleados) {\n\t\t\tSystem.out.println(x.dameEmpleados());\n\t\t}*/\n\t\t\n\t\t/*//BUCLE FOR\n\t\tfor(int i=0;i<listaEmpleados.size();i++) {\n\t\t\t//ALAMCENAMOS EN \"e\" LOS ELEMENTOS DEL ARRAYLIST\n\t\t\tEmpleado e =listaEmpleados.get(i); \n\t\t\tSystem.out.println(e.dameEmpleados());\n\t\t}*/\n\t\t\n\t\t//GUARDAMOS LA INFORMACIÓN DEL ARRAYLIST EN UN ARRAY CONVENSIONAL Y LO RECORREMOS\n\t\t//CREAMOS ARRAY Y LE DAMOS LA LONGITUD DEL ARRAYLIST:\n\t\tEmpleado arrayEmpleados[]= new Empleado[listaEmpleados.size()];\n\t\t//COPIAMOS LA INFORMACIÓN EN EL ARRAY CONVENSIONAL:\n\t\tlistaEmpleados.toArray(arrayEmpleados);\n\t\t//RECORREMOS\n\t\tfor(int i=0;i<arrayEmpleados.length;i++) {\n\t\t\tSystem.out.println(arrayEmpleados[i].dameEmpleados());\n\t\t}\n\t}", "@Test\r\n\tpublic void testAcquistareBigliettiE3(){\r\n\t\tCartaDiCredito carta2 = new CartaDiCredito(\"2334549359434\",2.8);\r\n\t\tCliente cliente = new Cliente(\"3\",\"Logan\",\"Peck\",\"logan@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"Logan92\",\"loganlogan\",\"loganlogan\",\"il tuo nome\",carta2);\r\n\t\tint size = cliente.getPrenotazioni().size();\r\n\t\tp1.acquistareBiglietti(4,\"carta\", cliente);\r\n\t\t//la size non cambia poiche' non vengono inseriti i nuovi biglietti\r\n\t\t//(fallisce acquisto)\r\n\t\tassertEquals(size,cliente.getPrenotazioni().size());\r\n\t}", "@Test\n public void nelioMuodostuu() {\n ArrayList lista=this.tetrimino.palautaKuvio();\n assertEquals(lista.size(), 4);\n \n }", "private void solicitaPecas(String nomeArquivoTorrent) throws UnknownHostException {\n\n try {\n\n // Passo 1 - Envia uma mensagem p ip do ArqTorrent com #+nomeArqTorrent\n ipServidor = getEnderecoRastreador(nomeArquivoTorrent);\n InetAddress enderecoServidor = InetAddress.getByName(ipServidor);\n String nomeArqOriginal = \"#\" + retornaNomeArq(nomeArquivoTorrent);\n DatagramPacket pacoteRequisicao = new DatagramPacket((nomeArqOriginal).getBytes(), nomeArqOriginal.length(), enderecoServidor, porto);\n soqueteCliente.send(pacoteRequisicao);\n\n //Recebe como resposta os pares que possuem alguma peça daquele arquivo\n DatagramPacket pacoteResposta = new DatagramPacket(new byte[256], 256);\n soqueteCliente.receive(pacoteResposta);\n String dadosResposta = new String(pacoteResposta.getData()).trim();\n System.out.println(\"Dados resposta: \" + dadosResposta);\n String[] ipPares = dadosResposta.split(\"-\");\n //System.out.println(\"Quantidade:\" +ipPares.length);\n\n\n //ARRUMAR ISSO DEPOIS\n String nomeArqePecas = \"$\" + retornaNomeArq(nomeArquivoTorrent)+\"/0-30\";\n DatagramPacket pacoteRequisicaoPecas = new DatagramPacket((nomeArqePecas).getBytes(), nomeArqePecas.length(), enderecoServidor, porto);\n soqueteCliente.send(pacoteRequisicaoPecas);\n\n System.out.println(\"nome: \"+nomeArqOriginal);\n Path path = Paths.get(nomeArqOriginal);\n\n File arquivoDados = path.toFile();\n RandomAccessFile arq = new RandomAccessFile(arquivoDados,\"rw\");\n int i=0;\n while(i<30){\n DatagramPacket peca = new DatagramPacket(new byte[1000], 1000);\n soqueteCliente.receive(peca);\n\n System.out.println(peca);\n String g = Metadados.geraChave(peca.getData());\n System.out.println(i + \"> \" + g);\n // writePeca(i,peca.getData(),arq);\n i++;\n }\n\n\n\n //DatagramPacket pacoteResposta = new DatagramPacket(new byte[25600], 25600);\n //soqueteCliente.receive(pacoteResposta);\n clienteTerminou = true;\n } catch (IOException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n } catch (NoSuchAlgorithmException e) {\n e.printStackTrace();\n }\n\n }", "@Test(timeout = 4000)\n public void test15() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n byte[][] byteArray0 = new byte[3][9];\n byte[] byteArray1 = new byte[4];\n byte byte0 = (byte)1;\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n FileSystemHandling.shouldAllThrowIOExceptions();\n fBCachedFetcher0.getFetchSize();\n try { \n fBCachedFetcher0.absolute(0);\n fail(\"Expecting exception: FBSQLException\");\n \n } catch(FBSQLException e) {\n //\n // You cannot position to the row 0 with absolute() method.\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "public int getCompleteListSize() { return size; }", "@Override\n public int getMaxCapacity() {\n return 156250000;\n }", "long buscarUltimo();", "public static int size_receivets() {\n return (32 / 8);\n }", "public void transcribir() \r\n\t{\r\n\t\tpalabras = new ArrayList<List<CruciCasillas>>();\r\n\t\tmanejadorArchivos = new CruciSerializacion();\r\n\t\tint contador = 0;\r\n\t\t\r\n\t\tmanejadorArchivos.leer(\"src/Archivos/crucigrama.txt\");\r\n\t\t\r\n\t\tfor(int x = 0;x<manejadorArchivos.getPalabras().size();x++){\r\n\t\t\t\r\n\t\t\tcontador++;\r\n\t\t\t\r\n\t\t\tif (contador == 4) {\r\n\t\t\t\r\n\t\t\t\tList<CruciCasillas> generico = new ArrayList<CruciCasillas>();\r\n\t\t\t\t\r\n\t\t\t\tfor(int y = 0; y < manejadorArchivos.getPalabras().get(x).length();y++)\r\n\t\t\t\t{\r\n\t\t\t\t\t\tgenerico.add(new CruciCasillas(manejadorArchivos.getPalabras().get(x).charAt(y)));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (y == (manejadorArchivos.getPalabras().get(x).length() - 1)) \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tpalabras.add(generico);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tcontador = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\t\r\n\t}", "public static List<Factura> generareListaFacturi(\n int numarFacturi, LocalDate dataMinima) {\n String[] denumiriClienti = new String[]{\n \"ALCOR CONSTRUCT SRL\",\n \"SC DOMINO COSTI SRL\",\n \"SC TRANSCRIPT SRL\",\n \"SIBLANY SRL\",\n \"INTERFLOOR SYSTEM SRL\",\n \"MERCURY IMPEX 2000 SRL\",\n \"ALEXANDER SRL\",\n \"METAL INOX IMPORT EXPOSRT SRL\",\n \"EURIAL BROKER DE ASIGURARE SRL\"\n };\n\n String[] denumiriProduse = new String[]{\n \"Stafide 200g\",\n \"Seminte de pin 300g\",\n \"Bulion Topoloveana 190g\",\n \"Paine neagra Frontera\",\n \"Ceai verde Lipton\"\n\n };\n\n double[] preturiProduse = new double[]{\n 5.20,\n 12.99,\n 6.29,\n 4.08,\n 8.99\n };\n\n // 2. Inițializare generare\n Random rand = new Random(); // vezi https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Random.html\n int numarMaximZile = (int) ChronoUnit.DAYS.between(dataMinima, LocalDate.now());\n List<Factura> facturi = new ArrayList<>();\n\n // 3. Generare facturi\n for (int indexFactura = 0; indexFactura < numarFacturi; indexFactura++) {\n\n var denumireClient = denumiriClienti[rand.nextInt(denumiriClienti.length)];\n var data = dataMinima.plusDays(rand.nextInt(numarMaximZile)); // maxim data curentă\n\n var factura = new Factura(denumireClient, data);\n\n // Adăugăm cel puțin un rând\n var numarProduse = 1 + rand.nextInt(NUMAR_MAXIM_PRODUSE - 1);\n for (int indexProdus = 0; indexProdus < numarProduse; indexProdus++) {\n\n // Atenție: produsul și prețul trebuie să fie corelate (aceeași poziție)\n var produsSelectat = rand.nextInt(denumiriProduse.length);\n var produs = denumiriProduse[produsSelectat];\n var pret = preturiProduse[produsSelectat];\n\n var cantitate = 1 + rand.nextInt(19);\n\n factura.adaugaLinie(produs, pret, cantitate);\n }\n\n facturi.add(factura);\n }\n\n return facturi;\n }", "public ArrayList<clsPago> consultaDataPagosCuotaInicial(int codigoCli)\n { \n ArrayList<clsPago> data = new ArrayList<clsPago>(); \n try{\n bd.conectarBaseDeDatos();\n sql = \" SELECT a.id_pagos_recibo idPago, a.id_usuario, b.name name_usuario, \"\n + \" a.referencia referencia, \"\n + \" a.fecha_pago fecha_pago, a.estado, \"\n + \" a.valor valor_pago, a.id_caja_operacion, e.name_completo nombre_cliente, \"\n + \" a.fecha_pago fecha_registro\"\n + \" FROM ck_pagos_recibo AS a\"\n + \" JOIN ck_usuario AS b ON a.id_usuario = b.id_usuario\"\n + \" JOIN ck_cliente AS e ON a.codigo = e.codigo\"\n + \" WHERE a.estado = 'A'\"\n + \" AND a.cuota_inicial = 'S'\"\n + \" AND a.estado_asignado = 'N'\"\n + \" AND a.codigo = \" + codigoCli; \n \n System.out.println(sql);\n bd.resultado = bd.sentencia.executeQuery(sql);\n \n if(bd.resultado.next())\n { \n do \n { \n clsPago oListaTemporal = new clsPago();\n \n oListaTemporal.setReferencia(bd.resultado.getString(\"referencia\"));\n oListaTemporal.setFechaPago(bd.resultado.getString(\"fecha_pago\"));\n oListaTemporal.setNombreUsuario(bd.resultado.getString(\"name_usuario\"));\n oListaTemporal.setNombreCliente(bd.resultado.getString(\"nombre_cliente\"));\n oListaTemporal.setValor(bd.resultado.getDouble(\"valor_pago\"));\n oListaTemporal.setFechaRegistro(bd.resultado.getString(\"fecha_registro\"));\n oListaTemporal.setIdPago(bd.resultado.getInt(\"idPago\"));\n data.add(oListaTemporal);\n }\n while(bd.resultado.next()); \n //return data;\n }\n else\n { \n data = null;\n } \n }\n catch(Exception ex)\n {\n System.out.print(ex);\n data = null;\n } \n bd.desconectarBaseDeDatos();\n return data;\n }", "@Test(timeout = 4000)\n public void test07() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n byte[][] byteArray0 = new byte[7][8];\n byte[] byteArray1 = new byte[8];\n byteArray1[0] = (byte) (-13);\n byteArray1[1] = (byte)77;\n byteArray1[2] = (byte) (-2);\n byteArray1[3] = (byte) (-103);\n byteArray1[4] = (byte) (-91);\n byteArray1[5] = (byte) (-44);\n byteArray1[6] = (byte) (-31);\n byteArray1[7] = (byte)33;\n byteArray0[0] = byteArray1;\n byte[] byteArray2 = new byte[4];\n byteArray2[0] = (byte)77;\n byteArray2[1] = (byte) (-44);\n byteArray2[2] = (byte) (-13);\n byteArray2[3] = (byte)77;\n byteArray0[1] = byteArray2;\n byte[] byteArray3 = new byte[1];\n byteArray3[0] = (byte) (-44);\n byteArray0[2] = byteArray3;\n byte[] byteArray4 = new byte[6];\n byteArray4[0] = (byte) (-94);\n byteArray4[1] = (byte) (-31);\n byteArray4[2] = (byte) (-13);\n byteArray4[3] = (byte) (-31);\n byteArray4[4] = (byte) (-91);\n byteArray4[5] = (byte)58;\n byteArray0[3] = byteArray4;\n byte[] byteArray5 = new byte[3];\n byteArray5[0] = (byte)58;\n byteArray5[1] = (byte) (-44);\n byteArray5[2] = (byte) (-103);\n byteArray0[4] = byteArray5;\n byte[] byteArray6 = new byte[3];\n byteArray6[0] = (byte) (-91);\n byteArray6[1] = (byte) (-2);\n byteArray6[2] = (byte) (-94);\n byteArray0[5] = byteArray6;\n byte[] byteArray7 = new byte[3];\n byteArray7[0] = (byte) (-13);\n byteArray7[1] = (byte)33;\n byteArray7[2] = (byte)58;\n byteArray0[6] = byteArray7;\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n boolean boolean0 = fBCachedFetcher0.isLast();\n assertFalse(boolean0);\n }", "@Test\r\n\tpublic void testAcquistareBigliettiE5(){\r\n\t\tCartaDiCredito carta = new CartaDiCredito(\"2334549359434\",23353.89);\r\n\t\tCliente cliente3 = new Cliente(\"4\",\"Mario\",\"Rossi\",\"rossi.m@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"rossimario\",\"passw.\",\"passw.\",\"domanda segreta..\",carta);\r\n\t\tp1.acquistareBiglietti(280,\"carta\", cliente3);\r\n\t\t//non andando a buon fine l'operazione, il cliente avra' 0 biglietti\r\n\t\tassertEquals(0,cliente3.getPrenotazioni().size());\r\n\t}", "@SuppressWarnings(\"unchecked\")\n public void consultarCoactivosXLS() throws CirculemosNegocioException {\n\n // consulta la tabla temporal de los 6000 coactivos\n StringBuilder sql = new StringBuilder();\n\n sql.append(\"select [TIPO DOC], [NUMERO DE IDENTIFICACIÓN], [valor multas], [titulo valor], proceso \");\n sql.append(\"from coactivos_xls \");\n sql.append(\"where id_tramite is null and numero_axis is null AND archivo is not null \");\n sql.append(\"AND [titulo valor] IN ('2186721','2187250','2187580','2186845')\");\n\n Query query = em.createNativeQuery(sql.toString());\n\n List<Object[]> listaResultados = Utilidades.safeList(query.getResultList());\n\n Date fechaCoactivo = UtilFecha.buildCalendar().getTime();\n CoactivoDTO coactivoDTOs;\n TipoIdentificacionPersonaDTO tipoIdentificacion;\n List<ObligacionCoactivoDTO> obligacionesCoactivoDTO;\n PersonaDTO personaDTO;\n ProcesoDTO proceso;\n // persiste los resultados en coactivoDTO\n for (Object[] coactivo : listaResultados) {\n coactivoDTOs = new CoactivoDTO();\n // persiste el tipo de indetificacion en TipoIdentificacionPersonaDTO\n personaDTO = new PersonaDTO();\n proceso = new ProcesoDTO();\n tipoIdentificacion = new TipoIdentificacionPersonaDTO();\n obligacionesCoactivoDTO = new ArrayList<>();\n\n tipoIdentificacion.setCodigo((String) coactivo[0]);\n personaDTO.setTipoIdentificacion(tipoIdentificacion);\n coactivoDTOs.setPersona(personaDTO);\n coactivoDTOs.getPersona().setNumeroIdentificacion((String) coactivo[1]);\n\n proceso.setFechaInicio(fechaCoactivo);\n coactivoDTOs.setProceso(proceso);\n coactivoDTOs.setValorTotalObligaciones(BigDecimal\n .valueOf(Double.valueOf(coactivo[2].toString().replaceAll(\"\\\\.\", \"\").replaceAll(\",\", \".\"))));\n coactivoDTOs.setValorTotalCostasProcesales(\n coactivoDTOs.getValorTotalObligaciones().multiply(BigDecimal.valueOf(0.05)));\n coactivoDTOs.getProceso().setObservacion(\"COACTIVO\");\n String[] numeroFactura = coactivo[3].toString().split(\",\");\n // separa los numeros de factura cuando viene mas de uno.\n for (String nFactura : numeroFactura) {\n // consulta por numero de factura el el saldo a capital por cada factura\n sql = new StringBuilder();\n sql.append(\"select nombre, saldo_capital, saldo_interes \");\n sql.append(\"from cartera_coactivos_xls \");\n sql.append(\"where nombre = :nFactura\");\n\n Query quer = em.createNativeQuery(sql.toString());\n\n quer.setParameter(\"nFactura\", nFactura);\n\n List<Object[]> result = Utilidades.safeList(quer.getResultList());\n // persiste las obligaciones consultadas y las inserta en ObligacionCoactivoDTO\n ObligacionCoactivoDTO obligaciones;\n for (Object[] obligacion : result) {\n obligaciones = new ObligacionCoactivoDTO();\n obligaciones.setNumeroObligacion((String) obligacion[0]);\n obligaciones.setValorObligacion(BigDecimal.valueOf(\n Double.valueOf(obligacion[1].toString().replaceAll(\"\\\\.\", \"\").replaceAll(\",\", \".\"))));\n obligaciones.setValorInteresMoratorios(BigDecimal.valueOf(\n Double.valueOf(obligacion[2].toString().replaceAll(\"\\\\.\", \"\").replaceAll(\",\", \".\"))));\n // Adiciona las obligaciones a una lista\n obligacionesCoactivoDTO.add(obligaciones);\n }\n\n }\n coactivoDTOs.setObligacionCoactivos(obligacionesCoactivoDTO);\n try {\n iLCoactivo.registrarCoactivoAxis(coactivoDTOs, coactivo[4].toString());\n } catch (Exception e) {\n logger.error(\"Error al registrar coactivo 6000 :\", e);\n }\n }\n }", "private void cargarDatos() {\r\n txtRucDni.setText(objVentas.getObjCliente().getStr_rucdni());\r\n txtCliente.setText(objVentas.getObjCliente().getStr_razonSocial());\r\n txtDocumento.setText(objVentas.getStr_numeroDocumento());\r\n txtMonto.setText(String.valueOf(Util.redondeo(objVentas.getDbTotal(), 2) ));\r\n txtPaga.requestFocus();\r\n setLocationRelativeTo(null);\r\n\r\n String arr[] = objVentas.getStr_numeroDocumento().split(\"-\");\r\n \r\n \r\n \r\n \r\n List<Ventas> listaVentaDetalle = new ArrayList<>();\r\n listaVentaDetalle = PaqueteBusinessDelegate.getFlujoCajaService().\r\n listarVenta(String.valueOf(gui.getLocal().getInt_idLocal()), Util.SINPAGO, objVentas.getStr_numeroDocumento(), 2);\r\n cargarTabla(listaVentaDetalle);\r\n \r\n int cantidadDocumentos;\r\n if (!this.gui.getListaConfig().get(0).getTipoImpresion().equals(Config.TICKETERA)){\r\n //Determinar la cantidad de productos por documentos\r\n cantidadDocumentos=(listaVentaDetalle.size()/10);\r\n log.info(\"Cantidad: \"+cantidadDocumentos);\r\n\r\n if(listaVentaDetalle.size()%10!=0)\r\n cantidadDocumentos++;\r\n }else{\r\n cantidadDocumentos = 1;\r\n }\r\n \r\n \r\n log.info(\"Cantidad: \"+cantidadDocumentos);\r\n \r\n// System.out.println(\"local : \"+objVentas.getObjLocal().getInt_idLocal()+\" tD :\"+arr[2].trim());\r\n txtNroDocumento.setText(PaqueteBusinessDelegate.getVentasService().\r\n consultaSiguinteCorrelativo(objVentas.getObjLocal().getInt_idLocal(), arr[2].trim()));\r\n \r\n// System.out.println(\"consulta : \"+PaqueteBusinessDelegate.getVentasService().\r\n// consultaSiguinteCorrelativo(objVentas.getObjLocal().getInt_idLocal(), arr[2].trim()));\r\n String documento=txtNroDocumento.getText();\r\n String statico=txtNroDocumento.getText().split(\"/\")[0];\r\n// System.out.println(\"estatico : \"+statico);\r\n statico=statico.split(\"-\")[0].concat(\"-\").concat(statico.split(\"-\")[1]).concat(\"-\");\r\n \r\n\r\n if (cantidadDocumentos>1){\r\n for (int i=1;i<cantidadDocumentos;i++){\r\n \r\n if (i<cantidadDocumentos)\r\n documento+=\";\";\r\n \r\n documento+=statico.concat(String.valueOf( Util.stringTOint(\r\n txtNroDocumento.getText().split(\"/\")[0].split(\"-\")[2])+i)).\r\n concat(\"/\").concat(txtNroDocumento.getText().split(\"/\")[1]);\r\n\r\n \r\n log.info(\"NRO: \"+documento);\r\n }\r\n txtNroDocumento.setText(documento);\r\n }\r\n \r\n \r\n \r\n \r\n }", "private void gerarLaudoPermanenciaMaior(MpmPrescricaoMedica prescricao,\r\n\t\t\tList<MpmLaudo> laudoList, FatConvenioSaudePlano convenioSaudePlano,\r\n\t\t\tAghParametros seqLaudoMaiorPermanencia) {\r\n\t\tMpmTipoLaudoConvenio tipoLaudoConvenio = this\r\n\t\t\t\t.getMpmTipoLaudoConvenioDAO()\r\n\t\t\t\t.obterTempoValidadeTipoLaudoPermanenciaMaior(\r\n\t\t\t\t\t\tseqLaudoMaiorPermanencia.getVlrNumerico().shortValue(),\r\n\t\t\t\t\t\tconvenioSaudePlano);\r\n\r\n\t\tif (tipoLaudoConvenio != null) {\r\n\r\n\t\t\tShort quantidadeDiasFaturamento = 0;\r\n\t\t\tShort diasPermanenciaMaior = 0;\r\n\r\n\t\t\tMpmTipoLaudo tipoLaudoMaiorPermanencia = this.getMpmTipoLaudoDAO()\r\n\t\t\t\t\t.obterPorChavePrimaria(\r\n\t\t\t\t\t\t\tseqLaudoMaiorPermanencia.getVlrNumerico()\r\n\t\t\t\t\t\t\t\t\t.shortValue());\r\n\r\n\t\t\tif (prescricao.getAtendimento().getInternacao() != null) {\r\n\t\t\t\tif (prescricao.getAtendimento()\r\n\t\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar() != null){\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (prescricao.getAtendimento()\r\n\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t.getQuantDiasFaturamento() != null){\r\n\t\t\t\t\t\tquantidadeDiasFaturamento = prescricao.getAtendimento()\r\n\t\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t\t.getQuantDiasFaturamento();\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdiasPermanenciaMaior = prescricao.getAtendimento()\r\n\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t.getDiasPermanenciaMaior();\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (diasPermanenciaMaior == null || diasPermanenciaMaior > 0){\r\n\t\t\t\t\r\n\t\t\t\tInteger adicionalDias = 0;\r\n\t\t\t\tif (quantidadeDiasFaturamento != null) {\r\n\t\t\t\t\tadicionalDias = (quantidadeDiasFaturamento * 2) + 1;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (DateUtil.validaDataTruncadaMaiorIgual(new Date(), DateUtil\r\n\t\t\t\t\t\t.adicionaDias(prescricao.getAtendimento().getInternacao()\r\n\t\t\t\t\t\t\t\t.getDthrInternacao(), adicionalDias))) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (this.getMpmLaudoDAO()\r\n\t\t\t\t\t\t\t.obterCountLaudosPorTipoEAtendimento(\r\n\t\t\t\t\t\t\t\t\tprescricao.getAtendimento(),\r\n\t\t\t\t\t\t\t\t\ttipoLaudoMaiorPermanencia) <= 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tMpmLaudo laudo = new MpmLaudo();\r\n\t\t\t\t\t\tlaudo.setDthrInicioValidade(prescricao.getAtendimento()\r\n\t\t\t\t\t\t\t\t.getInternacao().getDthrInternacao());\r\n\t\t\t\t\t\tlaudo.setContaDesdobrada(false);\r\n\t\t\t\t\t\tlaudo.setImpresso(false);\r\n\t\t\t\t\t\tlaudo.setLaudoManual(false);\r\n\t\t\t\t\t\tlaudo.setAtendimento(prescricao.getAtendimento());\r\n\t\t\t\t\t\tlaudo.setTipoLaudo(tipoLaudoMaiorPermanencia);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlaudoList.add(laudo);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Test\n @Order(6)\n void tabuSizeTest() {\n for (String taillardFilename : SearchTestUtil.taillardFilenames) {\n System.out.println(\"-----------------\");\n System.out.println(\"Run \" + taillardFilename);\n System.out.println(\"-----------------\");\n tabuSizeTestWith(taillardFilename);\n }\n }", "private List<ItemListaIntegracaoDTO> montarListaInstituicaoDTO(List<InstituicaoCooperativaSCIDTO> lista) {\n\t\tList<ItemListaIntegracaoDTO> listaVO = new ArrayList<ItemListaIntegracaoDTO>();\n\n\t\tfor(InstituicaoCooperativaSCIDTO instituicao:lista){\n\t\t\tItemListaIntegracaoDTO item = new ItemListaIntegracaoDTO(instituicao.getNumCooperativa().toString(), instituicao.getNumCooperativa() + \" - \" + instituicao.getNome());\n\t\t\tlistaVO.add(item);\n\t\t}\n\t\t\n\t\tCollections.sort(listaVO, new Comparator<ItemListaIntegracaoDTO>() {\n\t\t\tpublic int compare(ItemListaIntegracaoDTO o1, ItemListaIntegracaoDTO o2){\n\t\t\t\t\treturn o1.getCodListaItem().compareTo(o2.getCodListaItem());\n\t\t\t\t} \n\t\t});\n\t\t\n\t\treturn listaVO;\t\t\n\t}", "public static ArrayList<Vkladi> rascetPolozBalans() {\r\n\t\tArrayList<Vkladi> foundVkladi = new ArrayList<Vkladi>();\r\n\r\n\t\tint t = 0;\r\n\t\tfor (Vkladi vkla : vklad) {\r\n\r\n\t\t\tt = t + vkla.getPribil();\r\n\t\t}\r\n\t\tSystem.out.println(\"Polozitelnii balanse Scetov= \" + t + \"$\");\r\n\t\treturn foundVkladi;\r\n\t}", "public List<NumeroMega> listar() {\n List<NumeroMega> lista = new ArrayList<NumeroMega>();\n\n // Definicao da instrucao SQL\n String sql = \"Select NumeroMega from \" +TABELA+ \" order by id\";\n\n // Objeto que recebe os registros do banco de dados\n Cursor cursor = getReadableDatabase().rawQuery(sql, null);\n\n try {\n while (cursor.moveToNext()) {\n // Criacao de nova referencia\n NumeroMega numeroMega = new NumeroMega();\n // Carregar os atributos com dados do BD\n\n numeroMega.setNumeroMega(cursor.getString(0));\n\n // Adicionar novo a lista\n lista.add(numeroMega);\n }\n } catch (SQLException e) {\n Log.e(TAG, e.getMessage());\n } finally {\n cursor.close();\n }\n return lista;\n }", "long getNombreElements();", "private void cargarFichaLepra_convivientes() {\r\n\r\n\t\tMap<String, Object> parameters = new HashMap<String, Object>();\r\n\t\tparameters.put(\"codigo_empresa\", codigo_empresa);\r\n\t\tparameters.put(\"codigo_sucursal\", codigo_sucursal);\r\n\t\tparameters.put(\"nro_identificacion\", tbxNro_identificacion.getValue());\r\n\t\tparameters.put(\"fecha_actual\", new Date());\r\n\r\n\t\t// log.info(\"parameters\" + parameters);\r\n\t\tseguimiento_control_pqtService.setLimit(\"limit 25 offset 0\");\r\n\r\n\t\t// log.info(\"parameters>>>>\" + parameters);\r\n\t\tBoolean fecha_tratamiento = seguimiento_control_pqtService\r\n\t\t\t\t.existe_fecha_fin_tratamiento(parameters);\r\n\t\t// log.info(\"fecha_tratamiento>>>>\" + fecha_tratamiento);\r\n\r\n\t\tif (fecha_tratamiento) {\r\n\t\t\tMap<String, Object> parametros = new HashMap<String, Object>();\r\n\t\t\tparametros.put(\"nro_identificacion\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_identificacion());\r\n\t\t\tparametros.put(\"nro_ingreso\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_ingreso());\r\n\t\t\tparametros.put(\"estado\", admision_seleccionada.getEstado());\r\n\t\t\tparametros.put(\"codigo_administradora\",\r\n\t\t\t\t\tadmision_seleccionada.getCodigo_administradora());\r\n\t\t\tparametros.put(\"id_plan\", admision_seleccionada.getId_plan());\r\n\t\t\tparametros.put(IVias_ingreso.ADMISION_PACIENTE,\r\n\t\t\t\t\tadmision_seleccionada);\r\n\t\t\tparametros.put(IVias_ingreso.OPCION_VIA_INGRESO,\r\n\t\t\t\t\tOpciones_via_ingreso.REGISTRAR);\r\n\t\t\ttabboxContendor.abrirPaginaTabDemanda(false,\r\n\t\t\t\t\tIRutas_historia.PAGINA_CONTROL_CONVIVIENTES_LEPRA,\r\n\t\t\t\t\tIRutas_historia.LABEL_CONTROL_CONVIVIENTES_LEPRA,\r\n\t\t\t\t\tparametros);\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n ArrayList<Persona> cola = new ArrayList<>();\r\n \r\n generarCola(cola);\r\n \r\n //Creamos variables que nos seran útiles\r\n double recaudacion;\r\n double recaudacionTotal=0;\r\n Persona espectadorActual;\r\n int edadActual;\r\n int contadorPersonas=0;\r\n \r\n //Creamos el iterator\r\n Iterator<Persona> it=cola.iterator();\r\n \r\n \r\n //Recorremos la cola\r\n while(it.hasNext()){\r\n \r\n espectadorActual=it.next();\r\n \r\n //\"Atendemos\" al espectador para que pague\r\n edadActual=espectadorActual.getEdad();\r\n \r\n //Comprobamosla edad\r\n if(edadActual>=5 && edadActual<=10) { \r\n \trecaudacion=1; \r\n } else if(edadActual>=11 && edadActual<=17) {\r\n \trecaudacion=2.5;\r\n } else {\r\n \trecaudacion=3.5;\r\n }\r\n contadorPersonas++;\r\n recaudacionTotal+=recaudacion;\r\n \r\n System.out.println(\"Una persona de \"+edadActual+\" años se le ha cobrado \" +recaudacion+ \" euros\");\r\n \r\n }\r\n \r\n //Mostramos el resultado\r\n System.out.println(\"La recaudación es de \"+recaudacionTotal+\" euros y han venido \"+contadorPersonas);\r\n \r\n }", "public Collection cargarMasivo(int codigoCiclo, String proceso, String subproceso, int periodo) {\n/* 287 */ Collection resultados = new ArrayList();\n/* */ try {\n/* 289 */ String s = \"select m.Codigo_Ciclo, m.Codigo_Plan, m.Codigo_Meta, m.Codigo_Objetivo, u.Descripcion Nombre_Area, Um.Descripcion as Nombre_Unidad_Medida, to_char(m.Codigo_Objetivo,'9999999999') ||' - ' || o.Descripcion Nombre_Objetivo, to_char(m.Codigo_Meta,'9999999999') ||' - ' || m.Descripcion Nombre_Meta, m.Unidad_Medida, m.Valor_Minimo, m.Valor_Maximo, l.Valor_Logro, case when l.Valor_Logro is not null then 'A' else 'N' end Existe from Cal_Planes p, Cal_Plan_Objetivos o, Cal_Plan_Metas m left join Cal_Logros l on( m.Codigo_Ciclo = l.Codigo_Ciclo and m.Codigo_Plan = l.Codigo_Plan and m.Codigo_Meta = l.Codigo_Meta and m.Codigo_Objetivo = l.Codigo_Objetivo and \" + periodo + \" = l.Periodo),\" + \" Unidades_Dependencia u,\" + \" Sis_Multivalores Um\" + \" where p.Ciclo = o.Codigo_Ciclo\" + \" and p.Codigo_Plan = o.Codigo_Plan\" + \" and o.Codigo_Ciclo = m.Codigo_Ciclo\" + \" and o.Codigo_Plan = m.Codigo_Plan\" + \" and o.Codigo_Objetivo = m.Codigo_Objetivo\" + \" and p.Codigo_Area = u.Codigo\" + \" and m.Unidad_Medida = Um.Valor\" + \" and Um.Tabla = 'CAL_UNIDAD_MEDIDA_META'\" + \" and o.Proceso = '\" + proceso + \"'\" + \" and o.Subproceso = '\" + subproceso + \"'\" + \" and p.Ciclo = \" + codigoCiclo + \" and m.Estado = 'A'\" + \" and o.Estado = 'A'\" + \" and o.Tipo_Objetivo in ('G', 'M')\";\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 333 */ if (periodo == 1) {\n/* 334 */ s = s + \" and m.mes01='S'\";\n/* */ }\n/* 336 */ else if (periodo == 2) {\n/* 337 */ s = s + \" and m.mes02='S'\";\n/* */ }\n/* 339 */ else if (periodo == 3) {\n/* 340 */ s = s + \" and m.mes03='S'\";\n/* */ }\n/* 342 */ else if (periodo == 4) {\n/* 343 */ s = s + \" and m.mes04='S'\";\n/* */ }\n/* 345 */ else if (periodo == 5) {\n/* 346 */ s = s + \" and m.mes05='S'\";\n/* */ }\n/* 348 */ else if (periodo == 6) {\n/* 349 */ s = s + \" and m.mes06='S'\";\n/* */ }\n/* 351 */ else if (periodo == 7) {\n/* 352 */ s = s + \" and m.mes07='S'\";\n/* */ }\n/* 354 */ else if (periodo == 8) {\n/* 355 */ s = s + \" and m.mes08='S'\";\n/* */ }\n/* 357 */ else if (periodo == 9) {\n/* 358 */ s = s + \" and m.mes09='S'\";\n/* */ }\n/* 360 */ else if (periodo == 10) {\n/* 361 */ s = s + \" and m.mes10='S'\";\n/* */ }\n/* 363 */ else if (periodo == 11) {\n/* 364 */ s = s + \" and m.mes11='S'\";\n/* */ }\n/* 366 */ else if (periodo == 12) {\n/* 367 */ s = s + \" and m.mes12='S'\";\n/* */ } \n/* */ \n/* 370 */ s = s + \" order by m.Codigo_Ciclo, m.Codigo_Objetivo, m.Codigo_Meta, u.Descripcion\";\n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* */ \n/* 377 */ boolean rtaDB = this.dat.parseSql(s);\n/* 378 */ if (!rtaDB) {\n/* 379 */ return resultados;\n/* */ }\n/* */ \n/* 382 */ this.rs = this.dat.getResultSet();\n/* 383 */ while (this.rs.next()) {\n/* 384 */ CalMetasDTO reg = new CalMetasDTO();\n/* 385 */ reg.setCodigoCiclo(codigoCiclo);\n/* 386 */ reg.setCodigoPlan(this.rs.getInt(\"codigo_plan\"));\n/* 387 */ reg.setCodigoMeta(this.rs.getInt(\"codigo_meta\"));\n/* 388 */ reg.setCodigoObjetivo(this.rs.getInt(\"codigo_objetivo\"));\n/* 389 */ reg.setNombreArea(this.rs.getString(\"Nombre_Area\"));\n/* 390 */ reg.setNombreMeta(this.rs.getString(\"Nombre_meta\"));\n/* 391 */ reg.setNombreObjetivo(this.rs.getString(\"Nombre_Objetivo\"));\n/* 392 */ reg.setUnidadMedida(this.rs.getString(\"unidad_medida\"));\n/* 393 */ reg.setValorMinimo(this.rs.getDouble(\"valor_minimo\"));\n/* 394 */ reg.setValorMaximo(this.rs.getDouble(\"valor_maximo\"));\n/* 395 */ reg.setValorLogro(this.rs.getDouble(\"Valor_Logro\"));\n/* 396 */ reg.setNombreUnidadMedida(this.rs.getString(\"nombre_unidad_medida\"));\n/* 397 */ reg.setEstado(this.rs.getString(\"existe\"));\n/* 398 */ resultados.add(reg);\n/* */ }\n/* */ \n/* 401 */ } catch (Exception e) {\n/* 402 */ e.printStackTrace();\n/* 403 */ Utilidades.writeError(\"CalPlanMetasFactory:cargarTodos \", e);\n/* */ } \n/* 405 */ return resultados;\n/* */ }", "@Test(timeout = 4000)\n public void test14() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n byte[][] byteArray0 = new byte[9][4];\n byte[] byteArray1 = new byte[4];\n byteArray1[0] = (byte)1;\n byteArray1[1] = (byte)87;\n byteArray1[2] = (byte) (-12);\n byteArray1[3] = (byte) (-106);\n byteArray0[0] = byteArray1;\n byte[] byteArray2 = new byte[2];\n byteArray2[0] = (byte)1;\n byteArray2[1] = (byte)1;\n byteArray0[1] = byteArray2;\n byte[] byteArray3 = new byte[3];\n byteArray3[0] = (byte) (-106);\n byteArray3[1] = (byte) (-106);\n byteArray3[2] = (byte)87;\n byteArray0[2] = byteArray3;\n byte[] byteArray4 = new byte[3];\n byteArray4[0] = (byte)87;\n byteArray4[1] = (byte)71;\n byteArray4[2] = (byte)1;\n byteArray0[3] = byteArray4;\n byte[] byteArray5 = new byte[8];\n byteArray5[0] = (byte) (-12);\n byteArray5[1] = (byte)71;\n byteArray5[2] = (byte)87;\n byteArray5[3] = (byte) (-106);\n byteArray5[4] = (byte) (-106);\n byteArray5[5] = (byte)87;\n byteArray5[6] = (byte) (-106);\n byteArray5[7] = (byte) (-106);\n byteArray0[4] = byteArray5;\n byte[] byteArray6 = new byte[6];\n byteArray6[0] = (byte)87;\n byteArray6[1] = (byte)87;\n byteArray6[2] = (byte) (-106);\n byteArray6[3] = (byte)71;\n byteArray6[4] = (byte)71;\n byteArray6[5] = (byte)1;\n byteArray0[5] = byteArray6;\n byte[] byteArray7 = new byte[7];\n byteArray7[0] = (byte) (-12);\n byteArray7[1] = (byte)71;\n byteArray7[2] = (byte)1;\n byteArray7[3] = (byte) (-12);\n byteArray7[4] = (byte)1;\n byteArray7[5] = (byte)87;\n byteArray7[6] = (byte) (-106);\n byteArray0[6] = byteArray7;\n byte[] byteArray8 = new byte[9];\n byteArray8[0] = (byte)29;\n byteArray8[1] = (byte)59;\n byteArray8[2] = (byte)1;\n byteArray8[3] = (byte) (-12);\n byteArray8[4] = (byte) (-106);\n byteArray8[5] = (byte) (-12);\n byteArray8[6] = (byte) (-106);\n byteArray8[7] = (byte) (-12);\n byteArray8[8] = (byte) (-12);\n byteArray0[7] = byteArray8;\n byte[] byteArray9 = new byte[8];\n byteArray9[0] = (byte)59;\n byteArray9[1] = (byte) (-44);\n byteArray9[2] = (byte)59;\n byteArray9[3] = (byte)1;\n byteArray9[4] = (byte)29;\n byteArray9[5] = (byte)29;\n byteArray9[6] = (byte)87;\n byteArray9[7] = (byte)29;\n byteArray0[8] = byteArray9;\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n // Undeclared exception!\n try { \n fBCachedFetcher0.last();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "public static void main(String[] args) {\n\r\n\t\tBeneficiadoDAO dao = new BeneficiadoDAO();\r\n\t\tList<Beneficiado> lista1 = new ArrayList<>();\r\n\t\tList<Beneficiado> lista2 = new ArrayList<>();\r\n\t\tList<String> telefones1 = new ArrayList<String>();\r\n\t\tList<String> telefones2 = new ArrayList<String>();\r\n\t\t\r\n\t\ttry {\r\n\t\t\tlista1 = dao.listarTelefonesCelular1(\"iraja\");\r\n\t\t\tfor (int i = 0; i < lista1.size(); i++) {\r\n\t\t\t\ttelefones1.add(lista1.get(i).getTelefoneCelular1());\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tlista2 = dao.listarTelefonesCelular2(\"iraja\");\r\n\t\t\tfor (int i = 0; i < lista2.size(); i++) {\r\n\t\t\t\ttelefones2.add(lista2.get(i).getTelefoneCelular2());\r\n\t\t\t}\r\n\t\t} catch (RuntimeException e) {\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\tfor (String string : telefones1) {\r\n\t\t\tSystem.out.println(string.toString());\r\n\t\t}\r\n\t\t\r\n\t\tfor (String string : telefones2) {\r\n\t\t\tSystem.out.println(string.toString());\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tSystem.out.println(telefones1.size());\r\n\t\tSystem.out.println(telefones2.size());\r\n\r\n\t\t//System.out.println(\"Depois da comparação \"+lista.size());\r\n\r\n\t\t/*for (int i = 0; i < lista.size(); i++) {\r\n\t\t\tString aux1 = new String();\r\n\t\t\tString aux2 = new String();\r\n\t\t\t\r\n\t\t\taux1 = lista.get(i).getTelefoneCelular1();\r\n\t\t\taux2 = lista.get(i).getTelefoneCelular2();\r\n\t\t\t\r\n\t\t\tif(!aux1.equals(\"null\")){\r\n\t\t\t\ttelefones.add(\"21\"+aux1);\r\n\t\t\t}\r\n\t\t\t//else if(!aux2.equals(null)){\r\n\t\t\t\t//telefones.add(\"21\"+aux2);\r\n\t\t\t\r\n\t\t\t//}\r\n\t\t\t*/\r\n\t}", "@Test\n public void testContinguosStorageReSize() {\n for (int i = 9; i >= 0; i--) {\n String input = String.format(\"b0%d\", i);\n list.addToFront(input);\n }\n\n list.addToFront(\"Filler1\");\n list.addToBack(\"Filler2\");\n list.addToBack(\"Filler3\");\n list.addToFront(\"Filler0\");\n list.addAtIndex(0, \"Filler#\");\n list.addAtIndex(2, \"Filler!\");\n list.addAtIndex(6, \"Filler$\");\n list.removeFromFront();\n list.removeFromBack();\n list.removeAtIndex(4);\n list.removeAtIndex(0);\n list.removeAtIndex(2);\n\n int actualCapacity = ((Object[]) (list.getBackingArray())).length;\n for (int i = 0; i < list.size(); i++) {\n Assert.assertNotNull(((Object[]) (list.getBackingArray()))[i]);\n }\n for (int i = list.size(); i < actualCapacity; i++) {\n Assert.assertNull(((Object[]) (list.getBackingArray()))[i]);\n }\n }", "@Test(timeout = 4000)\n public void test17() throws Throwable {\n FileUtil fileUtil0 = new FileUtil();\n EvoSuiteFile evoSuiteFile0 = new EvoSuiteFile(\"/S_NULL.XML\");\n byte[] byteArray0 = new byte[9];\n FileSystemHandling.appendDataToFile(evoSuiteFile0, byteArray0);\n FileInputStream fileInputStream0 = fileUtil0.fetchSimilarItems((String) null, \"\");\n assertEquals(9, fileInputStream0.available());\n }", "@Test(timeout = 4000)\n public void test21() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n XSQLVAR[] xSQLVARArray0 = new XSQLVAR[0];\n FBResultSet fBResultSet0 = new FBResultSet(xSQLVARArray0, linkedList0);\n byte[][] byteArray0 = new byte[7][0];\n byte[] byteArray1 = new byte[7];\n byteArray1[0] = (byte) (-111);\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, fBResultSet0);\n FileSystemHandling.shouldAllThrowIOExceptions();\n fBCachedFetcher0.insertRow(byteArray0);\n fBCachedFetcher0.insertRow(fBResultSet0.row);\n assertFalse(fBCachedFetcher0.isBeforeFirst());\n }", "BigDecimal getCacheSpaceAvailable();", "public static Resultado MBBR(Demanda d, GrafoMatriz G, GrafoMatriz Gaux, ArrayList<ListaEnlazadaAsignadas> lea, int capacidadE, ListaEnlazada [] ksp){\n \n int caminoMasCorto = 0;\n ArrayList<Integer> caminosMovidos = new ArrayList<>();\n ListaEnlazada [] kspResults;\n \n //se busca el caminos mas corto\n for (int i=1; i<ksp.length; i++){\n if (Utilitarios.calcularSaltos(ksp[i])<Utilitarios.calcularSaltos(ksp[caminoMasCorto])){\n caminoMasCorto = i;\n }\n }\n \n caminosMovidos = Utilitarios.obtenerCaminosMovidos(ksp[caminoMasCorto], G, d);\n \n if (caminosMovidos.size()==0)\n System.out.println(\"Que bola\");\n \n Resultado [] results = Utilitarios.buscarCaminosAlternativos(caminosMovidos, lea, G, Gaux, capacidadE);\n \n if (results!=null){\n for (int i=0; i<results.length; i++){\n kspResults = Utilitarios.KSP(G, lea.get(caminosMovidos.get(i)).getDemanda().getOrigen(), \n lea.get(caminosMovidos.get(i)).getDemanda().getDestino(), 5);\n Utilitarios.asignarFS_saveRoute(kspResults, results[i], G, d, lea, -1);\n \n Utilitarios.limpiarCaminoAnterior(lea.get(caminosMovidos.get(i)),G,caminosMovidos.get(i),capacidadE, lea);\n }\n Resultado r = new Resultado();\n r.setCamino(caminoMasCorto);\n r.setInicio(0);\n r.setFin(d.getNroFS()-1);\n \n return r;\n }\n return null;\n }", "public ArrayList<Comobox> fontesRendimentos()\n {\n @SuppressWarnings(\"MismatchedQueryAndUpdateOfCollection\")\n ArrayList<Comobox> al= new ArrayList<>();\n @SuppressWarnings(\"UnusedAssignment\")\n ResultSet rs = null;\n sql=\"select * FROM VER_FONTEPAGAMENTO\";\n Conexao conexao = new Conexao();\n if(conexao.getCon()!=null)\n {\n try \n {\n cs = conexao.getCon().prepareCall(sql);\n cs.execute();\n rs=cs.executeQuery(); \n if (rs!=null) \n { \n while (rs.next())\n { \n al.add(new Comobox(rs.getString(\"REALID\"), rs.getString(\"FONTE\")));\n } \n }\n rs.close();\n } \n catch (SQLException ex)\n {\n Logger.getLogger(CreditoDao.class.getName()).log(Level.SEVERE, null, ex);\n System.out.println(\"Erro a obter fontes rendimentos \"+ex.getMessage());\n }\n }\n return al;\n }", "long getSize();", "private static List<Billetes> generarBilletes(String fecha, Pasajero p){\n\t\tList<Billetes> billetes = new ArrayList<>();\n\t\t\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tBilletes billete = new Billetes();\n\t\t\tbillete.setId(i);\n\t\t\tbillete.setFecha(fecha);\n\t\t\t\n\t\t\tchar c1 = (char)new Random().nextInt(50);\n\t\t\tchar c2 = (char)new Random().nextInt(50);\n\t\t\t\n\t\t\t/*\n\t\t\t * \n\t\t\t */\n\t\t\tbillete.setAsiento(\"\" + c1 + c2 + new Random().nextInt(100) + new Random().nextInt(50));\n\t\t\tbillete.setPasajero(p); \n\t\t\tbillete.setVuelo(p.getVuelos().get(new Random().nextInt(p.getVuelos().size())));\n\t\t\t\n\t\t\tbilletes.add(billete);\n\t\t}\n\t\t\n\t\treturn billetes;\n\t}", "public long reserva_de_entradas(int identificador_evento, Date fechaevento, Horario[] listahorarios ) throws ParseException {\n fgen.info (\"Identificador del evento\" + identificador_evento);\n fgen.info (\"Fecha del evento\" + fechaevento);\n ArrayList<Horario> horariosReserva = new ArrayList<Horario>();\n for (int i = 0; i < listahorarios.length; i++) {\n \n Horario horario = listahorarios[i];\n fgen.info (\"Horario : \" + horario.getHorario().toString()); \n horariosReserva.add(horario);\n List<Disponibilidad> listadisponibles = listahorarios[i].disponibilidades;\n for (int j = 0; j < listadisponibles.size() ; j++) { \n fgen.info (\" Disponibilidad - Cantidad: \" + listadisponibles.get(j).getCantidad());\n fgen.info (\" Disponibilidad - Precio: \" + listadisponibles.get(j).getPrecio());\n fgen.info (\" Disponibilidad - Sector: \" + listadisponibles.get(j).getSector());\n } \n \n \n } \n //Inicializo o tomo lo que esta en memoria de la lista de reservas\n ListaReservas reservas= new ListaReservas(); \n // busco el evento y que la lista de horarios sea en la que quiero reservar\n ListaEventos eventos = new ListaEventos();\n Calendar c = Calendar.getInstance();\n c.setTime(fechaevento);\n Evento e = eventos.buscarEvento(identificador_evento, c);\n List<Horario> horariosRetornar = new ArrayList<Horario>();\n if(e != null)\n {\n horariosRetornar = e.getHorarios();\n } \n \n if (horariosRetornar != null)\n {\n for (int i = 0; i < horariosRetornar.size(); i++) {\n for (int j = 0; j < listahorarios.length; j++) {\n Date fechaE = horariosRetornar.get(i).getHorario().getTime(); \n Date fechaEventoDate = listahorarios[j].hora.getTime(); \n if(fechaE.equals(fechaEventoDate)) \n { for (int k = 0; k < horariosRetornar.get(i).disponibilidades.size(); k++) {\n for (int l = 0; l < listahorarios[j].disponibilidades.size(); l++) {\n Disponibilidad d= horariosRetornar.get(i).disponibilidades.get(k);\n Disponibilidad r= listahorarios[j].disponibilidades.get(l);\n if (d.cantidad >= r.cantidad && d.sector.equalsIgnoreCase(r.sector) && d.precio==r.precio)\n {\n d.setCantidad(d.cantidad-r.cantidad);\n //Reserva reserv= new Reserva();\n //reservas.contador_Id= reservas.contador_Id +1;\n //reserv.idReserva= reservas.contador_Id;\n //reserv.Estado=1;\n //reserv.idEvento = identificador_evento;\n //reserv.horarios.add(listahorarios[j]);\n //reservas.listaReserva.add(reserv);\n //return reserv.idReserva;\n }\n else if(d.cantidad < r.cantidad && d.sector.equalsIgnoreCase(r.sector) && d.precio==r.precio)\n {\n //Si hay alguna solicitud de de reserva que no se pueda cumplir. Re reorna 0.\n //TODO: Hay que volver para atras las cantidades modificadas.\n return 0;\n }\n \n }\n \n }\n }\n }\n }\n Reserva reserv= new Reserva();\n reservas.contador_Id= reservas.contador_Id +1;\n reserv.idReserva= reservas.contador_Id;\n reserv.Estado=1;\n reserv.idEvento = identificador_evento;\n reserv.horarios = horariosReserva;\n reserv.fechaEvento = c;\n reservas.listaReserva.add(reserv);\n return reserv.idReserva;\n }\n \n return 0;\n }", "@Test\n public void retriveAllTest() throws SQLException {\n manager = new TableServizioManager(mockDb);\n List<Servizio> lista = manager.retriveAll();\n assertEquals(7,lista.size(),\"It should return a list of length 7\");\n }", "private void cargarFichaLepra_discapacidades() {\r\n\r\n\t\tMap<String, Object> parameters = new HashMap<String, Object>();\r\n\t\tparameters.put(\"codigo_empresa\", codigo_empresa);\r\n\t\tparameters.put(\"codigo_sucursal\", codigo_sucursal);\r\n\t\tparameters.put(\"nro_identificacion\", tbxNro_identificacion.getValue());\r\n\t\tparameters.put(\"fecha_actual\", new Date());\r\n\r\n\t\t// log.info(\"parameters\" + parameters);\r\n\t\tseguimiento_control_pqtService.setLimit(\"limit 25 offset 0\");\r\n\r\n\t\t// log.info(\"parameters>>>>\" + parameters);\r\n\t\tBoolean fecha_tratamiento = seguimiento_control_pqtService\r\n\t\t\t\t.existe_fecha_fin_tratamiento(parameters);\r\n\t\t// log.info(\"fecha_tratamiento>>>>\" + fecha_tratamiento);\r\n\r\n\t\tif (fecha_tratamiento) {\r\n\t\t\tMap<String, Object> parametros = new HashMap<String, Object>();\r\n\t\t\tparametros.put(\"nro_identificacion\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_identificacion());\r\n\t\t\tparametros.put(\"nro_ingreso\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_ingreso());\r\n\t\t\tparametros.put(\"estado\", admision_seleccionada.getEstado());\r\n\t\t\tparametros.put(\"codigo_administradora\",\r\n\t\t\t\t\tadmision_seleccionada.getCodigo_administradora());\r\n\t\t\tparametros.put(\"id_plan\", admision_seleccionada.getId_plan());\r\n\t\t\tparametros.put(IVias_ingreso.ADMISION_PACIENTE,\r\n\t\t\t\t\tadmision_seleccionada);\r\n\t\t\tparametros.put(IVias_ingreso.OPCION_VIA_INGRESO,\r\n\t\t\t\t\tOpciones_via_ingreso.REGISTRAR);\r\n\t\t\ttabboxContendor.abrirPaginaTabDemanda(false,\r\n\t\t\t\t\tIRutas_historia.PAGINA_VALORACION_DISCAPACIDADES_LEPRA,\r\n\t\t\t\t\tIRutas_historia.LABEL_VALORACION_DISCAPACIDADES_LEPRA,\r\n\t\t\t\t\tparametros);\r\n\t\t}\r\n\t}", "static int [] GerarAleatorio()\n {\n Random gerar = new Random();\n int [] Aleatorio = new int [pergu]; // Cria um Vetor com o tamanho de quantidade de perguntas\n \n \n int pos1, pos2, auxilio; \n \n for (int i = 0; i < Aleatorio.length; i++) \n {\n Aleatorio[i] = i ; // preenche o vetor\n }\n \n for (int i = 0; i < 1000; i++) //Quantidade de vezes que as perguntas serão embaralhadas \n {\n pos1 = gerar.nextInt(Aleatorio.length);\n pos2 = gerar.nextInt(Aleatorio.length);\n //troca \n auxilio = Aleatorio[pos1]; //guarda o valor da posição 1\n \n Aleatorio [pos1] = Aleatorio[pos2]; //troca o valor de 1 para 2\n Aleatorio[pos2] = auxilio; //troca o valor de 2 para o valor que estava na 1\n }\n \n \n return Aleatorio; \n }", "long getPageSize();", "long getPageSize();", "long getPageSize();", "@Test\r\n\tpublic void testAcquistareBigliettiE1() {\r\n\t\tCartaDiCredito carta = new CartaDiCredito(\"2334549359434\",23353.89);\r\n\t\tCliente c1 = new Cliente(\"3\",\"Logan\",\"Peck\",\"logan@hotmail.com\",\r\n\t\t\t\t\"M\",\"333152497\",\"Logan92\",\"loganlogan\",\"loganlogan\",\"il tuo nome\",carta);\r\n\t\tp1.acquistareBiglietti(3,\"carta\", c1);\r\n\t\t//verifico che ci siano 3 biglietti\r\n\t\tassertEquals(3,c1.getPrenotazioni().size());\r\n\t}", "public int getSize(){return this.IdAgente.size();}", "private void cargarTarjetaTuberculosis() {\r\n\t\tMap<String, Object> parametros = new HashMap<String, Object>();\r\n\t\tparametros.put(\"nro_identificacion\",\r\n\t\t\t\tadmision_seleccionada.getNro_identificacion());\r\n\t\tparametros.put(\"nro_ingreso\", admision_seleccionada.getNro_ingreso());\r\n\t\tparametros.put(\"estado\", admision_seleccionada.getEstado());\r\n\t\tparametros.put(\"codigo_administradora\",\r\n\t\t\t\tadmision_seleccionada.getCodigo_administradora());\r\n\t\tparametros.put(\"id_plan\", admision_seleccionada.getId_plan());\r\n\t\tparametros.put(IVias_ingreso.ADMISION_PACIENTE, admision_seleccionada);\r\n\t\tparametros.put(IVias_ingreso.OPCION_VIA_INGRESO,\r\n\t\t\t\tOpciones_via_ingreso.REGISTRAR);\r\n\t\ttabboxContendor.abrirPaginaTabDemanda(false,\r\n\t\t\t\tIRutas_historia.PAGINA_HC_TUBERCULOSIS,\r\n\t\t\t\tIRutas_historia.LABEL_HC_TUBERCULOSIS, parametros);\r\n\t}", "public static void main(String[] args) {\n\t\tFile dir = new File(\"H:\");\r\n\t\tString[] filelist = dir.list();\r\n\t\tlong total = 0;\r\n\t\tlong t = 0;\r\n\t\tfor(int i=0;i<filelist.length;i++){\r\n\t\t\t File readfile = new File(\"H:\" + \"\\\\\" + filelist[i]);\r\n\t\t\t t = readFile(readfile)/1024/1024;\r\n\t\t\t System.out.println(\"name=\" + readfile.getName() + \" size:=\" + t + \"MB\");\r\n\t\t\t total += t;\r\n\t\t}\r\n\t\tSystem.out.println(\"OK,all the files is list over,the number is \" + filelist.length + \"the total size is \" + total); \r\n\t}", "long buscarPrimeiro();", "@Test(timeout = 4000)\n public void test10() throws Throwable {\n FileUtil fileUtil0 = new FileUtil();\n EvoSuiteFile evoSuiteFile0 = new EvoSuiteFile(\"/A_.XML\");\n FileSystemHandling.appendStringToFile(evoSuiteFile0, \"\");\n ArrayList<Object> arrayList0 = new ArrayList<Object>();\n FileInputStream fileInputStream0 = fileUtil0.fetchAccessories(\"\", arrayList0);\n assertEquals(0, fileInputStream0.available());\n }", "public List<String> pot(ReportePlazaDTO reportePlazaDTO) {\n List<CustomOutputFile> lista = new ArrayList<CustomOutputFile>();\n List<String> listaString = new ArrayList<String>();\n\n String qnaCaptura = reportePlazaDTO.getQnaCaptura();\n String qnaCaptura2 = \"\";\n\n if (new Integer(qnaCaptura) % 2 == 0) {\n qnaCaptura2 = String.valueOf((new Integer(qnaCaptura) - 1));\n } else {\n qnaCaptura2 = qnaCaptura;\n }\n\n\n if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"e\")) {\n\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotEscenario(qnaCaptura);\n listaString.add(\"ID del Cargo,Nombre del Cargo\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"i\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotInmueble(qnaCaptura);\n listaString.add(\"Id Domicilio,Calle,Número Exterior,Número Interior,Colonia,Municipio,Estado/Entidad Fef.,País,Código Postal,Tipo de Oficina\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"a\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotAltas(qnaCaptura, \n qnaCaptura2);\n listaString.add(\"ID del Servidor Público,Nombre,Primer Apellido,Segundo Apellido,Tipo Vacancia,Telefono Directo,Conmutador,Extensión,Fax,Email,ID Domicilio,Nivel de Puesto,Id del Cargo,ID del Cargo Superior,Nivel_Jerarquico\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"b\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotBajas(qnaCaptura, \n qnaCaptura2);\n listaString.add(\"ID del Servidor Público\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"d\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotDirectorio(qnaCaptura, \n qnaCaptura2);\n listaString.add(\"Unidad,RFC,ID del Servidor Público,Nombre,Primer Apellido,Segundo Apellido,Tipo Vacancia,Telefono Directo,Conmutador,Extensión,Fax,Email,ID Domicilio,Nivel de Puesto,Id del Cargo,ID del Cargo Superior,Nivel_Jerarquico\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"r\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotRemuneraciones(qnaCaptura, \n qnaCaptura2);\n listaString.add(\"Id Puesto,Nombre,Tipo,SubTipo,Sueldo Base,Compensación Garantizada, Total Bruto, Total Neto,Nombre 01 Remuneracion,Monto 01 Remuneracion,Nombre 02 Remuneracion,Monto 02 Remuneracion,Nombre 03 Remuneracion,Monto 03 Remuneracion,Nombre 04 Remuneracion,Monto 04 Remuneracion,Nombre 05 Remuneracion,Monto 05 Remuneracion,Nombre 06 Remuneracion,Monto 06 Remuneracion,Nombre 07 Remuneracion,Monto 07 Remuneracion,Nombre 08 Remuneracion,Monto 08 Remuneracion,Nombre 09 Remuneracion,Monto 09 Remuneracion,Nombre 10 Remuneracion,Monto 10 Remuneracion,Nombre 11 Remuneracion,Monto 11 Remuneracion,Nombre 12 Remuneracion,Monto 12 Remuneracion,Nombre 13 Remuneracion,Monto 13 Remuneracion,Nombre 14 Remuneracion,Monto 14 Remuneracion,Nombre 15 Remuneracion,Monto 15 Remuneracion,Institucional,Colectivo de Retiro,Gastos Médicos,Separación Individualizado,Riesgos de Trabajo,Nombre Otros Seguros 1,Monto Otros Seguros 1,Nombre Otros Seguros 2,Monto Otros Seguros 2,Nombre Otros Seguros 3,Monto Otros Seguros 3,Nombre Otros Seguros 4,Monto Otros Seguros 4,Nombre Otros Seguros 5,Monto Otros Seguros 5,Nombre Otros Seguros 6,Monto Otros Seguros 6,Nombre Otros Seguros 7,Monto Otros Seguros 7,Nombre Otros Seguros 8,Monto Otros Seguros 8,Nombre Otros Seguros 9,Monto Otros Seguros 9,Nombre Otros Seguros 10,Monto Otros Seguros 10,Nombre Otros Seguros 11,Monto Otros Seguros 11,Nombre Otros Seguros 12,Monto Otros Seguros 12,Nombre Otros Seguros 13,Monto Otros Seguros 13,Nombre Otros Seguros 14,Monto Otros Seguros 14,Nombre Otros Seguros15,Monto Otros Seguros 15,Prima Vacacional,Primas de Antigüedad,Gratificación de Fin de Año,Pagas de Defunción,Ayuda para Despensa,Vacaciones,Nombre Prest. Econom 1,Monto Prest. Econom 1,Nombre Prest. Econom 2,Monto Prest. Econom 2,Nombre Prest. Econom 3,Monto Prest. Econom 3,Nombre Prest. Econom 4,Monto Prest. Econom 4,Nombre Prest. Econom 5,Monto Prest. Econom 5,Nombre Prest. Econom 6,Monto Prest. Econom 6,Nombre Prest.Econom 7,Monto Prest. Econom 7,Nombre Prest. Econom 8,Monto Prest. Econom 8,Nombre Prest. Econom 9,Monto Prest. Econom 9,Nombre Prest. Econom 10,Monto Prest. Econom 10,Nombre Prest. Econom 11,Monto Prest. Econom 11,Nombre Prest. Econom 12,Monto Prest. Econom 12,Nombre Prest. Econom 13,Monto Prest. Econom 13,Nombre Prest. Econom 14,Monto Prest. Econom 14,Nombre Prest. Econom 15,Monto Prest. Econom 15,Asistencia Legal,Asignación de Vehículo y/o Apoyo Económico ,Equipo de Telefonía Celular,Gastos de Alimentación,Nombre Prest. Inherentes al Puesto 1,Monto Prest. Inherentes al Puesto 1,Nombre Prest. Inherentes al Puesto 2,Monto Prest. Inherentes al Puesto 2,Nombre Prest. Inherentes al Puesto 3,Monto Prest. Inherentes al Puesto 3,Nombre Prest. Inherentes al Puesto 4,Monto Prest. Inherentes al Puesto 4,Nombre Prest. Inherentes al Puesto 5,Monto Prest. Inherentes al Puesto 5,Nombre Prest. Inherentes al Puesto 6,Monto Prest. Inherentes al Puesto 6,Nombre Prest. Inherentes al Puesto 7,Monto Prest. Inherentes al Puesto 7,Nombre Prest. Inherentes al Puesto 8,Monto Prest. Inherentes al Puesto 8,Nombre Prest. Inherentes al Puesto 9,Monto Prest. Inherentes al Puesto 9,Nombre Prest. Inherentes al Puesto 10,Monto Prest. Inherentes al Puesto 10,Nombre Prest. Inherentes al Puesto 11,Monto Prest. Inherentes al Puesto 11,Nombre Prest. Inherentes al Puesto 12,Monto Prest. Inherentes al Puesto 12,Nombre Prest. Inherentes al Puesto 13,Monto Prest. Inherentes al Puesto 13,Nombre Prest. Inherentes al Puesto 14,Monto Prest. Inherentes al Puesto 14,Nombre Prest. Inherentes al Puesto 15,Monto Prest. Inherentes al Puesto 15,ISSSTE / IMSS,FOVISSSTE / INFONAVIT,SAR,Nombre 01 Prest.Seg Social,Monto 01 Prest.Seg Social,Nombre 02 Prest.Seg Social,Monto 02 Prest.Seg Social,Nombre 03 Prest.Seg Social,Monto 03 Prest.Seg Social,Nombre 04 Prest.Seg Social,Monto 04 Prest.Seg Social,Nombre 05 Prest.Seg Social,Monto 05 Prest.Seg Social,Nombre 06 Prest.Seg Social,Monto 06 Prest.Seg Social,Nombre 07 Prest.Seg Social,Monto 07 Prest.Seg Social,Nombre 08 Prest.Seg Social,Monto 08 Prest.Seg Social,Nombre 09 Prest.Seg Social,Monto 09 Prest.Seg Social,Nombre 10 Prest.Seg Social,Monto 10 Prest.Seg Social,Nombre 11 Prest.Seg Social,Monto 11 Prest.Seg Social,Nombre 12 Prest.Seg Social,Monto 12 Prest.Seg Social,Nombre 13 Prest.Seg Social,Monto 13 Prest.Seg Social,Nombre 14 Prest.Seg Social,Monto 14 Prest.Seg Social,Nombre 15 Prest.Seg Social,Monto 15 Prest.Seg Social,Préstamos,Becas,Indemnizaciones,Nombre Otro Tipo Incentivo 01,Monto. Otro Tipo Incentivo 01,Nombre Otro Tipo Incentivo 02,Monto. Otro Tipo Incentivo 02,Nombre Otro Tipo Incentivo 03,Monto. Otro Tipo Incentivo 03,Nombre Otro Tipo Incentivo 04,Monto. Otro Tipo Incentivo 04,Nombre Otro Tipo Incentivo05,Monto. Otro Tipo Incentivo 05,Nombre Otro Tipo Incentivo 06,Monto. Otro Tipo Incentivo 06,Nombre Otro Tipo Incentivo 07,Monto. Otro Tipo Incentivo 07,Nombre Otro Tipo Incentivo 08,Monto. Otro Tipo Incentivo 08,Nombre Otro Tipo Incentivo 09,Monto. Otro Tipo Incentivo 09,Nombre Otro Tipo Incentivo 10,Monto. Otro Tipo Incentivo10,Nombre Otro Tipo Incentivo 11,Monto. Otro Tipo Incentivo 11,Nombre Otro Tipo Incentivo 12,Monto. Otro Tipo Incentivo12,Nombre Otro Tipo Incentivo 13,Monto. Otro Tipo Incentivo 13,Nombre Otro Tipo Incentivo 14,Monto. Otro Tipo Incentivo 14,Nombre Otro Tipo Incentivo 15,Monto. Otro Tipo Incentivo 15\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"f\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotFuncion((reportePlazaDTO.getQnaCaptura().substring(0, \n 4)));\n listaString.add(\"Identificador de la Facultad,Fundamento Legal,Documento Registrado,Unidad Administrativa,Nombre de la Unidad Administrativa\");\n } else if (reportePlazaDTO.getOrigen().equalsIgnoreCase(\"s\")) {\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotEstadistico(qnaCaptura);\n listaString.add(\"NIVEL,G,H,HH,I,J,K,L,M,N,O,Total\");\n }\n\n if (lista != null) {\n for (CustomOutputFile row: lista) {\n listaString.add(row.getRegistro());\n }\n } else\n listaString = null;\n return listaString;\n\n }", "@Test\n\tpublic void testListarVazio() throws IOException {\n\t\t// 1) criar o arquivo de dados vazio\n\t\tString nomeArquivo = \"dados.txt\";\n\t\tnew File(nomeArquivo).createNewFile();\t\t\n\t\t// 2) criar o processador de arquivos\n\t\t// utilizando o arquivo criado acima\n\t\tProcessadorDeArquivoSequencial pas = \n\t\t\t\tnew ProcessadorDeArquivoSequencial(\n\t\t\t\t\t\tnomeArquivo);\n\t\t// 3) solicitar a listagem dos registros\n\t\t// do processador\n\t\tList<Registro> lista = pas.listar();\n\t\t// 4) verificar tamanho zero dos registros\n\t\tAssert.assertTrue(lista.isEmpty());\n\t\t// 5) excluir o arquivo criado\n\t\tnew File(nomeArquivo).delete();\n\t}", "@Test\n public void allSize() throws Exception{\n fillFile();\n Assert.assertEquals(maxBlocks, rf.size());\n }", "Long diskSizeBytes();", "abstract public long[] getBlockListAsLongs();", "public static void main(String[] args) {\n\n Set<Long> ids = LongStream.range(0, 1_000_000).boxed().collect(Collectors.toSet());\n // HashSet\n // ArrayList\n // Long[]\n // long[]\n // int[]\n // LinkedList\n System.out.println(\"Allocated!\");\n\n System.out.println(PerformanceUtil.getUsedHeap());\n }", "@Test\r\n\tpublic void testSize() {\r\n\t\tAssert.assertEquals(15, list.size());\r\n\t}", "public final List<byte[]> mo9767g(int i) {\n ArrayList arrayList = new ArrayList();\n while (i > 0) {\n int min = Math.min(i, 4096);\n byte[] bArr = new byte[min];\n int i2 = 0;\n while (i2 < min) {\n int read = this.f9078e.read(bArr, i2, min - i2);\n if (read != -1) {\n this.f9084k += read;\n i2 += read;\n } else {\n throw C3606c0.m8181h();\n }\n }\n i -= min;\n arrayList.add(bArr);\n }\n return arrayList;\n }", "public DatosIteracion mejorIteracionOptimizada(\r\n\t\t\tArrayList<DatosIteracion> datos) {\r\n\t\tDatosIteracion d = new DatosIteracion(\"auxiliar\");\r\n\t\tLectura l = new Lectura(999999, 0, 0);\r\n\t\td.getValoresLecturas().add(l);\r\n\r\n\t\tfor (int i = 0; i < datos.size(); i++) {\r\n\r\n\t\t\tif ((d.getValoresLecturas(d.getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (d.getValoresLecturas(\r\n\t\t\t\t\td.getValoresLecturas().size() - 1).getTiempo() + 1)) < (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getTiempo() + 1))) {\r\n\r\n\t\t\t\td = datos.get(i);\r\n\t\t\t}\r\n\r\n\t\t\tif ((d.getValoresLecturas(d.getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (d.getValoresLecturas(\r\n\t\t\t\t\td.getValoresLecturas().size() - 1).getTiempo() + 1)) == (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getTiempo() + 1))) {\r\n\r\n\t\t\t\tif (d.getValoresLecturas(d.getValoresLecturas().size() - 1)\r\n\t\t\t\t\t\t.getTiempo() > datos\r\n\t\t\t\t\t\t.get(i)\r\n\t\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t\t.getTiempo()) {\r\n\r\n\t\t\t\t\td = datos.get(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn d;\r\n\t}", "int getPagesize();", "@Test\r\n public void teamListSizeTest(){\r\n int listSize = 5;\r\n \r\n\r\n assertEquals(\"expected results = \" + listSize, listSize, extractor.extractXDriversOrTeams(listSize, \"table.msr_season_team_results\", \"td.msr_team\").size());\r\n }", "public static int longArray() {\r\n\t\tString sCarp = System.getProperty(\"user.dir\");//Obtenemos la carpeta actual desde donde ejecutamos el código(de la carpeta del proyecto)\r\n\t\tFile carpeta = new File(sCarp); //Con este File obtenemos información de la carpeta\r\n\t\tFile[] listado = carpeta.listFiles();//Asi nos devuelven objetos file y podemos sacar mas info de ellos\r\n\r\n\t\tint longi=0;\r\n\t\t\r\n\t\tif(listado==null || listado.length == 0) {\r\n\t\t\tSystem.out.println(\"No hay elementos en la carpeta actual\");\r\n\t\t}else {\r\n\t\t\tlongi++;//solo ponemos un longi++ ya que si tiene archivos solo nos va a extraer uno que es la pos que guardamos\r\n\t\t\tfor(int i=0; i<listado.length;i++) {\r\n\t\t\t\tFile archivo = listado[i];\r\n\t\t\t\tif(archivo.isDirectory()==true) {\r\n\t\t\t\t\tFile[] listado2 = archivo.listFiles();\r\n\t\t\t\t\tif(listado2==null || listado2.length == 0) {\r\n\t\t\t\t\t\tSystem.out.println(\"No hay elementos en la carpeta actual\");\r\n\t\t\t\t\t}else {\r\n\t\t\t\t\t\tlongi++;\r\n\t\t\t\t\t}\t\t\t\t\t\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn longi;\r\n\t}", "private List<PlanTrabajo> generarPlanesTrabajo( Date fecPrgn, \n\t\t\tList<Cuadrilla> cuadrillas,Map<Long, GrupoAtencion> mpGrupos, \n\t\t\tMap<Long, Long> asignaciones ){\n\t\t\n\t\t\tList<PlanTrabajo> planTrabajoList = new ArrayList<PlanTrabajo>();\n\t\t\tSet<Long> grupos = asignaciones.keySet();\t\n\t\t\tlong np = 1;\n\t\t\tfor (Long ngrupo : grupos) {\n\t\t\t\t Long ncuadrilla = asignaciones.get(ngrupo);\n\t\t\t\t GrupoAtencion grupoAtencion = mpGrupos.get(ngrupo);\n\t\t\t\t //GrupoAtencion grupoAtencion = asignar(cuadrilla, idx, mpGruposCached);\n\t\t\t\t PlanTrabajo planTrabajo = new PlanTrabajo(np);\n\t\t\t\t int nsp = 1;\n\t\t\t\t planTrabajo.setFechaProgramacion(new Timestamp(fecPrgn.getTime()));\n\t\t\t\t int i = cuadrillas.indexOf( new Cuadrilla(ncuadrilla));\n\t\t\t\t if(i!=-1){\n\t\t\t\t\t \n\t\t\t\t\t Cuadrilla cuadrilla = cuadrillas.get(i);\n\t\t\t\t\t planTrabajo.setCuadrilla(cuadrilla);\n\t\t\t\t\t planTrabajo.setGrupoAtencion(grupoAtencion);\n\t\t\t\t\t \n\t\t\t\t\t if(grupoAtencion!=null){\n\t\t\t\t\t\t for( GrupoAtencionDetalle d : grupoAtencion.getGrupoAtencionDetalles()){\n\t\t\t\t\t\t\t // añadiendo las solicitudes de servicio\t\n\t\t\t\t\t\t\t SolicitudServicio s = d.getSolicitudServicio();\n\t\t\t\t\t\t\t //System.out.println(\" #### añadiendo solicitud \"+s.getNumeroSolicitud());\n\t\t\t\t\t\t\t if(planTrabajo.getPlanTrabajoDetalles()==null){\n\t\t\t\t\t\t\t\t planTrabajo.setPlanTrabajoDetalles(new ArrayList<PlanTrabajoDetalle>());\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t PlanTrabajoDetalle pd = new PlanTrabajoDetalle(np, nsp);\n\t\t\t\t\t\t\t pd.setSolicitudServicio(s);\n\t\t\t\t\t\t\t //planTrabajo.addPlanTrabajoDetalle( new PlanTrabajoDetalle(s));;\n\t\t\t\t\t\t\t planTrabajo.addPlanTrabajoDetalle(pd);\n\t\t\t\t\t\t\t nsp++;\n\t\t\t\t\t\t }\n\t\t\t\t\t\t planTrabajoList.add(planTrabajo);\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t np++;\n\t\t\t}\n\t\t\t\n\t\treturn planTrabajoList;\n\t}", "Integer diskSizeGB();", "public List<Produto> consultarProdutos(int consulta, String valor) {\r\n ConexaoBDJavaDB conexaoBD = new ConexaoBDJavaDB(\"routeexpress\");\r\n Connection conn = null;\r\n Statement stmt = null;\r\n ResultSet rs = null;\r\n List<Produto> produtos = new ArrayList<>();\r\n try {\r\n conn = conexaoBD.obterConexao();\r\n stmt = conn.createStatement();\r\n //Se a consulta for igual a zero(0) uma lista de todos os produtos \"cervejas\" e recuperada\r\n if (consulta == 0) {\r\n rs = stmt.executeQuery(consultas[consulta]);\r\n //Se a consulta for igual a tres(3) uma lista de todos os produtos \"cervejas\" e recuperada a parti do preco\r\n } else {\r\n rs = stmt.executeQuery(consultas[consulta] + \"'\" + valor + \"'\");\r\n }\r\n Produto produto;\r\n while (rs.next()) {\r\n produto = new Produto();\r\n produto.setIdCervejaria(rs.getInt(\"ID_CERVEJARIA\"));\r\n produto.setCervejaria(rs.getString(\"CERVEJARIA\"));\r\n produto.setPais(rs.getString(\"PAIS\"));\r\n produto.setIdCerveja(rs.getInt(\"ID_CERVEJA\"));\r\n produto.setIdFkCervajaria(rs.getInt(\"FK_CERVEJARIA\"));\r\n produto.setRotulo(rs.getString(\"ROTULO\"));\r\n produto.setPreco(rs.getString(\"PRECO\"));\r\n produto.setVolume(rs.getString(\"VOLUME\"));\r\n produto.setTeor(rs.getString(\"TEOR\"));\r\n produto.setCor(rs.getString(\"COR\"));\r\n produto.setTemperatura(rs.getString(\"TEMPERATURA\"));\r\n produto.setFamiliaEEstilo(rs.getString(\"FAMILIA_E_ESTILO\"));\r\n produto.setDescricao(rs.getString(\"DESCRICAO\"));\r\n produto.setSabor(rs.getString(\"SABOR\"));\r\n produto.setImagem1(rs.getString(\"IMAGEM_1\"));\r\n produto.setImagem2(rs.getString(\"IMAGEM_2\"));\r\n produto.setImagem3(rs.getString(\"IMAGEM_3\"));\r\n produtos.add(produto);\r\n }\r\n } catch (SQLException ex) {\r\n Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n } finally {\r\n if (conn != null) {\r\n try {\r\n conn.close();\r\n } catch (SQLException ex) {\r\n Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n if (stmt != null) {\r\n try {\r\n stmt.close();\r\n } catch (SQLException ex) {\r\n Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n if (rs != null) {\r\n try {\r\n rs.close();\r\n } catch (SQLException ex) {\r\n Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n }\r\n return produtos;\r\n }", "private void cargarFichaLepra_control() {\r\n\r\n\t\tMap<String, Object> parameters = new HashMap<String, Object>();\r\n\t\tparameters.put(\"codigo_empresa\", codigo_empresa);\r\n\t\tparameters.put(\"codigo_sucursal\", codigo_sucursal);\r\n\t\tparameters.put(\"nro_identificacion\", tbxNro_identificacion.getValue());\r\n\r\n\t\tficha_inicio_lepraService.setLimit(\"limit 25 offset 0\");\r\n\r\n\t\t// log.info(\"parameters>>>>\" + parameters);\r\n\t\tBoolean ficha_inicio = ficha_inicio_lepraService\r\n\t\t\t\t.existe_paciente_lepra(parameters);\r\n\t\t// log.info(\"ficha_inicio>>>>\" + ficha_inicio);\r\n\r\n\t\tif (ficha_inicio) {\r\n\t\t\tMap<String, Object> parametros = new HashMap<String, Object>();\r\n\t\t\tparametros.put(\"nro_identificacion\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_identificacion());\r\n\t\t\tparametros.put(\"nro_ingreso\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_ingreso());\r\n\t\t\tparametros.put(\"estado\", admision_seleccionada.getEstado());\r\n\t\t\tparametros.put(\"codigo_administradora\",\r\n\t\t\t\t\tadmision_seleccionada.getCodigo_administradora());\r\n\t\t\tparametros.put(\"id_plan\", admision_seleccionada.getId_plan());\r\n\t\t\tparametros.put(IVias_ingreso.ADMISION_PACIENTE,\r\n\t\t\t\t\tadmision_seleccionada);\r\n\t\t\tparametros.put(IVias_ingreso.OPCION_VIA_INGRESO,\r\n\t\t\t\t\tOpciones_via_ingreso.REGISTRAR);\r\n\t\t\ttabboxContendor.abrirPaginaTabDemanda(false,\r\n\t\t\t\t\tIRutas_historia.PAGINA_SEGUIMIENTO_TRATAMIENTO_LEPRA,\r\n\t\t\t\t\tIRutas_historia.LABEL_SEGUIMIENTO_TRATAMIENTO_LEPRA,\r\n\t\t\t\t\tparametros);\r\n\t\t}\r\n\t}", "public String top10Filmes() {\r\n\t\tString top10 = \"Nenhum ingresso vendido ate o momento\";\r\n\t\tint contador = 0;\r\n\t\tif (listaIngresso.isEmpty() == false) {\r\n\t\tfor (int i = 0; i < listaIngresso.size(); i++) {\r\n\t\tcontador = 0;\r\n\t\tfor(int j = 0; j < listaIngresso.size() - 1; j++){\r\n\t\tif(listaIngresso.get(i).getSessao().getFilme() == listaIngresso.get(j).getSessao().getFilme()){\r\n\t\tcontador++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\t\r\n\t\t}\r\n\t\treturn top10;\r\n\t}", "public List<String> pntbajas(ReportePlazaDTO reportePlazaDTO) {\n List<CustomOutputFile> lista = new ArrayList<CustomOutputFile>();\n List<String> listaString = new ArrayList<String>();\n\n String qnaCaptura = reportePlazaDTO.getQnaCaptura();\n String qnaCaptura2 = \"\";\n\n if (new Integer(qnaCaptura) % 2 == 0) {\n qnaCaptura2 = String.valueOf((new Integer(qnaCaptura) - 1));\n } else {\n qnaCaptura2 = qnaCaptura;\n }\n\n lista = \n super.persistence().get(QueryTdPlazaDAO.class).findBypotBajas(qnaCaptura, \n qnaCaptura2);\n listaString.add(\"ID del Servidor Público\");\n\n if (lista != null) {\n for (CustomOutputFile row: lista) {\n listaString.add(row.getRegistro());\n }\n } else\n listaString = null;\n return listaString;\n\n }" ]
[ "0.56544316", "0.56170547", "0.55992246", "0.5585545", "0.5523149", "0.55047125", "0.5486055", "0.54721063", "0.53641033", "0.5311314", "0.5289478", "0.528322", "0.52671075", "0.5265256", "0.52297014", "0.5227562", "0.52185315", "0.5198531", "0.5197839", "0.5197563", "0.5173197", "0.51686645", "0.51614636", "0.5146698", "0.5144771", "0.5138817", "0.5130523", "0.5128139", "0.51256675", "0.5122989", "0.5113708", "0.51009893", "0.5097282", "0.5095481", "0.5089411", "0.50870043", "0.5084317", "0.5075783", "0.50702995", "0.505807", "0.50518936", "0.5049756", "0.5043204", "0.5042597", "0.5038482", "0.5033861", "0.503379", "0.5025142", "0.5020587", "0.501617", "0.501341", "0.5012709", "0.50019026", "0.5000998", "0.49985564", "0.49973252", "0.4987455", "0.49854758", "0.49804834", "0.49803156", "0.49801213", "0.49740735", "0.49739155", "0.4972263", "0.49710688", "0.4970442", "0.49668723", "0.49664977", "0.49657235", "0.49607897", "0.49472323", "0.49462134", "0.49420488", "0.49418634", "0.49347594", "0.49347594", "0.49347594", "0.49344486", "0.49337098", "0.4932738", "0.49325225", "0.4932297", "0.49317268", "0.49316987", "0.49314603", "0.49296394", "0.49269965", "0.49246657", "0.49178213", "0.4917768", "0.49175745", "0.49123412", "0.49120983", "0.49091744", "0.49085045", "0.49084494", "0.4907919", "0.49054453", "0.4898661", "0.48967677", "0.48848143" ]
0.0
-1
DADO QUE POSSUO UMA ARQUIVO de X Bytes E REALIZE A LEITURA PARA UMA LISTA DAS PALAVRAS
private void testePerformaceUtilizandoPesquisaBinaria(String arquivo) { leituraDo(arquivo); leitor.ordenarComSort(); // QUANDO EU EXECUTAR A PESQUISA LINEAR long tempoInicial = System.currentTimeMillis(); @SuppressWarnings("static-access") int posicaoPalavraPesquisada = algoritimoDePesquisa.pesquisaBinaria(leitor.getConjuntoPalavrasArquivo(), "casa"); long tempoFinal = System.currentTimeMillis(); // ENTÃO ELE DEVE ACHAR A PALAVRA CHAVE E DEVO PRINTAR O TEMPO DE EXECUÇÃO NA TELA printResultado(arquivo, "Binaria", posicaoPalavraPesquisada,tempoFinal - tempoInicial); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test(timeout = 4000)\n public void test07() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n byte[][] byteArray0 = new byte[7][8];\n byte[] byteArray1 = new byte[8];\n byteArray1[0] = (byte) (-13);\n byteArray1[1] = (byte)77;\n byteArray1[2] = (byte) (-2);\n byteArray1[3] = (byte) (-103);\n byteArray1[4] = (byte) (-91);\n byteArray1[5] = (byte) (-44);\n byteArray1[6] = (byte) (-31);\n byteArray1[7] = (byte)33;\n byteArray0[0] = byteArray1;\n byte[] byteArray2 = new byte[4];\n byteArray2[0] = (byte)77;\n byteArray2[1] = (byte) (-44);\n byteArray2[2] = (byte) (-13);\n byteArray2[3] = (byte)77;\n byteArray0[1] = byteArray2;\n byte[] byteArray3 = new byte[1];\n byteArray3[0] = (byte) (-44);\n byteArray0[2] = byteArray3;\n byte[] byteArray4 = new byte[6];\n byteArray4[0] = (byte) (-94);\n byteArray4[1] = (byte) (-31);\n byteArray4[2] = (byte) (-13);\n byteArray4[3] = (byte) (-31);\n byteArray4[4] = (byte) (-91);\n byteArray4[5] = (byte)58;\n byteArray0[3] = byteArray4;\n byte[] byteArray5 = new byte[3];\n byteArray5[0] = (byte)58;\n byteArray5[1] = (byte) (-44);\n byteArray5[2] = (byte) (-103);\n byteArray0[4] = byteArray5;\n byte[] byteArray6 = new byte[3];\n byteArray6[0] = (byte) (-91);\n byteArray6[1] = (byte) (-2);\n byteArray6[2] = (byte) (-94);\n byteArray0[5] = byteArray6;\n byte[] byteArray7 = new byte[3];\n byteArray7[0] = (byte) (-13);\n byteArray7[1] = (byte)33;\n byteArray7[2] = (byte)58;\n byteArray0[6] = byteArray7;\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n boolean boolean0 = fBCachedFetcher0.isLast();\n assertFalse(boolean0);\n }", "@Test(timeout = 4000)\n public void test14() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n byte[][] byteArray0 = new byte[9][4];\n byte[] byteArray1 = new byte[4];\n byteArray1[0] = (byte)1;\n byteArray1[1] = (byte)87;\n byteArray1[2] = (byte) (-12);\n byteArray1[3] = (byte) (-106);\n byteArray0[0] = byteArray1;\n byte[] byteArray2 = new byte[2];\n byteArray2[0] = (byte)1;\n byteArray2[1] = (byte)1;\n byteArray0[1] = byteArray2;\n byte[] byteArray3 = new byte[3];\n byteArray3[0] = (byte) (-106);\n byteArray3[1] = (byte) (-106);\n byteArray3[2] = (byte)87;\n byteArray0[2] = byteArray3;\n byte[] byteArray4 = new byte[3];\n byteArray4[0] = (byte)87;\n byteArray4[1] = (byte)71;\n byteArray4[2] = (byte)1;\n byteArray0[3] = byteArray4;\n byte[] byteArray5 = new byte[8];\n byteArray5[0] = (byte) (-12);\n byteArray5[1] = (byte)71;\n byteArray5[2] = (byte)87;\n byteArray5[3] = (byte) (-106);\n byteArray5[4] = (byte) (-106);\n byteArray5[5] = (byte)87;\n byteArray5[6] = (byte) (-106);\n byteArray5[7] = (byte) (-106);\n byteArray0[4] = byteArray5;\n byte[] byteArray6 = new byte[6];\n byteArray6[0] = (byte)87;\n byteArray6[1] = (byte)87;\n byteArray6[2] = (byte) (-106);\n byteArray6[3] = (byte)71;\n byteArray6[4] = (byte)71;\n byteArray6[5] = (byte)1;\n byteArray0[5] = byteArray6;\n byte[] byteArray7 = new byte[7];\n byteArray7[0] = (byte) (-12);\n byteArray7[1] = (byte)71;\n byteArray7[2] = (byte)1;\n byteArray7[3] = (byte) (-12);\n byteArray7[4] = (byte)1;\n byteArray7[5] = (byte)87;\n byteArray7[6] = (byte) (-106);\n byteArray0[6] = byteArray7;\n byte[] byteArray8 = new byte[9];\n byteArray8[0] = (byte)29;\n byteArray8[1] = (byte)59;\n byteArray8[2] = (byte)1;\n byteArray8[3] = (byte) (-12);\n byteArray8[4] = (byte) (-106);\n byteArray8[5] = (byte) (-12);\n byteArray8[6] = (byte) (-106);\n byteArray8[7] = (byte) (-12);\n byteArray8[8] = (byte) (-12);\n byteArray0[7] = byteArray8;\n byte[] byteArray9 = new byte[8];\n byteArray9[0] = (byte)59;\n byteArray9[1] = (byte) (-44);\n byteArray9[2] = (byte)59;\n byteArray9[3] = (byte)1;\n byteArray9[4] = (byte)29;\n byteArray9[5] = (byte)29;\n byteArray9[6] = (byte)87;\n byteArray9[7] = (byte)29;\n byteArray0[8] = byteArray9;\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n // Undeclared exception!\n try { \n fBCachedFetcher0.last();\n fail(\"Expecting exception: NullPointerException\");\n \n } catch(NullPointerException e) {\n //\n // no message in exception (getMessage() returned null)\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "private int[] enquadramentoInsercaoDeBytes(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Insercao de Bytes]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Insercao de Bytes]\");\n Thread.sleep(velocidade);\n\n final char byteFlagStart = 'S';//Identificar o INICIO do quadro (Start)\n final char byteFlagEnd = 'E';//Identificar o FIM do quadro (End)\n final char byteDeEscape = '/';//Caractere de escape especial\n\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tByte de Inicio de Quadro [\"+byteFlagStart+\"]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tByte de Fim de Quadro [\"+byteFlagEnd+\"]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tByte de Escape de Quadro [\"+byteDeEscape+\"]\\n\");\n Thread.sleep(velocidade);\n\n\n String auxiliar = \"\";\n Boolean SE = true;\n\n for (int inteiro : quadro) {\n\n int quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(inteiro);\n inteiro = ManipuladorDeBit.deslocarBits(inteiro);\n\n int inteiroByte = ManipuladorDeBit.getPrimeiroByte(inteiro);\n\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tIC [\"+(char) inteiroByte+\"] \");\n Thread.sleep(velocidade);\n\n if (inteiroByte == (int) byteFlagStart) {//Inicio do Quadro\n SE = !SE;//Iniciar a Busca pelo Byte de Fim de Quadro\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n quantidadeByte--;\n }\n\n if (!SE) {\n\n for (int i=1; i<=quantidadeByte; i++) {\n int dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n\n if (dado == (int) byteDeEscape) {//Verificando se o dado eh um Byte de Escape\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"IC [\"+(char) dado+\"] \");\n Thread.sleep(velocidade);\n dado = ManipuladorDeBit.getPrimeiroByte(inteiro);//Adicionando o Byte\n auxiliar += (char) dado;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [\"+dado+\"] \");\n Thread.sleep(velocidade);\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n i++;\n\n } else if (dado == (int) byteFlagEnd) {//Verificando se o dado eh um Byte End\n SE = !SE;//Encontrou o Byte de Fim de Quadro\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"IC [\"+(char) dado+\"]\\n\");\n Thread.sleep(velocidade);\n } else {//Caso for um Byte de Carga Util\n auxiliar += (char) ManipuladorDeBit.getPrimeiroByte(inteiro);\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [\"+dado+\"] \");\n Thread.sleep(velocidade);\n }\n \n }\n\n }\n }\n\n //Novo Quadro de Carga Util\n int[] quadroDesenquadrado = new int[auxiliar.length()];\n //Adicionando as informacoes de Carga Util no QuadroDesenquadrado\n for (int i=0; i<auxiliar.length(); i++) {\n quadroDesenquadrado[i] = (int) auxiliar.charAt(i);\n ManipuladorDeBit.imprimirBits(quadroDesenquadrado[i]);\n }\n\n return quadroDesenquadrado;\n }", "List<Byte> getAsBytes();", "private List<ItemListaIntegracaoDTO> montarListaInstituicaoIdInstituicaoDTO(List<InstituicaoCooperativaSCIDTO> lista) {\n\t\tList<ItemListaIntegracaoDTO> listaVO = new ArrayList<ItemListaIntegracaoDTO>();\n\n\t\tfor(InstituicaoCooperativaSCIDTO instituicao:lista){\n\t\t\tString cooperativa = instituicao.getNumCooperativa().toString();\n\t\t\tif(instituicao.getNumCooperativa() == 300) {\n\t\t\t\tcooperativa = \"0300\";\n\t\t\t}\n\t\t\tItemListaIntegracaoDTO item = new ItemListaIntegracaoDTO(instituicao.getIdInstituicao().toString(), cooperativa + \" - \" + instituicao.getNome());\n\t\t\tlistaVO.add(item);\n\t\t}\n\t\t\n\t\tCollections.sort(listaVO, new Comparator<ItemListaIntegracaoDTO>() {\n\t\t\tpublic int compare(ItemListaIntegracaoDTO o1, ItemListaIntegracaoDTO o2){\n\t\t\t\t\treturn o1.getCodListaItem().compareTo(o2.getCodListaItem());\n\t\t\t\t} \n\t\t});\n\t\t\n\t\treturn listaVO;\t\t\n\t}", "private ListaSE<Pueblo> buscarLMPV(ListaSE<Pueblo>resPar, ArbolBin<Pueblo> mapa, int X){\n ListaSE<Pueblo> res = new ListaSE<Pueblo>(), rp;\n if(!mapa.vacio()){\n if(mapa.getRaiz().tiempo() <= X){\n resPar.add(mapa.getRaiz());\n rp = buscarLMPV(resPar.clone(), mapa.getIzq(), X - mapa.getRaiz().tiempo());\n if(rp.size() > res.size()) res = rp;\n rp = buscarLMPV(resPar.clone(), mapa.getDer(), X - mapa.getRaiz().tiempo());\n if(rp.size() > res.size()) res = rp;\n }else{\n if(resPar.size() > res.size()) res = resPar;\n }\n }else res = resPar;\n return res;\n }", "@SuppressWarnings(\"unchecked\")\n public void consultarCoactivosXLS() throws CirculemosNegocioException {\n\n // consulta la tabla temporal de los 6000 coactivos\n StringBuilder sql = new StringBuilder();\n\n sql.append(\"select [TIPO DOC], [NUMERO DE IDENTIFICACIÓN], [valor multas], [titulo valor], proceso \");\n sql.append(\"from coactivos_xls \");\n sql.append(\"where id_tramite is null and numero_axis is null AND archivo is not null \");\n sql.append(\"AND [titulo valor] IN ('2186721','2187250','2187580','2186845')\");\n\n Query query = em.createNativeQuery(sql.toString());\n\n List<Object[]> listaResultados = Utilidades.safeList(query.getResultList());\n\n Date fechaCoactivo = UtilFecha.buildCalendar().getTime();\n CoactivoDTO coactivoDTOs;\n TipoIdentificacionPersonaDTO tipoIdentificacion;\n List<ObligacionCoactivoDTO> obligacionesCoactivoDTO;\n PersonaDTO personaDTO;\n ProcesoDTO proceso;\n // persiste los resultados en coactivoDTO\n for (Object[] coactivo : listaResultados) {\n coactivoDTOs = new CoactivoDTO();\n // persiste el tipo de indetificacion en TipoIdentificacionPersonaDTO\n personaDTO = new PersonaDTO();\n proceso = new ProcesoDTO();\n tipoIdentificacion = new TipoIdentificacionPersonaDTO();\n obligacionesCoactivoDTO = new ArrayList<>();\n\n tipoIdentificacion.setCodigo((String) coactivo[0]);\n personaDTO.setTipoIdentificacion(tipoIdentificacion);\n coactivoDTOs.setPersona(personaDTO);\n coactivoDTOs.getPersona().setNumeroIdentificacion((String) coactivo[1]);\n\n proceso.setFechaInicio(fechaCoactivo);\n coactivoDTOs.setProceso(proceso);\n coactivoDTOs.setValorTotalObligaciones(BigDecimal\n .valueOf(Double.valueOf(coactivo[2].toString().replaceAll(\"\\\\.\", \"\").replaceAll(\",\", \".\"))));\n coactivoDTOs.setValorTotalCostasProcesales(\n coactivoDTOs.getValorTotalObligaciones().multiply(BigDecimal.valueOf(0.05)));\n coactivoDTOs.getProceso().setObservacion(\"COACTIVO\");\n String[] numeroFactura = coactivo[3].toString().split(\",\");\n // separa los numeros de factura cuando viene mas de uno.\n for (String nFactura : numeroFactura) {\n // consulta por numero de factura el el saldo a capital por cada factura\n sql = new StringBuilder();\n sql.append(\"select nombre, saldo_capital, saldo_interes \");\n sql.append(\"from cartera_coactivos_xls \");\n sql.append(\"where nombre = :nFactura\");\n\n Query quer = em.createNativeQuery(sql.toString());\n\n quer.setParameter(\"nFactura\", nFactura);\n\n List<Object[]> result = Utilidades.safeList(quer.getResultList());\n // persiste las obligaciones consultadas y las inserta en ObligacionCoactivoDTO\n ObligacionCoactivoDTO obligaciones;\n for (Object[] obligacion : result) {\n obligaciones = new ObligacionCoactivoDTO();\n obligaciones.setNumeroObligacion((String) obligacion[0]);\n obligaciones.setValorObligacion(BigDecimal.valueOf(\n Double.valueOf(obligacion[1].toString().replaceAll(\"\\\\.\", \"\").replaceAll(\",\", \".\"))));\n obligaciones.setValorInteresMoratorios(BigDecimal.valueOf(\n Double.valueOf(obligacion[2].toString().replaceAll(\"\\\\.\", \"\").replaceAll(\",\", \".\"))));\n // Adiciona las obligaciones a una lista\n obligacionesCoactivoDTO.add(obligaciones);\n }\n\n }\n coactivoDTOs.setObligacionCoactivos(obligacionesCoactivoDTO);\n try {\n iLCoactivo.registrarCoactivoAxis(coactivoDTOs, coactivo[4].toString());\n } catch (Exception e) {\n logger.error(\"Error al registrar coactivo 6000 :\", e);\n }\n }\n }", "public byte [] createBytesRepresentation(){\n\t\n\t\tLinkedList<Byte> l = new LinkedList<Byte>();\n\t\taddBytesRep(vec[vec.length-1],l);\n\t\tfor (int i=vec.length-2; i>=0; i--){\n\t\t\taddBytesRep(vec[i]-vec[i+1],l);\n\t\t\t\n\t\t}\n\t\t\n\t\tbyte [] bytesRep = new byte[l.size()];\n\t\t\n\t\tListIterator<Byte> iterator = l.listIterator(); \n\t\tint c=0;\n\t\twhile (iterator.hasNext()){\n\t\t\tbytesRep[c++]=iterator.next();\n\t\t}\n\t\treturn bytesRep;\n\t}", "@Test(timeout = 4000)\n public void test22() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n XSQLVAR[] xSQLVARArray0 = new XSQLVAR[0];\n FBResultSet fBResultSet0 = new FBResultSet(xSQLVARArray0, linkedList0);\n byte[][] byteArray0 = new byte[7][0];\n byte[] byteArray1 = new byte[7];\n byteArray1[0] = (byte) (-111);\n FileSystemHandling.appendLineToFile((EvoSuiteFile) null, \"!3eO>|kx{3s''g6%=\");\n byteArray1[1] = (byte) (-109);\n byteArray1[2] = (byte)31;\n linkedList0.add((byte[][]) null);\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, fBResultSet0);\n fBCachedFetcher0.next();\n fBCachedFetcher0.deleteRow();\n assertTrue(fBCachedFetcher0.isLast());\n }", "public static void consultaEleicoesPassadas() {\n\t\tArrayList<Eleicao> lista;\n\t\t\n\t\tint check = 0;\n\t\tint tries = 0;\n\t\tdo {\n\t\t\ttry {\n\t\t\t\tlista = rmiserver.getEleicoesPassadas();\n\t\t\t\tif(lista.isEmpty()) {\n\t\t\t\t\tSystem.out.println(\"Nao existem eleicoes para mostrar.\");\n\t\t\t\t}else {\n\t\t\t\t\tfor(Eleicao x: lista) {\n\t\t\t\t\t\tSystem.out.println(\"\\nEleicao \"+x.titulo);\n\t\t\t\t\t\tSystem.out.println(\"\\tID: \"+x.id);\n\t\t\t\t\t\tSystem.out.println(\"\\tDescricao: \"+x.descricao);\n\t\t\t\t\t\tSystem.out.println(\"\\tData Inicio: \"+x.dataInicio.toString());\n\t\t\t\t\t\tSystem.out.println(\"\\tData Fim: \"+x.dataInicio.toString());\n\t\t\t\t\t\tSystem.out.println(\"Resultados: \");\n\t\t\t\t\t\tif(x.tipo == 1) {\n\t\t\t\t\t\t\tif(x.registoVotos.size()>0) {\n\t\t\t\t\t\t\t\tfor(Lista y: x.listaCandidaturas) {\n\t\t\t\t\t\t\t\t\tdouble perc = y.contagem/(double)x.registoVotos.size() * 100;\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\tif(x.registoVotos.size()>0) {\n\t\t\t\t\t\t\t\tint alunos = 0, docentes = 0, funcs = 0;\n\t\t\t\t\t\t\t\tfor(Lista y:x.listaCandidaturas) {\n\t\t\t\t\t\t\t\t\tif(y.tipoLista.equals(\"1\")) {\n\t\t\t\t\t\t\t\t\t\talunos += y.contagem;\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"2\")) {\n\t\t\t\t\t\t\t\t\t\tfuncs += y.contagem;\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"3\")) {\n\t\t\t\t\t\t\t\t\t\tdocentes += y.contagem;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfor(Lista y: x.listaCandidaturas) {\n\t\t\t\t\t\t\t\t\tif(y.tipoLista.equals(\"1\")) {\n\t\t\t\t\t\t\t\t\t\tif(alunos>0) {\n\t\t\t\t\t\t\t\t\t\t\tdouble perc = (double)y.contagem/(double)alunos * 100;\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": 0% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"2\")) {\n\t\t\t\t\t\t\t\t\t\tif(funcs>0) {\n\t\t\t\t\t\t\t\t\t\t\tdouble perc = (double)y.contagem/(double)funcs * 100;\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": 0% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"3\")) {\n\t\t\t\t\t\t\t\t\t\tif(docentes>0) {\n\t\t\t\t\t\t\t\t\t\t\tdouble perc = (double)y.contagem/(double)docentes * 100;\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": 0% (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else if(y.tipoLista.equals(\"4\")) {\n\t\t\t\t\t\t\t\t\t\tdouble perc = y.contagem/(double)x.registoVotos.size() * 100;\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\t\"+y.nome+\": \"+perc+\"% sobre Total (Num. votos: \"+y.contagem+\")\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcheck = 1;\n\t\t\t} catch (RemoteException e1) {\n\t\t\t\t// Tratamento da Excepcao da chamada RMI addCandidatos\n\t\t\t\tif(tries == 0) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(6000);\n\t\t\t\t\t\t//faz novo lookup\n\t\t\t\t\t\trmiserver = (RMI_S_I) Naming.lookup(\"rmi://\"+registryIP+\":\"+registryPort+\"/rmi\");\n\t\t\t\t\t\trmiserver.subscribeConsola((ADMIN_C_I)consola);\n\t\t\t\t\t\ttries = 0;\n\t\t\t\t\t} catch (RemoteException | InterruptedException | MalformedURLException | NotBoundException e) {\n\t\t\t\t\t\t// FailOver falhou\n\t\t\t\t\t\ttries++;\n\t\t\t\t\t}\n\t\t\t\t}else if(tries > 0 && tries < 24) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tThread.sleep(1000);\n\t\t\t\t\t\t//faz novo lookup\n\t\t\t\t\t\trmiserver = (RMI_S_I) Naming.lookup(\"rmi://\"+registryIP+\":\"+registryPort+\"/rmi\");\n\t\t\t\t\t\trmiserver.subscribeConsola((ADMIN_C_I)consola);\n\t\t\t\t\t\ttries = 0;\n\t\t\t\t\t} catch (RemoteException | InterruptedException | MalformedURLException | NotBoundException e) {\n\t\t\t\t\t\t// FailOver falhou\n\t\t\t\t\t\ttries++;\n\t\t\t\t\t}\n\t\t\t\t}else if(tries >= 24) {\n\t\t\t\t\tSystem.out.println(\"Impossivel realizar a operacao devido a falha tecnica (Servidores RMI desligados).\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}while(check==0);\n\t\tcheck = 0;\n\t\t\n\t\t\n\t}", "private void m152570a(List<ByteBuffer> list) {\n synchronized (this.f113322u) {\n for (ByteBuffer byteBuffer : list) {\n m152578e(byteBuffer);\n }\n }\n }", "private void gerarLaudoPermanenciaMaior(MpmPrescricaoMedica prescricao,\r\n\t\t\tList<MpmLaudo> laudoList, FatConvenioSaudePlano convenioSaudePlano,\r\n\t\t\tAghParametros seqLaudoMaiorPermanencia) {\r\n\t\tMpmTipoLaudoConvenio tipoLaudoConvenio = this\r\n\t\t\t\t.getMpmTipoLaudoConvenioDAO()\r\n\t\t\t\t.obterTempoValidadeTipoLaudoPermanenciaMaior(\r\n\t\t\t\t\t\tseqLaudoMaiorPermanencia.getVlrNumerico().shortValue(),\r\n\t\t\t\t\t\tconvenioSaudePlano);\r\n\r\n\t\tif (tipoLaudoConvenio != null) {\r\n\r\n\t\t\tShort quantidadeDiasFaturamento = 0;\r\n\t\t\tShort diasPermanenciaMaior = 0;\r\n\r\n\t\t\tMpmTipoLaudo tipoLaudoMaiorPermanencia = this.getMpmTipoLaudoDAO()\r\n\t\t\t\t\t.obterPorChavePrimaria(\r\n\t\t\t\t\t\t\tseqLaudoMaiorPermanencia.getVlrNumerico()\r\n\t\t\t\t\t\t\t\t\t.shortValue());\r\n\r\n\t\t\tif (prescricao.getAtendimento().getInternacao() != null) {\r\n\t\t\t\tif (prescricao.getAtendimento()\r\n\t\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar() != null){\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (prescricao.getAtendimento()\r\n\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t.getQuantDiasFaturamento() != null){\r\n\t\t\t\t\t\tquantidadeDiasFaturamento = prescricao.getAtendimento()\r\n\t\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t\t.getQuantDiasFaturamento();\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdiasPermanenciaMaior = prescricao.getAtendimento()\r\n\t\t\t\t\t.getInternacao().getItemProcedimentoHospitalar()\r\n\t\t\t\t\t.getDiasPermanenciaMaior();\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (diasPermanenciaMaior == null || diasPermanenciaMaior > 0){\r\n\t\t\t\t\r\n\t\t\t\tInteger adicionalDias = 0;\r\n\t\t\t\tif (quantidadeDiasFaturamento != null) {\r\n\t\t\t\t\tadicionalDias = (quantidadeDiasFaturamento * 2) + 1;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (DateUtil.validaDataTruncadaMaiorIgual(new Date(), DateUtil\r\n\t\t\t\t\t\t.adicionaDias(prescricao.getAtendimento().getInternacao()\r\n\t\t\t\t\t\t\t\t.getDthrInternacao(), adicionalDias))) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (this.getMpmLaudoDAO()\r\n\t\t\t\t\t\t\t.obterCountLaudosPorTipoEAtendimento(\r\n\t\t\t\t\t\t\t\t\tprescricao.getAtendimento(),\r\n\t\t\t\t\t\t\t\t\ttipoLaudoMaiorPermanencia) <= 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tMpmLaudo laudo = new MpmLaudo();\r\n\t\t\t\t\t\tlaudo.setDthrInicioValidade(prescricao.getAtendimento()\r\n\t\t\t\t\t\t\t\t.getInternacao().getDthrInternacao());\r\n\t\t\t\t\t\tlaudo.setContaDesdobrada(false);\r\n\t\t\t\t\t\tlaudo.setImpresso(false);\r\n\t\t\t\t\t\tlaudo.setLaudoManual(false);\r\n\t\t\t\t\t\tlaudo.setAtendimento(prescricao.getAtendimento());\r\n\t\t\t\t\t\tlaudo.setTipoLaudo(tipoLaudoMaiorPermanencia);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tlaudoList.add(laudo);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public byte[] mo3891a() {\n int i;\n int i2;\n int i3;\n int i4;\n int i5;\n int i6;\n int i7;\n int i8;\n int i9;\n int i10;\n int i11;\n int i12;\n int i13;\n int i14;\n int i15;\n int i16;\n int i17;\n int i18;\n byte[] b;\n int i19;\n int length;\n mo3892b();\n int i20 = 3072;\n if (this.f687G != null) {\n i20 = 3072 + this.f687G.length + 1;\n }\n byte[] bArr = new byte[i20];\n bArr[0] = Byte.parseByte(this.f688a);\n byte[] b2 = C0331cr.m1177b(this.f689b);\n System.arraycopy(b2, 0, bArr, 1, b2.length);\n int length2 = b2.length + 1;\n try {\n byte[] bytes = this.f690c.getBytes(\"GBK\");\n bArr[length2] = (byte) bytes.length;\n length2++;\n System.arraycopy(bytes, 0, bArr, length2, bytes.length);\n i = length2 + bytes.length;\n } catch (Throwable th) {\n C0310c.m956a(th, \"Req\", \"buildV4Dot2\");\n bArr[length2] = 0;\n i = length2 + 1;\n }\n try {\n byte[] bytes2 = this.f691d.getBytes(\"GBK\");\n bArr[i] = (byte) bytes2.length;\n i++;\n System.arraycopy(bytes2, 0, bArr, i, bytes2.length);\n i2 = i + bytes2.length;\n } catch (Throwable th2) {\n C0310c.m956a(th2, \"Req\", \"buildV4Dot21\");\n bArr[i] = 0;\n i2 = i + 1;\n }\n try {\n byte[] bytes3 = this.f702o.getBytes(\"GBK\");\n bArr[i2] = (byte) bytes3.length;\n i2++;\n System.arraycopy(bytes3, 0, bArr, i2, bytes3.length);\n i3 = i2 + bytes3.length;\n } catch (Throwable th3) {\n C0310c.m956a(th3, \"Req\", \"buildV4Dot22\");\n bArr[i2] = 0;\n i3 = i2 + 1;\n }\n try {\n byte[] bytes4 = this.f692e.getBytes(\"GBK\");\n bArr[i3] = (byte) bytes4.length;\n i3++;\n System.arraycopy(bytes4, 0, bArr, i3, bytes4.length);\n i4 = i3 + bytes4.length;\n } catch (Throwable th4) {\n C0310c.m956a(th4, \"Req\", \"buildV4Dot23\");\n bArr[i3] = 0;\n i4 = i3 + 1;\n }\n try {\n byte[] bytes5 = this.f693f.getBytes(\"GBK\");\n bArr[i4] = (byte) bytes5.length;\n i4++;\n System.arraycopy(bytes5, 0, bArr, i4, bytes5.length);\n i5 = i4 + bytes5.length;\n } catch (Throwable th5) {\n C0310c.m956a(th5, \"Req\", \"buildV4Dot24\");\n bArr[i4] = 0;\n i5 = i4 + 1;\n }\n try {\n byte[] bytes6 = this.f694g.getBytes(\"GBK\");\n bArr[i5] = (byte) bytes6.length;\n i5++;\n System.arraycopy(bytes6, 0, bArr, i5, bytes6.length);\n i6 = i5 + bytes6.length;\n } catch (Throwable th6) {\n C0310c.m956a(th6, \"Req\", \"buildV4Dot25\");\n bArr[i5] = 0;\n i6 = i5 + 1;\n }\n try {\n byte[] bytes7 = this.f708u.getBytes(\"GBK\");\n bArr[i6] = (byte) bytes7.length;\n i6++;\n System.arraycopy(bytes7, 0, bArr, i6, bytes7.length);\n i7 = i6 + bytes7.length;\n } catch (Throwable th7) {\n C0310c.m956a(th7, \"Req\", \"buildV4Dot26\");\n bArr[i6] = 0;\n i7 = i6 + 1;\n }\n try {\n byte[] bytes8 = this.f695h.getBytes(\"GBK\");\n bArr[i7] = (byte) bytes8.length;\n i7++;\n System.arraycopy(bytes8, 0, bArr, i7, bytes8.length);\n i8 = i7 + bytes8.length;\n } catch (Throwable th8) {\n C0310c.m956a(th8, \"Req\", \"buildV4Dot27\");\n bArr[i7] = 0;\n i8 = i7 + 1;\n }\n try {\n byte[] bytes9 = this.f703p.getBytes(\"GBK\");\n bArr[i8] = (byte) bytes9.length;\n i8++;\n System.arraycopy(bytes9, 0, bArr, i8, bytes9.length);\n i9 = i8 + bytes9.length;\n } catch (Throwable th9) {\n C0310c.m956a(th9, \"Req\", \"buildV4Dot28\");\n bArr[i8] = 0;\n i9 = i8 + 1;\n }\n try {\n byte[] bytes10 = this.f704q.getBytes(\"GBK\");\n bArr[i9] = (byte) bytes10.length;\n i9++;\n System.arraycopy(bytes10, 0, bArr, i9, bytes10.length);\n i10 = i9 + bytes10.length;\n } catch (Throwable th10) {\n C0310c.m956a(th10, \"Req\", \"buildV4Dot29\");\n bArr[i9] = 0;\n i10 = i9 + 1;\n }\n try {\n if (TextUtils.isEmpty(this.f707t)) {\n bArr[i10] = 0;\n length = i10 + 1;\n } else {\n byte[] b3 = m1034b(this.f707t);\n bArr[i10] = (byte) b3.length;\n int i21 = i10 + 1;\n System.arraycopy(b3, 0, bArr, i21, b3.length);\n length = b3.length + i21;\n }\n i11 = length;\n } catch (Throwable th11) {\n C0310c.m956a(th11, \"Req\", \"buildV4Dot219\");\n bArr[i10] = 0;\n i11 = i10 + 1;\n }\n try {\n byte[] bytes11 = this.f709v.getBytes(\"GBK\");\n bArr[i11] = (byte) bytes11.length;\n i11++;\n System.arraycopy(bytes11, 0, bArr, i11, bytes11.length);\n i12 = i11 + bytes11.length;\n } catch (Throwable th12) {\n C0310c.m956a(th12, \"Req\", \"buildV4Dot211\");\n bArr[i11] = 0;\n i12 = i11 + 1;\n }\n try {\n byte[] bytes12 = this.f710w.getBytes(\"GBK\");\n bArr[i12] = (byte) bytes12.length;\n i12++;\n System.arraycopy(bytes12, 0, bArr, i12, bytes12.length);\n i13 = i12 + bytes12.length;\n } catch (Throwable th13) {\n C0310c.m956a(th13, \"Req\", \"buildV4Dot212\");\n bArr[i12] = 0;\n i13 = i12 + 1;\n }\n try {\n byte[] bytes13 = this.f711x.getBytes(\"GBK\");\n bArr[i13] = (byte) bytes13.length;\n i13++;\n System.arraycopy(bytes13, 0, bArr, i13, bytes13.length);\n i14 = bytes13.length + i13;\n } catch (Throwable th14) {\n C0310c.m956a(th14, \"Req\", \"buildV4Dot213\");\n bArr[i13] = 0;\n i14 = i13 + 1;\n }\n bArr[i14] = Byte.parseByte(this.f712y);\n int i22 = i14 + 1;\n bArr[i22] = Byte.parseByte(this.f697j);\n int i23 = i22 + 1;\n bArr[i23] = Byte.parseByte(this.f713z);\n int i24 = i23 + 1;\n if (this.f713z.equals(\"1\")) {\n byte[] d = C0331cr.m1187d(mo3890a(\"mcc\"));\n System.arraycopy(d, 0, bArr, i24, d.length);\n int length3 = i24 + d.length;\n byte[] d2 = C0331cr.m1187d(mo3890a(\"mnc\"));\n System.arraycopy(d2, 0, bArr, length3, d2.length);\n int length4 = length3 + d2.length;\n byte[] d3 = C0331cr.m1187d(mo3890a(\"lac\"));\n System.arraycopy(d3, 0, bArr, length4, d3.length);\n int length5 = length4 + d3.length;\n byte[] e = C0331cr.m1190e(mo3890a(\"cellid\"));\n System.arraycopy(e, 0, bArr, length5, e.length);\n int length6 = e.length + length5;\n int parseInt = Integer.parseInt(mo3890a(\"signal\"));\n if (parseInt > 127) {\n parseInt = 0;\n }\n bArr[length6] = (byte) parseInt;\n int i25 = length6 + 1;\n if (this.f682B.length() == 0) {\n bArr[i25] = 0;\n i24 = i25 + 1;\n } else {\n int length7 = this.f682B.split(\"\\\\*\").length;\n bArr[i25] = (byte) length7;\n i24 = i25 + 1;\n int i26 = 0;\n while (i26 < length7) {\n byte[] d4 = C0331cr.m1187d(m1032a(\"lac\", i26));\n System.arraycopy(d4, 0, bArr, i24, d4.length);\n int length8 = i24 + d4.length;\n byte[] e2 = C0331cr.m1190e(m1032a(\"cellid\", i26));\n System.arraycopy(e2, 0, bArr, length8, e2.length);\n int length9 = e2.length + length8;\n int parseInt2 = Integer.parseInt(m1032a(\"signal\", i26));\n if (parseInt2 > 127) {\n parseInt2 = 0;\n }\n bArr[length9] = (byte) parseInt2;\n i26++;\n i24 = length9 + 1;\n }\n }\n } else if (this.f713z.equals(\"2\")) {\n byte[] d5 = C0331cr.m1187d(mo3890a(\"mcc\"));\n System.arraycopy(d5, 0, bArr, i24, d5.length);\n int length10 = i24 + d5.length;\n byte[] d6 = C0331cr.m1187d(mo3890a(\"sid\"));\n System.arraycopy(d6, 0, bArr, length10, d6.length);\n int length11 = length10 + d6.length;\n byte[] d7 = C0331cr.m1187d(mo3890a(\"nid\"));\n System.arraycopy(d7, 0, bArr, length11, d7.length);\n int length12 = length11 + d7.length;\n byte[] d8 = C0331cr.m1187d(mo3890a(\"bid\"));\n System.arraycopy(d8, 0, bArr, length12, d8.length);\n int length13 = length12 + d8.length;\n byte[] e3 = C0331cr.m1190e(mo3890a(\"lon\"));\n System.arraycopy(e3, 0, bArr, length13, e3.length);\n int length14 = length13 + e3.length;\n byte[] e4 = C0331cr.m1190e(mo3890a(C1447g.f3485ae));\n System.arraycopy(e4, 0, bArr, length14, e4.length);\n int length15 = e4.length + length14;\n int parseInt3 = Integer.parseInt(mo3890a(\"signal\"));\n if (parseInt3 > 127) {\n parseInt3 = 0;\n }\n bArr[length15] = (byte) parseInt3;\n int i27 = length15 + 1;\n bArr[i27] = 0;\n i24 = i27 + 1;\n }\n if (this.f683C.length() == 0) {\n bArr[i24] = 0;\n i15 = i24 + 1;\n } else {\n bArr[i24] = 1;\n int i28 = i24 + 1;\n try {\n String[] split = this.f683C.split(MiPushClient.ACCEPT_TIME_SEPARATOR);\n byte[] b4 = m1034b(split[0]);\n System.arraycopy(b4, 0, bArr, i28, b4.length);\n int length16 = i28 + b4.length;\n try {\n byte[] bytes14 = split[2].getBytes(\"GBK\");\n bArr[length16] = (byte) bytes14.length;\n length16++;\n System.arraycopy(bytes14, 0, bArr, length16, bytes14.length);\n i16 = length16 + bytes14.length;\n } catch (Throwable th15) {\n C0310c.m956a(th15, \"Req\", \"buildV4Dot214\");\n bArr[length16] = 0;\n i16 = length16 + 1;\n }\n int parseInt4 = Integer.parseInt(split[1]);\n if (parseInt4 > 127) {\n parseInt4 = 0;\n }\n bArr[i16] = Byte.parseByte(String.valueOf(parseInt4));\n i15 = i16 + 1;\n } catch (Throwable th16) {\n C0310c.m956a(th16, \"Req\", \"buildV4Dot216\");\n byte[] b5 = m1034b(\"00:00:00:00:00:00\");\n System.arraycopy(b5, 0, bArr, i28, b5.length);\n int length17 = b5.length + i28;\n bArr[length17] = 0;\n int i29 = length17 + 1;\n bArr[i29] = Byte.parseByte(\"0\");\n i15 = i29 + 1;\n }\n }\n String[] split2 = this.f684D.split(\"\\\\*\");\n if (TextUtils.isEmpty(this.f684D) || split2.length == 0) {\n bArr[i15] = 0;\n i17 = i15 + 1;\n } else {\n bArr[i15] = (byte) split2.length;\n int i30 = i15 + 1;\n for (String str : split2) {\n String[] split3 = str.split(MiPushClient.ACCEPT_TIME_SEPARATOR);\n try {\n b = m1034b(split3[0]);\n } catch (Throwable th17) {\n C0310c.m956a(th17, \"Req\", \"buildV4Dot2110\");\n b = m1034b(\"00:00:00:00:00:00\");\n }\n System.arraycopy(b, 0, bArr, i30, b.length);\n int length18 = i30 + b.length;\n try {\n byte[] bytes15 = split3[2].getBytes(\"GBK\");\n bArr[length18] = (byte) bytes15.length;\n length18++;\n System.arraycopy(bytes15, 0, bArr, length18, bytes15.length);\n i19 = bytes15.length + length18;\n } catch (Throwable th18) {\n C0310c.m956a(th18, \"Req\", \"buildV4Dot217\");\n bArr[length18] = 0;\n i19 = length18 + 1;\n }\n int parseInt5 = Integer.parseInt(split3[1]);\n if (parseInt5 > 127) {\n parseInt5 = 0;\n }\n bArr[i19] = Byte.parseByte(String.valueOf(parseInt5));\n i30 = i19 + 1;\n }\n byte[] b6 = C0331cr.m1177b(Integer.parseInt(this.f685E));\n System.arraycopy(b6, 0, bArr, i30, b6.length);\n i17 = i30 + b6.length;\n }\n try {\n byte[] bytes16 = this.f686F.getBytes(\"GBK\");\n if (bytes16.length > 127) {\n bytes16 = null;\n }\n if (bytes16 == null) {\n bArr[i17] = 0;\n i18 = i17 + 1;\n } else {\n bArr[i17] = (byte) bytes16.length;\n int i31 = i17 + 1;\n System.arraycopy(bytes16, 0, bArr, i31, bytes16.length);\n i18 = bytes16.length + i31;\n }\n } catch (Throwable th19) {\n C0310c.m956a(th19, \"Req\", \"buildV4Dot218\");\n bArr[i17] = 0;\n i18 = i17 + 1;\n }\n int length19 = this.f687G != null ? this.f687G.length : 0;\n byte[] b7 = C0331cr.m1177b(length19);\n System.arraycopy(b7, 0, bArr, i18, b7.length);\n int length20 = i18 + b7.length;\n if (length19 > 0) {\n System.arraycopy(this.f687G, 0, bArr, length20, this.f687G.length);\n length20 += this.f687G.length;\n }\n byte[] bArr2 = new byte[length20];\n System.arraycopy(bArr, 0, bArr2, 0, length20);\n CRC32 crc32 = new CRC32();\n crc32.update(bArr2);\n byte[] a = C0331cr.m1167a(crc32.getValue());\n byte[] bArr3 = new byte[(a.length + length20)];\n System.arraycopy(bArr2, 0, bArr3, 0, length20);\n System.arraycopy(a, 0, bArr3, length20, a.length);\n int length21 = length20 + a.length;\n m1033a(bArr3, 0);\n return bArr3;\n }", "static int [] GerarAleatorio()\n {\n Random gerar = new Random();\n int [] Aleatorio = new int [pergu]; // Cria um Vetor com o tamanho de quantidade de perguntas\n \n \n int pos1, pos2, auxilio; \n \n for (int i = 0; i < Aleatorio.length; i++) \n {\n Aleatorio[i] = i ; // preenche o vetor\n }\n \n for (int i = 0; i < 1000; i++) //Quantidade de vezes que as perguntas serão embaralhadas \n {\n pos1 = gerar.nextInt(Aleatorio.length);\n pos2 = gerar.nextInt(Aleatorio.length);\n //troca \n auxilio = Aleatorio[pos1]; //guarda o valor da posição 1\n \n Aleatorio [pos1] = Aleatorio[pos2]; //troca o valor de 1 para 2\n Aleatorio[pos2] = auxilio; //troca o valor de 2 para o valor que estava na 1\n }\n \n \n return Aleatorio; \n }", "private void m14048a(List<ScanResult> list, SQLiteDatabase sQLiteDatabase) {\n Throwable th;\n System.currentTimeMillis();\n this.f18056e = false;\n if (list != null && list.size() != 0 && sQLiteDatabase != null && list != null) {\n double d = 0.0d;\n double d2 = 0.0d;\n int i = 0;\n Object obj = null;\n double[] dArr = new double[8];\n Object obj2 = null;\n int i2 = 0;\n StringBuffer stringBuffer = new StringBuffer();\n int i3 = 0;\n for (ScanResult scanResult : list) {\n if (i3 > 10) {\n break;\n }\n if (i3 > 0) {\n stringBuffer.append(\",\");\n }\n i3++;\n stringBuffer.append(\"\\\"\").append(Jni.encode2(scanResult.BSSID.replace(Config.TRACE_TODAY_VISIT_SPLIT, \"\"))).append(\"\\\"\");\n }\n Cursor cursor = null;\n Cursor rawQuery;\n try {\n rawQuery = sQLiteDatabase.rawQuery(\"select * from wof where id in (\" + stringBuffer.toString() + \");\", null);\n try {\n if (rawQuery.moveToFirst()) {\n while (!rawQuery.isAfterLast()) {\n double d3 = rawQuery.getDouble(1) - 113.2349d;\n double d4 = rawQuery.getDouble(2) - 432.1238d;\n int i4 = rawQuery.getInt(4);\n int i5 = rawQuery.getInt(5);\n if (i5 <= 8 || i5 <= i4) {\n int i6;\n Object obj3;\n float[] fArr;\n if (!this.f18055d) {\n if (obj == null) {\n int i7;\n if (obj2 != null) {\n int i8 = 0;\n while (i8 < i2) {\n Object obj4;\n double d5;\n double d6;\n fArr = new float[1];\n Location.distanceBetween(d4, d3, dArr[i8 + 1], dArr[i8], fArr);\n if (fArr[0] < 1000.0f) {\n obj4 = 1;\n d5 = d + dArr[i8];\n d6 = dArr[i8 + 1] + d2;\n i5 = i + 1;\n } else {\n obj4 = obj;\n i5 = i;\n d6 = d2;\n d5 = d;\n }\n i8 += 2;\n d2 = d6;\n d = d5;\n obj = obj4;\n i = i5;\n }\n if (obj == null) {\n if (i2 >= 8) {\n break;\n }\n i4 = i2 + 1;\n dArr[i2] = d3;\n i7 = i4 + 1;\n dArr[i4] = d4;\n i6 = i7;\n obj3 = obj2;\n } else {\n d += d3;\n d2 += d4;\n i++;\n i6 = i2;\n obj3 = obj2;\n }\n } else {\n i4 = i2 + 1;\n dArr[i2] = d3;\n i7 = i4 + 1;\n dArr[i4] = d4;\n i3 = 1;\n i6 = i7;\n }\n } else {\n fArr = new float[1];\n Location.distanceBetween(d4, d3, d2 / ((double) i), d / ((double) i), fArr);\n if (fArr[0] > 1000.0f) {\n rawQuery.moveToNext();\n } else {\n i6 = i2;\n obj3 = obj2;\n }\n }\n } else {\n fArr = new float[1];\n Location.distanceBetween(d4, d3, this.f18059h, this.f18058g, fArr);\n if (((double) fArr[0]) > this.f18057f + 2000.0d) {\n rawQuery.moveToNext();\n } else {\n obj = 1;\n d += d3;\n d2 += d4;\n i++;\n i6 = i2;\n obj3 = obj2;\n }\n }\n if (i > 4) {\n break;\n }\n rawQuery.moveToNext();\n i2 = i6;\n obj2 = obj3;\n } else {\n rawQuery.moveToNext();\n }\n }\n if (i > 0) {\n this.f18056e = true;\n this.f18060i = d / ((double) i);\n this.f18061j = d2 / ((double) i);\n }\n }\n if (rawQuery != null) {\n try {\n rawQuery.close();\n } catch (Exception e) {\n }\n }\n } catch (Exception e2) {\n cursor = rawQuery;\n } catch (Throwable th2) {\n th = th2;\n }\n } catch (Exception e3) {\n if (cursor != null) {\n try {\n cursor.close();\n } catch (Exception e4) {\n }\n }\n } catch (Throwable th3) {\n rawQuery = null;\n th = th3;\n if (rawQuery != null) {\n try {\n rawQuery.close();\n } catch (Exception e5) {\n }\n }\n throw th;\n }\n }\n }", "public java.util.List<java.lang.Integer> getByteListList() {\n return java.util.Collections.unmodifiableList(result.byteList_);\n }", "@Test(timeout = 4000)\n public void test15() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n byte[][] byteArray0 = new byte[3][9];\n byte[] byteArray1 = new byte[4];\n byte byte0 = (byte)1;\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n FileSystemHandling.shouldAllThrowIOExceptions();\n fBCachedFetcher0.getFetchSize();\n try { \n fBCachedFetcher0.absolute(0);\n fail(\"Expecting exception: FBSQLException\");\n \n } catch(FBSQLException e) {\n //\n // You cannot position to the row 0 with absolute() method.\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "List<byte[]> asByteArrayList();", "public final List<byte[]> mo9767g(int i) {\n ArrayList arrayList = new ArrayList();\n while (i > 0) {\n int min = Math.min(i, 4096);\n byte[] bArr = new byte[min];\n int i2 = 0;\n while (i2 < min) {\n int read = this.f9078e.read(bArr, i2, min - i2);\n if (read != -1) {\n this.f9084k += read;\n i2 += read;\n } else {\n throw C3606c0.m8181h();\n }\n }\n i -= min;\n arrayList.add(bArr);\n }\n return arrayList;\n }", "abstract public long[] getBlockListAsLongs();", "private void caricaLista() {\n /** variabili e costanti locali di lavoro */\n ArrayList unaLista = null;\n CampoDati unCampoDati = null;\n CDBLinkato unCampoDBLinkato = null;\n //@todo da cancellare\n try { // prova ad eseguire il codice\n /* recupera il campo DB specializzato */\n unCampoDBLinkato = (CDBLinkato)unCampoParente.getCampoDB();\n\n /* recupera la lista dal campo DB */\n unaLista = unCampoDBLinkato.caricaLista();\n\n /* recupera il campo dati */\n unCampoDati = unCampoParente.getCampoDati();\n\n /* registra i valori nel modello dei dati del campo */\n if (unaLista != null) {\n unCampoDati.setValoriInterni(unaLista);\n// unCampoDatiElenco.regolaElementiAggiuntivi();\n } /* fine del blocco if */\n\n } catch (Exception unErrore) { // intercetta l'errore\n /* mostra il messaggio di errore */\n Errore.crea(unErrore);\n } /* fine del blocco try-catch */\n\n }", "private List<ItemListaIntegracaoDTO> montarListaInstituicaoDTO(List<InstituicaoCooperativaSCIDTO> lista) {\n\t\tList<ItemListaIntegracaoDTO> listaVO = new ArrayList<ItemListaIntegracaoDTO>();\n\n\t\tfor(InstituicaoCooperativaSCIDTO instituicao:lista){\n\t\t\tItemListaIntegracaoDTO item = new ItemListaIntegracaoDTO(instituicao.getNumCooperativa().toString(), instituicao.getNumCooperativa() + \" - \" + instituicao.getNome());\n\t\t\tlistaVO.add(item);\n\t\t}\n\t\t\n\t\tCollections.sort(listaVO, new Comparator<ItemListaIntegracaoDTO>() {\n\t\t\tpublic int compare(ItemListaIntegracaoDTO o1, ItemListaIntegracaoDTO o2){\n\t\t\t\t\treturn o1.getCodListaItem().compareTo(o2.getCodListaItem());\n\t\t\t\t} \n\t\t});\n\t\t\n\t\treturn listaVO;\t\t\n\t}", "@Override\n @Transactional(readOnly = true)\n public List<FicheroByteDTO> findAll() {\n log.debug(\"Request to get all FicheroBytes\");\n return ficheroByteRepository.findAll().stream()\n .map(ficheroByteMapper::toDto)\n .collect(Collectors.toCollection(LinkedList::new));\n }", "private void getArquivo()\n {\n /*** Obtem o conteudo do pacote através do diretorio ***/\n File file = new File(caminho_origem);\n if (file.isFile())\n {\n try\n {\n /*** Lê o pacote e põe em um array de bytes ***/\n DataInputStream diStream = new DataInputStream(new FileInputStream(file));\n long len = (int) file.length();\n if (len > Utils.tamanho_maximo_arquivo)\n {\n System.out.println(Utils.prefixo_cliente + Utils.arquivo_muito_grande);\n System.exit(0);\n }\n Float numero_pacotes_ = ((float)len / Utils.tamanho_util_pacote);\n int numero_pacotes = numero_pacotes_.intValue();\n int ultimo_pacote = (int) len - (Utils.tamanho_util_pacote * numero_pacotes);\n int read = 0;\n /***\n 1500\n fileBytes[1500]\n p[512]\n p[512]\n p[476]len - (512 * numero_pacotes.intValue())\n ***/\n byte[] fileBytes = new byte[(int)len];\n while (read < fileBytes.length)\n {\n fileBytes[read] = diStream.readByte();\n read++;\n }\n int i = 0;\n int pacotes_feitos = 0;\n while ( pacotes_feitos < numero_pacotes)\n {\n byte[] mini_pacote = new byte[Utils.tamanho_util_pacote];\n for (int k = 0; k < Utils.tamanho_util_pacote; k++)\n {\n mini_pacote[k] = fileBytes[i];\n i++;\n }\n Pacote pacote_ = new Pacote();\n pacote_.setConteudo(mini_pacote);\n this.pacotes.add(pacote_);\n pacotes_feitos++;\n }\n byte[] ultimo_mini_pacote = new byte[ultimo_pacote];\n int ultimo_indice = ultimo_mini_pacote.length;\n for (int j = 0; j < ultimo_mini_pacote.length; j++)\n {\n ultimo_mini_pacote[j] = fileBytes[i];\n i++;\n }\n byte[] ultimo_mini_pacote2 = new byte[512];\n System.arraycopy(ultimo_mini_pacote, 0, ultimo_mini_pacote2, 0, ultimo_mini_pacote.length);\n for(int h = ultimo_indice; h < 512; h++ ) ultimo_mini_pacote2[h] = \" \".getBytes()[0];\n Pacote pacote_ = new Pacote();\n pacote_.setConteudo(ultimo_mini_pacote2);\n this.pacotes.add(pacote_);\n this.janela = new HashMap<>();\n for (int iterator = 0; iterator < this.pacotes.size(); iterator++) janela.put(iterator, new Estado());\n } catch (Exception e)\n {\n System.out.println(Utils.prefixo_cliente + Utils.erro_na_leitura);\n System.exit(0);\n }\n } else\n {\n System.out.println(Utils.prefixo_cliente + Utils.arquivo_inexistente);\n System.exit(0);\n }\n }", "public List<NumeroMega> listar() {\n List<NumeroMega> lista = new ArrayList<NumeroMega>();\n\n // Definicao da instrucao SQL\n String sql = \"Select NumeroMega from \" +TABELA+ \" order by id\";\n\n // Objeto que recebe os registros do banco de dados\n Cursor cursor = getReadableDatabase().rawQuery(sql, null);\n\n try {\n while (cursor.moveToNext()) {\n // Criacao de nova referencia\n NumeroMega numeroMega = new NumeroMega();\n // Carregar os atributos com dados do BD\n\n numeroMega.setNumeroMega(cursor.getString(0));\n\n // Adicionar novo a lista\n lista.add(numeroMega);\n }\n } catch (SQLException e) {\n Log.e(TAG, e.getMessage());\n } finally {\n cursor.close();\n }\n return lista;\n }", "public EnemigoGenerico[] cargaBichos()\n {\n \n //Crear la bicheria (hardCoded)\n CoordCasilla[] origen={new CoordCasilla(1,1), new CoordCasilla(18,1), new CoordCasilla(14,8), new CoordCasilla(17,17), new CoordCasilla(13,5)};\n CoordCasilla[] destino={new CoordCasilla(6,18) , new CoordCasilla(1,1), new CoordCasilla(1,8), new CoordCasilla(18,1) , new CoordCasilla(13,18) };\n \n \n DefBicho pelota=this.atlasBicheria.get(\"Pelota Maligna\");\n EnemigoGenerico bichos[]=new EnemigoGenerico[origen.length];\n \n for(int x=0;x<origen.length;x++)\n {\n List<CoordCasilla> camino = this.getCamino(origen[x], destino[x]);\n Gdx.app.log(\"CAMINO:\", \"DESDE (\"+origen[x].x+\",\"+origen[x].y+\") HASTA ( \"+destino[x].x+\",\"+destino[x].y+\")\");\n for (CoordCasilla cc : camino)\n Gdx.app.log(\"CASILLA.\", String.format(\"(%2d ,%2d )\", cc.x, cc.y));\n \n \n bichos[x] = new EnemigoGenerico(pelota, this.mapaAnimaciones.get(pelota.archivoAnim), pelota.pv, pelota.tasaRegen, pelota.velocidad, camino, pelota.distanciaPercepcion, pelota.ataques);\n }\n \n return bichos;\n }", "public List<List<CruciCasillas>> cargar(){\r\n\t\t\r\n\t\tList<List<CruciCasillas>> palabras = new ArrayList<List<CruciCasillas>>(manejadorArchivos.cargar());\r\n\t\t\r\n\t\treturn palabras;\r\n\t}", "public static void main(String[] args) {\n Util_BinTreeNode<Integer> root = new Util_BinTreeNode<>();\n root.add(8);\n root.add(4); root.add(16);\n root.add(2); root.add(6); root.add(11); root.add(20);\n /*\n Caution. Adding the bellow nodes, causes the java.lang.OutOfMemoryError: GC overhead limit exceeded\n root.add(1); root.add(3); root.add(5); root.add(7);\n root.add(10); root.add(12); root.add(19); root.add(21);\n */\n System.out.println(java.time.LocalTime.now());\n ArrayList<LinkedList<Integer>> aofl = allSequences(root);\n System.out.println(java.time.LocalTime.now());\n\n for (LinkedList<Integer> list : aofl) {\n for (Integer i : list) {\n System.out.print(i + \",\");\n }\n System.out.println(\" \");\n }\n }", "private int[] enquadramentoViolacaoCamadaFisica(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Violacao da Camada Fisica]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Violacao da Camada Fisica]\");\n Thread.sleep(velocidade);\n\n final int byteFlag = 255;//00000000 00000000 00000000 11111111\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Bits de Flag [11111111] = 255]\\n\\n\");\n Thread.sleep(velocidade);\n\n String auxiliar = \"\";\n Boolean SE = true;\n\n for (int inteiro : quadro) {\n int quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(inteiro);\n ManipuladorDeBit.imprimirBits(inteiro);\n inteiro = ManipuladorDeBit.deslocarBits(inteiro);\n ManipuladorDeBit.imprimirBits(inteiro);\n int inteiroByte = ManipuladorDeBit.getPrimeiroByte(inteiro);\n\n if (inteiroByte == byteFlag) {//Inicio do Quadro\n SE = !SE;//Iniciar a Busca pelo Byte de Fim de Quadro\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n quantidadeByte--;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\tIC [\" + inteiroByte + \"] \");\n }\n\n if (!SE) {\n\n ManipuladorDeBit.imprimirBits(inteiro);\n\n for (int i=1; i<=quantidadeByte; i++) {\n int dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n ManipuladorDeBit.imprimirBits(dado);\n\n if (dado == byteFlag) {//Verificando se encontrou o Byte de Flag\n SE = !SE;//Encontrou o Byte de Fim de Quadro\n } else {\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [ \");\n\n int novoQuadro = 0;\n\n Boolean cincoBits1 = ManipuladorDeBit.cincoBitsSequenciais(dado,1);\n if (cincoBits1) {\n\n dado = ManipuladorDeBit.deslocarBits(dado);\n ManipuladorDeBit.imprimirBits(dado);\n\n //Cria um inteiro com 1 no bit mais a esquerda e 0s em outros locais\n int displayMask = 1 << 31;//10000000 00000000 00000000 00000000\n //Para cada bit exibe 0 ou 1\n for (int b=1, cont=0; b<=8; b++) {\n //Utiliza displayMask para isolar o bit\n int bit = (dado & displayMask) == 0 ? 0 : 1;\n\n if (cont == 5) {\n cont = 0;//Zerando o contador\n dado <<= 1;//Desloca 1 bit para a esquerda\n bit = (dado & displayMask) == 0 ? 0 : 1;\n }\n\n if (b == 8) {//Quando chegar no Ultimo Bit\n inteiro <<= 8;//Deslocando 8 bits para esquerda\n dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n dado = ManipuladorDeBit.deslocarBits(dado);\n ManipuladorDeBit.imprimirBits(dado);\n\n novoQuadro <<= 1;//Deslocando 1 bit para a esquerda\n novoQuadro |= ManipuladorDeBit.pegarBitNaPosicao(dado,1);//Adicionando o bit ao novoDado\n\n ManipuladorDeBit.imprimirBits(novoQuadro);\n\n auxiliar += (char) novoQuadro;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(novoQuadro + \" ]\\n\");\n Thread.sleep(velocidade);\n i++;\n\n } else {//Colocando o Bit no novoQuadro\n novoQuadro <<= 1;//Deslocando 1 bit para a esquerda\n novoQuadro |= bit;//Adicionando o bit ao novoDado\n dado <<= 1;//Desloca 1 bit para a esquerda\n }\n\n if (bit == 1) {//Quando for um bit 1\n cont++;\n } else {//Caso vinher um bit 0\n cont = 0;\n }\n }\n\n } else {//Caso nao tem uma sequencia de 5 Bits 1's\n auxiliar += (char) dado;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(dado + \" ]\\n\");\n Thread.sleep(velocidade);\n }\n }\n \n inteiro <<= 8;//Deslocando 8 bits para a esquerda;\n }\n\n }\n }\n\n //Novo Quadro de Carga Util\n int[] quadroDesenquadrado = new int[auxiliar.length()];\n //Adicionando as informacoes de Carga Util no QuadroDesenquadrado\n for (int i=0; i<auxiliar.length(); i++) {\n quadroDesenquadrado[i] = (int) auxiliar.charAt(i);\n ManipuladorDeBit.imprimirBits(quadroDesenquadrado[i]);\n }\n\n return quadroDesenquadrado;\n }", "public final List<a> brw() {\n List<a> linkedList;\n Exception e;\n Throwable th;\n AppMethodBeat.i(73624);\n Cursor rawQuery;\n try {\n rawQuery = this.bSd.rawQuery(\"select rowid,exptId,groupId,exptSeq from ExptItem order by exptId\", null);\n if (rawQuery != null) {\n try {\n linkedList = new LinkedList();\n while (rawQuery.moveToNext()) {\n try {\n a aVar = new a();\n aVar.d(rawQuery);\n linkedList.add(aVar);\n } catch (Exception e2) {\n e = e2;\n try {\n ab.e(\"MicroMsg.ExptStorage\", \"get all expt without content error [%s]\", e.toString());\n if (rawQuery != null) {\n rawQuery.close();\n }\n AppMethodBeat.o(73624);\n return linkedList;\n } catch (Throwable th2) {\n th = th2;\n if (rawQuery != null) {\n }\n AppMethodBeat.o(73624);\n throw th;\n }\n }\n }\n ab.d(\"MicroMsg.ExptStorage\", \"get all expt without content [%d]\", Integer.valueOf(linkedList.size()));\n } catch (Exception e3) {\n e = e3;\n linkedList = null;\n ab.e(\"MicroMsg.ExptStorage\", \"get all expt without content error [%s]\", e.toString());\n if (rawQuery != null) {\n }\n AppMethodBeat.o(73624);\n return linkedList;\n }\n }\n linkedList = null;\n if (rawQuery != null) {\n rawQuery.close();\n }\n } catch (Exception e4) {\n e = e4;\n rawQuery = null;\n linkedList = null;\n } catch (Throwable th3) {\n th = th3;\n rawQuery = null;\n if (rawQuery != null) {\n rawQuery.close();\n }\n AppMethodBeat.o(73624);\n throw th;\n }\n AppMethodBeat.o(73624);\n return linkedList;\n }", "public static void main(String[] args) throws Exception {\n\t\tLista<Contato> vetor = new Lista<Contato>(20);\n\t\tLinkedList<Contato> listaEncadeada = new LinkedList<Contato>();\n\n\t\tContato c1 = new Contato(\"c1\", \"111-1111\", \"c1@email.com.br\");\n\t\tContato c2 = new Contato(\"c2\", \"222-2222\", \"c2@email.com.br\");\n\t\tContato c3 = new Contato(\"c3\", \"333-3333\", \"c3@email.com.br\");\n\t\tContato c4 = new Contato(\"c4\", \"444-2344\", \"c4@email.com.br\");\n\t\tContato c5 = new Contato(\"c5\", \"555-5585\", \"c5@email.com.br\");\n\t\tContato c6 = new Contato(\"c6\", \"111-1911\", \"c6@email.com.br\");\n\t\tContato c7 = new Contato(\"c7\", \"222-2322\", \"c7@email.com.br\");\n\t\tContato c8 = new Contato(\"c8\", \"333-3333\", \"c8@email.com.br\");\n\t\tContato c9 = new Contato(\"c9\", \"454-4644\", \"c9@email.com.br\");\n\t\tContato c10 = new Contato(\"c10\", \"515-5235\", \"c10@email.com.br\");\n\t\tContato c11 = new Contato(\"c11\", \"131-1411\", \"c11@email.com.br\");\n\t\tContato c12 = new Contato(\"c12\", \"252-2672\", \"c12@email.com.br\");\n\t\tContato c13 = new Contato(\"c13\", \"313-3433\", \"c13@email.com.br\");\n\t\tContato c14 = new Contato(\"c14\", \"433-4334\", \"c14@email.com.br\");\n\t\tContato c15 = new Contato(\"c15\", \"535-5355\", \"c15@email.com.br\");\n\t\tContato c16 = new Contato(\"c16\", \"161-1516\", \"c16@email.com.br\");\n\t\tContato c17 = new Contato(\"c17\", \"272-2272\", \"c17@email.com.br\");\n\t\tContato c18 = new Contato(\"c18\", \"383-3993\", \"c18@email.com.br\");\n\t\tContato c19 = new Contato(\"c19\", \"141-4949\", \"c19@email.com.br\");\n\t\tContato c20 = new Contato(\"c20\", \"565-5565\", \"c20@email.com.br\");\n\t\tContato c21 = new Contato(\"c21\", \"616-1611\", \"c21@email.com.br\");\n\t\tContato c22 = new Contato(\"c22\", \"212-2121\", \"c22@email.com.br\");\n\t\tContato c23 = new Contato(\"c23\", \"131-1331\", \"c23@email.com.br\");\n\t\tContato c24 = new Contato(\"c24\", \"424-4444\", \"c24@email.com.br\");\n\t\tContato c25 = new Contato(\"c25\", \"565-5555\", \"c25@email.com.br\");\n\t\tContato c26 = new Contato(\"c26\", \"111-1611\", \"c26@email.com.br\");\n\t\tContato c27 = new Contato(\"c27\", \"282-1252\", \"c27@email.com.br\");\n\t\tContato c28 = new Contato(\"c28\", \"323-3433\", \"c28@email.com.br\");\n\t\tContato c29 = new Contato(\"c29\", \"544-4464\", \"c29@email.com.br\");\n\t\tContato c30 = new Contato(\"c30\", \"155-5455\", \"c30@email.com.br\");\n\n\t\ttry {\n\t\t\t// ex5\n\t\t\tvetor.adiciona(c1);\n\t\t\tvetor.adiciona(c2);\n\t\t\tvetor.adiciona(c3);\n\t\t\tvetor.adiciona(c4);\n\t\t\tvetor.adiciona(c5);\n\t\t\tvetor.adiciona(c6);\n\t\t\tvetor.adiciona(c7);\n\t\t\tvetor.adiciona(c8);\n\t\t\tvetor.adiciona(c9);\n\t\t\tvetor.adiciona(c10);\n\t\t\tvetor.adiciona(c11);\n\t\t\tvetor.adiciona(c12);\n\t\t\tvetor.adiciona(c13);\n\t\t\tvetor.adiciona(c14);\n\t\t\tvetor.adiciona(c15);\n\t\t\tvetor.adiciona(c16);\n\t\t\tvetor.adiciona(c17);\n\t\t\tvetor.adiciona(c18);\n\t\t\tvetor.adiciona(c19);\n\t\t\tvetor.adiciona(c20);\n\t\t\tvetor.adiciona(c21);\n\t\t\tvetor.adiciona(c22);\n\t\t\tvetor.adiciona(c23);\n\t\t\tvetor.adiciona(c24);\n\t\t\tvetor.adiciona(c25);\n\t\t\tvetor.adiciona(c26);\n\t\t\tvetor.adiciona(c27);\n\t\t\tvetor.adiciona(c28);\n\t\t\tvetor.adiciona(c29);\n\t\t\tvetor.adiciona(c30);\n\t\t\t// ex3\n\t\t\tvetor.removerT(\"111-1111\");\n\t\t\t//ex4-vetor.RemoverTudo();\n\t\t\t\n\t\t\tSystem.out.println(vetor);\n\t\t\t// ex1\n\t\t\tSystem.out.println(\"Confirmar se o elemento na lista existe:\" + vetor.contem(c2));\n\t\t\t// ex2\n\t\t\tSystem.out.println(\"Retornar a posicao do elemento, se retornar -1 que dizer que o elemento não existe:\"\n\t\t\t\t\t+ vetor.indicio(c2));\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// ex6\n\t\tlistaEncadeada.add(c1);\n\t\tlistaEncadeada.add(c2);\n\t\tlistaEncadeada.add(c3);\n\t\tlistaEncadeada.add(c4);\n\t\tlistaEncadeada.add(c5);\n\t\tlistaEncadeada.add(c6);\n\t\tlistaEncadeada.add(c7);\n\t\tlistaEncadeada.add(c8);\n\t\tlistaEncadeada.add(c9);\n\t\tlistaEncadeada.add(c10);\n\t\tlistaEncadeada.add(c11);\n\t\tlistaEncadeada.add(c12);\n\t\tlistaEncadeada.add(c13);\n\t\tlistaEncadeada.add(c14);\n\t\tlistaEncadeada.add(c15);\n\t\tlistaEncadeada.add(c16);\n\t\tlistaEncadeada.add(c17);\n\t\tlistaEncadeada.add(c18);\n\t\tlistaEncadeada.add(c19);\n\t\tlistaEncadeada.add(c20);\n\t\tlistaEncadeada.add(c21);\n\t\tlistaEncadeada.add(c22);\n\t\tlistaEncadeada.add(c23);\n\t\tlistaEncadeada.add(c24);\n\t\tlistaEncadeada.add(c25);\n\t\tlistaEncadeada.add(c26);\n\t\tlistaEncadeada.add(c27);\n\t\tlistaEncadeada.add(c28);\n\t\tlistaEncadeada.add(c29);\n\t\tlistaEncadeada.add(c30);\n\n\t\tSystem.out.println(listaEncadeada);\n\n\t}", "private static byte[] m2539e(Context context) {\n Throwable th;\n int i = 0;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n byte[] bArr = new byte[0];\n String a = Log.m2547a(context, Log.f1857e);\n DiskLruCache diskLruCache = null;\n try {\n diskLruCache = DiskLruCache.m2767a(new File(a), 1, 1, 10240);\n File file = new File(a);\n if (file != null && file.exists()) {\n String[] list = file.list();\n int length = list.length;\n while (i < length) {\n String str = list[i];\n if (str.contains(\".0\")) {\n byteArrayOutputStream.write(StatisticsManager.m2535a(diskLruCache, str.split(\"\\\\.\")[0]));\n }\n i++;\n }\n }\n bArr = byteArrayOutputStream.toByteArray();\n if (byteArrayOutputStream != null) {\n try {\n byteArrayOutputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (diskLruCache != null) {\n try {\n diskLruCache.close();\n } catch (Throwable th2) {\n th = th2;\n }\n }\n } catch (IOException th3) {\n BasicLogHandler.m2542a(th3, \"StatisticsManager\", \"getContent\");\n if (byteArrayOutputStream != null) {\n try {\n byteArrayOutputStream.close();\n } catch (IOException e2) {\n e2.printStackTrace();\n }\n }\n if (diskLruCache != null) {\n diskLruCache.close();\n }\n } catch (Throwable th4) {\n th3 = th4;\n }\n return bArr;\n th3.printStackTrace();\n return bArr;\n }", "static ArrayList runLengthEncodingSequence(List<List> lists){\r\n\t\t\r\n\t\tArrayList encodinglist=new ArrayList<>();\r\n\t\t\r\n\t\tfor(List a: lists)\r\n\t\t{\r\n\t\t\tArrayList encodinglistinner=new ArrayList<>();\r\n\t\t\tencodinglistinner.add(a.size());\r\n\t\t\tencodinglistinner.add(a.get(0));\r\n\t\t\tencodinglist.add(encodinglistinner);\r\n\t\t}\r\n\t\treturn encodinglist;\r\n\t\r\n\t}", "private ArrayList limpiar() {//quita espacios en blanco y saltos de linea\n String codigoFuente = ta_source.getText();\n ArrayList retorno = new ArrayList();\n try {\n codigoFuente = codigoFuente.replaceAll(\" \", \"\");\n String aux = \"\";\n byte guardaLinea = 1, guardaBloque = 1;\n for (int i = 0; i < codigoFuente.length(); i++) {\n if (codigoFuente.length() > (i + 1) && codigoFuente.charAt(i) == '/' && codigoFuente.charAt(i + 1) == '/' && guardaBloque == 1) {\n guardaLinea = 0;//0: no guarda\n }\n if (codigoFuente.length() > (i + 1) && codigoFuente.charAt(i) == '/' && codigoFuente.charAt(i + 1) == '*' && guardaLinea == 1) {\n guardaBloque = 0;//0: no guarda\n }\n if (i > 0 && codigoFuente.charAt(i) == '/' && codigoFuente.charAt(i - 1) == '*') {\n guardaBloque = 2;//1: si guarda\n }\n if (codigoFuente.charAt(i) == '\\n' && guardaBloque == 1) {\n guardaLinea = 1;//1: si guarda\n if (aux.length() > 0) {\n retorno.add(aux);\n aux = \"\";\n }\n } else {\n if (i == codigoFuente.length() - 1) {\n aux += codigoFuente.charAt(i);\n retorno.add(aux);\n }\n }\n if (guardaBloque == 1 && guardaLinea == 1 && codigoFuente.charAt(i) != '\\n') {\n aux += codigoFuente.charAt(i);\n }\n if (guardaBloque == 2) {\n guardaBloque--;\n }\n }\n } catch (Exception e) {\n System.out.println(\"errror \" + e.getClass());\n } finally {\n return retorno;\n }\n }", "public ArrayList consultarTodo() {\n Cursor cursor = this.myDataBase.rawQuery(\"SELECT des_invfisico_tmp._id,des_invfisico_tmp.cod_ubicacion,des_invfisico_tmp.cod_referencia,des_invfisico_tmp.cod_plu,plu.descripcion FROM des_invfisico_tmp LEFT OUTER JOIN plu ON plu.cod_plu = des_invfisico_tmp.cod_plu \", null);\n ArrayList arrayList = new ArrayList();\n new ArrayList();\n if (cursor.moveToFirst()) {\n do {\n for (int i = 0; i <= 4; ++i) {\n if (cursor.isNull(i)) {\n arrayList.add(\"\");\n continue;\n }\n arrayList.add(cursor.getString(i));\n }\n } while (cursor.moveToNext());\n }\n\n return arrayList;\n }", "public void limpiarMemoria();", "public void transcribir() \r\n\t{\r\n\t\tpalabras = new ArrayList<List<CruciCasillas>>();\r\n\t\tmanejadorArchivos = new CruciSerializacion();\r\n\t\tint contador = 0;\r\n\t\t\r\n\t\tmanejadorArchivos.leer(\"src/Archivos/crucigrama.txt\");\r\n\t\t\r\n\t\tfor(int x = 0;x<manejadorArchivos.getPalabras().size();x++){\r\n\t\t\t\r\n\t\t\tcontador++;\r\n\t\t\t\r\n\t\t\tif (contador == 4) {\r\n\t\t\t\r\n\t\t\t\tList<CruciCasillas> generico = new ArrayList<CruciCasillas>();\r\n\t\t\t\t\r\n\t\t\t\tfor(int y = 0; y < manejadorArchivos.getPalabras().get(x).length();y++)\r\n\t\t\t\t{\r\n\t\t\t\t\t\tgenerico.add(new CruciCasillas(manejadorArchivos.getPalabras().get(x).charAt(y)));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (y == (manejadorArchivos.getPalabras().get(x).length() - 1)) \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tpalabras.add(generico);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tcontador = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\t\r\n\t}", "@Test\n\tpublic void testListarVazio() throws IOException {\n\t\t// 1) criar o arquivo de dados vazio\n\t\tString nomeArquivo = \"dados.txt\";\n\t\tnew File(nomeArquivo).createNewFile();\t\t\n\t\t// 2) criar o processador de arquivos\n\t\t// utilizando o arquivo criado acima\n\t\tProcessadorDeArquivoSequencial pas = \n\t\t\t\tnew ProcessadorDeArquivoSequencial(\n\t\t\t\t\t\tnomeArquivo);\n\t\t// 3) solicitar a listagem dos registros\n\t\t// do processador\n\t\tList<Registro> lista = pas.listar();\n\t\t// 4) verificar tamanho zero dos registros\n\t\tAssert.assertTrue(lista.isEmpty());\n\t\t// 5) excluir o arquivo criado\n\t\tnew File(nomeArquivo).delete();\n\t}", "public List<Cuenta> leerArchivoToList(InputStream archivo);", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int frames = 0, numPaginas = 0, cupoRevisado = 0, punteroExiste = -1, fallos = 0;\n boolean existe = false;\n String paginasIngresadas = \"\", accion = \"\";\n\n ArrayList paginas = new ArrayList();\n ArrayList bitPaginas = new ArrayList();\n ArrayList paginasAccedidas = new ArrayList();\n\n System.out.print(\"Ingrese numero de frames: \");\n frames = sc.nextInt();\n \n System.out.println(\"\");\n\n System.out.print(\"Ingrese cantidad de paginas: \");\n numPaginas = sc.nextInt();\n \n System.out.println(\"\");\n \n for (int i = 0; i < numPaginas; i++) {\n paginas.add((int)Math.floor(Math.random() * 20) + 1);\n }\n// System.out.print(\"Ingrese paginas separadas por coma (ej: 1,2,3,4): \");\n// paginasIngresadas = sc.next();\n\n// String[] paginasParseadas = paginasIngresadas.split(\",\");\n// numPaginas = paginasParseadas.length;\n//\n// for(int i = 0; i < paginasParseadas.length; i++) {\n// paginas.add(Integer.parseInt(paginasParseadas[i]));\n// }\n \n paginasAccedidas.add(paginas.get(0));\n bitPaginas.add(1);\n fallos++;\n\n accion = \"Se ingreso la pagina \" + paginasAccedidas.get(0) + \" con bit inicialzado en 1\";\n accion += \", fallos = \" + fallos;\n\n System.out.println(\"\");\n\n //Algoritmo de segunda oportunidad\n for(int i = 0; i < numPaginas; i++) {\n cupoRevisado = 0;\n existe = false;\n\n if(paginasAccedidas.size() == frames){\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)paginasAccedidas.get(j) == ((int)paginas.get(i)))){\n existe = true;\n if(((int)bitPaginas.get(j)) == 0) {\n bitPaginas.set(j, 1);\n accion = \"La pagina \" + paginasAccedidas.get(j) + \" ya existe en la tabla de paginas, su bit cambio de 0 a 1\";\n\n j = paginasAccedidas.size();\n }\n }\n }\n\n if(!existe){\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)bitPaginas.get(j)) == 0) {\n accion = \"Se reemplazo la pagina \" + paginasAccedidas.get(j) + \" con bit 0 por la pagina entrante \" + paginas.get(i) + \" inicializada con bit 1\";\n paginasAccedidas.set(j, paginas.get(i));\n fallos++;\n\n accion += \", fallos = \" + fallos;\n\n bitPaginas.set(j, 1);\n \n j = paginasAccedidas.size(); \n } else {\n cupoRevisado++;\n }\n }\n }\n\n if(cupoRevisado == frames) {\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n bitPaginas.set(j, 0);\n }\n\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)bitPaginas.get(j)) == 0) {\n accion = \"Todas las paginas son irremplazables, se cambiaron todos los bits de 1 a 0 y se reemplazo la pagina \" + paginasAccedidas.get(j) + \" por la pagina entrante \" + paginas.get(i);\n paginasAccedidas.set(j, paginas.get(i));\n fallos++;\n\n accion += \", fallos = \" + fallos;\n\n bitPaginas.set(j, 1);\n \n j = paginasAccedidas.size(); \n } else {\n cupoRevisado++;\n }\n }\n }\n } else {\n for(int j = 0; j < paginasAccedidas.size(); j++) {\n if(((int)paginasAccedidas.get(j) == ((int)paginas.get(i)))){\n existe = true;\n if(((int)bitPaginas.get(j)) == 0) {\n accion = \"La pagina \" + paginasAccedidas.get(j) + \" ya existe en la tabla de paginas, su bit cambio de 0 a 1\";\n bitPaginas.set(j, 1);\n\n j = paginasAccedidas.size();\n }\n } else {\n if(!existe) {\n paginasAccedidas.add(paginas.get(i));\n fallos++;\n\n accion = \"Se ingreso la pagina \" + paginas.get(i) + \" con bit inicializado en 1\";\n accion += \", fallos = \" + fallos;\n\n bitPaginas.add(1);\n\n j = paginasAccedidas.size();\n }\n }\n }\n }\n\n if(accion != \"\"){\n for(int j = 0; j < frames; j++){\n if(j < paginasAccedidas.size()){\n System.out.print(\" [ \" + paginasAccedidas.get(j) + \" ]\" + \"[ \" + bitPaginas.get(j) + \" ] \");\n } else {\n System.out.print(\" [ ][ ] \");\n }\n }\n \n System.out.println(\" Accion realizada: \" + accion);\n accion = \"\";\n\n System.out.println();\n } else {\n for(int j = 0; j < frames; j++){\n if(j < paginasAccedidas.size()){\n System.out.print(\" [ \" + paginasAccedidas.get(j) + \" ]\" + \"[ \" + bitPaginas.get(j) + \" ] \");\n } else {\n System.out.print(\" [ ][ ] \");\n }\n }\n \n System.out.println(\" Accion realizada: La pagina entrante \" + paginas.get(i) + \" ya existe en la tabla y su bit esta inicializado en 1\");\n accion = \"\";\n\n System.out.println();\n }\n }\n\n System.out.println(\"El numero de fallos fue: \" + fallos);\n \n }", "public static byte[] encode(ArrayList<Integer> nums)\n {\n //ArrayList<Byte> byteStream = new ArrayList<Byte>();\n int totalSize = 0;\n for(int i=0;i<nums.size();i++)\n {\n int n = nums.get(i);\n int sizeReq = 1;\n if(n < Math.pow(2, 7))\n sizeReq = 1;\n else if(n < Math.pow(2, 14))\n sizeReq = 2;\n else if(n < Math.pow(2, 21))\n sizeReq = 3;\n else if(n < Math.pow(2, 28))\n sizeReq = 4;\n totalSize += sizeReq;\n }\n byte totalArray[] = new byte[totalSize];\n int c = 0;\n for(int i=0;i<nums.size();i++)\n {\n byte array[] = encode(nums.get(i));\n //byteStream.addAll(array);\n for(int j=0;j<array.length;j++)\n totalArray[c++] = array[j];\n }\n return totalArray;\n }", "private static int getBytes(long r23) {\n /*\n java.lang.ThreadLocal<byte[]> r0 = TEMP_NUMBER_BUFFER\n java.lang.Object r0 = r0.get()\n byte[] r0 = (byte[]) r0\n r1 = 20\n if (r0 != 0) goto L_0x0013\n byte[] r0 = new byte[r1]\n java.lang.ThreadLocal<byte[]> r2 = TEMP_NUMBER_BUFFER\n r2.set(r0)\n L_0x0013:\n r2 = -9223372036854775808\n r4 = 54\n r5 = 57\n r6 = 45\n r7 = 53\n r8 = 56\n r9 = 55\n r10 = 51\n r11 = 50\n r12 = 0\n r13 = 48\n r14 = 1\n int r15 = (r23 > r2 ? 1 : (r23 == r2 ? 0 : -1))\n if (r15 != 0) goto L_0x0076\n r0[r12] = r6\n r0[r14] = r5\n r2 = 2\n r0[r2] = r11\n r2 = 3\n r0[r2] = r11\n r2 = 4\n r0[r2] = r10\n r2 = 5\n r0[r2] = r10\n r2 = 6\n r0[r2] = r9\n r2 = 7\n r0[r2] = r11\n r2 = 8\n r0[r2] = r13\n r2 = 9\n r0[r2] = r10\n r2 = 10\n r0[r2] = r4\n r2 = 11\n r0[r2] = r8\n r2 = 12\n r0[r2] = r7\n r2 = 13\n r3 = 52\n r0[r2] = r3\n r2 = 14\n r0[r2] = r9\n r2 = 15\n r0[r2] = r9\n r2 = 16\n r0[r2] = r7\n r2 = 17\n r0[r2] = r8\n r2 = 18\n r0[r2] = r13\n r2 = 19\n r0[r2] = r8\n return r1\n L_0x0076:\n r1 = 0\n int r3 = (r23 > r1 ? 1 : (r23 == r1 ? 0 : -1))\n if (r3 != 0) goto L_0x007f\n r0[r12] = r13\n return r14\n L_0x007f:\n if (r3 >= 0) goto L_0x0088\n r0[r12] = r6\n long r15 = java.lang.Math.abs(r23)\n goto L_0x008b\n L_0x0088:\n r14 = 0\n r15 = r23\n L_0x008b:\n r17 = 9\n r19 = 10\n r21 = 1\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x0099\n r17 = r21\n goto L_0x017e\n L_0x0099:\n r17 = 99\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00a3\n r17 = r19\n goto L_0x017e\n L_0x00a3:\n r17 = 999(0x3e7, double:4.936E-321)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00ad\n r17 = 100\n goto L_0x017e\n L_0x00ad:\n r17 = 9999(0x270f, double:4.94E-320)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00b7\n r17 = 1000(0x3e8, double:4.94E-321)\n goto L_0x017e\n L_0x00b7:\n r17 = 99999(0x1869f, double:4.9406E-319)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00c2\n r17 = 10000(0x2710, double:4.9407E-320)\n goto L_0x017e\n L_0x00c2:\n r17 = 999999(0xf423f, double:4.94065E-318)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00ce\n r17 = 100000(0x186a0, double:4.94066E-319)\n goto L_0x017e\n L_0x00ce:\n r17 = 9999999(0x98967f, double:4.940656E-317)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00da\n r17 = 1000000(0xf4240, double:4.940656E-318)\n goto L_0x017e\n L_0x00da:\n r17 = 99999999(0x5f5e0ff, double:4.9406564E-316)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00e6\n r17 = 10000000(0x989680, double:4.9406565E-317)\n goto L_0x017e\n L_0x00e6:\n r17 = 999999999(0x3b9ac9ff, double:4.940656453E-315)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x00f2\n r17 = 100000000(0x5f5e100, double:4.94065646E-316)\n goto L_0x017e\n L_0x00f2:\n r17 = 9999999999(0x2540be3ff, double:4.940656458E-314)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x0100\n r17 = 1000000000(0x3b9aca00, double:4.94065646E-315)\n goto L_0x017e\n L_0x0100:\n r17 = 99999999999(0x174876e7ff, double:4.94065645836E-313)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x0110\n r17 = 10000000000(0x2540be400, double:4.9406564584E-314)\n goto L_0x017e\n L_0x0110:\n r17 = 999999999999(0xe8d4a50fff, double:4.940656458408E-312)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x011f\n r17 = 100000000000(0x174876e800, double:4.9406564584E-313)\n goto L_0x017e\n L_0x011f:\n r17 = 9999999999999(0x9184e729fff, double:4.940656458412E-311)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x012e\n r17 = 1000000000000(0xe8d4a51000, double:4.94065645841E-312)\n goto L_0x017e\n L_0x012e:\n r17 = 99999999999999(0x5af3107a3fff, double:4.9406564584124E-310)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x013d\n r17 = 10000000000000(0x9184e72a000, double:4.9406564584125E-311)\n goto L_0x017e\n L_0x013d:\n r17 = 999999999999999(0x38d7ea4c67fff, double:4.94065645841246E-309)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x014c\n r17 = 100000000000000(0x5af3107a4000, double:4.94065645841247E-310)\n goto L_0x017e\n L_0x014c:\n r17 = 9999999999999999(0x2386f26fc0ffff, double:5.431165199810527E-308)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x015b\n r17 = 1000000000000000(0x38d7ea4c68000, double:4.940656458412465E-309)\n goto L_0x017e\n L_0x015b:\n r17 = 99999999999999999(0x16345785d89ffff, double:5.620395787888204E-302)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x016a\n r17 = 10000000000000000(0x2386f26fc10000, double:5.431165199810528E-308)\n goto L_0x017e\n L_0x016a:\n r17 = 999999999999999999(0xde0b6b3a763ffff, double:7.832953389245684E-242)\n int r3 = (r15 > r17 ? 1 : (r15 == r17 ? 0 : -1))\n if (r3 > 0) goto L_0x0179\n r17 = 100000000000000000(0x16345785d8a0000, double:5.620395787888205E-302)\n goto L_0x017e\n L_0x0179:\n r17 = 1000000000000000000(0xde0b6b3a7640000, double:7.832953389245686E-242)\n L_0x017e:\n long r1 = r15 / r17\n int r3 = (int) r1\n switch(r3) {\n case 0: goto L_0x01b6;\n case 1: goto L_0x01af;\n case 2: goto L_0x01aa;\n case 3: goto L_0x01a5;\n case 4: goto L_0x019e;\n case 5: goto L_0x0199;\n case 6: goto L_0x0194;\n case 7: goto L_0x018f;\n case 8: goto L_0x018a;\n case 9: goto L_0x0185;\n default: goto L_0x0184;\n }\n L_0x0184:\n goto L_0x01bb\n L_0x0185:\n int r3 = r14 + 1\n r0[r14] = r5\n goto L_0x01ba\n L_0x018a:\n int r3 = r14 + 1\n r0[r14] = r8\n goto L_0x01ba\n L_0x018f:\n int r3 = r14 + 1\n r0[r14] = r9\n goto L_0x01ba\n L_0x0194:\n int r3 = r14 + 1\n r0[r14] = r4\n goto L_0x01ba\n L_0x0199:\n int r3 = r14 + 1\n r0[r14] = r7\n goto L_0x01ba\n L_0x019e:\n int r3 = r14 + 1\n r6 = 52\n r0[r14] = r6\n goto L_0x01ba\n L_0x01a5:\n int r3 = r14 + 1\n r0[r14] = r10\n goto L_0x01ba\n L_0x01aa:\n int r3 = r14 + 1\n r0[r14] = r11\n goto L_0x01ba\n L_0x01af:\n int r3 = r14 + 1\n r6 = 49\n r0[r14] = r6\n goto L_0x01ba\n L_0x01b6:\n int r3 = r14 + 1\n r0[r14] = r13\n L_0x01ba:\n r14 = r3\n L_0x01bb:\n int r3 = (r17 > r21 ? 1 : (r17 == r21 ? 0 : -1))\n if (r3 != 0) goto L_0x01c0\n goto L_0x01d8\n L_0x01c0:\n java.lang.Long.signum(r17)\n long r1 = r1 * r17\n long r15 = r15 - r1\n r1 = 0\n int r3 = (r15 > r1 ? 1 : (r15 == r1 ? 0 : -1))\n if (r3 != 0) goto L_0x01d9\n L_0x01cc:\n int r1 = (r17 > r21 ? 1 : (r17 == r21 ? 0 : -1))\n if (r1 <= 0) goto L_0x01d8\n int r1 = r14 + 1\n r0[r14] = r13\n long r17 = r17 / r19\n r14 = r1\n goto L_0x01cc\n L_0x01d8:\n return r14\n L_0x01d9:\n long r17 = r17 / r19\n goto L_0x017e\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.unboundid.util.ByteStringBuffer.getBytes(long):int\");\n }", "public static List<Integer> getIntegerList(){\n List<Integer> nums = new ArrayList<>();//ArrayList<Integer> list = new ArrayList<>();\n for(int i=0;i<=1_000_000;i++) {\n nums.add(i);\n }\n return nums;\n }", "public List<UsuarioxLibro> todoPorUsuario(int idUsuario) {\r\n Connection con = Conexion.getConnection();\r\n PreparedStatement ps;\r\n ResultSet rs;\r\n List<UsuarioxLibro> uxl = new ArrayList<>();\r\n String sql = \"select * from usuarioxlibro where idusuario =\" + idUsuario;\r\n UsuarioxLibro usli;\r\n try {\r\n ps = con.prepareStatement(sql);\r\n rs = ps.executeQuery();\r\n while (rs.next()) {\r\n usli = new UsuarioxLibro(idUsuario, rs.getInt(\"idlibro\"), rs.getDouble(\"nota\"), rs.getBoolean(\"evaluacion\"), rs.getDouble(\"puntuacion\"));\r\n uxl.add(usli);\r\n }\r\n ps.close();\r\n rs.close();\r\n con.close();\r\n } catch (Exception e) {\r\n System.out.println(e);\r\n }\r\n return uxl;\r\n }", "public void cargarProductosVendidos() {\n try {\n //Lectura de los objetos de tipo productosVendidos\n FileInputStream archivo= new FileInputStream(\"productosVendidos\"+this.getCorreo()+\".dat\");\n ObjectInputStream ruta = new ObjectInputStream(archivo);\n productosVendidos = (ArrayList) ruta.readObject();\n archivo.close();\n \n \n } catch (IOException ioe) {\n System.out.println(\"Error de IO: \" + ioe.getMessage());\n } catch (ClassNotFoundException cnfe) {\n System.out.println(\"Error de clase no encontrada: \" + cnfe.getMessage());\n } catch (Exception e) {\n System.out.println(\"Error: \" + e.getMessage());\n }\n }", "public void llenarDatosConfiguracion(){\n\n hoseEntities = new ArrayList<>();\n //**********************************************************\n\n //Capturar Nombre Host WIFI\n int[] tramaNombreEmbedded = new int[16];\n int c = 0;\n for(int i = 8; i<= 23; i++){\n tramaNombreEmbedded[c] = bufferRecepcion[i];\n c++;\n }\n\n\n //Log.v(\"NOMBRE EMBEDDED\", \"\" + hexToAscii(byteArrayToHexString(tramaNombreEmbedded,tramaNombreEmbedded.length)));\n //**********************************************************\n //Capturar MAC TABLET\n int[] tramaMACTablet= new int[6];\n c = 0;\n for(int i = 24; i<= 29; i++){\n tramaMACTablet[c] = bufferRecepcion[i];\n c++;\n }\n //Log.v(\"MAC TABLET EMBEDDED\", \"\" + hexToAscii(byteArrayToHexString(tramaMACTablet,tramaMACTablet.length)));\n\n\n //**********************************************************\n //Capturar Contraseña Red Host\n int[] contrasenaHostEmbedded = new int[11];\n c = 0;\n for(int i = 30; i<= 40; i++){\n contrasenaHostEmbedded[c] = bufferRecepcion[i];\n c++;\n }\n\n //Log.v(\"CONTRASENA RED EMBEDDED\", \"\" + hexToAscii(byteArrayToHexString(contrasenaHostEmbedded,contrasenaHostEmbedded.length)));\n\n\n //**********************************************************\n //Capturar Nro Bombas\n int[] numeroBombas = new int[1];\n numeroBombas[0] = bufferRecepcion[41];\n numBombas = Integer.parseInt(byteArrayToHexIntGeneral(numeroBombas,1));\n //**********************************************************\n //int pIinicial = 42;\n\n //obtener solo IDbombas\n int[] idBombas = new int[numBombas];\n\n int pIinicial = 42;\n for(int i = 0; i< numBombas; i++){\n idBombas[i] = bufferRecepcion[pIinicial];\n pIinicial+=1;\n }\n\n int auxIdBomba=0;\n for(int i = 0; i< numBombas; i++){\n Hose hose = new Hose();\n TransactionEntity transactionEntity = new TransactionEntity();\n transactionEntity.setEstadoRegistro(\"P\");\n //**********************************************************\n //Capturar idBomba\n int[] idBomba = new int[1];\n idBomba[0] = bufferRecepcion[pIinicial];\n auxIdBomba=Integer.parseInt((byteArrayToHexIntGeneral(idBomba,1)));\n transactionEntity.setIdBomba(auxIdBomba);\n transactionEntity.setNombreManguera(\"\"+auxIdBomba);\n hose.setHoseNumber(auxIdBomba);\n hose.setHoseName(\"\"+auxIdBomba);\n hose.setHardwareId(1);\n hose.setLastTicket(0);\n hose.setFuelQuantity(0.0);\n\n //**********************************************************\n //Capturar idProducto\n int[] idProducto = new int[1];\n idProducto[0] = bufferRecepcion[pIinicial + 1];\n transactionEntity.setIdProducto(Integer.parseInt(byteArrayToHexIntGeneral(idProducto,1)));\n //**********************************************************\n //Capturar cantidadDecimales\n int[] cantidadDecimales = new int[1];\n cantidadDecimales[0] = bufferRecepcion[pIinicial + 2];\n transactionEntity.setCantidadDecimales(Integer.parseInt(byteArrayToHexIntGeneral(cantidadDecimales,1)));\n //**********************************************************\n //Capturar nombreManguera\n int[] nombreManguera = new int[10];\n int contadorMangueraInicial = pIinicial + 3;\n int contadorMangueraFinal = contadorMangueraInicial + 9;\n int contadorIteracionesManguera = 0;\n for(int j=contadorMangueraInicial; j<=contadorMangueraFinal; j++){\n nombreManguera[contadorIteracionesManguera] = bufferRecepcion[j];\n contadorIteracionesManguera ++;\n }\n //transactionEntity.setNombreManguera(hexToAscii(byteArrayToHexString(nombreManguera,nombreManguera.length)));\n Log.v(\"Nombre Manguera\", hexToAscii(byteArrayToHexString(nombreManguera,nombreManguera.length)));\n\n //Capturar nombreProducto\n int[] nombreProducto = new int[10];\n int contadorProductoInicial = pIinicial + 13;\n int contadorProductoFinal = contadorProductoInicial + 9;\n int contadorIteracionesProducto = 0;\n for(int k=contadorProductoInicial; k<=contadorProductoFinal; k++){\n nombreProducto[contadorIteracionesProducto] = bufferRecepcion[k];\n contadorIteracionesProducto ++;\n }\n transactionEntity.setNombreProducto(hexToAscii(byteArrayToHexString(nombreProducto,nombreProducto.length)));\n Log.v(\"Nombre Producto\",hexToAscii(byteArrayToHexString(nombreProducto,nombreProducto.length)));\n hose.setNameProduct(hexToAscii(byteArrayToHexString(nombreProducto,nombreProducto.length)));\n\n hoseEntities.add(transactionEntity);\n hoseMasters.add(hose);\n pIinicial = pIinicial + 23;\n }\n\n }", "public static void Auslesen()\r\n\t{\n\t\tLargeObjectManager lobj;\r\n\t\ttry {\r\n\t\t\tconn= DriverManager.getConnection(DB_URL,USER,PASS);\r\n\t\t\tlobj = ((org.postgresql.PGConnection)conn).getLargeObjectAPI();\r\n\t\t\tPreparedStatement ps = conn.prepareStatement(\"SELECT bild FROM bilder WHERE bild = ?\");\r\n\t\t\tps.setString(1, \"bild2.jpg\");\r\n\t\t\tResultSet rs = ps.executeQuery();\r\n\t\t\twhile (rs.next()) {\r\n\t\t\t // Open the large object for reading\r\n\t\t\t\tString name = rs.getString(1);\r\n\t\t\t int oid = rs.getInt(2);\r\n\t\t\t LargeObject obj = lobj.open(oid, LargeObjectManager.READ);\r\n\r\n\t\t\t // Read the data\r\n\t\t\t byte buf[] = new byte[obj.size()];\r\n\t\t\t obj.read(buf, 0, obj.size());\r\n\t\t\t // Do something with the data read here\r\n\t\t\t \r\n\t\t\t String pfad = \"C:/Temp\";\r\n\t\t\t\tFile file = createFile(pfad, \"bild2.jpg\");\r\n\t\t\t\tFiles.copy(obj.getInputStream(), file.toPath());\r\n\t\t\t\r\n\t\t\t \r\n\t\t\t // Close the object\r\n\t\t\t obj.close();\r\n\t\t\t}\r\n\t\t\trs.close();\r\n\t\t\tps.close();\r\n\t\t} catch (SQLException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\r\n\t\t\r\n\t}", "@Test(timeout = 4000)\n public void test21() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n XSQLVAR[] xSQLVARArray0 = new XSQLVAR[0];\n FBResultSet fBResultSet0 = new FBResultSet(xSQLVARArray0, linkedList0);\n byte[][] byteArray0 = new byte[7][0];\n byte[] byteArray1 = new byte[7];\n byteArray1[0] = (byte) (-111);\n linkedList0.add(byteArray0);\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, fBResultSet0);\n FileSystemHandling.shouldAllThrowIOExceptions();\n fBCachedFetcher0.insertRow(byteArray0);\n fBCachedFetcher0.insertRow(fBResultSet0.row);\n assertFalse(fBCachedFetcher0.isBeforeFirst());\n }", "private String[] concatenaArquivos(File ordem) throws Exception\n\t{\n\t\t// Cria referencia para os arquivos que serao retornados\n\t\t// apos o processamento\n\t\tCollection arquivosAposConcatenacao = new LinkedList();\n\t\t\n\t\t// Busca o objeto VoucherOrdem contendo os dados da ordem\n\t\t// que foram lidos a partir do arquivo cabecalho da ordem\n\t\tArquivoPedidoVoucherParser ordemParser = new ArquivoPedidoVoucherParser();\n\t\tVoucherOrdem ordemVoucher = ordemParser.parse(ordem);\n\t\t\n\t\t// Busca agora todas os nomes de arquivos de caixa\n\t\t// existentes gravados tambem no arquivo cabecalho\n\t\tString arquivosCaixa[] = getNomeArquivosCaixa(ordem);\n\t\tString dirOrigem = getPropriedade(\"ordemVoucher.dirArquivos\");\n\t\t\t\t\n\t\t// Faz a iteracao nos itens da ordem para entao criar um arquivo \n\t\t// para cada item no formato PrintOrder#[NUMORDEM]_[NUMITEM].dat\n\t\t// e para cada item entao identifica quais arquivos serao concatenados\n\t\tint realNumItem \t\t= 1;\n\t\tlong qtdeSomaCartoes \t= 0;\n\t\tboolean deveConcatenar \t= true;\n\t\tfor (Iterator i=ordemVoucher.getItensOrdem().iterator(); i.hasNext();)\n\t\t{\n\t\t\tVoucherOrdemItem itemOrdem = (VoucherOrdemItem)i.next();\n\t\t\t// O numero do item no sistema GPP comeca a partir do numero zero (0)\n\t\t\t// portanto como na Tecnomen e criado com item 1 o valor e decrescido de um\n\t\t\tlong qtdCartoes = procBatchPOA.getQtdeCartoes(ordemVoucher.getNumeroOrdem(),realNumItem-1);//(int)itemOrdem.getNumItem()-1);\n\t\t\tqtdeSomaCartoes += itemOrdem.getQtdeCartoes();\n\t\t\tif (qtdCartoes != 0 && deveConcatenar)\n\t\t\t{\n\t\t\t\titemOrdem.setQtdeCartoes( qtdCartoes );\n\t\t\t\tFile arquivoItem = new File(getNomeArquivoItem(ordem,realNumItem));//itemOrdem.getNumItem()));\n\t\t\t\tFileOutputStream itemStream = new FileOutputStream(arquivoItem);\n\t\t\t\tif (itemStream != null)\n\t\t\t\t{\n\t\t\t\t\t// Identifica quais sao os arquivos que devem ser concatenados\n\t\t\t\t\t// para este item. Para cada arquivo encontrado , este e lido\n\t\t\t\t\t// e entao concatenado ao arquivo do item que foi criado\n\t\t\t\t\tString caixasDoItem[] = getArquivosCaixaPorItem(ordemVoucher,itemOrdem,arquivosCaixa);\n\t\t\t\t\t// Atualiza informacoes de numeracao de lote do pedido no GPP\n\t\t\t\t\tatualizaNumeracaoLote(ordemVoucher.getNumeroOrdem(),realNumItem,caixasDoItem);//itemOrdem.getNumItem(),caixasDoItem);\n\t\t\t\t\tfor (int j=0; j < caixasDoItem.length; j++)\n\t\t\t\t\t\titemStream.write(getStreamArquivo(new File(dirOrigem+\n\t\t\t\t\t\t System.getProperty(\"file.separator\")+\n\t\t\t\t\t\t caixasDoItem[j])));\n\t\n\t\t\t\t\titemStream.close();\n\t\t\t\t\tarquivosAposConcatenacao.add(arquivoItem.getAbsolutePath());\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t\titemOrdem.setQtdeCartoes(0);\n\n\t\t\tdeveConcatenar = (qtdCartoes == qtdeSomaCartoes);\n\t\t\tif (qtdCartoes == qtdeSomaCartoes)\n\t\t\t{\n\t\t\t\tqtdeSomaCartoes = 0;\n\t\t\t\trealNumItem++;\n\t\t\t}\n\t\t}\n\t\treturn (String[])arquivosAposConcatenacao.toArray(new String[0]);\n\t}", "public static List<PolovniAutomobili> readAll() {\n List<PolovniAutomobili> listaUsera = new ArrayList<>();\n try {\n CONNECTION = DriverManager.getConnection(URL, USERNAME, PASSWORD);\n String query = \"SELECT * FROM polovni WHERE 1\";\n try (Statement st = (Statement) CONNECTION.createStatement()) {\n ResultSet rs = st.executeQuery(query);\n while (rs.next()) {\n String imgUrl = rs.getString(\"imgUrl\");\n String naziv = rs.getString(\"naziv\");\n int godiste = rs.getInt(\"godiste\");\n int cena = rs.getInt(\"cena\");\n String url = rs.getString(\"url\");\n listaUsera.add(new PolovniAutomobili(imgUrl, naziv, godiste,cena,url));\n }\n }\n CONNECTION.close();\n } catch (SQLException ex) {\n System.out.println(\"MySql Connection error...\");\n ex.printStackTrace();\n }\n return listaUsera;\n }", "@Test\r\n public void teamListTooLargeTest(){\r\n int tooBigListSize = 15;\r\n\r\n int expectedResult = extractor.extractXDriversOrTeams(tooBigListSize, \"table.msr_season_team_results\", \"td.msr_team\").size();\r\n\r\n assertEquals(\"expected results = \" + expectedResult, expectedResult, extractor.extractXDriversOrTeams(tooBigListSize, \"table.msr_season_team_results\", \"td.msr_team\").size());\r\n System.out.println(\"\");\r\n }", "public static List<StronaWiersza> pobierzStronaWierszazBazy(StronaWiersza stronaWiersza, String wnma, StronaWierszaDAO stronaWierszaDAO, TransakcjaDAO transakcjaDAO) {\r\n List<StronaWiersza> listaStronaWierszazBazy =new ArrayList<>();\r\n// stare = pobiera tylko w walucie dokumentu rozliczeniowego \r\n// listaNowychRozrachunkow = stronaWierszaDAO.findStronaByKontoWnMaWaluta(stronaWiersza.getKonto(), stronaWiersza.getWiersz().getTabelanbp().getWaluta().getSymbolwaluty(), stronaWiersza.getWnma());\r\n// nowe pobiera wszystkie waluty \r\n listaStronaWierszazBazy = stronaWierszaDAO.findStronaByKontoWnMa(stronaWiersza.getKonto(), wnma);\r\n //stronaWierszaDAO.refresh(listaStronaWierszazBazy);\r\n if (listaStronaWierszazBazy != null && !listaStronaWierszazBazy.isEmpty()) {\r\n try {\r\n DateFormat formatter;\r\n formatter = new SimpleDateFormat(\"yyyy-MM-dd\");\r\n String datarozrachunku = null;\r\n if (stronaWiersza.getWiersz().getDataWalutyWiersza() != null) {\r\n datarozrachunku = stronaWiersza.getWiersz().getDokfk().getRok()+\"-\"+stronaWiersza.getWiersz().getDokfk().getMiesiac()+\"-\"+stronaWiersza.getWiersz().getDataWalutyWiersza();\r\n } else {\r\n datarozrachunku = stronaWiersza.getWiersz().getDokfk().getDatadokumentu();\r\n }\r\n Date dataR = formatter.parse(datarozrachunku);\r\n Iterator it = listaStronaWierszazBazy.iterator();\r\n while(it.hasNext()) {\r\n StronaWiersza stronaWierszaZbazy = (StronaWiersza) it.next();\r\n List<Transakcja> zachowaneTransakcje = transakcjaDAO.findByNowaTransakcja(stronaWierszaZbazy);\r\n for (Iterator<Transakcja> itx = stronaWierszaZbazy.getPlatnosci().iterator(); itx.hasNext();) {\r\n Transakcja transakcjazbazy = (Transakcja) itx.next();\r\n if (zachowaneTransakcje == null || zachowaneTransakcje.size() == 0) {\r\n itx.remove();\r\n } else if (!zachowaneTransakcje.contains(transakcjazbazy)) {\r\n itx.remove();\r\n }\r\n }\r\n for (Transakcja ta : zachowaneTransakcje) {\r\n if (!stronaWierszaZbazy.getPlatnosci().contains(ta)) {\r\n stronaWierszaZbazy.getPlatnosci().add(ta);\r\n }\r\n }\r\n if (Z.z(stronaWierszaZbazy.getPozostalo()) <= 0.0) {\r\n it.remove();\r\n } else {\r\n String dataplatnosci;\r\n if (stronaWierszaZbazy.getWiersz().getDataWalutyWiersza() != null) {\r\n dataplatnosci = stronaWierszaZbazy.getWiersz().getDokfk().getRok()+\"-\"+stronaWierszaZbazy.getWiersz().getDokfk().getMiesiac()+\"-\"+stronaWierszaZbazy.getWiersz().getDataWalutyWiersza();\r\n } else {\r\n dataplatnosci = stronaWierszaZbazy.getWiersz().getDokfk().getDatadokumentu();\r\n }\r\n Date dataP = formatter.parse(dataplatnosci);\r\n if (dataP.compareTo(dataR) > 0) {\r\n it.remove();\r\n }\r\n }\r\n }\r\n } catch (ParseException ex) {\r\n E.e(ex);\r\n }\r\n }\r\n List<StronaWiersza> stronywierszaBO = stronaWierszaDAO.findStronaByKontoWnMaBO(stronaWiersza.getKonto(), stronaWiersza.getWnma());\r\n if (stronywierszaBO != null && !stronywierszaBO.isEmpty()) {\r\n Iterator it = stronywierszaBO.iterator();\r\n while(it.hasNext()) {\r\n StronaWiersza p = (StronaWiersza) it.next();\r\n if (Z.z(p.getPozostalo()) <= 0.0) {\r\n it.remove();\r\n }\r\n }\r\n listaStronaWierszazBazy.addAll(stronywierszaBO);\r\n }\r\n if (listaStronaWierszazBazy == null) {\r\n return (new ArrayList<>());\r\n }\r\n return listaStronaWierszazBazy;\r\n //pobrano wiersze - a teraz z nich robie rozrachunki\r\n }", "List<ParqueaderoEntidad> listar();", "public static List getAllImgs() {\n List polovniautomobili = new ArrayList<>();\n try {\n CONNECTION = DriverManager.getConnection(URL, USERNAME, PASSWORD);\n String query = \"SELECT imgUrl FROM polovni\";\n try (PreparedStatement ps = CONNECTION.prepareStatement(query)) {\n ResultSet result = ps.executeQuery();\n while (result.next()) {\n String imgUrl = result.getString(\"imgUrl\");\n polovniautomobili.add(imgUrl);\n }\n\n ps.close();\n CONNECTION.close();\n }\n CONNECTION.close();\n } catch (SQLException ex) {\n Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);\n }\n return polovniautomobili;\n }", "public Vector listaAsignaturasTotal(String nombre_titulacion)\n {\n try\n { \n //Se obtiene una conexion\n Connection conexion = this.bbdd.getConexion();\n\n //Se prepara la query\n String query = \"SELECT * FROM asignaturatotal \";\n query += \"WHERE tit_nombre='\"+nombre_titulacion+\"' AND activa = 's'\";\n\n //Se crea un vector de asignaturas\n Vector vectorAsignaturas = new Vector();\n\n //Se ejecuta la query\n Statement st = conexion.createStatement();\n ResultSet resultado = st.executeQuery(query);\n\n //Para cada fila se creará un objeto y se rellenará\n //con los valores de las columnas.\n while(resultado.next())\n {\n asignatura asignatura = new asignatura();\n\n asignatura.setCodigo(resultado.getString(\"codigo\"));\n asignatura.setTitulo(resultado.getString(\"titulo\"));\n asignatura.setFechaInicio(resultado.getDate(\"fechainicio\"));\n asignatura.setFechaFin(resultado.getDate(\"fechafin\"));\n asignatura.setResponsable(resultado.getString(\"responsable\"));\n asignatura.setEmail(resultado.getString(\"email\"));\n asignatura.setTelefono(resultado.getString(\"telefono\"));\n\n //Se añade la asignatura al vector de asignaturas\n vectorAsignaturas.add(asignatura);\n }\n\n //Se cierra la conexión\n this.bbdd.cerrarConexion(conexion);\n\n return vectorAsignaturas;\n }\n catch(SQLException e)\n {\n System.out.println(\"Error al acceder a las asignaturas de la Base de Datos: \"+e.getMessage());\n return null;\n }\n }", "@Test\n\tpublic void testGetLista() throws Exception {\n\t\tSystem.out.println(\"getLista\");\n\t\tso.execute(entity);\n\t\tList<IGeneralEntity> expResult = ((TakeTrucksOperation) so).getLista();\n\t\tList<IGeneralEntity> result = so.db.vratiSve(entity);\n\n\t\tassertEquals(expResult.size(), result.size());\n\t}", "@SuppressWarnings(\"PMD.ExcessiveMethodLength\")\r\n\tprivate void gerarLaudosUTI(MpmPrescricaoMedica prescricao,\r\n\t\t\tList<MpmLaudo> laudoList, FatConvenioSaudePlano convenioSaudePlano,\r\n\t\t\tAghParametros seqLaudoUTI) {\r\n\r\n\t\tIAghuFacade aghuFacade = getAghuFacade();\r\n\t\tif (prescricao.getAtendimento().getUnidadeFuncional() != null) {\r\n\t\t\t// TODO: RETIRAR ESTE MERGE QUANDO AS EXCEPTIONS COM ROLLBACK DOS\r\n\t\t\t// CRUDS DA PRESCRIÇÃO JÁ TIVEREM\r\n\t\t\t// SIDO REMOVIDAS.\r\n\t\t\taghuFacade.atualizarAghUnidadesFuncionaisSemException(prescricao.getAtendimento().getUnidadeFuncional());\r\n\t\t}\r\n\r\n\t\tboolean possuiCaracteristica = aghuFacade.possuiCaracteristicaPorUnidadeEConstante(prescricao.getAtendimento().getUnidadeFuncional().getSeq(),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tConstanteAghCaractUnidFuncionais.LAUDO_CTI);\r\n\t\tif (possuiCaracteristica) {\r\n\r\n\t\t\tShort tempoValidade = this.getMpmTipoLaudoConvenioDAO()\r\n\t\t\t\t\t.obterTempoValidadeTipoLaudo(\r\n\t\t\t\t\t\t\tseqLaudoUTI.getVlrNumerico().shortValue(),\r\n\t\t\t\t\t\t\tconvenioSaudePlano);\r\n\r\n\t\t\tif (tempoValidade != null) {\r\n\r\n\t\t\t\tboolean acheiLaudoValido = false;\r\n\r\n\t\t\t\tMpmTipoLaudo tipoLaudoUTI = this.getMpmTipoLaudoDAO()\r\n\t\t\t\t\t\t.obterPorChavePrimaria(\r\n\t\t\t\t\t\t\t\tseqLaudoUTI.getVlrNumerico().shortValue());\r\n\r\n\t\t\t\tList<MpmLaudo> laudos = this.getMpmLaudoDAO()\r\n\t\t\t\t\t\t.listarLaudosPorAtendimentoETipo(\r\n\t\t\t\t\t\t\t\tprescricao.getAtendimento(), tipoLaudoUTI,\r\n\t\t\t\t\t\t\t\tprescricao.getDthrInicio());\r\n\r\n\t\t\t\tString justificativa = null;\r\n\t\t\t\tShort duracaoTratamentoSolicitado = null;\r\n\r\n\t\t\t\tfor (MpmLaudo laudo : laudos) {\r\n\t\t\t\t\tDate dataTeste = DateUtil.adicionaDias(laudo\r\n\t\t\t\t\t\t\t.getDthrInicioValidade(), tempoValidade - 1);\r\n\r\n\t\t\t\t\tif (DateUtil.validaDataTruncadaMaiorIgual(dataTeste,\r\n\t\t\t\t\t\t\tprescricao.getDthrInicio())\r\n\t\t\t\t\t\t\t&& laudo.getDthrFimValidade() == null) {\r\n\r\n\t\t\t\t\t\tacheiLaudoValido = true;\r\n\r\n\t\t\t\t\t} else if (laudo.getDthrFimValidade() != null\r\n\t\t\t\t\t\t\t&& DateUtil.entreTruncado(prescricao\r\n\t\t\t\t\t\t\t\t\t.getDthrInicio(), laudo\r\n\t\t\t\t\t\t\t\t\t.getDthrInicioValidade(), laudo\r\n\t\t\t\t\t\t\t\t\t.getDthrFimValidade())) {\r\n\r\n\t\t\t\t\t\tacheiLaudoValido = true;\r\n\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (laudo.getDthrFimValidade() == null) {\r\n\t\t\t\t\t\t\tlaudo.setDthrFimValidade(DateUtil.adicionaDias(\r\n\t\t\t\t\t\t\t\t\tlaudo.getDthrInicioValidade(),\r\n\t\t\t\t\t\t\t\t\ttempoValidade - 1));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tjustificativa = laudo.getJustificativa();\r\n\t\t\t\t\tduracaoTratamentoSolicitado = laudo\r\n\t\t\t\t\t\t\t.getDuracaoTratSolicitado();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!acheiLaudoValido) {\r\n\r\n\t\t\t\t\tShort maximaDiariaUTI = null;\r\n\r\n\t\t\t\t\tif (prescricao.getAtendimento().getInternacao() != null) {\r\n\t\t\t\t\t\tmaximaDiariaUTI = prescricao.getAtendimento()\r\n\t\t\t\t\t\t\t\t.getInternacao()\r\n\t\t\t\t\t\t\t\t.getItemProcedimentoHospitalar()\r\n\t\t\t\t\t\t\t\t.getMaxDiariaUti();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (maximaDiariaUTI == null || maximaDiariaUTI > 0) {\r\n\t\t\t\t\t\tMpmLaudo laudo = new MpmLaudo();\r\n\t\t\t\t\t\tlaudo.setDthrInicioValidade(prescricao.getDthrInicio());\r\n\t\t\t\t\t\tlaudo.setDthrFimValidade(DateUtil.adicionaDias(laudo\r\n\t\t\t\t\t\t\t\t.getDthrInicioValidade(), tempoValidade - 1));\r\n\t\t\t\t\t\tlaudo.setDthrFimPrevisao(DateUtil.adicionaDias(laudo\r\n\t\t\t\t\t\t\t\t.getDthrInicioValidade(), tempoValidade - 1));\r\n\t\t\t\t\t\tlaudo.setJustificativa(justificativa);\r\n\t\t\t\t\t\tlaudo.setContaDesdobrada(false);\r\n\t\t\t\t\t\tlaudo.setImpresso(false);\r\n\t\t\t\t\t\tlaudo\r\n\t\t\t\t\t\t\t\t.setDuracaoTratSolicitado(duracaoTratamentoSolicitado);\r\n\t\t\t\t\t\tlaudo.setLaudoManual(false);\r\n\t\t\t\t\t\tlaudo.setAtendimento(prescricao.getAtendimento());\r\n\t\t\t\t\t\tlaudo.setTipoLaudo(tipoLaudoUTI);\r\n\t\t\t\t\t\tlaudoList.add(laudo);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public ArrayList<Comobox> fontesRendimentos()\n {\n @SuppressWarnings(\"MismatchedQueryAndUpdateOfCollection\")\n ArrayList<Comobox> al= new ArrayList<>();\n @SuppressWarnings(\"UnusedAssignment\")\n ResultSet rs = null;\n sql=\"select * FROM VER_FONTEPAGAMENTO\";\n Conexao conexao = new Conexao();\n if(conexao.getCon()!=null)\n {\n try \n {\n cs = conexao.getCon().prepareCall(sql);\n cs.execute();\n rs=cs.executeQuery(); \n if (rs!=null) \n { \n while (rs.next())\n { \n al.add(new Comobox(rs.getString(\"REALID\"), rs.getString(\"FONTE\")));\n } \n }\n rs.close();\n } \n catch (SQLException ex)\n {\n Logger.getLogger(CreditoDao.class.getName()).log(Level.SEVERE, null, ex);\n System.out.println(\"Erro a obter fontes rendimentos \"+ex.getMessage());\n }\n }\n return al;\n }", "public static void shufleArray(ArrayList<Number> list) {\r\n\t\tfor (int i = 0; i < list.size(); i++) {\r\n\t\t\t// generisemo prvi indeks.\r\n\t\t\tint indx1 = (int) (Math.random() * list.size());\r\n\t\t\t// generisemo drugi index.\r\n\t\t\tint indx2 = (int) (Math.random() * list.size());\r\n\t\t\t// cuvamo elemenat sa prvog indeksa.\r\n\t\t\tNumber temp = list.get(indx1);\r\n\t\t\t// Kopiramo elemenat sa drugog indeksa preko prvog elementa.\r\n\t\t\tlist.set(indx1, list.get(indx2));\r\n\t\t\t// Kopiramo temp (prvi elemenat) preko drugog elementa.\r\n\t\t\tlist.set(indx2, temp);\r\n\t\t}\r\n\t}", "private static List<Integer> initLista(int tamanho) {\r\n\t\tList<Integer> lista = new ArrayList<Integer>();\r\n\t\tRandom rand = new Random();\r\n\r\n\t\tfor (int i = 0; i < tamanho; i++) {\r\n\t\t\tlista.add(rand.nextInt(tamanho - (tamanho / 10) + 1)\r\n\t\t\t\t\t+ (tamanho / 10));\r\n\t\t}\r\n\t\treturn lista;\r\n\t}", "List<Plaza> consultarPlazas();", "public void cargarProductosEnVenta() {\n try {\n //Lectura de los objetos de tipo producto Vendido\n FileInputStream archivo= new FileInputStream(\"productosVentaCliente\"+this.getCorreo()+\".dat\");\n ObjectInputStream ruta = new ObjectInputStream(archivo);\n this.productosEnVenta = (ArrayList) ruta.readObject();\n archivo.close();\n \n \n } catch (IOException ioe) {\n System.out.println(\"ERROR: \" + ioe.getMessage());\n } catch (ClassNotFoundException cnfe) {\n System.out.println(\"ERROR: \" + cnfe.getMessage());\n } catch (Exception e) {\n System.out.println(\"ERROR: \" + e.getMessage());\n }\n }", "public List<Usuario> todosLosUsuarios() throws SQLException {\n PreparedStatement preSt = connection.prepareStatement(USUARIOS);\n ResultSet result = preSt.executeQuery();\n\n List<Usuario> usuario = new LinkedList<>();\n\n while (result.next()) {\n usuario.add(new Usuario(\n result.getInt(Usuario.USUARIO_ID_DB_NAME),\n result.getString(Usuario.NOMBRE_DB_NAME),\n result.getString(Usuario.PROFESION_DB_NAME),\n result.getString(Usuario.PASSWORD_DB_NAME)\n ));\n }\n System.out.println(\"Usuarios: \" + usuario.size());\n return usuario;\n }", "void mo54414a(int i, List<DownloadChunk> list);", "public void listarCarpetas() {\n\t\tFile ruta = new File(\"C:\" + File.separator + \"Users\" + File.separator + \"ram\" + File.separator + \"Desktop\" + File.separator+\"leyendo_creando\");\n\t\t\n\t\t\n\t\tSystem.out.println(ruta.getAbsolutePath());\n\t\t\n\t\tString[] nombre_archivos = ruta.list();\n\t\t\n\t\tfor (int i=0; i<nombre_archivos.length;i++) {\n\t\t\t\n\t\t\tSystem.out.println(nombre_archivos[i]);\n\t\t\t\n\t\t\tFile f = new File (ruta.getAbsoluteFile(), nombre_archivos[i]);//SE ALMACENA LA RUTA ABSOLUTA DE LOS ARCHIVOS QUE HAY DENTRO DE LA CARPTEA\n\t\t\t\n\t\t\tif(f.isDirectory()) {\n\t\t\t\tString[] archivos_subcarpeta = f.list();\n\t\t\t\tfor (int j=0; j<archivos_subcarpeta.length;j++) {\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println(archivos_subcarpeta[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}", "private int[] enquadramentoInsercaoDeBits(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Insercao de Bits]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Insercao de Bits]\\n\");\n Thread.sleep(velocidade);\n\n //Byte Flag que contem a sequencia de bits \"0111110\"\n final int byteFlag = 126;//00000000 00000000 00000000 01111110\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\t[Bits de Flag [01111110] = 126]\\n\\n\");\n Thread.sleep(velocidade);\n\n String auxiliar = \"\";\n Boolean SE = true;\n\n for (int inteiro : quadro) {\n //System.out.println(\"Quadro\");\n int quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(inteiro);\n ManipuladorDeBit.imprimirBits(inteiro);\n //System.out.println(\"Bits deslocados\");\n inteiro = ManipuladorDeBit.deslocarBits(inteiro);\n ManipuladorDeBit.imprimirBits(inteiro);\n int inteiroByte = ManipuladorDeBit.getPrimeiroByte(inteiro);\n\n if (inteiroByte == byteFlag) {//Inicio do Quadro\n SE = !SE;//Iniciar a Busca pelo Byte de Fim de Quadro\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n quantidadeByte--;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\tIC [\" + inteiroByte + \"] \");\n }\n\n if (!SE) {\n\n ManipuladorDeBit.imprimirBits(inteiro);\n\n for (int i=1; i<=quantidadeByte; i++) {\n int dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n System.out.println(\"asdfasdf\\n\");\n ManipuladorDeBit.imprimirBits(dado);\n\n if (dado == byteFlag) {//Verificando se encontrou o Byte de Flag\n SE = !SE;//Encontrou o Byte de Fim de Quadro\n } else {\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [ \");\n\n int novoQuadro = 0;\n\n Boolean cincoBits1 = ManipuladorDeBit.cincoBitsSequenciais(dado,1);\n if (cincoBits1) {\n\n dado = ManipuladorDeBit.deslocarBits(dado);\n ManipuladorDeBit.imprimirBits(dado);\n\n //Cria um inteiro com 1 no bit mais a esquerda e 0s em outros locais\n int displayMask = 1 << 31;//10000000 00000000 00000000 00000000\n //Para cada bit exibe 0 ou 1\n for (int b=1, cont=0; b<=8; b++) {\n //Utiliza displayMask para isolar o bit\n int bit = (dado & displayMask) == 0 ? 0 : 1;\n\n if (cont == 5) {\n cont = 0;//Zerando o contador\n dado <<= 1;//Desloca 1 bit para a esquerda\n bit = (dado & displayMask) == 0 ? 0 : 1;\n }\n\n if (b == 8) {//Quando chegar no Ultimo Bit\n inteiro <<= 8;//Deslocando 8 bits para esquerda\n dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n dado = ManipuladorDeBit.deslocarBits(dado);\n ManipuladorDeBit.imprimirBits(dado);\n\n novoQuadro <<= 1;//Deslocando 1 bit para a esquerda\n novoQuadro |= ManipuladorDeBit.pegarBitNaPosicao(dado,1);//Adicionando o bit ao novoDado\n\n ManipuladorDeBit.imprimirBits(novoQuadro);\n\n auxiliar += (char) novoQuadro;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(novoQuadro + \" ]\\n\");\n Thread.sleep(velocidade);\n i++;\n\n } else {//Colocando o Bit no novoQuadro\n novoQuadro <<= 1;//Deslocando 1 bit para a esquerda\n novoQuadro |= bit;//Adicionando o bit ao novoDado\n dado <<= 1;//Desloca 1 bit para a esquerda\n }\n\n if (bit == 1) {//Quando for um bit 1\n cont++;\n } else {//Caso vinher um bit 0\n cont = 0;\n }\n }\n\n } else {//Caso nao tem uma sequencia de 5 Bits 1's\n auxiliar += (char) dado;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(dado + \" ]\\n\");\n Thread.sleep(velocidade);\n }\n }\n \n inteiro <<= 8;//Deslocando 8 bits para a esquerda;\n }\n\n }\n }\n\n //Novo Quadro de Carga Util\n int[] quadroDesenquadrado = new int[auxiliar.length()];\n //Adicionando as informacoes de Carga Util no QuadroDesenquadrado\n for (int i=0; i<auxiliar.length(); i++) {\n quadroDesenquadrado[i] = (int) auxiliar.charAt(i);\n ManipuladorDeBit.imprimirBits(quadroDesenquadrado[i]);\n }\n\n return quadroDesenquadrado;\n }", "public static void main(String[] args) {\n float[] fb=new float[9];\n fb[0]=(int)12;\n fb[1]=(byte)13;\n fb[2]=(short)8;\n fb[3]=12.021f;\n // fb[4]=23443.43d;\n// fb[4]='a';\n// for(int i=0;i<=4;i++) {\n// \t System.out.println(fb[i]);\n// }\n List<Integer> lis1=new ArrayList<>();\n List<Integer> lis2=new ArrayList<>();\n lis1.add(2);\n lis1.add(4);\n lis1.add(16);\n lis1.add(32);\n lis1.add(96);\n lis1.add(123);\n lis1.add(435);\n lis1.add(234);\n lis1.add(100);\n lis1.add(122);\n lis1.add(240);\n lis1.add(350);\n java.util.Iterator<Integer> itr= lis1.iterator();\n //while(itr.hasNext()) {\n // itr.remove();\n \t System.out.println(itr.next());\n \t System.out.println(itr.next());\n \t System.out.println(itr.next());\n \t System.out.println(itr.next());\n\n \t System.out.println(itr.next());\n \t System.out.println(itr.next());\n \t System.out.println(itr.next());\n\n \t System.out.println(lis1);\n // \n// long startTime = System.currentTimeMillis();\n// getTotalX(lis1,lis2);\n// System.out.println(\"Time taken by 2 * o(n^2) \" + (System.currentTimeMillis() - startTime) + \"ms\"); \n// \n \t\t \n\t}", "@Test\n public void testContinguosStorageReSize() {\n for (int i = 9; i >= 0; i--) {\n String input = String.format(\"b0%d\", i);\n list.addToFront(input);\n }\n\n list.addToFront(\"Filler1\");\n list.addToBack(\"Filler2\");\n list.addToBack(\"Filler3\");\n list.addToFront(\"Filler0\");\n list.addAtIndex(0, \"Filler#\");\n list.addAtIndex(2, \"Filler!\");\n list.addAtIndex(6, \"Filler$\");\n list.removeFromFront();\n list.removeFromBack();\n list.removeAtIndex(4);\n list.removeAtIndex(0);\n list.removeAtIndex(2);\n\n int actualCapacity = ((Object[]) (list.getBackingArray())).length;\n for (int i = 0; i < list.size(); i++) {\n Assert.assertNotNull(((Object[]) (list.getBackingArray()))[i]);\n }\n for (int i = list.size(); i < actualCapacity; i++) {\n Assert.assertNull(((Object[]) (list.getBackingArray()))[i]);\n }\n }", "public static void CrearListaDeOleadasPorNivel(LinkedList<LinkedList<Enemigo>> Enemigos, int NumeroDeNivel, LinkedList<LinkedList<Posicion>> ListaDeEstelas, double Velocidad) {\n\t\tRandom aleatorio = new Random();\n\t\tint oleada = 1;\n\n\t\t// Genera un numero Random de enemigos para cada nivel de 12 a 17\n\t\tInteger numeroDeEnemigosPorNivel = (12 + aleatorio.nextInt(6));\n\n\t\t// Adentro de este loop se agregan todos los enemigos a la lista Enemigos\n\t\twhile (numeroDeEnemigosPorNivel > 0) {\n\t\t\toleada++;\n\t\t\t// oleadaEnemigos es una oleada\n\t\t\tLinkedList<Enemigo> oleadaEnemigos = new LinkedList<Enemigo>();\n\n\t\t\t// Genera Un numero Random de enemigos para cada oleada de 0 a 4\n\t\t\tint numeroDeEnemigosPorOleada = (aleatorio.nextInt(5));\n\t\t\tfor (int i = numeroDeEnemigosPorOleada; i != 0; i--) {\n\n\t\t\t\t/* Genera Un numero Random de enemigos para cada oleada de 0 a 4 */\n\t\t\t\tMisilBalistico MB = new MisilBalistico(Velocidad);\n\t\t\t\tMB.determinarDesplazamiento(Velocidad);\n\t\t\t\tListaDeEstelas.add(MB.getEstela().getListaDeEstelas());\n\t\t\t\toleadaEnemigos.add(MB);\n\t\t\t\tnumeroDeEnemigosPorNivel--;\n\t\t\t}\n\n\t\t\t// En todos los niveles se van a agregar los Misil Cruceros Inteligentes y los\n\t\t\t// Misil cruceros apartir de la oleada 4\n\t\t\tif ((oleada == 4)){\n\t\t\t\tif (VectorDeMisilesCrucerosPorNivel[NumeroDeNivel]) {\n\t\t\t\t\tMisilCruceroInteligente MCI = new MisilCruceroInteligente(Velocidad);\n\t\t\t\t\toleadaEnemigos.add(MCI);\n\t\t\t\t} else {\n\t\t\t\t\tMisilCrucero MC = new MisilCrucero(Velocidad);\n\t\t\t\t\toleadaEnemigos.add(MC);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Se agregan a la oleada de enemigos 2 bombarderos por nivel, siendo\n\t\t\t * aleatoriamente seleccionado si es un Satelite o un Avion utilizando un random\n\t\t\t * que devuelva 0 o 1 para determinar que bombardero sera el que se agregue a la\n\t\t\t * oleada\n\t\t\t */\n\n\t\t\tif ((oleada == 3) || (oleada == 7)) {\n\t\t\t\tint numeroDeBombarderosPorOleada = (aleatorio.nextInt(2));\n\t\t\t\tif (numeroDeBombarderosPorOleada == 1) {\n\t\t\t\t\tAvion A = new Avion();\n\t\t\t\t\toleadaEnemigos.add(A);\n\t\t\t\t} else {\n\t\t\t\t\tSatelite S = new Satelite();\n\t\t\t\t\toleadaEnemigos.add(S);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Agrego la oleada a la lista de oleadas\n\t\t\tEnemigos.add(oleadaEnemigos);\n\t\t}\n\n\t}", "List<C1700ar> mo7233f();", "@Test(timeout = 4000)\n public void test04() throws Throwable {\n LinkedList<byte[][]> linkedList0 = new LinkedList<byte[][]>();\n FBCachedFetcher fBCachedFetcher0 = new FBCachedFetcher(linkedList0, (FBObjectListener.FetcherListener) null);\n FileSystemHandling.shouldAllThrowIOExceptions();\n byte[][] byteArray0 = new byte[2][2];\n byte[] byteArray1 = new byte[0];\n byteArray0[0] = byteArray1;\n byte[] byteArray2 = new byte[9];\n byteArray2[0] = (byte)88;\n byteArray2[1] = (byte) (-22);\n byteArray2[2] = (byte)100;\n fBCachedFetcher0.absolute(946);\n byteArray2[3] = (byte) (-75);\n byteArray2[4] = (byte)37;\n byteArray2[5] = (byte)53;\n byteArray2[6] = (byte)43;\n byteArray2[7] = (byte)25;\n byteArray2[8] = (byte) (-43);\n byteArray0[1] = byteArray2;\n linkedList0.offerLast(byteArray0);\n try { \n fBCachedFetcher0.absolute(0);\n fail(\"Expecting exception: FBSQLException\");\n \n } catch(FBSQLException e) {\n //\n // You cannot position to the row 0 with absolute() method.\n //\n verifyException(\"org.firebirdsql.jdbc.FBCachedFetcher\", e);\n }\n }", "public ArrayList<Data> buscar1( String x ,Arbol_BB buscado ) {\r\n \r\n \r\n ArrayList<Data> lista = new ArrayList<Data>();\r\n int tam= x.length();\r\n String nombre;\r\n Data data= new Data();\r\n \r\n \r\n //System.out.println(x.compareTo(buscado.raiz.substring(0,tam)));\r\n try{\r\n if (!esVacio()) {\r\n \r\n if( x.compareTo(buscado.raiz.substring(0,tam))==0 ) {\r\n \r\n data.Altura= buscado.altura();\r\n data.nombre=buscado.raiz;\r\n lista.add(data );\r\n lista.addAll(buscar1(x , buscado.subABder));\r\n lista.addAll(buscar1(x, buscado.subABizq));\r\n \r\n \r\n \r\n } else {\r\n buscar1(x , buscado.subABder);\r\n buscar1(x, buscado.subABizq);\r\n \r\n }\r\n \r\n } //Una excepci�n\r\n //System.out.println(buscado.raiz);\r\n System.out.println(lista.get(0).nombre);\r\n return lista;\r\n }\r\n catch (Exception e) {\r\n \r\n //System.out.println(\"no existe\");\r\n \r\n return lista;\r\n }\r\n \r\n }", "private void cargarFichaLepra_convivientes() {\r\n\r\n\t\tMap<String, Object> parameters = new HashMap<String, Object>();\r\n\t\tparameters.put(\"codigo_empresa\", codigo_empresa);\r\n\t\tparameters.put(\"codigo_sucursal\", codigo_sucursal);\r\n\t\tparameters.put(\"nro_identificacion\", tbxNro_identificacion.getValue());\r\n\t\tparameters.put(\"fecha_actual\", new Date());\r\n\r\n\t\t// log.info(\"parameters\" + parameters);\r\n\t\tseguimiento_control_pqtService.setLimit(\"limit 25 offset 0\");\r\n\r\n\t\t// log.info(\"parameters>>>>\" + parameters);\r\n\t\tBoolean fecha_tratamiento = seguimiento_control_pqtService\r\n\t\t\t\t.existe_fecha_fin_tratamiento(parameters);\r\n\t\t// log.info(\"fecha_tratamiento>>>>\" + fecha_tratamiento);\r\n\r\n\t\tif (fecha_tratamiento) {\r\n\t\t\tMap<String, Object> parametros = new HashMap<String, Object>();\r\n\t\t\tparametros.put(\"nro_identificacion\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_identificacion());\r\n\t\t\tparametros.put(\"nro_ingreso\",\r\n\t\t\t\t\tadmision_seleccionada.getNro_ingreso());\r\n\t\t\tparametros.put(\"estado\", admision_seleccionada.getEstado());\r\n\t\t\tparametros.put(\"codigo_administradora\",\r\n\t\t\t\t\tadmision_seleccionada.getCodigo_administradora());\r\n\t\t\tparametros.put(\"id_plan\", admision_seleccionada.getId_plan());\r\n\t\t\tparametros.put(IVias_ingreso.ADMISION_PACIENTE,\r\n\t\t\t\t\tadmision_seleccionada);\r\n\t\t\tparametros.put(IVias_ingreso.OPCION_VIA_INGRESO,\r\n\t\t\t\t\tOpciones_via_ingreso.REGISTRAR);\r\n\t\t\ttabboxContendor.abrirPaginaTabDemanda(false,\r\n\t\t\t\t\tIRutas_historia.PAGINA_CONTROL_CONVIVIENTES_LEPRA,\r\n\t\t\t\t\tIRutas_historia.LABEL_CONTROL_CONVIVIENTES_LEPRA,\r\n\t\t\t\t\tparametros);\r\n\t\t}\r\n\t}", "private final void inicializarListas() {\r\n\t\t//Cargo la Lista de orden menos uno\r\n\t\tIterator<Character> it = Constantes.LISTA_CHARSET_LATIN.iterator();\r\n\t\tCharacter letra;\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tletra = it.next();\r\n\t\t\tthis.contextoOrdenMenosUno.crearCharEnContexto(letra);\r\n\t\t}\r\n\t\t\r\n\t\tthis.contextoOrdenMenosUno.crearCharEnContexto(Constantes.EOF);\r\n\t\t\r\n\t\tthis.contextoOrdenMenosUno.actualizarProbabilidades();\r\n\t\t\r\n\t\t//Cargo las listas de ordenes desde 0 al orden definido en la configuración\r\n\t\tOrden ordenContexto;\r\n\t\tfor (int i = 0; i <= this.orden; i++) {\r\n\t\t\tordenContexto = new Orden();\r\n\t\t\tthis.listaOrdenes.add(ordenContexto);\r\n\t\t}\r\n\t}", "private int[] buscarMenores(ArrayList<ArbolCod> lista){\n int temp;\n int m1=1;\n int m2=0;\n float vm1,vm2,aux;\n \n vm1=lista.get(m1).getProbabilidad();\n vm2=lista.get(m2).getProbabilidad();\n if (vm1<=vm2){\n temp=m1;\n m1=m2;\n m2=temp;\n } \n for (int i=2;i<lista.size();i++){\n vm1=lista.get(m1).getProbabilidad();\n vm2=lista.get(m2).getProbabilidad();\n aux=lista.get(i).getProbabilidad();\n if (aux<=vm2){\n m1=m2;\n m2=i;\n } \n else if (aux<=vm1){\n m1=i;\n }\n }\n int[] res=new int[2];\n res[0]=m1;\n res[1]=m2;\n return res;\n }", "private ArrayList<ParCharProb> calcularProbabilidadLista(ArrayList<ParCharProb> lista) {\n\t\tdouble cantidadElementos = 0;\r\n\t\tParCharProb par;\r\n\t\tIterator<ParCharProb> it = lista.iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tpar = it.next();\r\n\t\t\tcantidadElementos += par.getFrecuencia();\r\n\t\t}\r\n\t\t\r\n\t\tit = lista.iterator();\r\n\t\twhile (it.hasNext()) {\r\n\t\t\tpar = it.next();\r\n\t\t\tpar.setProbabilidad((double) par.getFrecuencia()/(double) cantidadElementos);\r\n\t\t}\r\n\t\treturn lista;\r\n\t}", "public static List getAllPrices() {\n List polovniautomobili = new ArrayList<>();\n try {\n CONNECTION = DriverManager.getConnection(URL, USERNAME, PASSWORD);\n String query = \"SELECT cena FROM polovni\";\n try (PreparedStatement ps = CONNECTION.prepareStatement(query)) {\n ResultSet result = ps.executeQuery();\n while (result.next()) {\n int naziv = result.getInt(\"cena\");\n polovniautomobili.add(naziv);\n\n }\n\n ps.close();\n CONNECTION.close();\n }\n CONNECTION.close();\n } catch (SQLException ex) {\n Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);\n }\n return polovniautomobili;\n }", "public List<MascotaExtraviadaEntity> darProcesosExtraviadaConRazaIgualA(String raza){\n List<MascotaExtraviadaEntity> procesos = mascotaExtraviadaPersistence.findAll();\n List<MascotaExtraviadaEntity> procesosFiltrados = new LinkedList<>();\n \n for( MascotaExtraviadaEntity p : procesos){\n if(p.getMascota().getRaza().equals(raza)){\n procesosFiltrados.add(p);\n }\n }\n return procesosFiltrados;\n }", "public ArrayList<clsPago> consultaDataPagosCuotaInicial(int codigoCli)\n { \n ArrayList<clsPago> data = new ArrayList<clsPago>(); \n try{\n bd.conectarBaseDeDatos();\n sql = \" SELECT a.id_pagos_recibo idPago, a.id_usuario, b.name name_usuario, \"\n + \" a.referencia referencia, \"\n + \" a.fecha_pago fecha_pago, a.estado, \"\n + \" a.valor valor_pago, a.id_caja_operacion, e.name_completo nombre_cliente, \"\n + \" a.fecha_pago fecha_registro\"\n + \" FROM ck_pagos_recibo AS a\"\n + \" JOIN ck_usuario AS b ON a.id_usuario = b.id_usuario\"\n + \" JOIN ck_cliente AS e ON a.codigo = e.codigo\"\n + \" WHERE a.estado = 'A'\"\n + \" AND a.cuota_inicial = 'S'\"\n + \" AND a.estado_asignado = 'N'\"\n + \" AND a.codigo = \" + codigoCli; \n \n System.out.println(sql);\n bd.resultado = bd.sentencia.executeQuery(sql);\n \n if(bd.resultado.next())\n { \n do \n { \n clsPago oListaTemporal = new clsPago();\n \n oListaTemporal.setReferencia(bd.resultado.getString(\"referencia\"));\n oListaTemporal.setFechaPago(bd.resultado.getString(\"fecha_pago\"));\n oListaTemporal.setNombreUsuario(bd.resultado.getString(\"name_usuario\"));\n oListaTemporal.setNombreCliente(bd.resultado.getString(\"nombre_cliente\"));\n oListaTemporal.setValor(bd.resultado.getDouble(\"valor_pago\"));\n oListaTemporal.setFechaRegistro(bd.resultado.getString(\"fecha_registro\"));\n oListaTemporal.setIdPago(bd.resultado.getInt(\"idPago\"));\n data.add(oListaTemporal);\n }\n while(bd.resultado.next()); \n //return data;\n }\n else\n { \n data = null;\n } \n }\n catch(Exception ex)\n {\n System.out.print(ex);\n data = null;\n } \n bd.desconectarBaseDeDatos();\n return data;\n }", "public void processaArquivos() throws Exception\n\t{\n\t\t/* Busca o nome do diretorio no arquivo de propriedades */\n\t\tString nomeDiretorio = getPropriedade(\"ordemVoucher.dirArquivos\");\n\t\tFile dirArquivos = new File(nomeDiretorio);\n\t\tif (!dirArquivos.isDirectory())\n\t\t\tthrow new IOException(\"Diretorio invalido... \"+nomeDiretorio);\n\n\t\t/* Busca os arquivos das ordems (arquivos com informacoes de caixa) */\n\t\tFileFilter filtro = new OrdemVoucherFileFilter(getPropriedade(\"ordemVoucher.patternArquivos\"),\n\t\t\t\t\t\t\t\t\t\t\t\t\t getPropriedade(\"ordemVoucher.extensaoArquivos\"));\n\t\tFile arquivosOrdem[] = dirArquivos.listFiles(filtro);\n\t\t\n\t\t/* Faz a varredura dos arquivos de ordem de voucher encontrados */\n\t\tfor (int i=0; i < arquivosOrdem.length; i++)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tSystem.out.println(\"Processando ordem:\"+arquivosOrdem[i].getName());\n\t\t\t\tif (existeArquivos(arquivosOrdem[i]))\n\t\t\t\t{\n\t\t\t\t\t// Realiza a concatenacao dos arquivos da ordem agrupando-as por item\n\t\t\t\t\t// e entao processa-os para a criptografia e compactacao antes de \n\t\t\t\t\t// envia-los ao GPP\n\t\t\t\t\tString arqAProcessar[] = concatenaArquivos(arquivosOrdem[i]);\n\t\t\t\t\t\n\t\t\t\t\t// Para cada arquivo encontrado de ordem de criacao de voucher\n\t\t\t\t\t// faz se a criptografia dos arquivos de caixa correspondentes\n\t\t\t\t\t// para entao compacta-los em um unico arquivo para posteriormente\n\t\t\t\t\t// ser enviado ao GPP juntamente com este arquivo de capa\n\t\t\t\t\t// da ordem de criacao do voucher\n\t\t\t\t\tString arquivoCompactado = criptografaECompactaOrdem(arquivosOrdem[i],arqAProcessar);\n\t\t\t\t\t\n\t\t\t\t\t// Caso ao criar os arquivos criptografados e compacta-los aconteca algum\n\t\t\t\t\t// erro entao o retorno do metodo e um nome de arquivo nulo. Se este nome\n\t\t\t\t\t// for nulo, entao nada e executado com esta ordem passando entao para a\n\t\t\t\t\t// proxima\n\t\t\t\t\tif (arquivoCompactado != null)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Envia o arquivo do cabecalho da ordem \n\t\t\t\t\t\t// e em seguida envia o arquivo compactado\n\t\t\t\t\t\tenviaArquivoParaGPP(arquivosOrdem[i]);\n\t\t\t\t\t\tenviaArquivoParaGPP(new File(arquivoCompactado));\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove os arquivos criptografados e compactados que foram enviados\n\t\t\t\t\t\t// para o GPP\n\t\t\t\t\t\tremoveArquivos(arquivosOrdem[i],arqAProcessar);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Move os arquivos de origem das informacoes de voucher para um diretorio\n\t\t\t\t\t\t// historico desses arquivos\n\t\t\t\t\t\t// Obs: Os arquivos concatenados foram removidos do diretorio\n\t\t\t\t\t\tmoveArquivos(arquivosOrdem[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(Exception e)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"Erro ao processar ordem:\"+arquivosOrdem[i].getName()+\" Erro:\"+e);\n\t\t\t}\n\t\t}\n\t}", "public void metodoInstanciaArbitrariaDeUnTipo2() {\n\t\tString[] lista= {\"cielo\",\"agua\",\"papa\",\"carpintero\",\"taza\",\"ciencia\",\"dedo\",\"mamut\",\"telefono\",\"computadora\",\"maniqui\",\"zapato\"};\n\t\tList<String> palabras=Arrays.asList(lista);\n\t\tpalabras.forEach(String::length);// \n\t\t//forEach recibe un consumidor de solo un parametro, es decir puede ser de la siguiente forma: (palabra)->{}\n\t\t//Pero tambien puede recibir un metodo referencia, en este caso, por ejemplo recibe el metodo length, pero el metodo length se opera sobre una instancia de String.\n\t\t//la firma del metodo length es: public int length() , es decir no recibe parametros, es operado sobre la instanacia del objeto.\n\t\t\n\t\t//Otro caso de referencia arbitraria seria\n\t\tArrays.sort(lista, String::compareToIgnoreCase);\n\t\t//Donde el segundo parametro es un Comparator, en este caso el metodo compareToIgnoreCase es un metodo de instancia, y recibe como parametro otro String para compararse \n\t\t//sobre la instancia del mismo.\n\t\t//definicion del Comparator: int compare(T o1, T o2);\n\t\t//definicion del compareToIgnoreCase: public int compareToIgnoreCase(String str)\n\t\t//La definicion compareToIgnoreCase esta muy cerca de Comparator pero el primero parametro es una instancia y el segundo parametro otra instancia. \n\t}", "public long reserva_de_entradas(int identificador_evento, Date fechaevento, Horario[] listahorarios ) throws ParseException {\n fgen.info (\"Identificador del evento\" + identificador_evento);\n fgen.info (\"Fecha del evento\" + fechaevento);\n ArrayList<Horario> horariosReserva = new ArrayList<Horario>();\n for (int i = 0; i < listahorarios.length; i++) {\n \n Horario horario = listahorarios[i];\n fgen.info (\"Horario : \" + horario.getHorario().toString()); \n horariosReserva.add(horario);\n List<Disponibilidad> listadisponibles = listahorarios[i].disponibilidades;\n for (int j = 0; j < listadisponibles.size() ; j++) { \n fgen.info (\" Disponibilidad - Cantidad: \" + listadisponibles.get(j).getCantidad());\n fgen.info (\" Disponibilidad - Precio: \" + listadisponibles.get(j).getPrecio());\n fgen.info (\" Disponibilidad - Sector: \" + listadisponibles.get(j).getSector());\n } \n \n \n } \n //Inicializo o tomo lo que esta en memoria de la lista de reservas\n ListaReservas reservas= new ListaReservas(); \n // busco el evento y que la lista de horarios sea en la que quiero reservar\n ListaEventos eventos = new ListaEventos();\n Calendar c = Calendar.getInstance();\n c.setTime(fechaevento);\n Evento e = eventos.buscarEvento(identificador_evento, c);\n List<Horario> horariosRetornar = new ArrayList<Horario>();\n if(e != null)\n {\n horariosRetornar = e.getHorarios();\n } \n \n if (horariosRetornar != null)\n {\n for (int i = 0; i < horariosRetornar.size(); i++) {\n for (int j = 0; j < listahorarios.length; j++) {\n Date fechaE = horariosRetornar.get(i).getHorario().getTime(); \n Date fechaEventoDate = listahorarios[j].hora.getTime(); \n if(fechaE.equals(fechaEventoDate)) \n { for (int k = 0; k < horariosRetornar.get(i).disponibilidades.size(); k++) {\n for (int l = 0; l < listahorarios[j].disponibilidades.size(); l++) {\n Disponibilidad d= horariosRetornar.get(i).disponibilidades.get(k);\n Disponibilidad r= listahorarios[j].disponibilidades.get(l);\n if (d.cantidad >= r.cantidad && d.sector.equalsIgnoreCase(r.sector) && d.precio==r.precio)\n {\n d.setCantidad(d.cantidad-r.cantidad);\n //Reserva reserv= new Reserva();\n //reservas.contador_Id= reservas.contador_Id +1;\n //reserv.idReserva= reservas.contador_Id;\n //reserv.Estado=1;\n //reserv.idEvento = identificador_evento;\n //reserv.horarios.add(listahorarios[j]);\n //reservas.listaReserva.add(reserv);\n //return reserv.idReserva;\n }\n else if(d.cantidad < r.cantidad && d.sector.equalsIgnoreCase(r.sector) && d.precio==r.precio)\n {\n //Si hay alguna solicitud de de reserva que no se pueda cumplir. Re reorna 0.\n //TODO: Hay que volver para atras las cantidades modificadas.\n return 0;\n }\n \n }\n \n }\n }\n }\n }\n Reserva reserv= new Reserva();\n reservas.contador_Id= reservas.contador_Id +1;\n reserv.idReserva= reservas.contador_Id;\n reserv.Estado=1;\n reserv.idEvento = identificador_evento;\n reserv.horarios = horariosReserva;\n reserv.fechaEvento = c;\n reservas.listaReserva.add(reserv);\n return reserv.idReserva;\n }\n \n return 0;\n }", "@Test\n public void nelioMuodostuu() {\n ArrayList lista=this.tetrimino.palautaKuvio();\n assertEquals(lista.size(), 4);\n \n }", "public DatosIteracion mejorIteracionOptimizada(\r\n\t\t\tArrayList<DatosIteracion> datos) {\r\n\t\tDatosIteracion d = new DatosIteracion(\"auxiliar\");\r\n\t\tLectura l = new Lectura(999999, 0, 0);\r\n\t\td.getValoresLecturas().add(l);\r\n\r\n\t\tfor (int i = 0; i < datos.size(); i++) {\r\n\r\n\t\t\tif ((d.getValoresLecturas(d.getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (d.getValoresLecturas(\r\n\t\t\t\t\td.getValoresLecturas().size() - 1).getTiempo() + 1)) < (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getTiempo() + 1))) {\r\n\r\n\t\t\t\td = datos.get(i);\r\n\t\t\t}\r\n\r\n\t\t\tif ((d.getValoresLecturas(d.getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (d.getValoresLecturas(\r\n\t\t\t\t\td.getValoresLecturas().size() - 1).getTiempo() + 1)) == (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getCapturados() / (datos\r\n\t\t\t\t\t.get(i)\r\n\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t.getTiempo() + 1))) {\r\n\r\n\t\t\t\tif (d.getValoresLecturas(d.getValoresLecturas().size() - 1)\r\n\t\t\t\t\t\t.getTiempo() > datos\r\n\t\t\t\t\t\t.get(i)\r\n\t\t\t\t\t\t.getValoresLecturas(\r\n\t\t\t\t\t\t\t\tdatos.get(i).getValoresLecturas().size() - 1)\r\n\t\t\t\t\t\t.getTiempo()) {\r\n\r\n\t\t\t\t\td = datos.get(i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn d;\r\n\t}", "private int[] enquadramentoContagemDeCaracteres(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Contagem de Caracteres]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Contagem de Caracteres]\\n\");\n Thread.sleep(velocidade);\n\n int informacaoDeControle = ManipuladorDeBit.getPrimeiroByte(quadro[0]);//Quantidade de Bits do quadro\n //Quantidade de Bits de carga util do quadro\n int quantidadeDeBitsCargaUtil = informacaoDeControle;\n System.out.println(\"IC: \" + informacaoDeControle);\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tIC [\"+informacaoDeControle+\"] \");\n\n\n int novoTamanho = quantidadeDeBitsCargaUtil/8;\n\n int[] quadroDesenquadrado = new int[novoTamanho];//Novo vetor de Carga Util\n int posQuadro = 0;//Posicao do Vetor de Quadros\n\n int cargaUtil = 0;//Nova Carga Util\n\n quadro[0] = ManipuladorDeBit.deslocarBits(quadro[0]);//Deslocando os bits 0's a esquerda\n //Primeiro inteiro do Quadro - Contem a informacao de Controle IC nos primeiros 8 bits\n quadro[0] <<= 8;//Deslocando 8 bits para a esquerda, descartar a IC\n\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [ \");\n for (int i=1; (i<=3) && (i<=novoTamanho); i++) {\n cargaUtil = ManipuladorDeBit.getPrimeiroByte(quadro[0]);\n quadroDesenquadrado[posQuadro++] = cargaUtil;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(cargaUtil + \" \");\n quadro[0] <<= 8;//Desloca 8 bits para a esquerda\n }\n\n Thread.sleep(velocidade);\n\n //Caso o quadro for composto por mais de um inteiro do vetor\n for (int i=1, quantidadeByte; posQuadro<novoTamanho; i++) {\n quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(quadro[i]);\n quadro[i] = ManipuladorDeBit.deslocarBits(quadro[i]);\n\n for (int x=1; (x<=quantidadeByte) && (x<=4); x++) {\n cargaUtil = ManipuladorDeBit.getPrimeiroByte(quadro[i]);\n quadroDesenquadrado[posQuadro++] = cargaUtil;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(cargaUtil + \" \");\n quadro[i] <<= 8;//Desloca 8 bits para a esquerda\n }\n Thread.sleep(velocidade);\n }\n \n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"]\\n\");\n Thread.sleep(velocidade);\n\n return quadroDesenquadrado;\n }", "public ArrayList<oferta> listadoOfertaxComercio(int idComercio) {\n ArrayList<oferta> lista = new ArrayList<>();\n try {\n Connection conn = DriverManager.getConnection(CONN, USER, PASS);\n\n PreparedStatement st = conn.prepareStatement(\"select o.nombre, o.cantidad, o.precio , c.id_comercio, id_oferta, descripcion, fecha, o.ruta, o.estado\\n\"\n + \"from Comercios c \\n\"\n + \"join Ofertas o on c.id_comercio = o.id_comercio \\n\"\n + \"where c.id_comercio = ?\");\n st.setInt(1, idComercio);\n ResultSet rs = st.executeQuery();\n\n while (rs.next()) {\n String nombreO = rs.getString(1);\n int cantidad = rs.getInt(2);\n Float precio = rs.getFloat(3);\n int id = rs.getInt(4);\n int ido = rs.getInt(5);\n String descripcion = rs.getString(6);\n String fecha = rs.getString(7);\n String ruta = rs.getString(8);\n boolean estado = rs.getBoolean(9);\n\n rubro rf = new rubro(0, \"\", true, \"\", \"\");\n comercio c = new comercio(\"\", \"\", \"\", id, true, \"\", \"\", rf, \"\");\n oferta o = new oferta(ido, nombreO, cantidad, precio, c, estado, descripcion, fecha,ruta );\n\n lista.add(o);\n }\n\n st.close();\n conn.close();\n } catch (SQLException ex) {\n ex.printStackTrace();\n }\n\n return lista;\n }", "private void consultarlistareportes() {\n db= con.getWritableDatabase();\n ReporteIncidente reporte= null;\n listarreportesinc =new ArrayList<ReporteIncidente>();\n Cursor cursor= db.rawQuery(\"select imagen1,asunto_reporte,estado_reporte,desc_reporte,cod_reporte from \"+ Utilitario.TABLE_REPORTE_INCIDENTE+\" where estado_reporte<>'Incompleto'\",null);\n\n while (cursor.moveToNext()){\n reporte= new ReporteIncidente();\n reporte.setImage1(cursor.getBlob(0));\n reporte.setAsunto(cursor.getString(1));\n reporte.setEstado(cursor.getString(2));\n reporte.setDescripcion(cursor.getString(3));\n reporte.setCodreporte(cursor.getInt(4));\n listarreportesinc.add(reporte);\n }\n //obtenerinformacion();\n db.close();\n }", "@Test(timeout = 4000)\n public void test07() throws Throwable {\n DefaultNucleotideCodec defaultNucleotideCodec0 = DefaultNucleotideCodec.INSTANCE;\n byte[] byteArray0 = new byte[4];\n DefaultNucleotideCodec defaultNucleotideCodec1 = DefaultNucleotideCodec.INSTANCE;\n Iterator<Nucleotide> iterator0 = defaultNucleotideCodec1.iterator(byteArray0);\n // Undeclared exception!\n try { \n defaultNucleotideCodec0.encode(11, iterator0);\n fail(\"Expecting exception: NoSuchElementException\");\n \n } catch(NoSuchElementException e) {\n //\n // no more elements\n //\n verifyException(\"org.jcvi.jillion.core.residue.nt.DefaultNucleotideCodec$IteratorImpl\", e);\n }\n }", "List<DownloadChunk> mo54445j(int i);", "public long problem2b(){\r\n LinkedList<String> linkList = new LinkedList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n linkList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis();\r\n return end - start; \r\n }", "private static <V> int buscarArbol(V pValor, List<Graph<V>> pLista) {\n for (int x = 1; x <= pLista.size(); x++) {\n Graph<V> arbol = pLista.get(x);\n Iterator<V> it1 = arbol.iterator();\n while (it1.hasNext()) {\n V aux = it1.next();\n if (aux.equals(pValor)) {\n return x;\n }\n }\n }\n return 0;\n }", "@Test\n\tpublic void testListarArquivoComRegistro() throws IOException\n\t{\n\t\t// 1) criar um arquivo de dados com 1 registro\n\t\tString nomeArquivo = \"dados.txt\";\n\t\tnew File(nomeArquivo).createNewFile();\n\t\tFileOutputStream fos = \n\t\t\t\tnew FileOutputStream(nomeArquivo);\n\t\tfos.write(\n\t\t\t\"001;Josť das Couves;BH;MG;2500\\n\".getBytes());\n\t\tfos.close();\n\t\t// 2) criar o processador de arq. seq.\n\t\tProcessadorDeArquivoSequencial pas = \n\t\t\tnew ProcessadorDeArquivoSequencial(nomeArquivo);\n\t\t// 3) listar os registros do arquivo\n\t\tList<Registro> lista = pas.listar();\n\t\t// 4) verificar quantidade de registros\n\t\tAssert.assertEquals(1, lista.size());\n\t\t// 5) excluir o arquivo criado\n\t\tnew File(nomeArquivo).delete();\n\t\t\n\t}", "public ArrayList<Float> leerMapaDesdeBaseDeDatos() {\n listaNumeros.add(2.0f);\r\n listaNumeros.add(3.0f);\r\n listaNumeros.add(4.0f);\r\n listaNumeros.add(5.0f);\r\n listaNumeros.add(1.0f);\r\n return listaNumeros;\r\n }", "public void cargarProductosComprados() {\n try {\n //Lectura de los objetos de tipo productoComprado\n FileInputStream archivo= new FileInputStream(\"productosComprados\"+this.getCorreo()+\".dat\");\n ObjectInputStream ruta = new ObjectInputStream(archivo);\n productosComprados = (ArrayList) ruta.readObject();\n archivo.close();\n \n \n } catch (IOException ioe) {\n System.out.println(\"Error de IO: \" + ioe.getMessage());\n } catch (ClassNotFoundException cnfe) {\n System.out.println(\"Error de clase no encontrada: \" + cnfe.getMessage());\n } catch (Exception e) {\n System.out.println(\"Error: \" + e.getMessage());\n }\n }", "@Test(timeout = 4000)\n public void test071() throws Throwable {\n Object[] objectArray0 = SQLUtil.parseColumnTypeAndSize(\"qfy0HL\");\n assertEquals(1, objectArray0.length);\n }", "List<BufferedImage> listarHuellas(Integer fcdc_id) throws SQLException, IOException;", "List<Pacote> buscarPorQtdDiasMaiorEPrecoMenor(int qtd, float preco);", "public static List getAllUrl() {\n List polovniautomobili = new ArrayList<>();\n try {\n CONNECTION = DriverManager.getConnection(URL, USERNAME, PASSWORD);\n String query = \"SELECT url FROM polovni\";\n try (PreparedStatement ps = CONNECTION.prepareStatement(query)) {\n ResultSet result = ps.executeQuery();\n while (result.next()) {\n String naziv = result.getString(\"url\");\n polovniautomobili.add(naziv);\n\n }\n\n ps.close();\n CONNECTION.close();\n }\n CONNECTION.close();\n } catch (SQLException ex) {\n Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);\n }\n return polovniautomobili;\n }", "@Test\n public void testAnalisarDados() throws Exception {\n System.out.println(\"analisarDados\");\n int[][] dadosFicheiro = null;\n int linhas = 0;\n Integer[] expResult = null;\n String time = \"\";\n String tipoOrdenacao = \"\";\n Integer[] resultArray = null;\n \n int[] result = ProjetoV1.analisarDados(dadosFicheiro, linhas, time, tipoOrdenacao);\n if(result != null){\n resultArray= ArrayUtils.converterParaArrayInteger(result); \n }\n \n assertArrayEquals(expResult, resultArray);\n\n }", "private static byte[] m17790a(Bitmap bitmap) {\n int i;\n int i2;\n int i3;\n int width = bitmap.getWidth();\n int height = bitmap.getHeight();\n OutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n for (i = 0; i < 32; i++) {\n byteArrayOutputStream.write(0);\n }\n int[] iArr = new int[(width - 2)];\n bitmap.getPixels(iArr, 0, width, 1, 0, width - 2, 1);\n Object obj = iArr[0] == -16777216 ? 1 : null;\n Object obj2 = iArr[iArr.length + -1] == -16777216 ? 1 : null;\n int length = iArr.length;\n width = 0;\n int i4 = 0;\n for (i2 = 0; i2 < length; i2++) {\n if (width != iArr[i2]) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, i2);\n width = iArr[i2];\n }\n }\n if (obj2 != null) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, length);\n }\n int i5 = i4;\n int i6 = i5 + 1;\n if (obj != null) {\n i = i6 - 1;\n } else {\n i = i6;\n }\n if (obj2 != null) {\n i3 = i - 1;\n } else {\n i3 = i;\n }\n iArr = new int[(height - 2)];\n bitmap.getPixels(iArr, 0, 1, 0, 1, 1, height - 2);\n obj = iArr[0] == -16777216 ? 1 : null;\n obj2 = iArr[iArr.length + -1] == -16777216 ? 1 : null;\n length = iArr.length;\n width = 0;\n i4 = 0;\n for (i2 = 0; i2 < length; i2++) {\n if (width != iArr[i2]) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, i2);\n width = iArr[i2];\n }\n }\n if (obj2 != null) {\n i4++;\n C5225r.m17788a(byteArrayOutputStream, length);\n }\n i6 = i4 + 1;\n if (obj != null) {\n i = i6 - 1;\n } else {\n i = i6;\n }\n if (obj2 != null) {\n i--;\n }\n for (i6 = 0; i6 < i3 * i; i6++) {\n C5225r.m17788a(byteArrayOutputStream, 1);\n }\n byte[] toByteArray = byteArrayOutputStream.toByteArray();\n toByteArray[0] = (byte) 1;\n toByteArray[1] = (byte) i5;\n toByteArray[2] = (byte) i4;\n toByteArray[3] = (byte) (i * i3);\n C5225r.m17787a(bitmap, toByteArray);\n return toByteArray;\n }" ]
[ "0.5548139", "0.54742545", "0.52966183", "0.5285389", "0.5256688", "0.5211503", "0.5202351", "0.5171077", "0.51558125", "0.510746", "0.508908", "0.50793225", "0.5076285", "0.5064593", "0.5057725", "0.5052603", "0.50426775", "0.50314224", "0.5027897", "0.5026966", "0.5026498", "0.5026457", "0.50021887", "0.49915028", "0.49771675", "0.49483487", "0.4945637", "0.49456093", "0.49294803", "0.48909903", "0.4889322", "0.48848796", "0.4871654", "0.48615777", "0.48601648", "0.48597872", "0.48570782", "0.48553136", "0.48532057", "0.48530582", "0.48529753", "0.48403242", "0.48353913", "0.48337376", "0.4829669", "0.48248708", "0.48225987", "0.48218718", "0.48217154", "0.48066095", "0.4800526", "0.47996113", "0.47978526", "0.47956422", "0.47902283", "0.47793868", "0.47765374", "0.47749764", "0.4773456", "0.47693262", "0.47674122", "0.47588265", "0.47568378", "0.47537825", "0.47537425", "0.47518295", "0.47448346", "0.47428444", "0.47389284", "0.47336257", "0.4732712", "0.47319618", "0.47312394", "0.4729587", "0.47251624", "0.47225842", "0.47218874", "0.4715129", "0.47150445", "0.4709324", "0.47092226", "0.47068864", "0.4703749", "0.47030488", "0.46963716", "0.46914423", "0.46904904", "0.468672", "0.46855113", "0.46816224", "0.46813124", "0.46807462", "0.46804467", "0.4672705", "0.46723723", "0.46715403", "0.46690997", "0.46682522", "0.46669993", "0.46653178" ]
0.52369547
5
The drone does not send the preferred target if it has not been set since last boot
@Override protected void onConnecting() { mPreferredTarget = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public int targetDevice() {\n return 0;\n }", "public void setChargerTarget() {\n if (getEnemies().size() > 0) {\n ArrayList<RobotReference> enemies = getEnemies();\n RobotReference closestEnemy = enemies.get(0);\n if (chargerTarget == null && teamTarget != null) {\n for (RobotReference enemy : enemies) {\n if (!enemy.isTeammate()) {\n if (Vector2d.getDistanceTo(closestEnemy.getLocation(), getLocation()) > Vector2d.getDistanceTo(enemy.getLocation(), getLocation()))\n closestEnemy = enemy;\n }\n }\n chargerTarget = closestEnemy;\n } else {\n chargerTarget = enemies.get(0);\n }\n }\n }", "@Override\n public String getTarget()\n {\n return null;\n }", "@Override\n public void setDefaultTarget() {\n hovered = AbstractDungeon.player;\n }", "private static void defineInitialAttackTarget() {\n\t\tUnit buildingToAttack = MapExploration.getNearestEnemyBuilding();\n\n\t\t// We know some building of CPU that we can attack.\n\t\tif (buildingToAttack != null) {\n\t\t\tchangeNextTargetTo(buildingToAttack);\n\t\t}\n\n\t\t// No building to attack found, safely decide not to attack.\n\t\telse {\n\t\t\tchangeStateTo(STATE_PEACE);\n\t\t}\n\t}", "public void setTarget(String val)\r\n\t{\r\n\t\t_target = val;\r\n\t}", "protected void setTarget(Command target) {\n\t\tproxy.setTarget(target);\n\t}", "@Override\n\tpublic void setTarget(Object arg0) {\n\t\tdefaultEdgle.setTarget(arg0);\n\t}", "public void setTarget(String target) {\n this.target = target;\n }", "public void toSelectingAttackTarget() {\n }", "public String getDefaultTarget() {\n return defaultTarget;\n }", "private void manageTestTarget(){ \n if(labelArray[TEST_TARGET_LOCATION].getIcon()==iconSet.getGrayIcon()){\n labelArray[TEST_TARGET_LOCATION].setIcon(iconSet.getTestTargetIcon());\n System.out.println(\"Test Start\");\n } \n else{\n testTargetDelay++;\n System.out.println(\"DELAY:\" + testTargetDelay);\n }\n }", "private void setNewTarget() {\n startPoint = new Circle(targetPoint);\n projection.addShift(this.targetGenerator.shiftX(startPoint), this.targetGenerator.shiftY(startPoint),\n this.targetGenerator.gridManager);\n this.targetPoint = new Circle(this.targetGenerator.generateTarget(startPoint), this.targetGenerator.gridManager.pointSize);\n projection.convertFromPixels(this.targetPoint);\n \n gameListeners.addedNewLine(startPoint, targetPoint);\n \n // TODO make probability upgradeable to spawn a new pickup\n if (Math.random() < pickupSpawnProbability) {\n generateNewPickup(); \n }\n }", "public void initDefaultCommand() {\n setDefaultCommand(new IdentifyBestTarget());\n }", "void setTarget(java.lang.String target);", "private void intelligentDecideMove() {\n\t\tMonster target=nearestEnemy();\r\n\t\tif(target!=null){\t\t\t\t//FIRST PRIORITY: pursue the target if it can be seen.\r\n\t\t\tswitchStates(PURSUIT);\r\n\t\t\ttargetTile=new Tile(target.currentTile);\r\n\t\t\t//saveMove();\r\n\t\t\tmonster.moveTowards(target);\r\n\t\t}\r\n\t\t\t\r\n\t\telse{\r\n\t\t\ttargetLostResponse();\r\n\t\t\t}\r\n\t}", "private void target() {\n\t\t// find distance to flower\n\t\tdouble dist = grid.getDistance(grid.getLocation(this),\n\t\t\t\t\t\t\t\t\t grid.getLocation(targetFlower));\n\t\t// if close to flower start harvesting nectar\n\t\tif(dist < 3) {\n\t\t\tstate = \"HARVESTING\";\n\t\t}\n\t\t// if VERY far from flower, it must have died. start scouting\n\t\telse if(dist > 200){\n\t\t\tstate = \"SCOUTING\";\n\t\t}\n\t\t// else keep moving toward flower\n\t\telse{\n\t\t\tmoveTowards(grid.getLocation(targetFlower), 3);\n\t\t\tfood -= highMetabolicRate;\n\t\t}\n\t}", "@Override\n\tpublic void initDefaultCommand() {\n \tElevator2.set(ControlMode.Follower, 6);\n \tElevator1.configSelectedFeedbackSensor(FeedbackDevice.QuadEncoder, 0, 50);\n \n }", "@Override\n\tpublic void setChaseTarget(){\n\t\tthis.setTarget(_pacman.getX()+Constants.SQUARE_SIDE,_pacman.getY()-(4*Constants.SQUARE_SIDE));\n\t}", "public void addTarget(Target target) {\n SocketChannel socketChannel = null;\n try {\n socketChannel = SocketChannel.open();\n socketChannel.configureBlocking(false);\n socketChannel.connect(target.address);\n target.socketChannel = socketChannel;\n target.connectStart = System.currentTimeMillis();\n synchronized (targets) {\n targets.add(target);\n }\n selector.wakeup();\n } catch (IOException e) {\n// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n if (socketChannel != null) {\n try {\n socketChannel.close();\n } catch (IOException e1) {\n e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n }\n }\n target.failure = e;\n addFinishedTarget(target);\n }\n\n }", "@Override\n\tpublic void teleopPeriodic() {\n\t\tRobot.intakeSubsystem._getSpeed();\n\n\t\tRobot.driveSubsystem.operatorOverride();\n\t\tScheduler.getInstance().run();\n\n\t\tTargetRegion boilerTarget = Robot.navigator.getBoilerTarget();\n\t\tif (boilerTarget != null) {\n\t\t\tSmartDashboard.putNumber(\"Target Center X\", boilerTarget.m_centerTop);\n\t\t\tSmartDashboard.putNumber(\"Target Center Y\", boilerTarget.m_bounds.m_top);\n\t\t} else {\n\t\t\tSmartDashboard.putNumber(\"Target Center X\", -1);\n\t\t\tSmartDashboard.putNumber(\"Target Center Y\", -1);\n\t\t}\n\t}", "@Override\n public void setTarget(GameObject newTarget) {\n if (newTarget != null && !newTarget.isVisible()) {\n newTarget = null;\n }\n\n // Can't target and attack festival monsters if not participant\n if (newTarget instanceof FestivalMonsterInstance && !isFestivalParticipant()) {\n newTarget = null;\n }\n\n final Party party = getParty();\n\n // Can't target and attack rift invaders if not in the same room\n if (party != null && party.isInDimensionalRift()) {\n final int riftType = party.getDimensionalRift().getType();\n final int riftRoom = party.getDimensionalRift().getCurrentRoom();\n if (newTarget != null && !DimensionalRiftManager.getInstance().getRoom(riftType, riftRoom).checkIfInZone(newTarget.getX(), newTarget.getY(), newTarget.getZ())) {\n newTarget = null;\n }\n }\n\n final GameObject oldTarget = getTarget();\n\n if (oldTarget != null) {\n if (oldTarget == newTarget) {\n return;\n }\n\n // Remove the L2Player from the _statusListener of the old target if it was a L2Character\n if (oldTarget.isCreature()) {\n ((Creature) oldTarget).removeStatusListener(this);\n }\n\n broadcastPacket(new TargetUnselected(this));\n }\n\n if (newTarget != null) {\n // Add the L2Player to the _statusListener of the new target if it's a L2Character\n if (newTarget.isCreature()) {\n ((Creature) newTarget).addStatusListener(this);\n }\n\n broadcastPacket(new TargetSelected(getObjectId(), newTarget.getObjectId(), getLoc()));\n }\n\n super.setTarget(newTarget);\n }", "public void setTarget(java.lang.String target) {\n this.target = target;\n }", "public void setTarget(Target target) {\n\t\tthis.target = target;\n\t}", "public TargetServerChromattic() {}", "private void sendBestTargetReport()\n {\n // define arrays (just of the bestTarget and a vertical bar so length 2)\n double[] centerXs = new double[2];\n double[] centerYs = new double[2];\n //double[] areas = new double[2];\n double[] widths = new double[2];\n double[] heights = new double[2];\n \n // send currentBestTarget if it exists\n if (currentBestTarget != null)\n {\n\t // set props of bestTarget\n\t centerXs[0] = currentBestTarget.centerX;\n\t centerYs[0] = currentBestTarget.centerY;\n\t //areas[0]\n\t widths[0] = currentBestTarget.width;\n\t heights[0] = currentBestTarget.height;\n }\n \n // create artificial target to display center bar\n centerXs[1] = IMAGE_WIDTH/2;\n centerYs[1] = IMAGE_HEIGHT/2;\n widths[1] = 10;\n heights[1] = IMAGE_HEIGHT;\n \n // send info\n Robot.targetSendingTable.putNumberArray(\"centerX\", centerXs);\n Robot.targetSendingTable.putNumberArray(\"centerY\", centerYs);\n //Robot.targetSendingTable.putNumberArray(\"area\", areas);\n Robot.targetSendingTable.putNumberArray(\"width\", widths);\n Robot.targetSendingTable.putNumberArray(\"height\", heights);\n }", "private void targetLostResponse(){\n\t\tswitch(state){\r\n\t\tcase(PURSUIT):\r\n\t\t\tstate=HUNTING;\r\n\t\t\tTile[] targetChoices=adjacentUnseenTiles(level(),targetTile);\r\n\t\t\tif(targetChoices[0]==null)\r\n\t\t\t\tstate=IDLE;\r\n\t\t\ttargetLostResponse();\r\n\t\t\tbreak;\r\n\t\tcase(HUNTING):\t//TODO: after reaching target tile, guess a new target tile, up to a point. (define what that point is) Eventually resume wandering.\r\n\t\t\tif(targetTile!=null){\r\n\t\t\t\tif(!targetTile.equalTo(monster.currentTile)){\r\n\t\t\t\t\tsaveMove();\r\n\t\t\t\t\tmonster.moveTowards(targetTile);\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\t//if(!monster.currentTile.equalTo(plannedPath[0]))\r\n\t\t\t\t\t//\tmonster.moveTowards(plannedPath[0]);\r\n\t\t\t\t\tstate=IDLE;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tstate=IDLE;\r\n\t\t\t\ttargetLostResponse();\r\n\t\t\t\t}\r\n\t\t\tbreak;\r\n\t\tcase(IDLE):\r\n\t\t\twander();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "public void setDefaultTarget(String defaultTarget) {\n this.defaultTarget = defaultTarget;\n }", "void changeBTAddress() {\n\t\t\n\t\t// if ( this.beacon.getAppType() == AppType.APPLE_GOOGLE_CONTACT_TRACING ) {\n\t\tif ( this.useRandomAddr()) {\n\t\t\t// try to change the BT address\n\t\t\t\n\t\t\t// the address is LSB..MSB and bits 47:46 are 0 i.e. bits 0 & 1 of right-most byte are 0.\n\t\t\tbyte btRandomAddr[] = getBTRandomNonResolvableAddress();\n\t\t\t\n\t\t\t// generate the hcitool command string\n\t\t\tString hciCmd = getSetRandomBTAddrCmd( btRandomAddr);\n\t\t\t\n\t\t\tlogger.info( \"SetRandomBTAddrCmd: \" + hciCmd);\n\t\t\t\n\t\t\t// do the right thing...\n\t\t\tfinal String envVars[] = { \n\t\t\t\t\"SET_RAND_ADDR_CMD=\" + hciCmd\n\t\t\t};\n\t\t\t\t\t\t\n\t\t\tfinal String cmd = \"./scripts/set_random_addr\";\n\t\t\t\n\t\t\tboolean status = runScript( cmd, envVars, this, null);\n\t\t}\n\t\t\t\n\t}", "public void teleopInit() {\n if (autonomousCommand != null) \n autonomousCommand.cancel();\n\n // RobotMap.enableUltrasonicTrigger(false);\n driveTrain.configForTeleopMode();\n }", "void setTarget(String target) {\n try {\n int value = Integer.valueOf(target);\n game.setTarget(value);\n } catch (NumberFormatException e) {\n // caused by inputting strings\n } catch (IllegalArgumentException e) {\n // caused by number < 6.\n game.setTarget(10);\n }\n }", "public String getTarget() {\n return target;\n }", "public String getTarget() {\n return target;\n }", "public final void takeTarget(xmf xmf) {\n akcr.b(xmf, \"target\");\n super.takeTarget(xmf);\n xmf.getLifecycle().a(this);\n }", "@Override\n public void teleopInit() {\n Robot.drive.setDefaultCommand(new DriveCommand());\n if (autonomousCommand != null) autonomousCommand.cancel();\n System.out.println(\"teleopInit being called\");\n \n }", "@EventHandler\n public void onEntityTarget(EntityTargetLivingEntityEvent e) {\n if (!plugin.getConfig().getBoolean(\"Protections.MobTargeting\"))\n return;\n if (!(e.getEntity() instanceof Monster))\n return;\n if (!(e.getTarget() instanceof Player))\n return;\n Player player = (Player) e.getTarget();\n if (player == null) return;\n if (!plugin.getPlayer(player).isAFK())\n return;\n e.setCancelled(true);\n }", "public String getTarget()\r\n\t{\r\n\t\treturn _target;\r\n\t}", "String getTarget();", "String getTarget();", "public void setDefault(String defaultTarget) {\n this.defaultTarget = defaultTarget;\n }", "boolean checkShouldSkipTarget(String target) {\n return Boolean.TRUE.equals(SKIP_TARGETS.retrieve(target));\n }", "private void applyHint() {\r\n\t\tif (this.client.getTurn().getMoves().size() != 0) {\r\n\t\t\tthis.client.submitTurn();\r\n\t\t} else { \r\n\t\t\tUtil.println(\"This could not been applied to the server.\");\r\n\t\t}\r\n\t}", "public String target(String target)\n {\n return target + \":\" + this.getPort();\n }", "private void decideMakeAutomaicMove(){\n\t\t\r\n\t\tif (playerMode != PlayerMode.manual){\r\n\t\t\tif (playerMode == PlayerMode.random) makeRandomMove();\r\n\t\t\telse makeSmartMove();\r\n\t\t}\r\n\t}", "public void sendNewConfiguration() {\n this.mWmService.mH.obtainMessage(18, this).sendToTarget();\n }", "public boolean isSelectingAttackTarget() {\n return false;\n }", "@Override\n\tpublic TargetLocator switchTo() {\n\t\treturn null;\n\t}", "public java.lang.String getTarget() {\n return target;\n }", "public TurnToTarget() {\n forceDone = false;\n turnToTarget = new TurnToAngle(0);\n }", "public void setTarget(String target) {\n this.target = target == null ? null : target.trim();\n }", "public void remTarget(){\n rem(DmpDMSAG.__target);\n }", "public void setTarget(String s) { \n shortcutValue(s, GENERAL_TARGET);\n }", "private Target getDefaultTarget()\n {\n if (defaultTargetAttribute != null)\n {\n return new Target(defaultTargetAttribute.getValue(), this);\n }\n else\n {\n return null;\n }\n }", "@objid (\"8fb70c43-b102-4a64-9424-c7cc07d58fcf\")\n void setTarget(Instance value);", "public boolean targetsDiscovered() {\n return false;\r\n }", "@Override\n\tpublic int getTargetParameter() {\n\t\treturn 0;\n\t}", "void setTarget(Node target) {\n\t\tthis.target = target;\n\t}", "public TargetReport retrieveBestTarget()\n\t{\n\t\t// get targets...\n\t\tgetTargetReports(allTargets);\n//\t\tSystem.out.println(\"All Targets: \" + allTargets);\n\t\t\n\t\t// and find the best one\n\t\tTargetReport bestTarget = null;\n\t\tdouble bestScore = 0;\n\t\tfor (TargetReport target : allTargets)\n\t\t{\n\t\t\t// Eliminate targets based on range\n\t\t\tdouble targetRange = getRangeToTarget(target);\n\t\t\tif (targetRange > MAX_REASONABLE_RANGE || targetRange < MIN_REASONABLE_RANGE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// When DRIVERS are lining up, eliminate based on the assumption that the target is aligned.\n\t\t\t// (targetCloseToCenter is set to true during teleop, because we would expect it to be with human drivers)\n\t\t\tif (targetCloseToCenter && Math.abs(target.centerX - IMAGE_WIDTH / 2) > CENTER_ZONE_SIZE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// add score for distance from throttle-based guess\n\t\t\tguessedRange = MAX_REASONABLE_RANGE*0.5*(-Robot.oi.UtilStick.getThrottle() + 1);\n\t\t\tif (Math.abs(guessedRange) > 0.01)\n\t\t\t{\n\t\t\t\t// give a bunch of weight (see TargetReport) based on closesness to guessedRange\n\t\t\t\ttarget.addScoreFromDistance(guessedRange, targetRange);\n\t\t\t\t\n\t\t\t\t// highly prioritize a target close to a guess (this basically overrides the above line...)\n\t\t\t\tif (Math.abs(guessedRange - targetRange) < GUESS_ACCURACY_TOLERANCE)\n\t\t\t\t{\n\t\t\t\t\tbestTarget = target;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// if a target is better than the best, it's now the best\n\t\t\tif (target.getCumulativeScore() > bestScore)\n\t\t\t{\n\t\t\t\tbestTarget = target;\n\t\t\t\tbestScore = target.getCumulativeScore();\n\t\t\t}\n\t\t}\n\t\tallTargets.clear(); // we thought this might have been taking up too much memory, so we cleared it once we were done with it. (It wasn't the issue)\n\t\t\n\t\t// determine if in launcher range to target and set notification based on this\n\t\tcurrentRangeToBestTarget = getRangeToBestTarget();\n\t\tif (Robot.launcherWheels.inRange(currentRangeToBestTarget))\n\t\t\tRobot.launcherstatus.setInRange();\n\t\telse\n\t\t\tRobot.launcherstatus.setOutOfRange();\n\n\t\t// if we've found one, cache and return it\n\t\t// otherwise, return null (it will just default to the first value of bestTarget)\n\t\tcurrentBestTarget = bestTarget;\n\t\t\n\t\t// ALSO, report bestTarget to Driver station\n//\t\tsendBestTargetReport(); // Didn't work, see below\n\t\t\n// \tSystem.out.println(currentBestTarget);\n\t\t\n\t\treturn bestTarget;\n\t}", "public void setTarget(String newValue);", "@Override\n\tpublic void teleopInit() {\n\t\tif (autonomousCommand != null)\n\t\t\tautonomousCommand.cancel();\n\t\tisAutonomous = false;\n\t\tisTeleoperated = true;\n\t\tisEnabled = true;\n\t\ttry {\n\t\t\tdrivebase.initDriveBase(1);\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tRobot.numToSend = 3;\n\t}", "public void setTargetType(int targetType) {\n this.targetType = targetType;\n \n Ability ability = battleEvent.getAbility();\n \n switch ( targetType ) {\n case NORMAL_TARGET:\n case AE_CENTER:\n //targetSelfButton.setVisible(ability.can(\"TARGETSELF\"));\n noMoreTargetsButton.setVisible(false);\n noTargetButton.setVisible(false);\n \n break;\n case SKILL_TARGET:\n //targetSelfButton.setVisible(ability.can(\"TARGETSELF\"));\n noMoreTargetsButton.setVisible(false);\n noTargetButton.setVisible(false);\n \n break;\n case AE_TARGET:\n case AE_SELECTIVE_TARGET:\n case AE_NONSELECTIVE_TARGET:\n //targetSelfButton.setVisible(ability.can(\"TARGETSELF\"));\n noMoreTargetsButton.setVisible(true);\n if ( targetSelected == true ) {\n noMoreTargetsButton.setText( \"Remove Target\" );\n } else {\n noMoreTargetsButton.setText( \"No More Targets\" );\n }\n noTargetButton.setVisible(false);\n break;\n case KNOCKBACK_TARGET:\n //targetSelfButton.setVisible(false);\n noMoreTargetsButton.setVisible(false);\n noTargetButton.setVisible(true);\n break;\n case SECONDARY_TARGET:\n //targetSelfButton.setVisible(ability.can(\"TARGETSELF\"));\n \n if ( targetSelected == true ) {\n noMoreTargetsButton.setText( \"Remove Target\" );\n noMoreTargetsButton.setVisible(true);\n noTargetButton.setVisible(false);\n } else {\n noMoreTargetsButton.setVisible(false);\n noTargetButton.setVisible(true);\n }\n \n break;\n }\n }", "public boolean noTarget()\n\t{\n\t\treturn getAggroListRP().isEmpty();\n\t}", "public String getTarget() {\n return this.target;\n }", "public void LaunchTorpedo() {\r\n if(this.CurrentTorpedoCount > 0) {\r\n System.out.println(this.ModelNumber + \" is firing off a torpedo!\");\r\n this.CurrentTorpedoCount -= 1;\r\n } else {\r\n System.out.println(\"Torpedoes Expended\");\r\n }\r\n }", "public FirstPlayerPickCommand(int sender, int target, int playerID) {\n super(sender, target);\n players = null;\n picked = playerID;\n }", "@Override\n public void initDefaultCommand() {\n setDefaultCommand(new ValidTarget());\n }", "public void setTarget(double target)\n {\n setTarget(target, null);\n }", "public EntityID nextTarget(Set<StandardEntity> victims) {\n\n// Clustering clustering = this.moduleManager.getModule(SampleModuleKey.AMBULANCE_MODULE_CLUSTERING);\n\n// if (this.clusterIndex == -1) {\n this.clusterIndex = clustering.getClusterIndex(this.agentInfo.getID());\n// }\n\n\n Collection<StandardEntity> elements = clustering.getClusterEntities(this.clusterIndex);\n\n calculateMapCenters(this.clusterIndex, elements);\n\n\n targetsMap.clear();\n\n if (previousTarget != null && !victims.contains(worldInfo.getEntity(previousTarget.getVictimID()))) {\n previousTarget = null;\n }\n\n\n refreshTargetsMap(victims, targetsMap);\n\n calculateDecisionParameters(victims, targetsMap);\n\n calculateVictimsCostValue();\n\n\n AmbulanceTarget bestTarget = null;\n bestTarget = findBestVictim(targetsMap, elements);\n\n //considering inertia for the current target to prevent loop in target selection\n if (previousTarget != null && victims.contains(worldInfo.getEntity(previousTarget.getVictimID()))) {\n if (bestTarget != null && !bestTarget.getVictimID().equals(previousTarget.getVictimID())) {\n Human bestHuman = (Human) worldInfo.getEntity(bestTarget.getVictimID());\n Human previousHuman = (Human) worldInfo.getEntity(previousTarget.getVictimID());\n\n double bestHumanCost = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(bestHuman.getPosition()).calc().getDistance();\n double previousHumanCost = pathPlanning.setFrom(agentInfo.getPosition()).setDestination(previousHuman.getPosition()).calc().getDistance();\n if (previousHumanCost < bestHumanCost) {\n bestTarget = previousTarget;\n }\n }\n }\n\n previousTarget = bestTarget;\n\n if (bestTarget != null) {\n return bestTarget.getVictimID();\n } else {\n return null;\n }\n\n }", "public boolean hasTarget() { \n if (isReal) {\n return get(\"tv\") == 1; // cleaned return statement up\n } else {\n return hasTargetSim.getBoolean(false);\n }\n }", "public void setTargeted() {\n targeted ++;\n }", "public static void sendNormalMOTD(Player target) {\n boolean somethingSent = false;\n\n //Send motd title\n if (motd.has(\"title\")) {\n target.sendMessage(ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n somethingSent = true;\n }\n\n //Send priority messages\n if (motd.has(\"priority\")) {\n String[] priority = new String[motd.getJSONArray(\"priority\").length()];\n for (int i = 0; i < priority.length; i++) {\n priority[i] = ChatColor.GOLD + \" > \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i));\n }\n target.sendMessage(priority);\n somethingSent = true;\n }\n\n //send a few random daily's\n if (motd.has(\"normal\") && !motd.getJSONArray(\"normal\").isEmpty()) {\n Random r = new Random();\n int totalNormalMessages;\n\n if (motdNormalCount > motd.getJSONArray(\"normal\").length()) {\n totalNormalMessages = motd.getJSONArray(\"normal\").length();\n } else {\n totalNormalMessages = motdNormalCount;\n }\n\n String[] normalMessages = new String[totalNormalMessages];\n JSONArray used = new JSONArray();\n int itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n normalMessages[0] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n used.put(itemNum);\n\n for (int i = 1; i < totalNormalMessages; i++) {\n while (used.toList().contains(itemNum)) {\n itemNum = r.nextInt(motd.getJSONArray(\"normal\").length());\n }\n normalMessages[i] = ChatColor.GREEN + \" > \" + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(itemNum));\n }\n\n target.sendMessage(normalMessages);\n somethingSent = true;\n }\n\n }", "@Test\n\t\t\tpublic void testTargetOneStep()\n\t\t\t{\n\t\t\t\t//Test one step and check for the right space\n\t\t\t\tboard.calcTargets(0, 7, 1);\n\t\t\t\tSet<BoardCell> targets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(1, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(1, 7)));\n\n\t\t\t\t// Test one step near a door with the incorrect direction\n\t\t\t\tboard.calcTargets(13, 6, 1);\n\t\t\t\ttargets= board.getTargets();\n\t\t\t\tboard.clearTargets();\n\t\t\t\tassertEquals(3, targets.size());\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(14, 6)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 5)));\n\t\t\t\tassertTrue(targets.contains(board.getCellAt(13, 7)));\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tprotected void processTarget() {\n\r\n\t}", "@Override\r\n\tprotected void processTarget() {\n\r\n\t}", "public Mob getTarget() {\r\n return target.get();\r\n }", "public void startMovingToTarget() \r\n {\n movingToTarget = true;\r\n }", "public abstract boolean isTarget();", "public static void setTarget(GameWorld gw){\n\t\tif(game == null)\n\t\t\tgame = gw;\n\t}", "public void approachTargetWithVision() {\n final double STEER_P = 0.005; \n final double DRIVE_P = 0.05; \n final double DESIRED_TARGET_AREA = 4; // Area of the target when the robot reaches the wall\n final double MAX_DRIVE = 0.75; // Simple speed limit so we don't drive too fast\n final double STEER_I = 0.005;\n final double DRIVE_I = 0.0;\n final double STEER_D = 0.02;\n final double xError;\n final double aError;\n double DRIVE_INTEGRAL = 0;\n\n \n\n double tv = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tv\").getDouble(0);\n double tx = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tx\").getDouble(0);\n double ta = NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"ta\").getDouble(0);\n xError = tx;\n aError = (DESIRED_TARGET_AREA - ta);\n // SmartDashboard.putNumber(\"TA\", ta);\n // SmartDashboard.putNumber(\"TA Error\", aError);\n SmartDashboard.putNumber(\"TX Error\", xError);\n STEER_INTEGRAL = STEER_INTEGRAL + (xError*0.02);\n DRIVE_INTEGRAL = DRIVE_INTEGRAL + (aError * 0.02);\n STEER_DERIVATIVE = (xError - STEER_ERROR_PRIOR)/0.02;\n SmartDashboard.putNumber(\"Integral\", STEER_INTEGRAL);\n SmartDashboard.putNumber(\"Derivative\", STEER_DERIVATIVE);\n SmartDashboard.putNumber(\"TA\", ta);\n\n\n if (tv < 1.0) {\n m_LimelightHasValidTarget = false;\n drive_cmd = 0.0;\n steer_cmd = 0.0;\n } else {\n m_LimelightHasValidTarget = true;\n // Start with proportional steering\n steer_cmd = (xError * STEER_P) + (STEER_INTEGRAL * STEER_I) + (STEER_DERIVATIVE * STEER_D);\n\n // try to drive forward until the target area reaches our desired area\n drive_cmd = (aError * DRIVE_P) + (DRIVE_INTEGRAL * DRIVE_I);\n // don't let the robot drive too fast into the goal\n if (drive_cmd > MAX_DRIVE){\n drive_cmd = MAX_DRIVE;\n }\n }\n\n Robot.driveTrain.setLeftMotors(-drive_cmd - steer_cmd);\n Robot.driveTrain.setRightMotors(-drive_cmd + steer_cmd);\n\n STEER_ERROR_PRIOR = xError;\n\n }", "public static void sendMOTDEdit(Player target) {\n if (motd.has(\"title\")){\n target.sendMessage(ChatColor.GREEN + \" > MOTD Title: \" + ChatColor.translateAlternateColorCodes('&', motd.getString(\"title\")));\n }\n \n if (motd.has(\"priority\")) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.GOLD + \" Priority messages. These will always show to the player.\");\n for (int i = 0; i < motd.getJSONArray(\"priority\").length(); i++) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.AQUA + String.valueOf(i) + \" \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"priority\").getString(i)));\n }\n if (motd.has(\"normal\")) {\n target.sendMessage(ChatColor.GREEN + \"--------------------------------------------------\");\n }\n } else {\n target.sendMessage(ChatColor.GREEN + \" > There are no priority messages\");\n }\n\n if (motd.has(\"normal\")) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.GOLD + \" Normal messages. A random \" + motdNormalCount + \" will be show to players each time.\");\n for (int i = 0; i < motd.getJSONArray(\"normal\").length(); i++) {\n target.sendMessage(ChatColor.GREEN + \" > \" + ChatColor.AQUA + String.valueOf(i) + \" \" + ChatColor.translateAlternateColorCodes('&', motd.getJSONArray(\"normal\").getString(i)));\n }\n } else {\n target.sendMessage(ChatColor.GREEN + \" > There are no normal messages\");\n }\n }", "void gettingBackToInitial(){\n robot.setDrivetrainPosition(-hittingMineralDistance, \"translation\", 1.0);\n }", "State getTarget();", "@Override\n\tprotected void takeOff(){\n\t\tgvh.log.i(TAG, \"Drone taking off\");\n\t\tsetControlInput(0, 0, 0, 1);\n\t}", "java.lang.String getTarget();", "java.lang.String getTarget();", "private TrackingResult followTarget(Rect target)\n\t{\n\t\t// Clear any existing target rectangle.\n\t\tcamera.addTarget(null);\n\t\t\n\t\t// Outline the target being tracked.\n\t\tcamera.addTarget(target);\n\t\t\n\t\t// This is field of view size.\n\t\tSize imageSize = camera.getImageSize();\n\t\t\n\t\t// get size of target outline area.\n\t\tint targetArea = target.height * target.width;\n\t\t\n\t\t// If we have just acquired target, record initial size. Size comparison\n\t\t// is how we determine distance to target.\n\t\t\n\t\tif (initialTargetArea == 0) initialTargetArea = targetArea;\n\t\t\n\t\t// Compute center point of target in the camera view image.\n\t\tint targetCenterX = target.x + target.width / 2;\n\t\tint imageCenterX = (int) (imageSize.width / 2);\n\t\t\n\t\t// offset minus indicates target is left of image center,\n\t\t// plus to the right. If target is left, drone needs to turn\n\t\t// left to center the target in the image which is a minus yaw value.\n\t\t\n\t\tint offset = targetCenterX - imageCenterX;\n\n\t\tlogger.fine(\"offset=\" + offset);\n\t\t\n\t\toffset *= .25;\t// Scale offset down;\n\t\t\n\t\t// Determine change in distance from last target acquisition.\n\t\t\n\t\tdouble distance = initialTargetArea - targetArea;\n\t\t\n\t\tlogger.fine(String.format(\"ia=%d ta=%d dist=%.0f\", initialTargetArea, targetArea, distance));\n\t\t\n\t\t//initialTargetArea = targetArea;\n\t\t\n\t\tdouble scaleFactor = 0.0;\n\t\t\n\t\t// If distance is small, call it good otherwise the drone\n\t\t// hunts back and forth. Value must be determined by testing.\n\t\t\n\t\tif (Math.abs(distance) < 2000.0) \n\t\t\tdistance = 0.0;\n\t\telse\n\t\t{\n\t\t\t// Scale distance change to a fwd/back movement value of 20% for flyRC command.\n\t\t\t// For some unknown reason, need more power to fly forward than back and even\n\t\t\t// with 30%, forward seems not reliable.\n\t\t\t// scaleFactor must be positive to preserve the sign of distance value.\n\t\t\t\n\t\t\tscaleFactor = 20.0 / Math.abs(distance);\n\t\t\n\t\t\tdistance = distance * scaleFactor;\n\t\t}\n\t\t\n\t\tlogger.fine(String.format(\"dist=%.1f fact=%f\", distance, scaleFactor));\n\t\t\n\t\treturn new TrackingResult(offset, (int) distance);\n\t}", "public void resetPIDF() {\n m_masterMotor.config_kP(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_P);\n m_masterMotor.config_kI(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_I);\n m_masterMotor.config_kD(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_D);\n m_masterMotor.config_kF(RobotMap.PID_PRIMARY_SLOT, RobotMap.LAUNCHER_F);\n }", "private void switchGprsDefautlSIM(long value) {\n\n\t\tif(value <0) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlong GprsValue = Settings.System.getLong(getContentResolver(),\n\t\t\t\tSettings.System.GPRS_CONNECTION_SIM_SETTING,\n\t\t\t\tSettings.System.DEFAULT_SIM_NOT_SET);\n\t\tif(value == GprsValue) {\n\t\t\treturn;\n\t\t}\t\t\n\t\tIntent intent = new Intent(Intent.ACTION_DATA_DEFAULT_SIM_CHANGED);\n\t\tintent.putExtra(\"simid\", value);\n\n\n\n\t\tmGprsTargSim = (value > 0) ? true : false;\n\n\t\tif (mGprsTargSim == true) {\n\t\t\tdealwithAttach();\n\t\t} else {\n\t\t\tdealwithDetach();\n\n\t\t}\n\n\t\tgetActivity().sendBroadcast(intent);\n\t}", "public void teleport(boolean penalty) { \n\t\tPublisher teleport_h = new Publisher(\"/ariac_human/go_home\", \"std_msgs/Bool\", bridge);\n\t\tif(penalty)\t\n\t\t\tteleport_h.publish(new Bool(true));\t\n\t\telse\n\t\t\tteleport_h.publish(new Bool(false));\t\n\n\t\t// Reset \"smart\" orientation variables\n\t\tlastHumanState_MsgT = System.currentTimeMillis();\n\t\tlastUnsafeD_MsgT = System.currentTimeMillis();\n\t\tpreviousDistance = 50.0;\n\t\tisAproximating = false;\n\t}", "private void setTargetServer(){\n mTargetServer = findViewById(R.id.network_scanner_host_edit_text);\n String ip = DefaultPreferences.getIp(this);\n if(ip != null) {\n mTargetServer.setText(ip);\n }\n\n mTargetServer.addTextChangedListener(new TextWatcher() {\n @Override\n public void beforeTextChanged(CharSequence s, int start, int count, int after) {\n\n }\n\n @Override\n public void onTextChanged(CharSequence s, int start, int before, int count) {\n DefaultPreferences.setIp(NetworkScannerActivity.this, s.toString());\n }\n\n @Override\n public void afterTextChanged(Editable s) {\n\n }\n });\n }", "public void registerTargets(){\n synchronized(targets){\n while(targets.size()>0){\n Target target= (Target) targets.removeFirst();\n try {\n target.socketChannel.register(selector,SelectionKey.OP_CONNECT,target);\n } catch (ClosedChannelException e) {\n// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n try {\n target.socketChannel.close();\n } catch (IOException e1) {\n e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n }\n target.failure=e;\n addFinishedTarget(target);\n }\n }\n }\n }", "String getTarget() {\r\n return this.target;\r\n }", "public void sendToWard(){\r\n\t\t//here is some code that we do not have access to\r\n\t}", "private void updateCurrentTarget(){\n switch (state){\n case States.DEAD:\n currentTarget = currentLocation;\n break;\n case States.FIGHT:\n if (targetEnemy != null)\n currentTarget = targetEnemy.getCurrentLocation();\n else\n currentTarget = targetBuilding.getLocation();\n break;\n case States.RETREAT:\n currentTarget = new Point(20,20);\n break;\n case States.LOSS:\n currentTarget = new Point(20,20);\n break;\n case States.WIN:\n currentTarget = village.getCenter();\n break;\n case States.IDLE:\n currentTarget = targetBuilding.getLocation();\n }\n }", "@Test\n public void testChooseLocalNode() {\n DatanodeDescriptor localNode = dataNodes[0];\n for (int i = 0; i < CHOOSE_TIMES; i++) {\n DatanodeStorageInfo[] targets =\n namenode.getNamesystem().getBlockManager().getBlockPlacementPolicy()\n .chooseTarget(FILE, 1, localNode,\n new ArrayList<DatanodeStorageInfo>(), false, null, BLOCK_SIZE,\n TestBlockStoragePolicy.DEFAULT_STORAGE_POLICY, null);\n Assert.assertEquals(1, targets.length);\n Assert.assertEquals(localNode, targets[0].getDatanodeDescriptor());\n }\n }", "public void setTargetid(Integer targetid) {\n this.targetid = targetid;\n }", "public void initDefaultCommand() {\n \tclaw = new DoubleSolenoid(RobotMap.CLAW_PNU_1, RobotMap.CLAW_PNU_2);\n \tpunch = new DoubleSolenoid(RobotMap.PUNCH_PNU_1, RobotMap.PUNCH_PNU_2);\n \t\n \tarm = new VictorSP(RobotMap.ARM_MOTOR);\n \t\n \tarmEncode = new Encoder(RobotMap.ARM_ENCODE_1, RobotMap.ARM_ENCODE_2);\n \t\n \t//armEncode.setPIDSourceType(PIDSourceType.kDisplacement);\n \tarmControl = new PIDController(0.01,0,0, armEncode, arm);\n \t\n }", "public static boolean hasTarget() {\n return NetworkTableInstance.getDefault().getTable(\"limelight\").getEntry(\"tv\").getDouble(0) == 0 ? false : true;\n }", "public Living getTarget();", "@Override\n public void init()\n {\n target.setAbsoluteTolerance(ANGLE_ABSOLUTE_TOLERANCE); // Configure the target's absolute tolerance\n /*\n Limit the speed on the target between these values to prevent overshooting and damage to motors\n Normally we would leave the output range without bounds because we wish for the end affector to reach the setpoint\n as fast as possible, in a constant time, which would mean having an output proportional to it's error, but in this case\n We don't care how long it takes to reach its target, we just want it to get there in one piece */\n //System.out.println(\"INITIALIZING PID CONTROL\");\n target.setOutputRange(-0.15, 0.15);\n\n /* load percent control in because output is simply a percentage */\n target.loadLeftController(\"percent\");\n target.loadRightController(\"percent\");\n }" ]
[ "0.64216167", "0.60817415", "0.59165686", "0.59057796", "0.58678865", "0.58304745", "0.58222", "0.5799163", "0.5778183", "0.57399714", "0.57225585", "0.57215613", "0.5709646", "0.5617461", "0.5583321", "0.55695", "0.5546031", "0.5541782", "0.552193", "0.55169946", "0.55160797", "0.5515013", "0.54764795", "0.54592365", "0.545723", "0.5451159", "0.54330736", "0.5426247", "0.5404052", "0.54039764", "0.5396629", "0.5393589", "0.5393589", "0.53861016", "0.5356399", "0.534652", "0.53432375", "0.5320296", "0.5320296", "0.5310841", "0.53061163", "0.5303756", "0.53020924", "0.5296463", "0.5294258", "0.52838004", "0.5266324", "0.5266188", "0.5264832", "0.52637184", "0.5240463", "0.5239686", "0.52386075", "0.52343297", "0.5233145", "0.52190405", "0.5216352", "0.5214133", "0.52119076", "0.5207129", "0.5201089", "0.51884925", "0.5179594", "0.51769114", "0.5173259", "0.5170251", "0.5168736", "0.51582634", "0.5156511", "0.51553", "0.5150135", "0.5147863", "0.51463467", "0.51463467", "0.5146154", "0.513751", "0.5137351", "0.5123145", "0.5122416", "0.5122267", "0.50959635", "0.5090454", "0.50841284", "0.508343", "0.508343", "0.5071243", "0.50659376", "0.5063419", "0.50625527", "0.5056132", "0.5046718", "0.5046081", "0.5041072", "0.504066", "0.5038805", "0.5036563", "0.50357944", "0.5031867", "0.5028708", "0.50262916" ]
0.6381652
1
clear all non saved settings
@Override protected final void onDisconnected() { mPilotingItf.cancelSettingsRollbacks() .resetLocation() .updateCurrentTarget(ReturnHomePilotingItf.Target.TAKE_OFF_POSITION) .updateGpsFixedOnTakeOff(false); if (!isPersisted()) { mPilotingItf.unpublish(); } super.onDisconnected(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void clearAllPreference() {\n editor.clear();\n editor.apply();\n }", "public static void clear(){\n preferences.edit().clear().apply();\n }", "public void clearAllPreferenceData() {\n sharedPreferences.edit().clear().apply();\n }", "public void clearPrefs() {\n getSharedPreferencesEditor().clear().apply();\n }", "public static void clearAllPreferences(Context context){\n SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);\n SharedPreferences.Editor editor = preferences.edit();\n editor.clear();\n editor.commit();\n }", "public void flushSettings() {\n prefs.putBoolean(\"noWalls\", noWalls);\n prefs.putBoolean(\"noGrid\", noGrid);\n\n prefs.flush();\n }", "@Override\r\n protected void clearSettings() {\r\n \r\n mfile = null;\r\n rmode = null;\r\n cmap = null;\r\n cmapMin = 0.0f;\r\n cmapMax = 0.0f;\r\n super.clearSettings();\r\n \r\n }", "public void clearForTesting() {\n mPreferences.edit().clear().apply();\n }", "private static void clear() {\n Context context = Leanplum.getContext();\n if (context != null) {\n SharedPreferences.Editor editor = context.getSharedPreferences(\n \"__leanplum__\", Context.MODE_PRIVATE).edit();\n if (editor != null) {\n editor.clear();\n editor.apply();\n }\n\n editor = context.getSharedPreferences(\"__leanplum_push__\", Context.MODE_PRIVATE).edit();\n if (editor != null) {\n editor.clear();\n editor.apply();\n }\n }\n }", "public static void reset() {\n prefs().edit()\n .remove(PREFKEY_USER_ID)\n .remove(PREFKEY_READER_TAG)\n .remove(PREFKEY_READER_RECOMMENDED_OFFSET)\n .remove(PREFKEY_READER_SUBS_PAGE_TITLE)\n .commit();\n }", "public static void clearCache() {\r\n\t\tsInstance.mSettings.clear();\r\n\t}", "public void reset() {\r\n properties.clear();\r\n }", "static void clearCache() {\n CONFIG_VALUES = null;\n RUN_MODE = null;\n }", "public void resetValues() {\n SharedPreferences.Editor editor = sharedPreferences.edit();\n editor.putString(CUREDIFFICULTY, null);\n editor.putInt(CURETARGETSCORE, 0);\n editor.putInt(CURRSCOREFINDCURE, 0);\n editor.apply();\n System.out.println(sharedPreferences.getAll());\n\n }", "public static void clearAllSavedUserData() {\n cacheUser = null;\n cacheAccessToken = null;\n getSharedPreferences().edit().clear().commit();\n }", "@Override\n public void clearSharedPrefs() {\n\n }", "public void resetSettings()\n {\n PrintWriter writer;\n try\n {\n writer = new PrintWriter(new File(\"settings.txt\"));\n int[] r = {0,2,0,0};\n for(int x:r)\n writer.println(x);\n writer.close();\n }\n catch(IOException e)\n {}\n }", "void clearAll();", "void clearAll();", "public void clearAll();", "public void clearAll();", "public void clear() {\n helpers.clear();\n islandKeysCache.clear();\n setDirty();\n }", "public void removeAllEncodingSettings() {\r\n\t\tBase.removeAll(this.model, this.getResource(), ENCODINGSETTINGS);\r\n\t}", "private void resetAll() {\n resetResources();\n resetStory();\n refresh();\n }", "public static void clear() {\n SharedPrefWrapper sharedPref = SharedPrefWrapper.getInstance();\n sharedPref.clearWeiboPref();\n }", "public void resetAll() {\n reset(getAll());\n }", "public static void reset() {\n\t\tCAUGHT.clear();\n\t\tLOAD_CACHE.clear();\n\t}", "public static void reset() {\n if (mPreference == null)\n return ;\n\n Editor editor = mPreference.edit();\n editor.clear();\n editor.commit();\n }", "private void resetAll() {\n\t\tif(mu1 != null)\n\t\t\tmodel.getView().reset(mu1);\n\t\tmu1 = null;\n\t\t\n\t\tif(mu2 != null)\n\t\t\tmodel.getView().reset(mu2);\n\t\tmu2 = null;\n\t\t\n\t\tif(functionWord != null)\n\t\t\tmodel.getView().reset(functionWord);\n\t\tfunctionWord = null;\n\t\t\n\t\tmodel.getSGCreatingMenu().reset();\n\t}", "public static void clear() {\r\n for (ConfigurationOption<?> opt : OPTIONS.values()) {\r\n opt.clear();\r\n }\r\n }", "@Test\n public void testClear() {\n System.out.println(\"clear\");\n Setting s = Setting.factory();\n Setting s1 = Setting.factory();\n Setting s2 = Setting.factory();\n Setting s3 = Setting.getSetting(\"test1\");\n assertFalse(Setting.isNotUsed(\"test1\"));\n Setting s4 = Setting.getSetting(\"test1\");\n assertEquals(s3, s4);\n Setting.clear();\n assertTrue(Setting.isNotUsed(\"test1\"));\n\n }", "@Override\r\n\tpublic void clearALL() {\n\t\tjavaScriptWindow.propertyTable = null;\r\n\r\n\t}", "private void resetAll() {\n\t\trightHandNavPanel.clear();\n\t\tmainFlowPanel.clear();\n\t\tparameterNameTxtArea.setText(\"\");\n\t\tdefineNameTxtArea.setText(\"\");\n\t\tfuncNameTxtArea.setText(\"\");\n\t\t\n\t\tdefineAceEditor.setText(\"\");\n\t\tparameterAceEditor.setText(\"\");\n\t\tSystem.out.println(\" in resetAll doing setText\");\n\t\tcqlAceEditor.setText(\"\");\n\t\tfunctionBodyAceEditor.setText(\"\");\n\t\t\n\t\tviewParameterList.clear();\n\t\tviewDefinitions.clear();\n\t\tviewFunctions.clear();\n\t\t\n\t\tif (paramCollapse != null) {\n\t\t\tparamCollapse.clear();\n\t\t}\n\t\tif (defineCollapse != null) {\n\t\t\tdefineCollapse.clear();\n\t\t}\n\t\tif (functionCollapse != null) {\n\t\t\tfunctionCollapse.clear();\n\t\t}\n\t\t\n\t\tsetIsPageDirty(false);\n\t\tresetMessageDisplay();\n\t}", "void reset(){\n if (vars!=null){\n vars.clear();\n }\n if (gVars!=null){\n gVars.clear();\n }\n }", "public void clearSharedPreferences(){\n\n //clear user session data\n SharedPreferences.Editor editor = mSharedPreferences.edit();\n editor.clear();\n editor.apply();\n\n }", "void reset() {\n errors.clear();\n variables.clear();\n }", "@Override\n public void removeAllValues() {\n Map<String, ?> map = preferences.getAll();\n Iterator<String> iterator = map.keySet().iterator();\n while (iterator.hasNext()) {\n removeValue(iterator.next());\n }\n }", "private void clearSharedPreference() {\n //Instantiate SharedPreferences\n SharedPreferences.Editor editor = mSharedPreferences.edit();\n //clears all saved data in SharedPreferences with tag sm_tag\n editor.clear();\n editor.apply();\n }", "@Override\r\n\tpublic void clearAll() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void clearAll() {\n\t\t\r\n\t}", "public void reset() {\n\t\treset(ModSettings.currentContext);\n\t}", "public void reset() {\n\t\t//set everything back to normal\n\t\tHashMap<String, Component> components = gui.getConversionSettingsComponents();\n\t\tfor (String key: components.keySet()) {\n\t\t\tComponent component = components.get(key);\n\t\t\tcomponent.setEnabled(true);\n\t\t}\n\t}", "void clearValues() {\n percentMissing = \"-1\";\n PICValue = \"-1\";\n maf = \"-1\";\n phenoDataSummary = \"-1\";\n genoSummaryScript = sharedInformation.getWorkingDirectory() + scriptsRelativePath + dataSummaryScriptName;\n phenoSummaryScript = sharedInformation.getWorkingDirectory() + scriptsRelativePath + phenoSummaryScriptName;\n enginePath = sharedInformation.getWorkingDirectory() + rEngineRelativePath;\n }", "public static void ResetPreferences() throws Exception{\n File root = InstrumentationRegistry.getTargetContext().getFilesDir().getParentFile();\n String[] sharedPreferencesFileNames = new File(root, \"shared_prefs\").list();\n try{\n for (String fileName : sharedPreferencesFileNames) {\n InstrumentationRegistry.getTargetContext().getSharedPreferences(fileName.replace(\".xml\", \"\"), Context.MODE_PRIVATE).edit().clear().commit();\n }\n }\n catch (NullPointerException exp){}\n\n }", "private void clearEverything(){\n partTime.setSelected(false);\n fullTime.setSelected(false);\n management.setSelected(false);\n addIT.setSelected(false);\n addCS.setSelected(false);\n addECE.setSelected(false);\n dateAddText.clear();\n nameAddText.clear();\n hourlyAddText.clear();\n annualAddText.clear();\n managerRadio.setSelected(false);\n dHeadRadio.setSelected(false);\n directorRadio.setSelected(false);\n\n removeCS.setSelected(false);\n removeECE.setSelected(false);\n removeIT.setSelected(false);\n dateRemoveText.clear();\n nameRemoveText.clear();\n\n setCS.setSelected(false);\n setECE.setSelected(false);\n setIT.setSelected(false);\n dateSetText.clear();\n nameSetText.clear();\n hoursSetText.clear();\n\n }", "public void resetAll() {\n triggered = false;\n classBlacklist.clear();\n policies.clear();\n protectedFiles.clear();\n System.setSecurityManager(defaultSecurityManager);\n }", "@Override\n\tpublic void clearAll() {\n\t\t\n\t}", "public void clear() {\n\t\tString cmd = null;\n\t\ttry {\n\t\t\tif (System.getProperty(\"os.name\").startsWith(\"Windows\"))\n\t\t\t\tcmd = \"cls\";\n\t\t\telse\n\t\t\t\tcmd = \"clear\";\n\t\t\tRuntime.getRuntime().exec(cmd);\n\t\t} catch (Exception ignore) {\n\t\t}\n\t}", "private void clearAllState() {\n // Clear all layout records and views\n mLayoutRecords.clear();\n removeAllViews();\n\n // Reset to the top of the grid\n resetStateForGridTop();\n\n // Clear recycler because there could be different view types now\n mRecycler.clear();\n }", "private void resetSharedPreferences(){\n SharedPreferences.Editor editor = sharedPreferences.edit();\n editor.putString(getString(R.string.pref_genre_key), getString(R.string.pref_genre_any_value));\n editor.putString(getString(R.string.pref_earliest_year_key), getString(R.string.pref_earliest_year_default));\n editor.putString(getString(R.string.pref_latest_year_key), getString(R.string.pref_latest_year_default));\n // Commit the edits\n editor.apply();\n }", "public void deleteAll(){\n editor.clear();\n editor.apply();\n }", "protected void clear() {\r\n setValue(getDefault());\r\n }", "private void resetApp() {\n\t\tthis.panelTags.setVisible(false);\n\t\tthis.panelMenu.setVisible(true);\n\t\tthis.model.clear();\n\t\tthis.btnClearAll.doClick(0);\n\t\t// textDestination jest czyszczony osobno, po JOptionPane\n\t\t// this.textDestination.setText(null);\n\t\tthis.btnDeleteAll.setEnabled(false);\n\t\tthis.btnDelete.setEnabled(false);\n\t}", "public void clearAutoSaves() {\n List<BasePanel> panels = new ArrayList<BasePanel>();\n for (int i=0; i<frame.baseCount(); i++)\n panels.add(frame.baseAt(i));\n for (BasePanel panel : panels) {\n deleteAutoSaveFile(panel);\n }\n }", "public void clear()\n {\n keys.clear();\n comments.clear();\n data.clear();\n }", "protected void ClearData() {\n\t\t// TODO Auto-generated method stub\n\t\n\t\t sharedPreferences = this.getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);\n\t\t Editor editor = sharedPreferences.edit();\n\t\t if(sharedPreferences.contains(\"username\")||sharedPreferences.contains(\"password\")){\n\t\t\t editor.remove(\"username\");\n\t\t\t editor.remove(\"password\");\n\t\t }\n\t\t editor.clear();\n\t\t editor.commit();\n\t}", "private void clearAll(){\n ImplLogger.enterMethod(); \n pharmaNameTextField.setText(ImplConst.EMPTY);\n userNameTextField.setText(ImplConst.EMPTY);\n passwordField.setText(ImplConst.EMPTY);\n confirmPasswordField.setText(ImplConst.EMPTY);\n addressLine1TextField.setText(ImplConst.EMPTY);\n addressLine2TextField.setText(ImplConst.EMPTY);\n regionComboBox.setSelectedIndex(0);\n emailTextField.setText(ImplConst.EMPTY);\n contactTextField.setText(ImplConst.EMPTY);\n zipCodeTextField.setText(ImplConst.EMPTY);\n ImplLogger.exitMethod();\n }", "public void Clean()\n\t{\n\t\tstorage.clear();\n\t}", "public static void clearPreferences(Context context) {\n SharedPreferences.Editor editor = getSharedPreferences(context).edit();\n editor.clear();\n editor.apply();\n }", "@Override\n public void resetAllValues() {\n }", "public void unReset () {\n count = lastSave;\n }", "public void reset() {\n\t\tvar.clear();\n\t\tname.clear();\n\t}", "public void clearAll() {\n bikeName = \"\";\n bikeDescription = \"\";\n bikePrice = \"\";\n street = \"\";\n zipcode = \"\";\n city = \"\";\n bikeImagePath = null;\n }", "public void clearAll() {\n mNetworkCapabilities = mTransportTypes = mUnwantedNetworkCapabilities = 0;\n mLinkUpBandwidthKbps = mLinkDownBandwidthKbps = LINK_BANDWIDTH_UNSPECIFIED;\n mNetworkSpecifier = null;\n mTransportInfo = null;\n mSignalStrength = SIGNAL_STRENGTH_UNSPECIFIED;\n mUids = null;\n mEstablishingVpnAppUid = INVALID_UID;\n mSSID = null;\n }", "public void clear () {\n\t\treset();\n\t}", "public void resetWorkspace() {\n //clear all pages and their drawers\n //clear all drawers and their content\n //clear all block and renderable block instances\n workspace.reset();\n //clear procedure output information\n ProcedureOutputManager.reset();\t//*****\n\n }", "private void clearRecord() {\n // Clearing current booking information from sharedPreference\n SharedPreferences.Editor editor = sharedpreferences.edit();\n editor.clear();\n editor.commit();\n shutdown();\n }", "protected void reset() {\n\t\tpush();\n\n\t\t// Clearen, en niet opnieuw aanmaken, om referenties elders\n\t\t// in het programma niet corrupt te maken !\n\t\tcurves.clear();\n\t\tselectedCurves.clear();\n\t\thooveredCurves.clear();\n\t\tselectedPoints.clear();\n\t\thooveredPoints.clear();\n\t\tselectionTool.clear();\n\t}", "@Override\n\tpublic void clear() {\n\n\t\tDisplay.findDisplay(uiThread).syncExec(new Runnable() {\n\n\t\t\tpublic void run() {\n\t\t\t\tclearInputs();\n\t\t\t\tsetDefaultValues();\n\t\t\t}\n\t\t});\n\n\t}", "public void reset(){\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm -r data/games_module\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"sed -i \\\"1s/.*/ \"+\"0\"+\" /\\\" data/winnings\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"sed -i \\\"1s/.*/ \"+\"175\"+\" /\\\" data/tts_speed\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/answered_questions\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/five_random_categories\");\n\t\tBashCmdUtil.bashCmdNoOutput(\"rm data/current_player\");\n\t\t_currentPlayer = null;\n\t\t_internationalUnlocked = false;\n\t\t_gamesData.clear();\n\t\t_fiveRandomCategories.clear();\n\t\tfor (int i= 0; i<5;i++) {\n\t\t\t_answeredQuestions[i]=0;\n\t\t}\n\t\tBashCmdUtil.bashCmdNoOutput(\"touch data/answered_questions\");\n\t\tinitialiseCategories();\n\t\ttry {\n\t\t\treadCategories();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tsetFiveRandomCategories();\n\t}", "private void reset() {\n\t\tfiles = new HashMap<>();\n\t\tparams = new HashMap<>();\n\t}", "public void reset () {\n lastSave = count;\n count = 0;\n }", "private static void cleanUpGlobalStateAndFileStore() {\n FileUtils.deleteDirectory(Paths.get(GLOBAL_STATE_DIR));\n }", "public void clearProperties(){\n\t\tcbDataType.setSelectedIndex(DT_INDEX_NONE);\n\t\tchkVisible.setValue(false);\n\t\tchkEnabled.setValue(false);\n\t\tchkLocked.setValue(false);\n\t\tchkRequired.setValue(false);\n\t\ttxtDefaultValue.setText(null);\n\t\ttxtHelpText.setText(null);\n\t\ttxtText.setText(null);\n\t\ttxtBinding.setText(null);\n\t\ttxtDescTemplate.setText(null);\n\t\ttxtCalculation.setText(null);\n\t\ttxtFormKey.setText(null);\n\t}", "public void resetAll() {\n this.mEntryAlias = null;\n this.mEntryUid = -1;\n this.mKeymasterAlgorithm = -1;\n this.mKeymasterPurposes = null;\n this.mKeymasterBlockModes = null;\n this.mKeymasterEncryptionPaddings = null;\n this.mKeymasterSignaturePaddings = null;\n this.mKeymasterDigests = null;\n this.mKeySizeBits = 0;\n this.mSpec = null;\n this.mRSAPublicExponent = null;\n this.mEncryptionAtRestRequired = false;\n this.mRng = null;\n this.mKeyStore = null;\n }", "public void clear() {\n\t\tconfigurationToButtonMap.clear();\n\t\tselected.clear();\n\t\tsuper.removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public static void removeAll() {\n\t\tgetPersistence().removeAll();\n\t}", "public void resetAll() {\r\n for (PropertyChangeListener pcl : pcs.getPropertyChangeListeners()) {\r\n pcs.removePropertyChangeListener(pcl);\r\n }\r\n GameInfo.getInstance().init();\r\n MazeMap.getInstance().init();\r\n addListener(Constants.MAZE, MazeMap.getInstance());\r\n addListener(Constants.GAMEINFO, GameInfo.getInstance());\r\n PacMan pacMan = initPacMan();\r\n initGhosts(pacMan);\r\n }", "public void clearEditMode()\n\t{\n\t\tpromptTarget = \"\";\n\t\tpromptType = \"\";\n\t\tcs = lastCs;\n\t}", "@SneakyThrows\n public void deleteKeysFromMemory() {\n Preferences.userRoot().clear();\n }", "public void clearTheGame() {\n players.clear();\n categories.clear();\n playedRounds = 0;\n indexOfActiveCategory = -1;\n indexOfActivePlayer = 0;\n numberOfRounds = 0;\n }", "private void clear() {\n\t\t\tkeySet.clear();\n\t\t\tvalueSet.clear();\n\t\t\tsize = 0;\n\t\t}", "private void clearAllUi() {\n /* Clear notification fields. */\n mTxtAuthentication.setText(R.string.noData);\n\n /* Clear card reader's response fields. */\n clearResponseUi();\n }", "public void clean() {\n coffeeMachine.setDefaultCupsBeforeClean();\n }", "public void reset() {\n mHsConfig = null;\n mLoginRestClient = null;\n mThirdPidRestClient = null;\n mProfileRestClient = null;\n mRegistrationResponse = null;\n\n mSupportedStages.clear();\n mRequiredStages.clear();\n mOptionalStages.clear();\n\n mUsername = null;\n mPassword = null;\n mEmail = null;\n mPhoneNumber = null;\n mCaptchaResponse = null;\n mTermsApproved = false;\n\n mShowThreePidWarning = false;\n mDoesRequireIdentityServer = false;\n }", "public void clearStorage();", "public void clearAll() {\n\t\tuserMap.clear();\n\t}", "@VisibleForTesting\n void clear() {\n try {\n configStore.delete(NamespaceId.SYSTEM.getNamespace(), TYPE, NAME);\n } catch (ConfigNotFoundException e) {\n // does not matter, ignore it\n }\n }", "public void clearAllNotClientCacheKeyOrDatabaseKey() {\n\t}", "public void reset() {\n this.displayHasContent = false;\n this.obscured = false;\n this.syswin = false;\n this.preferredRefreshRate = 0.0f;\n this.preferredModeId = 0;\n }", "@Override\n public void clearAllRegistrations()\n {\n writeRegistryStoreProperties(null);\n }", "public void reset() {\r\n availableOptionsModel.getObject().clear();\r\n selectedOptionsModel.getObject().clear();\r\n paletteForm.visitChildren(FormComponent.class, new IVisitor<Component>() {\r\n @Override\r\n public Object component(Component component) {\r\n ((FormComponent<?>) component).clearInput();\r\n return Component.IVisitor.CONTINUE_TRAVERSAL;\r\n }\r\n });\r\n paletteForm.getModelObject().setSearchString(\"\");\r\n }" ]
[ "0.79590803", "0.78890544", "0.76916397", "0.7515536", "0.74430597", "0.7371896", "0.7333781", "0.73171586", "0.7271661", "0.7106934", "0.71051604", "0.7040877", "0.7038106", "0.6960179", "0.69399947", "0.6930359", "0.69221324", "0.689571", "0.689571", "0.6872853", "0.6872853", "0.6868703", "0.68052936", "0.67939246", "0.67825407", "0.67731005", "0.6767001", "0.6752043", "0.673486", "0.6719208", "0.6715029", "0.668407", "0.6673991", "0.66601", "0.6655647", "0.6652687", "0.6651582", "0.6631299", "0.6627018", "0.6627018", "0.66100174", "0.65916604", "0.6586473", "0.6571998", "0.6559423", "0.6536145", "0.6528417", "0.65183216", "0.65155494", "0.65152776", "0.6509385", "0.6492411", "0.6471421", "0.6468639", "0.6464762", "0.6461339", "0.6451332", "0.6441133", "0.64400625", "0.64215094", "0.6406337", "0.64029807", "0.6389064", "0.6388281", "0.63827425", "0.63736874", "0.63724667", "0.63686395", "0.63565177", "0.6348852", "0.6346019", "0.63440686", "0.63326263", "0.6331749", "0.63309467", "0.63293", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6325154", "0.6323643", "0.6320757", "0.6312587", "0.6309525", "0.6308575", "0.63084567", "0.62916005", "0.62892294", "0.62888414", "0.62857336", "0.62751013", "0.627498", "0.6270251", "0.62681586", "0.62670666" ]
0.0
-1
Loads presets and settings from persistent storage and updates the component accordingly.
private void loadPersistedData() { IntegerRange storedAutoStartOnDisconnectDelayRange = AUTOSTART_ON_DISCONNECT_DELAY_RANGE_SETTING.load(mDeviceDict); if (storedAutoStartOnDisconnectDelayRange != null) { mPilotingItf.getAutoStartOnDisconnectDelay().updateBounds(storedAutoStartOnDisconnectDelayRange); } DoubleRange endingHoveringAltitudeRange = ENDING_HOVERING_ALTITUDE_RANGE_SETTING.load(mDeviceDict); if (endingHoveringAltitudeRange != null) { mPilotingItf.getEndingHoveringAltitude().updateBounds(endingHoveringAltitudeRange); } DoubleRange minAltitudeRange = MIN_ALTITUDE_RANGE_SETTING.load(mDeviceDict); if (minAltitudeRange != null) { mPilotingItf.getMinAltitude().updateBounds(minAltitudeRange); } applyPresets(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void loadPersistence() {\n\t\tFile file = new File(\"data.txt\");\n\t\tif (file.length() == 0) { // no persistent data to use\n\t\t\treturn;\n\t\t}\n\t\tdeserializeFile(file);\n\t\tloadPersistentSettings();\n\t}", "public void loadPersistencePreferences() {\n SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);\n boolean persistent = sharedPreferences.getBoolean(\"TileCachePersistence\", true);\n Log.v(TAG, \"Cache Size: \" + sharedPreferences.getInt(\"TileCacheSize\", MapsActivity.FILE_SYSTEM_CACHE_SIZE_DEFAULT)\n + \", Persistent: \" + persistent);\n int capacity = Math.min(sharedPreferences.getInt(\"TileCacheSize\", MapsActivity.FILE_SYSTEM_CACHE_SIZE_DEFAULT),\n MapsActivity.FILE_SYSTEM_CACHE_SIZE_MAX);\n TileCache fileSystemTileCache = this.mapView.getFileSystemTileCache();\n\n fileSystemTileCache.setPersistent(persistent);\n fileSystemTileCache.setCapacity(capacity);\n // text size\n String textScaleDefault = getString(R.string.preferences_text_scale_default);\n this.mapView.setTextScale(Float.parseFloat(sharedPreferences.getString(\"mapTextScale\", textScaleDefault)));\n }", "public void load()\n\t{\n\t\tfor(String s : playerData.getConfig().getKeys(false))\n\t\t{\n\t\t\tPlayerData pd = new PlayerData(playerData, s);\n\t\t\tpd.load();\n\t\t\tdataMap.put(s, pd);\n\t\t}\n\t}", "public void load () {\n hasSoundOn = preference.getBoolean(\"sound effect\", true);\n hasMusicOn = preference.getBoolean(\"background music\", true);\n soundVolume = MathUtils.clamp(preference.getFloat(\"sound volume\", 0.5f), 0.0f, 1.0f);\n musicVolume = MathUtils.clamp(preference.getFloat(\"music volume\", 0.5f), 0.0f, 1.0f);\n }", "public void load() {\n Boolean value = permanentStore.getBoolean(key);\n if (value != null) {\n set(value.booleanValue());\n log.info(\"Property \" + key + \" has the non-default value \" + value.booleanValue());\n } else {\n set(defaultValue);\n }\n }", "private void loadPreferences() {\n SharedPreferences sp = getSharedPreferences(MY_PREFS, MODE_PRIVATE);\n\n int entreeIndex = sp.getInt(\"entreeIndex\", 0);\n int drinkIndex = sp.getInt(\"drinkIndex\", 0);\n int dessertIndex = sp.getInt(\"dessertIndex\", 0);\n\n // Setting inputs from SharedPreferences\n spEntree.setSelection(entreeIndex);\n spDrink.setSelection(drinkIndex);\n spDessert.setSelection(dessertIndex);\n\n edtTxtEntreePrice.setText(alEntreePrices.get(entreeIndex));\n edtTxtDrinkPrice.setText(alDrinkPrices.get(drinkIndex));\n edtTxtDessertPrice.setText(alDessertPrices.get(dessertIndex));\n }", "public void updatePersistence() {\n\t\tFile file = new File(\"data.txt\");\n\t\tserializeToFile(file);\n\t\tupdatePersistentSettings();\n\t}", "public void loadFromLocalStorage() {\n\t\t\n\t}", "private void loadDatabaseSettings() {\r\n\r\n\t\tint dbID = BundleHelper.getIdScenarioResultForSetup();\r\n\t\tthis.getJTextFieldDatabaseID().setText(dbID + \"\");\r\n\t}", "private void loadState() {\n SharedPreferences prefs = getPreferences(MODE_PRIVATE);\n this._tally = prefs.getInt(\"count\", 0);\n }", "private void LoadSavedPreferences() {\n\t\tString value;\n\t\tSharedPreferences sharedPreferences = PreferenceManager\n\t\t\t\t.getDefaultSharedPreferences(this);\n\t\t// tab 3 ************************************************\n\t\tvalue = sharedPreferences.getString(\"tempSzad\", \"22\");\n\t\tettempSzad_.setText(value);\n\t\tvalue = sharedPreferences.getString(\"tempPmaxdop\", \"70\");\n\t\tettempPmaxdop_.setText(value);\n\t\tvalue = sharedPreferences.getString(\"tempZmaxdop\", \"22\");\n\t\tettempZmaxdop_.setText(value);\n\t\tvalue = sharedPreferences.getString(\"tempPumpaON\", \"50\");\n\t\tettempPumpaON_.setText(value);\n\n\t\t// tab 1 ************************************************\n\t\tvalue = sharedPreferences.getString(\"tv1\", \"20.20\");\n\t\ttvS1.setText(value);\n\t\tvalue = sharedPreferences.getString(\"tv2\", \"44.22\");\n\t\ttvS2.setText(value);\n\t\tvalue = sharedPreferences.getString(\"tv3\", \"19.22\");\n\t\ttvS3.setText(value);\n\t}", "public void load() {\r\n\t\t\r\n\t\t//-- Clean\r\n\t\tthis.repositories.clear();\r\n\t\t\r\n\t\tloadInternal();\r\n\t\tloadExternalRepositories();\r\n\t\t\r\n\t}", "private void load() {\n //Stopping all animations\n gameController.animGrid.cancelAnimations();\n\n for (int xx = 0; xx < gameController.grid.field.length; xx++) {\n for (int yy = 0; yy < gameController.grid.field[0].length; yy++) {\n int value = (int) SharedPreferenceUtil.get(this, xx + \"_\" + yy, -1);\n if (value > 0) {\n gameController.grid.field[xx][yy] = new Tile(xx, yy, value);\n } else if (value == 0) {\n gameController.grid.field[xx][yy] = null;\n }\n\n int undoValue = (int) SharedPreferenceUtil.get(this, SpConstant.UNDO_GRID + xx + \"_\" + yy, -1);\n if (undoValue > 0) {\n gameController.grid.undoField[xx][yy] = new Tile(xx, yy, undoValue);\n } else if (value == 0) {\n gameController.grid.undoField[xx][yy] = null;\n }\n }\n }\n\n gameController.currentScore = (int) SharedPreferenceUtil.get(this, SpConstant.SCORE, gameController.currentScore);\n gameController.historyHighScore = (int) SharedPreferenceUtil.get(this, SpConstant.HIGH_SCORE_TEMP, gameController.historyHighScore);\n gameController.lastScore = (int) SharedPreferenceUtil.get(this, SpConstant.UNDO_SCORE, gameController.lastScore);\n gameController.canUndo = (boolean) SharedPreferenceUtil.get(this, SpConstant.CAN_UNDO, gameController.canUndo);\n gameController.gameState = (int) SharedPreferenceUtil.get(this, SpConstant.GAME_STATE, gameController.gameState);\n gameController.lastGameState = (int) SharedPreferenceUtil.get(this, SpConstant.UNDO_GAME_STATE, gameController.lastGameState);\n gameController.isAudioEnabled = (boolean) SharedPreferenceUtil.get(this, SpConstant.AUDIO_ENABLED, gameController.isAudioEnabled);\n\n }", "private void loadPolicy() {\n loadSavedGlobalSetting();\n loadDefaultPolicy();\n loadSavedSetting();\n saveSetting();\n }", "private void loadSettings() {\n//\t\tSharedPreferences prefs = this.getSharedPreferences(Defs.PREFS_NAME, 0);\n//\t\t\n//\t\tString fileData = prefs.getString(Defs.PREFS_KEY_PREV_RATES_FILE, \"\");\n//\t\tLog.d(TAG, \"Loaded last \" + fileData);\n//\t\tif ( fileData.length() > 0 ) {\n//\t\t\tByteArrayInputStream bias = new ByteArrayInputStream(fileData.getBytes());\n//\t\t\t_oldRates = new ExchangeRate();\n//\t\t\tparseRates(bias, _oldRates);\n//\t\t}\n\t}", "private void load()\n {\n SharedPreferences sp = getActivity().getPreferences(Context.MODE_PRIVATE);\n if (sp.contains(\"passLength\") && passLenSB != null)\n passLenSB.setProgress(sp.getInt(\"passLength\", 0));\n\n if (sp.contains(\"minDigits\") && minDigSB != null)\n minDigSB.setProgress(sp.getInt(\"minDigits\", 0));\n\n for (int i=0; i<checkBoxes.size(); i++)\n {\n checkBoxes.get(i).setChecked(sp.getBoolean(\"chkbx\"+Integer.toString(i), false));\n if (checkBoxes.get(i).isChecked())\n runChkBxOption(i, checkBoxes.get(i), rootView, child); // this code makes app generate new pass each time\n\n }\n // this code will restore pass on rotation only\n if (savedInstanceState != null && savedInstanceState.containsKey(\"password\"))\n passTV.setText(colourCodePass(savedInstanceState.getString(\"password\")));\n }", "public void load() {\n handleLoad(false, false);\n }", "@Override\r\n\tpublic void load() {\n\t\ts.load();\r\n\r\n\t}", "public void reload(){\n\t\tplugin_configuration.load();\n\t\tflarf_configuration.load();\n\t\tmessages_configuration.load();\n\t\tstadiumlisting.load();\n\t}", "private void importState() {\n SpeakerManager s = new SpeakerManager();\n this.speakerManager = s.importState();\n\n RoomManager r = new RoomManager();\n this.roomManager = r.importState();\n\n OrganizerManager o = new OrganizerManager();\n this.organizerManager = o.importState();\n\n EventManager e = new EventManager();\n this.eventManager = e.importState();\n\n ChatManager c = new ChatManager();\n this.chatManager = c.importState();\n\n AttendeeManager a = new AttendeeManager();\n this.attendeeManager = a.importState();\n\n\n }", "private void setupSharedPreferences() {\n SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);\n\n //set the driver name and track variables using methods below, which are also called from onSharedPreferencesChanged\n setDriver(sharedPreferences);\n setTrack(sharedPreferences);\n }", "public void loadConfig(){\n this.saveDefaultConfig();\n //this.saveConfig();\n\n\n }", "private void loadData() {\n\t\tOptional<ServerData> loaded_data = dataSaver.load();\n\t\tif (loaded_data.isPresent()) {\n\t\t\tdata = loaded_data.get();\n\t\t} else {\n\t\t\tdata = new ServerData();\n\t\t}\n\t}", "private void loadPreferences() {\n\t\tXSharedPreferences prefApps = new XSharedPreferences(PACKAGE_NAME);\n\t\tprefApps.makeWorldReadable();\n\n\t\tthis.debugMode = prefApps.getBoolean(\"waze_audio_emphasis_debug\", false);\n }", "public void initAfterUnpersistence() {\n //From a legacy bundle\n if (sources == null) {\n sources = Misc.newList(getName());\n }\n super.initAfterUnpersistence();\n openData();\n }", "public void load() {\n }", "private void reloadData() {\n if (DataFile == null)\n DataFile = new File(dataFolder, DATAFILENAME);\n Data = YamlConfiguration.loadConfiguration(DataFile);\n }", "public void setup() {\n\t\tif(!plugin.getDataFolder().exists()) {\n\t\t\tplugin.getDataFolder().mkdir();\n\t\t}\n\n\t\t// Create main file\n\t\tString FileLocation = plugin.getDataFolder().toString() + File.separator + \"Storage\" + \".yml\";\n\t\tFile tmp = new File(FileLocation);\n\t\tstoragefile = tmp;\n\t\t// Check if file exists\n\t\tif (!storagefile.exists()) {\n\t\t\ttry {\n\t\t\t\tstoragefile.createNewFile();\n\t\t\t}catch(IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tBukkit.getServer().getConsoleSender().sendMessage(net.md_5.bungee.api.ChatColor.RED + \"Storage file unable to be created!\");\n\t\t\t}\n\t\t}\n\t\tstoragecfg = YamlConfiguration.loadConfiguration(storagefile);\n\t\tcreateStorageValues();\n\t}", "private void initializeStoreFromPersistedData() throws IOException\r\n {\r\n loadKeys();\r\n\r\n if (keyHash.isEmpty())\r\n {\r\n dataFile.reset();\r\n }\r\n else\r\n {\r\n final boolean isOk = checkKeyDataConsistency(false);\r\n if (!isOk)\r\n {\r\n keyHash.clear();\r\n keyFile.reset();\r\n dataFile.reset();\r\n log.warn(\"{0}: Corruption detected. Resetting data and keys files.\", logCacheName);\r\n }\r\n else\r\n {\r\n synchronized (this)\r\n {\r\n startupSize = keyHash.size();\r\n }\r\n }\r\n }\r\n }", "@Override\r\n\tprotected void initLoad() {\n\r\n\t}", "public void load() {\n\t}", "protected void updateFromTemplate() {\r\n try {\r\n if (templateList.getSelectedItem() != null) {\r\n getConfigurer().loadPropertiesFromFile((String) templateList.getSelectedItem());\r\n Iterator<PropertyInputPanel> it = propertyInputPanels.iterator();\r\n while (it.hasNext()) {\r\n PropertyInputPanel panel = it.next();\r\n \r\n Object currentValue = getConfigurer().getProperty(panel.getName());\r\n if (currentValue != null && panel.isEnabled()) {\r\n panel.setValue(currentValue);\r\n }\r\n \r\n }\r\n }\r\n } catch (ClassCastException e) {\r\n Util.debugMsg(\"Saved template has incompatible data, it will be ignored\");\r\n }\r\n }", "public void load() {\n updater.load(-1); // -1 because Guest ID doesn't matter.\n }", "public void reloadDataYaml() {\n\n if (!anyMetadataEnabled()) {\n metadataYaml = new YamlConfiguration();\n return;\n }\n if (!metadataFile.exists()) {\n try {\n Files.createFile(metadataFile.toPath());\n }\n catch (IOException ex) {\n getLogger().severe(\"Unable to create the metadata.yml file: \" + ex.getMessage());\n }\n }\n metadataYaml = YamlConfiguration.loadConfiguration(metadataFile);\n\n if (!getConfig().getBoolean(\"metadata.track-active-portal-counts\", false)) {\n metadataYaml.set(\"player-active-portal-counts\", null);\n }\n }", "void load() {\n String path = ModuleSettings.getConfigSetting(ReportBranding.MODULE_NAME, ReportBranding.AGENCY_LOGO_PATH_PROP);\n boolean useDefault = (path == null || path.isEmpty());\n defaultLogoRB.setSelected(useDefault);\n specifyLogoRB.setSelected(!useDefault);\n agencyLogoPathField.setEnabled(!useDefault);\n browseLogosButton.setEnabled(!useDefault);\n logFileCount.setText(String.valueOf(UserPreferences.getLogFileCount()));\n solrMaxHeapSpinner.setValue(UserPreferences.getMaxSolrVMSize());\n try {\n updateAgencyLogo(path);\n } catch (IOException ex) {\n logger.log(Level.WARNING, \"Error loading image from previously saved agency logo path\", ex);\n }\n if (memField.isEnabled()) {\n try {\n initialMemValue = Long.toString(getCurrentJvmMaxMemoryInGB());\n } catch (IOException ex) {\n logger.log(Level.SEVERE, \"Can't read current Jvm max memory setting from file\", ex);\n memField.setEnabled(false);\n }\n memField.setText(initialMemValue);\n }\n \n valid(); //ensure the error messages are up to date\n }", "@Override\r\n\tpublic void load() {\n\t}", "@Override\r\n\tprotected void load() {\n\t\t\r\n\t}", "public void loadSavedConfigsMap() {\n\t\tfinal File folder = new File(serializePath);\n\t\tlistFilesForFolder(folder);\n\t}", "private void loadPreferences() {\n SharedPreferences sp = getActivity().getSharedPreferences(SETTINGS, Context.MODE_PRIVATE );\n boolean lm = sp.getBoolean(getString(R.string.live_match), true);\n boolean ls = sp.getBoolean(getString(R.string.live_score), true);\n\n if(lm) live_match.setChecked(true);\n else live_match.setChecked(false);\n\n if(ls) live_score.setChecked(true);\n else live_score.setChecked(false);\n }", "public void preSaveInit() {\n persistentData.clear();\n for (int i = 0; i < getNumPoints(); i++) {\n persistentData.add(getPoint(i));\n }\n }", "public static void load() {\n for (DataSourceSwapper each : ServiceLoader.load(DataSourceSwapper.class)) {\n loadOneSwapper(each);\n }\n }", "@Override\r\n\tpublic void load() {\n\r\n\t}", "private void loadConfiguration() {\n // TODO Get schema key value from model and set to text field\n /*\n\t\t * if (!StringUtils.isBlank(schemaKey.getKeyValue())) {\n\t\t * schemaKeyTextField.setText(schemaKey.getKeyValue()); }\n\t\t */\n }", "private void loadData() {\n SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);\n String fromSymbols = sharedPreferences.getString(getString(R.string.cryto_key), getString(R.string.cryto_value));\n String toSymbols = sharedPreferences.getString(getString(R.string.currencies_key), getString(R.string.currencies_value));\n new FetchUrlTask().execute(fromSymbols, toSymbols);\n sharedPreferences.registerOnSharedPreferenceChangeListener(this);\n }", "@Override\n\tprotected void onResume() {\n\t\tsuper.onResume();\n\t\texecutor.execute(new Task(ReadingDataModel.Event.INIT_LOAD));\n\t\tinitBookNote();\n\t}", "private SettingsManager() {\r\n\t\tthis.loadSettings();\r\n\t}", "private void loadData() {\n //load general data\n Settings.loadSettings();\n\n this.spCrawlTimeout.setValue(Settings.CRAWL_TIMEOUT / 1000);\n this.spRetryPolicy.setValue(Settings.RETRY_POLICY);\n this.spRecrawlInterval.setValue(Settings.RECRAWL_TIME / 3600000);\n this.spRecrawlCheckTime.setValue(Settings.RECRAWL_CHECK_TIME / 60000);\n }", "public static void load()\n throws IOException, ClassNotFoundException {\n FileInputStream f_in = new\n FileInputStream (settingsFile);\n ObjectInputStream o_in = new\n ObjectInputStream(f_in);\n SettingsSaver loaded = (SettingsSaver) o_in.readObject();\n advModeUnlocked = loaded.set[0];\n LIM_NOTESPERLINE = loaded.set[1];\n LIM_96_MEASURES = loaded.set[2];\n LIM_VOLUME_LINE = loaded.set[3];\n LIM_LOWA = loaded.set[4];\n LIM_HIGHD = loaded.set[5];\n LOW_A_ON = loaded.set[6];\n NEG_TEMPO_FUN = loaded.set[7];\n LIM_TEMPO_GAPS = loaded.set[8];\n RESIZE_WIN = loaded.set[9];\n ADV_MODE = loaded.set[10];\n o_in.close();\n f_in.close();\n }", "public void onLoad()\n {\n saveDefaultConfig();\n\n // Get the lobby name\n chatManager = new ChatManager(this);\n lobby = getConfig().getString(\"lobby\");\n\n // Loading up needed classes\n worldManager = new WorldManager(this);\n\n boolean backupsFound = false;\n\n File backupDir = new File(getDataFolder(), \"backups\");\n if (!backupDir.exists()) {\n getLogger().info(\"No backup directory found; creating one now.\");\n getLogger().info(\"Place world folders you want to reset from in '.../plugins/SkyblockWarriors/backups'\");\n backupDir.mkdirs();\n } else {\n for (File backup : backupDir.listFiles()) {\n if ((backup.isDirectory()) && (backup.listFiles().length != 0)) {\n backupsFound = true;\n }\n }\n\n if (backupsFound) {\n getLogger().info(\"Found backup folder, attempting to reset the world..\");\n // Resetting the world\n worldManager.resetWorld();\n } else {\n if (!getConfig().getBoolean(\"arena-setup\") == false) {\n getLogger().info(\"The plugin should be setup, please copy the world into the backup folder\");\n getLogger().info(\"so the plugin can reset the world on each restart!\");\n }\n }\n }\n }", "@Override\n public void load() {\n }", "@Override\n public void load() {\n }", "public void refreshData(){ \n \t\tif(!mIsFirstRun){\n \t if(mDb == null) mDb = new Sqlite(this.getContext());\n \t if(!mDb.isOpen()) mDb.openRead();\n \t \n \t\t\tgetLoaderManager().restartLoader(0,null,this);\n \t\t}else mIsFirstRun = false;\n \t}", "private void loadData() {\n reminderData.loadDataFromSharedPreferences();\n reminderText.setText(reminderData.getNotificationText());\n timePicker.setMinute(reminderData.getMinutes());\n timePicker.setHour(reminderData.getHours());\n }", "public void postLoadProperties(){\n\ttry{\n\t \n\t switch (source){\n\t case \"heroku\":\n\t\tURL = new String(\"jdbc:postgresql://\" + host + \":\" + port + \"/\" + dbname + \"?sslmode=require&user=\" + user + \"&password=\" +password );\n\t\tbreak;\n\t case \"local\":\n\t\tURL = new String(\"jdbc:postgresql://\" + host + \"/\" + dbname);\n\t break;\n\t case \"elephantsql\":\n\t\n\t \tURL = new String(\"jdbc:postgresql://\" + host + \":\" + port + \"/\" + dbname + \"?user=\" + user + \"&password=\" +password + \"&SSL=true\" );\n\t\tbreak;\n\t}\n\t //\t LOGGER.info(\"URL: \" + URL);\n\n\tdbm = new DatabaseManager( this );\n\tif(authenticated){\n\t dbr = dbm.getDatabaseRetriever();\n\t dbi = dbm.getDatabaseInserter();\n\t dmf = new DialogMainFrame(this);\n\t}else{\n\t \tJOptionPane.showMessageDialog(null,\n\t\t\t \"Invalid username or password. Session terminated.\",\n\t\t\t\t \"Authentication Failure!\",\n\t\t\t JOptionPane.ERROR_MESSAGE);\n\t}\n\t}\n catch(SQLException sqle){\n\tLOGGER.info(\"SQL exception creating DatabaseManager: \" + sqle);\n }\n\t\n }", "public void UpdatePrefs()\r\n {\r\n \t\r\n \t// Data from the first name field is being stored into persistent storage\r\n \teditor.putString\r\n \t(\"name\", \r\n \tfNameField.getText()\r\n \t.toString());\r\n \t\r\n \t// Data from the last name field is being stored into persistent storage\r\n editor.putString\r\n (\"lName\",\r\n lNameField.getText()\r\n .toString());\r\n \r\n // Data from the phone number field is being stored into persistent storage\r\n editor.putString\r\n (\"phoneNum\"\r\n , phoneNumField.getText()\r\n .toString());\r\n \r\n // Data from the address field is being stored into persistent storage\r\n editor.putString\r\n (\"address\"\r\n , homeAddressField.getText()\r\n .toString());\r\n \r\n // Push all fields data to persistent storage forever\r\n editor.commit();\r\n }", "public abstract void initialSettings();", "private void loadSettings(){\n SharedPreferences sharedPreferences = getActivity().getSharedPreferences(SHARED_PREF, Context.MODE_PRIVATE);\n notificationSwtich = sharedPreferences.getBoolean(SWITCH, false);\n reminderOnOff.setChecked(notificationSwtich);\n }", "private void loadSettings() {\n \tLog.i(\"T4Y-Settings\", \"Load mobile settings\");\n \tmobileSettings = mainApplication.getMobileSettings();\n \t\n \t//update display\n autoSynchronizationCheckBox.setChecked(mobileSettings.isAllowAutoSynchronization());\n autoScanCheckBox.setChecked(mobileSettings.isAllowAutoScan());\n autoSMSNotificationCheckBox.setChecked(mobileSettings.isAllowAutoSMSNotification());\n }", "public void reload() {\n reloadConfig();\n loadConfiguration();\n }", "@Override\n protected void lazyLoad() {\n if (!isPrepared || !isVisible) {\n return;\n }\n initResumeInfo();\n }", "public void load() ;", "@PostConstruct\n\tpublic void loadProperties() {\n\t\tproperties.put(PropertyKey.TRANSLATION_FILE_STORE, \"C:\\\\development\\\\projects\\\\mega-translator\\\\store\");\n\t}", "protected void loadAll() {\n\t\ttry {\n\t\t\tloadGroups(this.folder, this.cls, this.cachedOnes);\n\t\t\t/*\n\t\t\t * we have to initialize the components\n\t\t\t */\n\t\t\tfor (Object obj : this.cachedOnes.values()) {\n\t\t\t\t((Component) obj).getReady();\n\t\t\t}\n\t\t\tTracer.trace(this.cachedOnes.size() + \" \" + this + \" loaded.\");\n\t\t} catch (Exception e) {\n\t\t\tthis.cachedOnes.clear();\n\t\t\tTracer.trace(\n\t\t\t\t\te,\n\t\t\t\t\tthis\n\t\t\t\t\t\t\t+ \" pre-loading failed. No component of this type is available till we successfully pre-load them again.\");\n\t\t}\n\t}", "private void manageLoaders() {\n\n // note: null is used in place of a Bundle object since all additional\n // parameters for Loader are global variables\n\n // get LoaderManager and initialise the loader\n if (getSupportLoaderManager().getLoader(LOADER_ID_01) == null) {\n getSupportLoaderManager().initLoader(LOADER_ID_01, null, this);\n } else {\n getSupportLoaderManager().restartLoader(LOADER_ID_01, null, this);\n }\n }", "private void getDataFromSharedPrefernce() {\r\n\r\n\t\tprofileImageString = mSharedPreferences_reg.getString(\"ProfileImageString\",\"\");\r\n\t\tpsedoName = mSharedPreferences_reg.getString(\"PseudoName\", \"\");\r\n\t\tprofiledescription = mSharedPreferences_reg.getString(\"Pseudodescription\", \"\");\r\n\r\n\t\tsetDataToRespectiveFields();\r\n\t}", "private void loadDataFromDatabase() {\n mSwipeRefreshLayout.setRefreshing(true);\n mPresenter.loadDataFromDatabase();\n }", "public void load() throws IOException {\r\n File file = new File(this.filename);\r\n //if file exist.\r\n if (file.exists() && !file.isDirectory()) {\r\n ObjectInputStream is = null;\r\n try {\r\n //opening and reaind the source file\r\n is = new ObjectInputStream(new FileInputStream(this.filename));\r\n SettingsFile temp = (SettingsFile) is.readObject();\r\n //import the loaded file data to the current core.SettingsFile\r\n this.boardSize = temp.getBoardSize();\r\n this.firstPlayer = temp.getFirstPlayer();\r\n this.secondPlayer = temp.getSecondPlayer();\r\n this.player1Color = temp.getPlayer1Color();\r\n this.player2Color = temp.getPlayer2Color();\r\n } catch (IOException e) {\r\n System.out.println(\"Error while loading\");\r\n } catch (ClassNotFoundException e) {\r\n System.out.println(\"Problem with class\");\r\n } finally {\r\n if (is != null) {\r\n is.close();\r\n }\r\n }\r\n }\r\n //if no file, set default settings.\r\n else {\r\n save(SIZE, FIRST_PLAYER, SECOND_PLAYER, PLAYER1COLOR, PLAYER2COLOR);\r\n }\r\n }", "private void setupSharedPreferences() {\n SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);\n\n String aaString = sharedPreferences.getString(getString(R.string.pref_antalAktier_key), getString(R.string.pref_antalAktier_default));\n// float aaFloat = Float.parseFloat(aaString);\n editTextAntalAktier.setText(aaString);\n\n String kk = sharedPreferences.getString(getString(R.string.pref_koebskurs_key), getString(R.string.pref_koebskurs__default));\n editTextKoebskurs.setText(kk);\n\n String k = sharedPreferences.getString(getString(R.string.pref_kurtage_key), getString(R.string.pref_kurtage_default));\n editTextKurtage.setText(k);\n\n// float minSize = Float.parseFloat(sharedPreferences.getString(getString(R.string.pref_size_key),\n// getString(R.string.pref_size_default)));\n// mVisualizerView.setMinSizeScale(minSize);\n\n // Register the listener\n sharedPreferences.registerOnSharedPreferenceChangeListener(this);\n }", "protected void loadData()\n {\n }", "private void loadDefaultValues() {\n for (Map.Entry<EditText, Integer> e : mPrefKeys.entrySet()) {\n e.getKey().setText(Pref.getDefault(this, e.getValue()));\n }\n }", "@Override\n\tprotected void load() {\n\n\t}", "@Override\n\tprotected void load() {\n\n\t}", "private void applyPresets() {\n applyAutoTrigger(AUTO_TRIGGER_PRESET.load(mPresetDict));\n applyPreferredTarget(PREFERRED_TARGET_PRESET.load(mPresetDict));\n applyEndingBehavior(ENDING_BEHAVIOR_PRESET.load(mPresetDict));\n applyAutoStartOnDisconnectDelay(AUTOSTART_ON_DISCONNECT_DELAY_PRESET.load(mPresetDict));\n applyEndingHoveringAltitude(ENDING_HOVERING_ALTITUDE_PRESET.load(mPresetDict));\n applyMinAltitude(MIN_ALTITUDE_PRESET.load(mPresetDict));\n }", "@Override\r\n\tpublic void init() {\n\t\tint numOfItems = loader.getNumOfItems();\r\n\t\tsetStoreSize(numOfItems);\r\n\r\n\t\tfor (int i = 0; i < numOfItems; i++) {\r\n DrinksStoreItem item = (DrinksStoreItem) loader.getItem(i);\r\n\t\t\tStoreObject brand = item.getContent();\r\n\t\t\tStoreObject existingBrand = findObject(brand.getName());\r\n\t\t\tif (existingBrand != null) {\r\n\t\t\t item.setContent(existingBrand);\r\n\t\t\t}\r\n\t\t\taddItem(i, item);\t\r\n\t\t}\r\n\t}", "private void swapAndLoadData() {\n\n \tLog.d(Constants.TAG, \"EntryListActivity: swapAndLoadData: update last loaded data date\");\n \tSharedPreferences settings = getSharedPreferences(Preferences.PREFS_NAME, 0);\n\t\tSharedPreferences.Editor editor = settings.edit();\n\t editor.putLong(Preferences.PREF_KEY_LAST_LOADED_DATA_DATE, this.lastRefreshSuccessDate);\n\t editor.commit();\n\n\t\tLog.d(Constants.TAG, \"EntryListActivity: swapAndLoadData: swap data\");\n\t\t// TODO JGU #1: swap in background or UI thread\n\t\tLoadNewDataTask loadNewDataTask = new LoadNewDataTask(this);\n\t\tloadNewDataTask.execute();\n//\t\texecuteSwapping();\n\t\t///JGU #1\n\t}", "@Override\n protected void onResume() {\n super.onResume();\n loadData();\n }", "@Override\n protected void onResume() {\n super.onResume();\n loadData();\n }", "@SuppressLint(\"CommitPrefEdits\")\n @Override\n public void onLoadFinished(Loader<SharedPreferences> loader,\n SharedPreferences prefs) {\n }", "public static void load() {\n load(false);\n }", "@Override\n public void setLoadOnStartup(int los) {\n }", "private void load(){\n mJSonNotifications = getSharedPreferences(SHARED_DEFAULT_NOTIFICATIONS, MODE_PRIVATE);\n Gson gson = new Gson();\n String json = mJSonNotifications.getString(SHARED_DEFAULT_NOTIFICATIONS, null);\n Type type = new TypeToken<SearchPreferences>() {}.getType();\n mSearchPreferences = gson.fromJson(json, type);\n if (mSearchPreferences == null) mSearchPreferences = new SearchPreferences();\n mNotificationsFragment.updateFragmentData(mSearchPreferences);\n }", "private void readData() {\n // set the values from the stored data\n // initially these are not set, so we need to query for \"containsKey\"...\n if (isTrue(Variable.MAXTRACKS_ENABLED)) {\n jsMaxTracks.setEnabled(true);\n jcbMaxTracks.setSelected(true);\n } else {\n jsMaxTracks.setEnabled(false);\n jcbMaxTracks.setSelected(false);\n }\n if (data.containsKey(Variable.MAXTRACKS)) {\n jsMaxTracks.setValue((Integer) data.get(Variable.MAXTRACKS));\n }\n if (isTrue(Variable.MAXSIZE_ENABLED)) {\n jsMaxSize.setEnabled(true);\n jcbMaxSize.setSelected(true);\n } else {\n jsMaxSize.setEnabled(false);\n jcbMaxSize.setSelected(false);\n }\n if (data.containsKey(Variable.MAXSIZE)) {\n jsMaxSize.setValue((Integer) data.get(Variable.MAXSIZE));\n }\n if (isTrue(Variable.MAXLENGTH_ENABLED)) {\n jsMaxLength.setEnabled(true);\n jcbMaxLength.setSelected(true);\n } else {\n jsMaxLength.setEnabled(false);\n jcbMaxLength.setSelected(false);\n }\n if (data.containsKey(Variable.MAXLENGTH)) {\n jsMaxLength.setValue((Integer) data.get(Variable.MAXLENGTH));\n }\n if (isTrue(Variable.ONE_MEDIA_ENABLED)) {\n jcbMedia.setEnabled(true);\n jcbOneMedia.setSelected(true);\n jcbConvertMedia.setEnabled(true);\n } else {\n jcbMedia.setEnabled(false);\n jcbOneMedia.setSelected(false);\n jcbConvertMedia.setEnabled(false);\n }\n // Check if pacpl can be used, do it every time the dialog starts as the\n // user might have installed it by now\n boolean bPACPLAvailable = UtilPrepareParty.checkPACPL((String) data\n .get(Variable.CONVERT_COMMAND));\n if (!bPACPLAvailable) {\n // disable media conversion if pacpl is not found\n jcbConvertMedia.setEnabled(false);\n }\n // don't set Convert to on from data if PACPL became unavailable\n if (isTrue(Variable.CONVERT_MEDIA) && bPACPLAvailable) {\n jcbConvertMedia.setSelected(true);\n } else {\n jcbConvertMedia.setSelected(false);\n }\n if (data.containsKey(Variable.ONE_MEDIA)) {\n jcbMedia.setSelectedItem(data.get(Variable.ONE_MEDIA));\n } else {\n // default to MP3 initially\n jcbMedia.setSelectedItem(\"mp3\");\n }\n if (data.containsKey(Variable.RATING_LEVEL)) {\n jsRatingLevel.setValue((Integer) data.get(Variable.RATING_LEVEL));\n }\n if (isTrue(Variable.NORMALIZE_FILENAME)) {\n jcbNormalizeFilename.setSelected(true);\n } else {\n jcbNormalizeFilename.setSelected(false);\n }\n }", "void setupAppState() {\n // Attempt to load existing config\n app_state = new AppState();\n app_state.loadConfiguration();\n\n // Force user to select a folder where journal will be stored (if not selected already)\n if (!app_state.configurationExists()) {\n DirectoryChooser directory_chooser = new DirectoryChooser();\n directory_chooser.setTitle(\"Journal location\");\n\n // We have to use new window\n StackPane root = new StackPane();\n Stage stage = new Stage();\n stage.setTitle(\"New Stage Title\");\n stage.setScene(new Scene(root, 150, 150));\n\n File selected_directory = directory_chooser.showDialog(stage.getScene().getWindow());\n if (selected_directory != null) {\n Path dir = selected_directory.toPath();\n app_state.changeConfiguration(dir.toString(), \"Journal\");\n } else {\n Helpers.alertErrorExit(\"No journal directory was selected!\");\n }\n\n stage.close();\n }\n\n app_state.loadTree();\n TreeItem<FileTree> root = new TreeItem<>(app_state.file_tree);\n note_tree.setRoot(root);\n\n try {\n fillTreeView(root);\n } catch (IOException e) {\n Helpers.alertErrorExit(\"Couldn't load a note image!\");\n }\n }", "private void initializeModel() {\n\t\tmodel = new Model();\n\n\t\t// load up playersave\n\t\ttry {\n\t\t\tFileInputStream save = new FileInputStream(\"playersave.ser\");\n\t\t\tObjectInputStream in = new ObjectInputStream(save);\n\t\t\tmodel = ((Model) in.readObject());\n\t\t\tin.close();\n\t\t\tsave.close();\n\t\t\tSystem.out.println(\"playersave found. Loading file...\");\n\t\t}catch(IOException i) {\n\t\t\t//i.printStackTrace();\n\t\t\tSystem.out.println(\"playersave file not found, starting new game\");\n\t\t}catch(ClassNotFoundException c) {\n\t\t\tSystem.out.println(\"playersave not found\");\n\t\t\tc.printStackTrace();\n\t\t}\n\t\t\n\t\t// load up customlevels\n\t\ttry {\n\t\t\tFileInputStream fileIn = new FileInputStream(\"buildersave.ser\");\n\t\t\tObjectInputStream in = new ObjectInputStream(fileIn);\n\t\t\tmodel.importCustomLevels(((ArrayList<LevelModel>) in.readObject()));\n\t\t\tin.close();\n\t\t\tfileIn.close();\n\t\t\tSystem.out.println(\"Builder ArrayList<LevelModel> found. Loading file...\");\n\t\t}catch(IOException i) {\n\t\t\t//i.printStackTrace();\n\t\t\tSystem.out.println(\"Builder ArrayList<LevelModel> file not found, starting new game\");\n\t\t\treturn;\n\t\t}catch(ClassNotFoundException c) {\n\t\t\tSystem.out.println(\"Builder ArrayList<LevelModel> not found\");\n\t\t\tc.printStackTrace();\n\t\t\treturn;\n\t\t}\n\t}", "@Override\n\tprotected void load() {\n\t\t\n\t}", "@Override\n\tprotected void load() {\n\t\t\n\t}", "@Override\n\tprotected void load() {\n\t\t\n\t}", "private void load() {\r\n\t\tswitch (this.stepPanel.getStep()) {\r\n\t\tcase StepPanel.STEP_HOST_GRAPH:\r\n\t\t\tloadGraph(StepPanel.STEP_HOST_GRAPH);\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_STOP_GRAPH:\r\n\t\t\tloadGraph(StepPanel.STEP_STOP_GRAPH);\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_CRITICAL_PAIRS:\r\n\t\t\tloadPairs();\r\n\t\t\tbreak;\r\n\t\tcase StepPanel.STEP_FINISH:\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "public static void load() {\n }", "public void load();", "public void load();", "public void setLoaded();", "public void load() {\n theDataSet = getParent().getCurrentDataset();\n currentSession = getParent().getSession();\n\n airlineContainer.setOnKeyPressed(new EventHandler<KeyEvent>(){\n @Override\n public void handle(KeyEvent event) {\n if (event.getCode().equals(KeyCode.ENTER)){\n editAirline();\n }\n }\n });\n\n toEdit = theDataSet.getAirlineDictionary().get(currentSession.getAirlineToEdit());\n\n airlNameEdit.setText(toEdit.getName());\n airlAliasEdit.setText(toEdit.getAlias());\n airlIATAEdit.setText(toEdit.getIATA());\n airlICAOEdit.setText(toEdit.getICAO());\n airlCallsignEdit.setText(toEdit.getCallSign());\n airlCountryEdit.setText(toEdit.getCountryName());\n airlActiveEdit.setText(toEdit.getActive());\n }", "private void loadInfo() {\n fname.setText(prefs.getString(\"fname\", null));\n lname.setText(prefs.getString(\"lname\", null));\n email.setText(prefs.getString(\"email\", null));\n password.setText(prefs.getString(\"password\", null));\n spinner_curr.setSelection(prefs.getInt(\"curr\", 0));\n spinner_stock.setSelection(prefs.getInt(\"stock\", 0));\n last_mod_date.setText(\" \" + prefs.getString(\"date\", getString(R.string.na)));\n }", "@Override\n\tpublic void initData(Bundle savedInstanceState) {\n\t\t\n\t}", "private void loadLists() {\n loadSavedCourses();\n loadSavedSchedules();\n }", "private void setupData() {\n locale = Locale.getDefault();\n userUIPreferences.setAnimation(AnimationUtils.loadAnimation(context, R.anim.fadein));\n\n }", "public void reload() {\n try {\n this.configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(this.getConfigurationFile());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void refresh()\n {\n PropertyManager.getInstance().refresh();\n init(this.path);\n }", "@PostLoad\n private void settingsAfterLoad()\n {\n\n productInfo = pis != null && pis.size() > 0;\n\n /* [2] setup transient : type */\n\n boolean clIsTransfer = cluster.getName().equals(R.CLNAME_TRANSFER);\n boolean catransferIsNone = catransfer.getName().equals(R.CANAME_NONE);\n\n Assert.assertEquals(MSG_PREF + \"pivot iff cluster = \" + R.CLNAME_PIVOT,\n pivot, cluster.getName().equals(R.CLNAME_PIVOT));\n\n Assert.assertTrue(MSG_PREF + \"RULE: cl=\" + R.CLNAME_TRANSFER + \" ==> catransfer!=\" + R.CANAME_NONE\n + \"; GOT: \" + cluster + \", \" + catransfer + \"; clIsTransfer=\" + clIsTransfer\n + \" catransferIsNone=\" + catransferIsNone, !clIsTransfer || !catransferIsNone);\n\n if (pivot) type = TTransactionType.pivot;\n else if (clIsTransfer) type = TTransactionType.transfer;\n else type = TTransactionType.simple;\n // TODO TTransactionType.exchange\n\n }" ]
[ "0.6377637", "0.63066643", "0.6215089", "0.6182025", "0.60741085", "0.607336", "0.59204644", "0.5900078", "0.58560014", "0.5831507", "0.5777495", "0.57614976", "0.57288915", "0.5723361", "0.56949896", "0.5684401", "0.56780994", "0.5671554", "0.5648699", "0.5630907", "0.5611346", "0.5592918", "0.55910194", "0.5579251", "0.55792314", "0.55654716", "0.55615026", "0.5554459", "0.5547104", "0.5545131", "0.5543854", "0.5500091", "0.54985535", "0.5493434", "0.54844195", "0.54726607", "0.5471593", "0.547117", "0.5465344", "0.54624856", "0.5456375", "0.54392976", "0.5427727", "0.54128104", "0.54118305", "0.5398759", "0.5397564", "0.5388461", "0.53731966", "0.5363277", "0.53631675", "0.5359885", "0.53588635", "0.5325992", "0.53232825", "0.53189296", "0.53188217", "0.5314674", "0.5286262", "0.5278842", "0.5278494", "0.5277952", "0.5276237", "0.52701646", "0.52669525", "0.5261229", "0.5252817", "0.5250946", "0.5250405", "0.5239256", "0.5238808", "0.5238808", "0.52381414", "0.52365136", "0.5229763", "0.52277005", "0.52277005", "0.5226091", "0.52104235", "0.5205643", "0.5198101", "0.51980615", "0.5193548", "0.5193257", "0.51924133", "0.51924133", "0.51924133", "0.5191976", "0.517336", "0.5173261", "0.5173261", "0.5171299", "0.5167796", "0.5167252", "0.5166574", "0.5166015", "0.5160481", "0.5159266", "0.51579565", "0.5151385" ]
0.6498227
0
Applies component's persisted presets.
private void applyPresets() { applyAutoTrigger(AUTO_TRIGGER_PRESET.load(mPresetDict)); applyPreferredTarget(PREFERRED_TARGET_PRESET.load(mPresetDict)); applyEndingBehavior(ENDING_BEHAVIOR_PRESET.load(mPresetDict)); applyAutoStartOnDisconnectDelay(AUTOSTART_ON_DISCONNECT_DELAY_PRESET.load(mPresetDict)); applyEndingHoveringAltitude(ENDING_HOVERING_ALTITUDE_PRESET.load(mPresetDict)); applyMinAltitude(MIN_ALTITUDE_PRESET.load(mPresetDict)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void preProcessDataModel() {\r\n collectAllAttribtueDefinitions();\r\n\r\n for (AttributeDefinition attribute : dataModel.getAttributeDefinitions()) {\r\n attribute.setAttributeType(UINameToValueMap.get(attribute.getAttributeType()));\r\n }\r\n\r\n if (null != dataModel.getLocalSecondaryIndexes()) {\r\n for (LocalSecondaryIndex index : dataModel.getLocalSecondaryIndexes()) {\r\n index.getProjection().setProjectionType(UINameToValueMap.get(index.getProjection().getProjectionType()));\r\n }\r\n }\r\n\r\n if (null != dataModel.getGlobalSecondaryIndexes()) {\r\n for (GlobalSecondaryIndex index : dataModel.getGlobalSecondaryIndexes()) {\r\n index.getProjection().setProjectionType(UINameToValueMap.get(index.getProjection().getProjectionType()));\r\n }\r\n }\r\n }", "private void updatePrescaleService() {\n\t\ttableModel.updatePrescaleService(config);\n\t}", "private void applyRules () throws DataNormalizationException {\n\t\tapplyRules(null);\n\t}", "public void prepare() {\n this.shifts = new ArrayList<>();\n this.rates = new ArrayList<>();\n // bootstrap shifts and rates\n this.prepareShifts();\n this.prepareRates();\n }", "public void preprocess() {\n }", "public void preprocess() {\n }", "public void preprocess() {\n }", "public void preprocess() {\n }", "public void doPreSaveActions() {\n\t\tcalculateBlockedPartitions();\n\t}", "void applyChanges() {\n trainFunction.setAlias(txtAlias.getText());\n trainFunction.getConfiguration().setAddress(txtAddress.getValue());\n\n trainFunction.getConfiguration().setBit(selectBit.getSelected().orElse(null));\n }", "public void preSaveInit() {\n persistentData.clear();\n for (int i = 0; i < getNumPoints(); i++) {\n persistentData.add(getPoint(i));\n }\n }", "protected void loadAll() {\n\t\ttry {\n\t\t\tloadGroups(this.folder, this.cls, this.cachedOnes);\n\t\t\t/*\n\t\t\t * we have to initialize the components\n\t\t\t */\n\t\t\tfor (Object obj : this.cachedOnes.values()) {\n\t\t\t\t((Component) obj).getReady();\n\t\t\t}\n\t\t\tTracer.trace(this.cachedOnes.size() + \" \" + this + \" loaded.\");\n\t\t} catch (Exception e) {\n\t\t\tthis.cachedOnes.clear();\n\t\t\tTracer.trace(\n\t\t\t\t\te,\n\t\t\t\t\tthis\n\t\t\t\t\t\t\t+ \" pre-loading failed. No component of this type is available till we successfully pre-load them again.\");\n\t\t}\n\t}", "public void applyUpdates() {\r\n synchronized (visualItemMap) {\r\n adder.execute(parentGroup);\r\n for (VisualItem3D item : visualItemMap.values()) {\r\n item.applyTransform();\r\n }\r\n }\r\n }", "void restoreBefore() {\r\n\t\t\tsurface.basemap.clear();\r\n\t\t\tsurface.basemap.putAll(basemapBefore);\r\n\t\t\tsurface.buildingmap.clear();\r\n\t\t\tsurface.buildingmap.putAll(buildingmapBefore);\r\n\t\t\tsurface.features.clear();\r\n\t\t\tsurface.features.addAll(surfaceBefore);\r\n\t\t\tsurface.buildings.clear();\r\n\t\t\tsurface.buildings.addAll(buildingsBefore);\r\n\t\t}", "public void prepareModel() {\n //Since many models have different scale amplitudes, we calculate a uniform scale factor for the model\n setScaleFactor();\n //Since the 3ds file does not provide normal values, we must calculate them ourselves\n calculateNormals();\n //Finally we need to setup the buffers for drawing\n setupBuffers();\n }", "public void apply() {\n // apply general settings\n if (generalModeKeepRadioButton.isSelected()) {\n settings.getGeneralSettings().setMode(Mode.KEEP);\n } else if (generalModeUpdateRadioButton.isSelected()) {\n settings.getGeneralSettings().setMode(Mode.UPDATE);\n } else if (generalModeReplaceRadioButton.isSelected()) {\n settings.getGeneralSettings().setMode(Mode.REPLACE);\n }\n\n settings.getGeneralSettings().getLevels().clear();\n if (generalLevelTypeCheckbox.isSelected()) {\n settings.getGeneralSettings().getLevels().add(Level.TYPE);\n }\n if (generalLevelMethodCheckbox.isSelected()) {\n settings.getGeneralSettings().getLevels().add(Level.METHOD);\n }\n if (generalLevelFieldCheckbox.isSelected()) {\n settings.getGeneralSettings().getLevels().add(Level.FIELD);\n }\n\n settings.getGeneralSettings().getVisibilities().clear();\n if (generalVisibilityPublicCheckbox.isSelected()) {\n settings.getGeneralSettings().getVisibilities().add(Visibility.PUBLIC);\n }\n if (generalVisibilityProtectedCheckbox.isSelected()) {\n settings.getGeneralSettings().getVisibilities().add(Visibility.PROTECTED);\n }\n if (generalVisibilityDefaultCheckbox.isSelected()) {\n settings.getGeneralSettings().getVisibilities().add(Visibility.DEFAULT);\n }\n if (generalVisibilityPrivateCheckbox.isSelected()) {\n settings.getGeneralSettings().getVisibilities().add(Visibility.PRIVATE);\n }\n\n settings.getGeneralSettings().setOverriddenMethods(generalOtherOverriddenMethodsCheckbox.isSelected());\n settings.getGeneralSettings().setSplittedClassName(generalOtherSplittedClassName.isSelected());\n\n // apply templates settings\n settings.getTemplateSettings().setClassTemplates(classTemplatesTable.getSettings());\n settings.getTemplateSettings().setConstructorTemplates(constructorTemplatesTable.getSettings());\n settings.getTemplateSettings().setMethodTemplates(methodTemplatesTable.getSettings());\n settings.getTemplateSettings().setFieldTemplates(fieldTemplatesTable.getSettings());\n }", "public void restoreAssets() {\r\n for (int i=0; i<myMaterials.size(); i++) {\r\n materials.put(myMaterials.get(i), materialAmounts.get(i));\r\n }\r\n for (int i=0; i<myCurrencies.size(); i++) {\r\n currencies.put(myCurrencies.get(i), currencyAmounts.get(i));\r\n }\r\n }", "@PreUpdate\r\n public void preUpdate() {\r\n\r\n }", "@Override\n public void preprocess() {\n }", "public void postConstruct() {\n if(jc != null && jc.getJvmOptions() != null) {\n oldProps = new ArrayList<String>(jc.getJvmOptions()); //defensive copy\n \n oldAttrs = collectAttrs(jc);\n }\n }", "void applyMixims() {\n if (this.applied) {\n throw new IllegalStateException(\"Mixims already applied to target class \" + this.className);\n }\n this.applied = true;\n \n MiximApplicatorStandard applicator = this.createApplicator();\n applicator.apply(this.mixims);\n this.applySignature();\n this.upgradeMethods();\n this.checkMerges();\n }", "public void applySmartPrescale()\n {\n\tfor(int i=0;i<smartPrescaleTable.size();i++){\n\t VStringParameter parameterTriggerConditions = (VStringParameter)smartPrescaleTable.get(i).module.parameter(\"triggerConditions\");\n\t parameterTriggerConditions.setValue(\"\");\n\t for(int j=0;j<smartPrescaleTable.get(i).prescaleConditionCount();j++){\n\t\tString condition = smartPrescaleTable.get(i).prescaleCondition(j);\n\t\tif(!condition.equals(\"\")) {\n\t\t if ( (!smartPrescaleTable.get(i).simple(j))\n\t\t\t || (smartPrescaleTable.get(i).prescale(j) != 0) ) {\n\t\t\tparameterTriggerConditions.addValue(smartPrescaleTable.get(i).prescaleCondition(j));\n\t\t }\n\t\t}\n\t }\n\t}\n }", "@Override\n\tpublic void reset() {\n\t\tthis.prepare();\n\t\tsuper.reset();\n\t}", "private void loadRules() throws DataNormalizationException {\n\t\tloadRules(TableVersion.COMMITTED);\n\t}", "@Override\r\n\tprotected void doPre() {\n\t\t\r\n\t}", "@PostConstruct\n public void init() {\n for (final Stat stat: Stat.ALL_STATS) {\n effortValues.put(stat, new SimpleIntegerProperty(0));\n minIndividualValues.put(stat, new SimpleIntegerProperty(0));\n maxIndividualValues.put(stat, new SimpleIntegerProperty(31));\n if (!stat.equals(Stat.HP)) {\n minMinusIndividualValues.put(stat, new SimpleIntegerProperty(0));\n maxMinusIndividualValues.put(stat, new SimpleIntegerProperty(31));\n minNeutralIndividualValues.put(stat, new SimpleIntegerProperty(0));\n maxNeutralIndividualValues.put(stat, new SimpleIntegerProperty(31));\n minPlusIndividualValues.put(stat, new SimpleIntegerProperty(0));\n maxPlusIndividualValues.put(stat, new SimpleIntegerProperty(31));\n }\n\n }\n reset();\n }", "public void postInit() {\n }", "@Override public void postInit()\n\t\t{\n\t\t}", "public final void initializeModifyPhasesView() {\n resetViews();\n modifyPhaseSettingsView.initialize(phasesUI, skin);\n }", "@Override\r\n\tpublic void afterPropertiesSet() throws Exception {\n\t\tloadRules2();\r\n\t}", "public void convertAll() {\n try {\n updater.init(getUnitsToConvert());\n for (Converter converter : converters) {\n converter.convert(updater);\n }\n world.saveLevelDatIfNeeded();\n updater.complete();\n } catch (IOException e) {\n updater.failed(e);\n }\n }", "@Override\n public void preprocess() {\n }", "private GameStatePresets()\n {\n\n }", "@Override\n\tpublic void preUpdate() {\n\n\t}", "private void populateRenderableProcessors()\n {\n myProcessorsLock.readLock().lock();\n try\n {\n mySpecializedProcessorsLock.writeLock().lock();\n try\n {\n myRenderableGeometryProcessors.clear();\n myProjectionSensitiveProcessors.clear();\n for (final Entry<ProcessorDistributionKey, GeometryProcessor<? extends Geometry>> processorEntry : myGeometryProcessorsMap\n .entrySet())\n {\n if (processorEntry.getValue() instanceof RenderableGeometryProcessor)\n {\n myRenderableGeometryProcessors.put(processorEntry.getKey(),\n (RenderableGeometryProcessor<? extends Geometry>)processorEntry.getValue());\n }\n\n if (processorEntry.getValue().sensitiveToProjectionChanges())\n {\n myProjectionSensitiveProcessors.put(processorEntry.getKey(), processorEntry.getValue());\n }\n }\n myProjectionSyncManager.setProcessors(myProjectionSensitiveProcessors.values());\n }\n finally\n {\n mySpecializedProcessorsLock.writeLock().unlock();\n }\n }\n finally\n {\n myProcessorsLock.readLock().unlock();\n }\n }", "@Override\n public void preRun() {\n super.preRun();\n }", "public void refreshInputDependentState() {\n refreshItemSetChoices();\n validateUserAnswers();\n recalculateRequired();\n }", "public void setAllTransformable() {\n for (Iterator<TransformLayer> itr =tLayerPool.values().iterator(); itr.hasNext(); ) {\n TransformLayer layer = itr.next();\n layer.setAllTransformable();\n }\n }", "public void applyToPersistentDataHolder(Set<Component> components, PersistentDataHolder holder) {\n Component[] componentsArray = components.toArray(new Component[0]);\n\n holder.getPersistentDataContainer()\n .set(componentsKey, componentArrayTagType, componentsArray);\n\n holder.getPersistentDataContainer()\n .set(versionKey, PersistentDataType.LONG, GearyEntityFactory.ENTITY_VERSION);\n }", "private void loadPersistedData() {\n IntegerRange storedAutoStartOnDisconnectDelayRange =\n AUTOSTART_ON_DISCONNECT_DELAY_RANGE_SETTING.load(mDeviceDict);\n if (storedAutoStartOnDisconnectDelayRange != null) {\n mPilotingItf.getAutoStartOnDisconnectDelay().updateBounds(storedAutoStartOnDisconnectDelayRange);\n }\n\n DoubleRange endingHoveringAltitudeRange = ENDING_HOVERING_ALTITUDE_RANGE_SETTING.load(mDeviceDict);\n if (endingHoveringAltitudeRange != null) {\n mPilotingItf.getEndingHoveringAltitude().updateBounds(endingHoveringAltitudeRange);\n }\n\n DoubleRange minAltitudeRange = MIN_ALTITUDE_RANGE_SETTING.load(mDeviceDict);\n if (minAltitudeRange != null) {\n mPilotingItf.getMinAltitude().updateBounds(minAltitudeRange);\n }\n\n applyPresets();\n }", "protected void preRun() {\r\n\t\tthis.preparePairs();\r\n\t}", "private void loadDefaultValues() {\n for (Map.Entry<EditText, Integer> e : mPrefKeys.entrySet()) {\n e.getKey().setText(Pref.getDefault(this, e.getValue()));\n }\n }", "protected void prepareForEditing() {\n\teditingContainer.add(editingComponent);\n }", "@Parameterized.BeforeParam\n public static void restoreBefore() {\n OLD_DISPLAY_METRICS.setTo(getApplicationContext().getResources().getDisplayMetrics());\n getApplicationContext().getResources().getDisplayMetrics().setTo(DISPLAY_METRICS_FOR_TEST);\n }", "protected void applyMatrices () {\n combinedMatrix.set(projectionMatrix).mul(transformMatrix);\n getShader().setUniformMatrix(\"u_projTrans\", combinedMatrix);\n }", "protected void init() {\n currentState.bgColor = appliedState.bgColor = gc.getBackground();\n currentState.fgColor = appliedState.fgColor = gc.getForeground();\n currentState.font = appliedState.font = gc.getFont();\n currentState.lineAttributes = gc.getLineAttributes();\n appliedState.lineAttributes = clone(currentState.lineAttributes);\n currentState.graphicHints |= gc.getLineStyle();\n currentState.graphicHints |= gc.getAdvanced() ? ADVANCED_GRAPHICS_MASK\n : 0;\n currentState.graphicHints |= gc.getXORMode() ? XOR_MASK : 0;\n\n appliedState.graphicHints = currentState.graphicHints;\n\n currentState.relativeClip = new RectangleClipping(gc.getClipping());\n currentState.alpha = gc.getAlpha();\n }", "public void resetProbs() {\n\t\t// Set all probabilities to one.\n\t\tfor (T element : itemProbs_.keySet()) {\n\t\t\titemProbs_.put(element, 1.0 / itemProbs_.size());\n\t\t}\n\t\trebuildProbs_ = true;\n\t\tklSize_ = 0;\n\t}", "private void saveBeforeRun() {\n if ( _helper != null && _settings.getSaveBeforeRun() )\n _helper.saveBeforeRun();\n }", "@Override\n\tpublic void recalculate() {\n\t\tthis.constant = Convert.MapEntry.toBoolean(this.getAttributes(), \"constant\", false);\n\t\tfinal Object defaultObject = Base.getJava(this.getAttributes(), \"default\", null);\n\t\tif (defaultObject == null) {\n\t\t\tthis.defaultValue = null;\n\t\t} else {\n\t\t\tif (defaultObject instanceof Set<?>) {\n\t\t\t\tthis.defaultValue = (Set<?>) defaultObject;\n\t\t\t} else if (defaultObject instanceof Collection<?>) {\n\t\t\t\tthis.defaultValue = Create.tempSet((Collection<?>) defaultObject);\n\t\t\t} else if (defaultObject instanceof Object[]) {\n\t\t\t\tthis.defaultValue = Create.tempSet(Arrays.asList((Object[]) defaultObject));\n\t\t\t} else {\n\t\t\t\tfinal String defaultString = defaultObject.toString();\n\t\t\t\tif (defaultString.length() == 0) {\n\t\t\t\t\tthis.defaultValue = Create.tempSet();\n\t\t\t\t} else {\n\t\t\t\t\tthis.defaultValue = Create.tempSet(Arrays.asList((Object[]) defaultString.split(\",\")));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void prepare()\n\t{\n\t\tsuper.prepare();\n\t}", "public void reInitializeModels () {\n this.model = new ModelManager(getTypicalAddressBook(), new UserPrefs());\n this.expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs());\n }", "@Override\r\n\tpublic void apply(Component component) {\n\t\t\r\n\t}", "public void initAfterUnpersistence() {\n //From a legacy bundle\n if (sources == null) {\n sources = Misc.newList(getName());\n }\n super.initAfterUnpersistence();\n openData();\n }", "private void storComponentProperties(){\n\t\t//IPreferenceStore prefStore = JFacePreferences.getPreferenceStore();\n\t\t//PreferenceStore prefStore = mOyster2.getPreferenceStore();\n\t\tProperties mprop = mOyster2.getProperties();\n\t\tint count = mprop.getInteger(Constants.NUMBER_OF_COLUMNS);\n\t\tfor(int i=0; i<count; i++){\n\t\t\tmprop.setString(Constants.COLUMN_TYPE+i, mprop.getDefaultString(Constants.COLUMN_TYPE+i));\n\t\t\tmprop.setString(Constants.COLUMN_NAME+i, mprop.getDefaultString(Constants.COLUMN_NAME+i));\n\t\t\tmprop.setString(Constants.COLUMN_WIDTH+i, mprop.getDefaultString(Constants.COLUMN_WIDTH+i));\n\t\t\t/*\n\t\t\tprefStore.setToDefault(Constants.COLUMN_TYPE+i);\n\t\t\tprefStore.setToDefault(Constants.COLUMN_NAME+i);\n\t\t\tprefStore.setToDefault(Constants.COLUMN_WIDTH+i);\n\t\t\t*/\n\t\t}\n\t\tmprop.setString(Constants.NUMBER_OF_COLUMNS, \"\"+columns.size());\n\t\tfor(int i=0; i<columns.size(); i++){\n\t\t\tResultViewerColumnInfo colInf = getColumnInfo(i);\n\t\t\tmprop.setString(Constants.COLUMN_NAME + i, colInf.getColumnName());\n\t\t\tmprop.setString(Constants.COLUMN_TYPE + i, colInf.getColumnType());\n\t\t\tmprop.setString(Constants.COLUMN_WIDTH + i, \"\"+colInf.getWidth());\n\t\t}\n\t\ttry{\n\t\t\tmprop.storeOn();\n\t\t\t//prefStore.save();\n\t\t}\n\t\tcatch(Exception IO){\n\t\t\tSystem.out.println(\"couldnt save properties\");\n\t\t}\n\t\t\n\t}", "private void preGenerate() {\n if (specState.randomSeed) {\n long seed = random.nextLong();\n runOnUiThread(() -> seedInput.setText(getString(R.string.integer, seed)));\n }\n\n if (specState.randomColor) {\n runOnUiThread(() -> {\n hueInput.setProgress(random.nextInt(256));\n saturationInput.setProgress(random.nextInt(256));\n valueInput.setProgress(random.nextInt(256));\n });\n }\n\n updateSpecs(specState);\n updateColorPreview();\n\n if (specState.targetWidth != sprite.getWidth() || specState.targetHeight != sprite.getHeight()) {\n recreateBitmap();\n }\n }", "private void load() {\n //Stopping all animations\n gameController.animGrid.cancelAnimations();\n\n for (int xx = 0; xx < gameController.grid.field.length; xx++) {\n for (int yy = 0; yy < gameController.grid.field[0].length; yy++) {\n int value = (int) SharedPreferenceUtil.get(this, xx + \"_\" + yy, -1);\n if (value > 0) {\n gameController.grid.field[xx][yy] = new Tile(xx, yy, value);\n } else if (value == 0) {\n gameController.grid.field[xx][yy] = null;\n }\n\n int undoValue = (int) SharedPreferenceUtil.get(this, SpConstant.UNDO_GRID + xx + \"_\" + yy, -1);\n if (undoValue > 0) {\n gameController.grid.undoField[xx][yy] = new Tile(xx, yy, undoValue);\n } else if (value == 0) {\n gameController.grid.undoField[xx][yy] = null;\n }\n }\n }\n\n gameController.currentScore = (int) SharedPreferenceUtil.get(this, SpConstant.SCORE, gameController.currentScore);\n gameController.historyHighScore = (int) SharedPreferenceUtil.get(this, SpConstant.HIGH_SCORE_TEMP, gameController.historyHighScore);\n gameController.lastScore = (int) SharedPreferenceUtil.get(this, SpConstant.UNDO_SCORE, gameController.lastScore);\n gameController.canUndo = (boolean) SharedPreferenceUtil.get(this, SpConstant.CAN_UNDO, gameController.canUndo);\n gameController.gameState = (int) SharedPreferenceUtil.get(this, SpConstant.GAME_STATE, gameController.gameState);\n gameController.lastGameState = (int) SharedPreferenceUtil.get(this, SpConstant.UNDO_GAME_STATE, gameController.lastGameState);\n gameController.isAudioEnabled = (boolean) SharedPreferenceUtil.get(this, SpConstant.AUDIO_ENABLED, gameController.isAudioEnabled);\n\n }", "protected void apply() {\r\n\t\tplayer.setAutoRoll(autoroll);\r\n\t\tplayer.setMission(mission);\r\n\t\tplayer.setState(state);\r\n\t\tplayer.getCards().setArtillery(cards.getArtillery());\r\n\t\tplayer.getCards().setCavalry(cards.getCavalry());\r\n\t\tplayer.getCards().setInfantry(cards.getInfantry());\r\n\t\tplayer.getCards().setJokers(cards.getJokers());\r\n\t\tMember member = player.getMember();\r\n\t\tif(score == Score.WIN) {\r\n\t\t\tmember.setScore(member.getScore() + player.getGame().getPlayers().size() - 1);\r\n\t\t\tmember.setWins(member.getWins() + 1);\r\n\t\t} else if(score == Score.LOSS) {\r\n\t\t\tmember.setScore(member.getScore() - 1);\r\n\t\t\tmember.setLosses(member.getLosses() + 1);\r\n\t\t}\r\n\t}", "@PostConstruct\n public void initialization() {\n init();\n //setQuestionEditMode(true); //need to initialize question fields\n //addCurrentQuestionsToView(); //initialize view of questions\n //setQuestionEditMode(false);\n }", "@Override\r\n public void performInitialization(Object model) {\r\n super.performInitialization(model);\r\n richTable.setForceLocalJsonData(true);\r\n\r\n //init binding info\r\n if (bindingInfo != null) {\r\n bindingInfo.setDefaults(ViewLifecycle.getView(), getPropertyName());\r\n }\r\n \r\n List<? extends Component> items = getItems();\r\n \r\n ComponentUtils.clearAndAssignIds(items);\r\n\r\n //iterate over this collections items to initialize\r\n for (Component item : this.getItems()) {\r\n initialComponentIds.add(item.getId());\r\n\r\n //if data field, setup a forced placeholder value\r\n if (item instanceof DataField) {\r\n ((DataField) item).setForcedValue(VALUE_TOKEN + item.getId() + VALUE_TOKEN);\r\n }\r\n\r\n ///populate expression map\r\n expressionConversionMap = buildExpressionMap(item, expressionConversionMap);\r\n }\r\n }", "protected void applySettings() {\n af_.SIZE_FIRST = Double.parseDouble(sizeFirstField_.getText());\n af_.NUM_FIRST = Double.parseDouble(numFirstField_.getText());\n af_.SIZE_SECOND = Double.parseDouble(sizeSecondField_.getText());\n af_.NUM_SECOND = Double.parseDouble(numSecondField_.getText());\n af_.CROP_SIZE = Double.parseDouble(cropSizeField_.getText());\n af_.THRES = Double.parseDouble(thresField_.getText());\n af_.CHANNEL1 = channelField1_.getText();\n af_.CHANNEL2 = channelField2_.getText();\n }", "@SuppressWarnings(\"unchecked\")\n\tprivate void setRules() {\n\t\tthis.result = Result.START;\n\t\t// Create all initial rule executors, and shuffle them if needed.\n\t\tthis.rules = new LinkedList<>();\n\t\tModule module = getModule();\n\t\tfor (Rule rule : module.getRules()) {\n\t\t\tRuleStackExecutor executor = (RuleStackExecutor) getExecutor(rule, getSubstitution());\n\t\t\texecutor.setContext(module);\n\t\t\tthis.rules.add(executor);\n\t\t}\n\t\tif (getRuleOrder() == RuleEvaluationOrder.RANDOM || getRuleOrder() == RuleEvaluationOrder.RANDOMALL) {\n\t\t\tCollections.shuffle((List<RuleStackExecutor>) this.rules);\n\t\t}\n\t}", "@Override\n public void preSave(BigDataStructureContainer learnedParameters, MemoryConfiguration memoryConfiguration) {\n }", "@Override\n\tpublic void setAutomataChanges() {\n\t\tautomata.transformShapeToState(shapes);\n\t\tautomata.verifyAutomata();\n\t}", "protected void performApply() {\n\n for (int i = 0; i < providers.getItemCount(); i++) {\n\n //TODO: The checkboxes are buggy. Sometimes the provider in the table - representation\n // seems not to be the correct VilArgumentProvier.\n if (providers.getItem(i).getChecked()) {\n VilArgumentProvider.getProvider(i).setActive(true);\n } else {\n VilArgumentProvider.getProvider(i).setActive(false);\n }\n \n //the arguments are in column 4..\n try {\n //Set the free arguments\n VilArgumentProvider.getProvider(i).setFreeArguments(providers.getItem(i).getText(4).trim().toString());\n } catch (NullPointerException e) {\n VilArgumentProvider.getProvider(i).setFreeArguments(\"\");\n }\n \n EASyPreferenceStore.persistVilArgumentProviderStates();\n }\n }", "@Override\n\tprotected void prepareChangeSetProcessing() {\n\t\t// change set processing is not supported for the product associations import\n\t}", "public void apply(Component comp) {\n\t\tif (_vars != null && isEffective(comp)) {\n\t\t\tfinal Evaluator eval = getEvaluator();\n\t\t\tfor (Map.Entry<String, Object> me: _vars.entrySet()) {\n\t\t\t\tfinal String name = me.getKey();\n\t\t\t\tfinal Object value = me.getValue();\n\t\t\t\tcomp.getSpaceOwner().setAttribute(\n\t\t\t\t\tname, Utils.evaluateComposite(eval, comp, value), !_local);\n\t\t\t}\n\t\t}\n\t}", "private void postProcessPrefs(PrefSet prefSet)\n \t{\n \t\tif (sessionScope == null)\n \t\t\treturn;\n \t\tfor (Pref<?> pref : prefSet.values())\n \t\t\tif (pref != null)\n \t\t\t\tpref.postLoadHook(sessionScope);\n \t}", "public void updatePlacers() {\r\n\t\tplacers.addAll(rulePlacers);\r\n\t\trulePlacers.clear();\r\n\t}", "protected void preparePainting() {\n if (paintRegion == null) {\n prepareRegionProperties();\n prepareOption();\n }\n\n calculateCameraMatrix();\n }", "public void preCommitChanges() {\n if (onEditListener != null)\n onEditListener.onPreEdit();\n }", "public void finishSetup(){\n setupAllBackgroundColorViews();\n setupAllBorderColorViews();\n setupAllViewsToSetTextColor();\n setupAllSpecialLayoutViews();\n setupAllRegularDataViews();\n setupAllSpecialLayoutViewsToChangeBackgroundColor();\n }", "@Override\n\tpublic void afterPropertiesSet() throws Exception {\n\t\tinit();\n\t}", "@PostLoad\n private void settingsAfterLoad()\n {\n\n productInfo = pis != null && pis.size() > 0;\n\n /* [2] setup transient : type */\n\n boolean clIsTransfer = cluster.getName().equals(R.CLNAME_TRANSFER);\n boolean catransferIsNone = catransfer.getName().equals(R.CANAME_NONE);\n\n Assert.assertEquals(MSG_PREF + \"pivot iff cluster = \" + R.CLNAME_PIVOT,\n pivot, cluster.getName().equals(R.CLNAME_PIVOT));\n\n Assert.assertTrue(MSG_PREF + \"RULE: cl=\" + R.CLNAME_TRANSFER + \" ==> catransfer!=\" + R.CANAME_NONE\n + \"; GOT: \" + cluster + \", \" + catransfer + \"; clIsTransfer=\" + clIsTransfer\n + \" catransferIsNone=\" + catransferIsNone, !clIsTransfer || !catransferIsNone);\n\n if (pivot) type = TTransactionType.pivot;\n else if (clIsTransfer) type = TTransactionType.transfer;\n else type = TTransactionType.simple;\n // TODO TTransactionType.exchange\n\n }", "@Override\n\tprotected void performDefaults() {\n\t\tif (fields != null) {\n\t\t\tIterator<FieldEditor> e = fields.iterator();\n\t\t\twhile (e.hasNext()) {\n\t\t\t\tFieldEditor pe = e.next();\n\t\t\t\tpe.loadDefault();\n\t\t\t}\n\t\t}\n\t\t// Force a recalculation of my error state.\n\t\tcheckState();\n\t\tsuper.performDefaults();\n\t}", "public void applyChanges(PresentationEngine presentationEngine) {\n super.realize(presentationEngine);\n }", "public void afterPropertiesSet()\r\n/* 21: */ {\r\n/* 22:47 */ Collection<Cache> caches = loadCaches();\r\n/* 23:48 */ Assert.notEmpty(caches, \"loadCaches must not return an empty Collection\");\r\n/* 24:49 */ this.cacheMap.clear();\r\n/* 25:52 */ for (Cache cache : caches)\r\n/* 26: */ {\r\n/* 27:53 */ this.cacheMap.put(cache.getName(), cache);\r\n/* 28:54 */ this.cacheNames.add(cache.getName());\r\n/* 29: */ }\r\n/* 30: */ }", "private void initSharedPre() {\n\t}", "protected abstract void setClueModels();", "private void resetResources() {\n resourceManager.resetAllResources();\n resourceManager=ResourceManager.getInstance(getApplicationContext()); //need update resourceManager upon reset\n }", "public void resetPacks() {\n user.resetPacks();\n saveData();\n }", "private void processPropertyPlaceHolders() {\n\t\tMap<String, PropertyResourceConfigurer> prcs = applicationContext.getBeansOfType(PropertyResourceConfigurer.class);\n\n\t\tif (!prcs.isEmpty() && applicationContext instanceof GenericApplicationContext) {\n\t\t\tBeanDefinition mapperScannerBean = ((GenericApplicationContext) applicationContext)\n\t\t\t\t\t.getBeanFactory().getBeanDefinition(beanName);\n\n\t\t\t// PropertyResourceConfigurer does not expose any methods to explicitly perform\n\t\t\t// property placeholder substitution. Instead, create a BeanFactory that just\n\t\t\t// contains this mapper scanner and post process the factory.\n\t\t\tDefaultListableBeanFactory factory = new DefaultListableBeanFactory();\n\t\t\tfactory.registerBeanDefinition(beanName, mapperScannerBean);\n\n\t\t\tfor (PropertyResourceConfigurer prc : prcs.values()) {\n\t\t\t\tprc.postProcessBeanFactory(factory);\n\t\t\t}\n\n\t\t\tPropertyValues values = mapperScannerBean.getPropertyValues();\n\n\t\t\tthis.basePackage = updatePropertyValue(\"basePackage\", values);\n\t\t\tthis.sqlSessionFactoryBeanName = updatePropertyValue(\"sqlSessionFactoryBeanName\", values);\n\t\t\tthis.sqlSessionTemplateBeanName = updatePropertyValue(\"sqlSessionTemplateBeanName\", values);\n\t\t}\n\t}", "void postInit();", "void postInit();", "public void preInit() {\n \tfor(int i=1;i<ItemAmmo.AMMO_TYPES.length;i++){\n \t\tif(i!=10 && i !=12){\n \t\tModelLoader.setCustomModelResourceLocation(TF2weapons.itemAmmo, i, new ModelResourceLocation(TF2weapons.MOD_ID+\":ammo_\"+ItemAmmo.AMMO_TYPES[i], \"inventory\"));\n \t\t}\n \t}\n \t\n \t//ModelLoader.registerItemVariants(TF2weapons.itemTF2, new ModelResourceLocation(TF2weapons.MOD_ID+\":copper_ingot\", \"inventory\"),new ModelResourceLocation(TF2weapons.MOD_ID+\":lead_ingot\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemAmmoFire, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":ammo_fire\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemChocolate, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":chocolate\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemHorn, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":horn\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemMantreads, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":mantreads\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemScoutBoots, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":scout_shoes\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemAmmoMedigun, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":ammo_medigun\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 0, new ModelResourceLocation(TF2weapons.MOD_ID+\":copper_ingot\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 1, new ModelResourceLocation(TF2weapons.MOD_ID+\":lead_ingot\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 2, new ModelResourceLocation(TF2weapons.MOD_ID+\":australium_ingot\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 3, new ModelResourceLocation(TF2weapons.MOD_ID+\":scrap_metal\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 4, new ModelResourceLocation(TF2weapons.MOD_ID+\":reclaimed_metal\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 5, new ModelResourceLocation(TF2weapons.MOD_ID+\":refined_metal\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 6, new ModelResourceLocation(TF2weapons.MOD_ID+\":australium_nugget\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 7, new ModelResourceLocation(TF2weapons.MOD_ID+\":key\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 8, new ModelResourceLocation(TF2weapons.MOD_ID+\":crate\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 9, new ModelResourceLocation(TF2weapons.MOD_ID+\":random_weapon\", \"inventory\"));\n \tModelLoader.setCustomModelResourceLocation(TF2weapons.itemTF2, 10, new ModelResourceLocation(TF2weapons.MOD_ID+\":random_hat\", \"inventory\"));\n \t\n \tRenderingRegistry.registerEntityRenderingHandler(EntityTF2Character.class, new IRenderFactory<EntityTF2Character>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityTF2Character> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderTF2Character(manager);\n\t\t\t}\n \t});\n \t/*RenderingRegistry.registerEntityRenderingHandler(EntityProjectileBase.class, new IRenderFactory<Entity>(){\n\t\t\t@Override\n\t\t\tpublic Render<Entity> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderEntity(manager);\n\t\t\t}\n \t});*/\n \tRenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new IRenderFactory<EntityRocket>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityRocket> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderRocket(manager);\n\t\t\t}\n \t});\n \t/*RenderingRegistry.registerEntityRenderingHandler(EntityFlame.class, new IRenderFactory<EntityFlame>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityFlame> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn (Render<EntityFlame>) new RenderEntity();\n\t\t\t}\n \t});*/\n \tRenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new IRenderFactory<EntityGrenade>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityGrenade> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderGrenade(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityStickybomb.class, new IRenderFactory<EntityStickybomb>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityStickybomb> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderStickybomb(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntitySyringe.class, new IRenderFactory<EntitySyringe>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntitySyringe> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderSyringe(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityBall.class, new IRenderFactory<EntityBall>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityBall> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderBall(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityFlare.class, new IRenderFactory<EntityFlare>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityFlare> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderFlare(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityJar.class, new IRenderFactory<EntityJar>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityJar> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderJar(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntitySentry.class, new IRenderFactory<EntitySentry>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntitySentry> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderSentry(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityDispenser.class, new IRenderFactory<EntityDispenser>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityDispenser> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderDispenser(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityTeleporter.class, new IRenderFactory<EntityTeleporter>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityTeleporter> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderTeleporter(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntityStatue.class, new IRenderFactory<EntityStatue>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntityStatue> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderStatue(manager);\n\t\t\t}\n \t});\n \tRenderingRegistry.registerEntityRenderingHandler(EntitySaxtonHale.class, new IRenderFactory<EntitySaxtonHale>(){\n\t\t\t@Override\n\t\t\tpublic Render<EntitySaxtonHale> createRenderFor(RenderManager manager) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn new RenderBiped<EntitySaxtonHale>(manager, new ModelBiped(), 0.5F, 1.0F){\n\t\t\t\t\tprivate final ResourceLocation TEXTURE=new ResourceLocation(TF2weapons.MOD_ID,\"textures/entity/tf2/SaxtonHale.png\");\n\t\t\t\t\tprotected ResourceLocation getEntityTexture(EntitySaxtonHale entity)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn TEXTURE;\n\t\t\t\t }\n\t\t\t\t};\n\t\t\t}\n \t});\n\t}", "@Override\n\tprotected void setup(Reducer<LongWritable, Text, Text, Text>.Context context)\n\t\t\tthrows IOException, InterruptedException {\n\t\tsuper.setup(context);\n\t\tminPnts=Long.parseLong(context.getConfiguration().get(\"minPnts\"));\n\t\tepsilon=Double.parseDouble(context.getConfiguration().get(\"epsilon\"));\n\t\toutput = new MultipleOutputs<Text,Text>(context);\n\t\tPath[] cacheFilesLocal = DistributedCache.getLocalCacheFiles(context.getConfiguration());\n\t\tfor (Path eachPath : cacheFilesLocal) {\n\t\t\t\n\t\t\tloadPartition(eachPath, context);\n\t\t\t\n\t\t}\n\t}", "public void init() {\n\t\tlong startTime = System.currentTimeMillis();\n\t\t\n\t\tfor(BusinessCategoryList categoryList : BusinessCategoryList.values()) {\n\t\t\tString[] names = categoryList.getValues().split(\",\");\n\t\t\tfor(String name : names) {\n\t\t\t\tget(name);\n\t\t\t}\n\t\t}\n\t\t\n\t\tlog.debug(\"Dirty hack completed in {} ms.\", System.currentTimeMillis() - startTime);\n\t}", "private void resetAll() {\n resetResources();\n resetStory();\n refresh();\n }", "void restoreAfter() {\r\n\t\t\tsurface.basemap.clear();\r\n\t\t\tsurface.basemap.putAll(basemapAfter);\r\n\t\t\tsurface.buildingmap.clear();\r\n\t\t\tsurface.buildingmap.putAll(buildingmapAfter);\r\n\t\t\tsurface.features.clear();\r\n\t\t\tsurface.features.addAll(surfaceAfter);\r\n\t\t\tsurface.buildings.clear();\r\n\t\t\tsurface.buildings.addAll(buildingsAfter);\r\n\t\t}", "protected void afterPropertiesSetInternal() {\n\t\t// override this method\n\t}", "private void restoreSettings() {\n PublicationRecognitionStructure prs =\n PreferencesManager.getPublicationRecognitionStructure();\n luminanceThresholdSpinner.setValue(new Integer(prs.getLuminanceCutOff()));\n markThresholdSpinner.setValue(new Integer(prs.getMarkThreshold()));\n fragmentPaddingSpinner.setValue(new Integer(prs.getFragmentPadding()));\n deskewThresholdSpinner.setValue(new Double(prs.getDeskewThreshold()));\n performDeskewCheckBox.setSelected(prs.isPerformDeskew());\n\n // restore the fieldname duplicate presets\n FieldnameDuplicatePresets fdp = PreferencesManager.getFieldnameDupliatePresets();\n defaultFieldnamePrefixTextField.setText(fdp.getFieldname());\n fieldnameCounterSpinner.setValue(fdp.getCounterStart());\n horizontalDuplicatesSpinner.setValue(fdp.getHorizontalDuplicates());\n verticalDuplicatesSpinner.setValue(fdp.getVerticalDuplicates());\n horizontalSpacingSpinner.setValue(fdp.getHorizontalSpacing());\n verticalSpacingSpinner.setValue(fdp.getVerticalSpacing());\n\n if (fdp.getNamingDirection()\n == FieldnameDuplicatePresets.DIRECTION_TOP_TO_BOTTOM_LEFT_TO_RIGHT) {\n lrtbButton.setSelected(false);\n tblrButton.setSelected(true);\n }\n\n if (fdp.getNamingDirection()\n == FieldnameDuplicatePresets.DIRECTION_LEFT_TO_RIGHT_TOP_TO_BOTTOM) {\n tblrButton.setSelected(false);\n lrtbButton.setSelected(true);\n }\n\n }", "@Override\n\tpublic void postInit() {\n\t\t\n\t}", "public abstract void postInit();", "private void applyOrSaveRules() {\n final boolean enabled = Api.isEnabled(this);\n final Context ctx = getApplicationContext();\n\n Api.generateRules(ctx, Api.getApps(ctx, null), true);\n\n if (!enabled) {\n Api.setEnabled(ctx, false, true);\n setDirty(false);\n return;\n }\n Api.updateNotification(Api.isEnabled(getApplicationContext()), getApplicationContext());\n new RunApply().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);\n }", "private void initializeAll() {\n initialize(rows);\n initialize(columns);\n initialize(boxes);\n }", "protected void updateFromTemplate() {\r\n try {\r\n if (templateList.getSelectedItem() != null) {\r\n getConfigurer().loadPropertiesFromFile((String) templateList.getSelectedItem());\r\n Iterator<PropertyInputPanel> it = propertyInputPanels.iterator();\r\n while (it.hasNext()) {\r\n PropertyInputPanel panel = it.next();\r\n \r\n Object currentValue = getConfigurer().getProperty(panel.getName());\r\n if (currentValue != null && panel.isEnabled()) {\r\n panel.setValue(currentValue);\r\n }\r\n \r\n }\r\n }\r\n } catch (ClassCastException e) {\r\n Util.debugMsg(\"Saved template has incompatible data, it will be ignored\");\r\n }\r\n }", "public void reset() {\n\t\t//set everything back to normal\n\t\tHashMap<String, Component> components = gui.getConversionSettingsComponents();\n\t\tfor (String key: components.keySet()) {\n\t\t\tComponent component = components.get(key);\n\t\t\tcomponent.setEnabled(true);\n\t\t}\n\t}", "protected void prepareModel() {\n model();\n }", "public void apply() {\n\t\tif (! defaultFragmentShader.exists() || ! defaultVertexShader.exists()) {\n\t\t\tthrow new IllegalArgumentException(\"No default shader exists.\");\n\t\t}\n\t\t\n\t}", "public void trainingPreprocessing() {\n neuralNetAndDataSet = new NeuralNetAndDataSet(neuralNetwork, trainingSet);\n trainingController = new TrainingController(neuralNetAndDataSet);\n neuralNetwork.getLearningRule().addListener(this);\n trainingController.setLmsParams(0.7, 0.01, 0);\n LMS learningRule = (LMS) this.neuralNetAndDataSet.getNetwork().getLearningRule();\n if (learningRule instanceof MomentumBackpropagation) {\n ((MomentumBackpropagation) learningRule).setMomentum(0.2);\n }\n }", "private void prePreTickUpdates() {\n\t\t// <- LOGGING\n\t\tif (logger.isDebugEnabled()) {\n\t\t\tlogger.debug(\"Pre PreTick\\t\\t (DefaultSchedule ID \" + id + \")\");\n\t\t}\n\t\t// LOGGING ->\n\n\t\t// copy to prevent concurrent modifications:\n\t\tList<PrePreTickAction> prePreTickActionsCopy = new ArrayList<PrePreTickAction>(\n\t\t\t\tprePreTickActions);\n\n\t\tfor (PrePreTickAction p : prePreTickActionsCopy) {\n\t\t\t// <- LOGGING\n\t\t\tif (logger.isTraceEnabled()) {\n\t\t\t\tlogger.trace(\"Do PrePreTick action \" + p);\n\t\t\t}\n\t\t\t// LOGGING ->\n\n\t\t\tp.prePreTick();\n\t\t}\n\t}" ]
[ "0.5469412", "0.5397771", "0.5073257", "0.50224006", "0.5003922", "0.5003922", "0.5003922", "0.5003922", "0.4992737", "0.49895376", "0.49531716", "0.4945241", "0.49361315", "0.4930255", "0.49054125", "0.48589033", "0.4834132", "0.4807334", "0.48049238", "0.4789418", "0.47729284", "0.47331434", "0.47262868", "0.4719962", "0.47178096", "0.4717753", "0.47122723", "0.46993494", "0.46891582", "0.4664715", "0.46629396", "0.46415603", "0.46380305", "0.46220767", "0.46164554", "0.460523", "0.45994502", "0.45970348", "0.4596189", "0.45929253", "0.45864585", "0.4586262", "0.45728263", "0.4568175", "0.45644835", "0.45605835", "0.45593637", "0.45478457", "0.4546694", "0.45460194", "0.4545287", "0.45325494", "0.45319957", "0.4528935", "0.45255417", "0.45231554", "0.4522361", "0.4515065", "0.45112664", "0.4511219", "0.45110962", "0.45072228", "0.45044878", "0.4504057", "0.44963998", "0.44905934", "0.44849995", "0.44770983", "0.44768074", "0.44735402", "0.44679728", "0.4455829", "0.4454499", "0.44459283", "0.44425192", "0.44403008", "0.44397733", "0.4439419", "0.44385123", "0.44368476", "0.4436015", "0.4435633", "0.4435633", "0.44317806", "0.44315255", "0.4423078", "0.44209665", "0.44160035", "0.44097695", "0.44080934", "0.44067213", "0.44065478", "0.43905693", "0.43898138", "0.43879896", "0.4387247", "0.43856156", "0.43844268", "0.43823326", "0.43818924" ]
0.7224475
0
Updates return home autotrigger delay.
private void updateAutoTriggerDelay(long delay) { if (mAutoTriggerDelay != delay) { mAutoTriggerDelay = delay; updateReachabilityStatus(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setDelay(double clock);", "long getInitialDelayInSeconds();", "@Override\n public native void setAutoDelay(int ms);", "public void setAutoResetDelay(int delay) {\n this.mAutoResetDelay = delay;\n }", "public long getDelay();", "@Override\n public native int getAutoDelay();", "public double getDelay();", "int getChronicDelayTime();", "int getUpdateTriggerTime();", "private void emulateDelay() {\n try {\n Thread.sleep(700);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "public Long getAutomaticStartupActionDelay() {\n return automaticStartupActionDelay;\n }", "private void changeDelay() {\n delay = ((int) (Math.random() * 10000) + 1000) / MAX_FRAMES;\n }", "public abstract int delay();", "public void setDelay(long d){delay = d;}", "public void setDelay(long delay) {\n this.delay = delay;\n }", "long lastAutomaticRefresh();", "public void countdownToResponsiveButtonCountdown()\n {\n countdownToResponsiveButtonsTimer = 43;\n }", "public void mo23018c() {\n this.f26122b.edit().putLong(\"last.last.show.attend\", System.currentTimeMillis()).apply();\n }", "public void upgradeAuto(View v){\n if(timertrue){ //to make sure that multiple instances of timer are not created\n timer();\n timertrue = false;\n }\n\n if((total - autovalue*10000) >= 0) {\n total -= autovalue * 10000;\n autovalue += 0.001*0.1*value;\n TextView TextAuto = (TextView)\n findViewById(R.id.TextAuto); //displays autoclicks per second\n TextAuto.setText(Double.toString(round(autovalue * 1000, 2)));\n\n\n TextView myTextView = (TextView)\n findViewById(R.id.textView);\n myTextView.setText(Double.toString(round(total,2)));\n }\n }", "long getRevokeDelay();", "@WithName(\"schedule.delay\")\n @WithDefault(\"5s\")\n Duration scheduleDelay();", "public void setDelay(float time)\n\t{\n\t\tdelayMax=time;\n\t}", "public Integer delayExistingRevokeInHours() {\n return this.delayExistingRevokeInHours;\n }", "public int getDelay() {\r\n return delay;\r\n }", "public int getDelay()\n {\n return delay;\n }", "public int getDelay() {\r\n\t\treturn delay;\r\n\t}", "public long getDelay()\n {\n return delay;\n }", "public void setDelaytime(Long delaytime) {\n this.delaytime = delaytime;\n }", "public void autoScoreBottomCenterPeg() {\n getRobotDrive().goForward(-.5); //Speed at which to back up\n Timer.delay(1); //Time to continue backing up\n getRobotDrive().stop(); //Stop backing up\n arm.armJag.set(.4); //Speed to lower arm *may need to be inverted*\n Timer.delay(.5); //Time to lower arm\n arm.grabTube(true); //Opens the claw to release Ub3r Tube\n getRobotDrive().goForward(-.5); //Speed at which to back up again\n arm.armJag.set(.3); //Lowers arm safely to ground.\n\n }", "private void delay() {\n\t\tDelay.msDelay(1000);\n\t}", "public long increaseExitDelay(long value) {\n logger.warn(\"ShutdownService : increaseExitDelay : \" + value);\n return _delay.addAndGet(value);\n }", "private void resetCooldown() {\n nextAttack = tower.getFireFrequency();\n }", "public int getDelay() {\n return delay;\n }", "public void setDroneDelay(int delay)\r\n {\r\n droneDelay=delay;\r\n }", "public void setDelay(int delay)\n {\n this.delay = delay;\n }", "public void newTurnPauseCountdown()\n {\n pauseNewTurn = true;\n pauseNewTurnTimer = 169;\n }", "private int get_delay() {\n double exp = slider1.getValue() / 100.0 - 9; // Range -9, 1\n exp = Math.min(0, exp); // Range -9, 0\n return (int) (Math.pow(10.0, exp) * 100000000.0);\n }", "public int getDelay() {\n\t\treturn delay;\n\t}", "private void setUpdateTriggerTime(int value) {\n bitField0_ |= 0x00000002;\n updateTriggerTime_ = value;\n }", "@ScheduledMethod(start = 1, interval = 1)\n\tpublic void update() {\n\t\tupdateParameters();\t\t\t// update bee coefficients using parameters UI\n\t\tkillBee();\t\t\t\t\t// (possibly) kill the bee (not currently used)\n\t\tlowFoodReturn();\n\t\tif(state == \"SLEEPING\"){\n\t\t\tsleep();\n\t\t}\n\t\tif(state == \"SCOUTING\"){\n\t\t\tscout();\n\t\t}\n\t\tif(state == \"TARGETING\"){\n\t\t\ttarget();\n\t\t}\n\t\tif(state == \"HARVESTING\"){\n\t\t\tharvest();\n\t\t}\n\t\tif(state == \"RETURNING\"){\n\t\t\treturnToHive();\n\t\t}\n\t\tif(state == \"AIMLESSSCOUTING\"){\n\t\t\taimlessScout();\n\t\t}\n\t\tif(state == \"DANCING\"){\n\t\t\tdance();\n\t\t}\n\t\tif(state == \"FOLLOWING\"){\n\t\t\tfollow();\n\t\t}\n\t}", "protected void setAutoFallRate(long autoFallRate) {\r\n\t\tthis.autoFallRate = autoFallRate;\r\n\t}", "private void getOneToteTimer()\r\n\t{\r\n\t\tswitch(autoStep)\r\n\t\t{\r\n\t\t\tcase 0:\r\n\t\t\t{\r\n\t\t\t\tpickUpTimer();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tcase 1:\r\n\t\t\t{\r\n\t\t\t\tdriveForwardTimer();\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\t\r\n\t}", "public void crawlDelay()\n\t{\n//\t\tint delay = robot.getCrawlDelay(best_match);\n//\t\tif (delay!=-1)\n//\t\t{\n//\t\t\ttry \n//\t\t\t{\n//\t\t\t\tTimeUnit.SECONDS.sleep(robot.getCrawlDelay(best_match));\n//\t\t\t} \n//\t\t\tcatch (InterruptedException e) \n//\t\t\t{\n//\t\t\t\treturn;\n//\t\t\t}\n//\t\t}\n\t}", "public void setDelay(int delay) {\n this.delay = delay;\n }", "public Long getDelaytime() {\n return delaytime;\n }", "@Override\n public void periodic()\n {\n if(AutoIntake)\n intake(-0.2f, -0.5f);\n }", "int getMaximumDelay();", "private void driveForwardTimer()\r\n\t{\r\n\t\tif(timer.get() < Config.Auto.timeDriveForward){\r\n\t\t\tdrive.setSpeed(0, 0, Config.Auto.driveForwardSpeed, Config.Auto.driveForwardSpeed);\r\n\t\t\tSystem.out.println(timer.get());}\r\n\t\t\r\n\t\telse\r\n\t\t{\r\n\t\t\tdrive.setSpeed(0, 0, 0, 0);\r\n\t\t\tautoStep++;\r\n\t\t}\r\n\t}", "public void newTurnCountdown() {\n newTurn = true;\n newTurnTimer = 77;\n }", "public void setDelay(int delay) {\n\t\t if (delay != this.delay) logger.info(\"New delay is: \"+getElapsedTimeHoursMinutesSecondsString(delay)); \n\t\t if (delay < this.delay) {\n\t\t\t scheduledFuture.cancel(true);\n\t\t\t reset(delay); \n\t\t }\n\t\t this.delay = delay;\n\t }", "public void mo23021d() {\n this.f26122b.edit().putLong(\"last.refresh.otherapp\", System.currentTimeMillis()).apply();\n }", "void setPaymentDelay(ch.crif_online.www.webservices.crifsoapservice.v1_00.PaymentDelay paymentDelay);", "public float getDelay()\n\t{\n\t\treturn delay;\n\t}", "public int getDelay()\r\n {\r\n return this.delay;\r\n }", "public int getDelayTime()\n\t{\n\t\treturn delayTime;\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tRobot.intakeSubsystem._getSpeed();\n\n\t\tRobot.driveSubsystem.operatorOverride();\n\t\tScheduler.getInstance().run();\n\n\t\tTargetRegion boilerTarget = Robot.navigator.getBoilerTarget();\n\t\tif (boilerTarget != null) {\n\t\t\tSmartDashboard.putNumber(\"Target Center X\", boilerTarget.m_centerTop);\n\t\t\tSmartDashboard.putNumber(\"Target Center Y\", boilerTarget.m_bounds.m_top);\n\t\t} else {\n\t\t\tSmartDashboard.putNumber(\"Target Center X\", -1);\n\t\t\tSmartDashboard.putNumber(\"Target Center Y\", -1);\n\t\t}\n\t}", "private void startGameAfterDelay() {\n int delay = (int) (double) DiaConfig.SECONDS_UNTIL_START.get() * MinecraftConstants.TICKS_PER_SECOND + 1;\n\n this.startingTask = new BukkitRunnable() {\n @Override\n public void run() {\n startGame();\n }\n }.runTaskLater(DiaHuntPlugin.getInstance(), delay);\n }", "public void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t\t\n shooterArm.updateSmartDashboard();\n\t\tdriveTrain.getDegrees();\n\n\t\tvision.findGoal();\n\t\tvision.getGoalXAngleError();\n\t\tvision.getGoalArmAngle();\n\n\t\t// Stop auto mode if the robot is tilted too much\n\t\tif (Math.abs(driveTrain.getRobotPitch())<=60 && Math.abs(driveTrain.getRobotRoll())<=60)\n\t\t\ttimerTilt.reset();\n\t\t\n\t\t// For some reason, robot did not move in last match in auto, so this code is suspect\n\t\t// Do the Pitch/Roll values need to be zeroed?\n//\t\tif ( autonomousCommand != null && timerTilt.get()>0.5)\n//\t\t\tautonomousCommand.cancel();\n\n\t}", "public long getDelay() {\n return mDelay;\n }", "public int getDelayedTimeout();", "public void liftUp(){\n set(m_defaultLiftSpeedUp);\n }", "int getAbsoluteMaximumDelay();", "public void autonomousPeriodic() {\n \tswitch(autoSelected) {\n \tcase customAuto:\n //Put custom auto code here \n break;\n \tcase defaultAuto:\n \tdefault:\n \t//Put default auto code here\n break;\n \t}\n }", "@Scheduled(fixedRate = 2000, initialDelay = 5000)\n\tpublic void scheduleTaskWithInitialDelay() {\n\t\tlog.info(\"Fixed Rate Task With Initial Delay :: Execution Time - {}\", dateTimeFormatter.format(LocalDateTime.now()));\n\t}", "public long getDelay() {\n return this.delay;\n }", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t\tSmartDashboard.putBoolean(\"Max Intake Extension: \", RobotMap.intakeLifted.get());\n\t\tSmartDashboard.putBoolean(\"Max Lift Extension:\", RobotMap.isAtTop.get());\n\t\tSmartDashboard.putBoolean(\"Min Lift Extension:\", RobotMap.isAtBottom.get());\n\t\tDriveTrain.driveWithJoystick(RobotMap.stick, RobotMap.rd); // Drive\n\t\tTeleOp.RaiseLift(RobotMap.liftTalon, RobotMap.controller); // Raise lift\n\t\tif(RobotMap.controller.getRawAxis(RobotMap.lowerLiftAxis) >= 0.2) {\n\t\tTeleOp.LowerLift(RobotMap.liftTalon, RobotMap.controller);\n\t\t}\n\t\tTeleOp.DropIntake(RobotMap.controller, RobotMap.intakeLifter);\n\t\tTeleOp.spinOut(RobotMap.intakeVictorLeft, RobotMap.controller);\n\t\t//TeleOp.spinnySpinny(RobotMap.intakeVictorLeft, RobotMap.stick);\n\t}", "private float resetTimer() {\r\n final float COUNTDOWNTIME = 10;\r\n return COUNTDOWNTIME;\r\n }", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tswitch (m_autoSelected) {\n\t\t\tcase kCustomAuto:\n\t\t\t\t// Put custom auto code here\n\t\t\t\tbreak;\n\t\t\tcase kDefaultAuto:\n\t\t\tdefault:\n\t\t\t\t// Put default auto code here\n\t\t\t\tbreak;\n\t\t}\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tswitch (m_autoSelected) {\n\t\t\tcase kCustomAuto:\n\t\t\t\t// Put custom auto code here\n\t\t\t\tbreak;\n\t\t\tcase kDefaultAuto:\n\t\t\tdefault:\n\t\t\t\t// Put default auto code here\n\t\t\t\tbreak;\n\t\t}\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tswitch (m_autoSelected) {\n\t\t\tcase kCustomAuto:\n\t\t\t\t// Put custom auto code here\n\t\t\t\tbreak;\n\t\t\tcase kDefaultAuto:\n\t\t\tdefault:\n\t\t\t\t// Put default auto code here\n\t\t\t\tbreak;\n\t\t}\n\t}", "public void autoStopForwardDelayTime(int delay) throws JposException;", "public void teleopPeriodic() {\n driverScreen.updateLCD();\n }", "protected void scheduleExpiry()\n {\n long dtExpiry = 0L;\n int cDelay = OldOldCache.this.m_cExpiryDelay;\n if (cDelay > 0)\n {\n dtExpiry = getSafeTimeMillis() + cDelay;\n }\n setExpiryMillis(dtExpiry);\n }", "public void setDelayMove(float delay_)\n\t{\n\t\tdelayMove=delayMove+delay_;\n\t}", "public void setUpDownTimer(float upDownTimer) {\n this.upDownTimer = upDownTimer;\n }", "public void setDelay(int delay) {\n\t\ttimer.setInitialDelay(delay);\n\t}", "public double getTimeDelayActivation() {\r\n\t\tif (activation_count > 1) return last_activation;\r\n\t\telse return 0.0;\r\n\t}", "long getTimerPref();", "@Override\n public void autonomousPeriodic() {\n switch (m_autoSelected) {\n case kCustomAuto:\n // Put custom auto code here\n break;\n case kDefaultAuto:\n default:\n // Put default auto code here\n break;\n }\n }", "@Override\n public void autonomousPeriodic() {\n switch (m_autoSelected) {\n case kCustomAuto:\n // Put custom auto code here\n break;\n case kDefaultAuto:\n default:\n // Put default auto code here\n break;\n }\n }", "@Override\n public void autonomousPeriodic() {\n switch (m_autoSelected) {\n case kCustomAuto:\n // Put custom auto code here\n break;\n case kDefaultAuto:\n default:\n // Put default auto code here\n break;\n }\n }", "@Override\n public void autonomousPeriodic() {\n switch (m_autoSelected) {\n case kCustomAuto:\n // Put custom auto code here\n break;\n case kDefaultAuto:\n default:\n // Put default auto code here\n break;\n }\n }", "public void startAgentTime() {\n Timer timer = new Timer(SIBAConst.TIME_AGENT_CHANGE_FOR_HOUR, new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n \t\n \tCalendar c = Calendar.getInstance();\n int minutos = c.get(Calendar.MINUTE);\n int hora = c.get( (Calendar.HOUR_OF_DAY)); \n hora = hora * 60;\n if (minutos >= 30 && minutos <= 59)\n {hora +=30;\t\n }\n if (hora > ctrlHours)\n {ctrlHours = hora;\n //activada bandera de modificacion de programacion\n activatedScheduleChange = true;\n }\n else\n { if (hora < ctrlHours)\n \t ctrlHours = 0;\n }\n \t\n \t\n \n }\n });\n timer.start();\n }", "@Override\r\n public int actionDelayTime(Entity attacker) {\n return 4000;\r\n }", "@Scheduled(fixedRate = 2000, initialDelay = 5000)\n public void scheduleTaskWithInitialDelay() {\n logger.info(\"Fixed Rate Task with Initial Delay :: Execution Time - {}\", formatter.format(LocalDateTime.now()));\n }", "public AutonDelay(double timeout) {\n super(\"autonDelay\");\n setTimeout(timeout);\n }", "public void autoStopBackwardDelayTime(int delay) throws JposException;", "public synchronized int setArrivalTime(){\n\t\t return random.nextInt((30-1)+1)+1;\n\n\t}", "int getSleepBeforeRetry();", "void setTime(){\n gTime += ((float)millis()/1000 - millisOld)*(gSpeed/4);\n if(gTime >= 4) gTime = 0;\n millisOld = (float)millis()/1000;\n }", "public int getNumDelayedUpdates() {\n return (Integer) getProperty(\"numDelayedUpdates\");\n }", "public void kickTimer() {\n delayTime = System.currentTimeMillis() + shutdownDelay;\n// System.out.println(\"Time at which the loop should kick: \" + delayTime);\n }", "private long getWaitTime() {\n long retVal = 1;\n long difference = System.currentTimeMillis() - myLastRefreshTime;\n if (difference < 75) {\n retVal = 75 - difference;\n }\n return (retVal);\n }", "@Override\n\tpublic void returnHome()\n\t{\n\t\tif(_returnHome && !isInsideRadius(getSpawn().getLocx(), getSpawn().getLocy(), 150, false))\n\t\t{\n\t\t\tclearAggroList();\n\t\t\tgetAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLoc());\n\t\t}\n\t}", "public void setDelay(BigDecimal delay) {\r\n this.delay = delay;\r\n }", "public void goToSleep() {\n mPowerManager.goToSleep(SystemClock.uptimeMillis());\n }", "ch.crif_online.www.webservices.crifsoapservice.v1_00.PaymentDelay addNewPaymentDelay();", "public void autoGrab(){\n \tif (getTrigger() == true){\n\t \tif(triggerTimer.get() >= TRIGGER_LOCKOUT){\n\t\t \tClawAct.set(true);\n\t\t \tisClosed = true;\n\t \t\tRobot.oi.armRumble(RUMBLE_DURATION);\n\t \t}\n \t}\n\n }", "long getRepeatIntervalPref();", "private void lightSpinnerDelay(int index) {\n\t\tif (toggleServiceButton.isChecked()) {\n\t\t\tswitch (index) {\n\t\t\tcase 0:\n\t\t\t\tlightSpinnerDelay = DELAY_FAST;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tlightSpinnerDelay = DELAY_GAME;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tlightSpinnerDelay = DELAY_UI;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tlightSpinnerDelay = DELAY_NORMAL;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstopLightService();\n\t\t\tstartLightService();\n\t\t\tdoLightBindService();\n\t\t\tstartLight();\n\t\t} else {\n\t\t\tif (lightService != null) {\n\t\t\t\tstopLightService();\n\t\t\t}\n\t\t}\n\t\tlightSpinnerDelay = index;\n\t\tSPE = SP.edit();\n\t\tSPE.putInt(\"lightSpinnerDelay\", lightSpinnerDelay);\n\t\tSPE.commit();\n\t}" ]
[ "0.5946312", "0.5816591", "0.5786145", "0.5746851", "0.5698563", "0.5669655", "0.56628203", "0.5654424", "0.563098", "0.5619098", "0.5579293", "0.55683035", "0.55638766", "0.55572176", "0.5511011", "0.55009407", "0.5480732", "0.54748523", "0.543951", "0.5421105", "0.54123247", "0.53927845", "0.5376611", "0.53721696", "0.53485435", "0.534579", "0.5338237", "0.5337829", "0.53354794", "0.5317498", "0.5317402", "0.53057575", "0.5297471", "0.528685", "0.526759", "0.5259468", "0.5256588", "0.5252107", "0.52490723", "0.5243803", "0.5242993", "0.5229494", "0.5229451", "0.5221339", "0.5216448", "0.52045244", "0.5200634", "0.5184645", "0.5181869", "0.5177564", "0.5174318", "0.5171442", "0.5168696", "0.516658", "0.5158727", "0.5150448", "0.51448345", "0.51365006", "0.51233476", "0.51230353", "0.51182497", "0.5113791", "0.5107576", "0.5101964", "0.50811875", "0.5076672", "0.5076277", "0.50739855", "0.50739855", "0.50739855", "0.5072041", "0.50704026", "0.5067885", "0.50630695", "0.5052613", "0.50524193", "0.50516534", "0.5047282", "0.504648", "0.504648", "0.504648", "0.504648", "0.5045713", "0.50429064", "0.5042589", "0.50287116", "0.50180084", "0.50179815", "0.501531", "0.5013827", "0.5010883", "0.5009391", "0.5001156", "0.49934527", "0.49932867", "0.498809", "0.49818859", "0.4981081", "0.49700597", "0.49642533" ]
0.6541407
0
Update the new target location.
private void onLocation(double latitude, double longitude, double altitude) { onLocation(latitude, longitude, altitude, null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setTargetLocation(Location targetLocation) \n {\n this.targetLocation = targetLocation;\n }", "public void updateLocation();", "private void updateCurrentTarget(){\n switch (state){\n case States.DEAD:\n currentTarget = currentLocation;\n break;\n case States.FIGHT:\n if (targetEnemy != null)\n currentTarget = targetEnemy.getCurrentLocation();\n else\n currentTarget = targetBuilding.getLocation();\n break;\n case States.RETREAT:\n currentTarget = new Point(20,20);\n break;\n case States.LOSS:\n currentTarget = new Point(20,20);\n break;\n case States.WIN:\n currentTarget = village.getCenter();\n break;\n case States.IDLE:\n currentTarget = targetBuilding.getLocation();\n }\n }", "public void setTargetLocation(Point location) {\n this.targetLocation = location;\n }", "private void updateLocation() {\n myLocationOnScreenRef.set(myComponent.getLocationOnScreen());\n }", "public void updateLocation()\r\n {\r\n\t\timg.setUserCoordinator(latitude, longitude);\r\n\t\timg.invalidate();\r\n\t}", "protected void updateTargetEditPart() {\n\t\tsetTargetEditPart(calculateTargetEditPart());\n\t}", "void update(Location location);", "public void update() {\r\n\t\ttable.putNumber(TARGET_X_KEY, targetX);\r\n\t\ttable.putNumber(TARGET_Y_KEY, targetY);\r\n\t\ttable.putNumber(DISTANCE, distance);\r\n\t\ttable.putBoolean(IS_FOUND, targetFound);\r\n\r\n\t}", "public void updateTarget(EnemyBot newRadarTarget) {\r\n\t\tradarTarget = newRadarTarget;\r\n\t}", "protected void updateLocation (BodyObject source, Location loc)\n {\n SceneLocation sloc = new SceneLocation(loc, source.getOid());\n if (!_ssobj.occupantLocs.contains(sloc)) {\n // complain if they don't already have a location configured\n Log.warning(\"Changing loc for occupant without previous loc \" +\n \"[where=\" + where() + \", who=\" + source.who() +\n \", nloc=\" + loc + \"].\");\n _ssobj.addToOccupantLocs(sloc);\n } else {\n _ssobj.updateOccupantLocs(sloc);\n }\n }", "private void update_location() throws Exception {\r\n\t\tif (children.size() == 1) {\r\n\t\t\tCLocation bloc = children.get(0).get_location();\r\n\t\t\tthis.location = bloc.get_source().get_location(bloc.get_bias(), bloc.get_length());\r\n\t\t} else if (children.size() > 1) {\r\n\t\t\tCLocation eloc = children.get(children.size() - 1).get_location();\r\n\t\t\tint beg = this.location.get_bias(), end = eloc.get_bias() + eloc.get_length();\r\n\t\t\tthis.location.set_location(beg, end - beg);\r\n\t\t}\r\n\t}", "private void moveToNewLocation() {\r\n System.out.println(\"\\nThis is the move to a new location option\");\r\n }", "public void update(World world, Target target);", "public abstract void updateLocations();", "public void testResolveTargetLocation() throws Exception {\n System.out.println(\"resolveTargetLocation\");\n \n instance.resolveTargetLocation();\n \n }", "public void setCurrentLocation(Location newLocation)\n\t{\n\t\tcurrentLocation = newLocation;\n\t}", "public void changeLocationOfTurtle(Point2D newLoc){ //WORKS\n\t\tsetTurtleLocToViewTurtleLoc();\n\t\tPoint2D locOrig = myTurtle.getLoc();\n\t\tmyTurtle.setLocation(newLoc);\n\t\tPoint2D locNew = myTurtle.getLoc();\n\t\tthis.moveTurtleImageAndDraw(locOrig, locNew);\n\t\tsetTurtleLocToViewTurtleLoc();\n\t\tthis.updateTurtleOnView();\n\t}", "public abstract void updateLocation(Location location, String newLocationName, int newLocationCapacity);", "@Override\n public void onLocationChanged(Location location) {\n updateLocation(location);\n }", "public void setCompassTarget ( Location loc ) {\n\t\texecute ( handle -> handle.setCompassTarget ( loc ) );\n\t}", "@Override\n\tpublic void updatePosition() {\n\t\t\n\t}", "protected void changeLocation(Location newLoc)\n {\n // Change location and notify the environment.\n Location oldLoc = location();\n myLoc = newLoc;\n environment().recordMove(this, oldLoc);\n\n // object is again at location myLoc in environment\n }", "public void actionUpdateGpsPosition(Location mLastLocation) {\n if(mLastLocation != null) {\n waypoint.updatePosition(mLastLocation.getLatitude(), mLastLocation.getLongitude());\n }\n }", "public void setLocation(Point newLocation) {\r\n this.p = newLocation;\r\n }", "public void update() {\n\t\tfinal StarSystem oldLocation = getPlayer().getLocation();\n\t\tfinal StarSystem newLocation = getChart().getSelected();\n\t\tgetPlayer().setLocation(newLocation);\n\t\tgetPlayer().setFuel(-oldLocation.distanceToStarSystem(newLocation));\n\t\tgetChart().setSelected(null);\n\t\tgetChart().repaint();\n\t\tplanetLbl.setText(\"Current Location: \" + player.getLocation().getName()\n\t\t\t\t+ \"....Tech Level: \" + player.getLocation().getTechLevel());\n\n\t}", "public void onLocationChanged(Location location) {\n\t\t\t\tupdatenewlocation(location);\n\t\t\t\t\n\t\t\t}", "@Override\n public void onLocationChange(Location loc) {\n user.setRelativePosition(loc.getX(), loc.getY());\n map.addStep(new PointF(loc.getX(), loc.getY()));\n //messageHandler.sendEmptyMessage(MESSAGE_REFRESH);\n }", "@Override\n \tpublic void onLocationChanged(Location location) {\n \t\tthis.location = location;\n \t}", "@Override\r\n\tpublic void onLocationChange(Location loc) {\n\t\tuser.setRelativePosition(loc.getX(), loc.getY());\r\n\t\tmap.addStep(new PointF(loc.getX(),loc.getY()));\r\n\t\tmessageHandler.sendEmptyMessage(MESSAGE_REFRESH);\r\n\t}", "public void updateYLoc();", "public void updateTranslationAnimation() {\n\t\tif (target == null)\n\t\t\treturn;\n\t\t\n\t\tfinal float\n\t\t\t// Declare the distance to the target position.\n\t\t\tdeltaX = target.x - this.x(),\n\t\t\tdeltaY = target.y - this.y(),\n\t\t\t// Declare the new coordinates for the SwipeTile to use.\n\t\t\tnewX = this.x() + (deltaX * translationDamping),\n\t\t\tnewY = this.y() + (deltaY * translationDamping);\n\t\t\n\t\t// Set the SwipeTile to the new-coordinates.\n\t\tsetPosition(newX, newY);\n\t}", "@SuppressLint(\"MissingPermission\")\n private void requestLocationUpdate() {\n }", "@Override\n public final void updateOrigin() {\n }", "public void move() {\n\t\t// Override move so we don't move, then get location set by owner.\n\t}", "private void setLocation(Location newLocation) {\n\t\tif (location != null) {\n\t\t\tfield.clear(location);\n\t\t}\n\t\tlocation = newLocation;\n\t\tfield.place(this, newLocation);\n\t}", "public void setTargetPosition(double position){\n targetPosition = position;\n }", "private void SetLocationRelative(Object object) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "public void updateSourceTarget(String source, String target) {\n\t\titem.setText(2, source);\n\t\titem.setText(3, target);\n\t}", "public void setLocation(Location location) {\n this.location = location;\n }", "public void setLocation(Location location) {\n this.location = location;\n }", "public void setLocation(Location location) {\n this.location = location;\n }", "public void setLocation(Location location) {\r\n\t\tthis.location = location;\r\n\t}", "public void setLocation(Location loc) {\n this.location = loc;\n }", "private void setNewTarget() {\n startPoint = new Circle(targetPoint);\n projection.addShift(this.targetGenerator.shiftX(startPoint), this.targetGenerator.shiftY(startPoint),\n this.targetGenerator.gridManager);\n this.targetPoint = new Circle(this.targetGenerator.generateTarget(startPoint), this.targetGenerator.gridManager.pointSize);\n projection.convertFromPixels(this.targetPoint);\n \n gameListeners.addedNewLine(startPoint, targetPoint);\n \n // TODO make probability upgradeable to spawn a new pickup\n if (Math.random() < pickupSpawnProbability) {\n generateNewPickup(); \n }\n }", "private void setLocationRelativeTo(Object object) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "private void setLocationRelativeTo(Object object) {\n throw new UnsupportedOperationException(\"Not supported yet.\"); //To change body of generated methods, choose Tools | Templates.\n }", "void setDestination(Locations destination);", "@Override\n\tpublic void updateLocation(String roomLocation, String sideLocation) {\n\t\tthis.room = roomLocation;\n\t\tthis.side = sideLocation;\n\t}", "private void updateTestTarget(TestTarget testTarget) {\r\n\t\tif (getDbContext().update(TESTTARGET).set(TESTTARGET.PATH, testTarget.getPath())\r\n\t\t\t\t.set(TESTTARGET.FILE_NAME, testTarget.getFileName()).set(TESTTARGET.NAME, testTarget.getName())\r\n\t\t\t\t.where(TESTTARGET.ID.eq(testTarget.getId())).execute() != 1) {\r\n\t\t\tmLogger.error(\"Failed to update package:\" + testTarget);\r\n\t\t} else {\r\n\t\t\tmLogger.debug(\"Test package updated:\" + testTarget);\r\n\t\t}\r\n\t}", "private void updatePosition(){\n updateXPosition(true);\n updateYPosition(true);\n }", "public void updatePlayerLocation() {requires new property on gamestate object\n //\n }", "public void refreshBrowserLocation() {\n initBrowserLocationSection();\n }", "public void setTarget(Vector3f target) \n {\n float distance = FastMath.abs(target.y - this.getPosition().y);\n this.motionTarget = target;\n this.motionPath = new MotionPath();\n \n this.motionPath.addWayPoint(this.getPosition());\n\n this.motionPath.addWayPoint(new Vector3f(this.getPosition().x, target.y, this.getPosition().z));\n \n grabberMotion = new MotionEvent(this.node, this.motionPath);\n grabberMotion.setInitialDuration(distance / this.speed);\n }", "public abstract void updateLocationXml(Location location, String newLocationName, int newLocationCapacity);", "public void setLocation(Location location) \n\t{\n\t\tthis.location = location;\n\t}", "public void setOriginalLocation() {\r\n for (int i = 0; i < this.enemies.size(); i++) {\r\n Point originalPoint = this.startLocations.get(i);\r\n this.enemies.get(i).setLocation(originalPoint);\r\n }\r\n }", "@Override\n public void setLocation(String location) {\n this.location = location;\n }", "private void UpdateLocation(final Location location)\r\n {\r\n invokeLater(new Runnable() \r\n {\r\n public void run()\r\n {\r\n double longitude = location.getQualifiedCoordinates().getLongitude();\r\n double latitude = location.getQualifiedCoordinates().getLatitude();\r\n float altitude = location.getQualifiedCoordinates().getAltitude();\r\n float speed = location.getSpeed(); \r\n String altSpeed = String.valueOf(altitude) + \" - \" + String.valueOf(speed);\r\n _lblLongitude.setText(String.valueOf(longitude));\r\n _lblLatitude.setText(String.valueOf(latitude));\r\n _lblAltSpeed.setText(altSpeed);\r\n }\r\n }); \r\n }", "public void updatePosition() {\n \t\r\n \tx += dx;\r\n \ty += dy;\r\n \t\r\n\t}", "public void setLocation(URI location)\r\n/* 288: */ {\r\n/* 289:432 */ set(\"Location\", location.toASCIIString());\r\n/* 290: */ }", "public void setSiteLocation(URI location) {\n \t\tthis.siteLocation = location;\n \t}", "private void moveToCurrentLocation() {\n \t\tGPSFilterLocationRetriever retriever = new GPSFilterLocationRetriever( new Criteria() );\n \t\tLocation loc = retriever.getLocation( this );\n \n \t\tif ( loc == null ) {\n \t\t\t// User turned off GPS, send it to device location settings.\n \t\t\tIntent i = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS );\n \t\t\tthis.startActivity( i );\n \t\t} else {\n \t\t\t// First move to the last known location..\n \t\t\tthis.moveCameraToLocation( loc, false );\n \n \t\t\t// Check if location fix is out dated, if it is, request a new location, ONCE.\n \t\t\tlong elapsedTime = System.currentTimeMillis() - loc.getTime();\n \t\t\tif ( elapsedTime > MAX_LOCATION_FIX_AGE ) {\n \t\t\t\t// Therefore, we request a single fix.\n \t\t\t\tretriever.requestSingleUpdate( this, new LocationAdapter() {\n \t\t\t\t\t@Override\n \t\t\t\t\tpublic void onLocationChanged( Location loc ) {\n \t\t\t\t\t\tmoveCameraToLocation( loc, true );\n \t\t\t\t\t}\n \t\t\t\t} );\n \t\t\t}\n \t\t}\n \t}", "@Override\n public void update(Location location) {\n System.out.println(\"We are hiring a new employee! \" + getName());\n }", "public void setTargetPosition(float x, float y){\r\n this.targetX = x;\r\n this.targetY = y;\r\n }", "@Override\n\tpublic void update() {\n\t\tmove();\n\t\tplace();\n\t}", "private void updateLocation(Location l){\n\n //Check if we are due an update (the difference between now and the last update must be more than the frequency of updates)\n long time = System.currentTimeMillis();\n l.setTime(time); //Use the time from the device TODO Do we need this step?\n long timeSinceUpdate = time - lastUpdate;\n\n\n //If an update is required\n if(timeSinceUpdate >= frequency) {\n\n //Update last update time\n lastUpdate = time;\n\n NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();\n //If connected to the internet then we can either initialize or upload our location\n if (netInfo != null && netInfo.isConnected()) {\n //If initialized upload the location\n if (initialized) {\n //Upload location the current location and tie up any loose ends\n uploadLocation(l);\n tieUpLooseEnds();\n }\n //If not initialized then initialize and add location to loose ends\n else {\n //Initialize\n init();\n //Add to loose ends\n looseEnds.add(l);\n }\n }\n //If not connected then add the location to our list of loose ends\n else {\n looseEnds.add(l);\n }\n }\n //If no update is due\n else{\n //No update - update time ago on the notification\n String updateTime = AbstractTrackerActivity.niceTime(timeSinceUpdate);\n notificationBuilder.setContentText(String.format(getString(R.string.notification_time_ago), updateTime));\n notificationManager.notify(AbstractTrackerActivity.NOTIFICATION_ID, notificationBuilder.build());\n }\n }", "protected void setLocation(Location newLocation)\n {\n if(location != null) {\n field.clear(location);\n }\n location = newLocation;\n field.place(this, newLocation);\n }", "@Override\n\tprotected void updateTargetRequest() {\n\t}", "Label setLocation();", "public void testSetGoalLocation() {\n test = new Location(9, 9);\n assertEquals(test, maze1.getGoalLocation());\n \n test = new Location(1, 1);\n maze1.setGoalLocation(test);\n assertEquals(test, maze1.getGoalLocation());\n \n test = new Location(2, 2);\n maze1.setCell(test, MazeCell.WALL);\n maze1.setGoalLocation(test);\n assertEquals(test, maze1.getGoalLocation());\n \n \n }", "public void update() {\n\t\t\n\t}", "protected void setPosition(long positionRequested, boolean update) {\n\t\tif (requestedFile != null) {\n\t\t\tcurrentFile = requestedFile;\n\t\t\trequestedFile = null;\n\t\t}\n\t\tif (currentFile != null) {\n\t\t\ttry {\n\t\t\t\tcurrentPosition = currentFile.setPosition(positionRequested);\n\t\t\t\tif (currentPosition != positionRequested)\n\t\t\t\t\tSystem.err.println(\"Warning: setPosition() failed: \" +\n\t\t\t\t\t\tcurrentPosition + \" instead of \" + positionRequested);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (update)\n\t\t\t\tgui.displayPanel.scrollTo(currentPosition /\n\t\t\t\t\t\tcurrentFile.frameSize / currentFile.frameRate, false);\n\t\t}\n\t}", "public void update(){}", "public void update(){}", "public void doUpdate() {\n fileChooser.setCurrentDirectory(new File(getPath()));\n fileChooser.rescanCurrentDirectory();\n }", "public void setLocation(int x, int y) {\r\n manager.setLocation(this, x, y);\r\n }", "protected synchronized void updateDrag(Point moveTarget) {\n if (beingDragged) {\n int dx = moveSource.x - moveTarget.x;\n int dy = moveSource.y - moveTarget.y;\n moveSource = moveTarget;\n \n int x = getHAdjustable().getValue() + dx;\n int y = getVAdjustable().getValue() + dy;\n setOrigin(x, y);\n }\n }", "private IPoint2D updateGoalPoint(IPoint2D loc, ArenaMap map, double lookAhead) {\n\t\tIPoint2D tmp = map.lastPointInRange(loc, lookAhead, true);\n\t\tRobot.managedPrinter.println(getClass(), \"next goal point: \" + tmp);\n\t\tif (tmp != null) {\n\t\t\ttmp.toDashboard(\"Goal point\");\n\t\t\tNetworkTable.getTable(\"motion\").putNumber(\"pointIdx\", ((IndexedPoint2D) tmp).getIndex());\n\t\t}\n\t\treturn tmp;\n\t}", "public void updatePosition(Location loc)\n {\n position = new BlockVector(loc.getX(), loc.getY(), loc.getZ());\n }", "public void update() {}", "public void setLocation(Path location)\n\t{\n\t\tsetHeader(LOCATION, location.toString());\n\t}", "public void update(Location location)\n {\n updatePosition(location);\n updateOrientation(location);\n updateWorld(location);\n }", "private void updateTarget(Object newValue) {\r\n if (this.bindingTarget != null) {\r\n // let the target update the new value\r\n this.bindingTarget.updateTarget(newValue);\r\n }\r\n }", "protected void setLocation(String location){\r\n this.location = location;\r\n }", "public void update() {\n\t}", "public void update() {\n\t}", "public void update() {\n\t}", "public void update() {\n\t}", "@Override\n\tpublic void locationChanged(Location newLocation) {\n\t\tshowOnMap(newLocation);\n\t\tgiveNavigationInstructions(newLocation);\n\t}", "void setLocationURI(URI locationURI);", "public void update() {\r\n\t\t\r\n\t}", "public void setLocation(float x, float y);", "public LocationEntity updateLocation(LocationDetail locationDetail) throws LocationException;", "protected void updateLocationUI() {\n if (mCurrentLocation != null) {\n //TrackDataCSVHelper myCSV2 = new TrackDataCSVHelper();\n //mDistanceFromWaypointText.setText(String.valueOf(myCSV2.getLon(track, this))); //<-- used this to test getting proper lat/lon\n //mDistanceFromWaypointText.setText(String.format(\"%s: %f\", \"Dist from WP\", mDistanceFromWaypoint));\n //mZoneStatusText.setText(\"IN THE ZONE? \" + mIsInZone);\n //mNumberUpdates.setText(String.valueOf(mNum));\n }\n }", "public void setLocation(String location) {\n this.location = location;\n }", "public void update()\n\t{\n\t\tsuper.update();\n\t}", "public void setLocation(String location) {\r\n this.location = location;\r\n }", "@Override\n\t\tpublic void update() {\n\n\t\t}", "@Override\n\t\tpublic void update() {\n\n\t\t}", "@Override\n\t\tpublic void update() {\n\n\t\t}" ]
[ "0.7320374", "0.6982854", "0.67651147", "0.66195416", "0.6561366", "0.6426398", "0.64169157", "0.63151383", "0.6293236", "0.6153", "0.6152121", "0.61073804", "0.6036623", "0.60312915", "0.6015337", "0.601275", "0.5960591", "0.593693", "0.5931203", "0.58983696", "0.5866947", "0.58426654", "0.58352613", "0.5801631", "0.58013237", "0.58001626", "0.5784881", "0.57813436", "0.5755065", "0.573363", "0.5716102", "0.57083374", "0.56995565", "0.56771386", "0.56607205", "0.5654767", "0.5644691", "0.5633279", "0.56321234", "0.56281537", "0.56281537", "0.56281537", "0.5616804", "0.5604343", "0.56018364", "0.5588547", "0.5588547", "0.5559625", "0.5544952", "0.5540354", "0.55327284", "0.5528618", "0.5521314", "0.5515469", "0.54907215", "0.5488502", "0.5466819", "0.5462581", "0.54612505", "0.54603064", "0.5459316", "0.5453121", "0.5443255", "0.5441818", "0.5438514", "0.54349864", "0.5430946", "0.54276556", "0.5419815", "0.54188967", "0.5404625", "0.53978854", "0.5394199", "0.53861487", "0.53861487", "0.5384358", "0.5381397", "0.53798485", "0.53774965", "0.537597", "0.535808", "0.53574395", "0.5351542", "0.5350358", "0.5346015", "0.5340727", "0.5340727", "0.5340727", "0.5340727", "0.53376216", "0.53364825", "0.5323747", "0.5323478", "0.5313761", "0.53136724", "0.53087336", "0.5305271", "0.5302961", "0.5301993", "0.5301993", "0.5301993" ]
0.0
-1
Update the new target location and whether the gps was fixed on take off.
private void onLocation(double latitude, double longitude, double altitude, @Nullable Boolean gpsFixedOnTakeOff) { if (Double.compare(latitude, UNKNOWN_COORDINATE) != 0 && Double.compare(longitude, UNKNOWN_COORDINATE) != 0) { mPilotingItf.updateLocation(latitude, longitude, altitude); if (gpsFixedOnTakeOff != null) { mPilotingItf.updateGpsFixedOnTakeOff(gpsFixedOnTakeOff); } } else { mPilotingItf.resetLocation(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void locationUpdate(Location newLocation, boolean isManual) {\n if (isManual) {\n /// (manual) location update by click on map\n if (mCurrentLocationManual.distanceTo(newLocation) <\n Constants.Locations.UPDATE_INTERVAL_DISTANCE) {\n /// show up explanation\n Toast toast = Toast.makeText(this, getString(R.string.tstTapIgnoringExplanation),\n Toast.LENGTH_SHORT);\n toast.setGravity(Gravity.CENTER, 0, 0);\n toast.show();\n return; /// just ignore jitter\n }\n else\n mCurrentLocationManual = newLocation;\n } else {\n /// (automatic) location update by network | GPS\n if (mCurrentLocationAutomatic.distanceTo(newLocation) < Constants.Locations.UPDATE_INTERVAL_DISTANCE)\n return; /// just ignore jitter\n else {\n mCurrentLocationAutomatic = newLocation;\n }\n }\n mCurrentLatLng = new LatLng(newLocation.getLatitude(), newLocation.getLongitude());\n /// change map position\n if (null != mPlacesMarkProcessor)\n mPlacesMarkProcessor.positionMove(mCurrentLatLng);\n\n /// asynchronously call (Foursquare) venues search for new location\n if (null != mPlacesSearchProcessor)\n mPlacesSearchProcessor.placesSearch(new Venue(newLocation.getLatitude(),\n newLocation.getLongitude()));\n /// look at placesUpdate() below to view how to process placesSearch() results...\n }", "public void updateLocation();", "private void updateGPS() {\n fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(Location.this);\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {\n fusedLocationProviderClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<android.location.Location>() {\n @Override\n public void onSuccess(android.location.Location location) {\n updateUI(location);\n }\n });\n } else {\n //permission not granted, we will ask for it\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 99);\n }\n }\n }", "@Override\n public void onLocationChanged(Location location) {\n Log.i(LOG_TAG, \"Location Change\");\n Location target = new Location(\"target\");\n String closePoint;\n int closestIndex = -1;// Default to none\n float minDistance = 1000; // Default to high value\n\n // Focus camera on initial location\n if (mapReady == true && initialCameraSet == true) {\n LatLng initialLocation = new LatLng(location.getLatitude(), location.getLongitude());\n gMap.moveCamera(CameraUpdateFactory.newLatLng(initialLocation));\n initialCameraSet = false; // Initial location already displayed\n }\n // Check if spot is close\n for (int i = 0; i < LocationsClass.spotsCoordinates.length; ++i) {\n target.setLatitude(LocationsClass.spotsCoordinates[i].latitude);\n target.setLongitude(LocationsClass.spotsCoordinates[i].longitude);\n if (location.distanceTo(target) < minDistance) {\n closestIndex = i; //Save closes index\n minDistance = location.distanceTo(target); // update minDistance\n }\n }\n\n if (minDistance < 200 && minDistance > 20) {\n Toast.makeText(getActivity(), \"Location: \" + LocationsClass.spotNames[closestIndex] +\n \" is within 200 meters!\\n\" + \"Go check it out!\", Toast.LENGTH_LONG).show();\n// pointsOfInterests.get(closestIndex).showInfoWindow();\n// gMap.getUiSettings().setMapToolbarEnabled(true);\n popNotification = true; // Allow notification to trigger when user reaches destination\n } else if (minDistance < 20) {\n if (closestIndex != currentUserLocation) {\n int locationId = getResources().getIdentifier(\"loc_\"+closestIndex, \"drawable\", getActivity().getPackageName());\n showArrivalNotification(locationId, LocationsClass.spotNames[closestIndex]);\n currentUserLocation = closestIndex; // Update user location\n }\n }\n\n if (hotspotIndex != -1) {\n pointsOfInterests.get(hotspotIndex).showInfoWindow();\n gMap.getUiSettings().setMapToolbarEnabled(true);\n }\n }", "private void updateLocation(Location l){\n\n //Check if we are due an update (the difference between now and the last update must be more than the frequency of updates)\n long time = System.currentTimeMillis();\n l.setTime(time); //Use the time from the device TODO Do we need this step?\n long timeSinceUpdate = time - lastUpdate;\n\n\n //If an update is required\n if(timeSinceUpdate >= frequency) {\n\n //Update last update time\n lastUpdate = time;\n\n NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo();\n //If connected to the internet then we can either initialize or upload our location\n if (netInfo != null && netInfo.isConnected()) {\n //If initialized upload the location\n if (initialized) {\n //Upload location the current location and tie up any loose ends\n uploadLocation(l);\n tieUpLooseEnds();\n }\n //If not initialized then initialize and add location to loose ends\n else {\n //Initialize\n init();\n //Add to loose ends\n looseEnds.add(l);\n }\n }\n //If not connected then add the location to our list of loose ends\n else {\n looseEnds.add(l);\n }\n }\n //If no update is due\n else{\n //No update - update time ago on the notification\n String updateTime = AbstractTrackerActivity.niceTime(timeSinceUpdate);\n notificationBuilder.setContentText(String.format(getString(R.string.notification_time_ago), updateTime));\n notificationManager.notify(AbstractTrackerActivity.NOTIFICATION_ID, notificationBuilder.build());\n }\n }", "private void updateCurrentTarget(){\n switch (state){\n case States.DEAD:\n currentTarget = currentLocation;\n break;\n case States.FIGHT:\n if (targetEnemy != null)\n currentTarget = targetEnemy.getCurrentLocation();\n else\n currentTarget = targetBuilding.getLocation();\n break;\n case States.RETREAT:\n currentTarget = new Point(20,20);\n break;\n case States.LOSS:\n currentTarget = new Point(20,20);\n break;\n case States.WIN:\n currentTarget = village.getCenter();\n break;\n case States.IDLE:\n currentTarget = targetBuilding.getLocation();\n }\n }", "@SuppressLint(\"MissingPermission\")\n private void requestLocationUpdate() {\n }", "public void actionUpdateGpsPosition(Location mLastLocation) {\n if(mLastLocation != null) {\n waypoint.updatePosition(mLastLocation.getLatitude(), mLastLocation.getLongitude());\n }\n }", "private void updateLocationUI() {\n if (mCurrentLocation != null) {\n Log.e(\"UPDATE GEO\", \"LAT \" + mCurrentLocation.getLatitude() + \" LON \" +\n mCurrentLocation.getLongitude() + \" LAST UPDATE \" + mLastUpdateTime);\n }\n }", "public void updateLocation(LatLng location){\n if ( Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission( this, android.Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED &&\n ContextCompat.checkSelfPermission( this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return ;\n }\n\n //allow map to display mockLocations\n mMap.setMyLocationEnabled(true);\n\n //setup Location manager\n Location mockLocation= new Location(LocationManager.GPS_PROVIDER);\n\n //build mock location using LatLng passed in\n mockLocation.setLatitude(location.latitude);\n mockLocation.setLongitude(location.longitude);\n mockLocation.setAltitude(0);\n mockLocation.setTime(System.currentTimeMillis());\n mockLocation.setElapsedRealtimeNanos(SystemClock.elapsedRealtimeNanos());\n mockLocation.setAccuracy(5);\n\n //add mockLoction to the manager\n mLocationManager.setTestProviderLocation(LocationManager.GPS_PROVIDER, mockLocation);\n mCurrentLoc = location;\n Log.i(\"LocationUpdate\", \"should have been updated\");\n\n\n\n }", "private void updateWithNewLocation(Location location)\n {\n\n float fLatitude = (float)0.0;\n float fLongitude = (float)0.0;\n float fHepe=(float)10000.0;\n byte ucNapUsed = 0;\n byte ucWiperErrorCode = 0;\n\n if (Config.LOGD) Log.d(TAG,\"Network Location callback\");\n\n if( location != null)\n {\n //read params from location structure return by WPS\n fLatitude = (float)(location.getLatitude());\n fLongitude = (float)(location.getLongitude());\n fHepe = location.getAccuracy();\n\n if(bScanCompleted == true)\n {\n ucNapUsed= (byte)aResults.size();\n }\n else\n {\n ucNapUsed = 50;\n }\n\n }\n else\n {\n ucWiperErrorCode = 99;\n }\n startWiperReport();\n native_notify_wiper_position(fLatitude,fLongitude,fHepe,ucNapUsed,ucWiperErrorCode);\n endWiperReport();\n\n }", "private void updateLocationUI() {\n if (mMap == null) {\n return;\n }\n\n /*\n * Request location permission, so that we can get the location of the\n * device. The result of the permission request is handled by a callback,\n * onRequestPermissionsResult.\n */\n if (ContextCompat.checkSelfPermission(this.getApplicationContext(),\n android.Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mLocationPermissionGranted = true;\n } else {\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);\n }\n\n if (mLocationPermissionGranted) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mLastKnownLocation = null;\n }\n }", "private void updateLocationUI() {\n if (mMap == null) {\n return;\n }\n /*\n * Request location permission, so that we can get the location of the\n * device. The result of the permission request is handled by a callback,\n * onRequestPermissionsResult.\n */\n if (ContextCompat.checkSelfPermission(this.getApplicationContext(),\n android.Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n mLocationPermissionGranted = true;\n } else {\n ActivityCompat.requestPermissions(this,\n new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);\n }\n if (mLocationPermissionGranted) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mLastKnownLocation = null;\n }\n }", "public void onLocationChanged(Location location) {\n\n if (net_connection_check()) {\n\n String message = String.format(\n\n \"New Location \\n Longitude: %1$s \\n Latitude: %2$s\",\n\n location.getLongitude(), location.getLatitude());\n\n // *************************** GPS LOCATION ***************************\n\n\n driveruserid = User_id;\n driverlat = location.getLatitude();\n driverlong = location.getLongitude();\n\n\n Location driverLocation = new Location(\"user location\");\n driverLocation.setLatitude(driverlat);\n driverLocation.setLongitude(driverlong);\n\n aController.setDriverLocation(driverLocation);\n\n String drivercurrentaddress = lattoaddress(driverlat, driverlong);\n\n\n if (!checktripend && mGoogleMap != null) {\n // mGoogleMap.clear();\n\n\n }\n LatLng mark1 = new LatLng(driverlat, driverlong);\n\n if (logoutcheck) {\n//\t\t\tDriverdetails();\n }\n\n LatLng target = new LatLng(driverlat, driverlong);\n\n String check = fullbutton.getText().toString();\n if (acc.equals(\"yes\") || check.equals(\"End Trip\")) {\n if (check.equals(\"End Trip\")) {\n // mGoogleMap.clear();\n // mGoogleMap.setTrafficEnabled(true);\n }\n origin = new LatLng(driverlat, driverlong);\n /* try{\n String url = getDirectionsUrl(origin, dest);\n drawMarker(dest);\n DownloadTask downloadTask = new DownloadTask();\n //Start downloading json data from Google Directions API\n downloadTask.execute(url);\n }catch (Exception e){\n\n }*/\n\n// checkOffRouteAndRedrwaRoute(location);\n\n }\n\n checkOffRouteAndRedrwaRoute(location);\n if (location.hasBearing() && mGoogleMap != null) {\n CameraPosition cameraPosition = new CameraPosition.Builder()\n .target(target) // Sets the center of the map to current location\n .zoom(16)\n .bearing(location.getBearing()) // Sets the orientation of the camera to east\n .tilt(0) // Sets the tilt of the camera to 0 degrees\n .build(); // Creates a CameraPosition from the builder\n mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));\n }\n }\n }", "void update(Location location);", "private void moveToCurrentLocation() {\n \t\tGPSFilterLocationRetriever retriever = new GPSFilterLocationRetriever( new Criteria() );\n \t\tLocation loc = retriever.getLocation( this );\n \n \t\tif ( loc == null ) {\n \t\t\t// User turned off GPS, send it to device location settings.\n \t\t\tIntent i = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS );\n \t\t\tthis.startActivity( i );\n \t\t} else {\n \t\t\t// First move to the last known location..\n \t\t\tthis.moveCameraToLocation( loc, false );\n \n \t\t\t// Check if location fix is out dated, if it is, request a new location, ONCE.\n \t\t\tlong elapsedTime = System.currentTimeMillis() - loc.getTime();\n \t\t\tif ( elapsedTime > MAX_LOCATION_FIX_AGE ) {\n \t\t\t\t// Therefore, we request a single fix.\n \t\t\t\tretriever.requestSingleUpdate( this, new LocationAdapter() {\n \t\t\t\t\t@Override\n \t\t\t\t\tpublic void onLocationChanged( Location loc ) {\n \t\t\t\t\t\tmoveCameraToLocation( loc, true );\n \t\t\t\t\t}\n \t\t\t\t} );\n \t\t\t}\n \t\t}\n \t}", "@Override\n public void onLocationChanged(Location location) {\n updateLocation(location);\n }", "private void updateGPS(){\n fusedLocationProviderClient =\n\n //---------------------------------------------------------------------------------------------\n\n\n //get permission from the user to track GPS\n if(ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){\n //user provided the permission\n //if a location is found than the SuccessListener will create an other trigger to an other anonymous function it´s called\n fusedLocationProviderClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>(){\n @Override\n public void onSuccess(Location location) {\n //Update the UI\n updateUIValues(location);\n }\n });\n }\n else{\n //user permission not granted yet\n //checking valid OS\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){\n requestPermissions(new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_FINE_LOCATION);\n }\n }\n\n }", "private void updateLocationToServer() {\n\n if (Utility.isConnectingToInternet(getActivity())) {\n\n if (mGpsTracker.canGetLocation()) {\n\n if (Utility.ischeckvalidLocation(mGpsTracker)) {\n\n Animation fade1 = AnimationUtils.loadAnimation(getActivity(), R.anim.flip);\n btnRefreshLocation.startAnimation(fade1);\n Map<String, String> params = new HashMap<String, String>();\n if (!AppConstants.isGestLogin(getActivity())) {\n params.put(\"iduser\", SharedPref.getInstance().getStringVlue(getActivity(), userId));\n } else {\n params.put(\"iduser\", \"0\");\n }\n\n params.put(\"latitude\", \"\" + mGpsTracker.getLatitude());\n params.put(\"longitude\", \"\" + mGpsTracker.getLongitude());\n RequestHandler.getInstance().stringRequestVolley(getActivity(), AppConstants.getBaseUrl(SharedPref.getInstance().getBooleanValue(getActivity(), isStaging)) + updatelocation, params, this, 5);\n fade1.cancel();\n } else {\n mGpsTracker.showInvalidLocationAlert();\n }\n } else {\n showSettingsAlert(5);\n }\n } else {\n Utility.showInternetError(getActivity());\n }\n\n }", "public void onLocationChanged(Location location) {\r\n\t\tif(isBetterLocation(location, this.oldLocation, this.limitPeriodToControlBetterLocation)){\r\n\t\t\tdeviceLocation.setLatitude(location.getLatitude());\r\n\t\t\tdeviceLocation.setLongitude(location.getLongitude());\r\n\t\t\tdeviceLocation.setGpsEnable(true);\r\n\t\t\tdeviceLocation.setAccuracy(location.getAccuracy());\r\n\t\t}\r\n\t\tthis.oldLocation = location;\r\n\t}", "public boolean requestingLocationUpdates() {\n return prefs\n .getBoolean(KEY_REQUESTING_LOCATION_UPDATES, false);\n }", "@Override\n public void onLocationUpdated(Location location) {\n fromPosition = new LatLng(location.getLatitude(), location.getLongitude());\n btn1.setVisibility(View.VISIBLE);\n moveCamera(new LatLng(location.getLatitude(), location.getLongitude()),\n DEFAULT_ZOOM, \"My Location\");\n }", "public void updateLocation()\r\n {\r\n\t\timg.setUserCoordinator(latitude, longitude);\r\n\t\timg.invalidate();\r\n\t}", "public void updatePlayerLocation() {requires new property on gamestate object\n //\n }", "@Override\n public void onLocationChanged( final Location location ) {\n if (location!=null) {\n // sore last location as member, in case it is needed somewhere (in e.g. your adjusted project)\n MainActivity.this.lastKnownLocaton = location;\n if ( MainActivity.this.architectView != null ) {\n // check if location has altitude at certain accuracy level & call right architect method (the one with altitude information)\n if ( location.hasAltitude() && location.hasAccuracy() && location.getAccuracy()<7) {\n MainActivity.this.architectView.setLocation( location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getAccuracy() );\n } else {\n MainActivity.this.architectView.setLocation( location.getLatitude(), location.getLongitude(), location.hasAccuracy() ? location.getAccuracy() : 1000 );\n }\n }\n }\n }", "@Override\r\n\tpublic Location updateLocation(Location location, boolean force) {\r\n\t\t\r\n\t\tif(force||\r\n\t\t\t\tlocation.getTimestampmilis()>=pos.getTimestampmilis()||\r\n\t\t\t\t(\r\n\t\t\t\t\tpos.getAccurancy()==-1||\r\n\t\t\t\t\tlocation.getAccurancy()>=0&&(location.getAccurancy()<pos.getAccurancy())\r\n\t\t\t\t)\r\n\t\t\t){\r\n\t\t\tpos=location;\r\n\t\t}else {\r\n\t\t\tLogger.d( \"Location not updated\");\r\n\t\t}\r\n\t\treturn pos;\r\n\t}", "private void updateLocation() {\n myLocationOnScreenRef.set(myComponent.getLocationOnScreen());\n }", "public boolean updateTo(int barID, double target) {\r\n\t\t// Adjust the status; changing it by the difference between the given\r\n\t\t// and current values.\r\n\t\treturn update(barID, Math.abs(target) - currentTarget[barID]);\r\n\t}", "private void setLocationUpdateFunction() {\n fabLocation.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n //create boolean isGPSEnabled equal to result returned from isProviderEnabled() method, sending locationManager.GPS_PROVIDER as paremeter\n boolean isGPSEnabled = locationManager.isProviderEnabled(locationManager.GPS_PROVIDER);\n //create boolean isNetworkEnabled equal to result returned from isProviderEnabled() method, sending locationManager.NETWORK_PROVIDER as paremeter\n boolean isNetworkEnabled = locationManager.isProviderEnabled(locationManager.NETWORK_PROVIDER);\n\n //if statement to determine if both booleans are false\n if (!isGPSEnabled && !isNetworkEnabled && ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission_group.LOCATION) != PackageManager.PERMISSION_GRANTED) {\n //toast message to tell the user that network and location are not available/enabled\n Toast.makeText(MainActivity.this, \"Network and Location not Available\", Toast.LENGTH_LONG).show();\n return;\n } else {\n //create Criteria object critera\n Criteria criteria = new Criteria();\n\n //string provider equal to value returned from method\n String provider = locationManager.getBestProvider(criteria, true);\n\n fabLocation.setClickable(false);\n\n //call locationupdater\n locationManager.requestLocationUpdates(provider, 0, 0, locationListener);\n }\n }\n });\n }", "private void updateMovement() {\n if (_movementTask == null) {\n return;\n }\n\n if (getOwner().isDead() || _followTarget != null && _followTarget.isDead()) {\n cancelMoveTask2(true);\n return;\n }\n\n // Movement is invalid! Queue a new movement and wait again!\n if (_destinationLocation == null)\n {\n if (_waypoints.peek() != null) {\n _destinationLocation = _waypoints.poll();\n\n if (getOwner().getLocation().getGameSector() != null && getOwner().getLocation().getGameSector().hasActiveNeighbours()) {\n double validatedZ = GeoService.getInstance().validateZ(_destinationLocation.getX(), _destinationLocation.getY(), _destinationLocation.getZ());\n if (validatedZ == Double.MIN_VALUE) {\n _movementTick = System.currentTimeMillis();\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n\n if (_destinationLocation != null) {\n _destinationLocation.setZ(validatedZ);\n }\n else {\n _movementTick = System.currentTimeMillis();\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n _isSectorActive = true;\n }\n else {\n _isSectorActive = false;\n }\n notifySector(true);\n }\n else\n {\n _movementTick = System.currentTimeMillis();\n getOwner().getAi().setFindPathCompleted(true);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n }\n\n if (_destinationLocation != null) {\n // Update current character movement, the location.\n float deltaTime = (System.currentTimeMillis() - _movementTick) / 1000.0f;\n float movementSpeed = getOwner().getActionStorage().getMoveSpeed();\n if (getOwner().getActionStorage().getAction().getActionChartActionT().getApplySpeedBuffType().isMove()) {\n movementSpeed *= (getOwner().getGameStats().getMoveSpeedRate().getMoveSpeedRate() + 1_000_000.0f) / 1_000_000.0f;\n }\n\n Location ownerLocation = getOwner().getLocation();\n\n double movementDirectionX = _destinationLocation.getX() - ownerLocation.getX();\n double movementDirectionY = _destinationLocation.getY() - ownerLocation.getY();\n double movementDirectionZ = _destinationLocation.getZ() - ownerLocation.getZ();\n\n double directionLength = Math.sqrt(Math.pow(movementDirectionX, 2) + Math.pow(movementDirectionY, 2) + Math.pow(movementDirectionZ, 2));\n movementDirectionX /= directionLength;\n movementDirectionY /= directionLength;\n movementDirectionZ /= directionLength;\n\n ownerLocation.setXYZ(\n ownerLocation.getX() + movementDirectionX * movementSpeed * deltaTime,\n ownerLocation.getY() + movementDirectionY * movementSpeed * deltaTime,\n ownerLocation.getZ() + movementDirectionZ * movementSpeed * deltaTime\n );\n\n if (_isSectorActive && !_navigationType.isAir()) {\n double validatedZ = GeoService.getInstance().validateZ(ownerLocation.getX(), ownerLocation.getY(), ownerLocation.getZ());\n if (validatedZ == Double.MIN_VALUE) {\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n return;\n }\n\n ownerLocation.setZ(validatedZ);\n }\n\n if (ownerLocation.isValid() && World.getInstance().getWorldMap().updateLocation(getOwner(), ownerLocation.getX(), ownerLocation.getY())) {\n double distanceToPoint = MathUtils.getDistance(ownerLocation, _destinationLocation) - getOwner().getTemplate().getBodySize();\n notifyVehicleMovement();\n\n if (_followTarget != null) {\n distanceToPoint -= _followTarget.getTemplate().getBodySize();\n\n if (!MathUtils.isInRange(_destinationLocation, _followTarget.getLocation(), 150)) {\n _destinationLocation.setLocation(_followTarget.getLocation());\n notifySector(true);\n } else { // No more waypoint's available. Send movement stop and events.\n if (distanceToPoint < 75 || distanceToPoint < getOwner().getTemplate().getAttackRange() && getOwner().getAi().getBehavior().isChase()) {\n getOwner().getAi().setFindPathCompleted(true);\n cancelMoveTask2(false);\n onMovementComplete();\n }\n }\n } else {\n // Check if we are near another destination, then we will\n // switch to another waypoint instead to continue our journey.\n Location nextWaypoint = _waypoints.peek();\n if (nextWaypoint != null) {\n if (distanceToPoint < 100) {\n _destinationLocation = null;\n }\n } else { // No more waypoint's available. Send movement stop and events.\n if (distanceToPoint < 75 || distanceToPoint < getOwner().getTemplate().getAttackRange() && getOwner().getAi().getBehavior().isChase()) {\n getOwner().getAi().setFindPathCompleted(true);\n cancelMoveTask2(false);\n onMovementComplete();\n }\n }\n }\n } else {\n getOwner().getAi().setFindPathCompleted(false);\n cancelMoveTask2(true);\n onMovementComplete();\n }\n }\n _movementTick = System.currentTimeMillis();\n }", "public void setTargetLocation(Location targetLocation) \n {\n this.targetLocation = targetLocation;\n }", "public void onNewLocationFromGPS(Location location) {\n gpsLocationFound = true;\n currentLocation = location;\n this.setLocationText(getLocationForPrint(location.getLatitude(),\n location.getLongitude()));\n requestForValidationOfQibla();\n }", "@Override\n\tpublic void onLocationChanged(Location arg0) {\n\n\t}", "@Override\n\tpublic void onLocationChanged(Location arg0) {\n\n\t}", "public void update() {\n\t\tfinal StarSystem oldLocation = getPlayer().getLocation();\n\t\tfinal StarSystem newLocation = getChart().getSelected();\n\t\tgetPlayer().setLocation(newLocation);\n\t\tgetPlayer().setFuel(-oldLocation.distanceToStarSystem(newLocation));\n\t\tgetChart().setSelected(null);\n\t\tgetChart().repaint();\n\t\tplanetLbl.setText(\"Current Location: \" + player.getLocation().getName()\n\t\t\t\t+ \"....Tech Level: \" + player.getLocation().getTechLevel());\n\n\t}", "@Override\n public void onLocationChanged(Location location) {\n mLastLocation = location;\n\n\n }", "@Override\n public void requestLocationUpdates() {\n handler = new Handler();\n handler.postDelayed(new LocationUpdateRunnable(), UPDATE_INTERVAL_MS);\n }", "public void updateYLoc();", "private void setCurrentLocation() {\n foundLocation = false;\n //Ignore the red line - we check for permissions before this function is called\n if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return;\n }\n googleMap.setMyLocationEnabled(true);\n FusedLocationProviderClient mFusedLocationProviderClient = LocationServices\n .getFusedLocationProviderClient(getActivity());\n //Ignore the red line - we check for permissions before this function is called\n Task<Location> lastLocation = mFusedLocationProviderClient.getLastLocation();\n lastLocation.addOnCompleteListener(task -> {\n if (task.isSuccessful()) {\n // Set the map's camera position to the current location of the device.\n Location location = task.getResult();\n if (location == null) {\n locationControlTask = new LocationControl();\n locationControlTask.execute(getActivity());\n } else {\n LatLng currentLatLng = new LatLng(location.getLatitude(),\n location.getLongitude());\n CameraUpdate update = CameraUpdateFactory.newLatLngZoom(currentLatLng,\n DEFAULT_ZOOM);\n googleMap.moveCamera(update);\n foundLocation = true;\n }\n }\n });\n }", "public void autoUpdate()\n {\n if(distanceSensor.checkDistance() < 300 && myRobot.getAutoDrive())\n {\n activateDumpSolenoid(forward);\n myRobot.setAutoDoneTrue();\n }\n\n //closes the ball tray after doing autonomous\n if(distanceSensor.checkDistance() > 900 && myRobot.getAutoDrive())\n {\n activateDumpSolenoid(reverse);\n }\n }", "protected void updateLocationUI() {\n if (mCurrentLocation != null) {\n //TrackDataCSVHelper myCSV2 = new TrackDataCSVHelper();\n //mDistanceFromWaypointText.setText(String.valueOf(myCSV2.getLon(track, this))); //<-- used this to test getting proper lat/lon\n //mDistanceFromWaypointText.setText(String.format(\"%s: %f\", \"Dist from WP\", mDistanceFromWaypoint));\n //mZoneStatusText.setText(\"IN THE ZONE? \" + mIsInZone);\n //mNumberUpdates.setText(String.valueOf(mNum));\n }\n }", "private void updateLocationUI() {\n if (mMap == null) {\n return;\n }\n try {\n if (mLocationPermissionGranted) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mLastKnownLocation = null;\n getLocationPermission();\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "private void updateLocationUI() {\n if (mMap == null) {\n return;\n }\n try {\n if (mLocationPermissionGranted) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mLastKnownLocation = null;\n getLocationPermission();\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "private void updateLocationUI() {\n if (mMap == null) {\n return;\n }\n try {\n if (mLocationPermissionGranted) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mLastKnownLocation = null;\n getLocationPermission();\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "@Override\n\tpublic void onLocationChanged(android.location.Location arg0) {\n\t\tif(gmapFlag == true){\n\t\t\tmyLocation = new LatLng(arg0.getLatitude(), arg0.getLongitude());\n\t\t}\n\t\t\n\t\t\n\t}", "@Override\r\n public synchronized void onLocationChange(Location location) {\r\n\r\n if (event.isOngoing()) { //check for event status\r\n evaluateOverspeeding(System.currentTimeMillis());\r\n } else {\r\n interrupt();\r\n }\r\n }", "private void updateLocationUi() {\n if (mMap == null) {\n return;\n }\n try {\n if (mPermissionCheck.locationPermissionGranted()) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "public boolean setGPS(String longitude, String latitude);", "@Override\n \t\t\tpublic void onLocationChanged(Location loc) {\n \t \n \t\t\t}", "@Override\n public void onLocationChanged(Location location) {\n if(!firstLocCheck){\n drive = new Drive(location.getLatitude(),location.getLongitude(),Car.carList.get(carIndex),startTime);\n firstLocCheck = true;\n } else {\n Drive.curLat = location.getLatitude();\n Drive.curLong = location.getLongitude();\n }\n System.out.println(\"Location has changed\");\n System.out.println(location.getLatitude() + \" | \" + location.getLongitude());\n\n //updateLoc(location);\n //locProvider = location.getProvider();\n }", "public void onLocationChanged(Location argLocation) {\n\t GeoPoint myGeoPoint = new GeoPoint(\r\n\t (int)(argLocation.getLatitude()*1000000),\r\n\t (int)(argLocation.getLongitude()*1000000));\r\n\t /*\r\n\t * it will show a message on \r\n\t * location change\r\n\t Toast.makeText(getBaseContext(),\r\n\t \"New location latitude [\" +argLocation.getLatitude() +\r\n\t \"] longitude [\" + argLocation.getLongitude()+\"]\",\r\n\t Toast.LENGTH_SHORT).show();\r\n\t */\r\n\r\n\t mapController.animateTo(myGeoPoint);\r\n\r\n\t }", "@Override\n public void onLocationChanged(Location location) {\n mPreviousLocation = mCurrentLocation;\n mCurrentLocation = location;\n //This causes the app to crash during first permission checks\n /* //Distance from current location to previous location\n mDistanceTravelled = mCurrentLocation.distanceTo(mPreviousLocation);*/\n //Distance from current location to waypoint location\n mDistanceFromWaypoint = mCurrentLocation.distanceTo(mWaypoint);\n mNum++;\n\n //Controls lap timer functionality based on location relative to the user and the waypoint\n isUserInStartZone();\n\n //mNumberUpdates++;\n updateLocationUI();\n\n }", "public void onLocationChanged(Location newlocation) {\n\t\t\t\t\n\t\t\t\tif (newlocation != null) \n\t\t\t\t{\n\t\t\t\t\tlocationManager.removeUpdates(this);\n\t\t\t\t\tpoint=getGeoPoint(newlocation);\n\t\t\t\t\t//String altitiude = \"Altitiude: \" + newlocation.getAltitude();\n\t\t\t\t\t//String accuracy = \"Accuracy: \" + newlocation.getAccuracy();\n\t\t\t\t\t//String time = \"Time: \" + newlocation.getTime();\n\t\t\t\t\tmapController.animateTo(point);\n\t\t\t\t\t\n\t\t\t\t\tlatitudes= String.valueOf(newlocation.getLatitude() * 1E6);\n\t\t\t\t\tlongitudes= String.valueOf (newlocation.getLongitude() * 1E6);\n\t\t\t\t\tnameValuePairs.add(new BasicNameValuePair(\"latd\",latitudes));\n\t\t\t\t\tnameValuePairs.add(new BasicNameValuePair(\"lotd\",longitudes));\n\t\t\t\t\tnameValuePairs.add(new BasicNameValuePair(\"id\",LoginId));\n\t\t\t\t\tArrayList<NameValuePair> result=db.getServerData(nameValuePairs,\"updatecoordinates.php\");\n\t\t\t\t\tnameValuePairs.clear();\n\t\t\t\t\tfor(int i=0;i<result.size();i++)\n\t\t\t\t\t{\n\t\t\t\t\t\ts=result.get(i).getName();\n\t\t\t\t\t\tif(s.equals(\"Error\"))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tToast tt=Toast.makeText(MapViewActivity.this, \"Co-Ords Updated\", 3000);\n\t\t\t\t\t\t\ttt.setGravity(Gravity.CENTER, 0, 15);\n\t\t\t\t\t\t\ttt.show();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tToast tt=Toast.makeText(MapViewActivity.this, \"Co-Ords Updated Error\", 3000);\n\t\t\t\t\t\t\ttt.setGravity(Gravity.CENTER, 0, 15);\n\t\t\t\t\t\t\ttt.show();break;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tresult.clear();\n\t\t\t\t\t\n\t\t\t\t\tmapView.invalidate();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "private void updateLocationUI() {\n if (mMap == null) {\n return;\n }\n try {\n if (mLocationPermissionGranted) {\n mMap.setMyLocationEnabled(true);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n } else {\n mMap.setMyLocationEnabled(false);\n mMap.getUiSettings().setMyLocationButtonEnabled(false);\n mLastKnownLocation = null;\n getLocationPermission();\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "private boolean isBetter(Location newLocation, Location oldLocation) {\n return true;\n }", "public abstract void updateLocations();", "public void onLocationChanged(Location location) {\n\t\t\t\tupdatenewlocation(location);\n\t\t\t\t\n\t\t\t}", "private void startLocationUpdates() {\r\n try {\r\n TimeUnit.SECONDS.sleep(3);\r\n } catch (InterruptedException e) {\r\n e.printStackTrace();\r\n }\r\n mFusedLocationClient.requestLocationUpdates(getLocationRequest(), mLocationCallback, Looper.getMainLooper());\r\n mMap.setMyLocationEnabled(true);\r\n }", "@Override\n\tpublic void update() {\n\t\t\n\t\tif (state) {\n\t\t\treturn;\n\t\t}\n\t\tsync();\n\t\tfor (QuestPlayer player : participants.getParticipants()) {\n\t\t\tif (player.getPlayer().isOnline())\n\t\t\tif (player.getPlayer().getPlayer().getLocation().getWorld().getName().equals(destination.getWorld().getName()))\n\t\t\tif ((player.getPlayer().getPlayer()).getLocation().distance(destination) <= targetRange) {\n\t\t\t\tstate = true;\n\t\t\t\tupdateQuest();\n\t\t\t\t\n\t\t\t\t//unregister listener, cause we'll never switch to unsatisfied\n\t\t\t\tHandlerList.unregisterAll(this);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tstate = false;\n\t}", "@Override\r\n public void onLocationChanged(Location location) {\n\r\n sendLocationUpdates(location);\r\n }", "private void updateLocationUI() {\n if (map == null) {\n return;\n }\n try {\n if (locationPermissionGranted) {\n map.setMyLocationEnabled(true);\n map.getUiSettings().setMyLocationButtonEnabled(true);\n } else {\n map.setMyLocationEnabled(false);\n map.getUiSettings().setMyLocationButtonEnabled(false);\n lastKnownLocation = null;\n getLocationPermission();\n }\n } catch (SecurityException e) {\n Log.e(\"Exception: %s\", e.getMessage());\n }\n }", "private void updateUI() {\n if (mCurrentLocation != null) {\n mLatitudeTextView.setText(String.valueOf(mCurrentLocation.getLatitude()));\n mLongitudeTextView.setText(String.valueOf(mCurrentLocation.getLongitude()));\n mLastUpdateTimeTextView.setText(mLastUpdateTime);\n\n localLatitude = Double.parseDouble(mLatitudeTextView.getText().toString());\n localLongtitude = Double.parseDouble(mLongitudeTextView.getText().toString());\n double newDistance = Math.round(gps2m(previousLatitude, previousLongitude, localLatitude, localLongtitude) * 100) / 100.0;\n\n /*\n if (!mStartUpdatesButton.isEnabled()) {\n mMoveTextView.setText(String.valueOf(newDistance) + \" m\");\n totalDistance += newDistance;\n\n mTotalDistanceTextView.setText(String.valueOf(totalDistance) + \"m\");\n }\n previousLatitude = localLatitude != 0 ? localLatitude : previousLongitude;\n previousLongitude = localLongtitude != 0 ? localLongtitude : previousLatitude;\n\n\n if (!mStartUpdatesButton.isEnabled()) {\n double speed = Double.parseDouble(timeToSpeed());\n\n timeslots.add(System.currentTimeMillis());\n userspeeds.add((float) speed);\n float randomspeed = (float)Math.random()*6;\n compspeeds.add(randomspeed);\n mSpeedTextView.setText(String.valueOf(speed) + \"km/h\");\n\n //TODO: change weight\n double calValue = calorieCalculator(weight, timeSingleValue / 3600, speed);\n calValue = Math.round(calValue * 100) / 100;\n calValue = calValue < 0 ? 0 : calValue;\n calValue = calValue > 100 ? 100 : calValue;\n calValue = calValue / 1000;\n mCalTextView.setText(String.valueOf(calValue));\n compDistance += 5*randomspeed/3600*1000;\n int predictedCalories = (int) Math.round((calValue / timeSingleValue)) * 3600;\n mCalPredictTextView.setText(String.valueOf(predictedCalories));\n\n\n if (compDistance > totalDistance) {\n if (status == 0 || status == 1) {\n MediaPlayer mediaPlayer1 = MediaPlayer.create(getApplicationContext(), R.raw.tooslow);\n mediaPlayer1.start();\n status = 2;\n }\n } else {\n if (status == 0 || status == 2) {\n MediaPlayer mediaPlayer2 = MediaPlayer.create(getApplicationContext(), R.raw.toofast);\n mediaPlayer2.start();\n status = 1;\n }\n }\n }\n */\n if (!mStartUpdatesButton.isEnabled()) {\n mMoveTextView.setText(String.valueOf(newDistance) + \" m\");\n totalDistance += newDistance;\n double totalDistanceOutput = Math.round(totalDistance * 100) / 100.0;\n totalDistanceOutput = totalDistanceOutput < 0 ? 0 : totalDistanceOutput;\n mTotalDistanceTextView.setText(String.valueOf(totalDistanceOutput) + \"m\");\n }\n previousLatitude = localLatitude != 0 ? localLatitude : previousLongitude;\n previousLongitude = localLongtitude != 0 ? localLongtitude : previousLatitude;\n if (!mStartUpdatesButton.isEnabled()) {\n double speed = Double.parseDouble(timeToSpeed());\n timeslots.add(System.currentTimeMillis());\n userspeeds.add((float) speed);\n float randomspeed = (float) Math.random() * 2;\n compspeeds.add(randomspeed);\n mSpeedTextView.setText(String.valueOf(speed) + \" km/h\");\n double calValue = calorieCalculator(weight, timeSingleValue / 3600, speed);\n calValue = calValue < 0 ? 0 : calValue;\n calValue = calValue > 100 ? 100 : calValue;\n calValue = calValue / 1000.0 * 60;\n calValue = Math.round(calValue * 100) / 100.0;\n mCalTextView.setText(String.valueOf(calValue) + \" kCal/m\");\n compDistance += 5 * randomspeed / 3600 * 1000;\n double predictedCalories = (calValue / timeSingleValue) * 60;\n predictedCalories = (predictedCalories < 0 || predictedCalories > 100000) ? 0 : predictedCalories;\n mCalPredictTextView.setText(\"~ \" + String.valueOf(predictedCalories) + \" kCal\");\n\n if (compDistance > totalDistance) {\n if (status == 0 || status == 1) {\n MediaPlayer mediaPlayer1 = MediaPlayer.create(getApplicationContext(), R.raw.tooslow);\n mediaPlayer1.start();\n status = 2;\n }\n } else {\n if (status == 0 || status == 2) {\n MediaPlayer mediaPlayer2 = MediaPlayer.create(getApplicationContext(), R.raw.toofast);\n mediaPlayer2.start();\n status = 1;\n }\n }\n }\n }\n }", "@Override\n\tpublic void onLocationChanged(Location loc)\n\t{\n\t}", "protected void trackLocation(View v) {\n SharedPreferences sharedPreferences = this.getSharedPreferences(\"com.tryagain.com.fleetmanagmentsystem.prefs\", Context.MODE_PRIVATE);\n SharedPreferences.Editor editor = sharedPreferences.edit();\n\n if (!saveUserSettings()) {\n return;\n }\n\n if (!checkIfGooglePlayEnabled()) {\n return;\n }\n\n if (currentlyTracking) {\n cancelAlarmManager();\n\n currentlyTracking = false;\n editor.putBoolean(\"currentlyTracking\", false);\n editor.putString(\"sessionID\", \"\");\n //int totalFuel = sharedPreferences.getInt(\"fuel\", 0);\n //float totalDistance = sharedPreferences.getFloat(\"distance\", -1);\n //Toast.makeText(getApplicationContext(),\"\"+totalFuel+\" \"+totalDistance,Toast.LENGTH_SHORT).show();\n } else {\n startAlarmManager();\n\n currentlyTracking = true;\n editor.putBoolean(\"currentlyTracking\", true);\n //editor.putFloat(\"totalDistanceInMeters\", 0f);\n editor.putBoolean(\"firstTimeGettingPosition\", true);\n editor.putString(\"sessionID\", UUID.randomUUID().toString());\n editor.putInt(\"fuel\", gaugeValue);\n\n mGaugeView.setVisibility(View.INVISIBLE);\n }\n\n editor.apply();\n setTrackingButtonState();\n }", "public void setLatitudeLongitude(Latitude updateLat,Longitude updateLon){\n trackLat = updateLat;\n trackLon = updateLon;\n // if(reportLocation != null){\n String out = trackNumber+\" update received\";\n if(debug){\n System.out.println(\"\\n\\n\"+trackNumber+\" set (update) new the location\");\n System.out.println(\"Set lat lon\"+updateLat.getDegrees () +\" and \"+updateLon.getDegrees ());\n }\n\n eventLogger.log(\" \");\n eventLogger.log(out);\n\n Constant.othGoldOutput.println (\"\");\n Constant.othGoldOutput.println (out);\n Constant.othGoldOutput .flush ();\n\n if(reportLocation != null){\n\n EventHandle[] reportLoc = ECAAgent.getEventHandles(reportLocationEventName);\n PrimitiveEventHandle peh = (PrimitiveEventHandle)beginCountDn;\n\n peh.insert(\"TimeStamp\",(Object)TrackUtilities.getTimeStamp());\n ECAAgent.getDefaultECAAgent().raiseEndEvent(reportLoc,this);\n beginCountDown();\n }\n return ;\n }", "@Override\n public void onLocationChanged(Location location) {\n\n if(!locationFound){\n while(mlongitude == 0.0 && mlatitude == 0.0) {\n\n mlatitude = location.getLatitude();\n mlongitude = location.getLongitude();\n }\n\n locationFound = true;\n }\n\n }", "public void onLocationChanged(Location location) {\n Log.d(\"Location\",location.toString());\n currentPosition.setAltitude(location.getAltitude());\n currentPosition.setCoordinate(new SKCoordinate(location.getLongitude(),location.getLatitude()));\n currentPosition.setSpeed(location.getSpeed());\n mapView.setPositionAsCurrent(currentPosition.getCoordinate(),1,true);\n }", "private void startLocationUpdate()\r\n {\r\n try \r\n {\r\n _locationProvider = LocationProvider.getInstance(null);\r\n \r\n if ( _locationProvider == null ) \r\n {\r\n // We would like to display a dialog box indicating that GPS isn't supported, but because\r\n // the event-dispatcher thread hasn't been started yet, modal screens cannot be pushed onto\r\n // the display stack. So delay this operation until the event-dispatcher thread is running\r\n // by asking it to invoke the following Runnable object as soon as it can.\r\n Runnable showGpsUnsupportedDialog = new Runnable() \r\n {\r\n public void run() \r\n {\r\n Dialog.alert(\"GPS is not supported on this platform, exiting...\");\r\n System.exit( 1 );\r\n }\r\n };\r\n invokeLater( showGpsUnsupportedDialog ); // ask event-dispatcher thread to display dialog ASAP\r\n } \r\n else \r\n {\r\n // only a single listener can be associated with a provider, and unsetting it involves the same\r\n // call but with null, therefore, no need to cache the listener instance\r\n _locationProvider.setLocationListener(new LocationListenerImpl(), _interval, 1, 1);\r\n }\r\n } catch (LocationException le) {\r\n System.err.println(\"Failed to instantiate the LocationProvider object, exiting...\");\r\n System.err.println(le); \r\n System.exit(0);\r\n } \r\n }", "public void setLocation(){\n //Check if user come from notification\n if (getIntent().hasExtra(EXTRA_PARAM_LAT) && getIntent().hasExtra(EXTRA_PARAM_LON)){\n Log.d(TAG, \"Proviene del servicio, lat: \" + getIntent().getExtras().getDouble(EXTRA_PARAM_LAT) + \" - lon: \" + getIntent().getExtras().getDouble(EXTRA_PARAM_LON));\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(getIntent().getExtras().getDouble(EXTRA_PARAM_LAT), getIntent().getExtras().getDouble(EXTRA_PARAM_LON)), 18));\n NotificationManager mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);\n mNM.cancel(1);\n } else{\n if (bestLocation!=null){\n Log.d(TAG, \"Posicion actual -> LAT: \"+ bestLocation.getLatitude() + \" LON: \" + bestLocation.getLongitude());\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(bestLocation.getLatitude(), bestLocation.getLongitude()), 16));\n } else{\n mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(41.651981, -4.728561), 16));\n }\n }\n }", "private boolean isBetterLocation(Location location, Location otherLocation) {\n\t\tfinal int DISTANCE = 200;\n\t\t\n\t // Check whether the new location fix is newer or older\n\t long timeDelta = location.getTime() - otherLocation.getTime();\n\t boolean isSignificantlyNewer = timeDelta > TIME_THRESHOLD;\n\t boolean isSignificantlyOlder = timeDelta < -TIME_THRESHOLD;\n\t boolean isNewer = timeDelta > 0;\n\n\t // If it's been more than two minutes since the current location, use the new location\n\t // because the user has likely moved\n\t if (isSignificantlyNewer) {\n\t return true;\n\t // If the new location is more than two minutes older, it must be worse\n\t } else if (isSignificantlyOlder) {\n\t return false;\n\t }\n\n\t // Check whether the new location fix is more or less accurate\n\t int accuracyDelta = (int) (location.getAccuracy() - otherLocation.getAccuracy());\n\t boolean isLessAccurate = accuracyDelta > 0;\n\t boolean isMoreAccurate = accuracyDelta < 0;\n\t boolean isSignificantlyLessAccurate = DISTANCE > 200;\n\n\t // Check if the old and new location are from the same provider\n\t boolean isFromSameProvider = isSameProvider(location.getProvider(),\n\t otherLocation.getProvider());\n\n\t // Determine location quality using a combination of timeliness and accuracy\n\t if (isMoreAccurate) {\n\t return true;\n\t } else if (isNewer && !isLessAccurate) {\n\t return true;\n\t } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) {\n\t return true;\n\t }\n\t return false;\n\t}", "public void startUpdatesButtonHandler() {\n if (!mRequestingLocationUpdates) {\n mRequestingLocationUpdates = true;\n // startLocationUpdates();\n }\n }", "@Override\n \tpublic void onLocationChanged(Location location) {\n \t\tthis.location = location;\n \t}", "@Override\r\n\tpublic void update() {\r\n\t\t\r\n\t\tboolean fireKicker = kickerTarget;\r\n\t\tdouble localWheelTarget = wheelTarget;\r\n\t\tdouble localHoodTarget = hoodTarget;\r\n\t\tdouble localTurretTarget = turretTarget;\r\n\t\t\r\n\t\tflywheel.setTargetVelocity(localWheelTarget);\r\n\t\tservoBoulderLock.set(servoTarget);\r\n\t\t\r\n\t\tsafeToFire = (getFlywheelCurrentVelocity() >= 50) &&\r\n\t\t\t\t(servoBoulderLock.get() == Constants.BALL_HOLDER_RETRACTED) &&\r\n\t\t\t\t(getHoodCurrentAngle() <= 70);\r\n\t\t\r\n\t\tif(fireKicker && safeToFire)\r\n\t\t\tkicker.fire();\r\n\t\telse\r\n\t\t\tkicker.reset();\r\n\t\t\r\n\t\tif(intake.safeForTurretToMove()){\r\n\t\t\thood.setTargetPosition(localHoodTarget);\r\n\t\t\tturret.setTargetPosition(localTurretTarget);\r\n\t\t} \r\n\t\t\r\n\t\tif(hood.isHoodSwitchPressed()){\r\n\t\t\thood.resetZeroPosition();\r\n\t\t}\r\n\t\t\r\n\t}", "@Override\n public void onLocationChanged(Location location) {\n }", "@Override\n public void onLocationChanged(Location location) {\n currentSpeed = location.getSpeed();\n //locationText.setText(String.valueOf(latitude)+ \" \" +String.valueOf(longitude)+ \" \" +String.valueOf(speed));\n //isGPSReady = true;\n }", "public void startLocationUpdates() {\n startLocationUpdatesFromInside();\n showForegroundNotification();\n }", "@Override\r\n\t\t\tpublic void onFinish() {\n\t\t\t\tLog.i(tag, \"Locatie bepalen..\");\r\n\t\t\t\tlm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000,\r\n\t\t\t\t\t\tminDistanceMeters, locationListener);\r\n\t\t\t}", "protected void startLocationUpdates() {\n mLocationRequest = new LocationRequest();\n mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n mLocationRequest.setInterval(UPDATE_INTERVAL);\n //mLocationRequest.setFastestInterval(FASTEST_INTERVAL);\n\n // Create LocationSettingsRequest object using location request\n LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();\n builder.addLocationRequest(mLocationRequest);\n LocationSettingsRequest locationSettingsRequest = builder.build();\n\n // Check whether location settings are satisfied\n // https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient\n SettingsClient settingsClient = LocationServices.getSettingsClient(this);\n settingsClient.checkLocationSettings(locationSettingsRequest);\n\n // new Google API SDK v11 uses getFusedLocationProviderClient(this)\n try{\n getFusedLocationProviderClient(this).requestLocationUpdates(mLocationRequest, new LocationCallback() {\n @Override\n public void onLocationResult(LocationResult locationResult) {\n onLocationChanged(locationResult.getLastLocation(),false);\n }\n },\n Looper.myLooper());\n }\n catch(SecurityException e){\n e.printStackTrace();\n }\n\n }", "public boolean wander() {\n\t\tMapLocation target = sensor.findTargetLocation();\n\t\treturn(nav.moveToLocation(target));\n\t}", "public boolean hasLocation()\n {\n return targetLocation != null;\n }", "@Override\r\n\tpublic void newLocationHasBeenCalculated(final String LocationCalculated) {\n\t\tfinal TextView ts = (TextView) findViewById(R.id.virtualSpot);\r\n\t\td(\"newLocation = \" + LocationCalculated);\r\n\t\t//currVS.setText(\"LocationCalculated\");\r\n\t\trunOnUiThread(new Runnable() {\r\n @Override\r\n public void run() {\r\n \tts.setText(LocationCalculated);\r\n \t\r\n \tcurrentVirtualSpot = mapOfVirtualSpots.get(LocationCalculated);\r\n \t\tif (location != -1 && currentVirtualSpot != null){\r\n \t\t\troute = ninethFloor.getRoute(currentVirtualSpot.getFirstPOI(), \"\"+location);\t\r\n \t\t\tdirectionDescription = route.getDirections();\r\n \t\t\tts.setText(directionDescription);\r\n \t\t}\r\n }\r\n });\r\n\t\t\r\n\t}", "@Override\n\t\tpublic void onLocationChanged(Location location) {\n\t\t\t\n\t\t}", "@Override\n\t\tpublic void onLocationChanged(Location location) {\n\t\t\t\n\t\t}", "@Override\n public void onLocationChanged(Location location) {\n currentLat = location.getLatitude();\n currentLong = location.getLongitude();\n\n if (location != null) {\n CLocation myLocation = new CLocation(location, true);\n this.updateSpeed(myLocation);\n }\n\n// String originUpdate = getAddressFromLatLng(currentLat, currentLong);\n// //Use Geocoder class to calculate minutes walking from current location.\n// String url = \"https://maps.googleapis.com/maps/api/distancematrix/json?origins=\" + originUpdate + \"&destinations=\" + destinationPassed + \"&mode=walking&language=fr-FR&avoid=tolls&key=AIzaSyBCv-Rz8niwSqwicymjqs_iKinNNsVBAdQ\";\n// Log.d(\"url string\", url);\n// geoTask.execute(url);\n }", "public void startLocationUpdates(){\n // High accuracy should use GPS to get the location\n locationRequest = new LocationRequest();\n locationRequest.setInterval(2000);\n locationRequest.setFastestInterval(1000);\n locationRequest.setSmallestDisplacement(1);\n locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n\n if(ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&\n ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){\n // The user has not given us access to get their location\n // May want to request those premissions here\n try {\n int gpsOff = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE);\n // If this returns zero then GPS is off\n if(gpsOff == 0){\n Intent turnOnGPS = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);\n startActivity(turnOnGPS);\n }\n }catch (Settings.SettingNotFoundException e){\n e.printStackTrace();\n }\n\n return;\n }\n\n LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);\n }", "public static void setParams(MapLocation target, int thresholdDistanceSq, boolean staySafe) {\n Bugging.target = target;\n Bugging.thresholdDistanceSq = thresholdDistanceSq;\n Bugging.staySafe = staySafe;\n }", "public void update()\n {\n if(RobotMap.manipController.getRawButton(XboxMap.X)==true)\n {\n activateDumpSolenoid(forward);\n }\n\n //when b is pressed, put gate back up\n if(RobotMap.manipController.getRawButton(XboxMap.B)==true)\n {\n activateDumpSolenoid(reverse);\n }\n\n //If A is pressed (auto)\n if(RobotMap.driveController.getRawButton(XboxMap.A)==true)\n {\n if(distanceSensor.checkDistance() < 270 && distanceSensor.checkDistance() != 0)\n {\n activateDumpSolenoid(forward);\n myRobot.setAutoDoneTrue();\n }\n }\n }", "protected boolean isBetterLocation(Location location) {\n if (mCurrent == null) {\n // A new location is always better than no location\n return true;\n }\n \n // Check whether the new location fix is newer or older\n long timeDelta = location.getTime() - mCurrent.getTime();\n boolean isSignificantlyOlder = timeDelta < -MIN_TIME_SHORT;\n boolean isNewer = timeDelta > 0;\n \n // If the new location is more than two minutes older, it must be worse\n if (isSignificantlyOlder) {\n return false;\n }\n \n // Check whether the new location fix is more or less accurate\n int accuracyDelta = (int) (location.getAccuracy() - mCurrent.getAccuracy());\n Log.d(TAG, location.getProvider() + \" accuracy: \" + location.getAccuracy());\n boolean isLessAccurate = accuracyDelta > 0;\n boolean isMoreAccurate = accuracyDelta < 0;\n boolean isSignificantlyLessAccurate = accuracyDelta > MIN_DISTANCE;\n \n // Check if the old and new location are from the same provider\n boolean isFromSameProvider = isSameProvider(location.getProvider(),\n \t\t mCurrent.getProvider());\n \n // Determine location quality using a combination of timeliness and accuracy\n if (isMoreAccurate) {\n return true;\n } else if (isNewer && !isLessAccurate) {\n return true;\n } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) {\n return true;\n }\n return false;\n }", "@Override\n public void onLocationChanged(Location location) {\n currentLatitude = location.getLatitude();\n currentLongitude = location.getLongitude();\n\n }", "private void updateLocation(){\r\n\t\t//UPDATE location SET longitude = double, latitude = double WHERE userName = userName\r\n\t\tString sqlCmd = \"UPDATE location SET longitude = \" + commandList.get(2) + \", latitude = \"\r\n\t\t\t\t+ commandList.get(3) + \" WHERE userName = '\" + commandList.get(1) + \"';\";\r\n\t\tSystem.out.println(sqlCmd);\r\n\r\n\t\ttry {//start SQL statement\r\n\t\t\tint changed = stmt.executeUpdate(sqlCmd);\r\n\t\t\tif(changed == 0){//if no updates were made (changed = 0) \r\n\t\t\t\terror = true;//error\r\n\t\t\t\tout.println(\"No user found\");//error message\r\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\terror = true;\r\n\t\t\tout.println(e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tif(error == false)\r\n\t\t\tout.println(\"true\");\r\n\t}", "@SuppressLint(\"RestrictedApi\")\n protected void startLocationUpdates() {\n mLocationRequest = new LocationRequest();\n mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n mLocationRequest.setInterval(UPDATE_INTERVAL);\n mLocationRequest.setFastestInterval(FASTEST_INTERVAL);\n\n LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();\n builder.addLocationRequest(mLocationRequest);\n LocationSettingsRequest locationSettingsRequest = builder.build();\n\n SettingsClient settingsClient = LocationServices.getSettingsClient(this);\n settingsClient.checkLocationSettings(locationSettingsRequest);\n\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n return;\n }\n getFusedLocationProviderClient(this).requestLocationUpdates(mLocationRequest, new LocationCallback() {\n @Override\n public void onLocationResult(LocationResult locationResult) {\n onLocationChanged(locationResult.getLastLocation());\n }\n },\n Looper.myLooper());\n }", "protected void gpsCheck() {\n GoogleApiClient googleApiClient = new GoogleApiClient.Builder(MapsActivity.this).addApi(LocationServices.API).build();\n googleApiClient.connect();\n\n LocationRequest locationRequest = LocationRequest.create();\n locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n\n LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest);\n builder.setAlwaysShow(true);\n\n PendingResult<LocationSettingsResult> result = LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build());\n result.setResultCallback(new ResultCallback<LocationSettingsResult>() {\n @Override\n public void onResult(@NonNull LocationSettingsResult result) {\n final Status status = result.getStatus();\n switch (status.getStatusCode()) {\n case LocationSettingsStatusCodes.SUCCESS:\n Log.i(TAG, \"All location settings are satisfied.\");\n break;\n case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:\n Log.i(TAG, \"Location settings are not satisfied. Show the user a dialog to upgrade location settings \");\n try {\n // Show the dialog by calling startResolutionForResult(), and check the result\n // in onActivityResult().\n status.startResolutionForResult(MapsActivity.this, REQUEST_CHECK_SETTINGS);\n } catch (IntentSender.SendIntentException e) {\n Log.i(TAG, \"PendingIntent unable to execute request.\");\n }\n break;\n case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:\n Log.i(TAG, \"Location settings are inadequate, and cannot be fixed here. Dialog not created.\");\n break;\n }\n }\n });\n }", "public void onLocationChanged(Location location) {\n\t\t\tsendGPS(location);\r\n\t\t}", "public void geolocTransfered() {\n\t\tthis.geolocTransfered = true;\n\t}", "@Override\npublic void onLocationChanged(Location location) {\nString lat = String.valueOf(location.getLatitude());\nString lon = String.valueOf(location.getLongitude());\nLog.e(\"GPS\", \"location changed: lat=\"+lat+\", lon=\"+lon);\n//tv.setText(\"lat=\"+lat+\", lon=\"+lon);\nLatLng coordinates = new LatLng(location.getLatitude(), location.getLongitude()); \nmMap.animateCamera(CameraUpdateFactory.newLatLngZoom(coordinates, 12));\n\n\n//Update Value of Lat Long\n}", "@Override\n public void onLocationChanged(Location location) {\n }", "private boolean isNotifyLocationChange(Location old, Location update) {\n boolean isNotifyLocationChange = false;\n\n isNotifyLocationChange = (old.distanceTo(update) >= MIN_DISTANCE_NOTIFY) && (update.getTime() - old.getTime() >= MIN_TIME_NOTIFY);\n\n return isNotifyLocationChange;\n }", "public void onLocationChanged(Location location) {\n \t\tif(lastKnownLoc == null){//if there is no prev location, use this\r\n \t\t\tlastKnownLoc = location;\r\n \t\t}else{\r\n \t\t\tif(lastKnownLoc.hasAccuracy() && location.hasAccuracy()){//if both the current location and the new one have an accuracy\r\n \t\t\t\tif(lastKnownLoc.getAccuracy() <= location.getAccuracy()){//use the one that is more accurate\r\n \t\t\t\tlastKnownLoc = location;\r\n \t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\tmap.addOverlay(location);\r\n \t\t//gpsText.setText(\"Latitude:\"+ lastKnownLoc.getLatitude() + \"\\nLongitude:\" + lastKnownLoc.getLongitude());\r\n }", "private void startLocationUpdates() {\n Log.d(LOG_TAG, \"startLocationUpdates() called\");\n fusedLocationClient.requestLocationUpdates(locationRequest, locationCallback, Looper.getMainLooper());\n }", "@Override\n\t\tpublic void onLocationChanged(Location args0) {\n\t\t\t mCurrentLocation = args0;\n\t mLastUpdateTime = DateFormat.getTimeInstance().format(new Date());\n\t updateUI();\n\n\t\t}" ]
[ "0.6672397", "0.6450602", "0.6324338", "0.626844", "0.61451966", "0.6069639", "0.6034468", "0.6018003", "0.5955222", "0.59470004", "0.5934213", "0.59314334", "0.5929384", "0.5927415", "0.5922519", "0.59198", "0.59065485", "0.5906533", "0.5901732", "0.5886363", "0.58821946", "0.5877156", "0.58767194", "0.5876656", "0.58612233", "0.58599234", "0.5854419", "0.5849432", "0.58264726", "0.58220667", "0.5819036", "0.580846", "0.57904106", "0.57904106", "0.57848495", "0.5779215", "0.5776368", "0.57489526", "0.5747662", "0.5732207", "0.57229847", "0.57093376", "0.57093376", "0.57093376", "0.56988055", "0.5697607", "0.5692035", "0.5686854", "0.5684185", "0.56806743", "0.5677122", "0.5669835", "0.5669059", "0.5668205", "0.566641", "0.56588537", "0.565753", "0.5654137", "0.5639358", "0.56384933", "0.56348085", "0.562735", "0.56262785", "0.56195503", "0.5616394", "0.56016105", "0.55995613", "0.55977505", "0.55852884", "0.558058", "0.557992", "0.55780256", "0.5575258", "0.55743986", "0.55724454", "0.55722564", "0.5567063", "0.5562998", "0.55558735", "0.5551744", "0.55491465", "0.5548466", "0.5548466", "0.5543282", "0.5537605", "0.5537323", "0.5531725", "0.5525111", "0.5525023", "0.55201566", "0.5517199", "0.5515326", "0.55121213", "0.55027676", "0.5502272", "0.5499816", "0.5499694", "0.549449", "0.54929423", "0.5482021" ]
0.6975609
0
Re authenticate to the backend server
public void reauthenticateBackendServer() { String token = userLogin(); // Update the retrieved token in the database. User user = userRepository.findByEmailIgnoreCase(SecurityUtils.getCurrentUser().getEmail()); user.setBackendToken(token); userRepository.save(user); // Update the user token on the Security context updateUserToSecurityContext(user, request); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void clientAuthenticate()\n throws HubIntegrationException {\n try {\n final ArrayList<String> segments = new ArrayList<>();\n segments.add(\"j_spring_security_check\");\n final HttpUrl httpUrl = createHttpUrl(segments, null);\n\n final Map<String, String> content = new HashMap<>();\n final String username = hubServerConfig.getGlobalCredentials().getUsername();\n String password = hubServerConfig.getGlobalCredentials().getEncryptedPassword();\n if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {\n try {\n password = hubServerConfig.getGlobalCredentials().getDecryptedPassword();\n\n content.put(\"j_username\", username);\n content.put(\"j_password\", password);\n final Request request = createPostRequest(httpUrl, createEncodedRequestBody(content));\n Response response = null;\n try {\n logRequestHeaders(request);\n response = getClient().newCall(request).execute();\n logResponseHeaders(response);\n if (!response.isSuccessful()) {\n throw new HubIntegrationException(response.message());\n }\n } finally {\n if (response != null) {\n response.close();\n }\n }\n } catch (IllegalArgumentException | EncryptionException e) {\n throw new HubIntegrationException(e.getMessage(), e);\n }\n }\n } catch (final IOException e) {\n throw new HubIntegrationException(e.getMessage(), e);\n }\n }", "private void authenticateAction() {\n if (requestModel.getUsername().equals(\"superuser\")\n && requestModel.getPassword().equals(\"\")) {\n Collection<Webres> webres = getAllWebres();\n proceedWhenAuthenticated(new User(null, null, null, \"superuser\", \"\", null) {\n @Override\n public Collection<Webres> getAllowedResources() {\n return webres;\n }\n @Override\n public ActionController getDefaultController() {\n return ActionController.EMPLOYEES_SERVLET;\n }\n });\n return;\n }\n \n // try to authenticate against other credentials from the database\n Optional<User> u = getUserByCredentials(requestModel.getUsername(), requestModel.getPassword()); \n if (u.isPresent()) {\n proceedWhenAuthenticated(u.get());\n return;\n }\n \n // report authentication failed\n LOG.log(Level.INFO, \"{0} Authentication failed. Login: {1}, Password: {2}\", new Object[]{httpSession.getId(), requestModel.getUsername(), requestModel.getPassword()});\n SignInViewModel viewModel = new SignInViewModel(true);\n renderSignInView(viewModel);\n }", "@Override\n protected void afterAuthenticating() {\n }", "@Override\r\n\tpublic void changeAuthentication(ClientSession clientSession) {\n\t}", "@GET\n @Path(\"/re\")\n public Response relogin() {\n return this.login();\n }", "private boolean authenticate (HttpRequest request, HttpResponse response) throws UnsupportedEncodingException\n\t{\n\t\tString[] requestSplit=request.getPath().split(\"/\",3);\n\t\tif(requestSplit.length<2)\n\t\t\treturn false;\n\t\tString serviceName=requestSplit[1];\n\t\tfinal int BASIC_PREFIX_LENGTH=\"BASIC \".length();\n\t\tString userPass=\"\";\n\t\tString username=\"\";\n\t\tString password=\"\";\n\t\t\n\t\t//Check for authentication information in header\n\t\tif(request.hasHeaderField(AUTHENTICATION_FIELD)\n\t\t\t\t&&(request.getHeaderField(AUTHENTICATION_FIELD).length()>BASIC_PREFIX_LENGTH))\n\t\t{\n\t\t\tuserPass=request.getHeaderField(AUTHENTICATION_FIELD).substring(BASIC_PREFIX_LENGTH);\n\t\t\tuserPass=new String(Base64.decode(userPass), \"UTF-8\");\n\t\t\tint separatorPos=userPass.indexOf(':');\n\t\t\t//get username and password\n\t\t\tusername=userPass.substring(0,separatorPos);\n\t\t\tpassword=userPass.substring(separatorPos+1);\n\t\t\t\n\t\t\t\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tlong userId;\n\t\t\t\tAgent userAgent;\n\t\t\t\t\n\t\t\t\tif ( username.matches (\"-?[0-9].*\") ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tuserId = Long.valueOf(username);\n\t\t\t\t\t} catch ( NumberFormatException e ) {\n\t\t\t\t\t\tthrow new L2pSecurityException (\"The given user does not contain a valid agent id!\");\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tuserId = l2pNode.getAgentIdForLogin(username);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tuserAgent = l2pNode.getAgent(userId);\n\t\t\t\t\n\t\t\t\tif ( ! (userAgent instanceof PassphraseAgent ))\n\t\t\t\t\tthrow new L2pSecurityException (\"Agent is not passphrase protected!\");\n\t\t\t\t((PassphraseAgent)userAgent).unlockPrivateKey(password);\n\t\t\t\t_currentUserId=userId;\n\t\t\t\t\n\t\t\t\tif(!_userSessions.containsKey(userId))//if user not registered\n\t\t\t\t{\t\t\t\t\n\t\t\t\t\tMediator mediator = l2pNode.getOrRegisterLocalMediator(userAgent);\n\t\t\t\t\t_userSessions.put(userId, new UserSession(mediator));\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t_userSessions.get(userId).updateServiceTime(serviceName,new Date().getTime());//update last access time for service\n\t\t\t\t\n\t\t\t\tconnector.logMessage(\"Login: \"+username);\n\t\t\t\tconnector.logMessage(\"Sessions: \"+Integer.toString(_userSessions.size()));\n\t\t\t\t\n\t\t\t\treturn true;\n\t\t\t\t\n\t\t\t}catch (AgentNotKnownException e) {\n\t\t\t\tsendUnauthorizedResponse(response, null, request.getRemoteAddress() + \": login denied for user \" + username);\n\t\t\t} catch (L2pSecurityException e) {\n\t\t\t\tsendUnauthorizedResponse( response, null, request.getRemoteAddress() + \": unauth access - prob. login problems\");\n\t\t\t} catch (Exception e) {\n\t\t\t\t\n\t\t\t\tsendInternalErrorResponse(\n\t\t\t\t\t\tresponse, \n\t\t\t\t\t\t\"The server was unable to process your request because of an internal exception!\", \n\t\t\t\t\t\t\"Exception in processing create session request: \" + e);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresponse.setStatus ( HttpResponse.STATUS_BAD_REQUEST );\n\t\t\tresponse.setContentType( \"text/plain\" );\n\t\t\tresponse.print ( \"No authentication provided!\" );\n\t\t\tconnector.logError( \"No authentication provided!\" );\n\t\t}\n\t\treturn false;\n\t}", "private void verifyAuthWithServer() {\n mResetModel.connect(\n myBinding.editResetEmail.getText().toString());\n //This is an Asynchronous call. No statements after should rely on the\n //result of connect().\n }", "private static Object doAuth(Request req, Response res) {\n \n HashMap<String, String> response = new HashMap<>();\n\t\t \n String email = Jsoup.parse(req.queryParams(\"email\")).text();\n\t\t String password = Jsoup.parse(req.queryParams(\"password\")).text();\n\t\t\n res.type(Path.Web.JSON_TYPE);\n \t\t\n\t\t\n\t\tif(email != null && !email.isEmpty() && password != null && !password.isEmpty() ) {\n \n authenticate = new Authenticate(password);\n\t\t\t//note that the server obj has been created during call to login()\n\t\t\tString M2 = authenticate.getM2(server);\n\t\t\t\n if(M2 != null || !M2.isEmpty()) {\n \n \n\t\t\tSession session = req.session(true);\n\t\t\tsession.maxInactiveInterval(Path.Web.SESSION_TIMEOUT);\n\t\t\tUser user = UserController.getUserByEmail(email);\n\t\t\tsession.attribute(Path.Web.ATTR_USER_NAME, user.getUsername());\n session.attribute(Path.Web.ATTR_USER_ID, user.getId().toString()); //saves the id as String\n\t\t\tsession.attribute(Path.Web.AUTH_STATUS, authenticate.authenticated);\n\t\t\tsession.attribute(Path.Web.ATTR_EMAIL, user.getEmail());\n logger.info(user.toString() + \" Has Logged In Successfully\");\n \n response.put(\"M2\", M2);\n response.put(\"code\", \"200\");\n response.put(\"status\", \"success\");\n response.put(\"target\", Path.Web.DASHBOARD);\n \n String respjson = gson.toJson(response);\n logger.info(\"Final response sent By doAuth to client = \" + respjson);\n res.status(200);\n return respjson;\n }\n\t\t\t\t\n\t\t} \n \n res.status(401);\n response.put(\"code\", \"401\");\n response.put(\"status\", \"Error! Invalid Login Credentials\");\n \n return gson.toJson(response);\n }", "@Override\n public JsonResponse duringAuthentication(String... params) {\n try {\n final String username = params[0];\n final String password = params[1];\n return RequestHandler.authenticate(this.getApplicationContext(), username, password);\n } catch (IOException e) {\n return null;\n }\n }", "boolean authNeeded();", "EmployeeMaster authenticateUser(int employeeId, String password);", "@Override\n public void onAuthenticationFailed() {\n }", "private void reauthenticate() {\n FirebaseUser firebaseUser = mAuth.getCurrentUser();\n\n if (firebaseUser == null) {\n return;\n }\n\n AuthCredential credential = EmailAuthProvider.getCredential(\n user.getEmail(),\n user.getPassword()\n );\n\n firebaseUser.reauthenticate(credential)\n .addOnCompleteListener(new OnCompleteListener<Void>() {\n @Override\n public void onComplete(@NonNull Task<Void> task) {\n\n if (task.isSuccessful()) {\n updateData();\n }\n }\n })\n .addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n FirebaseCrash.report(e);\n Toast.makeText(\n getContext(),\n e.getMessage(),\n Toast.LENGTH_SHORT\n ).show();\n }\n });\n }", "protected synchronized void login() {\n\t\tauthenticate();\n\t}", "private void authenticate(String user, String pass) {\n }", "public void authenticate(LoginRequest loginRequest) {\n\n }", "@Override\n\tpublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)\n\t\t\tthrows Exception {\n\t\t System.err.println(\"URI -- \"+request.getRequestURL());\n\t\t if(request.getRequestURI()!=null &&\n\t\t (request.getRequestURI().contains(\"/self/login\"))) return true;\n\t\t \n\t\t \n\t\t String authHeader = request.getHeader(AUTH_HEADER);\n\t\t \n\t\t if (authHeader == null) { \n\t\t\t response.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t\t response.getOutputStream().write(TOKEN_EXPIRE_MSG.getBytes()); return false;\n\t\t }\n\t\t \n\t\t if (authHeader.contains(\"Basic \")) {\n\t\t \n\t\t String encodedUserNamePassword = authHeader.split(\"Basic \")[1]; String\n\t\t strValue = \"\";\n\t\t try\n\t\t { \n\t\t\t strValue = new String(java.util.Base64.getDecoder().decode(encodedUserNamePassword.getBytes(\n\t\t\t\t\t \t\t)), \"UTF-8\"); \n\t\t }\n\t\t catch (Exception e)\n\t\t { \n\t\t\t e.printStackTrace(); \n\t\t\t // TODO: handle exception return false; \n\t\t }\n\t\t \n\t\t String[] arrayOfString = strValue.split(\"\\\\:\");\n\t\t \n\t\t if (arrayOfString.length > 1) \n\t\t { \n\t\t\t \tString userName = arrayOfString[0]; String\n\t\t\t \tpassword = arrayOfString[1]; System.err.println(userName);\n\t\t\t \tSystem.err.println(password);\n\t\t \n\t\t\t \tpassword = Base64.getEncoder().encodeToString((password + \"\").getBytes(\"utf-8\")); \n\t\t\t \tUsernamePasswordAuthenticationToken\n\t\t\t \tusernamePasswordAuthenticationToken = new\n\t\t\t \tUsernamePasswordAuthenticationToken( userName, password);\n\t\t \n\t\t\t \tAuthentication authentication = null; \n\t\t\t \ttry { authentication =\n\t\t\t \t\t\tautheticationManager.authenticate(usernamePasswordAuthenticationToken);\n\t\t \n\t\t } catch (Exception ex) { \n\t\t\t ex.printStackTrace();\n\t\t\t response.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t\t response.getOutputStream().write(UNAUTHORISED_ACCESS_MSG.getBytes());\n\t\t \n\t\t\t return false; \n\t\t } \n\t\t if (authentication.isAuthenticated()) {\n\t\t\t SecurityContextHolder.getContext().setAuthentication(authentication);\n\t\t\t return true; \n\t\t } else { \n\t\t\t\n\t\t\tresponse.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t\t response.getOutputStream().write(UNAUTHORISED_ACCESS_MSG.getBytes()); \n\t\t\t return false; \n\t\t\t } \n\t\t } else { \n\t\t\t String encodedValue = authHeader.split(\"Basic \")[1];\n\t\t \n\t\t\t if (isValidToken(encodedValue)) return true;\n\t\t \n\t\t \tresponse.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t \tresponse.getOutputStream().write(TOKEN_EXPIRE_MSG.getBytes()); return false;\n\t\t }\n\t\t \n\t\t } \n\t\t response.setContentType(JSON_HAL_CONTENT_TYPE);\n\t\t response.getOutputStream().write(UNAUTHORISED_ACCESS_MSG.getBytes()); return\n\t\t false;\n\t\t \n\t\t\n\t}", "void onRetryAuthentication();", "public Result authenticate() {\r\n // 1. Define class to send JSON response back\r\n class Login {\r\n public Long id;\r\n public String gamerTag;\r\n public String token;\r\n\r\n public Login() {\r\n }\r\n }\r\n\r\n // 2. Read email and password from request()\r\n JsonNode request = request().body().asJson();\r\n String gamerTag = request.get(\"gamerTag\").asText();\r\n String password = request.get(\"password\").asText();\r\n\r\n // 3. Find user with given gamerTag\r\n Login ret = new Login();\r\n User user = User.gamerTagLogin(gamerTag);\r\n if (user == null) {\r\n return unauthorized(Json.toJson(ret));\r\n }\r\n // 4. Compare password.\r\n String sha256 = User.getSha256(request.get(\"password\").asText());\r\n if (sha256.equals(user.getPassword())) {\r\n // Success\r\n String authToken = generateAuthToken();\r\n user.setToken(authToken);\r\n Ebean.update(user);\r\n ret.token = authToken;\r\n ret.gamerTag = user.getGamerTag();\r\n ret.id = user.getId();\r\n return ok(Json.toJson(ret));\r\n\r\n }\r\n // 5. Unauthorized access\r\n return unauthorized();\r\n }", "@Override\n public void onAuthenticationFailed() {\n }", "private void formAuthenticate(String server) throws Exception{\n\t\tCredentialsProvider credsProvider = new BasicCredentialsProvider();\n\t\tcredsProvider.setCredentials(\n\t\t\t\tnew AuthScope(server, 8081),\n\t\t\t\tnew UsernamePasswordCredentials(\"debug\", \"debuglockss\"));\n\t\tCloseableHttpClient httpclient = HttpClients.custom()\n\t\t\t\t.setDefaultCredentialsProvider(credsProvider)\n\t\t\t\t.build();\n\t\ttry {\n\t\t\tHttpGet httpget = new HttpGet(\"https://\"+ server +\":8081/Home\");\n\n\t\t\tLOGGER.info(\"Executing request \" + httpget.getRequestLine());\n\t\t\tCloseableHttpResponse response = httpclient.execute(httpget);\n\t\t\ttry {\n\t\t\t\tLOGGER.info(\"----------------------------------------\");\n\t\t\t\tLOGGER.info(response.getStatusLine().toString());\n\t\t\t\tLOGGER.info(EntityUtils.toString(response.getEntity()));\n\t\t\t} finally {\n\t\t\t\tresponse.close();\n\t\t\t}\n\t\t} finally {\n\t\t\thttpclient.close();\n\t\t}\n\t}", "protected Response login() {\n return login(\"\");\n }", "private void verifyAuthWithServer() {\n mRegisterModel.connect(binding.personFirstName.getText().toString(),\n binding.personLastName.getText().toString(),\n binding.registerEmail.getText().toString(),\n binding.registerPassword.getText().toString());\n //this is an Asynchronous call no statements after should rely on the result of connect\n }", "public boolean auth() throws IOException {\r\n \treturn auth(false);\r\n }", "@Override\n public Auth call() throws IOException {\n OkHttpClient client = new OkHttpClient();\n client.setFollowRedirects(false);\n client.setFollowSslRedirects(false);\n\n Request initRequest = new Request.Builder()\n .url(\"https://lobste.rs/login\")\n .build();\n\n Response initResponse = client.newCall(initRequest).execute();\n String initCookie = initResponse.header(\"Set-Cookie\").split(\";\")[0];\n String initBody = initResponse.body().string();\n String authenticity_token = Jsoup.parse(initBody).body().select(\"[name=authenticity_token]\").val();\n\n // Phase 2 is to authenticate given the cookie and authentication token\n RequestBody loginBody = new FormEncodingBuilder()\n .add(\"utf8\", \"\\u2713\")\n .add(\"authenticity_token\", authenticity_token)\n .add(\"email\", login)\n .add(\"password\", password)\n .add(\"commit\", \"Login\")\n .add(\"referer\", \"https://lobste.rs/\")\n .build();\n Request loginRequest = new Request.Builder()\n .url(\"https://lobste.rs/login\")\n .header(\"Cookie\", initCookie) // We must use #header instead of #addHeader\n .post(loginBody)\n .build();\n\n Response loginResponse = client.newCall(loginRequest).execute();\n String loginCookie = loginResponse.header(\"Set-Cookie\").split(\";\")[0];\n\n // Phase 3 is to grab the actual username/email from the settings page\n Request detailsRequest = new Request.Builder()\n .url(\"https://lobste.rs/settings\")\n .header(\"Cookie\", loginCookie)\n .build();\n Response detailsResponse = client.newCall(detailsRequest).execute();\n String detailsHtml = detailsResponse.body().string();\n\n Document dom = Jsoup.parse(detailsHtml);\n String username = dom.select(\"#user_username\").val();\n String email = dom.select(\"#user_email\").val();\n\n // And then we return the result of all three phases\n return new Auth(email, username, loginCookie);\n }", "public boolean authenticateUser() {\r\n try {\r\n \r\n firstServerMessage();\r\n sendKeys();\r\n sessionKeyMsg();\r\n \r\n \r\n \r\n \treturn true;\r\n }\r\n \r\n catch(Exception ioe){\r\n System.out.println(\"Terminating session with Acct#: \" + currAcct.getNumber());\r\n //ioe.printStackTrace();\r\n return false;\r\n }\r\n \r\n }", "private void startAuth() {\n if (ConnectionUtils.getSessionInstance().isLoggedIn()) {\n ConnectionUtils.getSessionInstance().logOut();\n } else {\n ConnectionUtils.getSessionInstance().authenticate(this);\n }\n updateUiForLoginState();\n }", "public void login () {\n\t\tGPPSignIn.sharedInstance().authenticate();\n\t}", "@Override\n public void commence(HttpServletRequest request,\n HttpServletResponse response,\n AuthenticationException authException) throws IOException {\n\n String requestURI = request.getRequestURI();\n if(requestURI.startsWith(\"/api\")){\n response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n response.setContentType(\"application/json;charset=utf-8\");\n PrintWriter out = response.getWriter();\n BaseResponse baseResponse = new BaseResponse();\n baseResponse.setMessage(authException.getMessage());\n baseResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n out.write(new ObjectMapper().writeValueAsString(baseResponse));\n out.flush();\n out.close();\n\n// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage());\n }else {\n response.sendRedirect(\"/login?redirect=\"+requestURI);\n }\n }", "private void respAuth() throws Exception {\n DataOutputStream dos = new DataOutputStream(os);\n dos.writeInt(1);\n dos.writeByte(Message.MSG_RESP_AUTH);\n if (haslogin) {\n dos.writeByte(Message.SUCCESS_AUTH);\n } else {\n dos.writeByte(Message.FAILED_AUTH);\n }\n }", "@Override\n public void authenticate() throws IOException, BadAccessIdOrKeyException {\n try{\n HttpPost post = new HttpPost(Constants.FRGXAPI_TOKEN);\n List<NameValuePair> params = new ArrayList<>();\n params.add(new BasicNameValuePair(\"grant_type\", \"apiAccessKey\"));\n params.add(new BasicNameValuePair(\"apiAccessId\", accessId));\n params.add(new BasicNameValuePair(\"apiAccessKey\", accessKey));\n post.setEntity(new UrlEncodedFormEntity(params, \"UTF-8\"));\n\n HttpResponse response = client.execute(post);\n String a = response.getStatusLine().toString();\n\n if(a.equals(\"HTTP/1.1 400 Bad Request\")){\n throw (new BadAccessIdOrKeyException(\"Bad Access Id Or Key\"));\n }\n HttpEntity entity = response.getEntity();\n String responseString = EntityUtils.toString(response.getEntity());\n\n JsonParser jsonParser = new JsonParser();\n JsonObject jo = (JsonObject) jsonParser.parse(responseString);\n if(jo.get(\"access_token\") == null){\n throw new NullResponseException(\"The Access Token you get is null.\");\n }\n String accessToken = jo.get(\"access_token\").getAsString();\n List<Header> headers = new ArrayList<>();\n headers.add(new BasicHeader(HttpHeaders.CONTENT_TYPE, \"application/json\"));\n headers.add(new BasicHeader(\"Authorization\", \"Bearer \" + accessToken));\n\n client = HttpClients.custom().setDefaultHeaders(headers).build();\n } catch (NullResponseException e) {\n System.out.println(e.getMsg());\n }\n }", "@Override\n public boolean authenticate() {\n try {\n if (conn != null) {\n return true;\n }\n conn = new Connection(configuration.getHost());\n conn.connect();\n //登陆linux\n boolean isAuthenticated = conn.authenticateWithPassword(configuration.getUsername(),\n configuration.getPassword());\n if (!isAuthenticated) {\n conn.close();\n conn = null;\n throw new UserOrPasswordErrorException(\"账号或密码错误!\");\n }\n return true;\n } catch (IOException e) {\n conn.close();\n conn = null;\n throw new HostCannotConnectException(\"无法连接到主机!\");\n }\n }", "private Object authenticate(Invocation invocation, HttpServletRequest request,\r\n HttpServletResponse response) throws IOException {\r\n\r\n Object[] args = invocation.getArgs();\r\n if (args.length != 2) {\r\n throw new RuntimeException(\"The authenticate call must have two arguments\");\r\n }\r\n\r\n String user = (String) args[0];\r\n String password = (String) args[1];\r\n\r\n //We can make the remote call\r\n Object result = invoke(invocation);\r\n\r\n //If the authentification failed we finish the execution\r\n if (result instanceof LoginContext) {\r\n LoginContext loginContext = (LoginContext) result;\r\n if (loginContext == null) {\r\n throw new RuntimeException(\"Login failed!!\");\r\n }\r\n \r\n HttpSession session = request.getSession(false);\r\n String sessionId = session.getId();\r\n response.addHeader(\"jsessionid\", sessionId);\r\n\r\n \r\n session.setAttribute(User.USER_KEY, loginContext.getUser());\r\n\r\n session.setAttribute(RhSessionContext.CLIENT_ID, loginContext.getClient_id());\r\n session.setAttribute(RhSessionContext.ORG_ID, loginContext.getOrg_id());\r\n session.setAttribute(RhSessionContext.DUTY_ID, loginContext.getDutyId());\r\n\r\n Map attrs = loginContext.getAttributes();\r\n Set<Map.Entry> entries = attrs.entrySet();\r\n for (Map.Entry entry : entries) {\r\n session.setAttribute((String) entry.getKey(), entry.getValue());\r\n }\r\n\r\n // 创建login session\r\n LoginSession loginSession = new LoginSession();\r\n loginSession.setLoginName(loginContext.getUser().getUsername());\r\n loginSession.setIp(request.getRemoteHost());\r\n loginSession.setLoginDate(new Date(session.getCreationTime()));\r\n loginSession.setSessionId(session.getId());\r\n loginSession.setLiving(true);\r\n\r\n //Session hibernateSession = RhinoCtx.instance().getHibernate().getSession();\r\n try {\r\n \r\n ServiceBase serviceBase = (ServiceBase) ServiceFactory.getService(ServiceBase.NAME);\r\n //ServiceBase serviceBase = (ServiceBase) RhinoCtx.getBean(\"serviceBase\");\r\n //hibernateSession.beginTransaction();\r\n serviceBase.save(loginSession);\r\n //hibernateSession.getTransaction().commit();\r\n session.setAttribute(\"loginSession\", loginSession);\r\n\r\n } catch (Exception ex) {\r\n ex.printStackTrace();\r\n //hibernateSession.getTransaction().rollback();\r\n } finally {\r\n //hibernateSession.close();\r\n }\r\n }\r\n return result;\r\n }", "@Override\n public boolean isClientAuthEnabled() {\n return true;\n }", "protected boolean authenticate() {\n \tif (mConfig == null) {\n \t\tmConfig = getConfig();\n \t}\n \tString keys[] = getKeys();\n \tif (keys != null) {\n\t mConfig = api.authenticateToken(keys[0], keys[1], mConfig);\n\t if (mConfig != null) {\n\t return true;\n\t }\n \t}\n \tshowToast(\"Failed user authentication for stored login tokens.\");\n \tclearKeys();\n \tsetLoggedIn(false);\n \treturn false;\n }", "boolean authenticate(String userName, String password);", "@Override\n public Authentication attemptAuthentication(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)\n throws AuthenticationException, IOException, ServletException {\n AccountCredentials credentials = new ObjectMapper().readValue(httpServletRequest.getInputStream(), AccountCredentials.class);\n UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(credentials.getUsername(), credentials.getPassword());\n return getAuthenticationManager().authenticate(token);\n }", "private void authenticate() {\n\t\t//Isn't a foreach because if the ciphertext is invalid, that data object is removed from the data array.\n\t\t// In a foreach, this would lead to a concurrent modification exception.\n\t\t//noinspection ForLoopReplaceableByForEach\n\t\tfor (int i = 0; i < data.size(); i++) {\n\t\t\ttry {\n\t\t\t\tdata.get(i).decryptText(plainPassword);\n\t\t\t} catch (VaultFormatException ignored) {\n\t\t\t}\n\t\t}\n\t}", "protected void login() {\n\t\t\r\n\t}", "private Boolean authorize() {\n\n return Session.getInstance().login(user.getText(), password.getText());\n }", "void setAuthenticated(boolean b);", "@Override\r\n\tpublic Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)\r\n\t\t\tthrows AuthenticationException {\r\n\tAppUser appUser = null;\r\n\r\n\ttry {\r\n\t\tappUser = new ObjectMapper().readValue(request.getInputStream(), AppUser.class);\r\n\t} catch (IOException e) {\r\n\t\tthrow new RuntimeException(e);\r\n\t}\r\n\r\n\t\tSystem.out.println(\"user one : \"+appUser.getUsername());\r\n\t\treturn authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(appUser.getUsername(), appUser.getPassword()));\r\n\t}", "public void authentication() throws AuthorizationException {\n\t\tclient = new RennClient(API_KEY, SECRET_KEY);\n\t\tclient.authorizeWithClientCredentials();\n\t}", "public void authenticate() {\n JSONObject jsonRequest = new JSONObject();\n try {\n jsonRequest.put(\"action\", \"authenticate\");\n jsonRequest.put(\"label\", \"label\");\n JSONObject dataObject = new JSONObject();\n dataObject.put(\"device_token\", CMAppGlobals.TOKEN);\n jsonRequest.put(\"data\", dataObject);\n\n if(CMAppGlobals.DEBUG) Logger.i(TAG, \":: AuthWsManager.authenticate : jsonRequest : \" + jsonRequest);\n\n // send JSON data\n WSManager.getInstance().con(mContext).sendJSONData(jsonRequest);\n\n\n } catch (JSONException e) {\n\n mContext.onWsFailure(e);\n }\n\n }", "@Override\n public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)\n \t\tthrows AuthenticationException {\n \treturn super.attemptAuthentication(request, response);\n }", "@Override\n public void configure(AuthorizationServerSecurityConfigurer security) {\n //allow send client_id and client_secret in params\n //otherwise headers:{Authorization: 'Basic client_id:client_secret in base64}\n security.allowFormAuthenticationForClients();\n security.checkTokenAccess(\"isAuthenticated()\");\n// security.checkTokenAccess(\"permitAll()\");\n }", "private void authorize() {\r\n\r\n\t}", "@Override\n\tprotected void service(HttpServletRequest request, HttpServletResponse response)\n\t\tthrows ServletException, IOException {\n\t\tif ((new AuthenticatedUser(request,response)).unauthenticated())\n\t\t\treturn;\n\t\tsuper.service(request, response);\n\t}", "public boolean authToServer() throws ClientChatException{\n\n\t\t// On crée un objet container pour contenir nos donnée\n\t\t// On y ajoute un AdminStream de type Authentification avec comme params le login et le mot de pass\n \tAuthentificationRequest request = new AuthentificationRequest(login, pass);\n\t\t\n\t\t//Auth sur le port actif\n\t\ttry {\n\t\t\t// On tente d'envoyer les données\n\t\t\toos_active.writeObject(request);\n\t\t\t// On tente de recevoir les données\n\t\t\tAuthentificationResponse response = (AuthentificationResponse)ois_active.readObject();\n\n\t\t\t// On switch sur le type de retour que nous renvoie le serveur\n\t\t\t// !!!Le type enum \"Value\" est sujet à modification et va grandir en fonction de l'avance du projet!!!\n\t\t\tswitch(response.getResponseType()){\n\t\t\tcase AUTH_SUCCESS:\n\t\t\t\t\n\t\t\t\towner = response.getOwner();\n\t\t\t\t\n\t\t\t\t//creation du socket\n\t\t\t\ttry {\n\t\t\t\t\ts_passive = new Socket(address, 3003);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive socket creation failed!\");\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// On crée le flux sortant !!!OBLIGATOIRE de créer le flux sortant avant le flux entrant!!!\n\t\t\t\ttry {\n\t\t\t\t\toos_passive = new ObjectOutputStream(s_passive.getOutputStream());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive OOS creation failed!\");\n\t\t\t\t}\n\t\t\t\t// On crée le flux entrant\n\t\t\t\ttry {\n\t\t\t\t\tois_passive = new ObjectInputStream(s_passive.getInputStream());\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new ClientChatException(ClientChatException.IO_ERREUR, \n\t\t\t\t\t\"ERROR : passive OIS creation failed!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\trequest = new AuthentificationRequest(owner);\t\t\t\n\t\t\t\t//Auth sur le port passif\n\t\t\t\ttry {\n\t\t\t\t\t// On tente d'envoyer les données\n\t\t\t\t\toos_passive.writeObject(request);\n\t\t\t\t\t// On tente de recevoir les données\n\t\t\t\t\tresponse = (AuthentificationResponse)ois_passive.readObject();\n\n\t\t\t\t\t// On switch sur le type de retour que nous renvoie le serveur\n\t\t\t\t\t// !!!Le type enum \"Value\" est sujet à modification et va grandir en fonction de l'avance du projet!!!\n\t\t\t\t\tswitch(response.getResponseType()){\n\t\t\t\t\tcase AUTH_SUCCESS:\n\t\t\t\t\t\topResult = \"Welcome!\";\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tcase AUTH_FAIL:\n\t\t\t\t\t\topResult = \"ERROR : check login/pwd! (passive socket)\";\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} catch(Exception e){\n\t\t\t\t\tthrow new ClientChatException (ClientChatException.IO_ERREUR, \"ERROR: Communication Error (passive)\");\n\t\t\t\t}\n\t\t\t\n\t\t\tcase AUTH_FAIL:\n\t\t\t\topResult = \"ERROR : check login/pwd! (active socket)\";\n\t\t\t\treturn false;\n\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new ClientChatException (ClientChatException.IO_ERREUR, \"ERROR: Communication Error (active)\");\n\t\t}\n\t\treturn true;\n }", "public void authenticate() {\n LOGGER.info(\"Authenticating user: {}\", this.name);\n WebSession result = null;\n try {\n result =\n getContext()\n .getAuthenticationMethod()\n .authenticate(\n getContext().getSessionManagementMethod(),\n this.authenticationCredentials,\n this);\n } catch (UnsupportedAuthenticationCredentialsException e) {\n LOGGER.error(\"User does not have the expected type of credentials:\", e);\n } catch (Exception e) {\n LOGGER.error(\"An error occurred while authenticating:\", e);\n return;\n }\n // no issues appear if a simultaneous call to #queueAuthentication() is made\n synchronized (this) {\n this.getAuthenticationState().setLastSuccessfulAuthTime(System.currentTimeMillis());\n this.authenticatedSession = result;\n }\n }", "@Override\n\t\t\tpublic boolean authenticate(String name, char[] password, String server) throws Exception {\n\t\t\t\treturn true;\n\t\t\t}", "@Override\n\tprotected Object handleTokenEndpointRequest(String requestId) {\n\t\tenv.removeObject(\"client_authentication\");\n\t\treturn super.handleTokenEndpointRequest(requestId);\n\t}", "@Override\n public Authentication attemptAuthentication(HttpServletRequest req,\n HttpServletResponse res) throws AuthenticationException {\n log.info(\"Attempting authentication\");\n try {\n LoginRequest creds = new ObjectMapper()\n .readValue(req.getInputStream(), LoginRequest.class);\n\n return getAuthenticationManager().authenticate(\n new UsernamePasswordAuthenticationToken(\n creds.getUsername(),\n creds.getPassword(),\n new ArrayList<>())\n );\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }", "@Override\n /**\n * Handles a HTTP GET request. This implements obtaining an authentication token from the server.\n */\n protected void handleGet(Request request, Response response) throws IllegalStateException {\n String username = String.valueOf(request.getAttributes().get(\"username\"));\n String password = String.valueOf(request.getAttributes().get(\"password\"));\n /* Construct MySQL Query. */\n String query = \"SELECT COUNT(id) AS `CNT`, `authToken` FROM accounts WHERE `username` = '\" + username + \"' AND \" +\n \"`password` = '\" + password + \"' LIMIT 0,1;\";\n /* Obtain the account count and existing token pair, as object array. */\n Object[] authenticationArray = dataHandler.handleAuthentication(database.ExecuteQuery(query,\n new ArrayList<String>()));\n int cnt = (int) authenticationArray[0];\n String existingToken = (String) authenticationArray[1];\n String authenticationToken = null;\n if (cnt == 1) { // There is exactly one account matching the parameterised username and password.\n if (existingToken == null) { // No token yet existed, generate one.\n authenticationToken = TokenGenerator.getInstance().generateAuthenticationToken(TOKEN_LENGTH);\n } else {\n authenticationToken = existingToken;\n }\n } else {\n this.returnStatus(response, new IllegalArgumentStatus(null));\n }\n if (!(authenticationToken == null || authenticationToken == \"\")) { // Update the database with the new token.\n Database.getInstance().ExecuteUpdate(\"UPDATE `accounts` SET `authToken` = '\" + authenticationToken +\n \"', `authTokenCreated` = CURRENT_TIMESTAMP WHERE `username` = '\" + username + \"';\",\n new ArrayList<String>());\n this.returnResponse(response, authenticationToken, new TokenSerializer());\n } else {\n this.returnStatus(response, new IllegalArgumentStatus(null));\n }\n }", "@Override\r\n\tpublic void login() {\n\t\t\r\n\t}", "public void authenticate() throws Exception {\n try {\n\n // Build the form body\n final FormBody.Builder formBodyBuilder = new FormBody.Builder().add(\"scope\", \"api-tenant\");\n\n // Has username/password\n if (appProps.getFodGrantType().equals(VulnerabilityReportConstants.GRANT_TYPE_PASSWORD)) {\n formBodyBuilder.add(\"grant_type\", VulnerabilityReportConstants.GRANT_TYPE_PASSWORD)\n .add(\"username\", appProps.getFodTenantId() + \"\\\\\" + appProps.getFodUsername())\n .add(\"password\", appProps.getFodPassword());\n } else // Has api key/secret\n {\n formBodyBuilder.add(\"grant_type\", VulnerabilityReportConstants.GRANT_TYPE_CLIENT_CREDENTIALS)\n .add(\"client_id\", appProps.getFodClientId())\n .add(\"client_secret\", appProps.getFodClientSecret());\n\n }\n final RequestBody formBody = formBodyBuilder.build();\n\n final Request request = new Request.Builder()\n .url(appProps.getFodAPIBaseURL() + \"/oauth/token\")\n .post(formBody)\n .build();\n final Response response = client.newCall(request).execute();\n \n if (!response.isSuccessful()) {\n \tlogger.debug(\"response::\" + response.message() + \", \" + response.code() + \", \" + response.toString());\n throw new FoDConnectionException(\"Unexpected code \" + response);\n }\n\n logger.info(\"Successful connection to Fortify On Demand!\");\n \n final String content = IOUtils.toString(response.body().byteStream(), \"utf-8\");\n response.body().close();\n\n // Parse the Response\n final JsonParser parser = new JsonParser();\n final JsonObject obj = parser.parse(content).getAsJsonObject();\n this.token = obj.get(\"access_token\").getAsString();\n\n } catch (final FoDConnectionException fce) {\n if (fce.getMessage().contains(VulnerabilityReportConstants.FOD_UNAUTORIZED)) {\n logger.error(\"FoD CONNECTION FAILED. Please check the FoD URL, username, tenant, and password and try again.\");\n logger.info(\"FoD URL=\" + appProps.getFodAPIBaseURL());\n logger.info(\"FoD GrantType=\" + appProps.getFodGrantType());\n logger.info(\"FoD client Id=\" + appProps.getFodClientId());\n logger.info(\"FoD username=\" + appProps.getFodUsername());\n logger.info(\"FoD tennant=\" + appProps.getFodTenantId());\n } else {\n logger.error(\"FoD Response was not successful with message: \" + fce.getMessage());\n }\n throw fce;\n }\n\n catch (final UnknownHostException uhe) {\n logger.error(\"Unknown Host Error. Are you connected to the internet?\");\n uhe.printStackTrace();\n throw uhe;\n }\n\n catch (final Exception e) {\n logger.error(\"Authentication to FoD failed. Connection seems OK.\");\n e.printStackTrace();\n throw e;\n }\n }", "public void reAuthenticateUser(User regUser){\n System.out.println(\"Authenticating Google User from DB\");\n UserWithRoles authUser = new UserWithRoles(regUser);\n Authentication authentication = new UsernamePasswordAuthenticationToken(\n authUser, authUser.getPassword(), authUser.getAuthorities()\n );\n SecurityContextHolder.getContext().setAuthentication(authentication);\n }", "public void authenticate(LoginCredentials credentials) throws LoginException;", "protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {\n }", "public void handleAuthenticationRequest(RoutingContext context) {\n\n final HttpServerRequest request = context.request();\n\n final String basicAuthentication = request.getHeader(AUTHORIZATION_HEADER);\n\n try {\n\n final String[] auth =\n BasicAuthEncoder.decodeBasicAuthentication(basicAuthentication).split(\":\");\n\n if (auth.length < 2) {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, HTML_CONTENT_TYPE)\n .end(Json.encode(Errors.CREDENTIAL_ERROR.error()));\n\n } else {\n\n final Credential credential = new Credential(auth[0], auth[1]);\n\n authenticationService.authenticate(credential, user -> {\n\n if (null != user) {\n\n tokenService.generateToken(user, token -> {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, HTML_CONTENT_TYPE).end(token);\n\n }, err -> {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(Errors.INTERNAL_ERROR.error()));\n\n });\n\n } else {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(Errors.CREDENTIAL_ERROR.error()));\n\n }\n\n }, err -> {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(err.toError()));\n\n });\n\n\n }\n\n } catch (final Exception e) {\n\n context.response().putHeader(CONTENT_TYPE_HEADER, JSON_CONTENT_TYPE)\n .end(Json.encode(Errors.INVALID_AUTHENTICATION_TOKEN.error()));\n\n\n }\n\n\n\n }", "@Override\n protected void initiateAuthenticationRequest(HttpServletRequest request, HttpServletResponse response,\n AuthenticationContext context) throws AuthenticationFailedException {\n String loginPage = ConfigurationFacade.getInstance().getAuthenticationEndpointURL()\n .replace(\"authenticationendpoint/login.do\", Token2Constants.LOGIN_PAGE);\n String queryParams = FrameworkUtils.getQueryStringWithFrameworkContextId(context.getQueryParams(),\n context.getCallerSessionKey(), context.getContextIdentifier());\n String retryParam = \"\";\n if (context.isRetrying()) {\n retryParam = Token2Constants.RETRY_PARAMS;\n }\n try {\n response.sendRedirect(loginPage + (\"?\" + queryParams) + \"&authenticators=\"\n + getName() + retryParam);\n } catch (IOException e) {\n throw new AuthenticationFailedException(\"Authentication failed!\", e);\n }\n }", "private static String doLogin(Request req, Response res) {\n HashMap<String, String> respMap;\n \n res.type(Path.Web.JSON_TYPE);\n \n \n\t String email = Jsoup.parse(req.queryParams(\"email\")).text();\n \n logger.info(\"email from the client = \" + email);\n \n if(email != null && !email.isEmpty()) { \n \n\t server = new SRP6JavascriptServerSessionSHA256(CryptoParams.N_base10, CryptoParams.g_base10);\n\t \t\t\n\t gen = new ChallengeGen(email);\n\t\t\n\t respMap = gen.getChallenge(server);\n \n if(respMap != null) {\n\t\t logger.info(\"JSON RESP SENT TO CLIENT = \" + respMap.toString());\n res.status(200);\n respMap.put(\"code\", \"200\");\n respMap.put(\"status\", \"success\");\n return gson.toJson(respMap);\n }\n }\n respMap = new HashMap<>();\n \n res.status(401);\n respMap.put(\"status\", \"Invalid User Credentials\");\n respMap.put(\"code\", \"401\");\n logger.error(\"getChallenge() return null map most likely due to null B value and Invalid User Credentials\");\n \treturn gson.toJson(respMap);\n}", "public static void authenticate() {\n\n Stage window = new Stage();\n\n final String url = OAUTH_URL + getQuery();\n\n BorderPane borderPane = new BorderPane();\n WebView browser = new WebView();\n WebEngine webEngine = browser.getEngine();\n\n webEngine.load(url);\n borderPane.setCenter(browser);\n\n webEngine.setOnStatusChanged(event -> {\n if (event.getSource() instanceof WebEngine) {\n WebEngine we = (WebEngine) event.getSource();\n String location = we.getLocation();\n // If we are redirected to REDIRECT_URL we get contents, and send it to verify() to get access token\n if (location.startsWith(REDIRECT_URL) && location.contains(\"code\") && AUTH_OBECT == null) try {\n URL url1 = new URL(location);\n String[] params = url1.getQuery().split(\"&\");\n Map<String, String> map = new HashMap<>();\n for (String param : params) {\n String name = param.split(\"=\")[0];\n String value = param.split(\"=\")[1];\n map.put(name, value);\n }\n String code = map.get(\"code\");\n // We have code so we continue the flow\n verify(code);\n window.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n });\n\n // create scene\n window.setTitle(\"Authentication\");\n Scene scene = new Scene(borderPane, 750, 500);\n window.setScene(scene);\n window.showAndWait();\n }", "private void loginHandler(RoutingContext context) {\n JsonObject creds = new JsonObject()\n .put(\"username\", context.getBodyAsJson().getString(\"username\"))\n .put(\"password\", context.getBodyAsJson().getString(\"password\"));\n\n // TODO : Authentication\n context.response().setStatusCode(500).end();\n }", "@Override\n\t\t\t\t\tpublic void commence(HttpServletRequest request, HttpServletResponse response,\n\t\t\t\t\t\t\torg.springframework.security.core.AuthenticationException authException)\n\t\t\t\t\t\t\tthrows IOException, ServletException {\n\t\t\t\t\t\tresponse.setCharacterEncoding(\"UTF-8\");\n\t\t\t\t\t\tresponse.setContentType(\"application/json\");\n\t\t\t\t\t\tresponse.getWriter()\n\t\t\t\t\t\t\t\t.println(new ObjectMapper().createObjectNode().put(\"msg\", \"请先登录!\").toString());\n\t\t\t\t\t\tresponse.getWriter().flush();\n\t\t\t\t\t\tresponse.getWriter().close();\n\t\t\t\t\t}", "protected void onSuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, Authentication authResult) throws IOException {\n }", "void stopAuthentication() {\n stop(false);\n }", "private void attemptUsernamePasswordLogin()\n {\n if (mAuthTask != null)\n {\n return;\n }\n\n if(mLogInButton.getText().equals(getResources().getString(R.string.logout)))\n {\n mAuthTask = new RestCallerPostLoginTask(this,mStoredToken,MagazzinoService.getAuthenticationHeader(this),true);\n mAuthTask.execute(MagazzinoService.getLogoutService(this));\n return;\n }\n // Reset errors.\n mUsernameView.setError(null);\n mPasswordView.setError(null);\n\n // Store values at the time of the login attempt.\n String email = mUsernameView.getText().toString();\n String password = mPasswordView.getText().toString();\n\n boolean cancel = false;\n View focusView = null;\n\n // Check for a valid password, if the user entered one.\n if (!TextUtils.isEmpty(password) && !isPasswordValid(password))\n {\n mPasswordView.setError(getString(R.string.error_invalid_password));\n focusView = mPasswordView;\n cancel = true;\n }\n\n // Check for a valid email address.\n if (TextUtils.isEmpty(email))\n {\n mUsernameView.setError(getString(R.string.error_field_required));\n focusView = mUsernameView;\n cancel = true;\n }\n else if (!isUsernameOrEmailValid(email))\n {\n mUsernameView.setError(getString(R.string.error_invalid_email));\n focusView = mUsernameView;\n cancel = true;\n }\n\n if (cancel)\n {\n // There was an error; don't attempt login and focus the first\n // form field with an error.\n focusView.requestFocus();\n return;\n }\n\n mAuthTask = new RestCallerPostLoginTask(this,email, password);\n mAuthTask.execute(MagazzinoService.getLoginService(this));\n\n }", "User authenticate(String username, String password);", "int authenticateUser(IDAOSession session, String userName, String password);", "private void attemptLogin() {\n if (mAuthTask != null) {\n return;\n }\n\n mUsrView.setError(null);\n mPasswordView.setError(null);\n\n String usr = mUsrView.getText().toString();\n String password = mPasswordView.getText().toString();\n\n Tuple<String, String> creds = /*getCredentials()*/ SERVER_CREDENTIALS;\n\n boolean cancel = false;\n View focusView = null;\n\n if (!TextUtils.isEmpty(password)) {\n if (!mPasswordView.getText().toString().equals(creds.y)) {\n if (Util.D) Log.i(\"attemptLogin\", \"pwd was \" + mPasswordView.getText().toString());\n mPasswordView.setError(getString(R.string.error_incorrect_creds));\n cancel = true;\n }\n focusView = mPasswordView;\n }\n\n if (TextUtils.isEmpty(usr)) {\n mUsrView.setError(getString(R.string.error_field_required));\n focusView = mUsrView;\n cancel = true;\n } else if (!usr.equals(creds.x)) {\n mUsrView.setError(getString(R.string.error_incorrect_creds));\n focusView = mUsrView;\n cancel = true;\n }\n\n if (cancel) {\n focusView.requestFocus();\n } else {\n if (prefs != null)\n prefs.edit().putBoolean(getString(R.string.settingAuthorized), true);\n showProgress(true);\n mAuthTask = new UserLoginTask(usr, password);\n mAuthTask.execute((Void) null);\n }\n }", "public abstract boolean authenticate(ServiceSecurity serviceSecurity, SecurityContext securityContext);", "@Override\n\tpublic void credite() {\n\t\t\n\t}", "@RequestMapping(value = \"/mqtt/auth\", method = { RequestMethod.POST, RequestMethod.GET })\r\n\tpublic String auth4MQTT(HttpServletRequest request, HttpServletResponse response) {\r\n\t\tString r = new String();\r\n\t\tEnumeration<String> params = request.getParameterNames();\r\n\t\tString userName = request.getParameter(\"username\");\r\n\t\tString pwd = request.getParameter(\"password\");\r\n\t\tString clientid = request.getParameter(\"clientid\");\r\n\t\t// ACL access 方式,1: 发布 2:订阅\r\n\t\t// 3:发布/订阅,可用于判断是否是acl校验,null表示是auth校验,非空时表示是acl校验\r\n\t\tString access = request.getParameter(\"access\");\r\n\t\tString topic = request.getParameter(\"topic\");\r\n\t\tString ip = request.getParameter(\"ipaddr\");\r\n\t\tif (clientid != null) {\r\n\t\t\tif (userName != null) {\r\n\t\t\t\t// check user auth\r\n\t\t\t\t// ....\r\n\t\t\t\t// check silo self\r\n\t\t\t\tif (!offlineMsgService.checkAuthForSilo(userName, pwd)) {\r\n\t\t\t\t\tresponse.setStatus(HttpServletResponse.SC_FORBIDDEN);\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\t\t\t\tresponse.setStatus(HttpServletResponse.SC_FORBIDDEN);\r\n\t\t\t}\r\n\t\t}\r\n\t\tlog.info(\"=======Mqtt auth clientId:{},user:{},access:{},topic:{},ip:{}========\", clientid, userName, access,\r\n\t\t\t\ttopic, ip);\r\n\t\treturn r;\r\n\t}", "@Override\n\tpublic boolean authenticate(OrderBean bean) {\n\t\treturn false;\n\t}", "@Override\n public void onResponse(String response) {\n editor.putBoolean(\"credentials_validity\", true);\n editor.putInt(\"last_login_method\", Constants.USER_PASS_LOGIN);\n editor.commit();\n saveCredentials(email, password);\n onLoginFinished(false);\n }", "AuthenticationToken authenticate(String username, CharSequence password) throws Exception;", "public interface HttpAdapter\n{\n /**\n * <P>Specify the realm that this authenticator is authenticating for. \n * \n * <P>This value should be well-known, very stable, and preferably\n * expressed in some \"canonical\" form.\n * \n * <P>As this value is a factor in authentication cryptography, any change\n * to it may invalidate passwords in the realm stored as part of digests.\n * \n */\n void setRealm(String realm);\n \n /**\n * Read authorization info from the client\n * \n * @param request The HttpServletRequest to read\n * @return An array of Credentials read from the client\n * @throws IOException\n * @throws ServletException\n */\n Credential<?>[] readAuthorization(HttpServletRequest request)\n throws IOException,ServletException;\n \n /**\n * Challenge the client to provide authorization info\n * \n * @param response The HttpServletResponse to write\n * @throws IOException\n * @throws ServletException\n */\n void writeChallenge(HttpServletResponse response)\n throws IOException,ServletException;\n}", "List<String> authenticateUser(String userName, String password);", "public boolean auth(boolean reauth) throws IOException {\r\n log.debug(\"auth Authentication method starts\");\r\n if(alreadyAuthorized && !reauth) {\r\n \tlog.debug(\"auth Already Authorized.\");\r\n \treturn true;\r\n }\r\n\r\n AuthCmdPayload sendPayload = new AuthCmdPayload();\r\n log.debug(\"auth Sending CmdPacket with AuthCmdPayload: cmd=\" + Integer.toHexString(sendPayload.getCommand())\r\n + \" len=\" + sendPayload.getPayload().getData().length);\r\n\r\n log.debug(\"auth AuthPayload initial bytes to send: {}\", DatatypeConverter.printHexBinary(sendPayload.getPayload().getData()));\r\n\r\n DatagramPacket recvPack = sendCmdPkt(10000, 2048, sendPayload);\r\n\r\n byte[] data = recvPack.getData();\r\n \r\n if(data.length <= 0) {\r\n log.error(\"auth Received 0 bytes on initial request.\");\r\n alreadyAuthorized = false;\r\n return false;\r\n }\r\n\r\n log.debug(\"auth recv encrypted data bytes (\" + data.length +\") after initial req: {}\", DatatypeConverter.printHexBinary(data));\r\n\r\n byte[] payload = null;\r\n try {\r\n log.debug(\"auth Decrypting encrypted data\");\r\n\r\n payload = decryptFromDeviceMessage(data);\r\n\r\n log.debug(\"auth Decrypted. len=\" + payload.length);\r\n\r\n } catch (Exception e) {\r\n log.error(\"auth Received datagram decryption error. Aborting method\", e);\r\n alreadyAuthorized = false;\r\n return false;\r\n }\r\n\r\n log.debug(\"auth Packet received payload bytes: \" + DatatypeConverter.printHexBinary(payload));\r\n\r\n key = subbytes(payload, 0x04, 0x14);\r\n\r\n log.debug(\"auth Packet received key bytes: \" + DatatypeConverter.printHexBinary(key));\r\n\r\n if (key.length % 16 != 0) {\r\n log.error(\"auth Received key len is not a multiple of 16! Aborting\");\r\n alreadyAuthorized = false;\r\n return false;\r\n }\r\n\r\n // recreate AES object with new key\r\n aes = new AES(iv, key);\r\n\r\n id = subbytes(payload, 0x00, 0x04);\r\n\r\n log.debug(\"auth Packet received id bytes: \" + DatatypeConverter.printHexBinary(id) + \" with ID len=\" + id.length);\r\n\r\n log.debug(\"auth End of authentication method\");\r\n alreadyAuthorized = true;\r\n\r\n return true;\r\n }", "@Override\n\tprotected void login() {\n\t\tsuper.login();\n\t}", "private void authenticationFailedHandler(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) {\n response.setHeader(HttpHeaders.WWW_AUTHENTICATE, \"Basic\");\n response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n }", "private void getAUTH_REQUEST() throws Exception {\n\t\t\n\t\tboolean status = true;\n\t\tboolean status2 = false;\n\t\tString msg = \"\";\n\t\t\n\t\t//File filePK = new File(\"identity\");\n\t\n\t\ttry {\n\t\t\t\n\t\t\tmsg = br.readLine();\n\t\t\tGetTimestamp(\"Received Authorization Request from Client: \" + msg);\n\t\t\t\n\t\t\tJSONObject REQUEST = (JSONObject) parser.parse(msg);\n\t String identity = REQUEST.get(\"identity\").toString();\n\t\t\t\n\t\t\t\n\t if((identity.contains(\"aaron@krusty\"))) {\n\n\t \tGetTimestamp(\"Authorization Request from Client is approved: \");\n\n\t \tGetTimestamp(\"Client Publickey is stored: \" ) ;\n\n\t \tString tosend = encrypt1(getSharedKey(), getClientPublicKey());\n\n\t \tGetTimestamp(\"Server sharedkey is being encrypted with Client's publickey to be sent: \") ;\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"AES128\", tosend);\n\t \tRESPONSE.put(\"status\", status);\n\t \tRESPONSE.put(\"message\", \"public key found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tGetTimestamp(\"Sending Authorization Response to Client: \");\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\n\n\t }\n\t else {\n\n\t \tSystem.out.println(\"Client \" + REQUEST.get(\"identity\") + \" has been rejected\");\n\n\t \tJSONObject RESPONSE = new JSONObject();\n\t \tRESPONSE.put(\"command\",\"AUTH_RESPONSE\");\n\t \tRESPONSE.put(\"status\", status2);\n\t \tRESPONSE.put(\"message\", \"public key not found\");\n\n\t \tStringWriter out = new StringWriter();\n\t \tRESPONSE.writeJSONString(out);\n\n\t \tString AUTH_RESPONSE = out.toString();\n\t \tSystem.out.println(AUTH_RESPONSE);\n\n\t \tpw.println(AUTH_RESPONSE);\n\t \tpw.flush();\n\n\t \tcloseConnection();\n\t }\n\t\t\t\t\n\t\t\t\n\t\t} catch (IOException ex) {\n\t\t\tLogger.getLogger(ServerTCP.class.getName()).log(Level.SEVERE, null, ex);\n\t\t}\n\t\tif (msg.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"Client has signed out!\");\n\t\t\tcloseConnection();\n\n\t\t} else {\t\n\t\t\tgetMessage();\n\t\t}\n\t}", "@Override\r\n\tpublic void login() {\n\r\n\t}", "boolean isAuthenticated();", "@Test\n public void doSuccessfulAuthTest() throws IOException {\n // Load valid credentials\n loadValidCredentials();\n\n final RestClient restClient = new HttpClientRestClient();\n restClient.init(testConfig);\n\n // Validate not yet valid\n assertFalse(\"should not yet be valid\", sessionRefreshHandler.isValid());\n// TODO\n// assertNull(\"Should have no header value yet\", sessionRefreshHandler.getAuthorizationHeaderValue());\n\n // Call method with valid credentials and this should return true.\n assertTrue(sessionRefreshHandler.refreshCredentials(pardotClient));\n\n // Sanity check\n assertTrue(sessionRefreshHandler.isValid());\n// TODO\n// assertNotNull(sessionRefreshHandler.getAuthorizationHeaderValue());\n }", "AuthenticationToken renewAuthentication(String headerToken);", "private static HttpResponse sendAuthenticated(HttpUriRequest request) throws Exception {\n if (accessToken == null) {\n throw new Exception(\"GitLab access token not set\");\n }\n request.addHeader(\"PRIVATE-TOKEN\", accessToken);\n return createClient().execute(request);\n }", "public void authenticateUser()\r\n\t{\r\n\t\tsc.nextLine(); \r\n\t\tint index=loginattempt();\r\n\t}", "RequestResult loginRequest() throws Exception;", "public void setWantClientAuth(boolean flag)\n {\n wantClientAuth = flag;\n }", "@Override\npublic boolean supports(Class<?> authentication) {\n return true;\n}", "@Override\n public URLConnection authenticate(final URLConnection connection) throws IOException {\n String authorization = getConfiguration().getUsername() + \":\" + getConfiguration().getPassword();\n String encodedAuthorization = new String(Base64.encodeBase64(authorization.getBytes()));\n connection.setRequestProperty(\"Authorization\", \"Basic \" + encodedAuthorization);\n return connection;\n }", "private void authenticate( String loging, String sysLoging,String password,String sys_password) throws Exception {\n \n if(!loging.equals(sysLoging) || !(sys_password.equals(password) )){\n Exception e = new Exception();\n throw e;\n }\n\n }", "public abstract boolean authenticate(String userid, String password) throws\n YAuthenticationException;", "public User doAuthentication(String account, String password);", "private static void hackRequestForSwitchingSecureScheme() {\n// Logger.debug(\"SCOPE -> hackRequestForSwitchingSecureScheme\");\n Http.Request.current().secure = true;\n hackRequestPort();\n }", "@Override\n public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {\n //oauthServer.realm(REALM);\n oauthServer.tokenKeyAccess(\"permitAll()\")\n .checkTokenAccess(\"isAuthenticated()\")\n //.passwordEncoder(this.passwordEncoder)\n .allowFormAuthenticationForClients();\n\n }", "@Override\r\n\tpublic Authentication authenticate(Authentication arg0)\r\n\t\t\tthrows AuthenticationException {\n\t\treturn null;\r\n\t}", "private ServicioLogin() {\n super();\n }" ]
[ "0.64765507", "0.63921", "0.6277572", "0.6246606", "0.62250566", "0.60446197", "0.6032125", "0.596606", "0.596168", "0.5945022", "0.5943184", "0.59417063", "0.59307414", "0.591021", "0.5909208", "0.5886393", "0.588637", "0.58704495", "0.58381087", "0.58365154", "0.57992643", "0.575507", "0.5735815", "0.5734547", "0.5714972", "0.5686927", "0.5686501", "0.5649612", "0.5638579", "0.5616524", "0.5612378", "0.56041926", "0.5594151", "0.5594061", "0.5577057", "0.5554928", "0.5548912", "0.55418843", "0.55394155", "0.55374247", "0.5537122", "0.55309486", "0.5524938", "0.5511876", "0.55014104", "0.54990286", "0.5493946", "0.5491705", "0.5483806", "0.5469762", "0.54606575", "0.5451892", "0.5446793", "0.5442381", "0.54359794", "0.5434305", "0.541157", "0.54039896", "0.53972936", "0.5394301", "0.5390968", "0.5386005", "0.5383274", "0.5380803", "0.5378251", "0.5378111", "0.5378098", "0.53759444", "0.5372629", "0.53596294", "0.5356819", "0.5355462", "0.5354098", "0.5342266", "0.53365666", "0.5320917", "0.5317706", "0.53176624", "0.53166616", "0.531596", "0.5310583", "0.529083", "0.52877253", "0.52869433", "0.5279957", "0.52788556", "0.52765375", "0.52741265", "0.52703035", "0.5268484", "0.5266666", "0.52664006", "0.5265839", "0.52636516", "0.5259055", "0.52485704", "0.5248164", "0.52451074", "0.52415043", "0.52324724" ]
0.7752846
0
Executes the request. This method is called from the WebView thread. To do a nontrivial amount of work, use: cordova.getThreadPool().execute(runnable); To run on the UI thread, use: cordova.getActivity().runOnUiThread(runnable);
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { this.callbackContext = callbackContext; if (action.equals("scan")) { scan(); } else { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void run() {\n //Request the HTML\n try {\n HttpClient Client = new DefaultHttpClient();\n //String URL = \"http://10.0.2.2:8888/url\";\n String URL = \"http://\" + ipAddress + \":8888/intent?sentence=\" + URLEncoder.encode(query, \"utf-8\").replace(\"+\", \"%20\");\n String responseJsonString = \"\";\n\n // Create Request to server and get response\n HttpGet httpget = new HttpGet(URL);\n ResponseHandler<String> responseHandler = new BasicResponseHandler();\n responseJsonString = Client.execute(httpget, responseHandler);\n\n JSONObject responseJSON = new JSONObject(responseJsonString);\n // Show response on activity\n speakOut(responseJSON.getString(\"speechText\"));\n\n // Show response on activity\n String response_url = responseJSON.getString(\"url\");\n if(!response_url.equals(new_url))\n {\n new_url = response_url;\n myWebView.post(new Runnable() {\n public void run() {\n myWebView.loadUrl(new_url);\n }\n });\n //myWebView.loadUrl(new_url);\n }\n //System.out.println(responseString);\n\n } catch (Exception ex) {\n System.out.println(ex.getMessage());\n }\n }", "@Override\n public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {\n \tLog.i(\"WebViewSDK\",\"CoocaaOSApi execute action = \" + action);\n if(WAIT_OS_READY.equals(action))\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n \tLog.i(\"WebViewSDK\",\"WAIT_OS_READY isCmdBindSuccess:\" + isCmdBindSuccess);\n while(!isCmdBindSuccess/* && mRef <= 1*/)\n {\n try {\n Thread.sleep(50);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n callbackContext.success();\n }\n });\n return true;\n }\n else if(LAUNCH_SOURCE_LIST.equals(action))\n {\n Intent intent = new Intent(\"startSourceList\");\n intent.putExtra(\"specialKey\", SkyworthBroadcastKey.SKY_BROADCAST_KEY_SIGNAL);\n cordova.getActivity().sendBroadcast(intent);\n callbackContext.success();\n return true;\n }\n else if(SET_FOCUS_POSITION.equals(action))\n {\n \tJSONObject paramObj = args.getJSONObject(0);\n \tif(paramObj != null){\n \t\tString strPos = paramObj.getString(\"focusposition\");\n \t\tint iPos = 0;\n \t\ttry{\n \t\t\tiPos = Integer.parseInt(strPos);\n \t\t\tSystemWebViewSDK.setFocusPosition(iPos);\n \t\t}catch(Exception e){\n \t\t\tcallbackContext.error(e.toString());\n \t\t}\n \t}\n \tcallbackContext.success();\n \treturn true;\n }\n else if(NOTIFY_JS_LOG.equals(action))\n {\n \tString eventId = \"\";\n \tString params = \"\";\n \tJSONObject eventIdObj = args.getJSONObject(0);\n \tJSONObject paramsObj = args.getJSONObject(1);\n \tif(eventIdObj != null && paramsObj != null){\n \t\teventId = eventIdObj.getString(\"eventId\");\n \t\tparams = paramsObj.getString(\"params\");\n \t}\n Intent intent = new Intent(\"notify.js.log\");\n intent.putExtra(\"eventId\", eventId);\n intent.putExtra(\"params\", params);\n LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);\n \tcallbackContext.success();\n \treturn true;\n }\n else if(NOTIFY_JS_LOG_EXTRA.equals(action))\n {\n String eventId = \"\",params = \"\",type = \"\";\n JSONObject eventIdObj = args.getJSONObject(0);\n JSONObject paramsObj = args.getJSONObject(1);\n JSONObject typeObj = args.getJSONObject(2);\n if(eventIdObj != null && paramsObj != null && typeObj != null){\n eventId = eventIdObj.getString(\"eventId\");\n params = paramsObj.getString(\"params\");\n type = typeObj.getString(\"type\");\n }\n if(\"resume\".equals(type)){\n Intent intent = new Intent(\"notify.js.log.resume\");\n intent.putExtra(\"eventId\", eventId);\n intent.putExtra(\"params\", params);\n LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);\n }else if(\"pause\".equals(type)){\n Intent intent = new Intent(\"notify.js.log.pause\");\n intent.putExtra(\"eventId\", eventId);\n LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);\n }\n callbackContext.success();\n return true;\n }\n else if(NOTIFY_JS_MESSAGE.equals(action))\n {\n\t\t\tJSONObject paramObj = args.getJSONObject(0);\n\t\t\tString data = \"\";\n\t\t\tif(paramObj != null){\n\t\t\t\tdata = paramObj.getString(\"webInfo\");\n\t\t\t}\n \tIntent intent = new Intent(\"notify.js.message\");\n \tintent.putExtra(\"key\", data);\n \tLocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);\n \tcallbackContext.success();\n \treturn true;\n }\n else if(LAUNCH_ONLINE_MOVIE_PLAYER.equals(action))\n {\n if(mCoocaaListener!=null && mediaApi!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n try\n {\n JSONObject urlObj = args.getJSONObject(0);\n JSONObject nameObj = args.getJSONObject(1);\n JSONObject needParseObj = args.getJSONObject(2);\n JSONObject urlTypeObj = args.getJSONObject(3);\n String urlType = urlTypeObj.getString(\"urlType\");\n SkyMediaItem[] items = new SkyMediaItem[1];\n SkyMediaItem item = new SkyMediaItem();\n item.type = SkyMediaItem.SkyMediaType.MOVIE;\n \n String needParseString = \"false\";\n if(needParseObj!=null)\n {\n \tneedParseString = needParseObj.getString(\"needparse\");\n }\n \n if(\"true\".equals(needParseString) || \"false\".equals(needParseString))\n {\n item.setNeedParse(Boolean.valueOf(needParseString));\n }\n else\n {\n item.setNeedParse(false);\n }\n item.url = urlObj.getString(\"url\");\n item.name = nameObj.getString(\"name\");\n item.extra.put(\"url_type\", urlType);\n items[0] = item;\n SkyMediaApiParam param = new SkyMediaApiParam();\n param.setPlayList(items,0);\n mediaApi.startOnlinePlayer(param);\n callbackContext.success();\n }catch(JSONException e)\n {\n callbackContext.error(e.toString());\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if (GET_USER_INFO.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.getLoginUserInfo();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called getLoginUserInfo\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if (GET_DEVICE_INFO.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.getDeviceInfo();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called getDeviceInfo\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(GET_MOVIEPLATFORM_INFO.equals(action))\n {\n PackageManager pm = this.cordova.getActivity().getPackageManager();\n String versionName = \"\";\n int versionCode = 0;\n\n try {\n PackageInfo info = pm.getPackageInfo(\"com.tianci.movieplatform\", 0);\n versionName = info.versionName;\n versionCode = info.versionCode;\n JSONObject result = new JSONObject();\n result.put(\"versionName\", versionName);\n result.put(\"versionCode\", versionCode);\n result.put(\"packageName\", \"com.tianci.movieplatform\");\n callbackContext.success(result);\n\n } catch (NameNotFoundException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n callbackContext.error(\"error occurs when called getMovieplatformInfo\");\n }\n return true;\n }\n else if(GET_BASE_INFO.equals(action))\n {\n long totalMem = 0, leftMem = 0;\n ActivityManager activityManager = (ActivityManager)mContext.getSystemService(Context.ACTIVITY_SERVICE);\n ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();\n activityManager.getMemoryInfo(outInfo);\n totalMem = outInfo.totalMem;\n leftMem = outInfo.availMem;\n\n long totalSpace = 0L, freeSpace = 0L;\n long blockSize = 0L, availableBlocks = 0L, totalBlocks = 0L;\n File path = Environment.getDataDirectory();\n StatFs stat = new StatFs(path.getPath());\n blockSize = stat.getBlockSize();\n availableBlocks = stat.getAvailableBlocks();\n totalBlocks = stat.getBlockCount();\n totalSpace = blockSize * totalBlocks;\n freeSpace = blockSize * availableBlocks;\n\n JSONObject result = new JSONObject();\n result.put(\"totalMem\", totalMem);\n result.put(\"leftMem\", leftMem);\n result.put(\"totalSpace\", totalSpace);\n result.put(\"freeSpace\", freeSpace);\n Log.i(\"WebViewSDK\",result.toString());\n callbackContext.success(result);\n return true;\n }\n else if(GET_APP_INFO.equals(action))\n {\n \tPackageManager pm = this.cordova.getActivity().getPackageManager();\n \tString versionName = \"\";\n \tint versionCode = 0;\n \t\n \ttry {\n \t\tJSONObject pkgNameObj = args.getJSONObject(0);\n \t\tString packageName = pkgNameObj.getString(\"packageName\");\n \t\tPackageInfo info = pm.getPackageInfo(packageName, 0);\n \t\tif(info == null){\n \t\t\tcallbackContext.error(\"this App is not installed :\" + packageName);\n \t\t}else{\n \t\tversionName = info.versionName;\n \t\tversionCode = info.versionCode;\n \t\tJSONObject result = new JSONObject();\n \t\tresult.put(\"versionName\", versionName);\n \t\tresult.put(\"versionCode\", versionCode);\n callbackContext.success(result);\n \t\t}\n\t\t\t} catch (NameNotFoundException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\tcallbackContext.error(\"error occurs when called getAppInfo\");\n\t\t\t}\n return true;\n }\n else if(GET_CURRENT_THEME.equals(action))\n {\n \tString theme = \"\";\n \ttry {\n \t if(SkyThemeEngine.getInstance().getThemeColorSeries() == ThemeColorSeriesEnum.E_THEME_COLOR_SERIES_DARK){\n \t \ttheme = \"dark\";\n \t }else{\n \t \ttheme = \"light\";\n \t }\n \t\tJSONObject result = new JSONObject();\n \t\tresult.put(\"theme\", theme);\n callbackContext.success(result);\n\n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\tcallbackContext.error(\"error occurs when called getCurTheme\");\n\t\t\t}\n return true;\n }\n else if(GET_WEBVIEWSDK_INFO.equals(action))\n {\n \tString versionName = \"\";\n \tint versionCode = 0;\n \t\n \ttry {\n \t\tversionName = SystemWebViewSDK.getVersionName();\n \t\tversionCode = SystemWebViewSDK.getVersionCode();\n \t\tJSONObject result = new JSONObject();\n \t\tresult.put(\"versionName\", versionName);\n \t\tresult.put(\"versionCode\", versionCode);\n callbackContext.success(result);\n\n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\tcallbackContext.error(\"error occurs when called getWebViewSDKInfo\");\n\t\t\t}\n return true;\n }\n else if(CREATE_APP_TASK.equals(action))\n {\n \ttry\n \t{\n \t\t//appstore 5.x support!\n \t\tif(mDownloadListenrer == null)\n \t{\n \t\tSuperXFinder.setContext(mContext);\n mDownloadListenrer = new MyTableDownloadListener();\n TableDownload._createTableDownloadListener(mContext, mDownloadListenrer);\n if(mProcessListener == null)\n \t\t{\n \t\t\tmProcessListener = new MyTableMoniteDownloadListener();\n \t\t\tTableDownload._addTableDownloadMonitor(mProcessListener);\n \t\t}\n \t}\n \t\t\n \t}catch (Exception e)\n \t{\n \t\te.printStackTrace();\n \t}\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n try{\n \t\n JSONObject urlObj = args.getJSONObject(0);\n JSONObject md5Obj = args.getJSONObject(1);\n JSONObject titleObj = args.getJSONObject(2);\n JSONObject pkgObj = args.getJSONObject(3);\n JSONObject appidObj = args.getJSONObject(4);\n JSONObject iconObj = args.getJSONObject(5);\n String url = urlObj.getString(\"url\");\n String md5 = md5Obj.getString(\"md5\");\n String title = titleObj.getString(\"title\");\n String pkgname = pkgObj.getString(\"pkg\");\n String appid = appidObj.getString(\"appid\");\n String icon = iconObj.getString(\"icon\");\n TableDownload checkdownloader = TableDownload._queryDownloadByUrl(url);\n if (checkdownloader==null)\n {\n checkdownloader = TableDownload._createAppDownload(url, md5, title, pkgname, appid, icon);\n }\n if (checkdownloader!=null)\n {\n if(mDownloadListenrer!=null)\n {\n mDownloadListenrer.addDownloadTask(checkdownloader);\n }\n TableDownload._start(checkdownloader.getId());\n JSONObject jsonObject = new JSONObject();\n try {\n jsonObject.put(\"taskid\", checkdownloader.getId());\n jsonObject.put(\"status\", checkdownloader.getStatus());\n jsonObject.put(\"name\", checkdownloader.getName());\n jsonObject.put(\"url\", checkdownloader.getUrl());\n jsonObject.put(\"progress\", checkdownloader.getLength()>0?checkdownloader.getProgress():0);\n jsonObject.put(\"createtime\", checkdownloader.getCreatetime());\n jsonObject.put(\"code\", checkdownloader.getOncode());\n jsonObject.put(\"extra\", checkdownloader.getOnextra());\n } catch (JSONException e) {\n e.printStackTrace();\n }\n callbackContext.success(jsonObject);\n }\n else\n {\n callbackContext.error(\"error occurs when called createDownloadTask\");\n }\n }catch(JSONException e)\n {\n callbackContext.error(e.toString());\n }\n }\n });\n return true;\n }\n else if(RESUME_APP_TASK.equals(action))\n {\n JSONObject taskIdObj = args.getJSONObject(0);\n String taskId = taskIdObj.getString(\"taskid\");\n if(mDownloadListenrer!=null)\n {\n mDownloadListenrer.resumeTaskId(Long.valueOf(taskId));\n }\n return true;\n }\n else if(DELETE_APP_TASK.equals(action))\n {\n JSONObject taskIdObj = args.getJSONObject(0);\n String taskId = taskIdObj.getString(\"taskid\");\n if(mDownloadListenrer!=null)\n {\n mDownloadListenrer.deleteTaskId(Long.valueOf(taskId));\n }\n return true;\n }\n else if(PAUSE_APP_TASK.equals(action))\n {\n JSONObject taskIdObj = args.getJSONObject(0);\n String taskId = taskIdObj.getString(\"taskid\");\n if(mDownloadListenrer!=null)\n {\n mDownloadListenrer.pauseTaskId(Long.valueOf(taskId));\n }\n return true;\n }\n else if(IS_NET_CONNECTED.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.isNetConnected();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called isNetConnected\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(GET_NET_TYPE.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.getNetType();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called getNetType\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(GET_DEVICE_LOCATION.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.getLocation();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called getNetType\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(GET_IP_INFO.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.getIpInfo();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called getIpInfo\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if (HAS_USER_LOGIN.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.hasUserLogin();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called hasUserLogin\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(START_QQ_ACOUNT.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n mCoocaaListener.startQQAcount();\n callbackContext.success();\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(SET_USER_LOGINOUT.equals(action))\n {\n if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n mCoocaaListener.setUserLogout();\n callbackContext.success();\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(GET_USER_ACCESS_TOKEN.equals(action))\n {\n \t if(mCoocaaListener!=null)\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n JSONObject successobj = mCoocaaListener.getUserAccessToken();\n if(successobj!=null)\n {\n callbackContext.success(successobj);\n }\n else\n {\n callbackContext.error(\"error occurs when called getUserAccessToken\");\n }\n }\n });\n }\n else\n {\n callbackContext.error(\"mCoocaaListener is not ready!\");\n }\n return true;\n }\n else if(GET_PROPERTY_VALUE.equals(action))\n {\n \ttry {\n \t\tString propertiesValue = \"\";\n \t\tJSONObject pkgNameObj = args.getJSONObject(0);\n \t\tString propertiesKey = pkgNameObj.getString(\"propertiesKey\");\n \t\tif(propertiesKey != null)\n \t\t\tpropertiesValue = SystemProperties.get(propertiesKey);\n \tJSONObject result = new JSONObject();\n \tresult.put(\"propertiesValue\", propertiesValue);\n callbackContext.success(result);\n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t\tcallbackContext.error(\"error occurs when called getPropertiesValue\");\n\t\t\t}\n return true;\n }\n else if(PURCHASE_ORDER.equals(action))\n {\n this.cordova.getThreadPool().execute(new Runnable() {\n @Override\n public void run() {\n \ttry{\n JSONObject appCodeObj = args.getJSONObject(0);//商户编号ID,由酷开发布给第三方\n JSONObject tradeidObj = args.getJSONObject(1);//订单编号ID\n JSONObject productNameObj = args.getJSONObject(2);//商品名称,例如“影视包年”\n JSONObject specialtypeObj = args.getJSONObject(3);//必填,通知支付结果给第三方开发者服务器URL,必须以http://开头,目前支持80端口 ,参数内容为,json格式字符串 例如:{\"notify_url\":\"http://tv.coocaa.com/notify_url.html\"}\n JSONObject amountObj = args.getJSONObject(4);//商品价格,以“元”为单位\n JSONObject productTypeObj = args.getJSONObject(5);\n JSONObject payActionObj = args.getJSONObject(6);\n JSONObject cmdObj = args.getJSONObject(7);\n JSONObject tokenObj = args.getJSONObject(8);\n JSONObject phoneNumObj = args.getJSONObject(9);\n \n String appcode = appCodeObj.getString(\"appcode\");\n String Tradeid = tradeidObj.getString(\"Tradeid\");\n String ProductName = productNameObj.getString(\"ProductName\");\n String SpecialType = specialtypeObj.getString(\"SpecialType\");\n String ProductType = productTypeObj.getString(\"ProductType\");\n String payAction = payActionObj.getString(\"payAction\");\n String cmd = cmdObj.getString(\"cmd\");\n double amount = amountObj.getDouble(\"amount\");\n String token = tokenObj.getString(\"token\");\n String phoneNum = phoneNumObj.getString(\"tel\");\n \n Intent mIntent = new Intent(\"coocaa.intent.movie.pay\");\n String pkgName = mContext.getPackageName();\n if(pkgName != null)\n \tmIntent.setPackage(pkgName);\n else\n \tmIntent.setPackage(\"com.tianci.movieplatform\");\n mIntent.putExtra(\"appcode\", appcode);\n mIntent.putExtra(\"ProductName\", ProductName);\n mIntent.putExtra(\"Tradeid\", Tradeid);\n mIntent.putExtra(\"amount\", amount / 100.0);\n mIntent.putExtra(\"ProductType\", ProductType);\n mIntent.putExtra(\"SpecialType\", \"{\\\"notify_url\\\":\\\"\" + SpecialType + \"\\\"}\");\n mIntent.putExtra(\"payAction\", PAY_ACTION);\n mIntent.putExtra(\"cmd\", cmd);\n mIntent.putExtra(\"token\", token);\n mIntent.putExtra(\"tel\", phoneNum);\n \n mContext.startActivity(mIntent);\n callbackContext.success();\n \n \t}catch(Exception e)\n {\n callbackContext.error(e.toString());\n }\n }\n });\n \treturn true;\n }\n else if(GET_SPACE_INFO.equals(action))\n {\n try {\n long totalSpace = 0L, freeSpace = 0L;\n long blockSize = 0L, availableBlocks = 0L, totalBlocks = 0L;\n File path = Environment.getDataDirectory();\n StatFs stat = new StatFs(path.getPath());\n blockSize = stat.getBlockSize();\n availableBlocks = stat.getAvailableBlocks();\n totalBlocks = stat.getBlockCount();\n totalSpace = blockSize * totalBlocks;\n freeSpace = blockSize * availableBlocks;\n JSONObject result = new JSONObject();\n result.put(\"totalSpace\", totalSpace);\n result.put(\"freeSpace\", freeSpace);\n callbackContext.success(result);\n } catch (Exception e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n callbackContext.error(\"error occurs when called getSpaceInfo\");\n }\n return true;\n }\n return false;\n }", "@Override\n\t\tpublic void run() {\n\t\t\tLooper.prepare();\n\n\t\t\tMap<String, String> param = new HashMap<String, String>();// 组装请求参数\n\t\t\tparam.put(\"UID\", \"3617\");\n\n\t\t\tHttp_PushTask HP = new Http_PushTask();\n\t\t\ttry {\n\t\t\t\tString result = HP\n\t\t\t\t\t\t.execute(\n\t\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\t\t\"http://192.168.51.200:8080/dfweb/sys/profitFR/profitResultList?UID=10&start=1&limit=5\")\n\t\t\t\t\t\t.get();\n\t\t\t\tif (!TextUtils.isEmpty(result)) {\n\t\t\t\t\tJSONObject js = new JSONObject(result);\n\t\t\t\t\tif (js.getBoolean(\"result\")) {\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tString message = js.getString(\"message\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t} catch (ExecutionException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "@Override\n public void onStarted(final String status) {\n this.cordova.getActivity().runOnUiThread(new Runnable() {\n @Override\n public void run() {\n String event = \"javascript:cordova.fireDocumentEvent('onStarted', {})\";\n webView.loadUrl(event);\n }\n });\n\n }", "@Override\n\t\t\t\t\tpublic void run() {\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tList<String> headers = readRequest(client);\n\t\t\t\t\t\t\tif (headers != null && headers.size() >= 1) {\n\t\t\t\t\t\t\t\tString requestURL = getRequestURL(headers.get(0));\n\t\t\t\t\t\t\t\tLog.d(TAG, requestURL);\n\n\t\t\t\t\t\t\t\tif (requestURL.startsWith(\"http://\")) {\n\n\t\t\t\t\t\t\t\t\t// HttpRequest request = new\n\t\t\t\t\t\t\t\t\t// BasicHttpRequest(\"GET\", requestURL);\n\n\t\t\t\t\t\t\t\t\tprocessHttpRequest(requestURL, client, headers);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tprocessFileRequest(requestURL, client, headers);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} catch (IllegalStateException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t}", "public void run() {\n if(isOnline){\n if(!webView.getUrl().contains(MainActivity.url)){\n webView.loadUrl(url);\n// webView.addJavascriptInterface(new WebAppInterface(context), \"Android\");\n\n }\n }else {\n webView.loadUrl(\"file:///android_asset/noConnection.html\");\n\n }\n }", "@Override\n\t\tpublic void run() {\n\t\t\tLooper.prepare();\n\n\t\t\tMap<String, String> param = new HashMap<String, String>();// 组装请求参数\n\t\t\tparam.put(\"idCardName\", \"卢波\");\n\t\t\tparam.put(\"IDNumber\", \"37142519930502763X\");\n\t\t\tparam.put(\"bankNumber\", \"6227002271530099694\");\n\t\t\tparam.put(\"companyName\", \"山东题开店收银台\");\n\t\t\tparam.put(\"mobilePhone\", \"18315913992\");\n\t\t\tparam.put(\"accounttype\", \"1\");\n\t\t\tparam.put(\"bankcardtype\", \"1\");\n\t\t\tparam.put(\"storeAddress\", \"山东省济南市天桥区时代总部基地4期H3楼201\");\n\t\t\tparam.put(\"uid\", \"3617\");\n\n\t\t\tHttp_PushTask HP = new Http_PushTask();\n\t\t\ttry {\n\t\t\t\tString result = HP.execute(CryptTool.transMapToString(param),\n\t\t\t\t\t\t\"http://cnyssj.com/dfweb_test/rbkjsame.do\").get();\n\t\t\t\tif (!TextUtils.isEmpty(result)) {\n\t\t\t\t\tJSONObject js = new JSONObject(result);\n\t\t\t\t\tif (js.getBoolean(\"result\")) {\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tString message = js.getString(\"message\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} catch (InterruptedException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t} catch (ExecutionException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t} catch (JSONException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "@Override\n\tprotected void onPostExecute(String result) {\n\t\tsuper.onPostExecute(result);\n\t\tsetupWebView();\n\t}", "@Override\r\n\t public void run() {\n\r\n\t\ttry {\r\n\t\t URL uri = new URL(url);\r\n\t\t String newParams = URLEncoder.encode(params, \"utf-8\");\r\n\t\t HttpURLConnection conn = (HttpURLConnection) uri\r\n\t\t\t .openConnection();\r\n\t\t conn.setRequestMethod(\"POST\");\r\n\t\t // 设置请求的参数\r\n\t\t conn.setDoInput(true);\r\n\t\t conn.setDoOutput(true);\r\n\r\n\t\t conn.getOutputStream().write(newParams.getBytes());\r\n\r\n\t\t if (conn.getResponseCode() == 200) {\r\n\t\t\tInputStream is = conn.getInputStream();\r\n\t\t\tString result = convertInputStreamToString(is);\r\n\t\t\t// 通过handler发送消息\r\n\t\t\tMessage msg = new Message();\r\n\t\t\tmsg.what = 1;\r\n\t\t\tmsg.obj = result;\r\n\t\t\thandler.sendMessage(msg);\r\n\t\t }\r\n\t\t} catch (MalformedURLException e) {\r\n\t\t // TODO Auto-generated catch block\r\n\t\t e.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t // TODO Auto-generated catch block\r\n\t\t e.printStackTrace();\r\n\t\t}\r\n\t }", "public final void run() {\n final long contextID = Nodex.instance.getContextID();\n Runnable runner = new Runnable() {\n public void run() {\n try {\n final T result = execute();\n NodexInternal.instance.executeOnContext(contextID, new Runnable() {\n public void run() {\n completionHandler.onEvent(new Completion(result));\n }\n });\n } catch (final Exception e) {\n NodexInternal.instance.executeOnContext(contextID, new Runnable() {\n public void run() {\n completionHandler.onEvent(new Completion(e));\n }\n });\n } catch (Throwable t) {\n //Not much we can do, just log it\n t.printStackTrace(System.err);\n }\n }\n };\n\n NodexInternal.instance.executeInBackground(runner);\n }", "@Override\n public void execute() {\n Task<Void> task = new Task<Void>() {\n @Override\n protected Void call() throws Exception {\n exportData();\n return null;\n }\n\n @Override\n protected void succeeded(){\n callback.onSuccess();\n super.succeeded();\n }\n\n @Override\n protected void failed(){\n callback.onFail(this.getException());\n super.failed();\n }\n };\n new Thread(task).start();\n }", "@Override\n\t\tpublic void run() {\n\t\t\tmHandler.post(new Runnable() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\t// display toast\n\n\t\t\t\t\tConnectivityManager cn = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);\n\n\t\t\t\t\tNetworkInfo nf = cn.getActiveNetworkInfo();\n\t\t\t\t\tif (nf != null && nf.isConnected() == true) {\n\n\n\t\t\t\t\t\t//new Don().execute(url); //notification için kullanılabilir\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t});\n\t\t}", "@Override\n\t\tpublic void run() {\n\t\t\tsuper.run();\n\t\t\ttry {\n\t\t\t\tHttp_PushTask HP = new Http_PushTask();\n\t\t\t\tString result = HP.execute(\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t\"http://cnyssj.com/dfweb/sys/good/getGoodList?token=\"\n\t\t\t\t\t\t\t\t+ token + \"&start=0&limit=100\").get();\n\n\t\t\t\tif (!TextUtils.isEmpty(result)) {\n\t\t\t\t\treList = new ArrayList<Recommend>();\n\t\t\t\t\treList = json.parseJsonsByReProduct(result);\n\t\t\t\t\tshowmessage(1);\n\t\t\t\t} else {\n\t\t\t\t\ttoast(\"获取数据失败!\");\n\t\t\t\t\tmDialog.dismiss();\n\t\t\t\t}\n\t\t\t} catch (InterruptedException e1) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te1.printStackTrace();\n\t\t\t} catch (ExecutionException e2) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te2.printStackTrace();\n\t\t\t}\n\t\t}", "@Override\n\tpublic void run() {\n\t\t\t\t\n\t\tString codigo = null;\n\t\ttry {\n\t\t\tcodigo = page.get();\n\t\t} catch (InterruptedException e) {\n\t\t\t//e.printStackTrace();\n\t\t} catch (ExecutionException e) {\n\t\t\t//e.printStackTrace();\n\t\t}\n\t\t\n\t\tif(codigo != null)\n\t\t{\n\t\t\ttrabalharCodigo(codigo);\t\t\t\n\t\t\t\t\n\t\t\tadapter = new NoticiaAdapter(getApplicationContext(),noticias);\t\t\t\t\t\t\t\t\t\t\t\n\t\t}\n\t\t\n\t\tmsg = new Message();\n\t\tmsg.arg1 = 1;\n\t\thandler.sendMessage(msg);\n\t\t\n\t}", "@Override\n public void run() {\n mRunnable.onPostExecute();\n mExecutor.onPostExecuteCallback(mRunnable);\n }", "public void run() {\n \t\t\r\n\t\t\tarraylist_destination.clear();\r\n\t\t\tarraylist_driverid.clear();\r\n\t\t\tarraylist_riderid.clear();\r\n\t\t\tarraylist_drivername.clear();\r\n\t\t\tarraylist_pickuptime.clear();\r\n\t\t\tarraylist_tripid.clear();\r\n\t\t\tarraylist_driver_image.clear();\r\n\t\t\tarraylist_rider_image.clear();\r\n\t\t\tarraylist_distance.clear();\r\n\t\t\tarraylist_requesttype.clear();\r\n\t\t\tarraylist_start.clear();\r\n\t\t\tarraylist_actualfare.clear();\r\n\t\t\tarraylist_suggestion.clear();\r\n\t\t\tarraylist_eta.clear();\r\n\t\t\tarraylist_driverrating.clear();\r\n\t\t\tarraylist_status.clear();\r\n\t\t\tarraylist_vehicle_color.clear();\r\n\t\t\tarraylist_vehicle_type.clear();\r\n\t\t\tarraylist_vehicle_name.clear();\r\n\t\t\tarraylist_vehicle_img.clear();\r\n\t\t\tarraylist_vehicle_year.clear();\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif(Utility.isConnectingToInternet(RiderQueue_Activity.this))\r\n \t \t{\r\n \t\t\t\t/**call pending request for rider queue class**/\r\n\t\t\t\tnew httpPendingRequest_riderqueue().execute(); \r\n \t \t\t}\r\n \t \telse{\r\n \t \t\tUtility.alertMessage(RiderQueue_Activity.this,\"error in internet connection\");\r\n \t \t}\r\n\t\t \r\n }", "@Override\n\tpublic void run() {\n\t\ttry{\n\t\t\tboolean redirected=false;\n\t\t\tint responseCode=0;\n\t\t\tint tries=0;\n\t\t\tString location=site.getUrl();\n\t\t\tHttpURLConnection urlConnection=null;\n\t\t\tdo{\n\t\t\t\tURL url = new URL(location);\n\t\t\t\turlConnection = (HttpURLConnection) url.openConnection();\n\t\t\t\turlConnection.setRequestProperty(\"User-Agent\", \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11\");\n\t\t\t\turlConnection.setConnectTimeout(Constants.CONNECTION_TIMEOUT);\n\t\t\t\turlConnection.setReadTimeout(Constants.READ_TIMEOUT);\n\t\t\t\turlConnection.setRequestMethod(\"GET\");\n\t\t\t\turlConnection.setInstanceFollowRedirects(true);\n\t\t\t\turlConnection.setUseCaches(false);\n\t\t\t\turlConnection.setAllowUserInteraction(false);\n\t\t\t\turlConnection.setRequestProperty(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\t\t\t\tresponseCode = urlConnection.getResponseCode();\n\t\t\t\t\n\t\t\t\tif(responseCode==HttpURLConnection.HTTP_MOVED_TEMP || responseCode==HttpURLConnection.HTTP_MOVED_PERM){ //handle 302 and 301 redirect. \n\t\t\t\t\tredirected=true;\n\t\t\t\t\tlocation = urlConnection.getHeaderField(\"Location\");\n\t\t\t\t\ttries++;\n\t\t\t\t}else\n\t\t\t\t\tredirected=false;\n\t\t\t}while(redirected && tries<3);\n\t\t\t\n\t\t\tif (responseCode == HttpURLConnection.HTTP_OK){\n\t\t\t\ttry (InputStream is = urlConnection.getInputStream();\n\t\t BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {\n\t\t String content = br.lines().collect(Collectors.joining(System.lineSeparator()));\n\t \tthis.callback.webContentCallBack(site, content);\n\t\t } \n\t\t\t}else this.callback.webContentCallBack(site, null); //any other case, null is returned as the content. \n\t\t}catch (Exception e) {\n\t\t\tLogger.getLogger(Fetcher.class.getName()).log(Level.WARNING, \"Site:\"+site.getUrl()+\" failed fetching.\", e);\n\t\t\ttry {\n\t\t\t\tthis.callback.webContentCallBack(site, null); //any exception, null is returned as the content. \n\t\t\t} catch (Exception e1) {\n\t\t\t} \n\t\t}\n\t}", "public void run() {\n //Request the HTML\n try {\n HttpClient Client = new DefaultHttpClient();\n //String URL = \"http://10.0.2.2:8888/url\";\n String URL = \"http://\" + ipAddress + \":8888/hello\";\n String responseJsonString = \"\";\n\n // Create Request to server and get response\n HttpGet httpget = new HttpGet(URL);\n ResponseHandler<String> responseHandler = new BasicResponseHandler();\n responseJsonString = Client.execute(httpget, responseHandler);\n\n JSONObject responseJSON = new JSONObject(responseJsonString);\n // Show response on activity\n speakOut(responseJSON.getString(\"speechText\"));\n } catch (Exception ex) {\n System.out.println(ex.getMessage());\n }\n }", "@Override\n public void onClick(View v) {\n RequestTask requestTask = new RequestTask();\n requestTask.execute();\n //SystemClock.sleep(5000);\n // textView.setText(htmldata);\n }", "@Override\n public void run() {\n String locString =\"javascript:updateUserLocation(\"+ String.valueOf(userLocation.getLatitude()) + \",\" +String.valueOf(userLocation.getLongitude())+ \")\";\n mWebView.loadUrl(locString);\n locString =\"javascript:updateUserAccuracy(\"+ String.valueOf(userLocation.getAccuracy())+ \")\";\n mWebView.loadUrl(locString);\n }", "protected Void doInBackground(String... urls) {\n /************ Make Post Call To Web Server ***********/\n /*****************************************************/\n return null;\n }", "@Override\n\t\tpublic void run() {\n\t\t\ttry {\n\n\t\t\t\tURL url = new URL(\"http://ecshopxax.sinaapp.com/js/index.js\");\n\t\t\t\tURLConnection connection = url.openConnection();\n\t\t\t\tInputStream is = connection.getInputStream();\n\t\t\t\tbyte[] bs = new byte[1024];\n\t\t\t\tint len = 0;\n\t\t\t\tStringBuffer sb = new StringBuffer();\n\t\t\t\twhile ((len = is.read(bs)) != -1) {\n\t\t\t\t\tString str = new String(bs, 0, len);\n\t\t\t\t\tsb.append(str);\n\t\t\t\t}\n\n\t\t\t\tMessage msg = new Message();\n\t\t\t\tmsg.what = 0x15;\n\n\t\t\t\tBundle bundle = new Bundle();\n\t\t\t\tbundle.clear();\n\n\t\t\t\t// bundle.putString(\"recv_server\", new String(buffer));\n\t\t\t\tbundle.putString(\"text1\", sb.toString());\n\n\t\t\t\tmsg.setData(bundle);\n\n\t\t\t\tmyHandler.sendMessage(msg);\n\n\t\t\t\n\t\t\t} catch (Exception e) {\n\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}", "@Override\n public void run() {\n mRunnable.onPreExecute();\n mExecutor.onPreExecuteCallback(mRunnable);\n }", "protected HttpUtils.HttpResult doInBackground() {\n\t\tHttpUtils.HttpResult result = null;\n if (context != null && !HttpUtils.isOnline(context)) {\n result = new HttpUtils.HttpResult();\n result.setEnvelope(context.getString(R.string.error_internet_not_connected));\n result.setCode(HttpUtils.HttpResult.BAD_REQUEST);\n result.setMessage(context.getString(R.string.error_connecting_message));\n return result;\n }\n\t\tif (RequestType.POST == requestType) {\n\t\t\tresult = HttpUtils.post(url, envelope, headers);\n\t\t} else if (RequestType.GET == requestType) {\n\t\t\tresult = HttpUtils.get(url, headers);\n\t\t}\n\t\treturn result;\n\t}", "public void run() {\n\t\t\t\t\tString resultString = upload(url, formParameters, datas);\n\t\t\t\t\tif (null != resultString) {\n\t\t\t\t\t\tMessage message = handler.obtainMessage(MessageWhat.UPLOADRESP, resultString);\n\t\t\t\t\t\thandler.sendMessage(message);\n\t\t\t\t\t}\n\t\t\t\t}", "public void executeOnMainThread(@NonNull Runnable runnable) {\r\n if (isMainThread()) {\r\n runnable.run();\r\n } else {\r\n postToMainThread(runnable);\r\n }\r\n }", "public void run() {\n\t\t\t\t\tString resultString = post(url, packet);\n\t\t\t\t\tMessage msg;\n\t\t\t\t\tif (null != handler) {\n\t\t\t\t\t\tif (StringUtils.isEmpty(resultString)) {\n\t\t\t\t\t\t\tmsg = handler.obtainMessage(Constant.FAIL_CODE, Constant.EXCEPTION);\n\t\t\t\t\t\t\thandler.sendMessage(msg);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tLog.i(TAG, \"=\" + resultString);\n\t\t\t\t\t\t\tLog.i(TAG, \"messageWhat=\" + messageWhat);\n\t\t\t\t\t\t\tmsg = handler.obtainMessage(messageWhat, resultString);\n\t\t\t\t\t\t\thandler.sendMessage(msg);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}", "@Override\n public void run() {\n\n new Thread() {\n\n @Override\n public void run() {\n HttpGet requestForTest = new HttpGet(\"http://m.google.com\");\n try {\n new DefaultHttpClient().execute(requestForTest); // can last...\n responded = true;\n } catch (Exception e) {}\n }\n\n }.start();\n\n try {\n int waited = 0;\n while(!responded && (waited < timeout)) {\n sleep(100);\n if(!responded ) { \n waited += 100;\n }\n }\n } \n catch(InterruptedException e) {} // do nothing \n finally { \n if (!responded) { handler.sendEmptyMessage(0); } \n else { handler.sendEmptyMessage(1); }\n }\n\n }", "public OnMainThread() {\n new AsyncTask<Void, Void, Void>() {\n\n @Override\n protected Void doInBackground(Void... params) {\n return null;\n }\n\n @Override\n protected void onPostExecute(Void aVoid) {\n run();\n }\n }.execute();\n }", "public void execute() {\n if (hasError())\n return;\n\n runLocally();\n runRemotely();\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tif (webView.getChildCount() > 0) {\n\t\t\t\t\twebView.removeViewAt(0);\n\t\t\t\t}\n\n\t\t\t\tswitch (notificationCode) {\n\t\t\t\tcase CoEvents.CONTEXT_WEBVIEW_HIDE:\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase CoEvents.CONTEXT_WEBVIEW_SHOW:\n\t\t\t\t\tLog.d(SmartConstants.APP_NAME, \"onReceiveContextNotification->CONTEXT_WEBVIEW_SHOW\");\n\t\t\t\t\tif (webViewDefaultImg != null) {\n\t\t\t\t\t\twebViewDefaultImg.setVisibility(View.INVISIBLE);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tJSONObject contextResponse = new JSONObject();\n\t\t\t\t\tcontextResponse.put(\"response\", \"OK\");\n\t\t\t\t\tSmartEventResponse smEventResponse = new SmartEventResponse();\n\t\t\t\t\tsmEventResponse.setOperationComplete(true);\n\t\t\t\t\tsmEventResponse.setServiceResponse(contextResponse.toString());\n\t\t\t\t\tsmEventResponse.setExceptionType(0);\n\t\t\t\t\tsmEventResponse.setExceptionMessage(null);\n\t\t\t\t\tsmartEvent.setSmartEventResponse(smEventResponse);\n\t\t\t\t\t// smartEvent.setJavaScriptNameToCallArg(contextResponse.toString());\n\t\t\t\t\tonFinishProcessingWithOptions(smartEvent);\n\t\t\t\t} catch (JSONException je) {\n\t\t\t\t\tonFinishProcessingWithError(smartEvent);\n\t\t\t\t}\n\n\t\t\t}", "public abstract void postToMainThread(@NonNull Runnable runnable);", "public abstract void executeOnNetwork(@NonNull Runnable runnable);", "@Override\n public void onClick(View v) {\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n doClickOnButtonWebView();\n }\n });\n }", "public void run() {\n String naverHtml = httpConnection(\"https://api.openweathermap.org/data/2.5/onecall?lat=\"+lat+\"&lon=\"+lon+\"&exclude=alerts&appid=e9e3ed325461bd506285bdb140285195&lang=kr&units=metric\");\n\n Bundle bun = new Bundle();\n bun.putString(\"HTML_DATA\", naverHtml);\n\n Message msg = handler.obtainMessage();\n msg.setData(bun);\n handler.sendMessage(msg);\n }", "@Override\r\n\tpublic void run() {\n\t\tresult = InternetConn.pushURL(URL);\r\n\t\tif(result.equals(\"-1\")){\r\n\t\t\t\r\n\t\t\tMessage msg = new Message();\r\n\t\t\tmsg.obj = \"网络连接错误\";\r\n\t\t\tmsg.what = -1;\r\n\t\t\tmHandler.sendMessage(msg);\r\n\t\t}else{\r\n\t\t\t\r\n\t\t\tMessage msg = new Message();\r\n\t\t\tmsg.obj = result;\r\n\t\t\tmsg.what = 1;\r\n\t\t\tmHandler.sendMessage(msg);\r\n\t\t}\r\n\t}", "@Override\n public void run() {\n MediaBrowser.Builder builder = new MediaBrowser.Builder(mContext)\n .setSessionToken(token)\n .setControllerCallback(sHandlerExecutor, callback);\n if (connectionHints != null) {\n builder.setConnectionHints(connectionHints);\n }\n controller.set(builder.build());\n }", "public void run() {\n\t\t\t\tHttpURLConnection connection = null;\r\n\t\t\t\tStringBuilder response = new StringBuilder();\r\n\t\t\t\ttry{\r\n\t\t\t\t\tURL url = new URL(address);\r\n\t\t\t\t\tconnection = (HttpURLConnection) url.openConnection();\r\n\t\t\t\t\tconnection.setRequestMethod(\"GET\");\r\n\t\t\t\t\tconnection.setConnectTimeout(8000);\r\n\t\t\t\t\tconnection.setReadTimeout(8000);\r\n\t\t\t\t\tconnection.setDoInput(true);\r\n\t\t\t\t\t//connection.setDoOutput(true);\r\n\t\t\t\t\tint responseCode = connection.getResponseCode();\r\n\t\t\t\t\tLog.d(\"HttpUtil\", String.valueOf(responseCode));\r\n\t\t\t\t\tif(responseCode != 200){\r\n\t\t\t\t\t\tLog.d(\"HttpUtil\", \"Get Fail\");\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tInputStream in = connection.getInputStream();\r\n\t\t\t\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(in));\r\n\t\t\t\t\t\tString line;\r\n\t\t\t\t\t\twhile((line = reader.readLine()) != null){\r\n\t\t\t\t\t\t\tresponse.append(line);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tLog.d(\"HttpUtil\", \"Get Success\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(listener != null){\r\n\t\t\t\t\t\tlistener.onFinish(response.toString());\r\n\t\t\t\t\t}\r\n\t\t\t\t}catch(Exception e){\r\n\t\t\t\t\tif(listener != null){\r\n\t\t\t\t\t\tlistener.onError(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}finally{\r\n\t\t\t\t\tif(connection != null){\r\n\t\t\t\t\t\tconnection.disconnect();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tAbsTaskAsynCallBack.this.run();\n\t\t\t\tAbsTaskAsynCallBack.this.callback();\n\t\t\t}", "@Override\r\n\t public void run() {\n\t\tsuper.run();\r\n\t\ttry {\r\n\t\t // String newParams=URLEncoder.encode(params, \"utf-8\");\r\n\t\t String newurl = url + \"?\" + params;\r\n\r\n\t\t URL uri = new URL(newurl);\r\n\t\t try {\r\n\t\t\tHttpURLConnection conn = (HttpURLConnection) uri\r\n\t\t\t\t.openConnection();\r\n\t\t\tconn.connect();\r\n\t\t\t// 获取返回结果\r\n\t\t\tif (conn.getResponseCode() == 200) {\r\n\t\t\t InputStream is = conn.getInputStream();\r\n\t\t\t String result = convertInputStreamToString(is);\r\n\t\t\t // 通过handle发送消息\r\n\t\t\t Message msg = new Message();\r\n\t\t\t msg.what = 2;\r\n\t\t\t msg.obj = result;\r\n\t\t\t handle.sendMessage(msg);\r\n\t\t\t}\r\n\t\t } catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t }\r\n\t\t} catch (MalformedURLException e) {\r\n\t\t // TODO Auto-generated catch block\r\n\t\t e.printStackTrace();\r\n\t\t}\r\n\t }", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tToast.makeText(getActivity(), R.string.global_server_fail_toast, Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "private void sendSupportRequest()\n {\n if (HelperHttp.isNetworkAvailable(getActivity()))\n {\n //Add parameters to request in arraylist\n ArrayList<Parameter> parameterList = new ArrayList<Parameter>();\n parameterList.add(new Parameter(\"userHash\", DataManager.getInstance().user.getUserHash(), String.class));\n parameterList.add(new Parameter(\"ticketType\", selectedRequestId, Integer.class));\n parameterList.add(new Parameter(\"ticketTitle\", edTitle.getText().toString(), String.class));\n parameterList.add(new Parameter(\"ticketDetails\", edDescription.getText().toString(), String.class));\n\n //create web service inputs\n DataInObject inObj = new DataInObject();\n inObj.setMethodname(\"LogNewSupportRequest\");\n inObj.setNamespace(Constants.TEMP_URI_NAMESPACE);\n inObj.setSoapAction(Constants.TEMP_URI_NAMESPACE + \"IPlannerService/LogNewSupportRequest\");\n inObj.setUrl(Constants.PLANNER_WEBSERVICE_URL);\n inObj.setParameterList(parameterList);\n\n //Network call\n showProgressDialog();\n new WebServiceTask(getActivity(), inObj, true, new TaskListener()\n {\n @Override\n public void onTaskComplete(Object response)\n {\n //Added by Asmita on 24th Jan 2017 as client asked to temporary hide the functionality due to server side error\n try\n {\n SoapObject outer = (SoapObject) response;\n SoapObject inner = (SoapObject) outer.getPropertySafely(\"Success\");\n successMessage = inner.getPropertySafelyAsString(\"Message\", \"0\");\n planTaskId = Integer.parseInt(inner.getPropertySafelyAsString(\"PlanTaskID\", \"0\"));\n\n if (imageDragableGridView.getUpdatedImageListWithoutPlus().size() >= 1)\n {\n for (int i = 0; i < imageDragableGridView.getUpdatedImageListWithoutPlus().size(); i++)\n {\n uploadDocFiles();\n }\n\n } else\n {\n hideProgressDialog();\n CustomDialogManager.showOkDialog(getActivity(), successMessage, new DialogListener()\n {\n @Override\n public void onButtonClicked(int type)\n {\n hideProgressDialog();\n if (getFragmentManager().getBackStackEntryCount() != 0)\n {\n getFragmentManager().popBackStack();\n } else\n {\n getActivity().finish();\n }\n }\n });\n }\n\n } catch (Exception e)\n {\n hideProgressDialog();\n e.printStackTrace();\n }\n\n }\n }).execute();\n } else\n {\n CustomDialogManager.showOkDialog(getActivity(), getString(R.string.no_internet_connection));\n }\n }", "@Override\n protected String doInBackground(String... urls) {\n\n WebView webView = (WebView) findViewById(R.id.webView);\n webView.getSettings().setJavaScriptEnabled(true);\n webView.loadUrl(urls[0]);\n\n return null;\n }", "@Override\n\t\t\tpublic void run() {\n\n\t\t\t\tpostParameters[0] = new PostParameter(\"keyword\", searchKeyword);\n\t\t\t\tpostParameters[1] = new PostParameter(\"university\", university);\n\t\t\t\tpostParameters[2] = new PostParameter(\"page\", Integer.toString(requestTime));\n\t\t\t\t\n\t\t\t\tjsonString = HttpUtil.httpRequest(HttpUtil.USER_SEARCHBOOKS, postParameters, HttpUtil.POST);\n\t\t\t\tif (jsonString != null) {\t\t\t\t\t\n\t\t\t\t\tMessage msg = handler.obtainMessage();\n\t\t\t\t\tmsg.what = what;\n\t\t\t\t\thandler.sendMessage(msg);\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\thandler.sendEmptyMessage(-1);\n\t\t\t\t}\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\t// defaultHttpClient\n\t\t\t\t\tLog.e(\"URL_\", url);\n\t\t\t\t\tDefaultHttpClient httpClient = new DefaultHttpClient();\n\t\t\t\t\tHttpPost httpPost = new HttpPost(url);\n\t\t\t\t\tLog.e(\"URL\", url);\n\t\t\t\t\thttpPost.setEntity(new UrlEncodedFormEntity(params,\n\t\t\t\t\t\t\tHTTP.UTF_8));\n\t\t\t\t\t// httpPost.setEntity(new UrlEncodedFormEntity(params));\n\n\t\t\t\t\t\n\t\t\t\t\tHttpResponse httpResponse = httpClient.execute(httpPost);\n\t\t\t\t\tHttpEntity httpEntity = httpResponse.getEntity();\n\t\t\t\t\tis = httpEntity.getContent();\n\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t\tlistener.connectError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\n\t\t\t\t\tBufferedReader reader = new BufferedReader(\n\t\t\t\t\t\t\tnew InputStreamReader(is, \"iso-8859-1\"), 8);\n\t\t\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\t\t\tString line = null;\n\t\t\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\t\t\tsb.append(line + \"n\");\n\t\t\t\t\t}\n\t\t\t\t\tis.close();\n\t\t\t\t\tjson = sb.toString();\n\t\t\t\t\t// Logger.e(json);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tLog.e(\"Buffer Error\",\n\t\t\t\t\t\t\t\"Error converting result: \" + e.toString());\n\t\t\t\t\tlistener.connectError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// try parse the string to a JSON object\n\t\t\t\ttry {\n\t\t\t\t\tLog.e(\"_responce\", json);\n\t\t\t\t\tjObj = new JSONObject(json);\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t\n\t\t\t\t\tlistener.connectError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tlistener.connectSucessfull(jObj);\n\t\t\t\t} catch (JSONException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}", "public abstract void runOnUiThread(Runnable runnable);", "@Override\n\t\t\t\t\t\t\t\t\tprotected Void doInBackground(\n\t\t\t\t\t\t\t\t\t\t\tVoid... params) {\n\t\t\t\t\t\t\t\t\t\tgetActivity().runOnUiThread(new Runnable(){\n\n\t\t\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\t\t\t\t\t\t\t\twebView.loadUrl(Uri.fromFile(new File(fileImg)).toString());\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t/*\n\t\t\t\t\t\t\t\t\t\tFile file = new File(fileImg);\n\n\t\t\t\t\t\t\t\t\t\t//Read text from file\n\t\t\t\t\t\t\t\t\t\tfinal StringBuilder text = new StringBuilder();\n\t\t\t\t\t\t\t\t\t\tFileInputStream fis = null;\n\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tfis = new FileInputStream(file);\n\t\t\t\t\t\t\t\t\t\t\tbyte[] buffer = new byte[1024];\n\t\t\t\t\t\t\t\t\t\t\twhile (fis.read(buffer) != -1) {\n\t\t\t\t\t\t\t\t\t\t\t\ttext.append(new String(buffer));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t Log.d(\"DEBUG_D\", text.toString());\n\t\t\t\t\t\t\t\t\t\t getActivity().runOnUiThread(new Runnable(){\n\n\t\t\t\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\t\t\t\t\t webView.loadData(text.toString(), \"text/html; charset=UTF-8\", null);\n\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}catch(Exception ex)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tex.printStackTrace();\n\t\t\t\t\t\t\t\t\t\t}finally{\n\t\t\t\t\t\t\t\t\t\t\tif (fis != null)\n\t\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfis.close();\n\t\t\t\t\t\t\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}*/\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t}", "public void runInExecutor() {\n this.executor.execute(this.callback);\n }", "@Override\n public void run() {\n MotionEyeHelper helper = new MotionEyeHelper();\n helper.setUsername(device.getUser().getUsername());\n try {\n helper.setPasswordHash(device.getUser().getPassword());\n } catch (NoSuchAlgorithmException e) {\n e.printStackTrace();\n }\n\n String cameraId = camera.getId();\n String serverurl;\n if (device.getDdnsURL().length() > 5) {\n if ((Utils.getNetworkType(mContext)) == NETWORK_MOBILE) {\n serverurl = device.getDDNSUrlCombo();\n } else if (device.getWlan().networkId == Utils.getCurrentWifiNetworkId(mContext)) {\n serverurl = device.getDeviceUrlCombo();\n\n } else {\n serverurl = device.getDDNSUrlCombo();\n\n }\n } else {\n serverurl = device.getDeviceUrlCombo();\n\n }\n String baseurl;\n if (!serverurl.contains(\"://\"))\n baseurl = removeSlash(\"http://\" + serverurl);\n else\n baseurl = removeSlash(serverurl);\n\n String url = baseurl + \"/picture/\" + cameraId + \"/current?_=\" + new Date().getTime();\n url = helper.addAuthParams(\"GET\", url, \"\");\n String finalUrl = url;\n\n new DownloadImageFromInternet(holder, camera, this, time, loaded).execute(finalUrl);\n\n\n }", "@Override \n public void run() {\n\t\tString path = Urls.URL_32;\n\t\t\n\t\tMap<String, String> map = new HashMap<String, String>();\n\t\tmap.put(\"login-name-or-mobile\", username);\n\t\tmap.put(\"pwd\", password);\n\t \tList<BasicNameValuePair> params = HttpUtils.setParams(map);\n\t \t\n\t\tMap<String, String> map2 = new HashMap<String, String>();\n\t \tmap2.put(\"Accept-Encoding\", \"gzip, deflate\");\n\t \tmap2.put(\"Accept\", \"application/json\");\n\n\t \tMap<String,String> info = new HashMap<String,String>();\n\t\tString jsonStr = \"\";\n\t\ttry {\n\t\t\tjsonStr = RequestService.getInstance().getRequest(params, path, map2);\n\t\t\t\n\t\t\tif(jsonStr==null || \"null\".equals(jsonStr) || \"\".equals(jsonStr)){\n\t\t\t\tinfo.put(\"available\", \"0\");\n\t\t\t}else{\n\t\t\t\tHttpUtils.parseJson(jsonStr, info, null);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tMessage msg = new Message(); \n\t msg.what = Constants.NETWORK_ERROR;\n\t handler.sendMessage(msg); \n\t return;\n\t\t}\n\t\t\n Message msg = new Message(); \n msg.obj = info;\n msg.what = Constants.GET_BALANCE_SUCCESS;\n handler.sendMessage(msg); \n }", "@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tthis.setContentView(R.layout.activity_httpclient);\r\n\t\ttv = (TextView) this.findViewById(R.id.tv_httpclient);\r\n\t\thandler = new MyHandler(tv, this);\r\n\t\ttestLocalIpAndMac();\r\n\t\tnew Thread(new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\tString response = HttpHelper.doGet(myWebPageUrl);\r\n\t\t\t\tLog.i(getClass().getSimpleName(), \"response = \" + response);\r\n\t\t\t\tMessage msg = new Message();\r\n\t\t\t\tmsg.what = 0x001;\r\n\t\t\t\tmsg.obj = response;\r\n\t\t\t\thandler.sendMessage(msg);\r\n\t\t\t}\r\n\t\t})\r\n\t\t.start();\r\n\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tif(e.getMessage()!=null) Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tif(e.getMessage()!=null) Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "public void run()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mAPICallManager.getTasksCount()==0) showActionBarProgress(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// toast\n\t\t\t\t\t\t\tif(e.getMessage()!=null) Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}", "@Override\n protected String doInBackground(Object... perams) {\n urll = perams[0].toString();//perams is an array of the vribles or things passed\n //place for html to go within scope of doinbackground\n String html2 = \"\";// html2 will have the html code filled within it\n String htmlt;\n try {\n InputStreamReader haha = new InputStreamReader(((URL) perams[0]).openStream());//input stream reader takes in an input stream!\n BufferedReader read = new BufferedReader(haha);// put the IO stream into the buffer for conversion from bytes to chars\n while ((htmlt = read.readLine()) != null) {\n if (isCancelled()) {\n html2 = \"\";\n break;\n }\n html2 = html2 + htmlt;\n }\n read.close();//closes the buffered stream\n urlandstring urlstr = new urlandstring(urll, html2);//creates a new urlandstringobject\n Message msg = Message.obtain();//creates and saves a new message instance\n msg.obj = urlstr;//puts the html variable into an object within the message\n msg.setTarget((Handler) perams[1]);//sets target to basic handler\n msg.sendToTarget(); //sends to target\n return html2;\n } catch (IOException e) {\n e.printStackTrace();\n // toast.toastpush(\"1\",urll);\n // Toast err= Toast.makeText(getApplicationContext(),\"ERROR cant open IO stream\",Toast.LENGTH_SHORT);//error message for if the io stream does not work\n // err.show();\n // Looper.loop();//for the correct implementation of thread message handling!\n return \"nope\";\n }\n }", "@Override\n protected AccGitHuber doInBackground(Void... voids) {\n return executeRequest();\n }", "public void run(){\n //logic to execute in a thread \n }", "@Override\n protected void onPostExecute(Void result) {\n startViewPagerThread();\n\n }", "@Override\n\t\tpublic void run() {\n\t\t\t\n\t\t\tSharedPreferences sharedPreferences = getSharedPreferences(\"LOGIN\", 0);\n\t\t\tid = sharedPreferences.getString(\"id\", \"\");\n\t\t\tString path = null;\n\t\t\tif(loc_flag.equals(\"1\")){\n\t\t\t\t path = \"http://2naive.cn/\";\n\t\t\t}\n\t\t\tif(loc_flag.equals(\"2\")){\n\t\t\t\tpath = App.address + \"CUpdateLoc.php?id=\"+id+\"&setLong=\"+long_t+\"&setLat=\"+lat_t;\n\t\t\t}\n\t\t\tfinal Editor editor = sharedPreferences.edit();\n\t\t\tHttpUtils http = new HttpUtils(3000);//10s超时\n\t\t\thttp.configCurrentHttpCacheExpiry(300); // 设置缓存5秒,5秒内直接返回上次成功请求的结果。\n\t\t\twhile (flag) {\n\t\t\t\t http.send(HttpMethod.GET, path,new RequestCallBack<String>() {\n\t\t\t\t @Override \n\t\t\t\t public void onFailure(HttpException arg0, String arg1) { \n\t\t\t\t //联网失败\n\t\t\t\t\t // Toast.makeText(getBaseContext(), \"\"+lon+\"---\"+lat, Toast.LENGTH_LONG).show();\n\t\t\t\t\t editor.putString(\"conn\", \"0\");\n\t\t\t\t }\t \n\t\t\t\t @Override \n\t\t\t\t public void onSuccess(ResponseInfo<String> arg0) { \n\t\t\t\t\t //联网成功\n\t\t\t\t\t editor.putString(\"conn\", \"1\");\n\t\t\t\t }\n\t\t\t\t});\n\t\t\t\teditor.commit();\n\t\t\t\tMessage message = new Message();\n\t\t\t\tmessage.what = 2;\n\t\t\t\tupdateUI.sendMessage(message);\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\tThread.sleep(3*1000); //暂定延时3s\n\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\t\t\tThread.interrupted();\n\t\t}", "@SuppressLint(\"SetJavaScriptEnabled\")\n @Override\n public void run() {\n\n if (progressDialog.isShowing()){\n progressDialog.dismiss();\n\n Log.v(\"Check UrlArraylist\", String.valueOf(AsyncUrl.url_arrayList.size()));\n Log.v(\"Check NameArraylist\", String.valueOf(AsyncUrl.name_arrayList.size()));\n\n for (int i = 0;i<AsyncUrl.url_arrayList.size();i++){\n\n String file_Url = String.valueOf(AsyncUrl.url_arrayList.get(i));\n final String fileType = file_Url.substring(file_Url.lastIndexOf(\".\") + 1);\n String file_Name = String.valueOf(AsyncUrl.name_arrayList.get(i));\n\n if (fileType.equals(\"pdf\")){\n\n String firstWord = file_Name.substring(0,1);\n Log.d(\"QBank \",firstWord);\n\n if (firstWord.equals(\"#\")){\n\n qBankWebView.setWebViewClient(new MyWebViewClient());\n qBankWebView.getSettings().setJavaScriptEnabled(true);\n qBankWebView.loadUrl(\"http://docs.google.com/gview?embedded=true&url=\"+file_Url);\n qBankWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);\n\n Log.v(\"Check NameArraylist\",file_Url);\n\n }\n }\n }\n }\n\n }", "public void run() \r\n\t\t{\n\r\n\t\t\tMyNameValuePair NameValuePair1 = new MyNameValuePair(\"app\", \"api\");\r\n\t\t\tMyNameValuePair NameValuePair2 = new MyNameValuePair(\"mod\",\r\n\t\t\t\t\t\"Notifytion\");\r\n\t\t\tMyNameValuePair NameValuePair3 = new MyNameValuePair(\"act\",\r\n\t\t\t\t\t\"get_notify_by_count\");\r\n\t\t\tMyNameValuePair NameValuePair4 = new MyNameValuePair(\"oauth_token\",\r\n\t\t\t\t\tac.getOauth_token());\r\n\t\t\tMyNameValuePair NameValuePair5 = new MyNameValuePair(\r\n\t\t\t\t\t\"oauth_token_secret\", ac.getOauth_token_secret());\r\n\r\n\t\t\tString result = MHttpClient.post(ThinkSNSApplication.baseUrl,\r\n\t\t\t\t\tNameValuePair1, NameValuePair2, NameValuePair3,\r\n\t\t\t\t\tNameValuePair4, NameValuePair5);\r\n\t\t\tSystem.out.println(\"GetNotifyThread结果:\" + result);\r\n\r\n\t\t\tinfos = format(result);\r\n\t\t\t\r\n\t\t}", "@Override\n\t\tpublic void run() {\n\t\t\ttry {\n\t\t\t\tProxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(\n\t\t\t\t\t\t\"proxy.iiit.ac.in\", 8080));\n\t\t\t\tURL url = new URL(url1);\n\t\t\t\tHttpURLConnection connection = (HttpURLConnection) url\n\t\t\t\t\t\t.openConnection(proxy);\n\t\t\t\tconnection.setRequestMethod(\"POST\");\n\t\t\t\t// connection.setRequestProperty(\"Content-Type\",\n\t\t\t\t// \"application/x-www-form-urlencoded\");\n\n\t\t\t\tconnection.setRequestProperty(\"Content-Length\",\n\t\t\t\t\t\t\"\" + Integer.toString(parameters.getBytes().length));\n\t\t\t\tconnection.setRequestProperty(\"Content-Language\", \"en-US\");\n\n\t\t\t\tconnection.setUseCaches(false);\n\t\t\t\tconnection.setDoInput(true);\n\t\t\t\tconnection.setDoOutput(true);\n\n\t\t\t\t// Send request\n\t\t\t\tDataOutputStream wr = new DataOutputStream(\n\t\t\t\t\t\tconnection.getOutputStream());\n\t\t\t\twr.writeBytes(parameters);\n\t\t\t\twr.flush();\n\t\t\t\twr.close();\n\n\t\t\t\t// Get Response\n\t\t\t\tInputStream is = connection.getInputStream();\n\t\t\t\tBufferedReader rd = new BufferedReader(\n\t\t\t\t\t\tnew InputStreamReader(is));\n\t\t\t\tString line;\n\t\t\t\tStringBuffer response = new StringBuffer();\n\t\t\t\twhile ((line = rd.readLine()) != null) {\n\t\t\t\t\tresponse.append(line);\n\t\t\t\t\tresponse.append('\\r');\n\t\t\t\t}\n\t\t\t\trd.close();\n\t\t\t\t// return response.toString();\n\t\t\t\tlong tID = Thread.currentThread().getId();\n\t\t\t\tlong time = ManagementFactory.getThreadMXBean()\n\t\t\t\t\t\t.getThreadCpuTime(tID);\n\t\t\t\tSystem.out.println(\"My thread \" + tID + \" execution time: \"\n\t\t\t\t\t\t+ time + \" ns.\");\n\t\t\t\tsumTimes=sumTimes+time;\n\t\t\t\tconnection.disconnect();\n\t\t\t} catch (Exception e) {\n\n\t\t\t\te.printStackTrace();\n\t\t\t\t// return null;\n\n\t\t\t} finally {\n\n\t\t\t}\n\t\t}", "public void run() {\n\t\t\t\t\tMessage msg;\n\t\t\t\t\tVector<File> files = new Vector<File>();\n\t\t\t\t\tfiles.add(new File(fileName));\n\t\t\t\t\tString result = upload(url, formParameters, files);\n\t\t\t\t\tif (StringUtils.isEmpty(result)) {\n\t\t\t\t\t\tmsg = handler.obtainMessage(Constant.UPLOAD_FAIL_CODE, Constant.UPLOAD_EXCEPTION);\n\t\t\t\t\t\thandler.sendMessage(msg);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tLog.i(TAG, result);\n\t\t\t\t\t\tmsg = handler.obtainMessage(messageWhat, result);\n\t\t\t\t\t\thandler.sendMessage(msg);\n\t\t\t\t\t}\n\n\t\t\t\t}", "public void runOnUiThread(Runnable action) {\n h.post(action);\n }", "public void run() {\n subredditApiRequest = new SubredditApiRequest(SubredditListViewFragment.this);\n subredditApiRequest.execute(subreddit);\n }", "public void sendMessage(View view) {\n new HttpRequestTask().execute();\n }", "public void run() {\n\t\t\t\tHttpURLConnection connection = null;\r\n\r\n\t\t\t\tPrintWriter printWriter = null;\r\n\t\t\t\tBufferedReader bufferedReader = null;\r\n\r\n\t\t\t\tStringBuffer response = new StringBuffer();\r\n\t\t\t\tStringBuffer request = new StringBuffer();\r\n\r\n\t\t\t\t// 组织请求参数\r\n\t\t\t\tif (null != params && !params.isEmpty()){\r\n\t\t\t\t\tfor (Map.Entry<String, String> entry : params.entrySet()){\r\n\t\t\t\t\t\trequest.append(entry.getKey()).append(\"=\").append(entry.getValue()).append(\"&\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//< 删除多余的&\r\n\t\t\t\t\trequest.deleteCharAt(request.length() - 1);\r\n\t\t\t\t}\r\n\t\t\t\tLog.d(\"HttpUtil\", request.toString());\r\n\r\n\t\t\t\ttry{\r\n\t\t\t\t\tURL url = new URL(address);\r\n\t\t\t\t\tconnection = (HttpURLConnection) url.openConnection();\r\n\t\t\t\t\tconnection.setRequestMethod(\"POST\");\r\n\t\t\t\t\tconnection.setRequestProperty(\"Content-Length\", String.valueOf(request.length()));\r\n\t\t\t\t\tconnection.setDoInput(true);\r\n\t\t\t\t\tconnection.setDoOutput(true);\r\n\t\t\t\t\tprintWriter = new PrintWriter(connection.getOutputStream());\r\n\t\t\t\t\tprintWriter.write(request.toString());\r\n\t\t\t\t\tprintWriter.flush();\r\n\r\n\t\t\t\t\tint responseCode = connection.getResponseCode();\r\n\t\t\t\t\tif(responseCode != 200){\r\n\t\t\t\t\t\tLog.d(\"HttpUtil\", \"Post Fail\");\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tLog.d(\"HttpUtil\", \"Post Success\");\r\n\t\t\t\t\t\tbufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));\r\n\t\t\t\t\t\tString line;\r\n\t\t\t\t\t\twhile ((line = bufferedReader.readLine()) != null) {\r\n\t\t\t\t\t\t\tresponse.append(line);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(listener != null){\r\n\t\t\t\t\t\tlistener.onFinish(response.toString());\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}catch(Exception e){\r\n\t\t\t\t\tif(listener != null){\r\n\t\t\t\t\t\tlistener.onError(e);\r\n\t\t\t\t\t}\r\n\t\t\t\t}finally{\r\n\t\t\t\t\tif(connection != null){\r\n\t\t\t\t\t\tconnection.disconnect();\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tif (printWriter != null) {\r\n\t\t\t\t\t\t\tprintWriter.close();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (bufferedReader != null) {\r\n\t\t\t\t\t\t\tbufferedReader.close();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} catch (IOException ex) {\r\n\t\t\t\t\t\tex.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}", "@Override\n\t\tpublic void run() {\n\t\t\ttry {\n\t\t\t\tURL url = new URL(\n\t\t\t\t\t\tnew UriFactory().getHeadPortraitUrl());\n\t\t\t\tconnection = (HttpURLConnection) url.openConnection();\n\t\t\t\tconnection.setRequestMethod(\"POST\");\n\t\t\t\tconnection.setConnectTimeout(8000);\n\t\t\t\tconnection.setReadTimeout(8000);\n\t\t\t\tconnection.setDoOutput(true);\n\t\t\t\tconnection.setDoInput(true);\n\t\t\t\tInputStream in = connection.getInputStream();\n\t\t\t\treader = new BufferedReader(new InputStreamReader(in));\n\t\t\t\tresponse = new StringBuilder();\n\t\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\t\tresponse.append(line);\n\t\t\t\t}\n\t\t\t\tString msg = JSONAnalysis(response.toString().trim());\n\t\t\t\tSystem.out.println(\"=======================\" + msg);\n\t\t\t\tUserDao user = new UserDao(context);\n\t\t\t\tString imgutl = user.detailImgUrl();\n\t\t\t\tString imageurl = msg + imgutl;\n\t\t\t\tSystem.out.println(imageurl);\n\t\t\t\tMessage message = new Message();\n\t\t\t\tBundle data = new Bundle();\n\t\t\t\tdata.putString(\"imgurl\", imageurl);\n\t\t\t\tmessage.what = 1;\n\t\t\t\tmessage.setData(data);\n\t\t\t\thandler1.sendMessage(message);\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t} finally {\n\t\t\t\tif (reader != null) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treader.close();\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (connection != null) {\n\t\t\t\t\tconnection.disconnect();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "@Override\r\n\tprotected void onPostExecute(String result) {\r\n\t\tif (result.contains(\"http\")) {\r\n\t\t\tmyWebView.setWebViewClient(new WebViewClient());\r\n\t\t\tmyWebView.clearCache(true);\r\n\t\t\tmyWebView.getSettings().setJavaScriptEnabled(true);\r\n\t\t\tmyWebView.loadUrl(result);\r\n\t\t\t((FlickrLoginDialog) dialogFragment).updateFlickr(flickr, frob);\r\n\t\t}\r\n\r\n\t}", "public void run() {\n\t\tHtmlPage page = null;\n\t\tHtmlSelect select = null;\n\t\tHtmlOption option = null;\n\t\tDataStreamWriter connection = null;\n\t\tWebClient client = new WebClient(BrowserVersion.FIREFOX_3);\n\t\t/* eseguo i job assegnati al thread in esecuzione */\n\t\tfor(int j = 0; j < this.jobs.length; j++) {\n\t\t\tint currentJob = this.jobs[j];\n\t\t\ttry {\n\t\t\t\t/* faccio dei tentativi per collegarmi alle pagine */\n\t\t\t\tpage = getPage(client, this.getDataSourceURL());\n\t\t\t\t/* seleziono l'opzione relativa alla regione assegnata al task */\n\t\t\t\tselect = (HtmlSelect) page.getByXPath(\"//select\").get(0);\n\t\t\t\toption = select.getOption(currentJob);\n\t\t\t\toption.setSelected(true);\n\t\t\t\tString regione = option.asText();\n\t\t\t\t/* seleziono l'opzione ed ottengo la pagina aggiornata */\n\t\t\t\tpage = (HtmlPage) select.fireEvent(Event.TYPE_CHANGE).getNewPage();\n\t\t\t\t\n\t\t\t\t/* estraggo i dati e li salvo nello \"storage\" */\n\t\t\t\tconnection = this.storageFacade.getDataStreamWriter();\n\t\t\t\tconnection.openStreamWriter();\n\t\t\t\tthis.extractData(client, connection, page, regione);\n\t\t\t}\n\t\t\tcatch (HTMLCrawlerException e) {\n\t\t\t\tSystem.err.println(\"@ HTMLCrawlerException : Extracting Data Error\");\n\t\t\t\tSystem.err.println(e.getMessage());\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\t//client.closeAllWindows();\n\t\t\t\tif (connection != null)\n\t\t\t\t\tconnection.closeStreamWriter();\n\t\t\t}\n\t\t}\n\t\tclient.closeAllWindows();\n\t}", "public void run() {\n\t\t\t\t\t\tint success;\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t// Building Parameters\r\n\t\t\t\t\t\t\tString Name = \"TempSensor\";\r\n\t\t\t\t\t\t\tString Subscription = paramInput.getText().toString();\r\n\t\t\t\t\t\t\tList<NameValuePair> params = new ArrayList<NameValuePair>();\r\n\t\t\t\t\t\t\tparams.add(new BasicNameValuePair(TAG_NAME, Name));\r\n\t\t\t\t\t\t\tparams.add(new BasicNameValuePair(TAG_SUB, Subscription));\r\n\t\t\t\t\t\t\t// getting product details by making HTTP request\r\n\t\t\t\t\t\t\t// Note that product details url will use GET request\r\n\t\t\t\t\t\t\tJSONObject json = jsonParser.makeHttpRequest(\r\n\t\t\t\t\t\t\t\t\turl_update_sensor, \"GET\", params);\r\n\t\t\t\t\t\t\t// check your log for json response\r\n\t\t\t\t\t\t\tLog.d(\"Smart Home\",\"============sensor_update=================\");\r\n\t\t\t\t\t\t\tLog.d(\"Smart Home\", json.getString(TAG_MSG));\t\t\t\t\t\r\n\t\t\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}", "public void runCode(View view) {\n\n for(String songName:SongsPlaylist.songs)\n {\n /*\n Message.obtain(); it create a ThreadPool for message and if the message id already available in the pool it send\n its benefit is again and agian Message object is not created and destroyed ...means its increase the performance\n */\n Message message = Message.obtain();\n /*\n we can send data thu sendData method pass bundle but we need one string so we send the obj variable that Message class\n builtin\n */\n message.obj = songName;\n\n /*here we can access the handler object that is created in the DownloadThread or you can say the handler of the\n DownloadThread we using that handler i send the message in the MessageQueue of DownloadThread for executing*/\n downloadThread.handler.sendMessage(message);\n }\n }", "@Override\n\t\t\t\t\t\t public void run() {\n\t\t\t\t\t\t\t getResponse();\n\t\t\t\t\t\t }", "@Override\n protected String doInBackground(String... urls) {\n try {\n try {\n return httpPost(url);\n } catch (JSONException e) {\n e.printStackTrace();\n return \"Error!\";\n }\n } catch (IOException e) {\n return \"Unable to retrieve web page. URL may be invalid.\";\n }\n }", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\tJSONArray jsa=new JSONArray();\r\n\t\t\t\tJSONObject j=new JSONObject();\r\n\r\n\t\t\t\ttry {\r\n\t\t\t\t\tj.put(\"userID\", AppConfig.LoginUser.getUserid());\r\n\t\t\t\t\tj.put(\"key\", key);\r\n\t\t\t\t\tj.put(\"condition\", condition);\r\n\t\t\t\t\t \r\n\t\t\t\t} catch (JSONException e) {\r\n\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\tjsa.put(j);\r\n\t\t\t\tXtResultFactory xtFac=new XtResultFactory();\r\n\t\t\t\txtFac.setJsonStr(QufeiSocketClient.getInstance().send(\"Getyanshoudan\", jsa));\r\n\t\t\t\tjson=xtFac.createResult();\r\n\t\t\t\tif(json==null){\r\n\t\t\t\t\tmsg.what=0;\r\n\t\t\t\t\tmsg.sendToTarget();\r\n\t\t\t\t\treturn ;\r\n\t\t\t\t}\r\n\t\t\t\tjsonArrayStr=json.getJsonStr();\r\n\t\t\t\t\r\n\t\t\t\tif(jsonArrayStr==null){\r\n\t\t\t\t\tmsg.what=0;\r\n\t\t\t\t\tmsg.sendToTarget();\r\n\t\t\t\t}\r\n\t\t\t\tdata=xtFac.getMapList();\r\n\t\t\t\tif(data!=null){\r\n\t\t\t\t\tmsg.what=1;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tmsg.what=0;\r\n\t\t\t\t}\r\n\t\t\t\tmsg.sendToTarget();\r\n\r\n\t\t\t}", "@SuppressLint({\"HardwareIds\", \"SetJavaScriptEnabled\"})\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n global = (Global) getApplicationContext();\n this.setTitle(\"Cargando...\");\n android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);\n setContentView(R.layout.activity_web_view_ubu);\n\n if(savedInstanceState == null){\n url = Objects.requireNonNull(getIntent().getDataString()).replace(\"ubuassistant://\",\"\");\n }\n\n WebView myWebView = findViewById(R.id.webview);\n WebSettings webSettings = myWebView.getSettings();\n webSettings.setJavaScriptEnabled(true);\n myWebView.setWebViewClient(new WebViewClient() {\n @Override\n public void onPageFinished(WebView view, String url) {\n WebViewUBU.this.setTitle(view.getTitle());\n Log.w(\"Global\", global.getWords().get(0));\n }\n });\n myWebView.setDownloadListener(new DownloadListener() {\n @Override\n public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {\n Intent i = new Intent(Intent.ACTION_VIEW);\n i.setData(Uri.parse(url));\n startActivity(i);\n }\n });\n myWebView.loadUrl(url);\n\n Toolbar myToolbar = findViewById(R.id.my_toolbar);\n setSupportActionBar(myToolbar);\n Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);\n getSupportActionBar().setDisplayShowHomeEnabled(true);\n\n new logVisit().execute();\n\n }", "public void runGoogleDirectionsQuery(){\n if(directionsRequestUrl != null) {\n new Thread(new Runnable(){\n public void run(){\n //Establishes URLConnections, sends the request, and receives the response as a string\n String searchResultString = getUrlContents(directionsRequestUrl);\n try {\n //Turns the response to a JSON object\n JSONObject directionsResultJSON = new JSONObject(searchResultString);\n\n //Parses the JSON object\n JSONArray routesArray = directionsResultJSON.getJSONArray(\"routes\");\n JSONObject route = routesArray.getJSONObject(0);\n\n //Extract the encodedPolylineString\n JSONObject overviewPolylines = route.getJSONObject(\"overview_polyline\");\n polylineEncodedString = overviewPolylines.getString(\"points\");\n\n //Extract the optimized order of the waypoints\n if(route.has(\"waypoint_order\")) {\n //uses this new order to build the orderedDestinations ArrayList\n JSONArray waypoint_order = route.getJSONArray(\"waypoint_order\");\n int[] order = new int[waypoint_order.length()];\n for(int i = 0; i < waypoint_order.length(); i++){\n order[i] = (Integer)waypoint_order.get(i);\n }\n orderedDestinations = calculateOrderedDestinations(order);\n } else {\n orderedDestinations = destinations;\n }\n\n //Inform the message handler that the request was a success\n Message msg = Message.obtain();\n msg.what = 0;\n handler.sendMessage(msg);\n } catch (JSONException e) {\n //error, probably network related\n e.printStackTrace();\n //inform the message handler that the request was a failure\n Message msg = Message.obtain();\n msg.what = 1;\n handler.sendMessage(msg);\n }\n }\n }).start();\n }\n }", "@Override\n\tpublic void run() {\n\t\ttry {\n\n\n\t\t\tBitmap result = ImageService.getImage(ac,urlparams);\n\t\t\tLog.i(\"tan8\",\"url\"+urlparams);\n\t\t\tMessage ms = Message.obtain();\n\t\t\tms.what = what;\n\t\t\tms.obj = result;\n\t\t\tif (handler != null) {\n\t\t\t\thandler.sendMessage(ms);\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "String execute(HttpServletRequest request);", "public void run() {\n try {\n System.out.println(\"Calling Process\");\n processRequest();\n\n } catch (Exception e) {\n System.out.println(\"Run Exception\" + e);\n }\n\n }", "private void runOnMainThread(Runnable task)\n {\n if (Thread.currentThread() == mHandler.getLooper().getThread())\n task.run();\n else\n mHandler.post(task);\n }", "protected void doInBackground(final Runnable runnable) {\n new AsyncTask() {\n @Override\n protected Object doInBackground(Object[] params) {\n runnable.run();\n return null;\n }\n }.execute(null, null, null);\n }", "@Override\r\n\t\tpublic void run() {\n\t\t\tString httpresponse = new String();\r\n\t\t\t// for (int i = 0; i < 10; i++) {\r\n\t\t\thttpresponse = HTTPGetInfo();\r\n\t\t\ttry {\r\n\t\t\t\tJSONparser(httpresponse);\r\n\t\t\t} catch (JSONException e) {\r\n\t\t\t\t// TODO 自动生成的 catch 块\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}", "public void run() \r\n\t\t{\n\t\t\tMyNameValuePair NameValuePair1 = new MyNameValuePair(\"app\", \"api\");\r\n\t\t\tMyNameValuePair NameValuePair2 = new MyNameValuePair(\"mod\",\r\n\t\t\t\t\t\"Notifytion\");\r\n\t\t\tMyNameValuePair NameValuePair3 = new MyNameValuePair(\"act\",\r\n\t\t\t\t\t\"set_notify_read\");\r\n\t\t\tMyNameValuePair NameValuePair4 = new MyNameValuePair(\"oauth_token\",\r\n\t\t\t\t\tac.getOauth_token());\r\n\t\t\tMyNameValuePair NameValuePair5 = new MyNameValuePair(\r\n\t\t\t\t\t\"oauth_token_secret\", ac.getOauth_token_secret());\r\n\t\t\tMyNameValuePair NameValuePair6 = new MyNameValuePair(\r\n\t\t\t\t\t\"type\", type);\r\n\r\n\t\t\tString result = MHttpClient.post(ThinkSNSApplication.baseUrl,\r\n\t\t\t\t\tNameValuePair1, NameValuePair2, NameValuePair3,\r\n\t\t\t\t\tNameValuePair4, NameValuePair5, NameValuePair6);\r\n\t\t\tSystem.out.println(\"SetNotifyReadThread结果:\" + result);\r\n\t\t}", "@Override\r\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\tToast.makeText(context, \"下载成功\", Toast.LENGTH_SHORT).show();\r\n\t\t\t\t\t\t\t}", "@Override\n\t\tprotected String doInBackground(Void... arg0) {\n\t\t\t\n\t\t\ttry {\n\t\t\t\t\n\t\t\t//\tif (handler != null){\n\t\t //\t\thandler.removeCallbacks(runnable);\n\t\t //\t}\n\t\t\t\t\n\t\t\t\t//handler.postDelayed(runnable, 5000);\n\t\t\t\t\n\t\t\t\t//Log.v(\"upl\", \"ok\");\n\t\t\t\t\n\t\t\t\tupload_data();\n\t\t\t\t//download_data();\n\t\t\t\t\n\t\t\t} catch (Exception e) {\n\t\t\t\t// TODO: handle exception\n\t\t\t\tLog.v(\"error upl noo\", e.toString());\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\treturn null;\n\t\t}", "@Override\r\n public void onSuccess(RestRequest request, RestResponse result) {\n result.consumeQuietly();\r\n runOnUiThread(new Runnable() {\r\n\r\n @Override\r\n public void run() {\r\n // Network component doesn’t report app layer status.\r\n // Use the Mobile SDK RestResponse.isSuccess() method to check\r\n // whether the REST request itself succeeded.\r\n\r\n try {\r\n\r\n Log.d(\"APITest\", \"success entered\");\r\n\r\n }\r\n catch (Exception e) {\r\n //showError(MainActivity.this, e);\r\n }\r\n\r\n }\r\n });\r\n\r\n }", "@Override\n public void run() {\n MainActivity.webView.loadUrl(\"https://www.facebook.com/\" + id);\n }", "public void run() {\n handler.post(new Runnable() {\r\n public void run() {\r\n // Toast.makeText(getApplicationContext(), \"driver view refresh\", Toast.LENGTH_SHORT).show();\r\n \t\t\r\n\t\t\tarraylist_destination.clear();\r\n\t\t\tarraylist_driverid.clear();\r\n\t\t\tarraylist_riderid.clear();\r\n\t\t\tarraylist_drivername.clear();\r\n\t\t\tarraylist_pickuptime.clear();\r\n\t\t\tarraylist_tripid.clear();\r\n\t\t\tarraylist_driver_image.clear();\r\n\t\t\tarraylist_rider_image.clear();\r\n\t\t\tarraylist_distance.clear();\r\n\t\t\tarraylist_requesttype.clear();\r\n\t\t\tarraylist_start.clear();\r\n\t\t\tarraylist_actualfare.clear();\r\n\t\t\tarraylist_suggestion.clear();\r\n\t\t\tarraylist_eta.clear();\r\n\t\t\tarraylist_driverrating.clear();\r\n\t\t\tarraylist_status.clear();\r\n\t\t\tarraylist_vehicle_color.clear();\r\n\t\t\tarraylist_vehicle_type.clear();\r\n\t\t\tarraylist_vehicle_name.clear();\r\n\t\t\tarraylist_vehicle_img.clear();\r\n\t\t\tarraylist_vehicle_year.clear();\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif(Utility.isConnectingToInternet(RiderQueue_Activity.this))\r\n \t \t{\r\n \t\t\t\t/**call pending request for rider queue class**/\r\n\t\t\t\tnew httpPendingRequest_riderqueue().execute(); \r\n \t \t\t}\r\n \t \telse{\r\n \t \t\tUtility.alertMessage(RiderQueue_Activity.this,\"error in internet connection\");\r\n \t \t}\r\n\t\t \r\n }\r\n });\r\n }", "public void run() {\n progressDialog.dismiss();\n insertUser();\n //userLogin();\n // onLoginSuccess();\n // onLoginFailed();\n\n }", "@Override\n protected Void doInBackground(String ... params) {\n HttpClient httpclient = new DefaultHttpClient();\n\n HttpPost httppost_ac_wemo_on;\n httppost_ac_wemo_on = new HttpPost(url_ac_wemo_on);\n\n\n try {\n\n // Execute HTTP Post Request\n HttpResponse response_1 = httpclient.execute(httppost_ac_wemo_on);\n\n// HttpResponse response_7 = httpclient.execute(httppost);\n// HttpResponse response_8 = httpclient.execute(httppost);\n// HttpResponse response_9 = httpclient.execute(httppost);\n } catch (ClientProtocolException e) {\n // TODO Auto-generated catch block\n Log.e(\"salim\",e.getMessage().toString());\n } catch (IOException e) {\n // TODO Auto-generated catch block\n Log.e(\"salim\",e.getMessage().toString());\n\n }\n\n return null;\n }", "@Override\n public void run() {\n\n URL url = null;\n try {\n url = new URL(\"https://httpbin.org/basic-auth/bob/sympa\");\n HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();\n // adding auth headers\n String userAndPassword = txtLogin+\":\"+txtPass; // text values from text fields\n// Log.i(\"USR\", txtLogin);\n// Log.i(\"PWD\", txtPass);\n String basicAuth = \"Basic \"+ Base64.encodeToString(userAndPassword.getBytes(), Base64.NO_WRAP);\n urlConnection.setRequestProperty(\"Authorization\", basicAuth);\n\n try {\n // read the returned HTML\n InputStream in = new BufferedInputStream(urlConnection.getInputStream());\n String s = readStream(in);\n Log.i(\"JFL\", s);\n\n jsonObject = new JSONObject(s); // storing the returned html in JSON form for easy access\n\n boolean res = jsonObject.getBoolean(\"authenticated\");\n// String usr = jsonObject.getString(\"user\");\n runOnUiThread(new Runnable() { // safe way to access the UI thread\n @Override\n public void run() {\n result.setText(\"\"+res);\n }\n });\n\n } catch (JSONException e) {\n e.printStackTrace();\n } finally {\n urlConnection.disconnect();\n }\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }", "private void startLoad() {\n\t\tif (getIntent().getFlags()==8)\n\t\t{\n\t\t\ttitleTv.setText(R.string.WXYT);\n\t\tmWebView.loadUrl(UrlLib.CLI);\n\t\t}\n\t\telse if (getIntent().getFlags()==5)\n\t\t{\n\t\t\ttitleTv.setText(R.string.reservior); \n\t\t\tmWebView.loadUrl(UrlLib.CLI5);\t\n\t\t}\t\n\t\t\n\t\tmWebView.setWebViewClient(new WebViewClient() {\n\n\t\t\t/*\n\t\t\t * (non-Javadoc)\n\t\t\t * \n\t\t\t * @see\n\t\t\t * android.webkit.WebViewClient#shouldOverrideUrlLoading(android\n\t\t\t * .webkit.WebView, java.lang.String)\n\t\t\t */\n\n\t\t\t@Override\n\t\t\tpublic boolean shouldOverrideUrlLoading(WebView view, String url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tview.loadUrl(url);\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * (non-Javadoc)\n\t\t\t * \n\t\t\t * @see\n\t\t\t * android.webkit.WebViewClient#onPageFinished(android.webkit.WebView\n\t\t\t * , java.lang.String)\n\t\t\t */\n\t\t\t@Override\n\t\t\tpublic void onPageFinished(WebView view, String url) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onPageFinished(view, url);\n\t\t\t}\n\t\t});\n\n\t\tmWebView.setWebChromeClient(new WebChromeClient() {\n\t\t\t@Override\n\t\t\tpublic void onProgressChanged(WebView view, int newProgress) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tsuper.onProgressChanged(view, newProgress);\n\t\t\t\tprogressBar.setProgress(newProgress);\n\t\t\t\tprogressBar.postInvalidate();\n\t\t\t\tif(newProgress==100)\n\t\t\t\t\tprogressBar.setVisibility(View.GONE);\n\n\t\t\t}\n\t\t});\n\n\t}" ]
[ "0.6207678", "0.60077846", "0.59308904", "0.58774406", "0.5766813", "0.57402056", "0.5672674", "0.56531715", "0.5601248", "0.55675656", "0.5557401", "0.5545228", "0.55291843", "0.55174094", "0.5515025", "0.55144507", "0.55143154", "0.5507303", "0.5495489", "0.5490408", "0.54767036", "0.54582953", "0.54536796", "0.54521585", "0.5441777", "0.5438736", "0.54295564", "0.54191995", "0.5384331", "0.53775316", "0.537149", "0.5349933", "0.5346116", "0.5344973", "0.5326128", "0.5310236", "0.53101015", "0.5305077", "0.5288576", "0.5279058", "0.5249286", "0.5249286", "0.5249286", "0.5249286", "0.5249286", "0.5249286", "0.5249286", "0.5249286", "0.5249286", "0.5246609", "0.5235408", "0.5226623", "0.52180076", "0.5203034", "0.51966405", "0.5195941", "0.5195429", "0.5193153", "0.5191349", "0.518885", "0.518885", "0.518885", "0.51844263", "0.51667196", "0.5162113", "0.5158471", "0.51578844", "0.515534", "0.5151365", "0.51454777", "0.51368713", "0.5135226", "0.5130355", "0.51233613", "0.51132524", "0.509468", "0.5086647", "0.50689393", "0.50678056", "0.50593126", "0.5059012", "0.50579375", "0.5047391", "0.50333863", "0.50287986", "0.5022708", "0.5017993", "0.5014155", "0.5002708", "0.50023174", "0.49952257", "0.49949172", "0.499027", "0.4989191", "0.49886227", "0.4980902", "0.49807948", "0.49754354", "0.49721986", "0.4964247", "0.4961322" ]
0.0
-1
Starts an intent to scan and decode a barcode.
public void scan() { Intent intentScan = new Intent(SCAN_INTENT); intentScan.addCategory(Intent.CATEGORY_DEFAULT); // avoid calling other phonegap apps intentScan.setPackage(this.cordova.getActivity().getApplicationContext().getPackageName()); this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void openScanner(){\n Intent intent = new Intent(ReturningTaskActivity.this, BarcodeScannerActivity.class);\n startActivityForResult(intent, 0);\n }", "private void initiateBarcodeScan(Activity activity) {\n IntentIntegrator zxingIntegrator = new IntentIntegrator(activity);\n zxingIntegrator.initiateScan();\n }", "@Override\n public void onClick(View v) {\n IntentIntegrator integ = IntentIntegrator.forSupportFragment(search_Fragement.this);\n integ.setCaptureActivity(CaptureAct.class);\n integ.setOrientationLocked(false);\n integ.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);\n integ.setPrompt(\"scanning code..\");\n integ.initiateScan();\n\n\n }", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\t\n\t // Make sure the request was successful\n\t if (resultCode == RESULT_OK) {\n\t Bundle resultBundle = data.getExtras();\n\t String decodedData = resultBundle.getString(\"DATA_RESULT\");\n\t String scanAction = resultBundle.getString(\"SCAN_ACTION\");\n\t\t \n\t\t if(scanAction != null && scanAction.equalsIgnoreCase(SCAN_TYPE)){\n\t\t\t // With the decoded data use session.get entity etc... then call server to get entity info\n\t\t\t try{\n\t\t\t\t processData(decodedData);\n\t\t\t }catch(Exception e){\n\t\t\t\t Toast.makeText(this, \"Unknown barcode format: please scan a valid barcode\", Toast.LENGTH_LONG).show();\n\t\t\t\t launchScanner(SCAN_TYPE);\n\t\t\t }\n\t\t\t \n\t\t }else{\n\t\t\t Toast.makeText(this, \"NO SCANNING ACTION\", Toast.LENGTH_LONG).show();\n\t\t\t launchScanner(SCAN_TYPE);\n\t\t }\n\t\t \n\t }else{\n\t\t finish();\t\t \n\t }\t \n\t}", "public void GoToScanbarcode(View view) {\n\n Intent intent = new Intent(HomeActivity.this, OpenScanner.class);\n intent.putExtra(\"Purpose\", mPurpose);\n Local.Set(getApplicationContext(), \"Purpose\", mPurpose);\n finish();\n\n startActivity(intent);\n }", "@Override\n public void run() {\n String scanNumText = result.getText();\n Toast.makeText(ItemScan.this, scanNumText, Toast.LENGTH_SHORT).show();\n Intent intent = getIntent();\n intent.putExtra(\"Barcode\", scanNumText);\n setResult(Activity.RESULT_OK, getIntent());\n finish();\n }", "public void on_code_read(String result){\n Intent intent = new Intent(ScanActivity.this, TargetActivity.class);\n intent.putExtra(\"result\", result);\n startActivity(intent);\n }", "private void scanCard() {\n\n Intent intent = new ScanCardIntent.Builder(getActivity()).build();\n startActivityForResult(intent, Constant.REQUEST_CODE_SCAN_CARD);\n }", "public void scanBarcode(View v) {\n Intent intent=new Intent(this, ScanBarcodeActivity.class);\n startActivityForResult(intent,0);\n }", "public void onActivityResult(int requestCode, int resultCode, Intent intent) {\n if (requestCode == 0) {\n if (resultCode == RESULT_OK) {\n Intent scanResult = new Intent(getBaseContext(), OutdoorYouHere.class);\n String contents = intent.getStringExtra(\"SCAN_RESULT\");\n //scanResult.putExtra(\"FLOOR_NUMBER\", floorNumber);\n //scanResult.putExtra(\"ROOM_NUMBER\", roomNumber);\n scanResult.putExtra(\"QR_SCAN\", contents);\n startActivity(scanResult);\n\n } else if (resultCode == RESULT_CANCELED) {\n // Handle cancel\n }\n }\n }", "private View.OnClickListener onScanBarcodeButtonClick() {\n return new View.OnClickListener() {\n\n @Override\n public void onClick(View v) {\n try {\n final Intent intent = new Intent(OnYard.ZXING_SCAN_ACTION);\n intent.putExtra(\"SCAN_MODE\", \"ONE_D_MODE\");\n getParentFragment().startActivityForResult(intent, SCAN_BARCODE_REQUEST_CODE);\n }\n catch (final Exception e) {\n showScanErrorDialog();\n logError(e);\n }\n }\n };\n }", "public void scanBarcode(View view) {\n IntentIntegrator integrator = new IntentIntegrator(this);\n integrator.setOrientationLocked(true);\n integrator.setCaptureActivity(CaptureActivityPortrait.class);\n integrator.initiateScan();\n }", "public static void openQrCodeReader(AppCompatActivity activity) {\n IntentIntegrator integrator = new IntentIntegrator(activity);\n integrator.initiateScan();\n }", "public boolean startScan(Bundle extras) {\n try {\n Bundle response = context.getContentResolver().call(AUTHORITY_URI, CALL_METHOD_START_SCAN, null, extras);\n return response != null;\n } catch (IllegalArgumentException ex) {\n Log.e(\"com.clover.android.sdk\", \"Failed to start barcode scanner. The scanner is only available on physical devices: \" + ex.getLocalizedMessage());\n return false;\n }\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n\n IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode,resultCode,data);\n if (intentResult.getContents() != null) {\n String scannedText = intentResult.getContents();\n\n // Get product data associated with the UPC barcode\n Uri uri = api.getURL(scannedText);\n api.getData(uri, this::productBarcodeHandler);\n }\n else {\n Toast.makeText(getApplicationContext(),\"Nothing was scanned\", Toast.LENGTH_SHORT).show();\n }\n }", "private void registerBarcode(View view) {\n if (getResult() != null) {\n Intent codeScannerIntent = new Intent(this, CodeScannerActivity.class);\n startActivityForResult(codeScannerIntent, CodeScannerActivity.SCAN_CODE_REQUEST);\n } else {\n Toast.makeText(this, \"Trial result is invalid, cannot register bar code\", Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n public void onClick(View view) {\n clearItemData();\n set_view_for(1);\n Intent intent;\n SharedPreferences sharedPreferences =\n PreferenceManager.getDefaultSharedPreferences(getBaseContext());\n String setting_barcode = sharedPreferences.getString(\"setting_barcode\", \"1\");\n session.setScanfor(\"1\"); //for item\n\n if (setting_barcode.equals(\"1\")) {\n intent = new Intent(getBaseContext(), ScanActivity.class);\n } else if (setting_barcode.equals(\"2\")) {\n intent = new Intent(getBaseContext(), ScanMainActivity.class);\n } else {\n intent = new Intent(getBaseContext(), ZxingScan.class);\n }\n\n startActivity(intent);\n\n\n }", "@Override\n\t\t\tpublic void onClick(View arg0) {\n\t\t\t\tIntent intent = new Intent(\n\t\t\t\t\t\t\"com.google.zxing.client.android.SCAN\");\n\t\t\t\tintent.putExtra(\"SCAN_MODE\", \"QR_CODE_MODE\");\n\t\t\t\tstartActivityForResult(intent, 0);\n\t\t\t}", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n //if qrcode reader\n if(code == 1){\n IntentResult qrcode = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);\n if (qrcode != null) {\n if (qrcode.getContents() != null) {\n String cut = qrcode.getContents();\n int corte = cut.indexOf(\"=\") + 1;\n final String code = cut.substring(corte, corte + 44);\n Intent readQRcode = new Intent(activity, VerNFe.class);\n readQRcode.putExtra(\"code\", code);\n overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);\n startActivity(readQRcode);\n } else {\n Toast.makeText(activity, R.string.toast_cancel_read_qrcode, Toast.LENGTH_SHORT).show();\n }\n drawerLayout.closeDrawers();\n } else {\n super.onActivityResult(requestCode, resultCode, data);\n }\n }\n //if barcode reader\n else if (code == 2){\n IntentResult barcode = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);\n if (barcode != null) {\n if (barcode.getContents() != null) {\n String codigo_de_barras = barcode.getContents();\n Descontos d = new Descontos();\n d.pegaProdutoPorCodigoDeBarras(codigo_de_barras);\n } else {\n Toast.makeText(this, \"Leitura do código de barras cancelado\", Toast.LENGTH_SHORT).show();\n }\n } else {\n Toast.makeText(this, \"Erro ao ler código de barras do Produto\", Toast.LENGTH_LONG).show();\n }\n }\n\n }", "@Override\n public void onClick(View view) {\n clearItemData();\n set_view_for(1);\n Intent intent;\n SharedPreferences sharedPreferences =\n PreferenceManager.getDefaultSharedPreferences(getBaseContext());\n String setting_barcode = sharedPreferences.getString(\"setting_barcode\", \"1\");\n session.setScanfor(\"3\"); //for item\n\n if (setting_barcode.equals(\"1\")) {\n intent = new Intent(getBaseContext(), ScanActivity.class);\n } else if (setting_barcode.equals(\"2\")) {\n intent = new Intent(getBaseContext(), ScanMainActivity.class);\n } else {\n intent = new Intent(getBaseContext(), ZxingScan.class);\n }\n\n startActivity(intent);\n\n\n }", "public void onClick(View view) {\n Intent intentScan = new Intent(\"com.google.zxing.client.android.SCAN\");\n intentScan.addCategory(Intent.CATEGORY_DEFAULT);\n intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);\n try {\n startActivityForResult(intentScan, SCAN_QR_REQUEST_CODE);\n } catch (ActivityNotFoundException e) {\n Toast.makeText(getActivity(), R.string.no_qr_scanner_installed,\n Toast.LENGTH_LONG).show();\n }\n }", "public void startQR(View view){\n\n try {\n Intent intent = new Intent(ACTION_SCAN);\n intent.putExtra(\"SCAN_MODE\", \"QR_CODE_MODE\");\n startActivityForResult(intent, 0);\n } catch (ActivityNotFoundException anfe) {\n showDialog(this, getResources().getString(R.string.qrreader_not_found), getResources().getString(R.string.would_you_like_to_download), getResources().getString(R.string.yes), getResources().getString(R.string.no)).show();\n }\n }", "public void scanQrCode() {\r\n cameraView.getHolder().addCallback(new SurfaceHolder.Callback() {\r\n @Override\r\n public void surfaceCreated(SurfaceHolder holder) {\r\n try {\r\n if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {\r\n // TODO: Consider calling\r\n // ActivityCompat#requestPermissions\r\n // here to request the missing permissions, and then overriding\r\n // public void onRequestPermissionsResult(int requestCode, String[] permissions,\r\n // int[] grantResults)\r\n // to handle the case where the user grants the permission. See the documentation\r\n // for ActivityCompat#requestPermissions for more details.\r\n return;\r\n }\r\n cameraSource.start(cameraView.getHolder());\r\n } catch (IOException ie) {\r\n Log.e(\"CAMERA SOURCE\", ie.getMessage());\r\n }\r\n }\r\n\r\n @Override\r\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {\r\n //cameraSource.release();\r\n }\r\n\r\n @Override\r\n public void surfaceDestroyed(SurfaceHolder holder) {\r\n cameraSource.stop();\r\n }\r\n });\r\n\r\n cameraView.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n cameraFocus(cameraSource, Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);\r\n }\r\n });\r\n\r\n barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {\r\n @Override\r\n public void release() {\r\n\r\n }\r\n\r\n @Override\r\n public void receiveDetections(Detector.Detections<Barcode> detections) {\r\n final SparseArray<Barcode> barcodes = detections.getDetectedItems();\r\n\r\n if (barcodes.size() != 0) {\r\n barcodeInfo.post(new Runnable() {\r\n public void run() {\r\n try {\r\n if (Config.getInstance().isInternetAvailable(BarcodeScanner.this)) {\r\n\r\n Config.getInstance().logger(BarcodeScanner.this,Config.getInstance().logger_ATTENDANCE_FILL_ATTENDANCE);\r\n String contents = barcodes.valueAt(0).displayValue;\r\n Toast.makeText(BarcodeScanner.this, contents, Toast.LENGTH_SHORT).show();\r\n tv_detectedValue.setText(contents);\r\n\r\n } else {\r\n Config.getInstance().GlobalInternetDialog(BarcodeScanner.this);\r\n }\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n });\r\n }\r\n }\r\n });\r\n }", "public void scanQR(View v) {\n try {\n //start the scanning activity from the com.google.zxing.client.android.SCAN intent\n Intent intent = new Intent(ACTION_SCAN);\n intent.putExtra(\"SCAN_MODE\", \"QR_CODE_MODE\");\n startActivityForResult(intent, 0);\n } catch (ActivityNotFoundException anfe) {\n //on catch, show the download dialog\n showDialog(this, \"No Scanner Found\", \"Download a scanner code activity?\", \"Yes\", \"No\").show();\n }\n }", "public void handleBarcodeScanned(ScenarioController scenarioController, String barcode);", "@ViewAnnotations.ViewOnClick(R.id.hunter_number_read_qr_button)\n protected void onReadQrCodeClicked(final View view) {\n final IntentIntegrator intentIntegrator = IntentIntegrator.forSupportFragment(this);\n intentIntegrator.setBarcodeImageEnabled(true);\n intentIntegrator.setOrientationLocked(false);\n intentIntegrator.initiateScan();\n }", "@Override\n public void onClick(View v) {\n qrScan.initiateScan();\n }", "private void onBarcodeDetected(Barcode barcode) {\n Log.d(TAG, \"Detected barcode with value: \" + barcode.displayValue);\n\n Intent returnIntent = new Intent();\n returnIntent.putExtra(INTENT_EXTRA_BARCODE_VALUE, barcode.displayValue);\n setResult(RESULT_OK, returnIntent);\n finish();\n }", "public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {\n\t inactivityTimer.onActivity();\n\t lastResult = rawResult;\n//\t ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);\n//\n//\t boolean fromLiveScan = barcode != null;\n//\t if (fromLiveScan) {\n//\t historyManager.addHistoryItem(rawResult, resultHandler);\n//\t // Then not from history, so beep/vibrate and we have an image to draw on\n//\t beepManager.playBeepSoundAndVibrate();\n//\t drawResultPoints(barcode, scaleFactor, rawResult);\n//\t }\n//\n//\t displayBarcodeAnimation(currentEan);\n//\t displayBarcodeAnimation2(rawResult.getText(),barcode);\n//\t \tString message = \"Barcode result: \"\n//\t + \" (\" + rawResult.getText() + ')';\n//\t Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();\n//\t // Wait a moment or else it will scan the same barcode continuously about 3 times\n\t restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);\n//\t \n\t \n\t \n\t try {\n\t\t\t\tif (barcode != null) {\n\t\t\t\t\tCaptureActivity.BARCODE = \"\";\n\t\t\t\t\tnow.setToNow();\n\t\t\t\t\tcurrentEan = rawResult.getText().trim();\n\t\t\t\t\t\n\t\t\t\t\tif (!lastEan.equals(currentEan)\n\t\t\t\t\t\t\t|| Math.abs(now.second - lastScanTime) >= SAME_PRODUCT_RESCAN_INTERVAL) {\n\t\t\t\t\t\tbeepManager.playBeepSoundAndVibrate();\n\n\t\t\t\t\t\tlastEan = currentEan;\n\t\t\t\t\t\tlastScanTime = now.second;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (currentEan!=null && !currentEan.isEmpty()) {\n\t\t\t\t\t\t\tdrawResultPoints(barcode, scaleFactor, rawResult);\n\t\t\t\t\t\t\tdisplayBarcodeAnimation2(rawResult.getText(),barcode);\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//\n\t\t\t\t\t\t\n//\t\t\t\t\t\trestartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);\n\t\t\t\t\t\tscanEanAddingStarted = true;\n\t\t\t\t\t\twhile (!scanEanRemovingStarted) {\n\t\t\t\t\t\t\tsacannedItemListForArticle.add(currentEan);\n\t\t\t\t\t\t\tscanEanAddingStarted = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tscanImageAddingStarted = true;\n\t\t\t\t\t\twhile (!scanImageRemovingStarted) {\n\t\t\t\t\t\t\tsacannedItemListForImage.add(currentEan);\n\t\t\t\t\t\t\tscanImageAddingStarted = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n//\t\t\t\t\t\ttvScanningProgressCounter.setText(\"\"+sacannedItemListForArticle.size()+\" remaining\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (Exception e) {\n\t\t\t\tCommonTask.ShowMessage(this, e.getMessage());\n\t\t\t}\n\t }", "void barcodeCaptured(String barcodeString);", "@ReactMethod\n public void startReader(final Promise promise) {\n scanDecode.initService(\"true\");\n scanDecode.getBarCode(new ScanInterface.OnScanListener() {\n @Override\n public void getBarcode(String s) {\n if (D) Log.d(TAG, \"HoneywellBarcodeReader - Barcode scan read\");\n sendEvent(BARCODE_READ_SUCCESS, s);\n }\n\n @Override\n public void getBarcodeByte(byte[] bytes) {\n\n }\n });\n\n promise.resolve(true);\n }", "public void onClickBtSkanuj(View v) {\n activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);\n IntentIntegrator integrator = new IntentIntegrator(activity);\n integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE);\n integrator.setPrompt(\"Scan\");\n integrator.setCameraId(0);\n integrator.setBeepEnabled(true);\n integrator.setBarcodeImageEnabled(false);\n\n integrator.setOrientationLocked(false);\n integrator.initiateScan();\n }", "private void onScanActionSelected() {\n Intent intent = new Intent(this, ScanActivity.class);\n startActivity(intent);\n }", "public void onGetProduct2Click(View v) throws UnsupportedEncodingException, JSONException {\n IntentIntegrator integrator = new IntentIntegrator(this);\n integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);\n integrator.setPrompt(\"Escanea un codigo\");\n integrator.setCameraId(0); // Use a specific camera of the device\n integrator.setBeepEnabled(false);\n integrator.setBarcodeImageEnabled(true);\n integrator.initiateScan();\n }", "@Override\n\t\tpublic void onClick( View v ) {\n\t\t\tIntent intent = new Intent( GetSellingItem.this, ZBarScannerActivity.class );\n\t\t\t\n\t\t\t// Specify ZBar to only scan for QR Codes (not barcodes or others).\n\t\t\tintent.putExtra( ZBarConstants.SCAN_MODES, new int[]{Symbol.QRCODE} );\n\t\t\t\n\t\t\t// Makes sure result of QR scan is sent to onActivityResult() later.\n\t\t\tstartActivityForResult( intent, ZBAR_REQUEST_ADD_ITEM ); \n\t\t}", "public void startScan()\n {\n Toolbox.toast(getContext(), \"Starting scan...\");\n //------------------------------------------------------------\n // Clear the list of devices and make sure user has Bluetooth\n // turned on\n clearDeviceLists();\n if ( !Toolbox.checkBLEAdapter(bleAdapter) )\n {\n Toolbox.requestUserBluetooth(mainActivity);\n }\n else\n {\n scanLeDevice(true);\n }\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n Intent intent = new Intent(getApplicationContext(), ScanPage.class);\n startActivity(intent);\n super.onActivityResult(requestCode, requestCode, data);\n }", "@RequiresPermission(allOf = {Manifest.permission.CAMERA, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH, Manifest.permission.ACCESS_FINE_LOCATION})\n public void scanQRCode(final Activity activityContext, final CameraSourcePreview cameraSourcePreview, final QRCodeScanListener qrCodeScanListener) {\n\n isScanned = false;\n BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(activityContext)\n .setBarcodeFormats(Barcode.QR_CODE)\n .build();\n\n CameraSource cameraSource = new CameraSource.Builder(activityContext, barcodeDetector)\n .setFacing(CameraSource.CAMERA_FACING_BACK)\n .setRequestedPreviewSize(1600, 1024)\n .setAutoFocusEnabled(true)\n .build();\n\n if (cameraSource != null) {\n try {\n cameraSourcePreview.start(cameraSource);\n } catch (IOException e) {\n Log.e(TAG, \"Unable to start camera source.\", e);\n cameraSource.release();\n cameraSource = null;\n }\n }\n\n barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {\n\n @Override\n public void release() {\n }\n\n @Override\n @RequiresPermission(allOf = {Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH, Manifest.permission.ACCESS_FINE_LOCATION})\n public void receiveDetections(Detector.Detections<Barcode> detections) {\n\n final SparseArray<Barcode> barcodes = detections.getDetectedItems();\n\n if (barcodes.size() != 0 && !isScanned) {\n\n Log.d(TAG, \"Barcodes size : \" + barcodes.size());\n Barcode barcode = barcodes.valueAt(0);\n Log.d(TAG, \"QR Code Data : \" + barcode.rawValue);\n String scannedData = barcode.rawValue;\n\n try {\n JSONObject jsonObject = new JSONObject(scannedData);\n\n String deviceName = jsonObject.optString(\"name\");\n String pop = jsonObject.optString(\"pop\");\n String transport = jsonObject.optString(\"transport\");\n int security = jsonObject.optInt(\"security\", ESPConstants.SecurityType.SECURITY_2.ordinal());\n String userName = jsonObject.optString(\"username\");\n String password = jsonObject.optString(\"password\");\n isScanned = true;\n\n if (qrCodeScanListener != null) {\n qrCodeScanListener.qrCodeScanned();\n }\n\n Handler handler = new Handler(Looper.getMainLooper());\n handler.post(new Runnable() {\n\n @Override\n public void run() {\n cameraSourcePreview.release();\n }\n });\n\n ESPConstants.TransportType transportType = null;\n ESPConstants.SecurityType securityType = null;\n\n if (!TextUtils.isEmpty(transport)) {\n\n if (transport.equalsIgnoreCase(\"softap\")) {\n\n transportType = ESPConstants.TransportType.TRANSPORT_SOFTAP;\n\n } else if (transport.equalsIgnoreCase(\"ble\")) {\n\n transportType = ESPConstants.TransportType.TRANSPORT_BLE;\n\n } else {\n qrCodeScanListener.onFailure(new RuntimeException(\"Transport type not supported\"));\n }\n\n } else {\n qrCodeScanListener.onFailure(new RuntimeException(\"Transport is not available\"));\n }\n\n securityType = setSecurityType(security);\n\n espDevice = new ESPDevice(context, transportType, securityType);\n espDevice.setDeviceName(deviceName);\n espDevice.setProofOfPossession(pop);\n espDevice.setUserName(userName);\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && transportType.equals(ESPConstants.TransportType.TRANSPORT_SOFTAP)) {\n\n WiFiAccessPoint wiFiDevice = new WiFiAccessPoint();\n wiFiDevice.setWifiName(deviceName);\n wiFiDevice.setPassword(password);\n espDevice.setWifiDevice(wiFiDevice);\n qrCodeScanListener.deviceDetected(espDevice);\n } else {\n isDeviceAvailable(espDevice, password, qrCodeScanListener);\n }\n\n } catch (JSONException e) {\n\n e.printStackTrace();\n qrCodeScanListener.onFailure(new RuntimeException(\"QR code not valid\"));\n }\n }\n }\n });\n }", "@Override\n public void onClick(View view) {\n\n controlVisBAR();\n barcodeView.decodeContinuous(callback);\n// barcodeView.resume();\n\n barcodeView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n controlVisCAM();\n }\n });\n }", "public void onClick(View v) {\n onScanBarcodeClick();\n }", "@JavascriptInterface\r\n public String startScanning() throws JSONException {\r\n try {\r\n if (ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.CAMERA)\r\n != PackageManager.PERMISSION_GRANTED) {\r\n mClss = FullScannerFragmentActivity.class;\r\n\r\n ActivityCompat.requestPermissions(((Activity)mContext),\r\n new String[]{android.Manifest.permission.CAMERA}, 1);\r\n } else {\r\n Intent intent = new Intent(mContext, FullScannerFragmentActivity.class);\r\n //mContext.startActivity(intent);\r\n ((Activity)mContext).startActivityForResult(intent, 0);\r\n }\r\n\r\n } catch (Exception e) {\r\n Log.d(\"Scanning\", e.getMessage());\r\n\r\n }\r\n\r\n return;\r\n\r\n }", "@Override\n public void onScanned(Barcode barcode) {\n super.onScanned(barcode);\n\n //on Scan completed close the scanner\n if (isScanning.get()) {\n getChildFragmentManager()\n .beginTransaction()\n .remove(getChildFragmentManager().findFragmentById(R.id.scannerFragment))\n .commit();\n }\n\n isScanning.set(false);\n\n /*\n * this works when if user scan the exist\n * code without scanning the enter code\n */\n boolean waitingForEnterCode = !getUpdatedPendingEntryEvent();\n if (barcode.rawValue.equals(EXIT) && waitingForEnterCode) {\n String message = \"Its look like that you haven't scan the Enter Code \" + new String(Character.toChars(0x1F622));\n showAlertDialog(message);\n return;\n }\n\n /*\n * this works when user scan the enter code again\n * without scanning the exit code\n */\n boolean waitingForExitCode = getUpdatedPendingEntryEvent();\n if (barcode.rawValue.equals(ENTER) && waitingForExitCode) {\n String message = \"you have already scan the Enter code First scan a Exist \" + new String(Character.toChars(0x1F622));\n showAlertDialog(message);\n return;\n }\n\n if (barcode.rawValue.equals(Constants.IQRCode.ENTER)) {\n viewmodel.updateScannedValueWhenEnter();\n updatePendingEntryEvent(true);\n } else if (barcode.rawValue.equals(EXIT)) {\n viewmodel.updateScannedValueWhenExist();\n updatePendingEntryEvent(false);\n } else {\n Toast.makeText(getActivity(), \"no action specified\", Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n\tpublic void onActivityResult(int requestCode, int resultCode, Intent intent) {\n\n if (resultCode == RESULT_CANCELED) {\n Toast.makeText(this, \"Cancelled\", Toast.LENGTH_SHORT).show();\n return;\n }\n\n Map<String, Object> data = null;\n if (requestCode == QR_CODE_SCAN_REQUEST_CODE) {\n IntentResult scanResult = IntentIntegrator.parseActivityResult(\n requestCode, resultCode, intent);\n if (scanResult != null && scanResult.getContents() != null) {\n Yaml yaml = new Yaml();\n String scanned_data = scanResult.getContents().toString();\n data = (Map<String, Object>) yaml.load(scanned_data);\n }\n }\n else if (requestCode == NFC_TAG_SCAN_REQUEST_CODE && resultCode == RESULT_OK) {\n if (intent.hasExtra(\"tag_data\")) {\n data = (Map<String, Object>) intent.getExtras().getSerializable(\"tag_data\");\n }\n }\n else {\n Log.w(\"Remocon\", \"Unknown activity request code: \" + requestCode);\n return;\n }\n\n if (data == null) {\n Toast.makeText(this, \"Scan failed\", Toast.LENGTH_SHORT).show();\n }\n else {\n try {\n Log.d(\"Remocon\", \"master chooser OBJECT: \" + data.toString());\n addMaster(new MasterId(data), false);\n } catch (Exception e) {\n Toast.makeText(this, \"invalid rocon master description: \" + e.getMessage(), Toast.LENGTH_SHORT).show();\n }\n }\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tIntent intent = new Intent(getActivity().getApplicationContext(), ScanQRCodeActivity.class);\n\t\t\t\tstartActivityForResult(intent, REQUEST_CODE);\n\t\t\t}", "@Override\n\tpublic void onActivityResult(int requestCode, int resultCode, Intent intent) {\n\t\t/*\n\t\t * returning from ZXing\n\t\t */\n\t\tif (requestCode == QR_INTENT_CODE) {\n\t\t\tif (resultCode == RESULT_OK) {\n\t\t\t\tRequestActivity.onQRScanned(this, intent);\n\t\t\t}\n\t\t}\n\t}", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity__scanner);\n\n this.setTitle(\"QR Scanner\");\n\n scan = findViewById(R.id.sc_btn);\n result = findViewById(R.id.result);\n done_btn = findViewById(R.id.done_btn);\n all = findViewById(R.id.all);\n\n //clicks on scan qr code button\n //go to Activity_scanCode\n scan.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n startActivity(new Intent(getApplicationContext(), Activity_scanCode.class));\n Handler handler = new Handler();\n //the result will display in 3s\n handler.postDelayed(new Runnable() {\n public void run() {\n all.setVisibility(View.VISIBLE);\n }\n }, 3000);\n\n }\n });\n\n //go back to previous page\n done_btn.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Toast.makeText(Activity_Scanner.this, \"Completed! Go back to main menu.\", Toast.LENGTH_SHORT).show();\n startActivity(new Intent(Activity_Scanner.this, Activity_MainMenuD.class));\n }\n });\n }", "public void onRead(BarcodeData barcodeData) {\n }", "@Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n receiver = new PDAReceiver() {\n\n @Override\n public void dispathCode(String code) {\n handleCode(code);\n\n }\n };\n\n scanDataIntentFilter = new IntentFilter();\n //scanDataIntentFilter.addAction(\"com.android.scancontext\"); //前台输出\n scanDataIntentFilter.addAction(\"com.android.scanservice.scancontext\"); //后台输出\n registerReceiver(receiver, scanDataIntentFilter);\n }", "private void onScanActionSelected() {\n\t\tIntent intent = new Intent(this, ScanActivity.class);\n\t\tstartActivity(intent);\n\t}", "public void continueOne(View view){\n EditText firstName= (EditText) findViewById(R.id.firstName);\n String firstNameString = firstName.getText().toString();\n EditText lastName= (EditText) findViewById(R.id.lastName);\n String lastNameString= lastName.getText().toString();\n EditText studentID= (EditText) findViewById(R.id.studentId);\n String studentIDString= studentID.getText().toString();\n\n /**Toasts are the things that are like mini notifications that you'll see at the bottom of the screen.*/\n Context context = getApplicationContext();\n CharSequence text = \"Let's do this, \" + firstNameString + \"!\";\n int duration = Toast.LENGTH_SHORT;\n Toast toast = Toast.makeText(context, text, duration);\n toast.show();\n /**The following is an intent to start the next activity (mainCodeOne), and carry the key user data with it. MainActivityOne*/\n Intent intentOne = new Intent(this, AndroidBarcodeActivityOne.class);\n intentOne.putExtra(\"firstNameString\", firstNameString);\n intentOne.putExtra(\"lastNameString\", lastNameString);\n intentOne.putExtra(\"studentIDString\", studentIDString);\n startActivity(intentOne);\n\n\n }", "@Override\n public void onBarcodeDetected(Barcode barcode) {\n Log.d(TAG,\"Barcode detected\");\n }", "@Override\r\n public void onClick(View v) {\r\n IntentIntegrator Integrator=new IntentIntegrator(MainStore.this);\r\n Integrator.initiateScan();\r\n }", "public ScanBarcode() {\n initComponents();\n \n \n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);\n if (result != null) {\n //if qrcode has nothing in it\n if (result.getContents() == null) {\n Toast.makeText(this, \"Result Not Found\", Toast.LENGTH_LONG).show();\n } else {\n //if qr contains data\n try {\n //converting the data to json\n JSONObject obj = new JSONObject(result.getContents());\n //setting values to textviews\n textViewName.setText(obj.getString(\"name\"));\n textViewAddress.setText(obj.getString(\"address\"));\n } catch (JSONException e) {\n e.printStackTrace();\n //if control comes here\n //that means the encoded format not matches\n //in this case you can display whatever data is available on the qrcode\n //to a toast\n Toast.makeText(this, result.getContents(), Toast.LENGTH_LONG).show();\n }\n }\n } else {\n super.onActivityResult(requestCode, resultCode, data);\n }\n }", "public void creatScreenCaptureIntent(Activity activity, int requestCode) {\n activity.startActivityForResult(mMediaProjectionManager.createScreenCaptureIntent(), requestCode);\n }", "void start(Intent intent, IntentFilter filter, IIntentCallback callback, IEclipseContext context);", "@Override\n public void onClick(View view)\n {\n Intent intent = new Intent(BoilerRoom.this, ScanQR.class);\n //intent.putExtra( \"id\", tvmechID.getText().toString() );\n startActivity(intent);\n }", "private void initialiseDetectorsAndSources() {\n\n barcodeDetector = new BarcodeDetector.Builder(this)\n .setBarcodeFormats(Barcode.QR_CODE)\n .build();\n\n cameraSource = new CameraSource.Builder(this, barcodeDetector)\n .setRequestedPreviewSize(1920, 1080)\n .setAutoFocusEnabled(true) //you should add this feature\n .build();\n\n surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {\n @Override\n public void surfaceCreated(SurfaceHolder holder) {\n try {\n if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {\n cameraSource.start(surfaceView.getHolder());\n Toast.makeText(getApplicationContext(), \"Camera started\", Toast.LENGTH_LONG).show();\n } else {\n ActivityCompat.requestPermissions(RideCycle.this, new\n String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);\n }\n\n } catch (IOException e) {\n e.printStackTrace();\n\n }\n\n\n }\n\n @Override\n public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {\n }\n\n @Override\n public void surfaceDestroyed(SurfaceHolder holder) {\n cameraSource.stop();\n }\n });\n\n\n barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {\n @Override\n public void release() {\n Toast.makeText(getApplicationContext(), \"To prevent memory leaks barcode scanner has been stopped\", Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void receiveDetections(Detector.Detections<Barcode> detections) {\n final SparseArray<Barcode> barcodes = detections.getDetectedItems();\n if (barcodes.size() != 0) {\n\n\n txtBarcodeValue.post(new Runnable() {\n\n @Override\n public void run() {\n\n if (barcodes.valueAt(0).email != null) {\n txtBarcodeValue.removeCallbacks(null);\n intentData = barcodes.valueAt(0).email.address;\n txtBarcodeValue.setText(intentData);\n isEmail = true;\n // btnAction.setText(\"ADD CONTENT TO THE MAIL\");\n } else {\n isEmail = false;\n// btnAction.setText(\"LAUNCH URL\");\n intentData = barcodes.valueAt(0).displayValue;\n txtBarcodeValue.setText(\"Cycle id: \" + intentData);\n\n }\n }\n });\n\n }\n }\n });\n }", "@RequiresPermission(allOf = {Manifest.permission.CAMERA, Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH, Manifest.permission.ACCESS_FINE_LOCATION})\n public void scanQRCode(final CodeScanner codeScanner, final QRCodeScanListener qrCodeScanListener) {\n\n isScanned = false;\n List<BarcodeFormat> formats = new ArrayList<>();\n formats.add(BarcodeFormat.QR_CODE);\n\n codeScanner.setDecodeCallback(new DecodeCallback() {\n @Override\n public void onDecoded(@NonNull final Result result) {\n\n String scannedData = result.getText();\n\n if (!TextUtils.isEmpty(scannedData) && !isScanned) {\n\n Log.d(TAG, \"QR Code Data : \" + scannedData);\n\n try {\n JSONObject jsonObject = new JSONObject(scannedData);\n\n String deviceName = jsonObject.optString(\"name\");\n String pop = jsonObject.optString(\"pop\");\n String transport = jsonObject.optString(\"transport\");\n int security = jsonObject.optInt(\"security\", ESPConstants.SecurityType.SECURITY_2.ordinal());\n String userName = jsonObject.optString(\"username\");\n String password = jsonObject.optString(\"password\");\n isScanned = true;\n\n if (qrCodeScanListener != null) {\n qrCodeScanListener.qrCodeScanned();\n }\n\n Handler handler = new Handler(Looper.getMainLooper());\n handler.post(new Runnable() {\n\n @Override\n public void run() {\n codeScanner.releaseResources();\n }\n });\n\n ESPConstants.TransportType transportType = null;\n ESPConstants.SecurityType securityType = null;\n\n if (!TextUtils.isEmpty(transport)) {\n\n if (transport.equalsIgnoreCase(\"softap\")) {\n\n transportType = ESPConstants.TransportType.TRANSPORT_SOFTAP;\n\n } else if (transport.equalsIgnoreCase(\"ble\")) {\n\n transportType = ESPConstants.TransportType.TRANSPORT_BLE;\n\n } else {\n Log.e(TAG, \"\" + transport + \" Transport type is not supported\");\n qrCodeScanListener.onFailure(new RuntimeException(\"Transport type is not supported\"));\n return;\n }\n } else {\n Log.e(TAG, \"Transport is not available in QR code data\");\n qrCodeScanListener.onFailure(new RuntimeException(\"QR code is not valid\"), scannedData);\n return;\n }\n\n securityType = setSecurityType(security);\n\n espDevice = new ESPDevice(context, transportType, securityType);\n espDevice.setDeviceName(deviceName);\n espDevice.setProofOfPossession(pop);\n espDevice.setUserName(userName);\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && transportType.equals(ESPConstants.TransportType.TRANSPORT_SOFTAP)) {\n\n WiFiAccessPoint wiFiDevice = new WiFiAccessPoint();\n wiFiDevice.setWifiName(deviceName);\n wiFiDevice.setPassword(password);\n espDevice.setWifiDevice(wiFiDevice);\n qrCodeScanListener.deviceDetected(espDevice);\n } else {\n isDeviceAvailable(espDevice, password, qrCodeScanListener);\n }\n\n } catch (JSONException e) {\n\n e.printStackTrace();\n qrCodeScanListener.onFailure(new RuntimeException(\"QR code is not valid\"), scannedData);\n }\n } else {\n qrCodeScanListener.onFailure(new RuntimeException(\"QR code is not valid\"), scannedData);\n }\n }\n });\n }", "public void setBarcode(java.lang.String barcode) {\n this.barcode = barcode;\n }", "@Override\n protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);\n if (result != null) {\n if (result.getContents() == null) {\n Log.d(\"MainActivity\", \"Cancelled scan\");\n makeToast(this, \"Cancelado\");\n } else {\n Log.d(\"MainActivity\", \"Scanned\");\n makeToast(this, \"Contactando con Salesforce, ISBN: \" + result.getContents());\n scanResult = result.getContents();\n\n if (scanResult != null) {\n try {\n getProducto(scanResult);\n } catch (Exception e) {\n Log.e(\"RequestError\", e.toString());\n makeToast(this, \"Ha ocurrido un error, intente nuevamente...\");\n } finally {\n sfResult = null;\n }\n }\n }\n } else {\n Log.d(\"MainActivity\", \"Weird\");\n // This is important, otherwise the result will not be passed to the fragment\n super.onActivityResult(requestCode, resultCode, data);\n }\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);\n if (result != null) {\n if (result.getContents() == null) {\n Toast.makeText(this, \"Result Not Found\", Toast.LENGTH_LONG).show();\n } else {\n partNumber = result.getContents();\n new BackgroundTaskScanQrCode().execute();\n }\n } else {\n super.onActivityResult(requestCode, resultCode, data);\n }\n }", "public interface BarcodeListener {\n void onBarCodeScanned( Barcode scannedBarCode );\n}", "static void startScanner(Context context, boolean fromDialog)\n {\n if (fromDialog || ApplicationPreferences.applicationEventWifiEnableScanning) {\n if (fromDialog)\n setScanRequest(context, true);\n\n WifiScanner wifiScanner = new WifiScanner(context);\n wifiScanner.doScan(fromDialog);\n }\n //dataWrapper.invalidateDataWrapper();\n }", "@Override\n\tpublic void startActivityForResult(Intent intent, int requestCode) {\n\t\tsuper.startActivityForResult(intent, requestCode);\n\t}", "public void handleDecode(Result rawResult, Bitmap barcode) {\n\t\tif (barcode == null) {\n\n\t\t} else {\n\t\t\thandleDecode(rawResult.getText());\n\t\t}\n\n\t}", "public void onActivityResult(int requestCode, int resultCode, Intent intent) {\n\n // get scan result\n IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);\n\n\n\n if (scanningResult != null)\n {\n String scanContent = scanningResult.getContents();\n String scanFormat = scanningResult.getFormatName();\n\n TextView scan_format = (TextView) findViewById(R.id.scan_format);\n TextView scan_format2 = (TextView) findViewById(R.id.scan_format2);\n TextView scan_content = (TextView) findViewById(R.id.scan_content);\n TextView scan_content2 = (TextView) findViewById(R.id.scan_content2);\n JSONObject obj=null;\n try{\n\n obj= new JSONObject(scanContent);\n\n }catch(Exception e){\n\n }\n String id= null;\n Boolean machineFound = false;\n // scan_format.setText(\"FORMAT: \" + scanFormat);\n // scan_content.setText(\"CONTENT: \" + scanContent);\n\n try\n {\n HttpRequest req = HttpRequest.getInstance();\n Integer i;\n JSONArray allMachines= (JSONArray) req.getMachine(\"all\", \"data\");\n JSONObject machi [] = new JSONObject[allMachines.length()];\n String listMachine [] = new String[allMachines.length()];\n\n for(i=0;i<allMachines.length();i++)\n {\n machi [i] = allMachines.getJSONObject(i);\n listMachine [i] = machi[i].getString(\"id\");\n if(obj.get(\"id\").equals(listMachine[i]))\n {\n machineFound = true;\n id=listMachine[i];\n }\n }\n\n }\n catch(Exception e)\n {\n String b;\n }\n\n if(machineFound==true)\n {\n Intent intent2 = new Intent(QRcode.this, Freestyle_machine.class);\n intent2.putExtra(\"id\", id);\n startActivity(intent2);\n }\n else\n {\n Toast.makeText(getApplicationContext(), R.string.Try_again,\n Toast.LENGTH_SHORT).show();\n scan_format.setText(R.string.Uncorrect_machine);\n scan_format2.setText(R.string.Scan_again);\n }\n\n return;\n\n\n\n }\n else{\n Toast.makeText(getApplicationContext(), R.string.Try_again,\n Toast.LENGTH_SHORT).show();\n\n }\n\n }", "public void cameraIntent() {\n startActivityForResult(new Intent(\"android.media.action.IMAGE_CAPTURE\"), 1);\n }", "@Override\n public void onCreate(Bundle state) {\n super.onCreate(state);\n setContentView(R.layout.activity_scanres);\n Bundle extras = getIntent().getExtras();\n tv_barcode = (TextView) findViewById(R.id.tv_barcode);\n tv_barcode.setText(extras.getString(\"result\"));\n\n JSONObject scanJO = new JSONObject();\n try {\n scanJO.put(\"result\", \"result\");\n // scanJO.put(\"two\", \"LLAAASDJSAJDSADSA\");\n } catch (JSONException e) {\n e.printStackTrace();\n }\n HttpPost httpPost = new HttpPost(\"https://www.excerp.tech/api/demoPost\", scanJO);\n Thread httpPostThread = new Thread();\n httpPostThread.start();\n try {\n httpPostThread.join();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Log.v(\"RETURN FROM HTTP POT\", httpPost.getResponse());\n }", "@Override\n protected void onResume() {\n // TODO Auto-generated method stub\n super.onResume();\n startScan();\n }", "private void iniciarQrDetector() {\n\n System.out.println(\"Iniciar Qr\");\n\n final Display display = getWindowManager().getDefaultDisplay();\n Point size = new Point();\n display.getSize(size);\n int width = size.x;\n int height = size.y;\n\n barcodeDetector = new BarcodeDetector.Builder(LectorActivity.this)\n .setBarcodeFormats(Barcode.QR_CODE)\n .build();\n\n barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {\n @Override\n public void release() {\n }\n\n @Override\n public void receiveDetections(Detector.Detections<Barcode> detections) {\n\n if (seguir) {\n final SparseArray<Barcode> qrcodes = detections.getDetectedItems();\n\n try {\n value = qrcodes.valueAt(0).rawValue;\n\n\n } catch (ArrayIndexOutOfBoundsException e) {\n System.out.println(\"No se ha encontrado ningún código.\");\n }\n\n if (!value.equals(\"0\")) {\n seguir = false;\n System.out.println(\"Leido, \"+value);\n comprueba_maquina(value);\n }\n }\n }\n });\n cameraSource = new CameraSource\n .Builder(LectorActivity.this, barcodeDetector)\n .setRequestedPreviewSize(height, width)\n .setAutoFocusEnabled(true)\n .build();\n\n cameraPreview.getHolder().addCallback(new SurfaceHolder.Callback() {\n @Override\n public void surfaceCreated(SurfaceHolder surfaceHolder) {\n if (ActivityCompat.checkSelfPermission(LectorActivity.this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {\n //Request permission\n ActivityCompat.requestPermissions(LectorActivity.this,\n new String[]{Manifest.permission.CAMERA}, RequestCameraPermissionID);\n System.out.println(\"PERMISOS\");\n return;\n }\n try {\n System.out.println(\"INICIAR CAMARA\");\n cameraSource.start(cameraPreview.getHolder());\n } catch (IOException e) {\n System.out.println(\"FALLO AL INICIAR CAMARA\");\n e.printStackTrace();\n }\n }\n\n @Override\n public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {\n\n }\n\n @Override\n public void surfaceDestroyed(SurfaceHolder surfaceHolder) {\n cameraSource.stop();\n }\n });\n }", "protected void startReport(){\n Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(cameraIntent,REQUEST_CODE);\n }", "public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {\n inactivityTimer.onActivity();\n\n boolean fromLiveScan = barcode != null;\n if (fromLiveScan) {\n // Then not from history, so beep/vibrate and we have an image to draw on\n beepManager.playBeepSoundAndVibrate();\n }\n\n //rawResult.getText() 结果\n if (rawResult == null || TextUtils.isEmpty(rawResult.getText())) {\n if (analyzeCallback != null) {\n analyzeCallback.onAnalyzeFailed();\n }\n } else {\n if (analyzeCallback != null) {\n analyzeCallback.onAnalyzeSuccess(barcode, rawResult.getText());\n }\n }\n\n }", "@Override\n public void onScanStarted() {\n Log.d(TAG, \"Scan Started\");\n }", "@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\n\t\tif (requestCode == 1) { // startActivityForResult回傳值\n\t\t\tif (resultCode == RESULT_OK) {\n\t\t\t\tString contents = data.getStringExtra(\"SCAN_RESULT\"); // 取得QR\n\t\t\t\t// Code內容\n\t\t\t\t// 以下開始處理資料\n\t\t\t\tgetPlaceUrl(contents.split(\" \")[0], contents.split(\" \")[1]);\n\t\t\t} else if (resultCode == RESULT_CANCELED) {\n\t\t\t\t// Handle cancel\n\t\t\t}\n\t\t}\n\t}", "@Override \n public void onActivityResult(int requestCode, int resultCode, Intent data) \n { \n \n if(requestCode==1) \n { \n \tString barcode=data.getStringExtra(\"BARCODE\");\n \tif (barcode.equals(\"NULL\"))\n \t{\n \t\t//that means barcode could not be identified or user pressed the back button\n \t\t//do nothing\t\n \t}\n \telse\n \t{\n \t\tsearch.setQuery(barcode, true);\n \t\tsearch.setIconifiedByDefault(false);\n \t}\n }\n \n if (requestCode == 2) {\n ArrayList<String> results;\n results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);\n //Toast.makeText(this, results.get(0), Toast.LENGTH_SHORT).show();\n \n //if the name has an ' then the SQL is failing. Hence replacing them. \n String text = results.get(0).replace(\"'\",\"\");\n search.setQuery(text, true);\n \t\tsearch.setIconifiedByDefault(false);\n }\n \n }", "public interface IntentStarter {\n void startActivityForResult(ResultRequestor requestor, Intent intent);\n}", "@Override\n public void run() {\n startActivity(intent);\n }", "private void startARActivity()\n {\n Intent itent = new Intent();\n \n itent.setClassName(\"com.qualcomm.vuforia.samples.VideoPlayback.app.\", \"VideoPlayback\");\n \n startActivity(itent);\n }", "@Override\n public void handleResult(com.google.zxing.Result rawResult) {\n if (rawResult.getText().length() < 4) {\n mScannerView.resumeCameraPreview(SimpleScanner.this);\n Toast.makeText(this, \"Wrong QR Code\", Toast.LENGTH_SHORT).show();\n } else {\n Result = rawResult.getText().substring(0, 4);\n MachineID = rawResult.getText().substring(Result.length());\n if (Result.equals(Verification)) {\n Intent i = new Intent(SimpleScanner.this, DetailBreakdownPage2.class);\n String currentResponseDateFinish = new SimpleDateFormat(\"yyyy/MM/dd HH:mm:ss\", Locale.getDefault()).format(new Date());\n i.putExtra(\"MachineID\", MachineID);\n i.putExtra(\"ResponseDateFinish\", currentResponseDateFinish);\n i.putExtra(\"Line\", Line);\n i.putExtra(\"Station\", Station);\n i.putExtra(\"PIC\", PIC);\n startActivity(i);\n } else {\n mScannerView.resumeCameraPreview(SimpleScanner.this);\n Toast.makeText(this, \"Station tidak sesuai\", Toast.LENGTH_SHORT).show();\n }\n }\n }", "public void ClickScanner(View view){\n MainActivity.redirectActivity(this,Scanner.class);\n\n }", "@Override\n public void onActivityResult(int requestCode, int resultCode, Intent data) {\n if (requestCode == SCAN_QR_REQUEST_CODE && resultCode == Activity.RESULT_OK) {\n mDevice.DeviceID = data.getStringExtra(\"SCAN_RESULT\");\n ((EditTextPreference) mDeviceId).setText(mDevice.DeviceID);\n mDeviceId.setSummary(mDevice.DeviceID);\n }\n }", "void onScanResult(final IScanResult result);", "@Override\n public void onScanFailed() {\n Log.d(TAG, \"Scan Failed\");\n BluetoothManipulator.startScan();\n }", "public void scanDocument() {\n Intent intent = new Intent(getContext(), ScanActivity.class);\n intent.putExtra(ScanConstants.OPEN_INTENT_PREFERENCE, ScanConstants.OPEN_CAMERA);\n startActivityForResult(intent, REQUEST_CAMERA);\n }", "private void initScanner() {\n /*\n * since barcodeReaderFragment is the child fragment in the ScannerFragment therefore\n * it is get using getChildFragmentManager\n * setting up the custom bar code listener\n */\n\n }", "void showResultActivity() {\n\n Intent intent = new Intent();\n intent.setClass(this, ScanResultActivity.class);\n startActivity(intent);\n finish();\n\n playEffect();\n }", "public abstract void startSingleScan();", "private void startRecognition() {\n mStatusTextView.setVisibility(View.VISIBLE);\n mStatusTextView.setText(R.string.status_scan_credentials);\n mStatusProgressBar.setVisibility(View.GONE);\n mRescanButton.setVisibility(View.GONE);\n\n mScannerView.setAnimated(true);\n hideMatchView();\n\n mTimeClockBar.setVisibility(View.VISIBLE);\n mTimeClockBar.setProgress(0);\n\n // Start a timeout for the recognition\n startRecognitionTimeout();\n\n mAllPasswords.clear();\n mSSIDMatchCounts.clear();\n mProcessor.setActive(true);\n }", "@Override\n public void handleResult(Result rawResult) {\n\n Toast.makeText(this,rawResult.getText(),Toast.LENGTH_LONG).show();\n// Toast.makeText(this,rawResult.getBarcodeFormat().toString(),Toast.LENGTH_LONG).show();\n\n\n if (rawResult.getText().equals(\"admin\")) {\n\n Intent intent = new Intent(ScannerActivity.this, ExamPage.class);\n startActivity(intent);\n finish();\n\n\n } else {\n\n Toast.makeText(this,\"Wrong QR Code\",Toast.LENGTH_LONG).show();\n Intent intent = new Intent(ScannerActivity.this, ScannerActivity.class);\n startActivity(intent);\n finish();\n\n\n }\n\n\n\n SharedPreferences sp = getSharedPreferences(\"PREF_NAME\", Context.MODE_PRIVATE);\n String qrText = sp.getString(\"QR_Code\", String.valueOf(-1));\n Toast.makeText(this,qrText,Toast.LENGTH_LONG).show();\n\n\n Log.v(\"Scan\", rawResult.getText()); // Prints scan results\n Log.v(\"Scan\", rawResult.getBarcodeFormat().toString()); // Prints the scan format (qrcode, pdf417 etc.)\n }", "public void productBarcodeHandler(JSONObject response) {\n try {\n JSONObject productInfo = response.getJSONObject(\"product\");\n JSONArray keywords = productInfo.getJSONArray(\"_keywords\");\n\n String name = productInfo.getString(\"product_name\");\n int resID = R.drawable.food_misc;\n\n for (int i = 0; i < keywords.length(); i++) {\n String keyword = keywords.getString(i);\n\n if (keyword.contains(\" \")) {\n keyword = keyword.replace(\" \", \"_\");\n }\n\n int resource = this.getResources().getIdentifier(\"food_\" + keyword, \"drawable\", this.getPackageName());\n if (resource != 0) {\n resID = resource;\n break;\n }\n }\n\n Intent intent = new Intent(this, ItemEntry.class);\n intent.putExtra(\"FOOD_NAME\", name);\n intent.putExtra(\"FOOD_PIC\", resID);\n startActivity(intent);\n }\n catch (Exception e) {\n Toast.makeText(getApplicationContext(),\"ERROR finding product!\", Toast.LENGTH_LONG).show();\n Log.e(\"UPC Scan Error:\", e.getMessage());\n e.printStackTrace();\n }\n }", "@Override\n\tpublic void onScanViewButtonClick() {\n\t\t\n\t}", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_scan, container, false);\n txt = v.findViewById(R.id.txt_view);\n imgpd = v.findViewById(R.id.img);\n CodeScannerView scannerView = v.findViewById(R.id.scanner_view);\n mCodeScanner = new CodeScanner(getActivity(),scannerView);\n mCodeScanner.setDecodeCallback(new DecodeCallback() {\n @Override\n public void onDecoded(@NonNull final Result result) {\n getActivity().runOnUiThread(new Runnable() {\n @Override\n public void run() {\n Toast.makeText(getActivity(), result.getText(), Toast.LENGTH_SHORT).show();\n\n loadSanPham(String.valueOf(result.getText()));\n }\n });\n }\n });\n scannerView.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n mCodeScanner.startPreview();\n }\n });\n return v ;\n }", "void mo21580A(Intent intent);", "protected abstract void startActivityForResult(final T androidComponent,\n final Intent intent,\n final int requestCode);", "protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n switch (requestCode) {\n case 0:\n try {\n if (resultCode == Activity.RESULT_OK) {\n String scanResult = data.getStringExtra(Constants.SCAN_RESULT);\n // set scanner result to text view on main screen\n TextView textView = (TextView) findViewById(R.id.scanResult);\n textView.setText(scanResult);\n\n Log.v(TAG, \"Bar Code ==: \" + scanResult);\n\n //new KiiPushBroadcastReceiver().sendGroupNotification(Constants.GROUPID, Constants.TOPICNAME, scanResult);\n //send scan result to server\n AsyncTaskSendData asyncTaskToSendData = new AsyncTaskSendData(getApplicationContext());\n asyncTaskToSendData.execute(scanResult);\n\n try{\n Thread.sleep(1000);\n }catch(InterruptedException e) {\n Log.e(TAG, \"thread sleep: \" + e.getMessage());\n }\n\n exitScanner2();\n\n break;\n } else if (resultCode == Activity.RESULT_CANCELED && data != null) {\n String error = data.getStringExtra(Constants.ERROR_INFO);\n if (!TextUtils.isEmpty(error)) {\n // Toast.makeText(this, error, Toast.LENGTH_SHORT).show();\n Log.e(TAG, \"Bar Code\" +\n \" error ==: \" + error);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n break;\n }\n }", "@Override\n public void onScanFinished() {\n Log.d(TAG, \"Scan Finished\");\n if(dicePlus == null){\n BluetoothManipulator.startScan();\n }\n }", "public void startScanning(View view) {\n // Check if the Location permission has been granted\n if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)\n == PackageManager.PERMISSION_GRANTED) {\n // Permission is already available, start scanning\n\n mScanProgressBar.setVisibility(View.VISIBLE);\n\n mProgressAnimator.start();\n\n scanDevice(true);\n mDeviceListAdapter.clear(); // remove sample devices\n } else {\n // Permission is missing and must be requested.\n requestLocationPermission();\n }\n\n\n }", "@Override\n public void onClick(DialogInterface dialog, int which) {\n goToNextScreen(barcode.getRawValue());\n dialog.dismiss();\n }", "private void shareBarcode(Activity activity, String text) {\n IntentIntegrator zxingIntegrator = new IntentIntegrator(activity);\n zxingIntegrator.shareText(text);\n }" ]
[ "0.7596086", "0.7158326", "0.715277", "0.6826418", "0.6730981", "0.66824853", "0.6668395", "0.65992624", "0.644984", "0.63863647", "0.637703", "0.63677186", "0.6337479", "0.6263392", "0.6260185", "0.6156796", "0.61527056", "0.6149059", "0.61259836", "0.6108261", "0.60988015", "0.60499287", "0.6042059", "0.60134065", "0.60071915", "0.6006959", "0.5976862", "0.592774", "0.5853871", "0.58534116", "0.5833845", "0.58086395", "0.57719105", "0.57591355", "0.5756779", "0.57511866", "0.57233614", "0.57221544", "0.5712749", "0.57107544", "0.5707191", "0.56421953", "0.56382346", "0.5575504", "0.555959", "0.5544855", "0.5541476", "0.55218655", "0.551441", "0.5483823", "0.5453541", "0.5451876", "0.544369", "0.5411244", "0.5408073", "0.53987545", "0.5392264", "0.5364155", "0.5361412", "0.535731", "0.5343944", "0.5320742", "0.5308095", "0.5278311", "0.5253068", "0.5251286", "0.5240546", "0.52370346", "0.52353144", "0.5234537", "0.5211032", "0.5197549", "0.51774794", "0.5168696", "0.51592857", "0.51572794", "0.51491183", "0.5143209", "0.51409507", "0.5136767", "0.5134419", "0.5127026", "0.5119984", "0.51192963", "0.50989723", "0.50978523", "0.50965357", "0.50901103", "0.5084628", "0.5084241", "0.5067639", "0.50515497", "0.5041836", "0.50386786", "0.5036781", "0.50322783", "0.50281644", "0.50238067", "0.4998269", "0.49776384" ]
0.62104225
15
/ Access modifiers changed, original: protected
public TextView a(Context context) { TextView textView = new TextView(context); textView.setGravity(17); textView.setTextSize(2, 12.0f); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LayoutParams(-2, -2)); TypedValue typedValue = new TypedValue(); getContext().getTheme().resolveAttribute(16843534, typedValue, true); textView.setBackgroundResource(typedValue.resourceId); textView.setAllCaps(true); int i = (int) (16.0f * getResources().getDisplayMetrics().density); textView.setPadding(i, i, i, i); return textView; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "public abstract Object mo26777y();", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "protected abstract Set method_1559();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "private abstract void privateabstract();", "private PropertyAccess() {\n\t\tsuper();\n\t}", "protected void h() {}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo27386d();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "public abstract void mo70713b();", "@Override\n\tprotected void getExras() {\n\n\t}", "protected Doodler() {\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "public abstract void mo56925d();", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void smell() {\n\t\t\n\t}", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "public abstract void mo27385c();", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "@Override\n public void memoria() {\n \n }", "protected void method_3848() {\r\n super.method_3848();\r\n }", "public final void mo51373a() {\n }", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "public abstract void mo30696a();", "@Override\n public void get() {}", "public void method_4270() {}", "private Infer() {\n\n }", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n\tpublic void leti() \n\t{\n\t}", "@Override\n\tpublic void modify() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "private void m50366E() {\n }", "private Get() {}", "private Get() {}", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "@Override\n\tpublic void verkaufen() {\n\t}", "public abstract String mo41079d();", "public abstract void m15813a();", "public abstract Object mo1771a();", "public abstract void mo27464a();", "public void gored() {\n\t\t\n\t}", "public abstract void mo35054b();", "public abstract String mo118046b();", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic int method() {\n\t\treturn 0;\n\t}", "public abstract void mo42329d();", "public void method_6349() {\r\n super.method_6349();\r\n }", "public abstract String mo13682d();", "private TMCourse() {\n\t}", "protected void method_2665() {\r\n super.method_2427(awt.field_4171);\r\n this.method_2440(true);\r\n this.method_2521(class_872.field_4244);\r\n }", "private MigrationInstantiationUtil() {\n\t\tthrow new IllegalAccessError();\n\t}", "@Override\n public boolean isPrivate() {\n return true;\n }", "@Override\n public void init() {\n\n }", "protected FanisamBato(){\n\t}", "public /* bridge */ /* synthetic */ void mo55096c() {\n super.mo55096c();\n }", "@Override\n void init() {\n }", "@Override\r\n\tpublic void member() {\n\t\t\r\n\t}", "public void myPublicMethod() {\n\t\t\n\t}", "public abstract Object mo1185b();", "protected Problem() {/* intentionally empty block */}", "public void mo21779D() {\n }", "@Override\n public void init() {\n }", "public /* bridge */ /* synthetic */ void mo55094a() {\n super.mo55094a();\n }", "abstract int pregnancy();", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "public abstract void mo42331g();", "@Override\n\tpublic void nghe() {\n\n\t}" ]
[ "0.73623323", "0.69830847", "0.68941706", "0.6798817", "0.67315143", "0.67264825", "0.67049384", "0.6551554", "0.65256643", "0.65247214", "0.64783233", "0.6459452", "0.644003", "0.6434508", "0.641292", "0.64095944", "0.64055127", "0.64055127", "0.6402614", "0.64020926", "0.6393029", "0.63912094", "0.63859856", "0.6384489", "0.6383653", "0.6380349", "0.6380349", "0.63279754", "0.6313872", "0.6292485", "0.6291318", "0.62806165", "0.62501454", "0.62501454", "0.62484556", "0.62161934", "0.6215408", "0.62054044", "0.6194926", "0.61860305", "0.6176722", "0.6148199", "0.61227506", "0.61191195", "0.6106887", "0.6105869", "0.60996646", "0.60863525", "0.6085324", "0.60816956", "0.60758764", "0.6070361", "0.60618234", "0.6060162", "0.6033592", "0.60312134", "0.60226506", "0.6021987", "0.6021259", "0.601888", "0.60173005", "0.60126936", "0.60126936", "0.6007756", "0.6007756", "0.6006481", "0.60035807", "0.6002446", "0.59910554", "0.59904367", "0.5986164", "0.59818316", "0.5979646", "0.5968579", "0.5962536", "0.59501475", "0.5950128", "0.59459466", "0.5935737", "0.5928706", "0.5926807", "0.59261245", "0.59209156", "0.5917089", "0.591341", "0.59093", "0.5907795", "0.59040606", "0.5900644", "0.5891739", "0.5888383", "0.58880633", "0.5888005", "0.58879685", "0.5887258", "0.5887091", "0.5885097", "0.58847475", "0.58776057", "0.5876178", "0.5876079" ]
0.0
-1
/ Access modifiers changed, original: protected
public void onAttachedToWindow() { super.onAttachedToWindow(); if (this.e != null) { a(this.e.getCurrentItem(), 0); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void prot() {\n }", "private stendhal() {\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "private Rekenhulp()\n\t{\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "public abstract Object mo26777y();", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "protected abstract Set method_1559();", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "private abstract void privateabstract();", "private PropertyAccess() {\n\t\tsuper();\n\t}", "protected void h() {}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public abstract void mo27386d();", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "public abstract void mo70713b();", "@Override\n\tprotected void getExras() {\n\n\t}", "protected Doodler() {\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "public abstract void mo56925d();", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "public void smell() {\n\t\t\n\t}", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "public abstract void mo27385c();", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "@Override\n protected void getExras() {\n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\r\n\tpublic void smthAbstr() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "protected void method_3848() {\r\n super.method_3848();\r\n }", "@Override\n public void memoria() {\n \n }", "public final void mo51373a() {\n }", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\t\t\t\tpublic void a() {\n\n\t\t\t\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "public abstract void mo30696a();", "@Override\n public void get() {}", "public void method_4270() {}", "private Infer() {\n\n }", "@Override\n\tpublic void leti() \n\t{\n\t}", "@Override\r\n\t\t\tpublic void buscar() {\n\r\n\t\t\t}", "@Override\n\tpublic void modify() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void func02() {\n\t\t\t\t\r\n\t\t\t}", "private void m50366E() {\n }", "private Get() {}", "private Get() {}", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "@Override\n\tpublic void verkaufen() {\n\t}", "public abstract String mo41079d();", "public abstract void m15813a();", "public abstract void mo27464a();", "public abstract Object mo1771a();", "public void gored() {\n\t\t\n\t}", "public abstract void mo35054b();", "public abstract String mo118046b();", "@Override\n\tpublic void erstellen() {\n\t\t\n\t}", "@Override\n\tpublic void dibuja() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic int method() {\n\t\treturn 0;\n\t}", "public abstract void mo42329d();", "public void method_6349() {\r\n super.method_6349();\r\n }", "public abstract String mo13682d();", "protected void method_2665() {\r\n super.method_2427(awt.field_4171);\r\n this.method_2440(true);\r\n this.method_2521(class_872.field_4244);\r\n }", "private TMCourse() {\n\t}", "private MigrationInstantiationUtil() {\n\t\tthrow new IllegalAccessError();\n\t}", "@Override\n public boolean isPrivate() {\n return true;\n }", "@Override\n public void init() {\n\n }", "protected FanisamBato(){\n\t}", "public /* bridge */ /* synthetic */ void mo55096c() {\n super.mo55096c();\n }", "@Override\n void init() {\n }", "@Override\r\n\tpublic void member() {\n\t\t\r\n\t}", "public void myPublicMethod() {\n\t\t\n\t}", "@Override\n public void init() {\n }", "abstract int pregnancy();", "public abstract Object mo1185b();", "public /* bridge */ /* synthetic */ void mo55094a() {\n super.mo55094a();\n }", "protected Problem() {/* intentionally empty block */}", "public void mo21779D() {\n }", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "public abstract void mo42331g();", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}" ]
[ "0.7364149", "0.6983697", "0.6894897", "0.68000275", "0.67330915", "0.67271525", "0.6705304", "0.6552741", "0.6526719", "0.6525501", "0.64800584", "0.6459902", "0.6441492", "0.6434852", "0.64129364", "0.64103013", "0.6406338", "0.6406338", "0.64056695", "0.6403243", "0.6394464", "0.6391666", "0.6387465", "0.63856626", "0.6384291", "0.6380622", "0.6380622", "0.63292044", "0.6314472", "0.6292876", "0.6292298", "0.6282146", "0.6249924", "0.6249924", "0.62484664", "0.6217445", "0.62168986", "0.62060344", "0.61936903", "0.61862963", "0.61772025", "0.61491126", "0.61252797", "0.6119485", "0.610739", "0.6107105", "0.6097613", "0.6088199", "0.6085442", "0.60823756", "0.6077856", "0.6070822", "0.60633695", "0.6060959", "0.603318", "0.60328007", "0.60238063", "0.6023302", "0.60218155", "0.60190666", "0.6016679", "0.6012982", "0.6012982", "0.6007684", "0.6007684", "0.6007355", "0.6005541", "0.6003537", "0.59915483", "0.5990943", "0.5986599", "0.5983226", "0.5981397", "0.59702146", "0.59630275", "0.59503585", "0.59496474", "0.5947279", "0.5937463", "0.5930279", "0.5927117", "0.592703", "0.5919249", "0.591669", "0.5915296", "0.5909692", "0.5909442", "0.59057814", "0.5901382", "0.5892636", "0.58897257", "0.58893085", "0.58892006", "0.5888576", "0.5888309", "0.5887905", "0.5885764", "0.5885703", "0.5877917", "0.5877588", "0.58770937" ]
0.0
-1
TODO Autogenerated method stub
@Override public boolean addNewUser(User user) { return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Compose a new tweet.
public void postTweet(int userId, int tweetId) { if (!tweets.containsKey(userId)) { //build one's tweet list tweets.put(userId, new LinkedList<>()); //follow himself follow(userId, userId); } //add new tweet on the first place tweets.get(userId).add(0, new Tweet(tweetId, timeStamp++)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void composeTweet(Tweet tweet, AsyncHttpResponseHandler handler) {\n String apiUrl = getApiUrl(\"statuses/update.json\");\n RequestParams params = new RequestParams();\n\n params.put(\"status\", tweet.getBody());\n params.put(\"in_reply_to_status_id\", tweet.getInReplyToStatusId());\n\n // Execute the request\n getClient().post(apiUrl, params, handler);\n }", "private void composeTweet() {\n if(NetworkUtils.isConnectedToNetwork((ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE)) == false) {\n Toast.makeText(this.getApplicationContext(), \"Please check your network connection!\", Toast.LENGTH_LONG).show();\n return;\n }\n Intent i = new Intent(this, ComposeActivity.class);\n startActivityForResult(i, REQ_CODE_COMPOSE_TWEET);\n }", "void makeTweet(OnTweetPostListener onTweetPostListener);", "public void onTweetClicked(View v) {\n String tweetText = tweetInput.getText().toString();\n RestClient client = TwitterClientApp.getRestClient();\n client.postTweet(tweetText, new JsonHttpResponseHandler() {\n @Override\n public void onSuccess(JSONObject jsonObject) {\n // Parse tweet and finish activity\n Tweet twt = new Tweet(jsonObject);\n twt.save();\n Intent result = new Intent();\n result.putExtra(EXTRA_TWEET, twt);\n setResult(RESULT_OK, result);\n finish();\n }\n\n @Override\n public void onFailure(Throwable throwable, JSONObject jsonObject) {\n super.onFailure(throwable, jsonObject);\n Log.e(\"ComposeTweetActivity\", \"Error occurred\");\n finish();\n }\n\n });\n }", "private void makeTweet(String text) {\n\t\tassertNotNull(activity.findViewById(ca.ualberta.cs.lonelytwitter.R.id.save));\n\t\ttextInput.setText(text);\n\t\t((Button) activity.findViewById(ca.ualberta.cs.lonelytwitter.R.id.save)).performClick();\n\t}", "public void tweet() {\r\n try {\r\n\r\n String twet = JOptionPane.showInputDialog(\"Tweett:\");\r\n Status status = twitter.updateStatus(twet);\r\n System.out.println(\"Successfully updated the status to [\" + status.getText() + \"].\");\r\n } catch (TwitterException ex) {\r\n java.util.logging.Logger.getLogger(MetodosTwit.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }", "public void tweet(String message) {\n\t\twait.until(ExpectedConditions.visibilityOf(composeBtn));\n\t\tcomposeBtn.click();\n\t\ttextBox.clear();\n\t\ttextBox.sendKeys(message);\n\t\tsendBtn.click();\n\t}", "public void postTweet(int userId, int tweetId) {\n\n }", "@Override\n\tpublic void tweet(String message) throws Exception {\n\t\t\n\t}", "private void composeTwoot() {\n new ComposeTwootPage(details, client);\n }", "public void onTweetSuccess(Tweet tweet);", "private void shareToTwitter(Context context, Uri uri) {\n Toast.makeText(context, \"start sharing to twitter \" + uri.getPath(), Toast.LENGTH_SHORT).show();\n String twitterPackage = \"com.twitter.android\";\n if (AppUtil.getInstance().isAppInstalled(context, twitterPackage)) {\n Intent intent = new Intent(Intent.ACTION_SEND);\n intent.putExtra(Intent.EXTRA_STREAM, uri);\n intent.putExtra(Intent.EXTRA_TEXT, \"the simple text\");\n intent.setType(\"image/*\");\n intent.setPackage(twitterPackage);\n context.startActivity(intent);\n\n //using Twitter Tweet Composer\n //The Twitter Android Application allows apps to start the exported Tweet composer via an Intent.\n //The Twitter Android compose is feature-rich, familiar to users, and has options for attaching images and videos.\n //If the Twitter app is not installed, the intent will launch twitter.com in a browser, but the specified image will be ignored.\n// TweetComposer.Builder builder = new TweetComposer.Builder(this)\n// .text(\"just setting up my Fabric.\")\n// .image(uri);\n// builder.show();\n\n } else {\n //The TwitterKit Tweet Composer (Beta) is a lightweight composer which lets users compose Tweets with App Cards from within your application.\n // It does not depend on the Twitter for Android app being installed.\n\n// Card card = new Card.AppCardBuilder(MainActivity.this)\n// .imageUri(uri)\n// .iPhoneId(\"123456\")\n// .iPadId(\"654321\")\n// .build();\n//\n// TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();\n// Intent intent = new ComposerActivity.Builder(MainActivity.this).session(session).card(card).createIntent();\n// startActivity(intent);\n Toast.makeText(context, \"to use this feature, you must have an Twitter application is installed\", Toast.LENGTH_SHORT).show();\n }\n }", "@Override\n public void success(Result<TwitterSession> result) {\n String username=result.data.getUserName();\n\n Toast.makeText(MainActivity.this,\"Hi.. \"+username,Toast.LENGTH_LONG).show();\n\n\n TwitterSession session = TwitterCore.getInstance().getSessionManager()\n .getActiveSession();\n\n Intent intent = new Intent(MainActivity.this,ComposeTweetActivity.class);\n\n startActivity(intent);\n\n /* TwitterSession session = TwitterCore.getInstance().getSessionManager()\n .getActiveSession();\n\n Intent intent = new ComposerActivity.Builder(MainActivity.this)\n .session(session)\n .createIntent();\n startActivity(intent); */\n\n\n\n\n }", "private Tweet() {\n this(\"\", -1, \"\", false);\n }", "public void onClickTwitt() {\n// if (isNetworkAvailable()) {\n// Twitt_Sharing twitt = new Twitt_Sharing(MainActivity.this,\n// StaticConstants.consumer_key, StaticConstants.secret_key);\n// //string_img_url = \"http://3.bp.blogspot.com/_Y8u09A7q7DU/S-o0pf4EqwI/AAAAAAAAFHI/PdRKv8iaq70/s1600/id-do-anything-logo.jpg\";\n// string_msg = \"\";\n// // here we have web url image so we have to make it as file to\n// // upload\n// //String_to_File(string_img_url);\n// // Now share both message & image to sharing activity\n// new Twitter_Handler(MainActivity.this, StaticConstants.consumer_key, StaticConstants.secret_key).resetAccessToken();\n// //twitt.shareToTwitter(string_msg, casted_image);\n// twitt.authenticateAndSaveAccessToken();\n//\n// } else {\n// showToast(\"No Network Connection Available ...\");\n// }\n final Context context = MainActivity.this;\n AlertDialog.Builder alert = new AlertDialog.Builder(context);\n\n alert.setTitle(\"Authenticate\");\n alert.setMessage(\"Enter you twitter account credentials.\");\n\n // Set an EditText view to get user input\n final EditText username = new EditText(context);\n username.setHint(\"Username\");\n username.setText(sharedPreferences.getString(StaticConstants.TWITTER_USERNAME_KEY, \"\"));\n final EditText password = new EditText(context);\n password.setInputType(129);\n password.setHint(\"Password\");\n password.setText(sharedPreferences.getString(StaticConstants.TWITTER_PASSWORD_KEY, \"\"));\n final TextView usernameLabel = new TextView(context);\n usernameLabel.setTextColor(Color.WHITE);\n usernameLabel.setText(\"Enter Twitter Username:\");\n final TextView passwordLabel = new TextView(context);\n passwordLabel.setTextColor(Color.WHITE);\n passwordLabel.setText(\"Enter Twitter Password:\");\n final TextView errmsgLabel = new TextView(context);\n errormsglabel = errmsgLabel;\n LinearLayout layout = new LinearLayout(context);\n layout.setOrientation(LinearLayout.VERTICAL);\n\n\n layout.addView(usernameLabel);\n layout.addView(username);\n layout.addView(passwordLabel);\n layout.addView(password);\n layout.addView(errmsgLabel);\n alert.setView(layout);\n\n alert.setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int whichButton) {\n errmsgLabel.setText(\"\");\n String uname = username.getText().toString();\n String pwd = password.getText().toString();\n if(!isNetworkAvailable()){\n new ToastMessageTask().execute(\"Network not available. Please try again!\");\n onClickTwitt();\n return;\n }\n if(uname!=null && uname.length()!=0 &&pwd!=null && pwd.length()!=0){\n new OnClickTwittClass().execute(uname,pwd);\n }\n else{\n new ToastMessageTask().execute(\"Invalid username/password.Please add again.\");\n }\n }\n });\n\n alert.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int whichButton) {\n // Canceled.\n dialog.cancel();\n }\n });\n\n alert.show();\n }", "public Tweet(String message){\n this.message = message;\n this.date = new Date();\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n if ((accounts.size() == 0) || (jTextAreaTweets.getText() == null || jTextAreaTweets.getText().length() == 0)) {\n int mc = JOptionPane.WARNING_MESSAGE;\n JOptionPane.showMessageDialog(null, \"Add an account/tweet/mention to tweet!!\", \"Attention!!\", mc);\n } else {\n String ids = jTextAreaId.getText();\n String lines[] = ids.split(\"\\\\r?\\\\n\");\n if (lines.length > 0) {\n for (String str : lines) {\n if (str != null && str.length() > 0) {\n tagIDList.add(str);\n }\n }\n } else {\n }\n if (tagIDList.size() > 0) {\n\n for (String mention : tagIDList) {\n for (String tweet : tweetList) {\n String tempTweet = tweet + \" \" + mention;\n mentionStack.push(tempTweet);\n }\n }\n\n } else {\n for (String tweet : tweetList) {\n String tempTweet = tweet;\n mentionStack.push(tempTweet);\n }\n }\n ArrayList<Thread> threads = new ArrayList<Thread>();\n long timeIntervalNumber = 1000 * 60;\n long timeIntervalNumberMax = 1000 *60*3;\n try {\n timeIntervalNumber = Long.parseLong(timeIntervalInput.getText()) * 1000;\n if (timeIntervalNumber < 60000)\n timeIntervalNumber = 1000 * 60;\n\n\n } catch (Exception e1) {\n e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n }\n try{\n timeIntervalNumberMax = Long.parseLong(timeIntervalInputMax.getText()) * 1000;\n if (timeIntervalNumberMax < 60000)\n timeIntervalNumberMax = 1000 * 60;\n }catch(Exception ex){\n ex.printStackTrace();\n }\n if(timeIntervalInput==timeIntervalInputMax)\n timeIntervalNumberMax+=30;\n for (Account account : accounts) {\n\n TweeterThread tweeterThread = new TweeterThread(mentionStack,\n account, accountDispName,\n statusDisplay, timeIntervalNumber<timeIntervalNumberMax?timeIntervalNumber:timeIntervalNumberMax,\n timeIntervalNumber>timeIntervalNumberMax?timeIntervalNumber:timeIntervalNumberMax,\n tweetLog, f1);\n Thread t = new Thread(tweeterThread);\n t.start();\n nThreads++;\n threads.add(t);\n }\n\n }\n }", "public Tweet(String message){\n this.message = message;\n this.Unique = UUID.randomUUID();\n }", "public void tweet() {\n ReusableActionsPageObjects.clickOnElement(driver, tweet, logger, \"tweet.\");\n }", "public synchronized void send(Tweet tweet) {\n\t\t// The EventBuilder is used to build an event using the\n\t\t// the raw JSON of a tweet\n\t\t// LOGGER.info(status.getUser().getScreenName() + \": \" +\n\t\t// status.getText());\n\n\t\t// create object to be send\n\t\tStreamItem si = new StreamItem();\n\t\t// si.setDataChannelId(dataChannelId);\n\t\t// si.setDataSourceId(dataSourceId);\n\t\t// si.setQueryData(query);\n\t\tsi.setTweet(tweet);\n\n\t\tWriter writer = new StringWriter();\n\n\t\t// serialize the java class to XML file\n\t\ttry {\n\t\t\t//JAXBContext jc = JAXBContext.newInstance(StreamItem.class);\n\t\t\t//Marshaller marshaller = jc.createMarshaller();\n\t\t\t// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\t\t\tJAXBElement<StreamItem> jaxbElement = new JAXBElement<StreamItem>(new QName(\"streamItem\"), StreamItem.class, si);\n\t\t\tmarshaller.marshallToJSON(jaxbElement, writer);\n\t\t\t\n\t\t\t// KeyedMessage<String, String> data = new KeyedMessage<String,\n\t\t\t// String>(kafkaTopic, DataObjectFactory.getRawJSON(status));\n\t\t\tKeyedMessage<String, String> data = new KeyedMessage<String, String>(kafkaTopic, writer.toString());\n\n\t\t\tkafkaProducer.send(data);\n\t\t} catch (JAXBException e) {\n\t\t\tLOGGER.info(\"Tweet serialisation error! \" + e);\n\t\t\tLOGGER.log(Level.SEVERE, e.getMessage(), e);\n\t\t\te.printStackTrace();\n\t\t} catch (Exception e) {\n\t\t\tLOGGER.info(\"Stream producer: Error while sending tweet! \");\n\t\t\tLOGGER.log(Level.SEVERE, e.getMessage(), e);\n\t\t\te.printStackTrace();\n\t\t}\n\n\n\t}", "public Twitter() {\n \n }", "public void postTweet(int userId, int tweetId) {\n tweetList.add(new Tweet(tweetId, userId));\n }", "public interface ComposeTweetListener {\n // This can be any number of events to be sent to the activity\n public void onTweetSuccess(Tweet tweet);\n }", "public void getTweets() {\r\n\t\t\r\n\t\tConfigurationBuilder cb = new ConfigurationBuilder();\r\n\t\tcb.setDebugEnabled(true);\r\n\t\t\r\n\t\t//provide your own keys\r\n\t cb.setOAuthConsumerKey(\"ConsumerKey\");\r\n\t cb.setOAuthConsumerSecret(\"ConsumerSecret\");\r\n\t cb.setOAuthAccessToken(\"AccessToken\");\r\n\t cb.setOAuthAccessTokenSecret(\"TokenSecret\");\r\n\r\n TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance(); \r\n \r\n //Check for live status updates\r\n StatusListener listener = new StatusListener() {\r\n\r\n @Override\r\n public void onException(Exception arg0) {\r\n \tSystem.out.println(\"Exception!! Data Not Inserted Into Database\");\r\n }\r\n\r\n @Override\r\n public void onDeletionNotice(StatusDeletionNotice arg0) {\r\n \tSystem.out.println(\"Got a status deletion notice id:\" + arg0.getStatusId());\r\n }\r\n \r\n @Override\r\n public void onScrubGeo(long userId, long upToStatusId) {\r\n System.out.println(\"Got scrub_geo event userId:\" + userId + \" upToStatusId:\" + upToStatusId);\r\n }\r\n \r\n @Override\r\n public void onStatus(Status status) {\r\n \t\r\n \t User user = status.getUser();\r\n \t \r\n String username = status.getUser().getScreenName();\r\n String profileLocation = user.getLocation();\r\n long tweetId = status.getId(); \r\n String content = status.getText();\r\n \r\n \r\n //Create a model for the live data\r\n TweetModel memoryData = new TweetModel(username, profileLocation, tweetId, content);\r\n \r\n //store to MongoDB if data is correct\r\n System.out.println(++counter + \") username: \" + username + \" location: \" + profileLocation + \" tweetId \" + tweetId + \" Text: \" + content );\r\n data.save(memoryData);\r\n }\r\n \r\n\t\t\t@Override\r\n public void onTrackLimitationNotice(int arg0) {\r\n\t System.out.println(\"Got track limitation notice:\" + arg0);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t@Override\r\n\t\t\tpublic void onStallWarning(StallWarning warning) {}\r\n };\r\n \r\n //Filter the live tweet results\r\n FilterQuery filterQuery = new FilterQuery();\r\n //Search for tweets with specific keywords\r\n String keywords[] = {\"Java\", \"Python\", \"PHP\"};\r\n //Restrict the language to English\r\n String[] lang = {\"en\"}; \r\n //Add the Filters\r\n filterQuery.language(lang);\r\n filterQuery.track(keywords);\r\n //Listen for Live Tweets\r\n twitterStream.addListener(listener);\r\n twitterStream.filter(filterQuery);\r\n\t}", "public Tweet(){\n super();\n }", "public void tweetButton() {\n ReusableActionsPageObjects.clickOnElement(driver, tweetButton, logger, \"tweet.\");\n }", "public void addTweet (Tweet tweet) throws IllegalArgumentException{\n tweets.add(tweet);\n\n }", "@RequestMapping(\"/comment/createtweet\")\n @CrossOrigin\n int createtweet(@RequestParam int uid, @RequestParam String tweettext);", "public static Twitter crearTwitter(){\n \tConfigurationBuilder cb = new ConfigurationBuilder();\n \tcb.setDebugEnabled(true)\n \t .setOAuthConsumerKey(\"WX0FvnWENusasa09R8IVG6FFm\")\n \t .setOAuthConsumerSecret(\"Z6cXLTiqkU6NvlhqEHD7Br3S0jhmtUiLPvOPXCqLcrhQKFMYNr\")\n \t .setOAuthAccessToken(\"509341639-6R41f6i6WUAQn1xfzI8uNbPeyIhQvkMnXYaszNv6\")\n \t .setOAuthAccessTokenSecret(\"We08mCgnLMPXn6zl8UrKwGegac0Z4ksrI0LwhAbBoxp5q\");\n \tTwitterFactory tf = new TwitterFactory(cb.build());\n \treturn tf.getInstance();\n\t}", "public void postTweet(int userId, int tweetId) {\n size++;\n Tweet newTweet = new Tweet(tweetId, size);\n User target = null;\n for (User user : users) {\n if (user.id == userId) {\n target = user;\n break;\n }\n }\n if (target == null) {\n target = new User(userId);\n users.add(target);\n }\n target.tweetList.add(newTweet);\n }", "@Override\n public void run() {\n String finalString = \"\";\n String str;\n while (true) {\n try {\n str = tweets.pop();\n finalString += (str + \"\\n\");\n } catch (Exception e) {\n break;\n }\n }\n AddFormWin.clearTweetStack();\n tweetLog.setText(tweetLog.getText() +\n \"\\nFailed to send the following tweets:\\n\" + finalString);\n JOptionPane.showMessageDialog(null, \"Tweet Sending Failed!\"\n , \"Failure!!\", JOptionPane.WARNING_MESSAGE);\n\n }", "public Twitter() {\n followees = new HashMap<>();\n tweetList = new ArrayList<>();\n }", "public Twitter() {\r\n\t\t\ttweet = new HashMap<Integer, List<twi>>(100);\r\n\t\t\tfollower = new HashMap<Integer, List<Integer>>(100);\r\n\t\t\ttimeStamp = 0;\r\n\t\t}", "private void _tweetShare(Activity act, String title, String description)\n {\n try {\n Intent shareIntent = new Intent(Intent.ACTION_SEND);\n shareIntent.setType(\"text/plain\");\n shareIntent.setPackage(\"com.twitter.android\");\n shareIntent.putExtra(Intent.EXTRA_TITLE, title);\n shareIntent.putExtra(Intent.EXTRA_TEXT, description);\n act.startActivity(shareIntent);\n } catch (ActivityNotFoundException ex) {\n String tweetUrl = StringUtils.join(\" \",\"https://twitter.com/intent/tweet?text=\", title, description);\n Uri uri = Uri.parse(tweetUrl);\n act.startActivity(new Intent(Intent.ACTION_VIEW, uri));\n }\n }", "public void postTweet(int userId, int tweetId) {\n Tweet tweet = new Tweet(tweetId, System.nanoTime());\n putSelfTweet(userId, tweet);\n if (userId2Followers.containsKey(userId)) {\n Set<Integer> followers = userId2Followers.get(userId);\n for (Integer followerId : followers) {\n putFollowerTweet(followerId, tweet);\n }\n }\n }", "public void post(Tweet newTweet) {\n newTweet.next = tweetHead;\n tweetHead = newTweet;\n }", "@Override\n public void run() {\n tweetLog.setText(tweetLog.getText() + tweets.size() + \" [\" + mention\n + \"] sent successfully from account @\" + account.screenName + \"\\n\");\n// frame.validate();\n// frame.pack();\n }", "public void postTweet(int userId, int tweetId) {\n User user = getOrCreateUser(userId);\n Tweet tweet = new Tweet(tweetId);\n user.myTweets.add(tweet);\n }", "private void showComponseTweetDialog() {\n FragmentManager manager = getSupportFragmentManager();\n FragmentTransaction ft = manager.beginTransaction();\n\n //set the dilaog framgment\n DialogFragment newFragment = ComposeTweetDialog.newInstance(new ComposeTweetDialog.ComposeTweetDialogListner() {\n @Override\n public void onTweet(String text) {\n if (text != null && !text.isEmpty()) {\n Fragment f = adapterViewPager.getRegisteredFragment(0);\n PageFragment pageFragment = (PageFragment) adapterViewPager.getRegisteredFragment(viewPager.getCurrentItem());\n\n pageFragment.postTheUserTweetOnTheList(text);\n }\n }\n });\n newFragment.show(ft, \"TWEET_DIALOG\");\n }", "public void postTweet(int userId, int tweetId) {\r\n\t\t\ttwi twitt = new twi(userId, tweetId, timeStamp++);\r\n\t\t\tList<twi> list = tweet.get(userId);\r\n\t\t\tif (list == null) {\r\n\t\t\t\tlist = new ArrayList<twi>();\r\n\t\t\t\tlist.add(twitt);\r\n\t\t\t\ttweet.put(userId, list);\r\n\t\t\t} else {\r\n\t\t\t\tif (list.size() == 10) {\r\n\t\t\t\t\tlist.remove(0);\r\n\t\t\t\t}\r\n\t\t\t\tlist.add(twitt);\r\n\t\t\t}\r\n\t\t\tList<Integer> friend = follower.get(userId);\r\n\t\t\tif (friend == null) {\r\n\t\t\t\tfriend = new LinkedList<Integer>();\r\n\t\t\t\tfriend.add(userId);\r\n\t\t\t\tfollower.put(userId, friend);\r\n\t\t\t}\r\n\t\t}", "public Twitter() {\n }", "public Tweet(String message, Date date){\n this.message = message;\n this.date = date;\n\n }", "public Twitter() {\n\n }", "TwitterResourceProvider(final IndexableTweets indexableTweets) throws IOException {\r\n tweets = new Stack<>();\r\n clones = indexableTweets.getClones();\r\n TwitterTemplate twitterTemplate = new TwitterTemplate( //\r\n indexableTweets.getConsumerKey(), //\r\n indexableTweets.getConsumerSecret(), //\r\n indexableTweets.getToken(), //\r\n indexableTweets.getTokenSecret());\r\n StreamingOperations streamingOperations = twitterTemplate.streamingOperations();\r\n StreamListener streamListener = new StreamListener() {\r\n\r\n final AtomicInteger counter = new AtomicInteger();\r\n final AtomicInteger deleted = new AtomicInteger();\r\n\r\n @Override\r\n public void onTweet(final Tweet tweet) {\r\n if (tweets.size() < 10000) {\r\n tweets.push(tweet);\r\n }\r\n if (counter.incrementAndGet() % 1000 == 0) {\r\n logger.info(\"Tweets received : \" + counter.get() + \", tweet cache : \" + tweets.size() + \", tweet : \" + ToStringBuilder.reflectionToString(tweet));\r\n }\r\n }\r\n\r\n @Override\r\n public void onDelete(final StreamDeleteEvent streamDeleteEvent) {\r\n if (deleted.incrementAndGet() % 1000 == 0) {\r\n logger.info(\"Deleted : \" + deleted.get() + \", event : \" + ToStringBuilder.reflectionToString(streamDeleteEvent));\r\n }\r\n }\r\n\r\n @Override\r\n public void onLimit(final int i) {\r\n logger.info(\"Limit : \" + i);\r\n }\r\n\r\n @Override\r\n public void onWarning(final StreamWarningEvent streamWarningEvent) {\r\n logger.info(\"Warning : \" + streamWarningEvent);\r\n }\r\n };\r\n List<StreamListener> listeners = Collections.singletonList(streamListener);\r\n stream = streamingOperations.sample(listeners);\r\n }", "public List<TweetDto> tweets(String username) {\n\t\tList<Tweet> convert = userRepository.findByUname(username).getTweets();\n\n\t\tList<TweetDto> dto = new ArrayList<>();\n\t\tfor(Tweet check : convert){\n\t\t\tswitch (check.getType()) {\n\t\t\tcase \"simple\":\n\t\t\t\tdto.add(tweetMapper.toSimpleDto(check));\n\t\t\t\tbreak;\n\t\t\tcase \"reply\":\n\t\t\t\tdto.add(tweetMapper.toReplyDto(check));\n\t\t\t\tbreak;\n\t\t\tcase \"repost\":\n\t\t\t\tdto.add(tweetMapper.toRepostDto(check));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tCollections.sort(dto, new TweetCompare());\n\t\tCollections.reverse(dto);\n\t\treturn dto;\n\t}", "public Twitter() {\n size = 0;\n users = new ArrayList<>();\n }", "public postTweet_args(postTweet_args other) {\n if (other.isSetTweet()) {\n this.tweet = new Tweet(other.tweet);\n }\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tif(!loggedIn){\n\t\t\t\t\tLog.d(\"POST FAILED\",\"NOT LOGGED IN\");\n\t\t\t\t}\n\t\t\t\tTweet tweet = new Tweet(text);\n\t\t\t\tTweetER ter = TweetER.getInstance(accntMgr);\n\t\t\t\ttry {\n\t\t\t\t\ttweet = ter.post(tweet);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t} catch (LimitExceededException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\t}", "@Override\n public void actionPerformed(ActionEvent e) {\n String text = tweetInsertTextBox.getText();\n if (text != null && text.length() > 0) {\n jTextAreaTweets.setText(jTextAreaTweets.getText() + text + \"\\n\");\n tweetInsertTextBox.setText(\"\");\n jTextAreaTweets.setRows(jTextAreaTweets.getLineCount());\n tweetList.add(text);\n //f1.validate();\n }\n }", "public void writeTweet(String tweet)\r\n\t{\n\t\ttweets.add(tweet);//adds the tweet to the tweets list\r\n\t\tnotifyObservers(tweet);//notifies observers of the tweet\r\n\t\tupdateTweet(tweet);//updates the tweet\r\n\t}", "public void postTweet(int userId, int tweetId) {\n tweets.put(tweetId, idx++);\n LinkedList<Integer> tweets = userToTwitter.computeIfAbsent(userId, e -> new LinkedList<>());\n tweets.addLast(tweetId);\n while (tweets.size() > 10) {\n tweets.removeFirst();\n }\n }", "@Override\n\tpublic void publishTweet(int id) {\n\t\ttweetDao.publishTweet(id);\n\t\t\n\t\t//Find The Tweet\n\t\tTweet aTweet = tweetDao.findTweetById(id);\n\t\t\n\t\t//publish it to twitter\n\t\t\n\t\tpublishTweetToTwitter(aTweet.getContent());\n\t\t\n\t}", "public void postTweet(int userId, int tweetId) {\n if(!users.containsKey(userId)){\n HashSet<Integer> uId = new HashSet<>(); // if the user Id is not there, how will it post the tweet?\n users.put(userId, uId); // Add the user to the database first\n }\n users.get(userId).add(userId);\n if(!tweets.containsKey(userId)){\n List<Tweet> t_id = new ArrayList<>();\n t_id.add(new Tweet(timestamp++, tweetId)); // Similarly add the same user with the tweet object\n tweets.put(userId, t_id);\n } else {\n tweets.get(userId).add(new Tweet(timestamp++, tweetId)); // User is tweeting more nowadays\n }\n }", "@Override\n \tpublic void onClick (View v)\n \t{\n \t\tString status = editText.getText().toString();\n \t\tnew PostToTwitter().execute(status);\n \t}", "@Override\n\tpublic void configure() throws Exception {\n from(\"scst:input\")\n\n // and we'll tweet that out here.\n\n // wanna see it in action?\n // just retweet this tweet!\n\n // thanks!\n .to(\"twitter:timeline/user\");\n\t}", "public static void run() throws TwitterException,\n\t\t\tSQLException, IOException {\n\t\t// just fill this\n\t\tConfigurationBuilder cb = new ConfigurationBuilder();\n\t\tcb.setDebugEnabled(true)\n\t\t\t\t.setOAuthConsumerKey(\"*\")\n\t\t\t\t.setOAuthConsumerSecret(\n\t\t\t\t\t\t\"*\")\n\t\t\t\t.setOAuthAccessToken(\n\t\t\t\t\t\t\"*-*\")\n\t\t\t\t.setOAuthAccessTokenSecret(\n\t\t\t\t\t\t\"*\");\n\n\t\tAWSCredentials credentials = new PropertiesCredentials(\n\t\t\t\tTweetGet.class.getResourceAsStream(\"AwsCredentials.properties\"));\n\t\tMysqlDataSource dataSource = new MysqlDataSource();\n\t\tdataSource.setUser(\"*\");\n\t\tdataSource.setPassword(\"*\");\n\t\tdataSource.setPort(3306);\n\t\tdataSource.setDatabaseName(\"TwitterDB\");\n\t\tdataSource\n\t\t\t\t.setServerName(\"*.rds.amazonaws.com\");\n\t\tConnection conn = null;\n\t\ttry {\n\t\t\tconn = dataSource.getConnection();\n\t\t} catch (SQLException e1) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te1.printStackTrace();\n\t\t}\n\t\tfinal Statement sqlStatement = conn.createStatement();\n\t\t\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"===========================================\");\n\t\t\tSystem.out.println(\"Connecting to Twitter\");\n\t\t\tSystem.out.println(\"===========================================\\n\");\n\t\t\tTwitterStream twitterStream = new TwitterStreamFactory(cb.build())\n\t\t\t.getInstance();\n\n\tStatusListener listener = new StatusListener() {\n\t\t@Override\n\t\tpublic void onStatus(Status status) {\n\n\t\t\t\n\t\t\tif (status.getLang().equals(\"en\")) {\n\n\t\t\t\tString user_id = String.valueOf(status.getUser().getId());\n\t\t\t\tString created_at = String.valueOf(status.getCreatedAt());\n\t\t\t\tGeoLocation geo = status.getGeoLocation();\n\n\t\t\t\tif (geo != null) {\n\t\t\t\t\tString lon = String.valueOf(geo.getLongitude());\n \t\tString lat = String.valueOf(geo.getLatitude());\n \t\tString lon_lat = lon+\",\"+lat;\n \t\tString originaltext = status.getText();\n \t\tString[] words = originaltext.split(\"\\\\s\");\n \t\tStringBuffer message = new StringBuffer();\n \t\tfor(String word:words){\n \t\t\tif (word.contains(\"@\") || word.contains(\"#\") || word.contains(\"http\")){\n \t\t\t\t\n \t\t\t}\n \t\t\telse\n \t\t\t{\n \t\t\t\tif(word.contains(\"'\")){\n\t\t\t\t\t\t\t\tword = word.replace(\"'\", \"\");\n\t\t\t\t\t\t\t}\n \t\t\t\tword = word.replaceAll(\"[^A-Za-z0-9 ]\", \"\");\n\t\t\t\t\t\t\tmessage.append(word);\n\t\t\t\t\t\t\tmessage.append(\" \");\n \t\t\t}\n \t\t}\n\t\t\t\t\tString query = \"INSERT INTO tweets (tweet_id,coordinates,created_at,tweet_text) VALUES ('\"\n\t\t\t\t\t\t\t+ user_id\n\t\t\t\t\t\t\t+ \"','\"\n\t\t\t\t\t\t\t+ lon_lat\n\t\t\t\t\t\t\t+ \"','\"\n\t\t\t\t\t\t\t+ created_at\n\t\t\t\t\t\t\t+ \"','\"\n\t\t\t\t\t\t\t+ message.toString()\n\t\t\t\t\t\t\t+ \"')\";\n\t\t\t\t\tString queueMessage = user_id + \"_\" + message;\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\tint sqlResult = sqlStatement.executeUpdate(query);\n\t\t\t\t\t} catch (SQLException e) {\n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t\t\t//sqs.sendMessage(new SendMessageRequest(myQueueUrl,queueMessage));\n\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println(query);\n\t\t\t\t\tSystem.out.println(message.toString());\n\t\t\t\t\tSystem.out.println(status.getLang());\n\t\t\t\t\tSystem.out.println(status.getGeoLocation()\n\t\t\t\t\t\t\t.getLatitude()\n\t\t\t\t\t\t\t+ \" \"\n\t\t\t\t\t\t\t+ status.getGeoLocation().getLongitude());\n\t\t\t\t}\n\t\t\t\t// }\n\t\t\t}\n\t\t}\n\n\t\t@Override\n\t\tpublic void onDeletionNotice(\n\t\t\t\tStatusDeletionNotice statusDeletionNotice) {\n\t\t\t// System.out.println(\"Got a status deletion notice id:\" +\n\t\t\t// statusDeletionNotice.getStatusId());\n\t\t}\n\n\t\t@Override\n\t\tpublic void onTrackLimitationNotice(int numberOfLimitedStatuses) {\n\t\t\t// System.out.println(\"Got track limitation notice:\" +\n\t\t\t// numberOfLimitedStatuses);\n\t\t}\n\n\t\t@Override\n\t\tpublic void onScrubGeo(long userId, long upToStatusId) {\n\t\t\t// System.out.println(\"Got scrub_geo event userId:\" + userId +\n\t\t\t// \" upToStatusId:\" + upToStatusId);\n\t\t}\n\n\t\t@Override\n\t\tpublic void onStallWarning(StallWarning warning) {\n\t\t\tSystem.out.println(\"Got stall warning:\" + warning);\n\t\t}\n\n\t\t@Override\n\t\tpublic void onException(Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t};\n\ttwitterStream.addListener(listener);\n\ttwitterStream.sample();\n\t\t} catch (AmazonServiceException ase) {\n\t\t\tSystem.out\n\t\t\t\t\t.println(\"Caught an AmazonServiceException, which means your request made it \"\n\t\t\t\t\t\t\t+ \"to Amazon SQS, but was rejected with an error response for some reason.\");\n\t\t\tSystem.out.println(\"Error Message: \" + ase.getMessage());\n\t\t\tSystem.out.println(\"HTTP Status Code: \" + ase.getStatusCode());\n\t\t\tSystem.out.println(\"AWS Error Code: \" + ase.getErrorCode());\n\t\t\tSystem.out.println(\"Error Type: \" + ase.getErrorType());\n\t\t\tSystem.out.println(\"Request ID: \" + ase.getRequestId());\n\t\t} catch (AmazonClientException ace) {\n\t\t\tSystem.out\n\t\t\t\t\t.println(\"Caught an AmazonClientException, which means the client encountered \"\n\t\t\t\t\t\t\t+ \"a serious internal problem while trying to communicate with SQS, such as not \"\n\t\t\t\t\t\t\t+ \"being able to access the network.\");\n\t\t\tSystem.out.println(\"Error Message: \" + ace.getMessage());\n\t\t}\n\n\t\t\n\t}", "@Override\n public void run() {\n String finalString = \"\";\n String str;\n while (true) {\n try {\n str = tweets.pop();\n finalString += (str + \"\\n\");\n } catch (Exception e) {\n break;\n }\n }\n tweetLog.setText(tweetLog.getText() + \"\\nFailed to send the following tweets:\\n\" + finalString);\n JOptionPane.showMessageDialog(null, \"All Tweets Sent Successfully!\", \"Success!!\", JOptionPane.WARNING_MESSAGE);\n }", "public void postTweet(int userId, int tweetId) {\n Tweet newTweet = new Tweet(tweetId, timestamp++);\n\n if (!usersMap.containsKey(userId)) usersMap.put(userId, new User(userId));\n usersMap.get(userId).post(newTweet);\n }", "public static ComposeTweetFragment newInstance() {\n ComposeTweetFragment fragment = new ComposeTweetFragment();\n\n return fragment;\n }", "@Override\n public void onCreate(Bundle savedInstanceState) \n {\n \t/* Set xml layout */\n super.onCreate(savedInstanceState);\n setContentView(R.layout.tweetlayout);\n \t\n /* Get additional information send by previous intent (last tweet) */\n Bundle bundle = this.getIntent().getExtras();\n String lastTweet = bundle.getString(\"lastTweet\");\n \n TextView tv = (TextView)findViewById(R.id.lastTweet);\n tv.setText(\"\\\"\" + lastTweet + \"\\\"\");\n \n /*\n * Form-button listner\n */\n \n OnClickListener submitListener = new OnClickListener() {\n \t public void onClick(View v) \n \t {\n \t \tTextView tv = (TextView)findViewById(R.id.newTweet_field);\n \t \ttry \n \t \t{\n\t\t\t\t\tLists.twitter.updateStatus(tv.getText().toString());\n\t\t\t\t\tTweet.this.setResult(1); \n\t\t\t\t\tTweet.this.finish();\n\t\t\t\t} \n \t \tcatch (TwitterException e) \n \t \t{\n \t \t\tnew Alert(e, Tweet.this);\n\t\t\t\t}\n \t }\n \t \n };\n \n /*\n * Assign listner to button\n */\n Button smbutton = (Button)findViewById(R.id.submitTweet);\n \tsmbutton.setOnClickListener(submitListener);\n \n }", "public getTweets_result(getTweets_result other) {\n if (other.isSetSuccess()) {\n this.success = new TweetBox(other.success);\n }\n }", "public Twitter() {\n\t\t\tuserMap = new HashMap<>();\n\t\t\tmaxFeed = 10;\n\t\t}", "private static void reply(Status status){\n String tweetedAtMe = \"@\" + status.getUser().getScreenName(); //retrieve username\n String completeReply = tweetedAtMe + \" \" + replyStatus + tweetedAtMe + \"?”\"; //message to tweet\n long inReply = status.getId(); //get id of status for reply\n StatusUpdate statusUpdate = new StatusUpdate(completeReply).inReplyToStatusId(inReply); //Status update is indicated as a reply\n\n Twitter twitter = TwitterInstantiator.instantiateTwitter(); //authorize to tweet on my behalf\n\n try{\n twitter.updateStatus(statusUpdate); //send tweet\n } catch (TwitterException te) {\n System.out.println(\"Ran into twitter exception: \" + te); //this tells me if I've sent too many tweets in a short time\n }\n }", "private void createContents() {\n // シェル\n super.createContents(this.parent, SWT.CLOSE | SWT.TITLE, false);\n this.getShell().setText(\"つぶやく\");\n this.shell = this.getShell();\n\n // レイアウト\n GridLayout glShell = new GridLayout(3, false);\n // glShell.horizontalSpacing = 1;\n glShell.marginHeight = 10;\n glShell.marginWidth = 10;\n // glShell.verticalSpacing = 1;\n this.shell.setLayout(glShell);\n\n Label thumnail = new Label(this.shell, SWT.NONE);\n GridData gdThumnail = new GridData(SWT.CENTER, SWT.CENTER, false, false, 3, 1);\n thumnail.setLayoutData(gdThumnail);\n try {\n Image orig = SwtUtils.makeImage(this.imageFile);\n thumnail.setImage(SwtUtils.scaleToFit(orig, 400, 300));\n orig.dispose();\n } catch (IOException e2) {\n SwtUtils.errorDialog(e2, TweetDialog.this.shell);\n }\n\n final Text text = new Text(this.shell, SWT.MULTI | SWT.BORDER | SWT.WRAP);\n GridData gdText = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);\n gdText.widthHint = SwtUtils.DPIAwareWidth(300);\n gdText.heightHint = SwtUtils.DPIAwareHeight(80);\n text.setLayoutData(gdText);\n\n Label userName = new Label(this.shell, SWT.NONE);\n userName.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));\n try {\n userName.setText(TwitterClient.getInstance().getUser().getScreenName());\n } catch (TwitterException e1) {\n SwtUtils.errorDialog(e1, TweetDialog.this.shell);\n }\n\n final Label remainChars = new Label(this.shell, SWT.NONE);\n remainChars.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));\n text.addModifyListener(new ModifyListener() {\n\n @Override\n public void modifyText(ModifyEvent e) {\n int remain = 117 - text.getText().length();\n remainChars.setText(String.valueOf(remain));\n }\n });\n text.setText(\"\");\n\n Button tweet = new Button(this.shell, SWT.NONE);\n GridData gdTweet = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);\n gdTweet.widthHint = SwtUtils.DPIAwareWidth(100);\n tweet.setLayoutData(gdTweet);\n tweet.setText(\"つぶやく\");\n tweet.addSelectionListener(new SelectionAdapter() {\n @Override\n public void widgetSelected(SelectionEvent e) {\n try {\n TwitterClient.getInstance().tweet(\n TweetDialog.this, text.getText(), TweetDialog.this.imageFile);\n TweetDialog.this.shell.close();\n ApplicationMain.logPrint(\"つぶやきました\");\n } catch (TwitterException e1) {\n SwtUtils.errorDialog(e1, TweetDialog.this.shell);\n }\n }\n });\n\n this.shell.pack();\n }", "@UiThreadTest\n\tpublic void testMakeTweet() {\n\t\t// Set that the Listview Adapter gets a new tweet\n\t\tLonelyTwitterActivity lta = getActivity();\n\t\tint old_length = lta.getAdapter().getCount();\n\t\tmakeTweet(\"NaOH Test. Wub. Wub.\");\n\t\tArrayAdapter<NormalTweetModel> aa = lta.getAdapter();\n\t\tassertEquals(aa.getCount(), old_length+1);\n\t\t\n\t\tassertTrue(aa.getItem(aa.getCount()-1) instanceof NormalTweetModel);\n\t\t\n\t\tassertEquals(aa.getItem(aa.getCount()-1).getText(), \"NaOH Test. Wub. Wub.\");\n\t}", "@Test\n\t\tpublic void createTweet() {\n\t\t\t\n\t\t\tRestAssured.baseURI=\"https://api.twitter.com/1.1/statuses\";\n\t\t\tResponse res=given().auth().oauth(ConsumerKey,ConsumerSecret,Token,TokenSecret).\n\t\t\tqueryParam(\"status\",\"I am learning API testing using RestAssured Java #Qualitest\").\n\t\t\twhen().post(\"/update.json\").then().extract().response();\n\t\t\t\n\t\t\tString responseString=res.asString();\n\t\t\t//System.out.println(responseString);\n\t\t\tlog.info(responseString);\n\t\t \n\t\t\tJsonPath js=new JsonPath(responseString);\n\t\t\tString id=js.get(\"id\").toString();\n\t\t\tlog.info(id);\n\t\t\tString text=js.get(\"text\").toString();\n\t\t\tlog.info(text);\n\t\t \n\t\t\t\n//\t\t\tString responseString=res.asString();\n//\t\t\tlog.info(responseString);\n//\t\t \n//\t\t\tJsonPath js=new JsonPath(responseString);\n//\t\t\tString id=js.get(\"id\").toString();\n//\t\t\tlog.info(id);\n//\t\t\tString text=js.get(\"text\").toString();\n//\t\t\tlog.info(text);\n//\t\t \n\t\t}", "public static boolean sendTweet(String tweet) {\n \t\tif (!isEnabled) {\n \t\t\tlogger.debug(\"Twitter client is disabled > execution aborted!\");\n \t\t\treturn false;\n \t\t}\n \n \t\ttry {\n \t\t\tStatus status = client.updateStatus(tweet);\n\t\t\tlogger.debug(\"Successfully sent Tweet '{}'\", status.getText());\n \t\t\treturn true;\n \t\t} catch (TwitterException e) {\n \t\t\tlogger.error(\"Failed to send Tweet '\" + tweet + \"' because of: \" + e.getLocalizedMessage());\n \t\t\treturn false;\n \t\t}\n \t}", "public TweetCorrected() {}", "public editTweet_args(editTweet_args other) {\n if (other.isSetBefore()) {\n this.before = new Tweet(other.before);\n }\n if (other.isSetAfter()) {\n this.after = new Tweet(other.after);\n }\n }", "@Override\r\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n HttpSession session = request.getSession();\r\n \r\n String action = request.getParameter(\"action\");\r\n User user = (User) session.getAttribute(\"user\");\r\n\r\n String url = \"/home.jsp\";\r\n \r\n if(action.equals(\"post_tweet\")) {\r\n String composerEmail = user.getemail();\r\n String message = request.getParameter(\"user_tweet\");\r\n ArrayList<String> mentions = null; //ArrayList used if more than one user is mentioned. \r\n UserMention userMention = new UserMention();\r\n HashTag hash = new HashTag();\r\n ArrayList<String> hashTags = null; //Arraylist used if more than one hashtag is used\r\n \r\n //find usernames that are mentioned. Returned values are the email addresses of usernames.\r\n mentions = findMentions(message);\r\n //find hashtags that are used.\r\n hashTags = findHashTags(message);\r\n //build tweet object\r\n Tweet tweet = new Tweet();\r\n tweet.setcomposerEmail(composerEmail);\r\n tweet.setMessage(message);\r\n \r\n //set boolean value mentions\r\n if(!mentions.isEmpty())\r\n tweet.setMentions(true);\r\n \r\n if(!hashTags.isEmpty())\r\n tweet.sethashTags(true);\r\n \r\n try {\r\n TweetDB.insert(tweet);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n ArrayList<UserTweetInfo> tweets;\r\n user = (User) session.getAttribute(\"user\");\r\n String email = user.getemail();\r\n tweets = TweetDB.selectTweetsByUser(email);\r\n \r\n //If mentions, insert userMention with user tweetID\r\n if(!mentions.isEmpty()){\r\n int tweetid = tweets.get(0).gettweetid();\r\n userMention.setemailAddress(email);\r\n userMention.settweetid(tweetid);\r\n for(int i = 0; i < mentions.size(); i++)\r\n {\r\n userMention.setuserMentionedEmail(mentions.get(i));\r\n \r\n try {\r\n UserMentionDB.insert(userMention);\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n }\r\n }\r\n //if hashTags, check for new hashtag or update\r\n if(!hashTags.isEmpty()){\r\n ArrayList<HashTag> allHashTags;\r\n allHashTags = HashTagDB.getHashTags();\r\n boolean found = false;\r\n int tweetid = tweets.get(0).gettweetid();\r\n TweetHashTag tweethash = new TweetHashTag();\r\n\r\n //if hashtag DB not empty, otherwise insert as new\r\n if(!allHashTags.isEmpty()) {\r\n for(int i = 0; i < hashTags.size(); i++) {\r\n for(int j = 0; j < allHashTags.size(); j++) {\r\n //update hashtag count in DB \r\n if(hashTags.get(i).equals(allHashTags.get(j).gethashText())) {\r\n found = true;\r\n int count = allHashTags.get(j).gethashCount();\r\n int id = allHashTags.get(j).getid();\r\n count += 1;\r\n hash.setid(id);\r\n hash.sethashCount(count);\r\n HashTagDB.update(hash);\r\n \r\n //associate hashtagID with tweetID\r\n tweethash.settweetid(tweetid);\r\n tweethash.sethashid(id);\r\n try {\r\n TweetHashTagDB.insert(tweethash);\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n } \r\n }\r\n //insert new hashtag\r\n if(!found) {\r\n hash.sethashText(hashTags.get(i));\r\n hash.sethashCount(1);\r\n try {\r\n HashTagDB.insert(hash);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n //Get HashTagID from DB and associate hashID with TweetID\r\n HashTag addedHashTag = new HashTag();\r\n addedHashTag = HashTagDB.searchByHashText(hashTags.get(i));\r\n tweethash.sethashid(addedHashTag.getid());\r\n tweethash.settweetid(tweetid);\r\n try {\r\n TweetHashTagDB.insert(tweethash);\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n }\r\n found=false; \r\n }\r\n }else{\r\n for(int i = 0; i < hashTags.size(); i++) {\r\n hash.sethashText(hashTags.get(i));\r\n hash.sethashCount(1);\r\n try {\r\n HashTagDB.insert(hash);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n HashTag addedHashTag = new HashTag();\r\n //getHashTagID from DB and associate hashID with tweetID in TweetHashTagDB\r\n addedHashTag = HashTagDB.searchByHashText(hashTags.get(i));\r\n tweethash.sethashid(addedHashTag.getid());\r\n tweethash.settweetid(tweetid);\r\n try {\r\n TweetHashTagDB.insert(tweethash);\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n }\r\n }\r\n \r\n }\r\n ArrayList<HashTag> top10Hash;\r\n top10Hash = HashTagDB.top10HashTags();\r\n session.setAttribute(\"trends\", top10Hash);\r\n session.setAttribute(\"tweets\", tweets);\r\n }\r\n if(action.equals(\"delete_tweet\")){\r\n // Get the id of this tweet from the request\r\n String tweetID = request.getParameter(\"tweetID\");\r\n ArrayList<UserTweetInfo> tweets;\r\n user = (User) session.getAttribute(\"user\");\r\n String email = user.getemail();\r\n boolean mentions = false;\r\n boolean hashTags = false;\r\n tweets = TweetDB.selectTweetsByUser(email);\r\n ArrayList<TweetHashTag> tweetHash;\r\n \r\n //check for user mentions and hashtags\r\n for(int i = 0; i < tweets.size(); i++) {\r\n if(tweets.get(i).gettweetid() == Integer.parseInt(tweetID)) {\r\n if(tweets.get(i).getmentions() != null)\r\n mentions = true;\r\n if(tweets.get(i).gethashtags() != null)\r\n hashTags = true;\r\n }\r\n }\r\n //if there are user mentions, delete mentions\r\n if(mentions){\r\n try {\r\n UserMentionDB.delete(tweetID);\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n }\r\n //if there are hashtags, delete hashtag or decrement current hashtag\r\n if(hashTags){\r\n HashTag hash = new HashTag();\r\n int count = 1;\r\n tweetHash = TweetHashTagDB.selectHashTagIDsByTweet(Integer.parseInt(tweetID));\r\n\r\n for(int i = 0; i < tweetHash.size(); i++)\r\n {\r\n hash = HashTagDB.searchByHashID(tweetHash.get(i).gethashid());\r\n //if count is 1, then hashtag is deleted from DB\r\n if(hash.gethashCount() == 1)\r\n {\r\n try {\r\n HashTagDB.delete(hash.getid());\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n }else{\r\n //decrement hashCount by 1\r\n int hashCount = hash.gethashCount();\r\n hashCount -= count;\r\n hash.sethashCount(count);\r\n HashTagDB.update(hash);\r\n }\r\n }\r\n //delete TweetID/HashtagID association in DB\r\n try {\r\n TweetHashTagDB.delete(Integer.parseInt(tweetID));\r\n }catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE,null,ex);\r\n }\r\n //update top 10 hashtags \r\n ArrayList<HashTag> top10Hash;\r\n top10Hash = HashTagDB.top10HashTags();\r\n session.setAttribute(\"trends\", top10Hash);\r\n }\r\n try {\r\n TweetDB.delete(tweetID);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n \r\n tweets.clear(); //clear tweets array to update\r\n tweets = TweetDB.selectTweetsByUser(email);\r\n session.setAttribute(\"tweets\", tweets);\r\n \r\n }\r\n if(action.equals(\"follow_user\"))\r\n {\r\n int userID = user.getid(); //get session user ID\r\n String followedUserID = request.getParameter(\"followedUserID\"); \r\n UserFollow follow = new UserFollow();\r\n \r\n //set Follow object\r\n follow.setuserID(userID);\r\n follow.setfollowedUserID(Integer.parseInt(followedUserID));\r\n \r\n //insert Follow object into DB\r\n try {\r\n FollowDB.insert(follow);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n \r\n //Pull follows for user and set session attribute\r\n ArrayList<UserFollow> follows;\r\n ArrayList<UserTweetInfo> tweets;\r\n int numFollowing = 0;\r\n\r\n user = (User) session.getAttribute(\"user\");\r\n String email = user.getemail();\r\n \r\n follows = FollowDB.selectFollowsByUser(userID);\r\n tweets = TweetDB.selectTweetsByUser(email);\r\n numFollowing = TweetDB.numberOfFollowing(email);\r\n\r\n session.setAttribute(\"tweets\", tweets);\r\n session.setAttribute(\"userFollows\", follows);\r\n session.setAttribute(\"numberOfFollowing\", numFollowing);\r\n }\r\n if(action.equals(\"unfollow_user\"))\r\n {\r\n int userID = user.getid();\r\n String followedUserID = request.getParameter(\"followedUserID\");\r\n UserFollow follow = new UserFollow();\r\n \r\n //set Follow object\r\n follow.setuserID(userID);\r\n follow.setfollowedUserID(Integer.parseInt(followedUserID));\r\n \r\n //Delete follow from DB\r\n try {\r\n FollowDB.delete(follow);\r\n } catch (ClassNotFoundException ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (Exception ex) {\r\n Logger.getLogger(tweetServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n //update session with new follow list for user\r\n ArrayList<UserFollow> follows;\r\n ArrayList<UserTweetInfo> tweets;\r\n int numFollowing = 0;\r\n \r\n user = (User) session.getAttribute(\"user\");\r\n String email = user.getemail();\r\n \r\n follows = FollowDB.selectFollowsByUser(userID);\r\n tweets = TweetDB.selectTweetsByUser(email);\r\n numFollowing = TweetDB.numberOfFollowing(email);\r\n \r\n session.setAttribute(\"tweets\", tweets);\r\n session.setAttribute(\"userFollows\", follows);\r\n session.setAttribute(\"numberOfFollowing\", numFollowing);\r\n \r\n }\r\n \r\n int numberOfTweets = TweetDB.numberOfUserTweets(user);\r\n session.setAttribute(\"numberOfTweets\", numberOfTweets);\r\n getServletContext()\r\n .getRequestDispatcher(url)\r\n .forward(request, response);\r\n }", "private List<ResponseList<Status>> get_tweet(long id) {\n\t\tList<ResponseList<Status>> tweets = new ArrayList(2);\n\t\ttry {\n\n\t\t\tPaging paging = new Paging(1, 200);\n\t\t\tResponseList<Status> tmp_Statues = twitter.getUserTimeline(id, paging); // get 200 Tweet\n\t\t\ttweets.add(0, tmp_Statues);\n\t\t\tpaging = new Paging(2, 200);\n\t\t\ttmp_Statues = twitter.getUserTimeline(id, paging);// get another 200 Tweet\n\t\t\ttweets.add(1, tmp_Statues);\n\n\t\t\tSystem.out.println(\"insert Tweets...\");\n\t\t\tSystem.out.println(\"path class\");\n\t\t\tSystem.getProperty(\"java.class.path\");\n\n\t\t\tfor (Status s : tweets.get(0))\n\t\t\t\tdb.insertTweets(s);\n\t\t\tSystem.out.println(\"tweets.get(1)\");\n\n\t\t\tfor (Status s : tweets.get(1))\n\t\t\t\tdb.insertTweets(s);\n\t\t\tSystem.out.println(\"Update_Creat_At(id);\");\n\n\t\t\tdb.Update_Creat_At(id);\n\t\t\tSystem.out.println(\"update_Complete_Tweets\");\n\n\t\t\tdb.update_Complete_Tweets(id);\n\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\tSystem.out.println(e.getMessage());\n\n\t\t}\n\t\treturn tweets;\n\t}", "public JsonHttpResponseHandler getComposeTweetHandler(final Context context, final List<Tweet> tweets, final TweetAdapter adapter, final RecyclerView rvTweets) {\n JsonHttpResponseHandler handler = new JsonHttpResponseHandler() {\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONObject response) {\n Log.d(\"TwitterClient\", response.toString());\n\n // Get the tweet id from the response.\n try {\n Tweet tweet = Tweet.fromJson(response);\n tweets.add(0, tweet);\n adapter.notifyItemInserted(0);\n rvTweets.scrollToPosition(0);\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONArray response) {\n Log.d(\"TwitterClient\", response.toString());\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {\n Log.d(\"TwitterClient\", responseString);\n throwable.printStackTrace();\n\n // Check connectivity.\n ConnectivityChecker cc = new ConnectivityChecker(context);\n cc.checkConnectivity();\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {\n Log.d(\"TwitterClient\", errorResponse.toString());\n throwable.printStackTrace();\n\n // Check connectivity.\n ConnectivityChecker cc = new ConnectivityChecker(context);\n cc.checkConnectivity();\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONArray errorResponse) {\n Log.d(\"TwitterClient\", errorResponse.toString());\n throwable.printStackTrace();\n\n // Check connectivity.\n ConnectivityChecker cc = new ConnectivityChecker(context);\n cc.checkConnectivity();\n }\n };\n\n return handler;\n }", "public Twitter() {\n\t\t\ttweets = new ArrayList<>();\n\t\t\tuserTweets = new HashMap<>();\n\t\t\ttweetOwner = new HashMap<>();\n\t\t\tuserRelation = new HashMap<>();\n\t\t}", "public void postTweet(int userId, int tweetId) {\n u_map.putIfAbsent(userId, new User(userId));\n u_map.get(userId).post(new Tweet(tweetId, counter++));\n }", "public Twitter() {\n userToTwitter = new HashMap<>();\n friends = new HashMap<>();\n tweets = new HashMap<>();\n }", "public Twitter() {\n twitterTweetMap = new HashMap<>();\n reverseTwitterFollowMap = new HashMap<>();\n }", "public Show_Tweet(String userid,Tweets tweet) {\n initComponents();\n \n jLabel_username.setText(userid);\n String Name = SQL.user.GetName(userid);\n jLabel_name.setText(Name);\n \n jLabel_Name.setText(tweet.User.Name);\n jLabel_Username.setText(tweet.User.Username);\n jLabel_Tweetid.setText(String.valueOf(tweet.TweetId));\n \n jTextArea.setText(tweet.Text);\n List<Users> list1 = SQL.user.GetLikers(tweet.TweetId);\n jLabel_NumberofLikes.setText(String.valueOf(list1.size()));\n List<Tweets> list2 = SQL.user.GetReplies(tweet.TweetId);\n jLabel_NumberofReplies.setText(String.valueOf(list2.size()));\n }", "private Tweet tabToTweet(String[] tab) throws ParseException {\n \t// Initialisation d'un tweet\n TweetSample tweet = new TweetSample();\n // position dans le tableau de string. Ici initialisé à 1\n int position = 1;\n \n if (tab.length < 3) // Gère le fait que le tweet n'a pas toutes les bonnes infos nécessaire\n \treturn null;\n else if (tab[2].length() < 19) // Gère le fait que la date ne soit pas au bon format\n \treturn null;\n \n // Si la taille du tableau est supérieur à la position (position = 1)\n if (tab.length > position ) {\n \t// Si la tab[1] est égale à 000 normalement non vu que 000 (dans Foot.txt) serait en position 0 mais on ne sait jamais\n if (tab[position].equals(\"000\")) {\n // Incrémente position\n \tposition ++;\n }\n // On ajoute tab[position] dans l'attribut userId de l'objet tweet\n tweet.setUserId(tab[position]);\n // Incrémente position\n position ++;\n } else\n \t// Sinon rtid égale null dans le cas où il n'éxiste pas\n tweet.setRtid(null);\n\n // Si la taille du tableau est supérieur à la position (position = 2)\n if (tab.length > position ) {\n \t// Création d'un formateur de date\n \tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n \t// Création d'une date avec le string trouvé dans le tableau de string\n Date date = sdf.parse(tab[position]);\n // On ajoute date dans l'attribut date de l'objet tweet\n tweet.setDate(date);\n // Incrémente position\n position ++;\n } else\n \t// Sinon rtid égale null dans le cas où il n'éxiste pas\n tweet.setRtid(null);\n\n // Si la taille du tableau est supérieur à la position (position = 3)\n if (tab.length > position ) {\n \t// On ajoute le message trouvé dans le tableau dans l'attribut text de l'objet tweet\n tweet.setText(tab[position]);\n // Incrémente position\n position ++;\n } else\n \t// Sinon rtid égale null dans le cas où il n'éxiste pas\n tweet.setRtid(null);\n\n // Si la taille du tableau est supérieur à la position (position = 4)\n if (tab.length > position ) {\n \t// On ajoute le rtid trouvé dans le tableau dans l'attribut rtid de l'objet tweet\n tweet.setRtid(tab[position]);\n } else\n \t// On ajoute une chaine vide dans le cas où il n'y pas de rtid dans l'attribut rtid de l'objet tweet \n tweet.setRtid(\"\");\n \n // Retourne l'objet tweet\n return tweet;\n }", "@Override\n public void onStatus(Status status) {\n // The EventBuilder is used to build an event using the headers and\n // the raw JSON of a tweet\n // shouldn't log possibly sensitive customer data\n //logger.debug(\"tweet arrived\");\n\n headers.put(\"timestamp\",String.valueOf(status.getCreatedAt().getTime()));\n\n Event event1;\n event1 = EventBuilder.withBody(TwitterObjectFactory.getRawJSON(status).getBytes(),headers);\n //event2 = EventBuilder.withBody(Integer.toString(status.getRetweetCount()),(Charset)headers);\n //event3 = EventBuilder.withBody(status.getText().getBytes(), headers);\n channel.processEvent(event1);\n //channel.processEvent(event2);\n\n }", "public static Twitter createTwitterObject() {\n\t\tOAuth2Token token = createFactory();\n\t\tConfigurationBuilder cb = new ConfigurationBuilder();\n\n\t\tcb.setApplicationOnlyAuthEnabled(true);\n\t\tcb.setOAuthConsumerKey(Secret.cKey);\n\t\tcb.setOAuthConsumerSecret(Secret.cSecret);\n\t\tcb.setOAuth2TokenType(token.getTokenType());\n\t\tcb.setOAuth2AccessToken(token.getAccessToken());\n\n\t\tTwitter twitter = new TwitterFactory(cb.build()).getInstance();\n\t\t\n\t\treturn twitter;\n }", "@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\n\t\t\t\t\n\t\t\t\tString mPath = Environment.getExternalStorageDirectory().toString(); \n\n\t\t\t\t// create bitmap screen capture\n\t\t\t\tBitmap bitmap;\n\t\t\t\tView v1 = findViewById(R.id.relative_layout);\n\t\t\t\t\n\t\t\t\tv1.setDrawingCacheEnabled(true);\n\t\t\t\t\n\t\t\n\t\t\t\tbitmap = Bitmap.createBitmap(v1.getDrawingCache());\n\t\t\t\tint height = bitmap.getHeight();\n\t\t\t\tint width = bitmap.getWidth();\n\t\t\t\tv1.setDrawingCacheEnabled(false);\n\t\t\t\tBitmap size = Bitmap.createBitmap(bitmap, 0,0, width, height-120 );\n\t\t\t\tOutputStream fout = null;\n\t\t\t\tlong timestamp = System.currentTimeMillis()/1000;\n\t\t\t\tFile imageFile = new File(mPath, \"Direnis\" + \"_\" + String.valueOf(timestamp)+ \".jpg\");\n\n\t\t\t\ttry {\n\t\t\t\t fout = new FileOutputStream(imageFile);\n\t\t\t\t size.compress(Bitmap.CompressFormat.JPEG, 90, fout);\n\t\t\t\t fout.flush();\n\t\t\t\t fout.close();\n\n\t\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t // TODO Auto-generated catch block\n\t\t\t\t e.printStackTrace();\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t // TODO Auto-generated catch block\n\t\t\t\t e.printStackTrace();\n\t\t\t\t}\n\t\t\t\t\n\t//TWITTER\n\t\t\t\t\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\tIntent intent = new Intent(Intent.ACTION_SEND);\n\t\t\t\t\tintent.setType(\"image/*\");\n\t\t\t\t\tintent.putExtra(Intent.EXTRA_TEXT, \"http://diren.is \");\n\t\t\t\t\tintent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(imageFile));\n\t\t\t\t\tfinal PackageManager pm = getPackageManager();\n\t\t\t\t\tfinal List<?> activityList = pm.queryIntentActivities(\n\t\t\t\t\t\t\tintent, 0);\n\t\t\t\t\tint len = activityList.size();\n\t\t\t\t\tfor (int i = 0; i < len; i++) {\n\t\t\t\t\t\tfinal ResolveInfo app = (ResolveInfo) activityList\n\t\t\t\t\t\t\t\t.get(i);\n\t\t\t\t\t\tif (\"com.twitter.android.PostActivity\"\n\t\t\t\t\t\t\t\t.equals(app.activityInfo.name)) {\n\t\t\t\t\t\t\tfinal ActivityInfo activity = app.activityInfo;\n\t\t\t\t\t\t\tfinal ComponentName name = new ComponentName(\n\t\t\t\t\t\t\t\t\tactivity.applicationInfo.packageName,\n\t\t\t\t\t\t\t\t\tactivity.name);\n\t\t\t\t\t\t\tintent.addCategory(Intent.CATEGORY_LAUNCHER);\n\t\t\t\t\t\t\tintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK\n\t\t\t\t\t\t\t\t\t| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);\n\t\t\t\t\t\t\tintent.setComponent(name);\n\t\t\t\t\t\t\tstartActivity(intent);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (final ActivityNotFoundException e) {\n\t\t\t\t\tToast.makeText(getApplicationContext(),\n\t\t\t\t\t\t\t\"Twitter Uygulamanız Bulunmamaktadır\",\n\t\t\t\t\t\t\tToast.LENGTH_SHORT);\n\t\t\t\t\tLog.i(\"twitter\", \"no twitter native\", e);\n\t\t\t\t}\n\n\t\t\t}", "public void onStatus(Status status) {\n String userName = status.getUser().getScreenName();\n String userId = Long.toString(status.getUser().getId());\n String messageTweet = status.getText();\n String imageUrl = status.getUser().getProfileImageURL();\n String lang = status.getUser().getLang();\n String timeZone = status.getUser().getTimeZone();\n String userLocation = status.getUser().getLocation();\n String time = tweetTime();\n\n makeJson(userId,userName,messageTweet,imageUrl, lang, timeZone, userLocation, time);\n \n}", "public TweetAdapter(List<Tweet> tweets, Activity timeLineActivity) {\n mTweets = tweets;\n this.timeLineActivity = timeLineActivity;\n }", "@Path(\"fetch/{query}/{limit}\")\r\n @GET\r\n @Produces(MediaType.APPLICATION_JSON)\r\n public Response fetchTweets(@PathParam(\"query\") final String query, @PathParam(\"limit\") final String limit)\r\n {\r\n log.debug(\"GET: augmentTweets: \" + query + \"\\tlimit string: \" + limit);\r\n\r\n final TweetList list = new TweetList();\r\n final int limitValue = Integer.parseInt(limit);\r\n\r\n // TODO try-with-resources should be:\r\n // try(final MongoClient client = new MongoClient(host, port)){\r\n try (final MongoClient client = new MongoClient(\"74.140.208.12\", 6789))\r\n {\r\n final MongoCollection<Document> coll = client.getDatabase(\"visualdb\").getCollection(\"visualcollection\");\r\n\r\n final Document queryDoc = new Document();\r\n queryDoc.put(\"query\", query);\r\n\r\n final FindIterable<Document> results = coll.find(queryDoc);\r\n\r\n int count = 0;\r\n for (final Document doc : results)\r\n {\r\n count++;\r\n\r\n final Tweet tweet = new Tweet();\r\n tweet.setText(doc.getString(\"text\"));\r\n tweet.setTweetUrl(doc.getString(\"url\"));\r\n tweet.setId(doc.getString(\"tweetId\"));\r\n\r\n final Location loc = new Location();\r\n loc.setInitialized(true);\r\n\r\n final Document locationDoc = doc.get(\"loc\", Document.class);\r\n loc.setLatitude(locationDoc.getDouble(\"latitude\").doubleValue());\r\n loc.setLongitude(locationDoc.getDouble(\"longitude\").doubleValue());\r\n tweet.setLocation(loc);\r\n\r\n final List<String> imageUrls = new ArrayList<>();\r\n final List<?> urls = doc.get(\"images\", List.class);\r\n\r\n for (final Object object : urls)\r\n {\r\n imageUrls.add(object.toString());\r\n }\r\n tweet.setImageUrls(imageUrls);\r\n\r\n final List<String> entities = new ArrayList<>();\r\n final List<?> entityList = doc.get(\"entities\", List.class);\r\n for (final Object object : entityList)\r\n {\r\n entities.add(object.toString());\r\n }\r\n tweet.setExtractedEntities(entities);\r\n list.getTweets().add(tweet);\r\n\r\n if (count > limitValue)\r\n {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return Response.ok(list).build();\r\n }", "public void postTweet(final int userId, final int tweetId) {\n List<int[]> userTweets = tweets.computeIfAbsent(userId, x -> new ArrayList<>());\n userTweets.add(new int[]{userId, tweetId, userTweets.size(), serial++});\n }", "public /*User*/ void createUser (String username) throws TwitterException, JAXBException{\n\t\t\n \tSystem.out.println(\"STEP 1 - \" + username);\n \ttwitter4j.User user1 = twitter.showUser(username);\n \ttwCount ++;\n \t\n \tList<Status> status = twitter.getHomeTimeline();\n \ttwCount ++;\n \t\n \tString name = user1.getName();\n \tString location = user1.getLocation();\n \tString description = user1.getDescription();\n \t\n \tArrayList<Integer> follower = new ArrayList<Integer>();\n \tArrayList<Integer> following = new ArrayList<Integer>();\n \tArrayList<Integer> friend = new ArrayList<Integer>();\n \t\n \tString tweets = getTweets((int)user1.getId(), 200);\n \tArrayList<String> tweetsFollowing = new ArrayList<String>();\n \tArrayList<String> tweetsFriends = new ArrayList<String>();\n \t\n\n\t\t\n\t\t\n \t\n\t\tIDs ids, ids2;\n\t\tids = twitter.getFollowersIDs(username, -1); // follower\n\t\ttwCount ++;\n\t\tids2 = twitter.getFriendsIDs(username, -1); // following\n\t\ttwCount ++;\n\t\t\n\n\t\t\n\t \tSystem.out.println(\"STEP 2 - \" + username);\n\t\t\n\n\t\t/*Follower*/ /*MAX 5000*/\n for (long id : ids.getIDs()) { \n\t \tfollower.add((int) id);\n\n\n }\n \n \n /**Following**/ /*MAX 5000*/\n for (long id : ids2.getIDs()) { \n \tfollowing.add((int) id);\n \n }\n \n\n \n /*Friends*/\n \n \t/*showFriendship(int sourceId,int targetId) throws TwitterException\n\t\tGets the detailed relationship status between a source user and a target user\n\t\tThis method calls http://api.twitter.com/1/friendships/show.json */\n \n Relationship r = null;\n int z = 0;\n for (long id : ids2.getIDs()){\n \t r = twitter.showFriendship(user1.getId(),id);\n \t if (r.isSourceFollowedByTarget()){\n \t\t z += 1;\n \t\t// System.out.println(id + \",number \"+ i );\n \t\t friend.add((int)id);\n \t }\n \t \n \t if (z >= 20){\n \t\t break;\n \t }\n \t\n }\n \n \n \n \n \n \n // \tSystem.out.println(\"\\n hddjkdsakjsadkjsdkj \" + friend.size() + \" \" + following.size());\n \n \n \n \tSystem.out.println(\"STEP 3 - \" + username);\n \t\n \t\n \t\n \t\n String u = \"\";\n \n \n int count = 0;\n /*tweetsFollowing*/\n for (int j : following){\n //\tSystem.out.println(\"\\n\\n\\n prints following: \" + j );\n \tu = getTweets(j, 10);\n // \tSystem.out.println(\"u.size \" + u.length() );\n \tif( u.length() > 0){\n \t\ttweetsFollowing.add(u);\n \t\tcount ++;\n \t}\n if (count >= 10){\n \tbreak;\n }\n \t\n }\n \n \n \n /*tweetsFriends*/\n\t\tcount = 0;\n if (friend.size() >= 10){\n\t for (int i : friend){\n\t // \tSystem.out.println(\"\\n there is some friends: \" + friend.size() );\n\t \tu = getTweets(i, 10);\n\t //\tSystem.out.println(\"\\n U.LENGHT \" + u.length() );\n\t \tif (u.length() > 0){\n\t \t\ttweetsFriends.add(u);\n\t \t\tcount ++;\n\t \t}\n\t \t\n\t if (count >= 10){\n\t \tbreak;\n\t }\n\t }\n\t \n }else if (following.size() > 21){ // no friends, I consider the following (not in tweetsFollowing) like friends \n //\tSystem.out.println(\"There is not a friend - > considers some following like friends\");\n \tfor (int i = 11; i < following.size(); i++){ // considers some following like friends\n\t \t//System.out.println(\"\\n\\n\\n prints follower: \" + i );\n\t \tu = getTweets(i, 10);\n\t // \tSystem.out.println(\"u.size friend\" + u.length() );\n\t \tif (u.length() > 0){\n\t \t\ttweetsFriends.add(u);\n\t \t\tcount ++;\n\t \t}\n\t \t\n\t if (count >= 10){\n\t \tbreak;\n\t }\n\t }\n \t\n }else{// I consider the following like friends\n \ttweetsFriends = tweetsFollowing;\n }\n \n \n//\t\t\n\n \n \n //System.out.println(tweetsFriends.size() + \"siiixx\");\n \n \ttwitter.User user = new twitter.User(username, name, location, friend, following, tweets, tweetsFriends, tweetsFollowing, description);\n //\tSystem.out.println(user.getTweetsFriends().size() + \"siiixx\");\n \t\n \tFile file = new File(\"otherFile/users/\"+username+\".xml\");\n\t\tJAXBContext jaxbContext = JAXBContext.newInstance(twitter.User.class);\n\t\tMarshaller jaxbMarshaller = jaxbContext.createMarshaller();\n\n\t\t// output pretty printed\n\t\tjaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\n\n\t\tjaxbMarshaller.marshal(user, file);\n\t\tjaxbMarshaller.marshal(user, System.out);\n\n \n }", "@PostMapping(\"/timeline\")\n\tpublic List<tweets> timelineList() {\n\n\t\tList<Tweet> timeline = twitter.timelineOperations().getHomeTimeline();\n\t\tfor (Tweet tweet : timeline) {\n\t\t\ttweets objTweets = new tweets(0, tweet.getText(), tweet.getProfileImageUrl(), tweet.getFromUser());\n\t\t\tservice.saveTweets(objTweets);\n\t\t}\n\t\tList<tweets> home = service.listAll();\n\t\treturn home;\n\t}", "public Twitter() {\n initComponents();\n }", "private WSResponse addTwitterData(WSResponse response, TwitterData twData) {\n\t\tif(twData!=null){\n\t\t\tif(twData.getTweets()!=null && twData.getTweets().size()>0){\n\t\t\t\tfor (Tweet tweet : twData.getTweets()) {\n\t\t\t\t\tEvents event=new Events();\n\t\t\t\t\tevent.setMessage(tweet.getMessage());\n\t\t\t\t\tevent.setMood(tweet.getMood().getType());\n\t\t\t\t\tevent.setSource(\"twitter\");\n\t\t\t\t\tevent.setTime(tweet.getTime());\n\t\t\t\t\tresponse.getEvents().add(event);\n\t\t\t\t\tresponse.setTwitter(response.getTwitter()+1);\n\t\t\t\t\tresponse.setScore(response.getScore()+tweet.getMood().getScore());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn response;\n\t}", "private String getTweetLink(Status status) {\n \t\treturn \"http://twitter.com/\" + status.getUser().getScreenName()\n \t\t\t\t+ \"/status/\" + status.getId();\n \t}", "@RequestMapping(value = \"/twitterpost\", method = RequestMethod.POST)\n\tpublic ModelAndView playersList(@RequestParam(value = \"tweet\", required = true) String post)\n\t\t\tthrows TwitterException {\n\t\tSystem.out.println(post);\n\t\tStatusUpdate status = new StatusUpdate(post);\n\n\t\ttwitter.updateStatus(status);\n\t\tMap<String, String> map = new HashMap<String, String>();\n\t\tmap.put(\"msg\", \"Successfully posted To Twitter\");\n\t\treturn new ModelAndView(\"tweetsuccess\", map);\n\t}", "public void postTweet(int userId, int tweetId) {\n tweetMap.putIfAbsent(userId, new ArrayList<>());\n tweetMap.get(userId).add(new int[]{time++, tweetId});\n }", "@Bean\n\tpublic IntegrationFlow sendTargetedTweetToRabbitMQ() {\t\t\n\t\treturn IntegrationFlows.from(requestChooserOutputChannel())\n\t\t\t\t//.transform(Transformers.toJson())\n\t\t\t\t//.transform(highlight())\t\t// Debug Purposes\n\t\t\t\t.handle(Amqp.outboundAdapter(rabbitTemplate)\n\t\t\t\t\t\t.exchangeName(CHOOSER_OUTPUT_FANOUT_EXCHANGE)).get();\n\t}", "@Override\n public void run() {\n while (!tweets.empty()) {\n synchronized (tweets) {\n synchronized (status) {\n synchronized (tweetLog) {\n\n final String mention = tweets.pop();\n try {\n account.updateStatus(mention);\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n //To change body of implemented methods use File | Settings | File Templates.\n tweetLog.setText(tweetLog.getText() + tweets.size() + \" [\" + mention\n + \"] sent successfully from account @\" + account.screenName + \"\\n\");\n// frame.validate();\n// frame.pack();\n }\n });\n\n } catch (final TwitterException e) {\n e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n int inde = 0;\n String idArray[] = id.getText().split(\"\\\\r?\\\\n\");\n for (String el : idArray) {\n System.out.println(\"idarray: \" + el);\n if (el.compareTo(account.screenName) == 0)\n break;\n else\n inde++;\n }\n final int inde2 = inde;\n\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n\n AddFormWin.updateStateOfAccount(id, status, e.getErrorMessage(), account);\n //To change body of implemented methods use File | Settings | File Templates.\n tweetLog.setText(tweetLog.getText() + \"failed to send tweet '\" + mention +\n \"' From Account \" + account.screenName + \"due to error:[\" + e.getErrorMessage() + \"]\\n\");\n tweets.push(mention);\n }\n });\n AddFormWin.nThreads--;\n //if this was the last thread then show error message and the remaining tweets\n if (AddFormWin.nThreads == 0 && tweets.size() > 0)\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n //To change body of implemented methods use File | Settings | File Templates.\n String finalString = \"\";\n String str;\n while (true) {\n try {\n str = tweets.pop();\n finalString += (str + \"\\n\");\n } catch (Exception e) {\n break;\n }\n }\n AddFormWin.clearTweetStack();\n tweetLog.setText(tweetLog.getText() +\n \"\\nFailed to send the following tweets:\\n\" + finalString);\n JOptionPane.showMessageDialog(null, \"Tweet Sending Failed!\"\n , \"Failure!!\", JOptionPane.WARNING_MESSAGE);\n\n }\n });\n return;\n }\n\n }\n }\n }\n try {\n long sleepTime= (long)(sleepInterval + Math.random()*(sleepIntervalMax-sleepInterval));\n Thread.sleep(sleepTime);\n } catch (InterruptedException e) {\n e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.\n }\n\n }\n AddFormWin.nThreads--;\n if (tweets.isEmpty())\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n //To change body of implemented methods use File | Settings | File Templates.\n String finalString = \"\";\n String str;\n while (true) {\n try {\n str = tweets.pop();\n finalString += (str + \"\\n\");\n } catch (Exception e) {\n break;\n }\n }\n tweetLog.setText(tweetLog.getText() + \"\\nFailed to send the following tweets:\\n\" + finalString);\n JOptionPane.showMessageDialog(null, \"All Tweets Sent Successfully!\", \"Success!!\", JOptionPane.WARNING_MESSAGE);\n }\n });\n\n }", "public void publish(String tweetText, String locationString, String trafficLevel) {\n\n Date date = new Date();\n String time = new Timestamp(date.getTime()).toString();\n\n try {\n HttpPost method = new HttpPost(httpEndPoint);\n\n if (httpClient != null) {\n String[] xmlElements = new String[]\n {\n \"<events>\" +\n \"<event>\" +\n \"<metaData>\" +\n \"<Timestamp>\" + time + \"</Timestamp>\" +\n \"</metaData>\" +\n\n \"<payloadData>\" +\n\n \"<Traffic_Location>\" + locationString + \"</Traffic_Location>\" +\n \"<Traffic_Level>\" + trafficLevel + \"</Traffic_Level>\" +\n \"<Twitter_Text>\" + tweetText + \"</Twitter_Text>\" +\n\n \"</payloadData>\" +\n\n \"</event>\" +\n \"</events>\"\n };\n\n try {\n for (String xmlElement : xmlElements) {\n StringEntity entity = new StringEntity(xmlElement);\n method.setEntity(entity);\n if (httpEndPoint.startsWith(\"https\")) {\n processAuthentication(method, username, password);\n }\n httpClient.execute(method).getEntity().getContent().close();\n logger.info(\"Event Published Successfully to \" + httpEndPoint + \"\\n\");\n }\n } catch (Exception e) {\n logger.error(\"Error While Sending Events to HTTP Endpoint : Connection Refused\");\n }\n\n Thread.sleep(500); // We need to wait some time for the message to be sent\n\n }\n } catch (Throwable t) {\n logger.error(\"Unable to Connect to HTTP endpoint\");\n }\n }", "public Twitter authToTwitter(Authenticating account) {\n System.out.println(\"##########TwitterData.Authenticating##########\");\n ConfigurationBuilder conf_Build = new ConfigurationBuilder();\n conf_Build.setOAuthConsumerKey(account.getCONSUMERKEY())\n .setOAuthConsumerSecret(account.getCONSUMERSECRET())\n .setOAuthAccessToken(account.getACCESSTOKEN())\n .setOAuthAccessTokenSecret(account.getACCESSTOKENSECRET());\n\n\n return new TwitterFactory(conf_Build.build()).getInstance();\n }", "public TweeterAdapter (List<Tweet> tweets){\n mTweets=tweets;\n }", "public MetodosTwit() {\r\n\r\n twitter = new TwitterFactory().getInstance();\r\n }", "public MatchBot(String user, int numTweets) {\n super(user, numTweets);\n }", "@Override\n public void update(String tweet, Long tweetTime) {\n\tuserFeed.add(tweet);\n\tlastUpdateTime = tweetTime;\n }" ]
[ "0.6821896", "0.6741255", "0.6711563", "0.63070965", "0.6214738", "0.6040289", "0.595183", "0.59110373", "0.5869741", "0.5858485", "0.5850284", "0.5845", "0.5831705", "0.5775812", "0.57639563", "0.5762864", "0.5735329", "0.5720031", "0.5665786", "0.56073296", "0.55487406", "0.5510776", "0.5492156", "0.5467922", "0.54576355", "0.5442165", "0.54400206", "0.54235476", "0.54086024", "0.53948855", "0.5385448", "0.53222585", "0.5289255", "0.52788866", "0.527262", "0.5265001", "0.52638876", "0.5255508", "0.52502066", "0.5242882", "0.52415484", "0.5237546", "0.52264196", "0.522071", "0.51979196", "0.5192337", "0.51584363", "0.5115685", "0.5105331", "0.5103832", "0.5101793", "0.50910795", "0.50744194", "0.50716513", "0.50627154", "0.5027827", "0.50270206", "0.50115174", "0.50094724", "0.50046337", "0.50041693", "0.50003666", "0.49970177", "0.4977173", "0.49714398", "0.49635115", "0.49586302", "0.4928522", "0.4918539", "0.4912622", "0.48907587", "0.48891702", "0.48839986", "0.486175", "0.48555773", "0.48545387", "0.48516443", "0.48438525", "0.48376417", "0.48292387", "0.48239562", "0.48215428", "0.48125076", "0.4807007", "0.48063716", "0.48054105", "0.48042738", "0.47933933", "0.47930738", "0.47929442", "0.47850484", "0.47839576", "0.47448766", "0.47448143", "0.47417685", "0.4732713", "0.4731066", "0.47190297", "0.47114024", "0.47095042" ]
0.4827014
80
Retrieve the 10 most recent tweet ids in the user's news feed. Each item in the news feed must be posted by users who the user followed or by the user himself. Tweets must be ordered from most recent to least recent.
public List<Integer> getNewsFeed(int userId) { //minHeap the top is the old tweet, which maybe remove from the list PriorityQueue<Tweet> minHeap = new PriorityQueue<>(new Comparator<Tweet>(){ @Override public int compare(Tweet t1, Tweet t2) { return t1.timePosted - t2.timePosted; } }); // get my followee Set Set<Integer> myFollowees = followees.get(userId); if (myFollowees != null) { for (Integer followeeId : myFollowees) { //get the tweets of them List<Tweet> followeeTweets = tweets.get(followeeId); if (followeeTweets != null) { for (Tweet tweet : followeeTweets) { if (minHeap.size() < feedMaxNum) { minHeap.offer(tweet); } else { //if it is older than the oldest one in the heap just discard if (tweet.timePosted <= minHeap.peek().timePosted) break; minHeap.offer(tweet); minHeap.poll(); } } } } } List<Integer> myFeed = new LinkedList<>(); while (!minHeap.isEmpty()) { myFeed.add(0, minHeap.poll().tweetId); } return myFeed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<Integer> getNewsFeed(int userId) {\n if (!userId2TopTenTweets.containsKey(userId)) {\n return new ArrayList<>(0);\n }\n\n\n userId2TopTenTweets.get(userId).sort((i1, i2)->i2.getTimestamp() - i1.getTimestamp() > 0 ? 1:i2.getTimestamp() - i1.getTimestamp() == 0 ? 0 : -1);\n List<Integer> result = new ArrayList<>();\n int size = 0;\n for (Tweet tweet : userId2TopTenTweets.get(userId)) {\n result.add(tweet.id);\n size++;\n if (size == 10) {\n return result;\n }\n }\n return result;\n }", "public List<Integer> getNewsFeed(int userId) {\n ArrayList<Tweet> feeds = new ArrayList<>();\n\n User user = getOrCreateUser(userId);\n feeds.addAll(user.myTweets);\n for (User followee : user.following) {\n feeds.addAll(followee.myTweets);\n }\n\n feeds.sort(new Comparator<Tweet>() {\n @Override\n public int compare(Tweet o1, Tweet o2) {\n return o2.counter - o1.counter;\n }\n });\n\n ArrayList<Integer> rlt = new ArrayList<>();\n\n for (Tweet tweet : feeds) {\n rlt.add(tweet.id);\n }\n\n if (rlt.size() > 10)\n return rlt.subList(0, 10);\n\n return rlt;\n }", "public List<Integer> getNewsFeed(int userId) {\n\t\t\tint resultSize = 10;\n\t\t\tList<Integer> result = new ArrayList<>(resultSize);\n\t\t\tSet<Integer> followees = getFollowees(userId);\n\t\t\tint count = 0;\n\t\t\tfor (int i = tweets.size() - 1; i >= 0; i--) {\n\t\t\t\tif (count == resultSize)\n\t\t\t\t\tbreak;\n\t\t\t\tint tweet = tweets.get(i);\n\t\t\t\tint owner = tweetOwner.get(tweet);\n\t\t\t\tif (owner == userId || followees.contains(owner)) {\n\t\t\t\t\tresult.add(tweet);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}", "public List<Integer> getNewsFeed(int userId) {\n List<Integer> res = new ArrayList<>();\n PriorityQueue<Tweet> queue = new PriorityQueue<Tweet>((t1, t2) -> t2.ts - t1.ts);\n User u = u_map.get(userId);\n if(u == null) return res;\n u.followed.forEach(followeeId->{\n Tweet head = u_map.get(followeeId).head;\n if(head != null){\n queue.offer(head);\n }\n });\n \n while(res.size() < 10 && !queue.isEmpty()){\n Tweet t = queue.poll();\n res.add(t.id);\n if(t.next != null) queue.offer(t.next);\n }\n return res;\n }", "public List<Integer> getNewsFeed(int userId) {\n if (!followees.containsKey(userId)) {\n followees.put(userId, new HashSet<>());\n followees.get(userId).add(userId);\n }\n List<Integer> result = new ArrayList<>();\n for (int i = tweetList.size() - 1; i >= 0; i--) {\n if (followees.get(userId).contains(tweetList.get(i).userId))\n result.add(tweetList.get(i).tweetId);\n if (result.size() == 10)\n break;\n }\n return result;\n }", "public List<Integer> getNewsFeed(int userId) {\n List<Integer> res = new ArrayList<Integer>();\n if (!followMap.containsKey(userId)) return res;\n PriorityQueue<Tweet> pq = new PriorityQueue<Tweet>(10000, new Comparator<Tweet>() {\n @Override\n public int compare(final Tweet t1, final Tweet t2) {\n return t2.ts - t1.ts;\n }\n });\n for (int followee : followMap.get(userId)) {\n if (!tweetMap.containsKey(followee) || tweetMap.get(followee).size()==0) continue;\n for (Tweet tweet : tweetMap.get(followee)) pq.add(tweet);\n }\n while (pq.size() > 0 && res.size() < 10) res.add(pq.poll().id);\n return res;\n }", "public List<Integer> getNewsFeed(int userId) {\n User target = null;\n for (User user : users) {\n if (user.id == userId) {\n target = user;\n }\n }\n if (target == null) {\n return null;\n }\n List<Tweet> tweets = new ArrayList<>(target.tweetList);\n for (User follower : target.followers) {\n tweets.addAll(follower.tweetList);\n }\n tweets.sort((o1, o2) -> o2.publishTime - o1.publishTime);\n while (tweets.size() > 10) {\n tweets.remove(tweets.size() - 1);\n }\n List<Integer> list = new ArrayList<>();\n for (Tweet tweet : tweets) {\n list.add(tweet.Id);\n }\n return list;\n }", "public List<Integer> getNewsFeed(int userId) {\n Set<Integer> friendSet = friends.computeIfAbsent(userId, e -> new HashSet<>());\n\n List<Integer> result = new ArrayList<>();\n\n result.addAll(userToTwitter.computeIfAbsent(userId, e -> new LinkedList<>()));\n for (int uid : friendSet) {\n result.addAll(userToTwitter.computeIfAbsent(uid, e -> new LinkedList<>()));\n }\n\n result.sort(Comparator.comparingInt(tweets::get).reversed());\n\n return result.size() > 10 ? result.subList(0, 10) : result;\n }", "public List<Integer> getNewsFeed(int userId) {\n List<Integer> feedList = new LinkedList<>();\n\n if (!usersMap.containsKey(userId)) return feedList;\n\n PriorityQueue<Tweet> minHeap = new PriorityQueue<>(10, new Comparator<Tweet>() {\n @Override\n public int compare(Tweet t1, Tweet t2) {\n return t2.time - t1.time;\n }\n });\n\n for (int followerId : usersMap.get(userId).follows) {\n User user = usersMap.get(followerId);\n // System.out.println(usersMap.get(userId).follows);\n if (user.tweetHead != null)\n minHeap.add(user.tweetHead);\n }\n\n\n Tweet tmpTweet;\n while (!minHeap.isEmpty() && feedList.size() < 10) {\n tmpTweet = minHeap.poll();\n if (tmpTweet != null)\n feedList.add(tmpTweet.tweetId);\n\n if (tmpTweet.next != null) {\n minHeap.add(tmpTweet.next);\n }\n }\n\n return feedList;\n }", "public List<Integer> getNewsFeed(int userId) {\n List<Integer> temp = new ArrayList<Integer>();\n PriorityQueue<Tweet> pq = new PriorityQueue<>((a,b)->a.time - b.time); // Ascending order of timestamp of tweets\n HashSet<Integer> following = users.get(userId);\n if(following != null){\n for(int fId : following){ // For each of the user followers\n List<Tweet> t = tweets.get(fId);\n if(t != null){\n for(Tweet post: t){ // For each of the tweets of their followers\n if(pq.size() < feedsize){ // If PQ is not filled\n pq.add(post);\n } else {\n if(post.time >= pq.peek().time){ // If the incoming tweet is latest than the root of PQ tweet\n pq.poll();\n pq.add(post); // Add to the PQ\n }\n }\n }\n }\n }\n }\n while(!pq.isEmpty()){\n temp.add(0, pq.poll().id); // Add to tmp in descending order of timestamp of tweets\n }\n return temp;\n }", "public List<Integer> getNewsFeed(int userId) {\n List<Integer> ret = new ArrayList<>();\n if (!map.containsKey(userId)) return ret;\n User u = map.get(userId);\n PriorityQueue<Tweet> q = new PriorityQueue<>(u.followee.size(), (a, b) -> (b.time - a.time));\n for (User usr: u.followee) {\n if (usr.tweet != null)\n q.add(usr.tweet);\n }\n for (int i = 0; i < 10 && !q.isEmpty(); i++) {\n Tweet t = q.poll();\n ret.add(t.ID);\n if (t.next != null)\n q.add(t.next);\n }\n return ret;\n }", "public List<Integer> getNewsFeed(int userId) {\n List<Integer> tmp = twitterTweetMap.getOrDefault(userId, new LinkedList<>());\n return tmp.size() <= 10 ? tmp : tmp.subList(0,10);\n }", "public List<Integer> getNewsFeed(final int userId) {\n PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> b[3] - a[3]);\n Set<Integer> followees = follows.computeIfAbsent(userId, x -> new HashSet<>());\n followees.add(userId);\n for (int followee : followees) {\n if (tweets.containsKey(followee)) {\n List<int[]> userTweets = tweets.get(followee);\n pq.add(userTweets.get(userTweets.size() - 1));\n }\n }\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < 10 && !pq.isEmpty(); i++) {\n int[] curr = pq.poll();\n res.add(curr[1]);\n if (curr[2] > 0) {\n pq.add(tweets.get(curr[0]).get(curr[2] - 1));\n }\n }\n return res;\n }", "public List<Integer> getNewsFeed(int userId) {\n\t\t\tList<Integer> feed = new LinkedList<Integer>();\n\t\t\tif (!userMap.containsKey(userId))\n\t\t\t\treturn feed;\n\t\t\tPriorityQueue<Tweet> pq = new PriorityQueue<>((a, b) -> a.time - b.time);\n\t\t\tSet<Integer> users = userMap.get(userId).followed;\n\t\t\tfor (int user : users) {\n\t\t\t\tList<Tweet> list = userMap.get(user).userTweets;\n\t\t\t\tint c = 0;\n\t\t\t\tfor (Tweet t : list) {\n\t\t\t\t\tpq.offer(t);\n\t\t\t\t\tc++;\n\t\t\t\t\tif (pq.size() > maxFeed)\n\t\t\t\t\t\tpq.remove();\n\t\t\t\t\tif (c > maxFeed)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (!pq.isEmpty())\n\t\t\t\tfeed.add(0, pq.remove().tweetId);\n\t\t\treturn feed;\n\t\t}", "private ArrayList<TweetData> getTweets(JSONObject json, QueryTargetInfo info) {\n ArrayList<TweetData> tweets = new ArrayList<TweetData>();\n\n JSONArray jsonArray = json.optJSONArray(\"statuses\");\n\n\n if (jsonArray == null) {\n return tweets;\n }\n\n for (int i = 0; i < jsonArray.length(); i++) {\n try {\n TweetData tweet = new TweetData();\n JSONObject tweetJson = jsonArray.getJSONObject(i);\n\n SimpleDateFormat df = new SimpleDateFormat(TIME_FORMAT);\n\n tweet.twitterId = tweetJson.getString(\"id_str\");\n tweet.published = (int)(df.parse(tweetJson.getString(\"created_at\")).getTime() / 1000);\n tweet.content = tweetJson.getString(\"text\");\n tweet.source = tweetJson.optString(\"source\", \"<No Source>\");\n tweet.lang = tweetJson.optString(\"lang\", \"en\");\n\n tweet.author = \"Jon Doe\";\n JSONObject user = tweetJson.optJSONObject(\"user\");\n if (user != null) {\n tweet.author = user.optString(\"screen_name\", \"Jon Doe\");\n }\n\n tweet.place = tweetJson.optString(\"place\", \"\");\n tweet.geo = tweetJson.optString(\"geo\", \"\");\n\n // Keep track of the smallest id.\n if (info.smallestId == null ||\n Long.valueOf(tweet.twitterId) < Long.valueOf(info.smallestId)) {\n info.smallestId = tweet.twitterId;\n }\n\n // Keep track of the last seen (max) id.\n if (info.lastSeenId == null ||\n Long.valueOf(tweet.twitterId) > Long.valueOf(info.lastSeenId)) {\n info.lastSeenId = tweet.twitterId;\n }\n\n tweets.add(tweet);\n } catch (Exception ex) {\n Logger.logError(\"Unable to parse tweet.\", ex);\n }\n }\n\n return tweets;\n }", "void getTweets(long lastUid) {\n client.getMentionsTimeline(lastUid, new JsonHttpResponseHandler() {\n\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONArray response) {\n Log.d(\"DEBUG\", response.toString());\n addAll(Tweet.fromJsonArray(response));\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {\n Log.d(\"DEBUG\", errorResponse.toString());\n }\n });\n }", "public List<Integer> getNewsFeed(int userId) {\n List<Node> tweets = tweetMap.get(userId);\n if (tweets == null) {\n return new LinkedList<>();\n }\n return tweets.stream().map(node -> node.tweetId).collect(Collectors.toList());\n }", "public List<NewsNotifications> getNewsFeed(int limit);", "public List<Entry> show10MostRecentEntries() {\n\t\tList<Entry> subList;\n\t\tif (entries.isEmpty()){\n\t\t\tSystem.out.println(\"The blog doesn't have any entries yet\");\n\t\t\treturn entries.getList();\n\t\t}\n\t\telse {\n\t\t\tif (entries.getSize()>= 10){\n\t\t\t\tsubList= entries.getSubList(0,10);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsubList= entries.getSubList(0,entries.getSize());\n\t\t\t}\n\t\t\tIterator<Entry> it = subList.listIterator();\n\t\t\twhile (it.hasNext()) {\n\t\t\t\tEntry entry = it.next();\n\t\t\t\tSystem.out.println(\"Entry Title: \" + entry.getTitle());\n\t\t\t\tSystem.out.println(\"Entry Content: \" + entry.getContent());\n\t\t\t}\n\t\t\t\n\t\t\treturn subList;\n\t\t}\n\t}", "@Override\n public void populateTimeline() {\n long fetchMoreStart = tweets.size() > 0 ? tweets.get(tweets.size() - 1).getUid() : -1;\n client.getHomeTimeline(new JsonHttpResponseHandler() {\n // on success\n\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONArray json) {\n addAll(Tweet.fromJSONArray(json));\n }\n\n // on failure\n @Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {\n Log.d(\"DEBUG\", errorResponse.toString());\n }\n }, fetchMoreStart);\n }", "public @NotNull TwitterFeedResponse getTwitterFeed(@NotNull final String userName,\n final int maxNumOfTweets,\n final long sinceMessageId) throws TwitterException {\n User u = twitter.showUser(userName);\n TwitterFeedResponse feed = initializeFeed(u);\n ResponseList<Status> tweets;\n if (sinceMessageId <= 0) {\n tweets = twitter.getUserTimeline(feed.userId, new Paging(1, maxNumOfTweets));\n } else {\n tweets = twitter.getUserTimeline(feed.userId, new Paging(1, maxNumOfTweets, sinceMessageId));\n }\n feed.limit = u.getRateLimitStatus().getLimit();\n feed.remaining = u.getRateLimitStatus().getRemaining();\n\n for (Status s : tweets) {\n TwitterFeedResponse.Tweet t = initializeTweet(s, feed);\n feed.tweets.add(t);\n }\n\n return feed;\n }", "public static List<TopicBean> getRecentTopics() {\r\n\t\tDBCollection topicsColl = getCollection(TOPICS_COLLECTION);\r\n\t\t\r\n\t\tDBObject query = new BasicDBObject(\"deleted\", new BasicDBObject(\"$ne\", true));\r\n\t\t\r\n\t\tList<DBObject> topicsDBList=new ArrayList<DBObject>();//List<DBObject> topicsDBList = topicsColl.find(query).sort(new BasicDBObject(\"last_update\", -1)).toArray();\r\n\t\tDBCursor topicCur=topicsColl.find(query).sort(new BasicDBObject(\"last_update\", -1));\r\n\t\twhile(topicCur.hasNext()){\r\n\t\t\ttopicsDBList.add(topicCur.next());\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\tList<TopicBean> recentTopics = new ArrayList<TopicBean>();\r\n\t\tfor (DBObject topicDBObject : topicsDBList) {\r\n\t\t\tTopicBean topic = new TopicBean();\r\n\t\t\ttopic.parseBasicFromDB(topicDBObject);\r\n\t\t\ttopic.setConversations(ConversationDAO.loadConversationsByTopic(topic.getId()));\r\n\t\t\trecentTopics.add(topic);\r\n\t\t\t\r\n\t\t\tif (recentTopics.size() == 20) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn recentTopics;\r\n\t}", "public List<TweetDto> feed(String username) {\n\t\tList<TweetDto> self = new ArrayList<>();\n\t\tfor (Tweet tweet : userRepository.findByUname(username).getTweets()) {\n\t\t\tif (tweet.isDeleted() == false){\n\t\t\t\tswitch (tweet.getType()) {\n\t\t\t\tcase \"simple\":\n\t\t\t\t\tself.add(tweetMapper.toSimpleDto(tweet));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"reply\":\n\t\t\t\t\tself.add(tweetMapper.toReplyDto(tweet));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"repost\":\n\t\t\t\t\tself.add(tweetMapper.toRepostDto(tweet));\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\n/* Gets their followers posts and determines if it is a new post, reply or a repost\nand sets it in the database accordingly */\n\t\tfor (User u : userRepository.findByUname(username).getFollowing()) {\n\t\t\tfor (Tweet tweet : u.getTweets()) {\n\t\t\t\tif (tweet.isDeleted() == false)\n\t\t\t\t\tif (tweet.isDeleted() == false){\n\t\t\t\t\t\tswitch (tweet.getType()) {\n\t\t\t\t\t\tcase \"simple\":\n\t\t\t\t\t\t\tself.add(tweetMapper.toSimpleDto(tweet));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"reply\":\n\t\t\t\t\t\t\tself.add(tweetMapper.toReplyDto(tweet));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"repost\":\n\t\t\t\t\t\t\tself.add(tweetMapper.toRepostDto(tweet));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tCollections.sort(self, new TweetCompare());\n\t\tCollections.reverse(self);\n\t\treturn self;\n\t}", "private static List<Status> getStatuses(Twitter twitter){\n\t\tList<Status> mainList = new ArrayList<Status>(900);\n\t\tPaging page = new Paging();\n\t\twhile(true){\n\t\t\ttry{\n\t\t\t\tList<Status> list = twitter.getUserTimeline(USER,page);\n\t\t\t\t\n\t\t\t\tif(list.size() == 0) break;\n\t\t\t\t\n\t\t\t\tmainList.addAll(list);\n\t\t\t\tlong max_id = list.get(list.size()-1).getId();\n\t\t\t\t\n\t\t\t\tpage.setMaxId(max_id-1);\n\t\t\t}catch(TwitterException e){\n\t\t\t\tSystem.out.println(\"Exception caught :\" +\n\t\t\t\t\t\t\" some thing wrong, check internet connction or try after some time\");\n\t\t\t\tSystem.out.println(\"error message : \"+ e.toString());\n\t\t\t\tSystem.out.println(\"Program will quit now\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn mainList;\n\t}", "private Artist[] getTop10(List<User> users){\n\t\tArtist[] top=new Artist[10];\n\t\tHashMap<Artist, Integer> rank=new HashMap<Artist,Integer>();\n\t\tfor(User u:users) {\n\t\t\tfor(int i=0;i<u.artists.size();i++) {\n\t\t\t\tArtist a=u.artists.get(i);\n\t\t\t\tInteger weight=rank.getOrDefault(a, 0);\n\t\t\t\trank.put(a, weight+u.artistsWeights.get(i));\n\t\t\t}\n\t\t}\n\t\tArrayList<Artist>ranking=new ArrayList<Artist>();\n\t\tranking.addAll(rank.keySet());\n\t\tranking.sort((a1,a2)->rank.get(a2)-rank.get(a1));\n\t\tfor(int i=0;i<10;i++) {\n\t\t\ttop[i]=ranking.get(i);\n\t\t}\n\t\treturn top;\n\t\t\n\t}", "public void getFavoritesTimeline(Long uid, Long since, Long max, AsyncHttpResponseHandler handler) {\n if (uid == null) {\n Log.i(\"DEBUG\", \"Invalid user id...\");\n return;\n }\n String apiUrl = getApiUrl(\"favorites/list.json\");\n // Specify params\n RequestParams params = new RequestParams();\n params.put(\"user_id\", uid);\n params.put(\"count\", 25);\n if (since != null) {\n params.put(\"since_id\", since);\n } else if (max != null) {\n params.put(\"max_id\", max);\n }\n // Execute the request\n getClient().get(apiUrl, params, handler);\n }", "public List<Integer> getNewsFeed(int userId) {\n\n }", "List<Tweet> findAllByUserInOrderByCreatedAtDesc(List<User> users);", "private List<ResponseList<Status>> get_tweet(long id) {\n\t\tList<ResponseList<Status>> tweets = new ArrayList(2);\n\t\ttry {\n\n\t\t\tPaging paging = new Paging(1, 200);\n\t\t\tResponseList<Status> tmp_Statues = twitter.getUserTimeline(id, paging); // get 200 Tweet\n\t\t\ttweets.add(0, tmp_Statues);\n\t\t\tpaging = new Paging(2, 200);\n\t\t\ttmp_Statues = twitter.getUserTimeline(id, paging);// get another 200 Tweet\n\t\t\ttweets.add(1, tmp_Statues);\n\n\t\t\tSystem.out.println(\"insert Tweets...\");\n\t\t\tSystem.out.println(\"path class\");\n\t\t\tSystem.getProperty(\"java.class.path\");\n\n\t\t\tfor (Status s : tweets.get(0))\n\t\t\t\tdb.insertTweets(s);\n\t\t\tSystem.out.println(\"tweets.get(1)\");\n\n\t\t\tfor (Status s : tweets.get(1))\n\t\t\t\tdb.insertTweets(s);\n\t\t\tSystem.out.println(\"Update_Creat_At(id);\");\n\n\t\t\tdb.Update_Creat_At(id);\n\t\t\tSystem.out.println(\"update_Complete_Tweets\");\n\n\t\t\tdb.update_Complete_Tweets(id);\n\n\t\t} catch (Exception e) {\n\t\t\t// TODO: handle exception\n\t\t\tSystem.out.println(e.getMessage());\n\n\t\t}\n\t\treturn tweets;\n\t}", "public ArrayList<Tweet> getTweetsByUserId(long id) {\n\t\tTweet tweet = null;\n\t\t\n\t\tString queryString = \n\t\t\t \"PREFIX sweb: <\" + Config.NS + \"> \" +\n\t\t\t \"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \" +\n\t\t\t \"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \" +\n\t\t\t \"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\" +\n\t\t\t \"select * \" +\n\t\t\t \"where { \" +\n\t\t\t \t\t\"?user sweb:id \" + id + \".\" +\n\t\t\t \t\t\"?tweet sweb:user ?user. \" +\n\t\t\t \"} \\n \";\n\n\t Query query = QueryFactory.create(queryString);\n\t \n\t QueryExecution qe = QueryExecutionFactory.create(query, this.model);\n\t ResultSet results = qe.execSelect();\n\t \n\t ArrayList<Tweet> tweets = new ArrayList<Tweet>();\n\t while(results.hasNext()) {\n\t \tQuerySolution solution = results.nextSolution() ;\n\t Resource currentResource = solution.getResource(\"tweet\");\n\n\t /* Taking care of the date */\n\t\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-d k:m:s\");\n\t\t\tString dateRaw = currentResource.getProperty(this.createdAt).getString();\n\t\t\tdateRaw = dateRaw.replace('T', ' ');\n\t\t\tdateRaw = dateRaw.replace(\"Z\", \"\");\n\t\t\t\n\t\t\tDate date = null;\n\t\t\ttry {\n\t\t\t\tdate = dateFormat.parse(dateRaw);\n\t\t\t} catch (ParseException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\t\n\t\t\t\n\t tweet = new Tweet(\n\t \t\tString.valueOf(id),\n\t \t\tcurrentResource.getProperty(this.text).getString(),\n\t \t\tdate\n\t );\t\n\t \n\t tweets.add(tweet);\n\t }\n\t \n\t return tweets;\n\t}", "private ArrayList<TweetData> query(QueryTargetInfo info) {\n String url;\n ArrayList<TweetData> tweets = new ArrayList<TweetData>();\n InputStream is = null;\n\n // lastSeenId should have been set earlier.\n // However, if it is still null, just use \"0\".\n if (info.lastSeenId == null) {\n url = String.format(\"%s?q=%s&count=%d&result_type=recent&since_id=0\",\n URL_BASE, info.query, RPP);\n } else if (info.smallestId == null) {\n url = String.format(\"%s?q=%s&count=%d&result_type=recent&since_id=%s\",\n URL_BASE, info.query, RPP, info.lastSeenId);\n } else {\n url = String.format(\"%s?q=%s&count=%d&result_type=recent&since_id=%s&max_id=%s\",\n URL_BASE, info.query, RPP, info.lastSeenId, info.smallestId);\n }\n\n try {\n do {\n URL searchURL = new URL(url);\n HttpsURLConnection searchConnection = (HttpsURLConnection)searchURL.openConnection();\n\n searchConnection.setRequestProperty(\"Host\", \"api.twitter.com\");\n searchConnection.setRequestProperty(\"User-Agent\", \"BirdCatcher\");\n searchConnection.setRequestProperty(\"Authorization\", \"Bearer \" + kBearerToken);\n\n is = searchConnection.getInputStream();\n\n JSONTokener jsonTokener = new JSONTokener(is);\n\n JSONObject json = new JSONObject(jsonTokener);\n\n is.close();\n\n url = getNextLink(json, url, info);\n\n tweets.addAll(getTweets(json, info));\n\n Thread.sleep(1000);\n\n is = null;\n } while (url != null);\n } catch (Exception e) {\n Logger.logError(\"Error performing query\", e);\n\n if (is != null) {\n try {\n java.io.BufferedReader in =\n new java.io.BufferedReader(new java.io.InputStreamReader(is));\n\n String response = \"Response from Twitter:\\n\";\n String temp;\n\n while ((temp = in.readLine()) != null) {\n response += (temp + \"\\n\");\n }\n\n Logger.logDebug(response);\n\n response = null;\n temp = null;\n } catch (Exception ex) {\n }\n }\n\n return tweets;\n }\n\n return tweets;\n }", "public List<ExoSocialActivity> getOlderFeedActivities(Identity owner, Long sinceTime, int limit);", "public List<ExoSocialActivity> getOlderOnActivityFeed(\n Identity ownerIdentity, ExoSocialActivity baseActivity, int limit);", "@Override\n\tpublic List<UserTweet> getFeed() throws Exception {\n\t\tList<UserTweet> usertweets = new ArrayList<UserTweet>();\n\t\t\n\t\tUserTweet userTweet1 = new UserTweet();\n\t\tuserTweet1.setUsername(\"aren from dao\");\n\t\tuserTweet1.setTweetMessage(\"hey was up\");\n\t\t\n\t\tUserTweet userTweet2 = new UserTweet();\n\t\tuserTweet2.setUsername(\"aren2 new\");\n\t\tuserTweet2.setTweetMessage(\"hey was up 2\");\n\t\t\n\t\tusertweets.add(userTweet1);\n\t\tusertweets.add(userTweet2);\n\t\t\n\t\treturn usertweets;\n\t}", "private static void printMostRetweetedTweets() throws Exception{\n\t\t\n\t\tString max_retweeted_tweet[] = new String[3];\t//string containing tweets\n\t\tint max_counts[] = new int[3];\t//string containing their retweet count\n\t\t\n\t\tfor(Status status : statusList){\n\t\t\tif(!status.isRetweet() && status.getURLEntities().length != 0){\n\t\t\t\tint count = status.getRetweetCount();\n\t\t\t\tint index = getMinIndex(max_counts);\n\t\t\t\tif(count>max_counts[index]){\n\t\t\t\t\tmax_counts[index] = count;\n\t\t\t\t\tmax_retweeted_tweet[index] = status.getText();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t/* printing top 3 most retweeted tweets with links in them */\n\t\tSystem.out.println(\"the top 3 most retweeted tweets with links in them : \");\n\t\tfor(int i=0; i<3; i++){\n\t\t\tSystem.out.println(\"Tweet : \" + max_retweeted_tweet[i] + \" retweeted \"+ max_counts[i] + \" times\" );\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t}", "@Override\n\tpublic List<Post> getRecentPostsForUser(String arg0, int arg1)\n\t\t\tthrows Exception {\n\t\treturn null;\n\t}", "public List<Tweet> getAllTweets() {\n\t\tList<Tweet> tweets = new ArrayList<Tweet>();\n\t\tString selectQuery = \"SELECT * FROM \" + TweetDataSource.TABLE_TWEETS;\n\n\t\tSQLiteDatabase db = this.getReadableDatabase();\n\t\tCursor c = db.rawQuery(selectQuery, null);\n\n\t\t// looping through all rows and adding to list\n\t\tif (c.moveToFirst()) {\n\t\t\tdo {\n\t\t\t\tTweet tweet = TweetDataSource.cursorToTweet(c);\n\n\t\t\t\tUser user = getUserById(c.getLong(c\n\t\t\t\t\t\t.getColumnIndex(TweetDataSource.COLUMN_USER_UID)));\n\t\t\t\ttweet.setUser(user);\n\n\t\t\t\t// adding to list\n\t\t\t\ttweets.add(tweet);\n\t\t\t} while (c.moveToNext());\n\t\t}\n\n\t\treturn tweets;\n\t}", "public ArrayList<Tweet> getTweets() {\n Collections.sort(tweets, new Comparator<Tweet>() {\n public int compare(Tweet tweet1, Tweet tweet2) {\n return tweet1.getDate().compareTo(tweet2.getDate());\n }\n });\n\n return tweets;\n }", "public List<String> homeTimeline() {\r\n\t\tList<String> twitterResponseList = new ArrayList<String>();\r\n\t\ttry {\r\n\t\t\tProperties properties = getProperties();\r\n\t\t\tString apiUrl = properties.getProperty(\"twitter.api.home.timeline\") + \"?count=10\"; // append count to max of\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 10\r\n\r\n\t\t\tHttpResponse apiResponse = executeHttpGet(apiUrl);\r\n\r\n\t\t\tif (200 == apiResponse.getStatusLine().getStatusCode()) {\r\n\t\t\t\tJSONArray jsonArray = new JSONArray(EntityUtils.toString(apiResponse.getEntity()));\r\n\t\t\t\tfor (int i = 0; i < jsonArray.length(); i++) {\r\n\t\t\t\t\tJSONObject jsonObject = (JSONObject) jsonArray.get(i);\r\n\t\t\t\t\tJSONObject userObject = (JSONObject) jsonObject.get(\"user\");\r\n\t\t\t\t\tString displayText = (String) userObject.get(\"screen_name\") + \" : \"\r\n\t\t\t\t\t\t\t+ (String) jsonObject.get(\"text\"); // data to be displayed in screen_name : tweet format\r\n\t\t\t\t\ttwitterResponseList.add(displayText); // list of data in the format mentioned above\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\treturn twitterResponseList;\r\n\r\n\t}", "@Override\n public void onLoadMore(long max_id, int totalItemsCount, RecyclerView view) {\n if (currentUser == null) {\n populateTimeline(index, null);\n //getLocalTweets();\n }\n else{\n populateTimeline(index, currentUser.getScreenName());\n //getLocalTweets();\n }\n }", "@Override\n public void onTweetsFetched(List<Tweet> tweets) {\n finalTweetID = tweets.get(tweets.size() - 1).getId();\n twitterCallback.onTweetsFetched(tweets); //Return tweets\n }", "public Artist[] getTop10() {\n\t\tArrayList<User> users=new ArrayList<User>();\n\t\tusers.addAll(this.users.values());\n\t\treturn getTop10(users);\n\t}", "@Override\n public List<News> getTop(int top) throws Exception {\n Connection conn = null;\n PreparedStatement statement = null;\n ResultSet result = null;\n List<News> list = new ArrayList<>();\n String query = \"select top (?) * from news\\n\"\n + \"order by timePost desc\";\n try {\n conn = getConnection();\n statement = conn.prepareStatement(query);\n statement.setInt(1, top);\n result = statement.executeQuery();\n while (result.next()) {\n News news = new News(result.getInt(\"ID\"),\n result.getString(\"title\"),\n result.getString(\"description\"),\n result.getString(\"image\"),\n result.getString(\"author\"),\n result.getDate(\"timePost\"),\n result.getString(\"shortDes\"));\n list.add(news);\n }\n } catch (ClassNotFoundException | SQLException e) {\n throw e;\n } finally {\n closeResultSet(result);\n closePreparedStatement(statement);\n closeConnection(conn);\n }\n return list;\n }", "public ArrayList<Message> getTop10Messages(String logUser, String friendUser, String date){\n ArrayList<Message> myMessageList = new ArrayList<>();\r\n //System.out.println(\"getTop10Date: \" + date);\r\n this.query = \"SELECT * FROM cristomessenger.message\\n\" +\r\n \"WHERE ((id_user_orig = \\\"\" + logUser + \"\\\" and id_user_dest = \\\"\" + friendUser + \"\\\") or (\"\r\n + \"id_user_orig = \\\"\" + friendUser + \"\\\" and id_user_dest = \\\"\" + logUser + \"\\\")) and \"\r\n + \"datetime < \\\"\" + date + \"\\\" \" +\r\n \"order by datetime asc LIMIT 10;\";\r\n try {\r\n this.ConnectDatabase();\r\n this.QuerySQLExecute();\r\n while (this.rs.next()) {\r\n Message MessageAux = new Message();\r\n MessageAux.setTransmitter(this.rs.getString(\"id_user_orig\"));\r\n MessageAux.setReceiver(this.rs.getString(\"id_user_dest\"));\r\n MessageAux.setText(this.rs.getString(\"text\"));\r\n MessageAux.setDate(this.rs.getString(\"datetime\"));\r\n myMessageList.add(MessageAux);\r\n }\r\n //System.out.println(\"getTop10MSG: \" + myMessageList.size());\r\n } catch (SQLException e ) {\r\n System.out.println(e.getMessage());\r\n } finally {\r\n if (this.stmt != null) { \r\n try {\r\n this.stmt.close();\r\n } catch (SQLException ex) {\r\n Logger.getLogger(UsersModel.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n }\r\n \r\n return myMessageList;\r\n }", "public List<Status> getTweets() {\r\n\t\tincrementShutdownTimer();\r\n\t\treturn tweets;\r\n\t}", "public void getRecentUsers(View view){\n SharedPreferences sharedPref = getContext().getSharedPreferences(\"recentVisited\", Context.MODE_PRIVATE);\n int size = sharedPref.getInt(\"size\", 0);\n\n // clears the variables.\n userName.clear();\n uid.clear();\n for (int i = size+1; i >0 ; i--) {\n String name= sharedPref.getString(\"name_\"+i,\"deleted\");\n String userId= sharedPref.getString(\"uid_\"+i,\"deleted\");\n if (!Objects.equals(name, \"deleted\")){\n userName.add(name);\n uid.add(userId);\n }\n\n }\n\n setList(view);\n }", "public List<ExoSocialActivity> getOlderUserActivities(Identity owner, Long sinceTime, int limit);", "public List<ExoSocialActivity> getOlderOnUserActivities(\n Identity ownerIdentity, ExoSocialActivity baseActivity, int limit);", "private List<NewsArticle> getMostPopular() {\n LOGGER.log(Level.INFO, \"getMostPopular\");\n return newsService.getMostPopular();\n }", "public Artist[] getTop10(int userID) {\n\t\tUser user=users.get(userID);\n\t\tArrayList<User> users=new ArrayList<User>();\n\t\tusers.addAll(user.friends);\n\t\tusers.add(user);\n\t\treturn getTop10(users);\n\t}", "public String getTweets(int user, int n) throws TwitterException{\n\t\n\n\t\ttry {\n\t\t\t\n\t\t\t\n\t twitter4j.User user1 = twitter.showUser(user);\n\t // System.out.println(\"INIZIO PER \" + user1.getScreenName() + \" - isProtect: \" + user1.isProtected()); \n\t \n\t \n\t if (user1.getLang().equalsIgnoreCase(\"en\") && user1.isProtected() == false /*&& user1.getFollowersCount() > 50*/ ){\n\t\t\t\t//First param of Paging() is the page number, second is the number per page (this is capped around 200 I think.\n\t\t\t\tPaging paging = new Paging(1, n);// fet 200 twett\n\t\t\t\tList<Status> statuses = twitter.getUserTimeline(user, paging);\n\t\t \tString out = \"\";\n\t\t\t\t/*User's Tweets*/\n\t\t\t\tfor(Status st : statuses)\n\t\t\t\t{\n\t\t\t\t//\tSystem.out.println(st.getUser().getLocation() + \" \" + st.getUser().getScreenName()+\" ----------- \" + st.getText() + \"\\n\");\n\t\t\t\t\tif (st.getLang().equals(\"en\")){\n\t\t\t\t\t\tout = out + \"\\n\" + st.getText();\n\t\t\t\t\t//\tSystem.out.println(st.getText()+ \" \" + user);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\treturn out;\n\t } else {\n\t \treturn \"\";\n\t }\n\n\t\t} catch (TwitterException name) {\n\t\t\t\n\t\t//\tSystem.out.println(\"This username is not valid \" + name.getErrorMessage());\n\t\t\treturn \"\";\n\t\t} \n\t\t\n \t\n }", "@Transactional\r\n\tpublic List<Tweet> getAllTweets() {\n\t\tList<Tweet> tweets = tweetRepository.findAll(Sort.by(Sort.Direction.DESC, \"postDTTM\"));\r\n\t\treturn tweets;\r\n\t}", "public ArrayList<String> getTweets (long currentUserId) throws TwitterException {\n\t\tArrayList<String> tweets = new ArrayList<String>();\n\n\t\tPaging paging = new Paging();\n\t\tResponseList<Status> currentUserTimeLine = this.twitter.getUserTimeline(currentUserId, paging);\n\n\t\tfor(Status status:currentUserTimeLine) {\n\t\t\ttweets.add(status.getText());\n\t\t}\n\n\t\treturn tweets;\n\t}", "public void getUserTimeline(Long uid, Long since, Long max, AsyncHttpResponseHandler handler) {\n if (uid == null) {\n Log.i(\"DEBUG\", \"Invalid user id...\");\n return;\n }\n String apiUrl = getApiUrl(\"statuses/user_timeline.json\");\n // Specify params\n RequestParams params = new RequestParams();\n params.put(\"user_id\", uid);\n params.put(\"count\", 25);\n if (since != null) {\n params.put(\"since_id\", since);\n } else if (max != null) {\n params.put(\"max_id\", max);\n }\n // Execute the request\n getClient().get(apiUrl, params, handler);\n }", "private void refreshFeed() {\n ParseQuery<Post> query = ParseQuery.getQuery(Post.class);\n query.include(Post.KEY_USER);\n query.addDescendingOrder(\"createdAt\");\n query.setLimit(20);\n query.findInBackground(new FindCallback<Post>() {\n // Result of the call to Parse\n @Override\n public void done(List<Post> queryPosts, ParseException e) {\n // There is an error\n if(e != null) {\n Log.e(TAG, \"Error in getting posts\");\n return;\n }\n for(Post post : queryPosts) {\n // post.getUser() gets the Id... post.getUser().getUsername() gets the Username associated to the id of getUser in User's table\n Log.i(TAG, \"Post \" + post.getDescription() + \" username: \" + post.getUser().getUsername());\n }\n\n adapter.clear();\n adapter.addAll(queryPosts);\n }\n });\n }", "List<Tweet> findAllByUserOrderByCreatedAtDesc(User user);", "public List<ExoSocialActivity> getNewerFeedActivities(Identity owner, Long sinceTime, int limit);", "public static List<Status> getFeed() throws TwitterException {\n\t\tTwitter twitter = TwitterFactory.getSingleton();\n\t\tPaging paging = new Paging(1,100);\n\t\tList<Status> statuses = twitter.getHomeTimeline(paging);\n\t\treturn statuses;\n\t}", "@Override\n public void run() {\n ArrayList<Tweet> tweets = getTweets();\n int numTweets = tweets.size();\n long id = tweets.get(numTweets - 1).mUid - 1;\n Log.d(TAG, \"Requested items id starting at id = \" + id);\n populateHomeTimelineFromId(id);\n }", "public int getNumberOfOlderOnActivityFeed(Identity ownerIdentity, Long sinceTime);", "public LinkedList<User> getUsers() throws TwitterException {\n System.out.println(\"##########Getting The Tweets##########\");\n LinkedList<User> users = new LinkedList<>();\n for (String keyword : this.wordsLookingFor) {\n //Search for tweets\n for (Status A : this.searchTweets(keyword)) {\n //System.out.println(A.getText());\n getUserFromStatus(users, A);\n }\n }\n\n System.out.println(\"Users Number is \".concat(Integer.toString(users.size())));\n return users;\n }", "private void loadMoreData() {\n twitterClient.getNextPageOfTweets(new JsonHttpResponseHandler() {\n @Override\n public void onSuccess(int statusCode, Headers headers, JSON json) {\n Log.i(ACTIVITY_TAG, \"onSuccess: loadMoreData\");\n // deserialize and construct new model objects from API response\n JSONArray jsonArray = json.jsonArray;\n try {\n // append new data object tweets to existing list\n // notify adapter\n tweetsAdapter.addAll(Tweet.fromJsonArray(jsonArray));\n } catch (JSONException e) {\n Log.e(ACTIVITY_TAG, \"JSON exception: loadMoreData\", e);\n }\n }\n\n @Override\n public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) {\n Log.e(ACTIVITY_TAG, \"onFailure: loadMoreData:\" + response , throwable);\n }\n }, tweets.get(tweets.size() - 1).getId());\n }", "@RequestMapping(\"/top-posts\")\n public List<PostEntity> topPostsByUser(Principal principal) {\n List<PostEntity> fullList = postService.topPostsByUser(principal.getName());\n List<PostEntity> top15List = new ArrayList<>();\n int counterMax;\n\n if (fullList.size() < 15) {\n counterMax = fullList.size();\n } else {\n counterMax = 14;\n }\n\n for (int i = 0; i < counterMax; i++) {\n top15List.add(fullList.get(i));\n }\n\n return top15List;\n }", "public List<User> getUsersByNumberOfPosts(int N);", "public List<ExoSocialActivity> getOlderComments(ExoSocialActivity existingActivity, Long sinceTime, int limit);", "public CompletableFuture<List<Status>> getUserTimeline(String screenName){\n CompletableFuture<List<Status>> userTimeline= null;\n\n try {\n userTimeline=CompletableFuture.supplyAsync(() -> {\n List<Status> temp=null;\n try{\n temp=twitter.getUserTimeline(screenName).stream().limit(10).collect(Collectors.toList());\n }\n catch (Exception e){\n e.printStackTrace();\n }\n return temp;\n });\n return userTimeline;\n }\n catch (Exception e){\n e.printStackTrace();\n }\n\n return userTimeline;\n }", "public void populateTimeline(long maxId, String screenName) {\n\n //check connectivity:\n if (Utilities.isNetworkAvailable(getContext()) && Utilities.isOnline()) {\n\n twitterClient.getUserTimeline(new JsonHttpResponseHandler() {\n @Override\n public void onSuccess(int statusCode, Header[] headers, JSONArray response) {\n // deserialize the response and create models\n ArrayList<Tweet> tweetList = Tweet.fromJSONArray(response);\n\n //load data into the view:\n\n //store reference to current size\n int currentSize = tweets.size();\n\n //add retrieved tweets to existing list\n tweets.addAll(tweetList);\n\n //visually refresh the list\n tweetsAdapter.notifyItemRangeInserted(currentSize, tweetList.size());\n\n if (!tweetList.isEmpty()) {\n updateIndex();\n }\n swipeContainer.setRefreshing(false);\n }\n\n @Override\n public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONArray errorResponse) {\n Toast.makeText(getContext(), \"Error in request\", Toast.LENGTH_SHORT).show();\n }\n\n\n @Override\n public void onUserException(Throwable error) {\n Toast.makeText(getContext(), R.string.on_user_exception, Toast.LENGTH_SHORT).show();\n }\n }, maxId, screenName);\n } else {\n Toast.makeText(getContext(), R.string.device_not_connected, Toast.LENGTH_SHORT).show();\n }\n }", "public int getNumberOfNewerOnActivityFeed(Identity ownerIdentity, Long sinceTime);", "public List<Song> findTopTen(){\n\t\treturn this.songRepo.findTop10ByOrderByRatingDesc();\n\t}", "protected void populateFeed() {\n ParseQuery<Post> query = ParseQuery.getQuery(Post.class);\n query.include(Post.KEY_USER);\n query.addDescendingOrder(Post.CREATED_AT);\n query.setLimit(20);\n query.findInBackground(new FindCallback<Post>() {\n // Result of the call to Parse\n @Override\n public void done(List<Post> queryPosts, ParseException e) {\n // There is an error\n if(e != null) {\n Log.e(TAG, \"Error in getting posts\");\n return;\n }\n for(Post post : queryPosts) {\n // post.getUser() gets the Id... post.getUser().getUsername() gets the Username associated to the id of getUser in User's table\n Log.i(TAG, \"Post \" + post.getDescription() + \" username: \" + post.getUser().getUsername());\n }\n posts.addAll(queryPosts);\n adapter.notifyDataSetChanged();\n }\n });\n }", "public int getNumberOfOlderOnActivityFeed(Identity ownerIdentity, ExoSocialActivity baseActivity);", "@Scheduled(fixedRate = 120000)\n public void readRss() {\n\n List<ItemNews> itemList = new ArrayList<>();\n\n try {\n String url = \"https://www.nytimes.com/svc/collections/v1/publish/https://www.nytimes.com/section/world/rss.xml\";\n\n try (XmlReader reader = new XmlReader(new URL(url))) {\n SyndFeed feed = new SyndFeedInput().build(reader);\n for (SyndEntry entry : feed.getEntries()) {\n LocalDateTime localDateTime = entry.getPublishedDate().toInstant()\n .atZone(ZoneId.systemDefault())\n .toLocalDateTime();\n ItemNews item = new ItemNews();\n item.setTitle(entry.getTitle());\n item.setAuthor(entry.getAuthor());\n item.setLink(entry.getLink());\n item.setDescription(entry.getDescription().getValue());\n item.setDateTime(localDateTime);\n modifyItem(item);\n itemList.add(item);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n if (!itemList.isEmpty()) {\n Collections.sort(itemList , Comparator.comparing(ItemNews::getDateTime));\n saveItems(itemList);\n }\n }", "public void postTweet(int userId, int tweetId) {\n tweets.put(tweetId, idx++);\n LinkedList<Integer> tweets = userToTwitter.computeIfAbsent(userId, e -> new LinkedList<>());\n tweets.addLast(tweetId);\n while (tweets.size() > 10) {\n tweets.removeFirst();\n }\n }", "private void getFirsTopRatedMovies() {\n\t\ttry {\n\t\t\tMovieApiClient movieApiClient = MovieDbApi.getRetrofitClient().create(MovieApiClient.class);\n\t\t\tCall<TopRatedMovies> call = movieApiClient.getTopRatedMovies(getString(R.string.api_key), \"en_US\", currentPage);\n\t\t\tcall.enqueue(new Callback<TopRatedMovies>() {\n\t\t\t\t@Override\n\t\t\t\tpublic void onResponse(Call<TopRatedMovies> call, Response<TopRatedMovies> response) {\n\t\t\t\t\tif (response.isSuccessful()) {\n\t\t\t\t\t\tTopRatedMovies topRatedMovies = response.body();\n\t\t\t\t\t\tList<TopRatedMovieResults> topRatedMovieResults = topRatedMovies.getResults();\n\t\t\t\t\t\tprogress.setVisibility(View.GONE);\n\t\t\t\t\t\tadapter.addAll(topRatedMovieResults);\n\n\t\t\t\t\t\tif (currentPage <= TotalPages)\n\t\t\t\t\t\t\tadapter.addLoadingFooter();\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tisLastPage = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprogress.setVisibility(View.GONE);\n\t\t\t\t\t\tlayout_nothing_to_show.setVisibility(View.VISIBLE);\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), getString(R.string.error), Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onFailure(Call<TopRatedMovies> call, Throwable t) {\n\t\t\t\t\tif (t instanceof SocketTimeoutException || t instanceof IOException) {\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), getString(R.string.no_netowrk), Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\tLog.e(\"ERROR\", getString(R.string.no_netowrk), t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tLog.e(\"ERROR\", getString(R.string.error), t);\n\t\t\t\t\t\tToast.makeText(getApplicationContext(), getString(R.string.error), Toast.LENGTH_SHORT).show();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "Data<List<User>> getFollowers(Integer limit);", "public Twitter() {\n\t\t\tuserMap = new HashMap<>();\n\t\t\tmaxFeed = 10;\n\t\t}", "List<Tweet> findAllByOrderByCreatedAtDesc();", "List<Event> fetchRecentEvents(User user, int limit) throws PersistenceException, InvalidArgumentException;", "@Override\n public List<Track> recommendByRecentListen (Long uid) {\n List<Track> recommendation = new ArrayList<>();\n List<Listen> mostRecentListen = listenRepository.getTop3ByUidOrderByTimestampDesc(uid);\n if(mostRecentListen == null) {\n recommendation.addAll(trackRepository.getTop10ByArtist(artistRepository.getArtistFromId(1L)));\n return recommendation;\n }\n mostRecentListen.stream().forEach(listen -> {\n Artist mostRecentArtist = trackRepository.findById(listen.getTid()).getArtist();\n recommendation.addAll(trackRepository.getTop3ByArtist(mostRecentArtist));\n });\n if(mostRecentListen!=null && mostRecentListen.size()>1){\n recommendation.add(trackRepository.findById(mostRecentListen.get(0).getTid()));\n }\n\n return recommendation;\n }", "public int getCount() {\n return tweets.size();\n }", "public List<News> getNewsList(Integer id) {\n List<News> newsList = newsMapper.selectByAuthorId(id);\n newsList.sort((dt1,dt2) -> {\n if (dt1.getPubdate().getTime() < dt2.getPubdate().getTime()) {\n return 1;\n } else if (dt1.getPubdate().getTime() > dt2.getPubdate().getTime()) {\n return -1;\n } else {\n return 0;\n }\n });\n return newsList;\n }", "public void getTweets() {\r\n\t\t\r\n\t\tConfigurationBuilder cb = new ConfigurationBuilder();\r\n\t\tcb.setDebugEnabled(true);\r\n\t\t\r\n\t\t//provide your own keys\r\n\t cb.setOAuthConsumerKey(\"ConsumerKey\");\r\n\t cb.setOAuthConsumerSecret(\"ConsumerSecret\");\r\n\t cb.setOAuthAccessToken(\"AccessToken\");\r\n\t cb.setOAuthAccessTokenSecret(\"TokenSecret\");\r\n\r\n TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance(); \r\n \r\n //Check for live status updates\r\n StatusListener listener = new StatusListener() {\r\n\r\n @Override\r\n public void onException(Exception arg0) {\r\n \tSystem.out.println(\"Exception!! Data Not Inserted Into Database\");\r\n }\r\n\r\n @Override\r\n public void onDeletionNotice(StatusDeletionNotice arg0) {\r\n \tSystem.out.println(\"Got a status deletion notice id:\" + arg0.getStatusId());\r\n }\r\n \r\n @Override\r\n public void onScrubGeo(long userId, long upToStatusId) {\r\n System.out.println(\"Got scrub_geo event userId:\" + userId + \" upToStatusId:\" + upToStatusId);\r\n }\r\n \r\n @Override\r\n public void onStatus(Status status) {\r\n \t\r\n \t User user = status.getUser();\r\n \t \r\n String username = status.getUser().getScreenName();\r\n String profileLocation = user.getLocation();\r\n long tweetId = status.getId(); \r\n String content = status.getText();\r\n \r\n \r\n //Create a model for the live data\r\n TweetModel memoryData = new TweetModel(username, profileLocation, tweetId, content);\r\n \r\n //store to MongoDB if data is correct\r\n System.out.println(++counter + \") username: \" + username + \" location: \" + profileLocation + \" tweetId \" + tweetId + \" Text: \" + content );\r\n data.save(memoryData);\r\n }\r\n \r\n\t\t\t@Override\r\n public void onTrackLimitationNotice(int arg0) {\r\n\t System.out.println(\"Got track limitation notice:\" + arg0);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t@Override\r\n\t\t\tpublic void onStallWarning(StallWarning warning) {}\r\n };\r\n \r\n //Filter the live tweet results\r\n FilterQuery filterQuery = new FilterQuery();\r\n //Search for tweets with specific keywords\r\n String keywords[] = {\"Java\", \"Python\", \"PHP\"};\r\n //Restrict the language to English\r\n String[] lang = {\"en\"}; \r\n //Add the Filters\r\n filterQuery.language(lang);\r\n filterQuery.track(keywords);\r\n //Listen for Live Tweets\r\n twitterStream.addListener(listener);\r\n twitterStream.filter(filterQuery);\r\n\t}", "public List<ExoSocialActivity> getOlderOnUserSpacesActivities(\n Identity ownerIdentity, ExoSocialActivity baseActivity, int limit);", "@PostMapping(\"/timeline\")\n\tpublic List<tweets> timelineList() {\n\n\t\tList<Tweet> timeline = twitter.timelineOperations().getHomeTimeline();\n\t\tfor (Tweet tweet : timeline) {\n\t\t\ttweets objTweets = new tweets(0, tweet.getText(), tweet.getProfileImageUrl(), tweet.getFromUser());\n\t\t\tservice.saveTweets(objTweets);\n\t\t}\n\t\tList<tweets> home = service.listAll();\n\t\treturn home;\n\t}", "@Override\n\tpublic List<PositionData> getLatest10PostionInfo(String terminalId) {\n\t\ttry {\n\t\t\tList<PositionData> returnData = new ArrayList<PositionData>();\n\t\t\tList<PositionData> tempData = new ArrayList<PositionData>();\n\t\t\tList<PositionData> position_list = positionDataDao.findByHQL(\"from PositionData where tid = '\" + terminalId + \"' order by date desc\");\n\t\t\tfor(int i=0;i<(position_list.size()>10?10:position_list.size());i++){\n\t\t\t\ttempData.add(position_list.get(i));\n\t\t\t}\n\t\t\tfor(int i=tempData.size()-1;i>=0;i--)\n\t\t\t\treturnData.add(tempData.get(i));\n\t\t\treturn returnData;\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}", "@Override\n public int getItemCount() {\n return tweets.size();\n }", "@Path(\"fetch/{query}/{limit}\")\r\n @GET\r\n @Produces(MediaType.APPLICATION_JSON)\r\n public Response fetchTweets(@PathParam(\"query\") final String query, @PathParam(\"limit\") final String limit)\r\n {\r\n log.debug(\"GET: augmentTweets: \" + query + \"\\tlimit string: \" + limit);\r\n\r\n final TweetList list = new TweetList();\r\n final int limitValue = Integer.parseInt(limit);\r\n\r\n // TODO try-with-resources should be:\r\n // try(final MongoClient client = new MongoClient(host, port)){\r\n try (final MongoClient client = new MongoClient(\"74.140.208.12\", 6789))\r\n {\r\n final MongoCollection<Document> coll = client.getDatabase(\"visualdb\").getCollection(\"visualcollection\");\r\n\r\n final Document queryDoc = new Document();\r\n queryDoc.put(\"query\", query);\r\n\r\n final FindIterable<Document> results = coll.find(queryDoc);\r\n\r\n int count = 0;\r\n for (final Document doc : results)\r\n {\r\n count++;\r\n\r\n final Tweet tweet = new Tweet();\r\n tweet.setText(doc.getString(\"text\"));\r\n tweet.setTweetUrl(doc.getString(\"url\"));\r\n tweet.setId(doc.getString(\"tweetId\"));\r\n\r\n final Location loc = new Location();\r\n loc.setInitialized(true);\r\n\r\n final Document locationDoc = doc.get(\"loc\", Document.class);\r\n loc.setLatitude(locationDoc.getDouble(\"latitude\").doubleValue());\r\n loc.setLongitude(locationDoc.getDouble(\"longitude\").doubleValue());\r\n tweet.setLocation(loc);\r\n\r\n final List<String> imageUrls = new ArrayList<>();\r\n final List<?> urls = doc.get(\"images\", List.class);\r\n\r\n for (final Object object : urls)\r\n {\r\n imageUrls.add(object.toString());\r\n }\r\n tweet.setImageUrls(imageUrls);\r\n\r\n final List<String> entities = new ArrayList<>();\r\n final List<?> entityList = doc.get(\"entities\", List.class);\r\n for (final Object object : entityList)\r\n {\r\n entities.add(object.toString());\r\n }\r\n tweet.setExtractedEntities(entities);\r\n list.getTweets().add(tweet);\r\n\r\n if (count > limitValue)\r\n {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return Response.ok(list).build();\r\n }", "Data<List<User>> getFollowersCursor(String cursor, Integer limit);", "public static List<Tweet> getTweetList(List<TweetWithUser> tweetWithUsers) {\n List<Tweet> tweets = new ArrayList<>();\n for (int i = 0; i < tweetWithUsers.size(); i++) {\n Tweet tweet = tweetWithUsers.get(i).tweet;\n tweet.user = tweetWithUsers.get(i).user;\n tweets.add(tweet);\n }\n return tweets;\n }", "Data<List<User>> getfollowingUsers(Integer limit);", "public List<Song> topTen() {\n\t\treturn lookifyRepository.findTop10ByOrderByRatingDesc();\n\t}", "public List<Kweet> getTimelineKweets(String username) {\n return kweetDAO.getTimelineKweets(username);\n }", "public static ArrayList<NewsItem> loadNews(int descending) throws JSONException{\n \t\t\n \t\t//Get JSON string from server\n \t\tString result = getJSON(Constants.NEWSFEED + descending); \n \t\t\n \t\tList<NewsItem> posts = new ArrayList<NewsItem>();\n \t\t\n \t\t//Parse JSON string\n \t\t\tJSONObject json_obj = new JSONObject(result);\n \t\t\tJSONArray json_arr = json_obj.getJSONArray(\"data\");\n \t\t\t\n \t\t\tfor (int i = 0; i < json_arr.length(); i++){\n \t\t\t\t//Get post message\n \t\t\t\tString message = json_arr.getJSONObject(i).optString(\"message\");\n \t\t\t\t\n \t\t\t\t//Get date\n \t\t\t\tString[] date = json_arr.getJSONObject(i).optString(\"created_time\").split(\"T\");\n \t\t\t\t\n \t\t\t\t//Get image url\n \t\t\t\tString image = json_arr.getJSONObject(i).optString(\"picture\");\n \t\t\t\t\n \t\t\t\tif(!image.equals(\"\")){\n \t\t\t\t\timage = image.replace(\"s.jpg\", \"n.jpg\");\n\t\t\t\t\timage = image.replace(\"s.png\", \"n.png\");\n \t\t\t\t}\n \t\t\t\t\n \t\t\t\t//Add to posts if valid content\n \t\t\t\tif ((!message.equals(\"\")) && (!date.equals(\"\"))){\n \t\t\t\t\tposts.add(new NewsItem(message, date[0], image));\n \t\t\t\t}\n \t\t\t}\n \t\t\n \t\treturn (ArrayList<NewsItem>) posts;\n \t}", "private int gather(QueryTargetInfo info) {\n ArrayList<TweetData> res;\n int count = 0;\n int tempCount;\n int ndx;\n boolean flag = true;\n\n info.smallestId = null;\n\n do {\n flag = true;\n res = query(info);\n\n //If there was an error getting the tweets, then don't continue.\n if (res == null) {\n flag = false;\n } else {\n //If we did not get the maximum tweets, then don't continue\n if (res.size() < (MAX_PAGES * RPP)) {\n flag = false;\n }\n\n //Save the results in the db.\n tempCount = store.insertTweets(info, res);\n\n count += tempCount;\n }\n } while (flag);\n\n return count;\n }", "public List<ExoSocialActivity> getOlderUserSpacesActivities(Identity owner, Long sinceTime, int limit);", "public List<ExoSocialActivity> getOlderOnSpaceActivities(Identity spaceIdentity,\n ExoSocialActivity baseActivity,\n int limit);", "public void userWithMostLikes() {\n Map<Integer, Integer> userLikesCount = new HashMap<>();\n Map<Integer, User> users = DataStore.getInstance().getUsers();\n \n for (User user : users.values()) {\n for (Comment c : user.getComments()) {\n int likes = 0;\n if (userLikesCount.containsKey(user.getId())) {\n likes = userLikesCount.get(user.getId());\n }\n likes += c.getLikes();\n userLikesCount.put(user.getId(), likes);\n }\n }\n int max = 0;\n int maxId = 0;\n for (int id : userLikesCount.keySet()) {\n if (userLikesCount.get(id) > max) {\n max = userLikesCount.get(id);\n maxId = id;\n }\n }\n System.out.println(\"User with most likes: \" + max + \"\\n\" \n + users.get(maxId));\n }", "public void userWithMostLikes() {\n Map<Integer, Integer> userLikesCount = new HashMap<>();\n Map<Integer, User> users = DataStore.getInstance().getUsers();\n \n for (User user : users.values()) {\n for (Comment c : user.getComments()) {\n int likes = 0;\n if (userLikesCount.containsKey(user.getId())) {\n likes = userLikesCount.get(user.getId());\n }\n likes += c.getLikes();\n userLikesCount.put(user.getId(), likes);\n }\n }\n int max = 0;\n int maxId = 0;\n for (int id : userLikesCount.keySet()) {\n if (userLikesCount.get(id) > max) {\n max = userLikesCount.get(id);\n maxId = id;\n }\n }\n System.out.println(\"User with most likes: \" + max + \"\\n\" \n + users.get(maxId));\n }", "@GET(\"user-news-article-content?expand=newsArticle,newsArticle.newsArticleType,newsArticle.translations,newsArticle.like,newsArticle.liked,newsArticle.comments_count&per-page=1000\")\n Call<UserNewsResponse>getUserNews();", "public void searchUserAccount( )\r\n throws TwitterException, URISyntaxException, IOException{\r\n\r\n // looks at all tweets since this page\r\n // the count is the limit\r\n\r\n int count = 0;\r\n String text = \"\";\r\n Paging paging = new Paging(pageInt, 10);\r\n List<Status> statuses = twitter.getUserTimeline(user, paging);\r\n\r\n for (Status s : statuses) {\r\n String url = \"https://twitter.com/\" + s.getUser().getScreenName() + \"/status/\" + s.getId();\r\n if (s.getRetweetedStatus() == null) {\r\n content = url;\r\n //send the links to text\r\n HandleFile(override, active);\r\n\r\n //regular expressions\r\n String regex = \"https://t.co/.*\";\r\n text = s.getText().replaceAll(regex,\"\");\r\n\r\n System.out.println(s.getUser().getName() + \": \" + text);\r\n System.out.println(url); //prints the url of the tweet\r\n System.out.println(s.getCreatedAt()+\"\\n\");\r\n\r\n //sets the tweets to variables to be exported\r\n tweets = tweets + \" \" +text + \"\\n\"+ url + \"\\n\" + s.getCreatedAt() + \"\\n\\n\";\r\n\r\n\r\n active = false;\r\n\r\n //search for nudes\r\n getTwitterImage(s);\r\n }\r\n count++;\r\n\r\n if(count == 5 && limitInt > 0){\r\n limitInt--;\r\n pageInt++;\r\n searchUserAccount();\r\n }\r\n }\r\n }" ]
[ "0.74031943", "0.72697574", "0.7105399", "0.70931816", "0.70775187", "0.70763576", "0.7032798", "0.6988661", "0.6974764", "0.6936991", "0.6934822", "0.6849612", "0.6745586", "0.65934104", "0.6431383", "0.626682", "0.6154491", "0.60707486", "0.60458946", "0.5976068", "0.5941378", "0.5939905", "0.59156495", "0.58728933", "0.58603364", "0.58486515", "0.581073", "0.58072364", "0.57974", "0.579718", "0.5794841", "0.5787337", "0.57788616", "0.5773152", "0.5735888", "0.5727772", "0.5698356", "0.5694118", "0.5661478", "0.5650547", "0.5635204", "0.562877", "0.5623376", "0.56134963", "0.5571033", "0.55293894", "0.5526521", "0.55202913", "0.54943055", "0.54929274", "0.5489174", "0.5471748", "0.546316", "0.5446138", "0.5444737", "0.5415731", "0.5401006", "0.540034", "0.5389921", "0.5375376", "0.5370716", "0.53609943", "0.5360669", "0.5346463", "0.5344235", "0.5312204", "0.52943397", "0.52913326", "0.5274536", "0.52610874", "0.52569443", "0.5247128", "0.5223923", "0.5221573", "0.52053046", "0.519555", "0.51954377", "0.5182853", "0.5181302", "0.51757175", "0.51525074", "0.5149083", "0.5148546", "0.5143626", "0.51422966", "0.51303065", "0.5126262", "0.5122078", "0.50982577", "0.50960886", "0.50801414", "0.5078197", "0.5077833", "0.50736564", "0.50689316", "0.50679225", "0.50662994", "0.50662994", "0.5064188", "0.5061165" ]
0.7061101
6
follower follows a followee
public void follow(int followerId, int followeeId) { // if (!followees.containsKey(followerId)) { followees.put(followerId, new HashSet<>()); } followees.get(followerId).add(followeeId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void follow(int followerId, int followeeId) {\n\n }", "public void follow(int followerId, int followeeId) {\n if (followerId == followeeId) return;\n User follower = getOrCreateUser(followerId);\n User followee = getOrCreateUser(followeeId);\n\n if (!follower.following.contains(followee))\n follower.following.add(followee);\n }", "public void follow(int followerId, int followeeId) {\n User source = null, target = null;\n for (User user : users) {\n if (user.id == followerId) {\n source = user;\n } else if (user.id == followeeId) {\n target = user;\n }\n }\n if (source == null) {\n source = new User(followerId);\n }\n if (target == null) {\n target = new User(followeeId);\n }\n source.follow(target);\n }", "public void follow(int followerId, int followeeId) {\n if (followeeId == followerId) {\n return;\n }\n if (!userId2Followers.containsKey(followeeId)) {\n userId2Followers.put(followeeId, new HashSet<>());\n }\n userId2Followers.get(followeeId).add(followerId);\n\n if (!userId2Followees.containsKey(followerId)) {\n userId2Followees.put(followerId, new HashSet<>());\n }\n\n // 自己关注的人,如果不包含当前操作的用户,就添加到set中,并且修改tweet\n if (!userId2Followees.get(followerId).contains(followeeId)) {\n userId2Followees.get(followerId).add(followeeId);\n if (userId2AllTweets.containsKey(followeeId)) {\n List<Tweet> followeeTweets = userId2AllTweets.get(followeeId);\n for (Tweet followeeTweet : followeeTweets) {\n putFollowerTweet(followerId, followeeTweet);\n }\n }\n }\n }", "public void follow(int followerId, int followeeId) {\n\t\t\tif (!userRelation.containsKey(followerId))\n\t\t\t\tuserRelation.put(followerId, new HashSet<>());\n\t\t\tuserRelation.get(followerId).add(followeeId);\n\t\t}", "public void follow(final int followerId, final int followeeId) {\n follows.computeIfAbsent(followerId, x -> new HashSet<>()).add(followeeId);\n }", "public void follow(int followerId, int followeeId) {\n u_map.putIfAbsent(followerId, new User(followerId));\n u_map.putIfAbsent(followeeId, new User(followeeId));\n u_map.get(followerId).follow(followeeId);\n }", "public followerRelation(User follower, User followee) {\n this.follower = follower;\n this.followee = followee;\n }", "public void follow(int followerId, int followeeId) {\n if (followeeId != followerId) {\n Set<Integer> friendSet = friends.computeIfAbsent(followerId, e -> new HashSet<>());\n friendSet.add(followeeId);\n }\n }", "public void follow(int followerId, int followeeId) {\n if (!followees.containsKey(followerId)) {\n followees.put(followerId, new HashSet<>());\n followees.get(followerId).add(followerId);\n }\n followees.get(followerId).add(followeeId);\n }", "public void follow(int followerId, int followeeId) {\n if(!map.containsKey(followerId)){\n User u = new User(followerId);\n map.put(followerId, u);\n }\n if(!map.containsKey(followeeId)){\n User u = new User(followeeId);\n map.put(followeeId, u);\n }\n map.get(followerId).follow(map.get(followeeId));\n }", "public void addFollower(String follower, String following) {\n for (User u : users) {\n System.out.println(\"iterating: \" + u.getName() + \" : \" + following);\n if (u.getName().equals(follower)) {\n for (String f : u.getFollowers()) {\n\n if (f.equals(following)) {\n System.out.println(\"ENDDDDD\");\n return;\n }\n }\n System.out.println(\"adding follower!!!!!!!!\");\n getUser(follower).addFollower(following);\n }\n }\n }", "public void follow(int followerId, int followeeId) {\n if (!followMap.containsKey(followerId)) followMap.put(followerId, new HashSet<Integer>());\n followMap.get(followerId).add(followeeId);\n }", "public void follow(int followerId, int followeeId) {\n if(!users.containsKey(followerId) && followerId != followeeId){ // If user is not in database\n HashSet<Integer> u_id = new HashSet<>();\n users.put(followerId, u_id);\n }\n users.get(followerId).add(followeeId); // Add the user and the followee to the hashmap\n }", "public void follow(int followerId, int followeeId) {\n if (!usersMap.containsKey(followerId))\n usersMap.put(followerId, new User(followerId));\n\n if (!usersMap.containsKey(followeeId))\n usersMap.put(followeeId, new User(followeeId));\n\n usersMap.get(followerId).follow(followeeId);\n }", "public void follow(int followerId, int followeeId) {\n Set<Integer> followeeSet = reverseTwitterFollowMap.getOrDefault(followeeId, new HashSet<>());\n followeeSet.add(followeeId);\n reverseTwitterFollowMap.put(followeeId, followeeSet);\n }", "@Override\n\tpublic void follow(String username) throws Exception {\n\t\t\n\t}", "public void addFollower(Follower follower) {\n follower_list.add(follower);\n }", "public void setFollowUp(String followUp) {\n\t this.followUp = followUp;\n\t}", "public void setFollow(String follow) {\r\n this.follow = follow;\r\n }", "public void follow(int followerId, int followeeId) {\n\t\t\tif (!userMap.containsKey(followerId))\n\t\t\t\tuserMap.put(followerId, new User(followerId));\n\t\t\tif (!userMap.containsKey(followeeId))\n\t\t\t\tuserMap.put(followeeId, new User(followeeId));\n\t\t\tuserMap.get(followerId).follow(followeeId);\n\t\t}", "public void setFollowerId(Long followerId) {\n this.followerId = followerId;\n }", "public void metFollower() {\n metFollowers++;\n }", "@Override\n\t\tpublic void onFollow(User arg0, User arg1) {\n\t\t\t\n\t\t}", "public void addFollowers(String follower) {\n\tuserFollowers.add(follower);\n }", "public void followUser(User user) \r\n\t{\n\t\tUser follow = user;\r\n\t\tthis.following.add(follow);//follows the user used as a parameter\r\n\t\tnotifyObservers(follow);//notifies observers of the user\r\n\t\tfollowers.add(follow);//adds you to their followers\r\n\t}", "@Override\n\tpublic void onFollow(User source, User followedUser) {\n\n\t}", "public followerRelation(Long followerId, Long followeeId) {\n this.follower = User.findById(followerId);\n this.followee = User.findById(followeeId);\n }", "@Override\n\tpublic boolean followUser(Long us_id) {\n\t\treturn false;\n\t}", "Boolean sendFollowRequest(User user);", "public void setFollowUp(final String followID) \n {\n followUp = followID;\n }", "public boolean follow(Node n) { return true; }", "public void follow(String followingId, User user) {\n final Key<Account> followerKey = Key.create(user.getUserId());\n\n // Create target user key from user id.\n final Key<Account> followingKey = Key.create(followingId);\n\n // Create record key for following account.\n final Key<DeviceRecord> recordKey = DeviceRecord.createKey(followingKey);\n\n Relationship relationship = followAccount(followerKey, followingKey);\n\n Key<AccountShard> followerShardKey = accountShardService.getRandomShardKey(followerKey);\n Key<AccountShard> followingShardKey = accountShardService.getRandomShardKey(followingKey);\n\n Map<Key<Object>, Object> fetched =\n ofy().load().keys(followerKey, recordKey, followerShardKey, followingShardKey);\n\n //noinspection SuspiciousMethodCalls\n Account follower = (Account) fetched.get(followerKey);\n //noinspection SuspiciousMethodCalls\n DeviceRecord record = (DeviceRecord) fetched.get(recordKey);\n //noinspection SuspiciousMethodCalls\n AccountShard followerShard = (AccountShard) fetched.get(followerShardKey);\n //noinspection SuspiciousMethodCalls\n AccountShard followingShard = (AccountShard) fetched.get(followingShardKey);\n\n followerShard =\n accountShardService.updateCounter(followerShard, AccountShardService.Update.FOLLOWING_UP);\n followingShard =\n accountShardService.updateCounter(followingShard, AccountShardService.Update.FOLLOWER_UP);\n\n FollowNotifiable notification = FollowNotifiable.create(follower, record);\n\n ImmutableSet<Object> saveList = ImmutableSet\n .builder()\n .add(relationship)\n .add(followerShard)\n .add(followingShard)\n .addAll(notification.getNotifications())\n .build();\n\n ofy().transact(() -> ofy().save().entities(saveList).now());\n\n notificationService.send(notification);\n }", "@RequestMapping(value = \"/follow/{follower_username}\", method = RequestMethod.POST)\n public ResponseEntity<?> followUser(@PathVariable(\"follower_username\") String followerUserName) {\n User user = userService.follow(followerUserName);\n if (user == null) {\n ApiResponse apiResponse = new ApiResponse(false, \"User \" + followerUserName + \" not found\", HttpStatus.NOT_FOUND);\n return new ResponseEntity<>(apiResponse, HttpStatus.NOT_FOUND);\n }else if(user.getUserName().contains(\"existing\")){\n ApiResponse apiResponse = new ApiResponse(false, \"User \" + followerUserName + \" is already being followed\", HttpStatus.NOT_FOUND);\n return new ResponseEntity<>(apiResponse, HttpStatus.NOT_FOUND);\n }\n String responseMsg = user.getUserName() + \" is now following \" + followerUserName;\n return new ResponseEntity<>(responseMsg, HttpStatus.OK);\n }", "public void setFollowing(String following) {\n this.following = following;\n }", "public Long getFollowerId() {\n return followerId;\n }", "public void appendToFollowedUsers(String followedUsers);", "public void addToFollowedUsers(String followedUsers);", "public Followers getFollowers() {\n return followers;\n }", "public boolean isPresent(User followee, User follower) throws UserException, FollowerException {\n\t\tboolean flag = false;\n\t\tList<BigInteger> listfo = followerDao.getFollowersbyUser(follower);\n\t\tif(listfo!=null) {\n\t\tfor(BigInteger i: listfo)\n\t {\n\t \n\t if(followee.getPersonID()==i.longValue()) {\n\t flag=true;\n\t break;\n\t }\n\t }\n\t\t}\n\t\treturn flag;\n\t}", "@Override\n public User addFollower(String followerName, String userToFollow) {\n int id = userDataMapper.addFollower(getUser(followerName).getId(), getUser(userToFollow).getId());\n if (id == -1)\n return null;\n return userDataMapper.getUserByID(id);\n }", "public void setFollowers(String followers) {\n this.followers = followers;\n }", "public void unfollow(int followerId, int followeeId) {\n\n }", "public static boolean addFollower(String currentUser, String userToFollow) {\n return UserFactory.addFollower(currentUser, userToFollow);\n }", "List<User> getFollowersForUser(User user);", "public void setFollowerCount(Integer followerCount) {\n this.followerCount = followerCount;\n }", "public String getFollow() {\r\n return follow;\r\n }", "public void addFollowings(String following) {\n\tuserFollowings.add(following);\n }", "public FollowUserResponse follow(FollowUserRequest request) throws IOException {\n ClientCommunicator followCommunicator = new ClientCommunicator(new FollowUserStrategy());\n\n return (FollowUserResponse) followCommunicator.doWebRequest(request, request.getAuthToken());\n }", "@GetMapping(value = \"/follow/{userId}\")\n public @ResponseBody Message followUser(Principal principal, @PathVariable String userId) {\n User loggedInUser = userService.getUser(principal);\n User pageUser = userService.getUser(userId);\n\n String message;\n\n if (loggedInUser.getFollowing().contains(pageUser.getId())) {\n loggedInUser.unfollowId(pageUser.getId());\n pageUser.removeFollowerId(loggedInUser.getId());\n message = \"Successfully unfollowed user\";\n } else {\n loggedInUser.followId(pageUser.getId());\n pageUser.addFollowerId(loggedInUser.getId());\n message = \"Successfully followed user\";\n }\n\n userService.saveUser(loggedInUser);\n userService.saveUser(pageUser);\n\n return new Message.Builder().withSuccess().withData(message).build();\n }", "public void unfollow(int followerId, int followeeId) {\n if (usersMap.containsKey(followerId) && followerId != followeeId)\n usersMap.get(followerId).unfollow(followeeId);\n }", "public void setFollowedId(Long followedId) {\n this.followedId = followedId;\n }", "public void unfollow(int followerId, int followeeId) {\n if(users.containsKey(followerId) && followerId != followeeId){\n users.get(followerId).remove(followeeId); // Remove as required\n } \n }", "public void unfollow(int followerId, int followeeId) {\n if(!u_map.containsKey(followerId) || followerId == followeeId){\n return;\n }\n u_map.get(followerId).unfollow(followeeId);\n }", "public final void followButtonClicked(User user, TextView textView) {\r\n textView.setClickable(false);\r\n boolean isFollowing = user.isFollowing();\r\n String str = \"userAPI\";\r\n if (!isFollowing) {\r\n user.setFollowing(true);\r\n updateFollowButtonStateUi(textView, C0008R$drawable.round_button_following, C0016R$string.following, C0006R$color.gray4);\r\n if (Intrinsics.areEqual((Object) user.getStatus(), (Object) \"deactivated\")) {\r\n textView.setClickable(true);\r\n user.setFollowing(false);\r\n updateFollowButtonStateUi(textView, C0008R$drawable.round_button_follow, C0016R$string.follow, 17170443);\r\n Logger.d(\"user follow_deactivated\", new Object[0]);\r\n Snackbar.Companion.showMessage(this, \"탈퇴한 사용자입니다\");\r\n return;\r\n }\r\n Disposable disposable = this.followingDisposable;\r\n if (disposable != null) {\r\n disposable.dispose();\r\n }\r\n UserAPI userAPI2 = this.userAPI;\r\n if (userAPI2 == null) {\r\n Intrinsics.throwUninitializedPropertyAccessException(str);\r\n }\r\n this.followingDisposable = userAPI2.putFollow(user.getId()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe((BiConsumer<? super T, ? super Throwable>) new PersonalizedRecommendActivity$followButtonClicked$1<Object,Object>(this, textView, user));\r\n } else if (isFollowing) {\r\n user.setFollowing(false);\r\n updateFollowButtonStateUi(textView, C0008R$drawable.round_button_follow, C0016R$string.follow, 17170443);\r\n Disposable disposable2 = this.unfollowingDisposable;\r\n if (disposable2 != null) {\r\n disposable2.dispose();\r\n }\r\n UserAPI userAPI3 = this.userAPI;\r\n if (userAPI3 == null) {\r\n Intrinsics.throwUninitializedPropertyAccessException(str);\r\n }\r\n this.unfollowingDisposable = userAPI3.deleteFollow(user.getId()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe((BiConsumer<? super T, ? super Throwable>) new PersonalizedRecommendActivity$followButtonClicked$2<Object,Object>(this, textView, user));\r\n }\r\n }", "public void unfollow(int followerId, int followeeId) {\n if (!followees.containsKey(followerId)) {\n followees.put(followerId, new HashSet<>());\n followees.get(followerId).add(followerId);\n }\n if (followerId == followeeId) return;\n followees.get(followerId).remove(followeeId);\n }", "public void appendToFollowedUsers(List<String> followedUsers);", "public FollowResponse getFollowing(FollowRequest request) throws IOException {\n ClientCommunicator communicator = new ClientCommunicator(new FolloweeStrategy());\n\n return (FollowResponse) communicator.doWebRequest(request, null);\n }", "@Step(\"Add current user to following\")\n public void followCurrentUser() {\n try {\n Thread.sleep(3000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n WebElement followButton = driver.findElement(By.xpath(\"//div[@data-testid='primaryColumn']//div[contains(@data-testid, '-follow')]/div\"));\n waitForElement(followButton);\n waitForElementToBeClickable(followButton);\n scrollToElement(followButton);\n ((JavascriptExecutor)driver).executeScript(\"arguments[0].click()\", followButton);\n }", "public void setFollowerNotifiableStatusByFollower(User follower, FollowerNotifiable notifiable) {\n fstRepository.findAllByFollower(follower)\n .forEach( fst -> {\n fst.setFollowerNotifiable(notifiable);\n logger.debug(\"fstId: {} -> notifiable: {})\", fst.getId(), fst.getFollowerNotifiable());\n fstRepository.save(fst);\n });\n }", "public void unfollow(int followerId, int followeeId) {\n if (followeeId == followerId) {\n return;\n }\n if (userId2Followees.containsKey(followerId)) {\n userId2Followees.get(followerId).remove(followeeId);\n }\n if (userId2Followers.containsKey(followeeId)) {\n if (userId2Followers.get(followeeId).contains(followerId)) {\n userId2Followers.get(followeeId).remove(followerId);\n rebuildTweet(followerId);\n }\n }\n }", "public void withUserByFolloweeId() {\n _query.xdoNss(() -> _query.queryUserByFolloweeId());\n }", "public boolean toggleFollowUser(String follower, String followed) {\n return userDAO.toggleFollowUser(follower, followed);\n }", "public void unfollow(int followerId, int followeeId) {\n\t\t\tif (!userMap.containsKey(followerId) || !userMap.containsKey(followeeId) || followerId == followeeId)\n\t\t\t\treturn;\n\t\t\tuserMap.get(followerId).unFollow(followeeId);\n\t\t}", "public void unfollow(int followerId, int followeeId) {\n User source = null;\n User target = null;\n for (User user : users) {\n if (user.id == followerId) {\n source = user;\n } else if (user.id == followeeId) {\n target = user;\n }\n }\n if (source == null || target == null) {\n return;\n }\n source.unfollow(target);\n }", "public void followOrFriendUser(Author user) {\n\n switch (mSearchType) {\n case FOLLOW:\n mUser.addUserToList(Author.AuthorLists.FOLLOWING, user.firebaseId);\n user.addUserToList(Author.AuthorLists.FOLLOWERS, mUser.firebaseId);\n\n break;\n\n case FRIEND:\n mUser.addUserToList(Author.AuthorLists.SENT_REQUESTS, user.firebaseId);\n user.addUserToList(Author.AuthorLists.RECEIVED_REQUESTS, mUser.firebaseId);\n\n break;\n }\n }", "public void unfollow(int followerId, int followeeId) {\n\t\t\tif (userRelation.containsKey(followerId)) {\n\t\t\t\tuserRelation.get(followerId).remove(followeeId);\n\t\t\t}\n\t\t}", "private void setupUserFollowButton() {\n if (!Helper.isPrismUserCurrentUser(prismUser)) {\n userFollowButton.setVisibility(View.VISIBLE);\n\n InterfaceAction.toggleSmallFollowButton(context, CurrentUser.isFollowingPrismUser(prismUser), userFollowButton);\n\n userFollowButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n boolean performFollow = !CurrentUser.isFollowingPrismUser(prismUser);\n InterfaceAction.handleFollowButtonClick(context, performFollow, userFollowButton, prismUser);\n }\n });\n }\n }", "public Follow unfollow(String follower, String followee)\r\n\t\t\tthrows NullOrEmptyException, UserDoesNotExistException, CannotDoItToYourselfException {\r\n\t\tvalidateInput(follower, followee);\r\n\t\tUser followerUser = userDao.findOne(follower);\r\n\t\tif (followerUser == null) {\r\n\t\t\tthrow new UserDoesNotExistException(follower);\r\n\t\t}\r\n\t\tUser followeeUser = userDao.findOne(followee);\r\n\t\tif (followeeUser == null) {\r\n\t\t\tthrow new UserDoesNotExistException(followee);\r\n\t\t}\r\n\t\tFollow f = followDao.findByFollowerIdAndFolloweeId(followerUser.getId(), followeeUser.getId());\r\n\t\tif (f != null) {\r\n\t\t\tfollowDao.delete(f);\r\n\t\t}\r\n\t\treturn f;\r\n\t}", "public Long getFollowedId() {\n return followedId;\n }", "public void unfollow(int followerId, int followeeId) {\n if(!map.containsKey(followerId) || followerId==followeeId)\n return;\n map.get(followerId).unfollow(map.get(followeeId));\n }", "public void unfollow(int followerId, int followeeId) {\n if (followerId == followeeId) return;\n User follower = database.get(followerId);\n if (follower == null) return;\n\n User followee = database.get(followeeId);\n if (followee == null) return;\n\n follower.following.remove(followee);\n }", "public String getFollowUp() {\n\t return this.followUp;\n\t}", "public String getFollowers() {\n return followers;\n }", "public boolean follow(ProfileInterface other);", "public void addMeetingFollowupItem(MeetingFollowupItem mfi)\n throws Exception\n {\n }", "public void addToFollowedUsers(List<String> followedUsers);", "public void unfollow(final int followerId, final int followeeId) {\n follows.computeIfAbsent(followerId, x -> new HashSet<>()).remove(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n Set<Integer> friendSet = friends.computeIfAbsent(followerId, e -> new HashSet<>());\n friendSet.remove(followeeId);\n }", "public void setFollowerStatusByFollower(User follower, FollowerStatus status) {\n fstRepository.findAllByFollower(follower)\n .forEach( fst -> {\n fst.setFollowerStatus(status);\n logger.debug(\"fstId: {} -> status: {})\", fst.getId(), fst.getFollowerStatus());\n fstRepository.save(fst);\n });\n }", "private void checkFollowingUser() {\n Log.d(TAG, \"checkFollowingUser: Called\");\n FirebaseDatabase.getInstance().getReference().child(\"Follow\").child(FirebaseAuth.getInstance().getCurrentUser().getUid())\n .child(\"following\").addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n Log.d(TAG, \"onDataChange: Getting Following List\");\n followingList.clear();\n for(DataSnapshot dataSnapshot:snapshot.getChildren())\n {\n Log.d(TAG, \"onDataChange: getting following list\");\n followingList.add(dataSnapshot.getKey());\n }\n Log.d(TAG, \"onDataChange: going to read post for followings\");\n readPosts(); // get Following people post on Home Activity\n\n }\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n Log.d(TAG, \"onCancelled: Started\");\n\n }\n });\n }", "public UserDTOBuilder setFollowers(List<UserDTO> followers) {\n this.followers = followers;\n return this;\n }", "public void unfollow(int followerId, int followeeId) {\n if (followMap.containsKey(followerId) && followeeId != followerId) followMap.get(followerId).remove(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n\t\tif (!followees.containsKey(followerId) || followerId == followeeId) return;\n\t\tfollowees.get(followerId).remove(followeeId);\n\t}", "protected void addFollowTransition( String ruleName, NFAState following ) {\n\t Rule r = grammar.getRule( ruleName );\n\t NFAState end = r.stopState;\n\t while ( end.transition( 1 ) != null )\n\t {\n\t end = (NFAState)end.transition( 1 ).target;\n\t }\n\t if ( end.transition( 0 ) != null )\n\t {\n\t // already points to a following node\n\t // gotta add another node to keep edges to a max of 2\n\t NFAState n = factory.newState();\n\t Transition e = new Transition( Label.EPSILON, n );\n\t end.addTransition( e );\n\t end = n;\n\t }\n\t Transition followEdge = new Transition( Label.EPSILON, following );\n\t end.addTransition( followEdge );\n\t}", "public boolean doesUsernameFollow(String username, User follow) {\r\n\t\tUser user = getUser(username);\r\n\t\tFollow f = followDao.findByFollowerIdAndFolloweeId(user.getId(), follow.getId());\r\n\t\tif (f != null) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public void handleFollow() {\r\n if (following == null) {\r\n setFollowing();\r\n }\r\n if (following == null) {\r\n return;\r\n }\r\n if (--lastHit < 1) {\r\n int hit = RandomUtil.random(1, 14);\r\n following.getImpactHandler().manualHit(this, hit, ImpactHandler.HitsplatType.NORMAL);\r\n following.getActionSender().sendMessage(\"The dark core creature steals some life from you for its master.\", 1);\r\n corporealBeastNPC.getSkills().heal(hit);\r\n lastHit = RandomUtil.random(10, 25);\r\n }\r\n }", "@Override\r\n public void onClick(View view) {\n String userName = entries.get(position);\r\n // TODO: ADD THE USER TO THE FOLLOWERS LIST\r\n entries.remove(position);\r\n notifyItemRemoved(position);\r\n notifyItemRangeChanged(position, entries.size());\r\n User user = AppLocale.getInstance().getUser();\r\n new ElasticSearch().acceptFollow(user, userName);\r\n Toast.makeText(mContext, \"Accepted : \" + u, Toast.LENGTH_SHORT).show();\r\n }", "public FollowerResponse getFollowers(FollowerRequest request, String urlPath) throws IOException, TweeterRemoteException {\n FollowerResponse response = clientCommunicator.doPost(urlPath, request, null, FollowerResponse.class);\n\n if(response.isSuccess()) {\n return response;\n } else {\n throw new RuntimeException(response.getMessage());\n }\n }", "public Builder setFollowers(Followers followers) {\n this.followers = followers;\n return this;\n }", "@RequestMapping(value = \"/follow/add\", method = RequestMethod.POST, produces = \"application/json\")\n\t@ResponseBody\n\tpublic boolean switchFollower(HttpServletRequest request, @RequestParam String followeeID) throws Exception {\n\t\tSystem.out.println(\"reached controller\");\n\t\tboolean flag = false;\n\t\tint id = Integer.parseInt(followeeID);\n\t\tHttpSession session = request.getSession();\n\t\tUser follower = (User) session.getAttribute(\"user\");\n\t\ttry {\n\t\t\tUser followee = (User) followerDao.get(id);\n\t\t\tif (isPresent(followee, follower)) {\n\t\t\t\tflag = followerDao.removeFollower(followee,follower);\n\t\t\t} else {\n//\t\t\t\tfollowee.getFollowers().add(follower);\n//\t\t\t\tSystem.out.println(\"added\");\n\t\t\t\tflag = followerDao.addFollower(followee,follower);\n\t\t\t}\n\n\t\t} catch (FollowerException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn flag;\n\n\t}", "public void unfollow(String followingId, User user) throws NotFoundException {\n final Key<Account> followerKey = Key.create(user.getUserId());\n\n // Create target user key from user id.\n final Key<Account> followingKey = Key.create(followingId);\n\n final Key<Relationship> followKey = ofy()\n .load()\n .type(Relationship.class)\n .ancestor(followerKey)\n .filter(Relationship.FIELD_FOLLOWING_KEY + \" =\", followingKey)\n .keys()\n .first()\n .now();\n\n Guard.checkNotFound(followKey, \"Relationship is not found.\");\n\n Key<AccountShard> followerShardKey = accountShardService.getRandomShardKey(followerKey);\n Key<AccountShard> followingShardKey = accountShardService.getRandomShardKey(followingKey);\n\n Map<Key<Object>, Object> fetched =\n ofy().load().keys(followerKey, followerShardKey, followingShardKey);\n\n //noinspection SuspiciousMethodCalls\n AccountShard followerShard = (AccountShard) fetched.get(followerShardKey);\n //noinspection SuspiciousMethodCalls\n AccountShard followingShard = (AccountShard) fetched.get(followingShardKey);\n\n followerShard =\n accountShardService.updateCounter(followerShard, AccountShardService.Update.FOLLOWING_DOWN);\n followingShard =\n accountShardService.updateCounter(followingShard, AccountShardService.Update.FOLLOWER_DOWN);\n\n final ImmutableList<Object> saveList =\n ImmutableList.builder().add(followerShard).add(followingShard).build();\n\n ofy().transact(() -> {\n ofy().defer().delete().key(followKey);\n ofy().defer().save().entities(saveList);\n });\n }", "public void unfollow(int followerId, int followeeId) {\n Set<Integer> followerSet = reverseTwitterFollowMap.get(followeeId);\n List<Integer> tweetList = twitterTweetMap.get(followeeId);\n List<Integer> followerTweetList = twitterTweetMap.get(followerId);\n if (followerSet == null || followerSet.isEmpty()){\n return;\n }\n else {\n followerSet.remove(followerId);\n }\n if(tweetList == null || tweetList.isEmpty()){\n return;\n }\n for(int tweetId : tweetList){\n followerTweetList.remove(new Integer(tweetId));\n }\n }", "public void setFollowing(Boolean newValue) { following = newValue; }", "@Override\r\n\tpublic void update(FollowUp followup) {\n\t\t\r\n\t}", "public String getFollowUp() \n {\n return followUp;\n }", "public void setFollowPosition(boolean on) {\n\tfollowPos = on;\n }", "@Override\n\tpublic List<User> getFollowers() throws Exception {\n\t\treturn null;\n\t}", "private void setFollowersCount() {\n ParseQuery<Follow> query = ParseQuery.getQuery(Follow.class);\n query.whereEqualTo(Follow.KEY_TO, user);\n query.countInBackground((count, e) -> {\n mFollowersTextView.setText(String.valueOf(count));\n });\n }", "public void setFollowingSince(Date followingSince) {\n this.followingSince = followingSince;\n }" ]
[ "0.8634217", "0.77610016", "0.77226377", "0.7679853", "0.7661275", "0.7650216", "0.76189363", "0.7618426", "0.7583517", "0.7574959", "0.75664026", "0.7527517", "0.7499501", "0.7496841", "0.74608916", "0.7434044", "0.7421119", "0.73507047", "0.7293242", "0.7276397", "0.72650826", "0.7252251", "0.7230671", "0.722913", "0.7167801", "0.7165203", "0.71496856", "0.71428084", "0.70950526", "0.7047161", "0.7024721", "0.7023683", "0.70181245", "0.69880164", "0.6985958", "0.6982799", "0.69691724", "0.69602144", "0.69537675", "0.6920452", "0.69073415", "0.6880426", "0.6846879", "0.68025655", "0.6781527", "0.67569804", "0.6697866", "0.6690657", "0.6690281", "0.66212904", "0.6612929", "0.66001135", "0.6584464", "0.6573458", "0.65487075", "0.6545899", "0.6545289", "0.6544887", "0.65278995", "0.6496765", "0.6494504", "0.6475997", "0.6473919", "0.64625096", "0.64612126", "0.64342636", "0.6431985", "0.6430419", "0.64298964", "0.6429331", "0.6409449", "0.6402842", "0.6392001", "0.6391469", "0.63902646", "0.6379982", "0.63796586", "0.63440406", "0.6328534", "0.63273066", "0.6325212", "0.6324155", "0.63144124", "0.63105726", "0.6298417", "0.62876946", "0.6283914", "0.62828577", "0.6271283", "0.62656575", "0.62649333", "0.6255771", "0.624449", "0.62244487", "0.6197433", "0.61899626", "0.6185912", "0.61755085", "0.6163202", "0.6160854" ]
0.7496681
14
follower unfollows a followee but one can't unfollow himself
public void unfollow(int followerId, int followeeId) { if (!followees.containsKey(followerId) || followerId == followeeId) return; followees.get(followerId).remove(followeeId); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void unfollow(int followerId, int followeeId) {\n\n }", "void unFollow(User user);", "@Override\n\t\tpublic void onUnfollow(User arg0, User arg1) {\n\t\t\t\n\t\t}", "public void unfollow(int followerId, int followeeId) {\n if(users.containsKey(followerId) && followerId != followeeId){\n users.get(followerId).remove(followeeId); // Remove as required\n } \n }", "@Override\n\tpublic boolean unfollowUser(Long us_id) {\n\t\treturn false;\n\t}", "@Override\n\tpublic void unfollow(String username) throws Exception {\n\t\t\n\t}", "public void unfollow(int followerId, int followeeId) {\n if (usersMap.containsKey(followerId) && followerId != followeeId)\n usersMap.get(followerId).unfollow(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n User source = null;\n User target = null;\n for (User user : users) {\n if (user.id == followerId) {\n source = user;\n } else if (user.id == followeeId) {\n target = user;\n }\n }\n if (source == null || target == null) {\n return;\n }\n source.unfollow(target);\n }", "public void unfollow(int followerId, int followeeId) {\n if(!u_map.containsKey(followerId) || followerId == followeeId){\n return;\n }\n u_map.get(followerId).unfollow(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n\t\t\tif (userRelation.containsKey(followerId)) {\n\t\t\t\tuserRelation.get(followerId).remove(followeeId);\n\t\t\t}\n\t\t}", "public void unfollow(int followerId, int followeeId) {\n Set<Integer> friendSet = friends.computeIfAbsent(followerId, e -> new HashSet<>());\n friendSet.remove(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n if (!followees.containsKey(followerId)) {\n followees.put(followerId, new HashSet<>());\n followees.get(followerId).add(followerId);\n }\n if (followerId == followeeId) return;\n followees.get(followerId).remove(followeeId);\n }", "public void unfollow(final int followerId, final int followeeId) {\n follows.computeIfAbsent(followerId, x -> new HashSet<>()).remove(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n\t\t\tif (!userMap.containsKey(followerId) || !userMap.containsKey(followeeId) || followerId == followeeId)\n\t\t\t\treturn;\n\t\t\tuserMap.get(followerId).unFollow(followeeId);\n\t\t}", "public void unfollow(int followerId, int followeeId) {\n if (followMap.containsKey(followerId) && followeeId != followerId) followMap.get(followerId).remove(followeeId);\n }", "public void unfollow(int followerId, int followeeId) {\n if (followerId == followeeId) return;\n User follower = database.get(followerId);\n if (follower == null) return;\n\n User followee = database.get(followeeId);\n if (followee == null) return;\n\n follower.following.remove(followee);\n }", "public void unfollow(int followerId, int followeeId) {\n if (followeeId == followerId) {\n return;\n }\n if (userId2Followees.containsKey(followerId)) {\n userId2Followees.get(followerId).remove(followeeId);\n }\n if (userId2Followers.containsKey(followeeId)) {\n if (userId2Followers.get(followeeId).contains(followerId)) {\n userId2Followers.get(followeeId).remove(followerId);\n rebuildTweet(followerId);\n }\n }\n }", "public void unfollow(int followerId, int followeeId) {\n Set<Integer> followerSet = reverseTwitterFollowMap.get(followeeId);\n List<Integer> tweetList = twitterTweetMap.get(followeeId);\n List<Integer> followerTweetList = twitterTweetMap.get(followerId);\n if (followerSet == null || followerSet.isEmpty()){\n return;\n }\n else {\n followerSet.remove(followerId);\n }\n if(tweetList == null || tweetList.isEmpty()){\n return;\n }\n for(int tweetId : tweetList){\n followerTweetList.remove(new Integer(tweetId));\n }\n }", "public void unfollow(int followerId, int followeeId) {\n if(!map.containsKey(followerId) || followerId==followeeId)\n return;\n map.get(followerId).unfollow(map.get(followeeId));\n }", "public Follow unfollow(String follower, String followee)\r\n\t\t\tthrows NullOrEmptyException, UserDoesNotExistException, CannotDoItToYourselfException {\r\n\t\tvalidateInput(follower, followee);\r\n\t\tUser followerUser = userDao.findOne(follower);\r\n\t\tif (followerUser == null) {\r\n\t\t\tthrow new UserDoesNotExistException(follower);\r\n\t\t}\r\n\t\tUser followeeUser = userDao.findOne(followee);\r\n\t\tif (followeeUser == null) {\r\n\t\t\tthrow new UserDoesNotExistException(followee);\r\n\t\t}\r\n\t\tFollow f = followDao.findByFollowerIdAndFolloweeId(followerUser.getId(), followeeUser.getId());\r\n\t\tif (f != null) {\r\n\t\t\tfollowDao.delete(f);\r\n\t\t}\r\n\t\treturn f;\r\n\t}", "public boolean unfollow(ProfileInterface other);", "public void removeFromFollowedUsers(String followedUsers);", "@RequestMapping(value = \"/unfollow/{follower_username}\", method = RequestMethod.POST)\n public ResponseEntity<?> unfollowUser(@PathVariable(\"follower_username\") String followerUserName) {\n User user = userService.unfollow(followerUserName);\n if (user == null) {\n ApiResponse apiResponse = new ApiResponse(false, \"User \" + followerUserName + \" not found\", HttpStatus.NOT_FOUND);\n return new ResponseEntity<>(apiResponse, HttpStatus.NOT_FOUND);\n }\n return new ResponseEntity<>(user, HttpStatus.OK);\n }", "public UnfollowUserResponse unfollow(UnfollowUserRequest request) throws IOException {\n ClientCommunicator unfollowCommunicator = new ClientCommunicator(new UnfollowUserStrategy());\n\n return (UnfollowUserResponse) unfollowCommunicator.doWebRequest(request, request.getAuthToken());\n }", "public void unfollow(String followingId, User user) throws NotFoundException {\n final Key<Account> followerKey = Key.create(user.getUserId());\n\n // Create target user key from user id.\n final Key<Account> followingKey = Key.create(followingId);\n\n final Key<Relationship> followKey = ofy()\n .load()\n .type(Relationship.class)\n .ancestor(followerKey)\n .filter(Relationship.FIELD_FOLLOWING_KEY + \" =\", followingKey)\n .keys()\n .first()\n .now();\n\n Guard.checkNotFound(followKey, \"Relationship is not found.\");\n\n Key<AccountShard> followerShardKey = accountShardService.getRandomShardKey(followerKey);\n Key<AccountShard> followingShardKey = accountShardService.getRandomShardKey(followingKey);\n\n Map<Key<Object>, Object> fetched =\n ofy().load().keys(followerKey, followerShardKey, followingShardKey);\n\n //noinspection SuspiciousMethodCalls\n AccountShard followerShard = (AccountShard) fetched.get(followerShardKey);\n //noinspection SuspiciousMethodCalls\n AccountShard followingShard = (AccountShard) fetched.get(followingShardKey);\n\n followerShard =\n accountShardService.updateCounter(followerShard, AccountShardService.Update.FOLLOWING_DOWN);\n followingShard =\n accountShardService.updateCounter(followingShard, AccountShardService.Update.FOLLOWER_DOWN);\n\n final ImmutableList<Object> saveList =\n ImmutableList.builder().add(followerShard).add(followingShard).build();\n\n ofy().transact(() -> {\n ofy().defer().delete().key(followKey);\n ofy().defer().save().entities(saveList);\n });\n }", "public void removeFromFollowedUsers(List<String> followedUsers);", "public abstract void deactivation(FollowMeManager manager);", "public void setNoFollow() {\n noFollow= true;\n }", "Completable unfollow(UnfollowCommand command) {\n return api.unfollow(command);\n }", "public void unSetFollow(User user, AsyncHttpResponseHandler handler) {\n if (user == null) {\n return;\n }\n\n String apiUrl = getApiUrl(\"friendships/destroy.json\");\n RequestParams params = new RequestParams();\n\n params.put(\"user_id\", String.valueOf(user.getUid()));\n\n // Execute the request\n getClient().post(apiUrl, params, handler);\n }", "public Boolean unfollow(User main, User friend){\n SQLiteDatabase db = getWritableDatabase();\n db.beginTransaction();\n\n String whereClauses = UHF_ID + \"=\" + main.getId() + \" AND \" + UHF_FRIEND + \"=\" + friend.getId();\n try {\n db.delete(UHF_TABLE, whereClauses , null);\n db.setTransactionSuccessful();\n return true;\n } catch (Exception e) {\n Log.d(\"SQL\", e.getMessage());\n return false;\n } finally {\n db.endTransaction();\n }\n }", "public static void fixFollowers() throws twitter4j.TwitterException\n\t{\n\n\t\tlong[] friends = twitter.getFriendsIDs(-1).getIDs();\n\n\t\tif (friends.length > 2000)\n\t\t{\n\t\t\tfor (int i = 0; i < friends.length / 2; i++)\n\t\t\t{\n\t\t\t\ttwitter.destroyFriendship(friends[i]);\n\t\t\t}\n\t\t}\n\t}", "@DELETE\n @Path(\"/{requirementId}/followers\")\n @Produces(MediaType.APPLICATION_JSON)\n @ApiOperation(value = \"This method removes the current user from a followers list of a given requirement.\")\n @ApiResponses(value = {\n @ApiResponse(code = HttpURLConnection.HTTP_OK, message = \"Returns the requirement\", response = RequirementEx.class),\n @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = \"Unauthorized\"),\n @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = \"Not found\"),\n @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = \"Internal server problems\")\n })\n public Response removeUserFromFollowers(@PathParam(\"requirementId\") int requirementId) {\n DALFacade dalFacade = null;\n try {\n UserAgent agent = (UserAgent) Context.getCurrent().getMainAgent();\n long userId = agent.getId();\n String registratorErrors = service.bazaarService.notifyRegistrators(EnumSet.of(BazaarFunction.VALIDATION, BazaarFunction.USER_FIRST_LOGIN_HANDLING));\n if (registratorErrors != null) {\n ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors);\n }\n dalFacade = service.bazaarService.getDBConnection();\n Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId);\n boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Delete_FOLLOW, dalFacade);\n if (!authorized) {\n ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.AUTHORIZATION, Localization.getInstance().getResourceBundle().getString(\"error.authorization.follow.delete\"));\n }\n dalFacade.unFollowRequirement(internalUserId, requirementId);\n Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId);\n Gson gson = new Gson();\n service.bazaarService.getNotificationDispatcher().dispatchNotification(service, new Date(), Activity.ActivityAction.UNFOLLOW, requirement.getId(),\n Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId);\n return Response.ok(gson.toJson(requirement)).build();\n } catch (BazaarException bex) {\n if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) {\n return Response.status(Response.Status.UNAUTHORIZED).entity(ExceptionHandler.getInstance().toJSON(bex)).build();\n } else if (bex.getErrorCode() == ErrorCode.NOT_FOUND) {\n return Response.status(Response.Status.NOT_FOUND).entity(ExceptionHandler.getInstance().toJSON(bex)).build();\n } else {\n return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(bex)).build();\n }\n } catch (Exception ex) {\n BazaarException bex = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, \"\");\n return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ExceptionHandler.getInstance().toJSON(bex)).build();\n } finally {\n service.bazaarService.closeDBConnection(dalFacade);\n }\n }", "public static boolean removeFollower(String currentUser, String userToFollow) {\n return UserFactory.removeFollower(currentUser, userToFollow);\n }", "@Override\r\n\tpublic void delete(FollowUp followup) {\n\t\t\r\n\t}", "public boolean unFollowPage(int pageID) throws Exception\n {\n return userFan.unfollowPage(pageID);\n }", "public void follow(int followerId, int followeeId) {\n\n }", "public void removeFriend(String me, String other, UserFriends uf) {\n MongoCollection<Document> followColl = db.getCollection(\"followList\");\n\n getFollowList(me, uf);\n\n // remove other user on my following list\n if (!uf.friendsList.isEmpty()) uf.friendsList.remove(other);\n if (uf.friendsList.contains(me)) uf.friendsList.remove(me);\n\n // updating database\n followColl.findOneAndUpdate(\n eq(\"username\", me),\n Updates.set(\"following\", uf.friendsList)\n );\n }", "@Override\n\tpublic boolean followUser(Long us_id) {\n\t\treturn false;\n\t}", "public void setFollow(String follow) {\r\n this.follow = follow;\r\n }", "public void setFollowUp(String followUp) {\n\t this.followUp = followUp;\n\t}", "@Override\n public boolean test(Status status) {\n User tweetPoster = status.getUser();\n\n if (followStatusChecker.isFollowedBy(tweetPoster)) {\n return true;\n }\n if (unfollowAutomatically && followStatusChecker.isFollowing(tweetPoster)) {\n try {\n System.out.println(\"I'm going to unfollow \" + status.getUser() + \" because he is not following us anymore\");\n followStatusChecker.unfollow(tweetPoster);\n } catch (TwitterException e) {\n e.printStackTrace();\n }\n }\n return false;\n }", "public void setFollowUp(final String followID) \n {\n followUp = followID;\n }", "public boolean toggleFollowUser(String follower, String followed) {\n return userDAO.toggleFollowUser(follower, followed);\n }", "default void disableFollowButton() {}", "@Override\n\tpublic boolean batchDelFollowers(List<Serializable> ids) {\n\t\treturn false;\n\t}", "@Override\n\tpublic List<User> getFollowers() throws Exception {\n\t\treturn null;\n\t}", "@Override\n\t\tpublic void onFollow(User arg0, User arg1) {\n\t\t\t\n\t\t}", "public void handleFollow() {\r\n if (following == null) {\r\n setFollowing();\r\n }\r\n if (following == null) {\r\n return;\r\n }\r\n if (--lastHit < 1) {\r\n int hit = RandomUtil.random(1, 14);\r\n following.getImpactHandler().manualHit(this, hit, ImpactHandler.HitsplatType.NORMAL);\r\n following.getActionSender().sendMessage(\"The dark core creature steals some life from you for its master.\", 1);\r\n corporealBeastNPC.getSkills().heal(hit);\r\n lastHit = RandomUtil.random(10, 25);\r\n }\r\n }", "public void setFollowerId(Long followerId) {\n this.followerId = followerId;\n }", "public boolean getNoFollow() {\n return noFollow;\n }", "public followerRelation(User follower, User followee) {\n this.follower = follower;\n this.followee = followee;\n }", "public final void followButtonClicked(User user, TextView textView) {\r\n textView.setClickable(false);\r\n boolean isFollowing = user.isFollowing();\r\n String str = \"userAPI\";\r\n if (!isFollowing) {\r\n user.setFollowing(true);\r\n updateFollowButtonStateUi(textView, C0008R$drawable.round_button_following, C0016R$string.following, C0006R$color.gray4);\r\n if (Intrinsics.areEqual((Object) user.getStatus(), (Object) \"deactivated\")) {\r\n textView.setClickable(true);\r\n user.setFollowing(false);\r\n updateFollowButtonStateUi(textView, C0008R$drawable.round_button_follow, C0016R$string.follow, 17170443);\r\n Logger.d(\"user follow_deactivated\", new Object[0]);\r\n Snackbar.Companion.showMessage(this, \"탈퇴한 사용자입니다\");\r\n return;\r\n }\r\n Disposable disposable = this.followingDisposable;\r\n if (disposable != null) {\r\n disposable.dispose();\r\n }\r\n UserAPI userAPI2 = this.userAPI;\r\n if (userAPI2 == null) {\r\n Intrinsics.throwUninitializedPropertyAccessException(str);\r\n }\r\n this.followingDisposable = userAPI2.putFollow(user.getId()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe((BiConsumer<? super T, ? super Throwable>) new PersonalizedRecommendActivity$followButtonClicked$1<Object,Object>(this, textView, user));\r\n } else if (isFollowing) {\r\n user.setFollowing(false);\r\n updateFollowButtonStateUi(textView, C0008R$drawable.round_button_follow, C0016R$string.follow, 17170443);\r\n Disposable disposable2 = this.unfollowingDisposable;\r\n if (disposable2 != null) {\r\n disposable2.dispose();\r\n }\r\n UserAPI userAPI3 = this.userAPI;\r\n if (userAPI3 == null) {\r\n Intrinsics.throwUninitializedPropertyAccessException(str);\r\n }\r\n this.unfollowingDisposable = userAPI3.deleteFollow(user.getId()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe((BiConsumer<? super T, ? super Throwable>) new PersonalizedRecommendActivity$followButtonClicked$2<Object,Object>(this, textView, user));\r\n }\r\n }", "public boolean hasFollowUp() \n {\n return followUp.equals(Constants.CLOSE);\n }", "@Test\n\tpublic void testNoFollow2() {\n\t\tList<String> rules = Arrays.asList(\"a\", \"c\", null, \"a\", \"b\");\n\t\tTaboo<String> tab = new Taboo<String>(rules);\n\t\t\n\t\tSet<String> ans1 = new HashSet<String>(Arrays.asList(\"c\", \"b\"));\n\t\tassertEquals(ans1, tab.noFollow(\"a\"));\n\t\t\n\t\tSet<String> ans2 = Collections.emptySet();\n\t\tassertEquals(ans2, tab.noFollow(\"c\"));\n\t\t\n\t\tSet<String> ans3 = Collections.emptySet();\n\t\tassertEquals(ans3, tab.noFollow(\"b\"));\n\t\t\n\t\tSet<String> ans4 = Collections.emptySet();\n\t\tassertEquals(ans4, tab.noFollow(\"x\"));\n\t\t\n\t\tSet<String> ans5 = Collections.emptySet();\n\t\tassertEquals(ans5, tab.noFollow(null));\n\t}", "@Override\n\tpublic void onFollow(User source, User followedUser) {\n\n\t}", "public void metFollower() {\n metFollowers++;\n }", "@Override\n\tpublic void follow(String username) throws Exception {\n\t\t\n\t}", "public void setFollowing(String following) {\n this.following = following;\n }", "private boolean userNotAlreadyFollowing(String url) {\n mStatusTextView.setText(\"\");\n\n if (WearFeedEntry.isFollowingUrl(url)) {\n mStatusTextView.setText(getActivity().getString(R.string.already_following_feed));\n return false;\n }\n\n return true;\n }", "private static void removeTalker(User talker, AppCompatActivity activity) {\n mRefUsersTalk\n .child(mAuth.getCurrentUser().getUid())\n .child(talker.getId())\n .removeValue()\n .addOnSuccessListener(aVoid -> {\n\n //REMOVES CURRENT USER TO TALKER NODE\n mRefUsersTalk\n .child(talker.getId())\n .child(mAuth.getCurrentUser().getUid())\n .removeValue()\n .addOnSuccessListener(aVoid1 -> {\n showProgressDialog(false);\n Toast.makeText(activity.getApplicationContext(), \"Usuário removido com sucesso!\", Toast.LENGTH_SHORT)\n .show();\n\n backToMainActivity(activity);\n })\n .addOnFailureListener(Throwable::getLocalizedMessage);\n })\n .addOnFailureListener(Throwable::getLocalizedMessage);\n\n }", "public void delete(Long id) {\n log.debug(\"Request to delete Follower : {}\", id);\n followerRepository.deleteById(id);\n }", "public void follow(int followerId, int followeeId) {\n if (followeeId == followerId) {\n return;\n }\n if (!userId2Followers.containsKey(followeeId)) {\n userId2Followers.put(followeeId, new HashSet<>());\n }\n userId2Followers.get(followeeId).add(followerId);\n\n if (!userId2Followees.containsKey(followerId)) {\n userId2Followees.put(followerId, new HashSet<>());\n }\n\n // 自己关注的人,如果不包含当前操作的用户,就添加到set中,并且修改tweet\n if (!userId2Followees.get(followerId).contains(followeeId)) {\n userId2Followees.get(followerId).add(followeeId);\n if (userId2AllTweets.containsKey(followeeId)) {\n List<Tweet> followeeTweets = userId2AllTweets.get(followeeId);\n for (Tweet followeeTweet : followeeTweets) {\n putFollowerTweet(followerId, followeeTweet);\n }\n }\n }\n }", "public followerRelation(Long followerId, Long followeeId) {\n this.follower = User.findById(followerId);\n this.followee = User.findById(followeeId);\n }", "public void follow(int followerId, int followeeId) {\n if (followeeId != followerId) {\n Set<Integer> friendSet = friends.computeIfAbsent(followerId, e -> new HashSet<>());\n friendSet.add(followeeId);\n }\n }", "public void follow(int followerId, int followeeId) {\n if (followerId == followeeId) return;\n User follower = getOrCreateUser(followerId);\n User followee = getOrCreateUser(followeeId);\n\n if (!follower.following.contains(followee))\n follower.following.add(followee);\n }", "public interface IUnfollowRequest{\n\n\n }", "public void follow(int followerId, int followeeId) {\n User source = null, target = null;\n for (User user : users) {\n if (user.id == followerId) {\n source = user;\n } else if (user.id == followeeId) {\n target = user;\n }\n }\n if (source == null) {\n source = new User(followerId);\n }\n if (target == null) {\n target = new User(followeeId);\n }\n source.follow(target);\n }", "@Override\n\tpublic boolean getCaughtBy(Orangutan o) {\n\t\tif(isFollowing()) //Mar elkapott pandat nem kapunk el\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tif(o.isFollowedBy()){\n\t\t\tsetFollowedBy(o.followedBy);\n\t\t\tfollowedBy.setFollowing(this);\n\t\t}\n\t\tsetFollowing(o);\n\t\to.setFollowedBy(this);\n\t\treturn true;\n\t}", "public void follow(int followerId, int followeeId) {\n u_map.putIfAbsent(followerId, new User(followerId));\n u_map.putIfAbsent(followeeId, new User(followeeId));\n u_map.get(followerId).follow(followeeId);\n }", "public void rejectSubscriber(Friend lf);", "@Override\n\tpublic void onUnfavorite(User source, User target, Status unfavoritedStatus) {\n\n\t}", "public static void main(String[] args) {\n\t\t//System.out.println(Follow.removeFollow(\"5\",\"2\"));\n\t\t//System.out.println(Follow.listFollowed(\"5\"));\n\t}", "public void setFollowing(Boolean newValue) { following = newValue; }", "public void removeNonFollowers(Integer numberOfDaysInterval) {\n logger.info(\"-------------------------REMOVE NON FOLLOWERS PROCESS------------------------\");\n\n Process processType = Process.REMOVE_NON_FOLLOWERS;\n List<ProcessResult> processesInNumberOfDaysInterval =\n processResultService.getAllInIntervalOfDays(numberOfDaysInterval, processType);\n\n if (!processesInNumberOfDaysInterval.isEmpty()) {\n logger.info(\"THE PROCESS HAS ALREADY RUN IN THE DAYS INTERVAL: \" + numberOfDaysInterval);\n return;\n }\n\n pageService.goToPage(false, PageAddress.INSTAGRAM_MY_ACCOUNT.getLinkToPage());\n pageService.waitForButtonAndClickIt(false, MY_FOLLOWING_MAIN_BUTTON);\n\n Integer myFollowingNumber = (Integer) pageService.\n getValueFromElement(false, ElementValue.NUMBER_WITH_K_COMA_OR_POINT, MY_FOLLOWING_NUMBER);\n\n ProcessResult processResult = processIgList(LIST_USERNAME_LINKS, processType, myFollowingNumber);\n processResult.setConfirmedFollowing(myFollowingNumber);\n processResultService.printResultAndValidate(processType, processResult);\n processResultService.getProcessResultJpaRepository().saveAndFlush(processResult);\n }", "public void follow(int followerId, int followeeId) {\n\t\t\tif (!userRelation.containsKey(followerId))\n\t\t\t\tuserRelation.put(followerId, new HashSet<>());\n\t\t\tuserRelation.get(followerId).add(followeeId);\n\t\t}", "public void follow(int followerId, int followeeId) {\n if(!users.containsKey(followerId) && followerId != followeeId){ // If user is not in database\n HashSet<Integer> u_id = new HashSet<>();\n users.put(followerId, u_id);\n }\n users.get(followerId).add(followeeId); // Add the user and the followee to the hashmap\n }", "public Long getFollowerId() {\n return followerId;\n }", "public void setFollowerCount(Integer followerCount) {\n this.followerCount = followerCount;\n }", "public Set<T> noFollow(T elem) {\n\t\t Set<T> s = rule.get(elem.hashCode());\n\t\t return s == null ? new HashSet<T>() :s; // TODO YOUR CODE HERE\n\t}", "@Override\n public void unsuspendPlayer(String username) {\n if (match != null && username != null) {\n match.unsuspendPlayer(username);\n }\n }", "Boolean sendFollowRequest(User user);", "public void setFollowedId(Long followedId) {\n this.followedId = followedId;\n }", "private void setupUserFollowButton() {\n if (!Helper.isPrismUserCurrentUser(prismUser)) {\n userFollowButton.setVisibility(View.VISIBLE);\n\n InterfaceAction.toggleSmallFollowButton(context, CurrentUser.isFollowingPrismUser(prismUser), userFollowButton);\n\n userFollowButton.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n boolean performFollow = !CurrentUser.isFollowingPrismUser(prismUser);\n InterfaceAction.handleFollowButtonClick(context, performFollow, userFollowButton, prismUser);\n }\n });\n }\n }", "@Override\n\t\tpublic void onUnfavorite(User arg0, User arg1, Status arg2) {\n\t\t\t\n\t\t}", "public void follow(final int followerId, final int followeeId) {\n follows.computeIfAbsent(followerId, x -> new HashSet<>()).add(followeeId);\n }", "public void addFollower(String follower, String following) {\n for (User u : users) {\n System.out.println(\"iterating: \" + u.getName() + \" : \" + following);\n if (u.getName().equals(follower)) {\n for (String f : u.getFollowers()) {\n\n if (f.equals(following)) {\n System.out.println(\"ENDDDDD\");\n return;\n }\n }\n System.out.println(\"adding follower!!!!!!!!\");\n getUser(follower).addFollower(following);\n }\n }\n }", "@Override\n\tpublic List<User> getFollowingUsers() throws Exception {\n\t\treturn null;\n\t}", "List<User> getFollowersForUser(User user);", "public Followers getFollowers() {\n return followers;\n }", "public void follow(int followerId, int followeeId) {\n if(!map.containsKey(followerId)){\n User u = new User(followerId);\n map.put(followerId, u);\n }\n if(!map.containsKey(followeeId)){\n User u = new User(followeeId);\n map.put(followeeId, u);\n }\n map.get(followerId).follow(map.get(followeeId));\n }", "public void follow(int followerId, int followeeId) {\n if (!followees.containsKey(followerId)) {\n followees.put(followerId, new HashSet<>());\n followees.get(followerId).add(followerId);\n }\n followees.get(followerId).add(followeeId);\n }", "public void follow(int followerId, int followeeId) {\n Set<Integer> followeeSet = reverseTwitterFollowMap.getOrDefault(followeeId, new HashSet<>());\n followeeSet.add(followeeId);\n reverseTwitterFollowMap.put(followeeId, followeeSet);\n }", "public void follow(int followerId, int followeeId) {\n if (!followMap.containsKey(followerId)) followMap.put(followerId, new HashSet<Integer>());\n followMap.get(followerId).add(followeeId);\n }", "void unsetWhoOwnsWhom();", "public void setFollowers(String followers) {\n this.followers = followers;\n }", "public String getFollow() {\r\n return follow;\r\n }", "@Override\n public boolean equals(Object object) {\n if (!(object instanceof Followup)) {\n return false;\n }\n Followup other = (Followup) object;\n if ((this.idfollowup == null && other.idfollowup != null) || (this.idfollowup != null && !this.idfollowup.equals(other.idfollowup))) {\n return false;\n }\n return true;\n }", "public void setFollowerNotifiableStatusByFollower(User follower, FollowerNotifiable notifiable) {\n fstRepository.findAllByFollower(follower)\n .forEach( fst -> {\n fst.setFollowerNotifiable(notifiable);\n logger.debug(\"fstId: {} -> notifiable: {})\", fst.getId(), fst.getFollowerNotifiable());\n fstRepository.save(fst);\n });\n }", "public void follow(int followerId, int followeeId) {\n\t\t//\n\t\tif (!followees.containsKey(followerId)) {\n\t\t\tfollowees.put(followerId, new HashSet<>());\n\t\t}\n\t\tfollowees.get(followerId).add(followeeId);\n\t}" ]
[ "0.8573132", "0.8061164", "0.7997007", "0.7900755", "0.78706336", "0.78439814", "0.76091725", "0.7575813", "0.75749546", "0.75367707", "0.7531035", "0.74689186", "0.745566", "0.7393234", "0.73841876", "0.7348093", "0.7318927", "0.73069686", "0.7262704", "0.7152059", "0.69795054", "0.69276303", "0.6858998", "0.6778341", "0.67732185", "0.65970796", "0.6569735", "0.65538335", "0.6463221", "0.64263165", "0.63367665", "0.6290467", "0.6262751", "0.6225578", "0.6215103", "0.6210438", "0.6209178", "0.620319", "0.61168486", "0.6019215", "0.59975827", "0.59440535", "0.58833456", "0.58408034", "0.5786127", "0.57830465", "0.57814205", "0.57612526", "0.5735587", "0.5724961", "0.56942016", "0.5693082", "0.5679921", "0.5672526", "0.5657677", "0.5646157", "0.5636194", "0.5632302", "0.5609586", "0.5574279", "0.55643636", "0.55589265", "0.555305", "0.5550994", "0.55481774", "0.55456215", "0.5545489", "0.55105436", "0.54829216", "0.54759884", "0.54665613", "0.54403585", "0.5439174", "0.543471", "0.5418098", "0.5410506", "0.5408594", "0.53889203", "0.538363", "0.5374304", "0.5371306", "0.5365309", "0.5355008", "0.53525585", "0.53453743", "0.5326534", "0.53101945", "0.5303224", "0.529171", "0.5290688", "0.5269253", "0.5264841", "0.5264117", "0.5260402", "0.5256479", "0.5251893", "0.5244546", "0.52439374", "0.5213735", "0.51820874" ]
0.73256606
16
Method: isInputDataValid(String input) has to return true
@Test public void isInputDataValidTest() { boolean invoke = Deencapsulation.invoke(modificationFibonacci, "isInputDataValid", "1"); assertTrue(invoke); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tprotected void isValid(String input) throws DataInputException\n\t{\n\t}", "private boolean isValidInput() {\n\t\treturn true;\n\t}", "private boolean isInputValid() {\n return true;\n }", "protected abstract boolean isInputValid();", "protected abstract boolean isInputValid(@NotNull ConversationContext context, @NotNull String input);", "public abstract boolean isValidValue(String input);", "public boolean validate(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\tif(!Character.isDigit(c))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\treturn true;\n\t}", "public boolean checkInput(String input){\n\t\t//make sure only input 0-9\n\t\tif(input.length() != 1){\n\t\t\treturn false;\n\t\t}\n\t\tchar c = input.charAt(0);\n\t\tif(!Character.isDigit(c)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private boolean isInValidInput(String input) {\n\n\t\tif (input == null || input.isEmpty())\n\t\t\treturn true;\n\n\t\tint firstPipeIndex = input.indexOf(PARAM_DELIMITER);\n\t\tint secondPipeIndex = input.indexOf(PARAM_DELIMITER, firstPipeIndex + 1);\n\n\t\t/*\n\t\t * if there are no PARAM_DELIMITERs or starts with a PARAM_DELIMITER\n\t\t * (Meaning command is missing) or only single PARAM_DELIMITER input is\n\t\t * not valid\n\t\t */\n\t\tif (firstPipeIndex == -1 || firstPipeIndex == 0 || secondPipeIndex == -1)\n\t\t\treturn true;\n\n\t\t// Means package name is empty\n\t\tif (secondPipeIndex - firstPipeIndex < 2)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "public static boolean checkInput(String saInput) {\r\n\t\treturn checkGenericPattern(saInput) && checkGenericPattern(unalter(saInput));\r\n\t}", "protected abstract boolean checkInput();", "public boolean validate(final String input){\n\n matcher = pattern.matcher(input);\n return matcher.matches();\n\n }", "default Boolean validateInput(String input){\n if (input.contains(\"(\") || input.contains(\")\") || input.contains(\"[\") || input.contains(\"}\") || input.contains(\"{\") || input.contains(\"}\") )\n {\n return true;\n }else{\n return false;\n }\n }", "protected abstract int isValidInput();", "public boolean isValidInput(String input) {\r\n\t\tif (input == null || input.isEmpty())\r\n\t\t\treturn false;\r\n\t\tString inputTokens[] = input.split(\" \");\r\n\t\tif (inputTokens.length < 2)\r\n\t\t\treturn false;\r\n\t\tfor (int i = 0; i < inputTokens.length; i++) {\r\n\t\t\tfor (int j = 0; j < inputTokens[i].length(); j++) {\r\n\t\t\t\tswitch (inputTokens[i].charAt(j)) {\r\n\t\t\t\tcase '!':\r\n\t\t\t\tcase '?':\r\n\t\t\t\tcase '@':\r\n\t\t\t\tcase '#':\r\n\t\t\t\tcase '*':\r\n\t\t\t\tcase '/':\r\n\t\t\t\tcase '<':\r\n\t\t\t\tcase '>':\r\n\t\t\t\tcase '&':\r\n\t\t\t\tcase '%':\r\n\t\t\t\tcase '~':\r\n\t\t\t\tcase ';':\r\n\t\t\t\tcase ':':\r\n\t\t\t\tcase '[':\r\n\t\t\t\tcase ']':\r\n\t\t\t\tcase '{':\r\n\t\t\t\tcase '}':\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "public synchronized boolean validate(Object data) {\n if (!(data instanceof String)) {\n return false;\n }\n\n String dataString = (String) data;\n dataString = dataString.replaceAll(\"\\\\s\", \"\").replaceAll(\"-\", \"\");\n if (dataString.length() != 6) {\n return false;\n }\n\n for (Character c : dataString.substring(0, 2).toCharArray()) {\n if (!Character.isLetter(c)) {\n return false;\n }\n }\n for (Character c : dataString.substring(3, 5).toCharArray()) {\n if (!Character.isDigit(c)) {\n return false;\n }\n }\n return true;\n }", "public boolean isInputValid()\n {\n String[] values = getFieldValues();\n if(values[0].length() > 0 || values[1].length() > 0 || values[2].length() > 0)\n return true;\n else\n return false;\n }", "public boolean checkInput();", "@Override\n\tpublic boolean checkInput() {\n\t\treturn true;\n\t}", "public boolean isValid(String input){\r\n\t\t// Verifies if the input contains multiple integer / double values sperated by \",\"\r\n\t\tString[] splitValues = input.split(\",\");\r\n\t\tfor(int i = 0; i < splitValues.length; i++){\t\r\n\t\t\ttry{\r\n\t\t\t\tDouble.parseDouble(splitValues[i]);\r\n\t\t\t}\r\n\t\t\tcatch(NumberFormatException nfe){\r\n\t\t\t\tSystem.err.println(\"### [ValuesRequirement] ERROR: unparseable number in \" + splitValues[i] + \", part of \" + input);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "protected boolean validateData(String [] data) {\n return true;\n }", "public boolean isCryptoInputValid(String input) {\n\t\tOnlineCourseQuery query = new OnlineCourseQuery();\n\t\t\n\t\tList<String> tempFiatCurrencyList = Arrays.asList(\"CHF\");\n\t\tList<String> tempcryptoCurrencyList = Arrays.asList(input);\n\t\t\n\t\ttry {\n\t\t\tJSONObject resultObject = query.getOnlineCourseData(tempcryptoCurrencyList, tempFiatCurrencyList);\n\t\t\t\n\t\t\t Iterator<String> keys = resultObject.keys();\n\t\t\t String str = keys.next();\n\t\t\t String result = resultObject.optString(str);\n\t\t\t \n\t\t\t if (result.equals(\"Error\")) {\n\t\t\t\t return false;\n\t\t\t }\n\t\t\t \n\t\t\t return true;\n\t\t\t\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\n\t\t}\n\t\treturn false;\n\t}", "public static boolean isStringValid(String check, String inputData) {\n\t\tString errorMessage = \"\";\n\n\t\tif (inputData == null || inputData.length() == 0) {\n\t\t\terrorMessage += \"No valid : \" + check + \"\\n\";\n\t\t}\n\n\t\tif (errorMessage.length() == 0)\n\t\t\treturn true;\n\n\t\terrorMessage(errorMessage);\n\t\treturn false;\n\t}", "private void validateData(String input) {\n String[] inputStringArray = input.split(\" \");\n\n for (String s : inputStringArray) {\n try {\n Integer.parseInt(s);\n } catch (NumberFormatException e) {\n throw new NumberFormatException(\n \"Looks like your input - \" + s + \", is not a number. Try again\");\n }\n }\n }", "public static Boolean validateInput(String input) {\n\t\tString xInput = input.substring(0,1);\n\n\t\n\n\t\t\n\t\tboolean xIsLetter = Character.isLetter(xInput.charAt(0));\n\n\t\tif((!input.isEmpty()) || (!xIsLetter)) {\n\t\n\t\t\treturn false;\n\t\t} else {\n\n\t\t\treturn true; \n\t\t\t}\n\t\t}", "public static boolean checkForValidInput(String input) {\n try {\n int inputValue = Integer.parseInt(input);\n return inputValue >= 0 && inputValue <= 8;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "private boolean isValid(String input){\n return input.length() == 10 && input.matches(\"-?\\\\d+(\\\\.\\\\d+)?\");\n //check its digits\n }", "private void validateInputParameters(){\n\n }", "public boolean inputIsValid() {\n return nameIsValid() &&\n descriptionIsValid() &&\n priceIsValid() &&\n streetIsValid() &&\n zipcodeIsValid() &&\n cityIsValid() &&\n imageIsSelected();\n }", "private boolean isValidInput() {\n if (null == mUsername || mUsername.length() <= 0) {\n return false;\n } else if (null == mPassword || mPassword.length() <= 0) {\n return false;\n }\n return true;\n }", "public static boolean isSecondArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && CommonUtils.isNumeric(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "private boolean containsValidCharacters(String inputString)\r\n {\r\n boolean validityFlag = true;\r\n int inputStringLength = inputString.trim().length();\r\n for (int i = 0 ; i < inputStringLength ; i++)\r\n {\r\n char digit = inputString.charAt(i);\r\n if (!((digit >= 'A' && digit <= 'Z') || (digit >= 'a' && digit <= 'z') || (digit >= '0' && digit <= '9')))\r\n {\r\n validityFlag = false;\r\n break;\r\n }\r\n }\r\n return validityFlag;\r\n }", "public abstract boolean verifyInput();", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (nameField.getText() == null || nameField.getText().length() == 0) {\r\n errorMessage += \"请输入直播名!\\n\";\r\n }\r\n if (urlField.getText() == null || urlField.getText().length() == 0) {\r\n errorMessage += \"请输入直播流!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n Alert alert = new Alert(Alert.AlertType.ERROR);\r\n alert.setTitle(\"输入错误\");\r\n alert.setContentText(errorMessage);\r\n return false;\r\n }\r\n }", "private static boolean valid_input(String user_input) {\n \n boolean output = false;\n \n if(user_input.length() == 2){\n \n output = (user_input.substring(0,1).matches(\"[0-9]\") && user_input.substring(1,2).matches(\"[a-zA-Z]\"));\n } else if (user_input.length() == 3) {\n \n output = (user_input.substring(0,2).matches(\"[1-2][0-9]\") && user_input.substring(2,3).matches(\"[a-zA-Z]\"));\n \n if(Integer.parseInt(user_input.substring(0,2))>TicTacToe.game.gridSize){\n output = false;\n }\n }\n \n return output;\n }", "protected boolean isValidData() {\n return true;\n }", "private boolean isValidInput(String input) \r\n {\r\n\t \r\n return input!=null&&input.length()<=10;\r\n \r\n }", "private static boolean isParsable(String input) {\n try {\n Integer.parseInt(input);\n return true;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "boolean inputValid(String s) {\n\n if (s.length() == 0) {\n return false;\n }\n\n //check whether there are wrong commas\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == ',') {\n if(!s.contains(\"log\")) {\n resS = \"There are wrong commas\";\n return false;\n }\n }\n }\n\n //check whether there are multiple points\n if(s.charAt(0)=='.' || s.charAt(s.length()-1)=='.') return false;\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == '.') {\n if (!Character.isDigit(s.charAt(ii - 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else if (!Character.isDigit(s.charAt(ii + 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else {\n for (int jj = ii + 2; jj < s.length(); jj++) {\n if (s.charAt(jj) == '.') {\n String ss = s.substring(ii + 2, jj);\n if (!(ss.contains(\"+\") || ss.contains(\"-\") || ss.contains(\"*\") || ss.contains(\"/\") || ss.contains(\"%\")\n || ss.contains(\"^\") || ss.contains(\")\"))) {\n resS=\"These are wrong points.\";\n return false;\n }\n }\n }\n }\n }\n }\n ArrayList<Token> operation = tokenize(s);\n return isNumberOrOpe(operation) && isOpePosRight(operation) && isValidparentheses(operation) && isValidTan(operation) && isLogWrong(operation);\n }", "public boolean validateFieldInput(String input) {\n\t\tboolean valid = false;\n\t if (input.matches(\"^[0-9]{1,8}([.][0-9]{1,4})?$\") && Double.valueOf(input) >0.0) {\n\t \t\n\t \tvalid = true;\n\t }\n\t \n\t return valid;\n\t}", "public boolean checkInput(String str)\n {\n try\n {\n Integer.parseInt(str);\n } \n catch(NumberFormatException ex)\n {\n return false;\n } \n return true;\n }", "private boolean isValid(char input) {\n if (this.isLetter(input) || this.isDigit(input) || this.isOperator(input)\n || this.isIgnored(input)) {\n return true;\n } else return false;\n }", "private void validateData() {\n }", "public abstract boolean isValid(String s);", "private static boolean validateInput1(String[] input) {\n\t\tif (input.length != 1) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean isInputValid(ConversationContext context, String s)\r\n/* */ {\r\n/* 135 */ return (s.equalsIgnoreCase(\"one\")) || (s.equals(\"1\")) || (s.equalsIgnoreCase(\"two\")) || (s.equals(\"2\")) || (s.equalsIgnoreCase(\"zero\")) || (s.equals(\"0\"));\r\n/* */ }", "private void checkUserInput() {\n }", "public static boolean isGoodField(String input) {\n if (input == null || input.isEmpty() || input.length() < 6)\n return false;\n return true;\n }", "private boolean isUserInputValid(String[] packetData)\n\t{\n\t\tif(packetData.length < 3 ) return false;\n\t\tString address = packetData[0];\n\t\tint port = Integer.parseInt(packetData[1]);\n\n\t\tint addressPeriodsCount = address.length() - address.replace(\".\", \"\").length();\n\n\t\tif (packetData.length < 3)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse if(address.equals(\"localhost\") && (port > 0 || port <= 65535))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (addressPeriodsCount == 3 ||addressPeriodsCount == 2 ) && (port > 0 || port <= 65535);\n\t\t}\n\t}", "private static boolean isValidDigit(String strInput) {\n boolean isValid = true;\n if (isPrimitive(strInput)) {\n int input = Integer.parseInt(strInput);\n if (input < 1 || input > 255) {\n log.debug(\"Wrong config input value: {}\", strInput);\n isValid = false;\n } else {\n isValid = true;\n }\n\n } else {\n isValid = false;\n }\n\n return isValid;\n }", "public static boolean isFirstArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && isValidCurrency(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n// Show the error message.\r\n Dialogs.create()\r\n .title(\"Invalid Fields\")\r\n .masthead(\"Please correct invalid fields\")\r\n .message(errorMessage)\r\n .showError();\r\n return false;\r\n }\r\n }", "private static boolean isBadInput(String s) {\n\t\tString[] split = s.split(\"\\\\s+\");\n\t\tif (split.length != 3) {\n\t\t\tSystem.err.printf(\"Unknow length: %d\\n\", split.length);\n\t\t\treturn true;\n\t\t}\n\t\ttry {\n\t\t\tInteger.parseInt(split[0]);\n\t\t\tInteger.parseInt(split[2]);\n\t\t} catch (NumberFormatException e) {\n\t\t\tSystem.err.printf(\"Input numbers only.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif (split[1].length() != 1) {\n\t\t\tSystem.err.printf(\"Operator should be one character.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "private boolean isInputValid(){\n\t\tString errorMessage = \"\";\n\t\tif((nameField.getText() == null) || (nameField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid product name!\\n\";\n\t\t}\n\t\tif((amountAvailableField.getText() == null) || (amountAvailableField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount available value!\\n\";\n\t\t}\n\t\tif((amountSoldField.getText() == null) || (amountSoldField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount sold value!\\n\";\n\t\t}\n\t\tif((priceEachField.getText() == null) || (priceEachField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price for each!\\n\";\n\t\t}\n\t\tif((priceMakeField.getText() == null) || (priceMakeField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price to make the product!\\n\";\n\t\t}\n\t\tif(errorMessage.length() == 0){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n public void testCheckInputValidation() {\n GreekNumberValidation instance = new GreekNumberValidation();\n assertEquals(false, instance.checkInputValidation(\"69 88 89 89 35\"));\n assertEquals(false, instance.checkInputValidation(\"69 885 896 897 35\"));\n assertEquals(false, instance.checkInputValidation(\"6 885 896 8 35\"));\n assertEquals(true, instance.checkInputValidation(\"6985898731\"));\n assertEquals(true, instance.checkInputValidation(\"asd 34 5\"));\n assertEquals(true, instance.checkInputValidation(\"asd gfd g\"));\n assertEquals(true, instance.checkInputValidation(\"asdgfdg\"));\n\n }", "private boolean validFormInputs() {\n String email = etEmail.getText().toString();\n String password = etPassword.getText().toString();\n String institutionName = etInstitutionName.getText().toString();\n String addressFirst = etInstitutionAddressFirst.getText().toString();\n String addressSecond = etInstitutionAddressSecond.getText().toString();\n String CIF = etCIF.getText().toString();\n\n String[] allInputs = {email, password, institutionName, addressFirst, addressSecond, CIF};\n for (String currentInput : allInputs) {\n if (currentInput.matches(\"/s+\")) // Regex pt cazul cand stringul e gol sau contine doar spatii\n return false; // formular invalid - toate inputurile trebuie sa fie completate\n }\n String[] stringsAddressFirst = addressFirst.split(\",\");\n String[] stringsAddressSecond = addressSecond.split(\",\");\n if (stringsAddressFirst.length != 4 ||\n stringsAddressSecond.length != 3)\n return false;\n\n //<editor-fold desc=\"Checking if NUMBER and APARTMENT are numbers\">\n try {\n Integer.parseInt(stringsAddressSecond[0]);\n Integer.parseInt(stringsAddressSecond[2]);\n return true; // parsed successfully without throwing any parsing exception from string to int\n }catch (Exception e) {\n Log.v(LOG_TAG, \"Error on converting input to number : \" + e);\n return false; // parsed unsuccessfully - given strings can not be converted to int\n }\n //</editor-fold>\n }", "private boolean validateInput(){\n boolean operationOK = true;\n //perform input validation on the double values in the form\n String integrationTime = this.integrationTimeText.getText();\n String integrationFrequency = this.integrationFrequencyText.getText();\n \n if(!integrationTime.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationTime);\n integrationTimeText.setBackground(Color.WHITE);\n integrationTimeText.setToolTipText(\"Time in seconds (s)\");\n } catch (NumberFormatException ex) {\n integrationTimeText.setBackground(Color.RED);\n operationOK=false;\n integrationTimeText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(!integrationFrequency.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationFrequency);\n integrationFrequencyText.setBackground(Color.WHITE);\n integrationFrequencyText.setToolTipText(\"Frequency in Hertz (Hz)\");\n \n } catch (NumberFormatException ex) {\n operationOK=false;\n integrationFrequencyText.setBackground(Color.RED);\n integrationFrequencyText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(currentStepOperationsPanel!=null){\n operationOK = this.currentStepOperationsPanel.validateInput();\n \n }\n return operationOK;\n }", "@Override\n public boolean isInputDateValid(String dateStr) {\n DateFormat sdf = new SimpleDateFormat(this.date);\n sdf.setLenient(false);\n try {\n sdf.parse(dateStr);\n } catch (ParseException e) {\n return false;\n }\n return true;\n }", "private static boolean validateInput2(String[] input) {\n\t\tif (input.length != 2) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "protected boolean checkInput(String input) {\n\t\tfor(int i = 0; i < 10; i++) {\n\t\t\tfor(int j = 0; j < 10; j++) {\n\t\t\t\tif(refRadar[i][j].equals(input)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public static boolean validateData( String data ) throws InvalidRouteException{\n\t if(data.length() == 3) return \tisLetter(data.charAt(0)) &&\n\t \t\t\t\t\t\t\t\tisLetter(data.charAt(1)) &&\n\t \t\t\t\t\t\t\t\tisNumber(data.charAt(2));\n\t\tthrow new InvalidRouteException(\"The route '\"+data+\"' is invalid, please use the format LetterLetterNumber, ex: AB4\");\n\t}", "private static String[] checkInput(String input) throws Exception{\n String[] in = input.trim().split(\" \");\n\n if(in.length == 0){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(CommandEnum.getCommandEnumFrom(in[0]) == null){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(isSpecificCommandENum(in[0],BYE)){\n return in;\n }\n if(isSpecificCommandENum(in[0],TERMINATE)){\n return in;\n }\n\n if(in.length < MIN_PARAM){\n throw new CommandException(ExceptionEnum.LESS_INPUT_EXCEPTION);\n }\n\n if(in.length > MAX_PARAM){\n throw new CommandException(ExceptionEnum.EXTRA_INPUT_EXCEPTION);\n }\n\n //check input value\n for(int i = 1; i < in.length; i++){\n try{\n Integer.parseInt(in[i]);\n }catch(NumberFormatException e){\n throw new CommandException(ExceptionEnum.INVALID_INPUT_EXCEPTION);\n }\n }\n\n return in;\n }", "public static boolean isValidInput(String str) {\n if (str != null && str.matches(\"^[a-zA-Z0-9_]*$\")){\n return true;\n }\n\n return false;\n }", "public static boolean validateLocation(String input){\n\t\tif (input.matches(\"^\\\\{\\\".*\\\"(\\\\s|):.+\\\\}$\") && input.contains(\"\\\"\" + InterviewData.INPUT + \"\\\"\")){\n\t\t\t//System.out.println(\"IS VALID: \" + input); \t\t//debug\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean validateName(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\t\n\t\t\tif(!Character.isAlphabetic(c))\n\t\t\t{\n\t\t\t if(c == '-' || c == ' ')\n\t\t\t\t{\n\t\t\t\treturn true;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t else return false;\n\t\t\t}\t\n\t\t\t\n\t\t}\n\t\treturn true;\n\t}", "private boolean validateInput() {\n boolean isValid = true;\n Alert errMsg = Util.getAlert(Alert.AlertType.ERROR);\n if (connectionsCB.getEditor().getText() == null || !Util.isValidAddress(connectionsCB.getEditor().getText())) {\n errMsg.setContentText(\"Invalid TRex Host Name or IP address\");\n isValid = false;\n } else if (!Util.isValidPort(rpcPort.getText())) {\n errMsg.setContentText(\"Invalid TRex Sync Port Number(\" + rpcPort.getText() + \")\");\n isValid = false;\n } else if (!Util.isValidPort(asyncPort.getText())) {\n errMsg.setContentText(\"Invalid Async Port Number(\" + asyncPort.getText() + \")\");\n isValid = false;\n } else if (Util.isNullOrEmpty(nameTF.getText())) {\n errMsg.setContentText(\"Name should not be empty\");\n isValid = false;\n }\n\n if (!isValid) {\n errMsg.show();\n }\n return isValid;\n }", "public static boolean checkInputAll(String saInput) {\r\n\t\treturn checkGenericPatternAll(saInput) && checkGenericPatternAll(unalter(saInput));\r\n\t}", "public static boolean isValidDate(String input) {\n try {\n LocalDate.parse(input);\n return true;\n } catch (DateTimeParseException e) {\n return false;\n }\n }", "public boolean validateInput(double input){\n\t\tif(input >= -1 && input <= 1)\n\t\t return true;\n\t\treturn false;\t\n\t}", "private boolean checkValidDate(String inputDate) {\n SimpleDateFormat date = new SimpleDateFormat(\"ddMMyy\");\n date.setLenient(false);\n try {\n date.parse(inputDate);\n return true;\n } catch (ParseException e) {\n return false;\n }\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (gemNameField.getText() == null || gemNameField.getText().length() == 0) {\n errorMessage += \"No valid gem name!\\n\";\n }\n if (gemValueField.getText() == null || gemValueField.getText().length() == 0) {\n errorMessage += \"No valid gem value!\\n\";\n } else {\n // try to parse the gem value into an int.\n try {\n Integer.parseInt(gemValueField.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid gem value (must be an integer)!\\n\";\n }\n }\n if (gemDescripField.getText() == null || gemDescripField.getText().length() == 0) {\n errorMessage += \"No valid gem description!\\n\";\n }\n\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.initOwner(dialogStage);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n\n alert.showAndWait();\n\n return false;\n }\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ID.getText() == null || ID.getText().length() == 0) {\n errorMessage += \"No valid id!\\n\";\n System.out.println(\"fl\");\n }\n if (password.getText() == null || password.getText().length() == 0) {\n errorMessage += \"No valid password!\\n\"; \n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Dialogs.create()\n .title(\"Invalid Fields\")\n .masthead(\"Please correct invalid fields\")\n .message(errorMessage)\n .showError();\n return false;\n }\n }", "public static boolean isExpressionValid(String[] input) {\n\t\ttry {\n\t\t\tif (isFirstArgumentValid(input[0].toUpperCase()) && isSecondArgumentValid(input[1])\n\t\t\t\t\t&& isThirdArgumentValid(input[2].toUpperCase()) && isFourthArgumentValid(input[3].toUpperCase())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Something wrong with the input parameters\");\n\t\t}\n\t\treturn false;\n\t}", "@Test\n\tpublic void forInputChecker() {\n\t\tchar charTest = 'c';\n\t\tboolean result = false;\n\t\ttry {\n\t\t\tresult = object1.inputChecker(charTest);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tboolean ExpectedResult = true;\n\t\tassertEquals(ExpectedResult, result);\n\n\t}", "public static boolean isParsable(String input) {\r\n\t\tboolean parsable = true;\r\n\t\ttry {\r\n\t\t\tInteger.parseInt(input);\r\n\t\t} catch (NumberFormatException e) {\r\n\t\t\tparsable = false;\r\n\t\t}\r\n\t\treturn parsable;\r\n\t}", "public void setInputData(java.lang.String inputData) {\n this.inputData = inputData;\n }", "public Boolean test(String input);", "private void checkInput(String input)throws Exception{\n\n if (input.getBytes(\"UTF-8\").length > 255){\n throw new IOException(\"Message too long\");\n\n }\n try {\n if (Integer.parseInt(input) < 0 || Integer.parseInt(input) > 65535) {\n throw new IOException(\"Port not valid\");\n }\n }catch (NumberFormatException e){\n //nothing should happen\n }\n }", "protected void validateInput()\r\n\t{\r\n\t\tString errorMessage = null;\r\n\t\tif ( validator != null ) {\r\n\t\t\terrorMessage = validator.isValid(text.getText());\r\n\t\t}\r\n\t\t// Bug 16256: important not to treat \"\" (blank error) the same as null\r\n\t\t// (no error)\r\n\t\tsetErrorMessage(errorMessage);\r\n\t}", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (commentField.getText() == null || commentField.getText().length() == 0) {\n errorMessage += \"Не введен комментарий!\\n\";\n }\n if (timeField.getText() == null || timeField.getText().length() == 0) {\n errorMessage += \"Не введено время выполнения задачи!\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.INFORMATION);\n alert.setTitle(\"Не введены все данные!\");\n alert.setHeaderText(null);\n alert.setContentText(\"Пожалуйста, введите все данные!\");\n alert.showAndWait();\n return false;\n }\n }", "public String validate(Data[] data);", "public boolean valid()\r\n\t{\r\n\t\treturn valid(getInputStream());\r\n\t}", "@Test\n public void isInputDataValidTestWithBadInput() {\n boolean invoke = Deencapsulation.invoke(modificationFibonacci, \"isInputDataValid\", \"a\");\n assertFalse(invoke);\n }", "private boolean checkForWrongInput(){\n if(this.studentCode.getText().isEmpty())\n return true;\n //Check for length\n if(this.studentCode.getText().length() != 3)\n return true;\n //Check for invalid characters\n for(char c: this.studentCode.getText().toCharArray())\n if(!Character.isDigit(c))\n return true;\n\n return false;\n }", "private static String validateInputStr() {\n String str = \"\";\n Scanner genericString = new Scanner(System.in);\n if (!genericString.hasNextInt()) {\n str = genericString.nextLine();\n return str;\n }\n else {\n validateInputStr();\n }\n return str;\n }", "public static boolean isAlphapetic(String userInput) {\n return Pattern.matches(Constants.NAME_VALIDATION, userInput);\n }", "@Test\n\tpublic void secindForInputChecker() {\n\t\tchar charTest = 'c';\n\t\tboolean result = false;\n\t\ttry {\n\t\t\tresult = object1.inputChecker(charTest);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tboolean ExpectedResult = true;\n\t\tassertEquals(ExpectedResult, result);\n\n\t}", "@Override\n public boolean validate(final String param) {\n return false;\n }", "public static boolean isThirdArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input)\n\t\t\t\t&& (input.contains(Constants.TO_CONSTANT) || input.contains(Constants.IN_CONSTANT)))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (idLabel.getText() == null || idLabel.getText().length() == 0) {\r\n errorMessage += \"No valid ID number!\\n\"; \r\n } else {\r\n // try to parse the postal code into an int.\r\n try {\r\n Integer.parseInt(idLabel.getText());\r\n } catch (NumberFormatException e) {\r\n errorMessage += \"No valid ID number (must be an integer)!\\n\"; \r\n }\r\n }\r\n \r\n if (firstNameField.getText() == null || firstNameField.getText().length() == 0) {\r\n errorMessage += \"No valid first name!\\n\"; \r\n }\r\n if (lastNameField.getText() == null || lastNameField.getText().length() == 0) {\r\n errorMessage += \"No valid last name!\\n\"; \r\n }\r\n if (industryField.getText() == null || industryField.getText().length() == 0) {\r\n errorMessage += \"No valid industry!\\n\"; \r\n }\r\n\r\n if (workTypeField.getText() == null || workTypeField.getText().length() == 0) {\r\n errorMessage += \"No valid work type!\\n\"; \r\n }\r\n\r\n if (addressField.getText() == null || addressField.getText().length() == 0) {\r\n errorMessage += \"No valid address!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n // Show the error message.\r\n Alert alert = new Alert(AlertType.ERROR);\r\n alert.initOwner(dialogStage);\r\n alert.setTitle(\"Invalid Fields\");\r\n alert.setHeaderText(\"Please correct invalid fields\");\r\n alert.setContentText(errorMessage);\r\n\r\n alert.showAndWait();\r\n\r\n return false;\r\n }\r\n }", "public boolean isDataValid() {\r\n boolean dataValid = true;\r\n\r\n if (this.needDefaultValue) {\r\n try {\r\n this.getDefaultValue();\r\n } catch (Exception e) {\r\n dataValid = false;\r\n }\r\n }\r\n\r\n if (this.nameTextField.getText() == null || this.nameTextField.getText().length() == 0) {\r\n dataValid = false;\r\n }\r\n\r\n return dataValid;\r\n\r\n }", "public boolean isInteger(String input){\r\n try{\r\n Integer.parseInt(input);\r\n } catch (NumberFormatException e){\r\n return false;\r\n } catch (NullPointerException e){\r\n return false;\r\n }\r\n return true;\r\n }", "private boolean validateInput() {\n\tboolean valid = false;\n\ttry {\n\t if (paymentText == null | paymentText.getValue() == \"\") {\n\t\tpaymentText.focus();\n\t\tthrow new NullPointerException(\"paymentText fehlt\");\n\t }\n\t if (paymentBetrag == null | paymentBetrag.getValue() == \"\") {\n\t\tpaymentBetrag.focus();\n\t\tthrow new NullPointerException(\"paymentBetrag fehlt\");\n\t }\n\t if (!paymentBetrag.isEmpty()) {\n\t\t@SuppressWarnings(\"unused\")\n\t\tdouble d = Double.parseDouble(paymentBetrag.getValue());\n\t }\n\t // seems that everything was OK\n\t valid = true;\n\t} catch (NullPointerException e) {\n\t System.out.println(\"PaymentWindow - \" + e);\n\t} catch (NumberFormatException e) {\n\t // entered value is no number\n\t paymentBetrag.focus();\n\t}\n\treturn valid;\n }", "public static boolean CheckInputCorrect(String input) {\r\n\t\tboolean binary_tautology = false;\r\n\r\n\t\t// every char is passed through to evaluate if it is a 1 or 0.\r\n\t\tfor (int i = 0; i < input.length(); i++) {\r\n\t\t\tint z = Character.digit(input.charAt(i), 10);\r\n\r\n\t\t\tif ((z == 0) || (z == 1)) {\r\n\t\t\t\tbinary_tautology = true;\r\n\t\t\t} else {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn binary_tautology;\r\n\t}", "public boolean isParsable(String input){\n boolean parsable = true;\n try{\n Integer.parseInt(input);\n }catch(NumberFormatException e){\n parsable = false;\n }\n return parsable;\n}", "private boolean isInputValid() {\n boolean isValidInput = true;\n\n if (TextUtils.isEmpty(studentID)) {\n Validator.setEmptyError(studentIDLayout);\n isValidInput = false;\n } else {\n studentIDLayout.setError(null);\n studentIDLayout.setErrorEnabled(false);\n }\n\n if (TextUtils.isEmpty(studentName)) {\n Validator.setEmptyError(studentNameLayout);\n isValidInput = false;\n } else {\n studentNameLayout.setError(null);\n studentNameLayout.setErrorEnabled(false);\n }\n\n if (TextUtils.isEmpty(fatherName)) {\n Validator.setEmptyError(fatherNameLayout);\n isValidInput = false;\n } else {\n fatherNameLayout.setError(null);\n fatherNameLayout.setErrorEnabled(false);\n }\n\n if (TextUtils.isEmpty(gender)) {\n genderErrorText.setVisibility(View.VISIBLE);\n isValidInput = false;\n } else {\n genderErrorText.setVisibility(View.GONE);\n }\n\n if (TextUtils.isEmpty(phone)) {\n Validator.setEmptyError(phoneLayout);\n isValidInput = false;\n } else if (!Validator.isValidMobile(phone)) {\n isValidInput = false;\n phoneLayout.setError(\"This phone is not valid\");\n } else {\n phoneLayout.setError(null);\n phoneLayout.setErrorEnabled(false);\n }\n\n if (TextUtils.isEmpty(email)) {\n Validator.setEmptyError(emailLayout);\n isValidInput = false;\n } else if (!Validator.isValidEmail(email)) {\n isValidInput = false;\n emailLayout.setError(\"This email is not valid\");\n } else {\n emailLayout.setError(null);\n emailLayout.setErrorEnabled(false);\n }\n\n return isValidInput;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n //for now just check they actually typed something\n if ((userField.getText() == null) || userField.getText().isEmpty()) {\n errorMessage += \"No username entered\\n\";\n }\n if ((pwField.getText() == null) || pwField.getText().isEmpty()) {\n errorMessage += \"No password entered\\n\";\n }\n\n //no error message means success / good input\n if (errorMessage.isEmpty()) {\n return true;\n } else {\n // Show the error message if bad data\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.initOwner(_dialogStage);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n\n alert.showAndWait();\n\n return false;\n }\n }", "@Override\n public boolean inputIsValid(ParserInput<?> input) {\n return input instanceof TokensParserInput;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ServiceName.getText() == null || ServiceName.getText().length() == 0) {\n errorMessage += \"No valid name!\\n\";\n }\n if (Serviceemail.getText() == null || Serviceemail.getText().length() == 0) {\n Pattern p = Pattern.compile(\"[_A-Za-z0-9][A-Za-z0-9._]*?@[_A-Za-z0-9]+([.][_A-Za-z]+)+\");\n Matcher m = p.matcher(Serviceemail.getText());\n if (m.find() && m.group().equals(Serviceemail.getText())) {\n errorMessage += \"No valid Mail Forment!\\n\";\n }\n }\n if (servicedescrip.getText() == null || servicedescrip.getText().length() == 0) {\n errorMessage += \"No valid description !\\n\";\n }\n if (f == null && s.getImage() == null) {\n errorMessage += \"No valid photo ( please upload a photo !)\\n\";\n }\n if (Serviceprice.getText() == null || Serviceprice.getText().length() == 0) {\n errorMessage += \"No valid prix !\\n\";\n } else {\n // try to parse the postal code into an int.\n try {\n Float.parseFloat(Serviceprice.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid prix (must be a Float)!\\n\";\n }\n }\n if ( !Weekly.isSelected() && !Daily.isSelected() && !Monthly.isSelected()) {\n errorMessage += \"No valid Etat ( select an item !)\\n\";\n }\n if (Servicesatet.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid etat ( select an item !)\\n\";\n }\n if (ServiceCity.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid City ( select an item !)\\n\";\n }\n if (servicetype.getSelectionModel().getSelectedIndex() == -1) {\n errorMessage += \"No valid Type ( select an item !)\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n alert.showAndWait();\n return false;\n }\n }", "protected final boolean isValidValueImpl(String value) {\n if (value.length() != 8) {\n return false;\n }\n\n // Convert all 3 components of the string to integers\n int y, m, d;\n try {\n y = Integer.parseInt(value.substring(0, 4));\n m = Integer.parseInt(value.substring(4, 6));\n d = Integer.parseInt(value.substring(6, 8));\n } catch (NumberFormatException nfe) {\n return false;\n }\n\n // Check that the values are in the correct range\n return (y >= 0) && (m >= 1) && (m <= 12) && (d >= 1) && (d <= 31);\n }", "private boolean isInputValid() {\r\n \r\n String errorMessage = \"\";\r\n \r\n // Email regex provided by emailregex.com using the RFC5322 standard\r\n String emailPatternString = \"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\\\"(?:[\\\\x01-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x21\\\\x23-\\\\x5b\\\\x5d-\\\\x7f]|\\\\\\\\[\\\\x01-\\\\x09\\\\x0b\\\\x0c\\\\x0e-\\\\x7f])*\\\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\\\x01-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x21-\\\\x5a\\\\x53-\\\\x7f]|\\\\\\\\[\\\\x01-\\\\x09\\\\x0b\\\\x0c\\\\x0e-\\\\x7f])+)\\\\])\";\r\n \r\n // Phone number regex provided by Ravi Thapliyal on Stack Overflow:\r\n // http://stackoverflow.com/questions/16699007/regular-expression-to-match-standard-10-digit-phone-number\r\n String phoneNumString = \"^(\\\\+\\\\d{1,2}\\\\s)?\\\\(?\\\\d{3}\\\\)?[\\\\s.-]?\\\\d{3}[\\\\s.-]?\\\\d{4}$\";\r\n \r\n Pattern emailPattern = Pattern.compile(emailPatternString, Pattern.CASE_INSENSITIVE);\r\n Matcher emailMatcher;\r\n \r\n Pattern phoneNumPattern = Pattern.compile(phoneNumString);\r\n Matcher phoneNumMatcher;\r\n \r\n // Validation for no length or over database size limit\r\n if ((custFirstNameTextField.getText() == null || custFirstNameTextField.getText().length() == 0) || (custFirstNameTextField.getText().length() > 25)) {\r\n errorMessage += \"First name has to be between 1 and 25 characters.\\n\";\r\n }\r\n \r\n if ((custLastNameTextField.getText() == null || custLastNameTextField.getText().length() == 0) || (custLastNameTextField.getText().length() > 25)) {\r\n errorMessage += \"Last name has to be between 1 and 25 characters.\\n\";\r\n }\r\n \r\n if ((custAddressTextField.getText() == null || custAddressTextField.getText().length() == 0) || (custAddressTextField.getText().length() > 75)) {\r\n errorMessage += \"Address has to be between 1 and 75 characters.\\n\";\r\n }\r\n \r\n if ((custCityTextField.getText() == null || custCityTextField.getText().length() == 0) || (custCityTextField.getText().length() > 50)) {\r\n errorMessage += \"City has to be between 1 and 50 characters.\\n\";\r\n }\r\n \r\n if ((custProvinceTextField.getText() == null || custProvinceTextField.getText().length() == 0) || (custProvinceTextField.getText().length() > 2)) {\r\n errorMessage += \"Province has to be a two-letter abbreviation.\\n\";\r\n }\r\n \r\n if ((custPostalCodeTextField.getText() == null || custPostalCodeTextField.getText().length() == 0) || (custPostalCodeTextField.getText().length() > 7)) {\r\n errorMessage += \"Postal Code has to be between 1 and 7 characters.\\n\";\r\n }\r\n \r\n if ((custCountryTextField.getText() == null || custCountryTextField.getText().length() == 0) || (custCountryTextField.getText().length() > 25)) {\r\n errorMessage += \"Country has to be between 1 and 25 characters.\\n\";\r\n }\r\n \r\n if ((custHomePhoneTextField.getText() == null || custHomePhoneTextField.getText().length() == 0) || (custHomePhoneTextField.getText().length() > 20)) {\r\n errorMessage += \"Phone number has to be between 1 and 20 characters long.\\n\";\r\n } else {\r\n phoneNumMatcher = phoneNumPattern.matcher(custHomePhoneTextField.getText());\r\n if (!phoneNumMatcher.matches()) {\r\n errorMessage += \"Phone number not in the correct format: (111) 111-1111.\\n\";\r\n }\r\n }\r\n \r\n if ((custBusinessPhoneTextField.getText() == null || custBusinessPhoneTextField.getText().length() == 0) || (custBusinessPhoneTextField.getText().length() > 20)) {\r\n errorMessage += \"Phone number has to be between 1 and 20 characters long.\\n\";\r\n } else {\r\n phoneNumMatcher = phoneNumPattern.matcher(custBusinessPhoneTextField.getText());\r\n if (!phoneNumMatcher.matches()) {\r\n errorMessage += \"Phone number not in the correct format: (111) 111-1111.\\n\";\r\n }\r\n }\r\n \r\n if ((custEmailTextField.getText() == null || custEmailTextField.getText().length() == 0) || (custEmailTextField.getText().length() > 50)) {\r\n errorMessage += \"Email has to be between 1 and 50 characters.\\n\";\r\n } else {\r\n emailMatcher = emailPattern.matcher(custEmailTextField.getText());\r\n if (!emailMatcher.matches()) {\r\n errorMessage += \"Email format is not correct. Should be in the format username@domain.domaincode.\\n\"; \r\n } \r\n }\r\n \r\n if (errorMessage.length() > 0) {\r\n Alert alert = new Alert(AlertType.ERROR, errorMessage, ButtonType.OK);\r\n alert.setTitle(\"Input Error\");\r\n alert.setHeaderText(\"Please correct invalid fields\");\r\n alert.showAndWait();\r\n \r\n return false;\r\n }\r\n \r\n return true;\r\n }" ]
[ "0.87173057", "0.8256622", "0.80132455", "0.80083805", "0.7655423", "0.7491948", "0.7445991", "0.7435885", "0.74241877", "0.7353339", "0.7318285", "0.73103964", "0.7286584", "0.72425276", "0.7204857", "0.71385336", "0.7122796", "0.7061847", "0.6997576", "0.69702536", "0.6967549", "0.69179064", "0.69111574", "0.69017917", "0.68983287", "0.6898158", "0.6896908", "0.68839777", "0.6878058", "0.68689096", "0.6834134", "0.68337256", "0.680288", "0.67890286", "0.6737274", "0.6726071", "0.67129153", "0.67120886", "0.6702593", "0.668272", "0.66788584", "0.66737723", "0.66672", "0.66585344", "0.6644941", "0.66013086", "0.6579357", "0.6562486", "0.65496546", "0.65416914", "0.65200686", "0.651827", "0.6490274", "0.64687675", "0.6451847", "0.64402235", "0.64306873", "0.6426561", "0.6418411", "0.6412251", "0.6405472", "0.63982934", "0.6385595", "0.6384665", "0.6383953", "0.63829505", "0.6373642", "0.6370252", "0.6330448", "0.63288224", "0.63266844", "0.6322005", "0.6320083", "0.6311463", "0.6306131", "0.63053864", "0.62942845", "0.6288134", "0.62811303", "0.6276291", "0.6263823", "0.6254059", "0.6241411", "0.62396294", "0.62373435", "0.6233023", "0.62304986", "0.62280726", "0.6222577", "0.6214234", "0.61937463", "0.6190217", "0.61887175", "0.6185312", "0.6171941", "0.61691225", "0.61690646", "0.61627156", "0.6162208", "0.6156373", "0.6153536" ]
0.0
-1
Method: isInputDataValid(String input) has to return false
@Test public void isInputDataValidTestWithBadInput() { boolean invoke = Deencapsulation.invoke(modificationFibonacci, "isInputDataValid", "a"); assertFalse(invoke); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tprotected void isValid(String input) throws DataInputException\n\t{\n\t}", "private boolean isValidInput() {\n\t\treturn true;\n\t}", "private boolean isInputValid() {\n return true;\n }", "protected abstract boolean isInputValid();", "protected abstract boolean isInputValid(@NotNull ConversationContext context, @NotNull String input);", "private boolean isInValidInput(String input) {\n\n\t\tif (input == null || input.isEmpty())\n\t\t\treturn true;\n\n\t\tint firstPipeIndex = input.indexOf(PARAM_DELIMITER);\n\t\tint secondPipeIndex = input.indexOf(PARAM_DELIMITER, firstPipeIndex + 1);\n\n\t\t/*\n\t\t * if there are no PARAM_DELIMITERs or starts with a PARAM_DELIMITER\n\t\t * (Meaning command is missing) or only single PARAM_DELIMITER input is\n\t\t * not valid\n\t\t */\n\t\tif (firstPipeIndex == -1 || firstPipeIndex == 0 || secondPipeIndex == -1)\n\t\t\treturn true;\n\n\t\t// Means package name is empty\n\t\tif (secondPipeIndex - firstPipeIndex < 2)\n\t\t\treturn true;\n\n\t\treturn false;\n\t}", "public boolean checkInput(String input){\n\t\t//make sure only input 0-9\n\t\tif(input.length() != 1){\n\t\t\treturn false;\n\t\t}\n\t\tchar c = input.charAt(0);\n\t\tif(!Character.isDigit(c)){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public abstract boolean isValidValue(String input);", "protected abstract boolean checkInput();", "public boolean validate(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\tif(!Character.isDigit(c))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\t\n\t\t}\n\t\treturn true;\n\t}", "public static boolean checkInput(String saInput) {\r\n\t\treturn checkGenericPattern(saInput) && checkGenericPattern(unalter(saInput));\r\n\t}", "default Boolean validateInput(String input){\n if (input.contains(\"(\") || input.contains(\")\") || input.contains(\"[\") || input.contains(\"}\") || input.contains(\"{\") || input.contains(\"}\") )\n {\n return true;\n }else{\n return false;\n }\n }", "protected abstract int isValidInput();", "public boolean isValidInput(String input) {\r\n\t\tif (input == null || input.isEmpty())\r\n\t\t\treturn false;\r\n\t\tString inputTokens[] = input.split(\" \");\r\n\t\tif (inputTokens.length < 2)\r\n\t\t\treturn false;\r\n\t\tfor (int i = 0; i < inputTokens.length; i++) {\r\n\t\t\tfor (int j = 0; j < inputTokens[i].length(); j++) {\r\n\t\t\t\tswitch (inputTokens[i].charAt(j)) {\r\n\t\t\t\tcase '!':\r\n\t\t\t\tcase '?':\r\n\t\t\t\tcase '@':\r\n\t\t\t\tcase '#':\r\n\t\t\t\tcase '*':\r\n\t\t\t\tcase '/':\r\n\t\t\t\tcase '<':\r\n\t\t\t\tcase '>':\r\n\t\t\t\tcase '&':\r\n\t\t\t\tcase '%':\r\n\t\t\t\tcase '~':\r\n\t\t\t\tcase ';':\r\n\t\t\t\tcase ':':\r\n\t\t\t\tcase '[':\r\n\t\t\t\tcase ']':\r\n\t\t\t\tcase '{':\r\n\t\t\t\tcase '}':\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "@Override\n\tpublic boolean checkInput() {\n\t\treturn true;\n\t}", "public synchronized boolean validate(Object data) {\n if (!(data instanceof String)) {\n return false;\n }\n\n String dataString = (String) data;\n dataString = dataString.replaceAll(\"\\\\s\", \"\").replaceAll(\"-\", \"\");\n if (dataString.length() != 6) {\n return false;\n }\n\n for (Character c : dataString.substring(0, 2).toCharArray()) {\n if (!Character.isLetter(c)) {\n return false;\n }\n }\n for (Character c : dataString.substring(3, 5).toCharArray()) {\n if (!Character.isDigit(c)) {\n return false;\n }\n }\n return true;\n }", "private void validateData(String input) {\n String[] inputStringArray = input.split(\" \");\n\n for (String s : inputStringArray) {\n try {\n Integer.parseInt(s);\n } catch (NumberFormatException e) {\n throw new NumberFormatException(\n \"Looks like your input - \" + s + \", is not a number. Try again\");\n }\n }\n }", "public boolean isInputValid()\n {\n String[] values = getFieldValues();\n if(values[0].length() > 0 || values[1].length() > 0 || values[2].length() > 0)\n return true;\n else\n return false;\n }", "public boolean checkInput();", "public boolean validate(final String input){\n\n matcher = pattern.matcher(input);\n return matcher.matches();\n\n }", "protected boolean validateData(String [] data) {\n return true;\n }", "public boolean isValid(String input){\r\n\t\t// Verifies if the input contains multiple integer / double values sperated by \",\"\r\n\t\tString[] splitValues = input.split(\",\");\r\n\t\tfor(int i = 0; i < splitValues.length; i++){\t\r\n\t\t\ttry{\r\n\t\t\t\tDouble.parseDouble(splitValues[i]);\r\n\t\t\t}\r\n\t\t\tcatch(NumberFormatException nfe){\r\n\t\t\t\tSystem.err.println(\"### [ValuesRequirement] ERROR: unparseable number in \" + splitValues[i] + \", part of \" + input);\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public static boolean isSecondArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && CommonUtils.isNumeric(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "private boolean isValidInput() {\n if (null == mUsername || mUsername.length() <= 0) {\n return false;\n } else if (null == mPassword || mPassword.length() <= 0) {\n return false;\n }\n return true;\n }", "private void validateInputParameters(){\n\n }", "public static boolean isStringValid(String check, String inputData) {\n\t\tString errorMessage = \"\";\n\n\t\tif (inputData == null || inputData.length() == 0) {\n\t\t\terrorMessage += \"No valid : \" + check + \"\\n\";\n\t\t}\n\n\t\tif (errorMessage.length() == 0)\n\t\t\treturn true;\n\n\t\terrorMessage(errorMessage);\n\t\treturn false;\n\t}", "public boolean isCryptoInputValid(String input) {\n\t\tOnlineCourseQuery query = new OnlineCourseQuery();\n\t\t\n\t\tList<String> tempFiatCurrencyList = Arrays.asList(\"CHF\");\n\t\tList<String> tempcryptoCurrencyList = Arrays.asList(input);\n\t\t\n\t\ttry {\n\t\t\tJSONObject resultObject = query.getOnlineCourseData(tempcryptoCurrencyList, tempFiatCurrencyList);\n\t\t\t\n\t\t\t Iterator<String> keys = resultObject.keys();\n\t\t\t String str = keys.next();\n\t\t\t String result = resultObject.optString(str);\n\t\t\t \n\t\t\t if (result.equals(\"Error\")) {\n\t\t\t\t return false;\n\t\t\t }\n\t\t\t \n\t\t\t return true;\n\t\t\t\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\n\t\t}\n\t\treturn false;\n\t}", "public static Boolean validateInput(String input) {\n\t\tString xInput = input.substring(0,1);\n\n\t\n\n\t\t\n\t\tboolean xIsLetter = Character.isLetter(xInput.charAt(0));\n\n\t\tif((!input.isEmpty()) || (!xIsLetter)) {\n\t\n\t\t\treturn false;\n\t\t} else {\n\n\t\t\treturn true; \n\t\t\t}\n\t\t}", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (nameField.getText() == null || nameField.getText().length() == 0) {\r\n errorMessage += \"请输入直播名!\\n\";\r\n }\r\n if (urlField.getText() == null || urlField.getText().length() == 0) {\r\n errorMessage += \"请输入直播流!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n Alert alert = new Alert(Alert.AlertType.ERROR);\r\n alert.setTitle(\"输入错误\");\r\n alert.setContentText(errorMessage);\r\n return false;\r\n }\r\n }", "private boolean isValid(String input){\n return input.length() == 10 && input.matches(\"-?\\\\d+(\\\\.\\\\d+)?\");\n //check its digits\n }", "public abstract boolean verifyInput();", "private static boolean isBadInput(String s) {\n\t\tString[] split = s.split(\"\\\\s+\");\n\t\tif (split.length != 3) {\n\t\t\tSystem.err.printf(\"Unknow length: %d\\n\", split.length);\n\t\t\treturn true;\n\t\t}\n\t\ttry {\n\t\t\tInteger.parseInt(split[0]);\n\t\t\tInteger.parseInt(split[2]);\n\t\t} catch (NumberFormatException e) {\n\t\t\tSystem.err.printf(\"Input numbers only.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif (split[1].length() != 1) {\n\t\t\tSystem.err.printf(\"Operator should be one character.\\n\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean validateFieldInput(String input) {\n\t\tboolean valid = false;\n\t if (input.matches(\"^[0-9]{1,8}([.][0-9]{1,4})?$\") && Double.valueOf(input) >0.0) {\n\t \t\n\t \tvalid = true;\n\t }\n\t \n\t return valid;\n\t}", "protected boolean isValidData() {\n return true;\n }", "private void validateData() {\n }", "private boolean isValidInput(String input) \r\n {\r\n\t \r\n return input!=null&&input.length()<=10;\r\n \r\n }", "public void testInvalidInput(){\n\t\tString input = \"bye\";\n\t\tString actual = operation.processOperation(input);\n\t\tString expected = \"bye bye could not be performed\";\n\t\tassertEquals(expected,actual);\n\t}", "private boolean isValid(char input) {\n if (this.isLetter(input) || this.isDigit(input) || this.isOperator(input)\n || this.isIgnored(input)) {\n return true;\n } else return false;\n }", "public static boolean checkForValidInput(String input) {\n try {\n int inputValue = Integer.parseInt(input);\n return inputValue >= 0 && inputValue <= 8;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "public boolean inputIsValid() {\n return nameIsValid() &&\n descriptionIsValid() &&\n priceIsValid() &&\n streetIsValid() &&\n zipcodeIsValid() &&\n cityIsValid() &&\n imageIsSelected();\n }", "boolean inputValid(String s) {\n\n if (s.length() == 0) {\n return false;\n }\n\n //check whether there are wrong commas\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == ',') {\n if(!s.contains(\"log\")) {\n resS = \"There are wrong commas\";\n return false;\n }\n }\n }\n\n //check whether there are multiple points\n if(s.charAt(0)=='.' || s.charAt(s.length()-1)=='.') return false;\n for (int ii = 1; ii < s.length() - 1; ii++) {\n if (s.charAt(ii) == '.') {\n if (!Character.isDigit(s.charAt(ii - 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else if (!Character.isDigit(s.charAt(ii + 1))) {\n resS=\"These are wrong points.\";\n return false;\n } else {\n for (int jj = ii + 2; jj < s.length(); jj++) {\n if (s.charAt(jj) == '.') {\n String ss = s.substring(ii + 2, jj);\n if (!(ss.contains(\"+\") || ss.contains(\"-\") || ss.contains(\"*\") || ss.contains(\"/\") || ss.contains(\"%\")\n || ss.contains(\"^\") || ss.contains(\")\"))) {\n resS=\"These are wrong points.\";\n return false;\n }\n }\n }\n }\n }\n }\n ArrayList<Token> operation = tokenize(s);\n return isNumberOrOpe(operation) && isOpePosRight(operation) && isValidparentheses(operation) && isValidTan(operation) && isLogWrong(operation);\n }", "private void checkUserInput() {\n }", "public static boolean isGoodField(String input) {\n if (input == null || input.isEmpty() || input.length() < 6)\n return false;\n return true;\n }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n// Show the error message.\r\n Dialogs.create()\r\n .title(\"Invalid Fields\")\r\n .masthead(\"Please correct invalid fields\")\r\n .message(errorMessage)\r\n .showError();\r\n return false;\r\n }\r\n }", "@Override\n public boolean validate(final String param) {\n return false;\n }", "private boolean containsValidCharacters(String inputString)\r\n {\r\n boolean validityFlag = true;\r\n int inputStringLength = inputString.trim().length();\r\n for (int i = 0 ; i < inputStringLength ; i++)\r\n {\r\n char digit = inputString.charAt(i);\r\n if (!((digit >= 'A' && digit <= 'Z') || (digit >= 'a' && digit <= 'z') || (digit >= '0' && digit <= '9')))\r\n {\r\n validityFlag = false;\r\n break;\r\n }\r\n }\r\n return validityFlag;\r\n }", "public boolean checkInput(String str)\n {\n try\n {\n Integer.parseInt(str);\n } \n catch(NumberFormatException ex)\n {\n return false;\n } \n return true;\n }", "@Override\n public boolean isInputDateValid(String dateStr) {\n DateFormat sdf = new SimpleDateFormat(this.date);\n sdf.setLenient(false);\n try {\n sdf.parse(dateStr);\n } catch (ParseException e) {\n return false;\n }\n return true;\n }", "private boolean checkForWrongInput(){\n if(this.studentCode.getText().isEmpty())\n return true;\n //Check for length\n if(this.studentCode.getText().length() != 3)\n return true;\n //Check for invalid characters\n for(char c: this.studentCode.getText().toCharArray())\n if(!Character.isDigit(c))\n return true;\n\n return false;\n }", "private static boolean valid_input(String user_input) {\n \n boolean output = false;\n \n if(user_input.length() == 2){\n \n output = (user_input.substring(0,1).matches(\"[0-9]\") && user_input.substring(1,2).matches(\"[a-zA-Z]\"));\n } else if (user_input.length() == 3) {\n \n output = (user_input.substring(0,2).matches(\"[1-2][0-9]\") && user_input.substring(2,3).matches(\"[a-zA-Z]\"));\n \n if(Integer.parseInt(user_input.substring(0,2))>TicTacToe.game.gridSize){\n output = false;\n }\n }\n \n return output;\n }", "private static boolean validateInput1(String[] input) {\n\t\tif (input.length != 1) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "private static boolean isValidDigit(String strInput) {\n boolean isValid = true;\n if (isPrimitive(strInput)) {\n int input = Integer.parseInt(strInput);\n if (input < 1 || input > 255) {\n log.debug(\"Wrong config input value: {}\", strInput);\n isValid = false;\n } else {\n isValid = true;\n }\n\n } else {\n isValid = false;\n }\n\n return isValid;\n }", "protected void validateInput()\r\n\t{\r\n\t\tString errorMessage = null;\r\n\t\tif ( validator != null ) {\r\n\t\t\terrorMessage = validator.isValid(text.getText());\r\n\t\t}\r\n\t\t// Bug 16256: important not to treat \"\" (blank error) the same as null\r\n\t\t// (no error)\r\n\t\tsetErrorMessage(errorMessage);\r\n\t}", "private static boolean isParsable(String input) {\n try {\n Integer.parseInt(input);\n return true;\n } catch (NumberFormatException e) {\n return false;\n }\n }", "public boolean validateInput(double input){\n\t\tif(input >= -1 && input <= 1)\n\t\t return true;\n\t\treturn false;\t\n\t}", "private boolean checkValidDate(String inputDate) {\n SimpleDateFormat date = new SimpleDateFormat(\"ddMMyy\");\n date.setLenient(false);\n try {\n date.parse(inputDate);\n return true;\n } catch (ParseException e) {\n return false;\n }\n }", "private static boolean validateInput2(String[] input) {\n\t\tif (input.length != 2) {\n\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public abstract boolean isValid(String s);", "public static boolean isValidInput(String str) {\n if (str != null && str.matches(\"^[a-zA-Z0-9_]*$\")){\n return true;\n }\n\n return false;\n }", "private boolean isUserInputValid(String[] packetData)\n\t{\n\t\tif(packetData.length < 3 ) return false;\n\t\tString address = packetData[0];\n\t\tint port = Integer.parseInt(packetData[1]);\n\n\t\tint addressPeriodsCount = address.length() - address.replace(\".\", \"\").length();\n\n\t\tif (packetData.length < 3)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\telse if(address.equals(\"localhost\") && (port > 0 || port <= 65535))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn (addressPeriodsCount == 3 ||addressPeriodsCount == 2 ) && (port > 0 || port <= 65535);\n\t\t}\n\t}", "public boolean isInputValid(ConversationContext context, String s)\r\n/* */ {\r\n/* 135 */ return (s.equalsIgnoreCase(\"one\")) || (s.equals(\"1\")) || (s.equalsIgnoreCase(\"two\")) || (s.equals(\"2\")) || (s.equalsIgnoreCase(\"zero\")) || (s.equals(\"0\"));\r\n/* */ }", "private boolean isInputValid(){\n\t\tString errorMessage = \"\";\n\t\tif((nameField.getText() == null) || (nameField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid product name!\\n\";\n\t\t}\n\t\tif((amountAvailableField.getText() == null) || (amountAvailableField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount available value!\\n\";\n\t\t}\n\t\tif((amountSoldField.getText() == null) || (amountSoldField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid amount sold value!\\n\";\n\t\t}\n\t\tif((priceEachField.getText() == null) || (priceEachField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price for each!\\n\";\n\t\t}\n\t\tif((priceMakeField.getText() == null) || (priceMakeField.getText().length() == 0)){\n\t\t\terrorMessage += \"No valid price to make the product!\\n\";\n\t\t}\n\t\tif(errorMessage.length() == 0){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n\tvoid testCheckString2() {\n\t\tassertFalse(DataChecker.checkString(\"\"));\n\t}", "private void checkInput(String input)throws Exception{\n\n if (input.getBytes(\"UTF-8\").length > 255){\n throw new IOException(\"Message too long\");\n\n }\n try {\n if (Integer.parseInt(input) < 0 || Integer.parseInt(input) > 65535) {\n throw new IOException(\"Port not valid\");\n }\n }catch (NumberFormatException e){\n //nothing should happen\n }\n }", "private static String[] checkInput(String input) throws Exception{\n String[] in = input.trim().split(\" \");\n\n if(in.length == 0){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(CommandEnum.getCommandEnumFrom(in[0]) == null){\n throw new CommandException(ExceptionEnum.INCORRECT_COMMAND_EXCEPTION);\n }\n\n if(isSpecificCommandENum(in[0],BYE)){\n return in;\n }\n if(isSpecificCommandENum(in[0],TERMINATE)){\n return in;\n }\n\n if(in.length < MIN_PARAM){\n throw new CommandException(ExceptionEnum.LESS_INPUT_EXCEPTION);\n }\n\n if(in.length > MAX_PARAM){\n throw new CommandException(ExceptionEnum.EXTRA_INPUT_EXCEPTION);\n }\n\n //check input value\n for(int i = 1; i < in.length; i++){\n try{\n Integer.parseInt(in[i]);\n }catch(NumberFormatException e){\n throw new CommandException(ExceptionEnum.INVALID_INPUT_EXCEPTION);\n }\n }\n\n return in;\n }", "@Override\n protected boolean isValueIsValid(String value) {\n return false;\n }", "@Test\n public void testCheckInputValidation() {\n GreekNumberValidation instance = new GreekNumberValidation();\n assertEquals(false, instance.checkInputValidation(\"69 88 89 89 35\"));\n assertEquals(false, instance.checkInputValidation(\"69 885 896 897 35\"));\n assertEquals(false, instance.checkInputValidation(\"6 885 896 8 35\"));\n assertEquals(true, instance.checkInputValidation(\"6985898731\"));\n assertEquals(true, instance.checkInputValidation(\"asd 34 5\"));\n assertEquals(true, instance.checkInputValidation(\"asd gfd g\"));\n assertEquals(true, instance.checkInputValidation(\"asdgfdg\"));\n\n }", "@Override\r\n\tpublic boolean validate(String num) {\n\t\treturn false;\r\n\t}", "public boolean validateName(String input)//true if valid\n\t{\n\t\t//loop through string verifying for numbers\n\t\tfor(int i = 0;i<input.length(); i++)\n\t\t{\n\t\t\tchar c = input.charAt(i);\n\t\t\t\n\t\t\tif(!Character.isAlphabetic(c))\n\t\t\t{\n\t\t\t if(c == '-' || c == ' ')\n\t\t\t\t{\n\t\t\t\treturn true;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t else return false;\n\t\t\t}\t\n\t\t\t\n\t\t}\n\t\treturn true;\n\t}", "public static boolean isFirstArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input) && isValidCurrency(input))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "private static String validateInputStr() {\n String str = \"\";\n Scanner genericString = new Scanner(System.in);\n if (!genericString.hasNextInt()) {\n str = genericString.nextLine();\n return str;\n }\n else {\n validateInputStr();\n }\n return str;\n }", "public void setInputData(java.lang.String inputData) {\n this.inputData = inputData;\n }", "public static boolean isValidDate(String input) {\n try {\n LocalDate.parse(input);\n return true;\n } catch (DateTimeParseException e) {\n return false;\n }\n }", "public static boolean validateData( String data ) throws InvalidRouteException{\n\t if(data.length() == 3) return \tisLetter(data.charAt(0)) &&\n\t \t\t\t\t\t\t\t\tisLetter(data.charAt(1)) &&\n\t \t\t\t\t\t\t\t\tisNumber(data.charAt(2));\n\t\tthrow new InvalidRouteException(\"The route '\"+data+\"' is invalid, please use the format LetterLetterNumber, ex: AB4\");\n\t}", "private boolean validateInput(EditText titleInput, EditText descriptionInput, EditText priceInput) {\n String title = titleInput.getText().toString();\n String description = descriptionInput.getText().toString();\n int price = (TextUtils.isEmpty(priceInput.getText().toString()))? -1 : Integer.parseInt(priceInput.getText().toString());\n if (TextUtils.isEmpty(title) || TextUtils.isEmpty(description) || price < 0) {\n Toast.makeText(this.getActivity(),\n \"Please, fill in all fields.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n if (photoURI == null) {\n Toast.makeText(this.getActivity(),\n \"Please, add a picture to this item before submitting it.\",\n Toast.LENGTH_LONG).show();\n return false;\n }\n return true;\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (ID.getText() == null || ID.getText().length() == 0) {\n errorMessage += \"No valid id!\\n\";\n System.out.println(\"fl\");\n }\n if (password.getText() == null || password.getText().length() == 0) {\n errorMessage += \"No valid password!\\n\"; \n }\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Dialogs.create()\n .title(\"Invalid Fields\")\n .masthead(\"Please correct invalid fields\")\n .message(errorMessage)\n .showError();\n return false;\n }\n }", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (commentField.getText() == null || commentField.getText().length() == 0) {\n errorMessage += \"Не введен комментарий!\\n\";\n }\n if (timeField.getText() == null || timeField.getText().length() == 0) {\n errorMessage += \"Не введено время выполнения задачи!\\n\";\n }\n if (errorMessage.length() == 0) {\n return true;\n } if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.INFORMATION);\n alert.setTitle(\"Не введены все данные!\");\n alert.setHeaderText(null);\n alert.setContentText(\"Пожалуйста, введите все данные!\");\n alert.showAndWait();\n return false;\n }\n }", "protected boolean checkInput(String input) {\n\t\tfor(int i = 0; i < 10; i++) {\n\t\t\tfor(int j = 0; j < 10; j++) {\n\t\t\t\tif(refRadar[i][j].equals(input)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "private boolean validateInput(){\n boolean operationOK = true;\n //perform input validation on the double values in the form\n String integrationTime = this.integrationTimeText.getText();\n String integrationFrequency = this.integrationFrequencyText.getText();\n \n if(!integrationTime.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationTime);\n integrationTimeText.setBackground(Color.WHITE);\n integrationTimeText.setToolTipText(\"Time in seconds (s)\");\n } catch (NumberFormatException ex) {\n integrationTimeText.setBackground(Color.RED);\n operationOK=false;\n integrationTimeText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(!integrationFrequency.equals(\"\")){\n try {\n Double itime = Double.parseDouble(integrationFrequency);\n integrationFrequencyText.setBackground(Color.WHITE);\n integrationFrequencyText.setToolTipText(\"Frequency in Hertz (Hz)\");\n \n } catch (NumberFormatException ex) {\n operationOK=false;\n integrationFrequencyText.setBackground(Color.RED);\n integrationFrequencyText.setToolTipText(\"This field has to be a valid double (eg. 1.5)\");\n }\n }\n if(currentStepOperationsPanel!=null){\n operationOK = this.currentStepOperationsPanel.validateInput();\n \n }\n return operationOK;\n }", "private static double checkInput(String input) {\n\t\tdouble parsedValue = 0;\n\t\ttry {\n\t\t\tparsedValue = Double.parseDouble(input);\n\t\t} catch (NumberFormatException parseFailed) {\n\t\t\tSystem.out.println(\"'\" + input + \"' se ne može protumačiti kao broj.\");\n\t\t\treturn ERROR;\n\t\t}\n\n\t\tif (parsedValue > 0) {\n\t\t\treturn parsedValue;\n\t\t} else if (parsedValue < 0) {\n\t\t\tSystem.out.println(\"Unijeli ste negativnu vrijednost.\");\n\t\t} else {\n\t\t\tSystem.out.println(\"Ne postoji pravokutnik sa stranicom duljine nula.\");\n\t\t}\n\t\treturn ERROR;\n\t}", "private boolean isInputValid() {\n String errorMessage = \"\";\n\n if (gemNameField.getText() == null || gemNameField.getText().length() == 0) {\n errorMessage += \"No valid gem name!\\n\";\n }\n if (gemValueField.getText() == null || gemValueField.getText().length() == 0) {\n errorMessage += \"No valid gem value!\\n\";\n } else {\n // try to parse the gem value into an int.\n try {\n Integer.parseInt(gemValueField.getText());\n } catch (NumberFormatException e) {\n errorMessage += \"No valid gem value (must be an integer)!\\n\";\n }\n }\n if (gemDescripField.getText() == null || gemDescripField.getText().length() == 0) {\n errorMessage += \"No valid gem description!\\n\";\n }\n\n if (errorMessage.length() == 0) {\n return true;\n } else {\n // Show the error message.\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.initOwner(dialogStage);\n alert.setTitle(\"Invalid Fields\");\n alert.setHeaderText(\"Please correct invalid fields\");\n alert.setContentText(errorMessage);\n\n alert.showAndWait();\n\n return false;\n }\n }", "private boolean validFormInputs() {\n String email = etEmail.getText().toString();\n String password = etPassword.getText().toString();\n String institutionName = etInstitutionName.getText().toString();\n String addressFirst = etInstitutionAddressFirst.getText().toString();\n String addressSecond = etInstitutionAddressSecond.getText().toString();\n String CIF = etCIF.getText().toString();\n\n String[] allInputs = {email, password, institutionName, addressFirst, addressSecond, CIF};\n for (String currentInput : allInputs) {\n if (currentInput.matches(\"/s+\")) // Regex pt cazul cand stringul e gol sau contine doar spatii\n return false; // formular invalid - toate inputurile trebuie sa fie completate\n }\n String[] stringsAddressFirst = addressFirst.split(\",\");\n String[] stringsAddressSecond = addressSecond.split(\",\");\n if (stringsAddressFirst.length != 4 ||\n stringsAddressSecond.length != 3)\n return false;\n\n //<editor-fold desc=\"Checking if NUMBER and APARTMENT are numbers\">\n try {\n Integer.parseInt(stringsAddressSecond[0]);\n Integer.parseInt(stringsAddressSecond[2]);\n return true; // parsed successfully without throwing any parsing exception from string to int\n }catch (Exception e) {\n Log.v(LOG_TAG, \"Error on converting input to number : \" + e);\n return false; // parsed unsuccessfully - given strings can not be converted to int\n }\n //</editor-fold>\n }", "public boolean validateMoveAndPlay(String input){\n // This function validates the move. such as whether coins are present or not.\n try{\n InvalidMoveException.validateMove(input, this.gameController);\n if(playMove(input) == false){\n return false;\n }\n }catch(InvalidMoveException e){\n System.out.println(\"\\nDiscarding \"+input+ \" move because of following exception\");\n System.out.println(e.getMessage()+\"\\n\");\n }\n return true;\n }", "public boolean checkData(String data){\n\t\tSimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy/MM/dd\");\n\t dateFormat.setLenient(false);\n\t try {\n\t\t\tdateFormat.parse(data.trim());\n\t\t} catch (java.text.ParseException e) {\n\t\t\treturn false;\n\t\t}\n\t return true;\n\t}", "private boolean validateInput() {\n boolean isValid = true;\n Alert errMsg = Util.getAlert(Alert.AlertType.ERROR);\n if (connectionsCB.getEditor().getText() == null || !Util.isValidAddress(connectionsCB.getEditor().getText())) {\n errMsg.setContentText(\"Invalid TRex Host Name or IP address\");\n isValid = false;\n } else if (!Util.isValidPort(rpcPort.getText())) {\n errMsg.setContentText(\"Invalid TRex Sync Port Number(\" + rpcPort.getText() + \")\");\n isValid = false;\n } else if (!Util.isValidPort(asyncPort.getText())) {\n errMsg.setContentText(\"Invalid Async Port Number(\" + asyncPort.getText() + \")\");\n isValid = false;\n } else if (Util.isNullOrEmpty(nameTF.getText())) {\n errMsg.setContentText(\"Name should not be empty\");\n isValid = false;\n }\n\n if (!isValid) {\n errMsg.show();\n }\n return isValid;\n }", "@Override\n\t\tpublic boolean isInvalid() {\n\t\t\treturn false;\n\t\t}", "public static boolean isThirdArgumentValid(String input) {\n\t\tif (CommonUtils.isNotNullOrEmpty(input)\n\t\t\t\t&& (input.contains(Constants.TO_CONSTANT) || input.contains(Constants.IN_CONSTANT)))\n\t\t\treturn true;\n\t\treturn false;\n\t}", "public static boolean validateLocation(String input){\n\t\tif (input.matches(\"^\\\\{\\\".*\\\"(\\\\s|):.+\\\\}$\") && input.contains(\"\\\"\" + InterviewData.INPUT + \"\\\"\")){\n\t\t\t//System.out.println(\"IS VALID: \" + input); \t\t//debug\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n\tvoid testCheckString3() {\n\t\tassertFalse(DataChecker.checkString(null));\n\t}", "private boolean checkInputValidity() {\n // if any of the input field is empty, return false directly\n if (name.getText().equals(\"\") || id.getText().equals(\"\") || fiber.getText().equals(\"\")\n || protein.getText().equals(\"\") || fat.getText().equals(\"\") || calories.getText().equals(\"\")\n || carbohydrate.getText().equals(\"\")) {\n String message = \"Make sure enter the value of all nutrient components, please try again!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();// close the add food stage\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any nutrition info input is not a number value or is negative, return false directly\n try {\n Double fibervalue = null;\n Double proteinvalue = null;\n Double fatvalue = null;\n Double caloriesvalue = null;\n Double carbohydratevalue = null;\n // trim the input to exact numeric value\n fibervalue = Double.valueOf(fiber.getText().trim());\n proteinvalue = Double.valueOf(protein.getText().trim());\n fatvalue = Double.valueOf(fat.getText().trim());\n caloriesvalue = Double.valueOf(calories.getText().trim());\n carbohydratevalue = Double.valueOf(carbohydrate.getText().trim());\n // nutrition input is suppose to be positive numbers\n // if any of the numbers is negative, return false diretcly\n if (fibervalue < 0.0 || proteinvalue < 0.0 || fatvalue < 0.0 || caloriesvalue < 0.0\n || carbohydratevalue < 0.0) {\n String message = \"The input of the nutrient can not be negative, please try again!\";\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close();\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n // if any input of the nutrition info is not a double value, catch the exception and return\n // false\n } catch (Exception e) {\n String message =\n \"At least one nutrition value input is invalid, please type a number in nutrient textbox!\";\n // display the warning windows with the assigned warning message\n Alert alert = new Alert(AlertType.INFORMATION, message);\n alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);\n this.close(); // close the addfood stage\n // wait for response from ok button\n alert.showAndWait().filter(response -> response == ButtonType.OK);\n return false;\n }\n return true;\n }", "private boolean validateInput() {\n String username = editUsername.getText().toString().trim();\n String email = editEmail.getText().toString().trim();\n String password = editPassword.getText().toString().trim();\n String repeatPassword = editRepeatPassword.getText().toString().trim();\n if (!password.equals(repeatPassword)) {\n ShowMessageUtil.tosatSlow(\"Enter passwords differ\", EmailRegisterActivity.this);\n return false;\n } else if (username.equals(\"\") || email.equals(\"\") || password.equals(\"\")) {\n ShowMessageUtil.tosatSlow(\"every item can not be empty!\", EmailRegisterActivity.this);\n return false;\n }\n if (username.length()>10){\n ShowMessageUtil.tosatSlow(\"the character length of the username can't be over than 10\", EmailRegisterActivity.this);\n return false;\n }\n return true;\n }", "public static boolean checkInputAlert(String saInput) throws Exception {\r\n\t\tboolean bool = checkInput(saInput);\r\n\r\n\t\tif (! bool) {\r\n\t\t\tStringBuffer sb = new StringBuffer(\"Hazardous characters found in the input: \");\r\n\t\t\tsb.append(\"\\\"\").append(HansFilter.alter(saInput)).append(\"\\\"\");\r\n\r\n\t\t\tthrow new Exception(sb.toString());\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}", "public boolean Validate_Input(String attack_coord){\r\n\t\tattack_coord=attack_coord.trim(); //deletes any unecessary whitespace\r\n\t\tif(attack_coord.length()>3) { //format incorrect\r\n\t\t\tdisplay.scroll(\"Input string too long to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(attack_coord.length()<=1){\r\n\t\t\tdisplay.scroll(\"Input string too short to be proper coordinate\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// Convert the string inputs into integers\r\n\t\tString x_as_string = attack_coord.substring(1);\r\n\t\tycoor = letterToIndex(attack_coord.charAt(0));\r\n\t\t\r\n\t\t\r\n\t\ttry{\r\n\t\t\txcoor=Integer.parseInt(x_as_string);\r\n\t\t\txcoor--; //to match the xcoor with the array position\r\n\t\t} catch (NumberFormatException nfe) {\r\n\t display.scroll(\"Incorrect Format. Enter with letter and then number i.e. B3\");\r\n\t display.printScreen();\r\n\t return false;\r\n\t\t}\r\n\r\n\t\t\r\n\t\t\r\n\r\n\t\tif(!hisBoard.in_Grid(xcoor, ycoor)){\r\n\t\t\tdisplay.scroll(\"The Coordinate input is not within (A-J) or (1-10)\");\r\n\t\t\tdisplay.printScreen();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif(hisBoard.already_attacked(xcoor,ycoor)){\r\n\t\t\tdisplay.scroll(\"Coordinate has already been attacked\");\r\n\t\t\tdisplay.printScreen();\t\t\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public void invalid() {\r\n\t\tSystem.out.println(\"Please enter a valid input\");\r\n\t}", "protected void checkInputFile(final String inputFile)\r\n\t{\r\n\t\tif(inputFile == null)\r\n\t\t{\r\n\t\t\tthrow new NullPointerException(\"Given input file is null\");\r\n\t\t}\r\n\t\t\r\n\t\tif(inputFile.trim().isEmpty())\r\n\t\t{\r\n\t\t\tthrow new IllegalArgumentException(\"Name of the input file is empty\");\r\n\t\t}\r\n\t\t\r\n\t\tfinal File in = new File(inputFile);\r\n\t\tif (!in.canRead())\r\n\t\t{\r\n\t\t\tthrow new IllegalArgumentException(\"File \" + \r\n\t\t\t\t\t\t\t\t\t\t\t\tinputFile + \r\n\t\t\t\t\t\t\t\t\t\t\t\t\" does not exist or is not readable.\");\r\n\t\t}\r\n\t}", "public Boolean test(String input);", "private boolean validateInput() {\n\tboolean valid = false;\n\ttry {\n\t if (paymentText == null | paymentText.getValue() == \"\") {\n\t\tpaymentText.focus();\n\t\tthrow new NullPointerException(\"paymentText fehlt\");\n\t }\n\t if (paymentBetrag == null | paymentBetrag.getValue() == \"\") {\n\t\tpaymentBetrag.focus();\n\t\tthrow new NullPointerException(\"paymentBetrag fehlt\");\n\t }\n\t if (!paymentBetrag.isEmpty()) {\n\t\t@SuppressWarnings(\"unused\")\n\t\tdouble d = Double.parseDouble(paymentBetrag.getValue());\n\t }\n\t // seems that everything was OK\n\t valid = true;\n\t} catch (NullPointerException e) {\n\t System.out.println(\"PaymentWindow - \" + e);\n\t} catch (NumberFormatException e) {\n\t // entered value is no number\n\t paymentBetrag.focus();\n\t}\n\treturn valid;\n }", "public boolean validateInput() {\n/* 158 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "private boolean isInputValid() {\r\n String errorMessage = \"\";\r\n\r\n if (idLabel.getText() == null || idLabel.getText().length() == 0) {\r\n errorMessage += \"No valid ID number!\\n\"; \r\n } else {\r\n // try to parse the postal code into an int.\r\n try {\r\n Integer.parseInt(idLabel.getText());\r\n } catch (NumberFormatException e) {\r\n errorMessage += \"No valid ID number (must be an integer)!\\n\"; \r\n }\r\n }\r\n \r\n if (firstNameField.getText() == null || firstNameField.getText().length() == 0) {\r\n errorMessage += \"No valid first name!\\n\"; \r\n }\r\n if (lastNameField.getText() == null || lastNameField.getText().length() == 0) {\r\n errorMessage += \"No valid last name!\\n\"; \r\n }\r\n if (industryField.getText() == null || industryField.getText().length() == 0) {\r\n errorMessage += \"No valid industry!\\n\"; \r\n }\r\n\r\n if (workTypeField.getText() == null || workTypeField.getText().length() == 0) {\r\n errorMessage += \"No valid work type!\\n\"; \r\n }\r\n\r\n if (addressField.getText() == null || addressField.getText().length() == 0) {\r\n errorMessage += \"No valid address!\\n\";\r\n }\r\n\r\n if (errorMessage.length() == 0) {\r\n return true;\r\n } else {\r\n // Show the error message.\r\n Alert alert = new Alert(AlertType.ERROR);\r\n alert.initOwner(dialogStage);\r\n alert.setTitle(\"Invalid Fields\");\r\n alert.setHeaderText(\"Please correct invalid fields\");\r\n alert.setContentText(errorMessage);\r\n\r\n alert.showAndWait();\r\n\r\n return false;\r\n }\r\n }", "public boolean isParsable(String input){\n boolean parsable = true;\n try{\n Integer.parseInt(input);\n }catch(NumberFormatException e){\n parsable = false;\n }\n return parsable;\n}" ]
[ "0.85649997", "0.8096069", "0.7852256", "0.78284705", "0.7385448", "0.73349047", "0.7262217", "0.7252187", "0.7204674", "0.7184475", "0.7106134", "0.7089437", "0.7071313", "0.70243365", "0.7020989", "0.69791234", "0.6889323", "0.6887267", "0.6868709", "0.68330115", "0.6820228", "0.6816022", "0.680566", "0.6775743", "0.6769249", "0.6730423", "0.67290837", "0.6708012", "0.6682617", "0.6661305", "0.6654916", "0.66527814", "0.66456735", "0.6629746", "0.66246176", "0.6576723", "0.65655", "0.6554072", "0.654227", "0.6537649", "0.6522428", "0.6507871", "0.65005755", "0.6484184", "0.6482812", "0.6471965", "0.64703393", "0.6439721", "0.6438475", "0.6426592", "0.64145124", "0.6408762", "0.63994163", "0.6379944", "0.6367802", "0.63495576", "0.6343348", "0.6341357", "0.63377875", "0.6334586", "0.6313797", "0.6312457", "0.6311729", "0.6308283", "0.6301439", "0.63011986", "0.62798584", "0.6271537", "0.6269755", "0.6264618", "0.62516916", "0.6251018", "0.62178016", "0.62174016", "0.6214928", "0.6213492", "0.6205238", "0.6202079", "0.6193577", "0.61828655", "0.61760664", "0.61525756", "0.6142585", "0.6135257", "0.613487", "0.61298156", "0.61166567", "0.6114034", "0.6101542", "0.608915", "0.6087943", "0.60841537", "0.60831666", "0.6080708", "0.6077555", "0.6077452", "0.6075398", "0.6063707", "0.6048639", "0.604725" ]
0.6595669
35
DB = new DBHelper(this);
public void init(){ elements = new ArrayList<>(); elements.add(new ListElement("Aeshnidae",this)); ListElement element1 = createItem("Baetidae"); elements.add(element1); //elements.add(new ListElement("Aeshnidae", 6, R.drawable.aeshnidaem)); //elements.add(new ListElement("Baetidae", 4, R.drawable.baetidae)); elements.add(new ListElement("Blepharoceridae", 10, R.drawable.blepharoceridae)); elements.add(new ListElement("Calamoceratidae", 10, R.drawable.calamoceridae)); elements.add(new ListElement("Ceratopogonidae", 4, R.drawable.ceratopogonidae)); elements.add(new ListElement("Chironomidae", 2, R.drawable.chironomidae)); elements.add(new ListElement("Coenagrionidae", 6, R.drawable.coenagrionidae)); elements.add(new ListElement("Corydalidae", 6, R.drawable.corydalidae)); elements.add(new ListElement("Culicidae", 2, R.drawable.culicidae)); elements.add(new ListElement("Dolichopodidae", 4, R.drawable.dolichopodidae)); elements.add(new ListElement("Dystiscidae", 3, R.drawable.dytiscidae)); elements.add(new ListElement("Elmidae", 5, R.drawable.elmidae)); elements.add(new ListElement("Elmidae Larvae", 5, R.drawable.elmidae_larvae)); elements.add(new ListElement("Empididae", 8, R.drawable.empididaem)); elements.add(new ListElement("Ephydridae", 8, R.drawable.ephydridaem)); elements.add(new ListElement("Eprilodactylidae", 5, R.drawable.eprilodactylidaem)); elements.add(new ListElement("Gyrinidae", 3, R.drawable.gyrinidae)); elements.add(new ListElement("Helicopsychidae", 10, R.drawable.helicopsychidae)); elements.add(new ListElement("Hidrophilidae", 3, R.drawable.hidrophilidae)); elements.add(new ListElement("Hidropsychidae", 5, R.drawable.hidropsychidae)); elements.add(new ListElement("Hirudinea", 5, R.drawable.hirudineam)); elements.add(new ListElement("Hyalellidae", 6, R.drawable.hyalellidaem)); elements.add(new ListElement("Hydracarina", 4, R.drawable.hydracarinam)); elements.add(new ListElement("Hydrobiosidae", 8, R.drawable.hydrobiosidae)); elements.add(new ListElement("Hydroptilidae", 6, R.drawable.hydroptilidae)); elements.add(new ListElement("Leptoceridae", 8, R.drawable.leptoceridae)); elements.add(new ListElement("Leptohyphidea", 7, R.drawable.leptohyphideam)); elements.add(new ListElement("Leptophlebiidae", 10, R.drawable.leptophlebiidae)); elements.add(new ListElement("Lestidae", 8, R.drawable.lestidaem)); elements.add(new ListElement("Libellulidae", 6, R.drawable.libellulidaem)); elements.add(new ListElement("Lymnaeidae", 3, R.drawable.lymnaeidaem)); elements.add(new ListElement("Muscidae", 2, R.drawable.muscidae)); elements.add(new ListElement("Nematoda", 0, R.drawable.nematodam)); elements.add(new ListElement("Odontoceridae", 10, R.drawable.odontoceridae)); elements.add(new ListElement("Oligochaeta", 1, R.drawable.oligochaetam)); elements.add(new ListElement("Ostrachoda", 3, R.drawable.ostracodam)); elements.add(new ListElement("Perlidae", 10, R.drawable.perlidae)); elements.add(new ListElement("Philopotamidae", 8, R.drawable.philopotamidae)); elements.add(new ListElement("Physidae", 3, R.drawable.physidaem)); elements.add(new ListElement("Planaridae", 5, R.drawable.planaridae)); elements.add(new ListElement("Planorbidae", 3, R.drawable.planorbidaem)); elements.add(new ListElement("Psephenidae", 5, R.drawable.psephenidae)); elements.add(new ListElement("Psychodidae", 3, R.drawable.psychodidae)); elements.add(new ListElement("Scirtidae", 5, R.drawable.scirtidae)); elements.add(new ListElement("Sialidea", 6, R.drawable.sialidaem)); elements.add(new ListElement("Simuliidae", 5, R.drawable.simuliidae)); elements.add(new ListElement("Sphaeriidae", 3, R.drawable.sphaeriidaem)); elements.add(new ListElement("Stratiomidae", 4, R.drawable.stratiomidae)); elements.add(new ListElement("Syrphidae", 1, R.drawable.syrphidaem)); elements.add(new ListElement("Tabanidae", 4, R.drawable.tabanidae)); elements.add(new ListElement("Thiaridae", 3, R.drawable.thiaridaem)); elements.add(new ListElement("Tipulidae", 5, R.drawable.tipulidae)); elements.add(new ListElement("Xiphocentronidae", 8, R.drawable.xiphocentronidaem)); ListAdapter listAdapter = new ListAdapter(elements, this, new ListAdapter.OnItemClickListener() { @Override public void onItemClick(ListElement item) { moveToDescription(item); } }); RecyclerView recyclerView = findViewById(R.id.listRecyclerView); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(listAdapter); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void initDB() {\n dataBaseHelper = new DataBaseHelper(this);\n }", "private void openDatabase() {\r\n SearchHelper = new DBHelper(this);\r\n }", "public DBManager(Context context){ \n\t\thelper = new DBHelper(context); \n\t\tdb = helper.getWritableDatabase(); \n\t}", "private DatabaseAccess(Context context){\n this.openHelper=new DatabaseOpenHelper(context);\n }", "private void initDB() {\n dataBaseHelper = new DataBaseHelper(getActivity());\n }", "private DatabaseAccess(Context context) {\n this.openHelper = new MyDatabase(context);\n }", "public void leerDB(){\n sqlDB = bdHelper.getReadableDatabase();\n\n }", "public static void setDatabase(MySQLiteHelper db){\n database = db;\n }", "public void onCreate() {\n DatabaseHelper mDbHelper = new DatabaseHelper(context);\n }", "private DatabaseAccess(Context context) {\n this.openHelper = new DatabaseOpenHelper(context);\n }", "private static SQLiteOpenHelper getSQLiteOpenHelper(Context context){\n if(InsertDataToDB.dbHelper == null){\n InsertDataToDB.dbHelper = new ValaisStudyDBHelper(context);\n }\n return InsertDataToDB.dbHelper;\n }", "public GastoDAO(Context context){\n dbHelper = new MyDatabaseHelper(context);\n database = dbHelper.getWritableDatabase();\n }", "DatabaseController(Context context){\n helper=new MyHelper(context);\n }", "private DatabaseAccess(Context context) {\n this.openHelper = new RecipesDatabase(context);\n }", "public DataBaseHelper(Context context) {\n \n \tsuper(context, DB_NAME, null, 1);\n this.myContext = context;\n }", "@Override\n public boolean onCreate() {\n myDB = new DBHelperActivity(getContext(), null, null, 1);\n return false;\n }", "public DbHelper(){\n\t\tmongoDbHelper = new MongoDb();\n\t}", "private CustomerDatabaseHelper(Context context){\n _openHelper = new DatabaseOpenHelper(context);\n }", "private void getDatabase(){\n\n }", "SimpleDatabaseHelper(Context context) {\n _openHelper = new SimpleSQLiteOpenHelper(context);\n }", "public DBAdapter(Context ctx) {\n this.context = ctx;\n myDBHelper = new DatabaseHelper(context);\n }", "public DatabaseHelper(Context context) {\n super(context, \"caballoscocheros.db\", null);\n\n db = getWritableDatabase();\n DaoMaster daoMaster = new DaoMaster(db);\n daoSession = daoMaster.newSession();\n }", "public static synchronized DatabaseHelper getInstance (Context context){\n\n if(mHelper == null) {\n mHelper = new DatabaseHelper(context.getApplicationContext());\n }\n return mHelper;\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n\n }", "private void configureDB() {\n\t\tmDb = mDbHelper.getWritableDatabase();\n\t}", "public static DBHelper getDBHelper(Context context) {\n if (dbh == null) {\n dbh = new DBHelper(context.getApplicationContext());\n Log.i(TAG, \"getDBHelper, dbh == null\");\n }\n Log.i(TAG, \"getDBHelper()\");\n return dbh;\n }", "public void onCreate(SQLiteDatabase db) {\n }", "public static DBHelper getDbHelper() {\n return dbHelper;\n }", "public DatabaseHelper getDbHelper() {\n return dbHelper;\n }", "public DBHelper(Context context) {\n super(context, Database_Name, null, 1);\n\n }", "private DBHelper(Context context){\n this.context= context;\n tablesClass = new TablesClass(context, Constants.DATABASE_NAME,null,Constants.DB_VERSION);\n\n }", "@Override\r\n public void onCreate(SQLiteDatabase db) {\r\n\r\n }", "private void initDb() {\n\t\tif (dbHelper == null) {\n\t\t\tdbHelper = new DatabaseOpenHelper(this);\n\t\t}\n\t\tif (dbAccess == null) {\n\t\t\tdbAccess = new DatabaseAccess(dbHelper.getWritableDatabase());\n\t\t}\n\t}", "DatabaseHelper(Context context){\n super(context,BD_BOLSATRABAJO,null,vers);\n }", "public DataBaseHelper(Context context) {\n\n super(context, DB_NAME, null, 1);\n this.myContext = context;\n }", "@Override\r\n public void onCreate(SQLiteDatabase arg0) {\n\r\n }", "public GaelDbHelper( final Context context ){\n\tsuper( context, DATABASE_NAME, null, DATABASE_VERSION );\n\tmContext = context;\n\tlog.trace( \"GaelDbHelper.constructor():\" + DATABASE_NAME );\n}", "public interface DBHelper {\n}", "@Override\n\tpublic void onCreate(SQLiteDatabase db) {\n\t}", "@Override\n\tpublic void onCreate(SQLiteDatabase db) {\n\t}", "@Override\n\tpublic void onCreate(SQLiteDatabase db) {\n\t}", "@Override\r\n\tpublic void onCreate(SQLiteDatabase db) {\n\t}", "public DatabaseAccess(Context context) {\n this.openHelper = new OlpbhtbDatabase(context);\n }", "public static DatabaseHelper getDatabaseHelper()\r\n\t{\r\n\t\treturn databaseHelper;\r\n\t}", "public void close()\n\n {\n DBHelper.close();\n }", "public DBManager(){\r\n connect(DBConstant.driver,DBConstant.connetionstring);\r\n }", "@Override\r\n\t\tpublic void onCreate(SQLiteDatabase db) {\n\r\n\t\t}", "public DataBaseHelper(Context context) {\n\n super(context, DB_NAME, null, 10);\n this.myContext = context;\n this.DB_PATH = \"data/data/\"+context.getPackageName()+\"/databases/\";\n }", "public void close() {\n myDBHelper.close();\n }", "public void close() {\n myDBHelper.close();\n }", "@Override\n public void onCreate(SQLiteDatabase arg0) {\n }", "@Override\n\tpublic void onCreate(SQLiteDatabase db) {\n\t\t\n\t}", "@Override\n\tpublic void onCreate(SQLiteDatabase db) {\n\t\t\n\t}", "@Override\n public void onCreate(SQLiteDatabase sqLiteDatabase) {\n\n }", "@Override\n public void onCreate(SQLiteDatabase sqLiteDatabase) {\n\n }", "public static DbHelper getInstance(){\n\t\treturn _DbHelperHold.INSTANCE;\n\t}", "public void CloseDB() {\n \n }", "SmDatabaseHelper(Context context) {\n super(context, DBNAME, null, 1);\n }", "public synchronized static DatabaseHelper getInstance(Context context) {\n if(DATABASE_HELPER == null) {\n DATABASE_HELPER = new DatabaseHelper(context.getApplicationContext());\n }\n return DATABASE_HELPER;\n }", "@Override\r\n public boolean onCreate(){\n db = new DatabaseHelper(getContext()).getWritableDatabase();\r\n return true;\r\n }", "TaskDbHelper(Context context){\n super(context, DATA_BASE_NAME, null, DATABASE_VERSION);\n }", "private void connectDatabase(){\n }", "public void onOpen(dbHelper helper){\n\n }", "private void initDB(){\n gistHelper = new GistSQLiteHelper(mainActivity, \"GistsDB\", null, 1);\n db = gistHelper.getWritableDatabase();\n }", "@Override\n public void onCreate(SQLiteDatabase sqLiteDatabase) {\n }", "private DBConnection() \n {\n initConnection();\n }", "public ConnectDB(){\r\n\r\n\t}", "public static synchronized DBOpenHelper getInstance(Context context){\n\t\tif(dbHelper == null)\n\t\t\tdbHelper = new DBOpenHelper(context);\t\t\n\t\treturn dbHelper;\n\t\t\n\t}", "public DbHelper(Context context) {\n super(context, DBNAME, null, 1);\n }", "public static synchronized DatabaseHelper getInstance(Context context) { \n\t\t // Use the application context, which will ensure that you \n\t\t // don't accidentally leak an Activity's context.\n\t\t // See this article for more information: http://bit.ly/6LRzfx\n\t\t if (sInstance == null) {\n\t\t sInstance = new DatabaseHelper(context.getApplicationContext());\n\t\t }\n\t\t return sInstance;\n\t\t}", "public void close()\n {\n DBHelper.close();\n }", "public void close()\n {\n DBHelper.close();\n }", "@Override\n public boolean onCreate() {\n myOpenHelper = new MySQLiteOpenHelper(getContext(),\n MySQLiteOpenHelper.DATABASE_NAME, null, \n MySQLiteOpenHelper.DATABASE_VERSION);\n \n return true;\n }", "private DatabaseHandler(){\n createConnection();\n }", "public void close()\r\n {\r\n DBHelper.close();\r\n }", "public DatabaseHelper(Context context) {\n super(context, DATABASE_NAME, null, 1);\n }", "@Override\n\tpublic void onCreate(SQLiteDatabase arg0) {\n\t\t\n\t}", "public DbHelper(Context context) {\n super(context, DATABASE_NAME, null, DATABASE_VERSION);\n mContext = context;\n }", "public DeviceDBHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); }", "public void open() {\n dbHelper = new DatabaseHelper(context);\n sqLiteDatabase = dbHelper.getWritableDatabase();\n }", "@Override\n\tpublic void initDemoDB() {\n\t}", "public UserInfoDatabase(Context context) {\r\n mDatabaseOpenHelper = new DatabaseOpenHelper(context);\r\n }", "Object getDB();", "private void setupDatabase() {\r\n\t\tDatabaseHelperFactory.init(this);\r\n\t\tdatabase = DatabaseHelperFactory.getInstance();\r\n\t}", "public DatabaseHelper(Context context) {\n super(context, DATABASE_NAME, null, DATABASE_VERSION);\n this.context = context;\n res = context.getResources();\n }", "@Override\n public void onCreate(SQLiteDatabase db) {\n }", "public void close() {\n mDbHelper.close();\n }", "public DB() {\r\n\t\r\n\t}", "@Override\npublic Object databaseHelper(Context context) {\n\treturn null;\n}", "public void closeDBHelper() {\n\t\tif (dbHelper != null)\n\t\t\tdbHelper.closeDatabase();\n\t}", "public DataBaseManager(Context context) {\n helper = new DataBaseHelper(context);\n db = helper.getWritableDatabase();\n }", "private DBHelper(Context context) {\n super(context, DB_NAME, null, DB_VERSION);\n }", "public SqlHelper() {\n\t\tloadDbDriver();\n\t}", "@Override\r\n public void onCreate(SQLiteDatabase db)\r\n {\n }" ]
[ "0.7937752", "0.7670031", "0.7630217", "0.7626183", "0.7534554", "0.74374294", "0.73110753", "0.7289072", "0.7243384", "0.72310966", "0.7227017", "0.7216727", "0.71825206", "0.7179911", "0.7120061", "0.70851135", "0.7058478", "0.7014365", "0.6995249", "0.69895715", "0.697759", "0.69775826", "0.69774806", "0.69749963", "0.69749963", "0.69749963", "0.69749963", "0.69749963", "0.69726646", "0.69726646", "0.69726646", "0.69559073", "0.69550663", "0.6923464", "0.6911285", "0.6908691", "0.69068116", "0.68941015", "0.6889948", "0.68857425", "0.68749", "0.68664044", "0.6864167", "0.68583965", "0.6846281", "0.6834867", "0.6834867", "0.6834867", "0.68303466", "0.68227124", "0.6817323", "0.6813167", "0.68092316", "0.67924285", "0.6789563", "0.67781067", "0.67781067", "0.6765284", "0.6763607", "0.6763607", "0.6757221", "0.6757221", "0.67516184", "0.6746117", "0.67409486", "0.67371345", "0.671694", "0.6705916", "0.66898865", "0.6689645", "0.6675473", "0.6651624", "0.6651215", "0.6630949", "0.6629857", "0.66269684", "0.662222", "0.65952134", "0.65952134", "0.6581729", "0.65769094", "0.65743256", "0.65663844", "0.65607333", "0.6556032", "0.6552259", "0.65517044", "0.65489936", "0.654429", "0.6536641", "0.65305686", "0.65225005", "0.65193766", "0.6519263", "0.6517766", "0.6515492", "0.6511149", "0.6510126", "0.6489027", "0.648833", "0.6486282" ]
0.0
-1
sort list by x value
private void sort() { Collections.sort(mEntries, new Comparator<BarEntry>() { @Override public int compare(BarEntry o1, BarEntry o2) { return o1.getX() > o2.getX() ? 1 : o1.getX() < o2.getX() ? -1 : 0; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void sortByX() {\n\t\tCollections.sort(pointList, getXComparator());\n\t}", "public static List<Integer> sort(List<Integer> input) {\n\t\tif (input.size() < 2)\n\t\t\treturn input;\n\n\t\tint pivot = input.get((input.size() - 1) / 2);\n\t\tList<Integer> less = input.stream().filter(x -> x < pivot).collect(Collectors.toList());\n\t\tList<Integer> greater = input.stream().filter(x -> x > pivot).collect(Collectors.toList());\n\t\tList<Integer> all = new ArrayList<>(sort(less));\n\t\tall.add(pivot);\n\t\tall.addAll(sort(greater));\n\t\treturn all;\n\t}", "@Test\n public void testSort() {\n initialize();\n var realList = new HighScoreList();\n realList.setList(list);\n realList.sort();\n\n assertEquals(300, realList.getList().get(0).getScore());\n assertEquals(200, realList.getList().get(1).getScore());\n assertEquals(100, realList.getList().get(2).getScore());\n }", "public SortingAlgorithmResult<E> sort(List<E> l);", "private List<Integer> sort(List<Integer> list) {\n List<Integer> sorted = new ArrayList<Integer>();\n if (list.size() == 0) {\n return list;\n } else {\n List<Integer> l = new ArrayList<Integer>();\n Integer m = list.get(0);\n List<Integer> h = new ArrayList<Integer>();\n \n for(int i : list.subList(1, list.size())) {\n if (i > m)\n h.add(i);\n else\n l.add(i);\n }\n \n sorted.addAll(sort(l));\n sorted.add(m);\n sorted.addAll(sort(h));\n }\n return sorted;\n }", "public static void sort(ArrayList<Number> list) {\r\n\t\t\t\t\tfor (int i = 0; i < list.size(); i++) {\r\n\t\t\t\t\t\tfor (int j = 0; j < list.size(); j++) {\r\n\t\t\t\t\t\t\t// Ako je vrijadnost elementa na idneksu i manja od vrijednosti\r\n\t\t\t\t\t\t\t// elementa na idneksu j, zamijeni im pozicije.\r\n\t\t\t\t\t\t\tif (list.get(i).doubleValue() < list.get(j).doubleValue()) {\r\n\t\t\t\t\t\t\t\t// Cuvamo elemenat sa drugog indeksa u temp varijabli.\r\n\t\t\t\t\t\t\t\tNumber temp = list.get(j);\r\n\t\t\t\t\t\t\t\t// Kopiramo elemenat sa prvog indeksa preko drugog elementa.\r\n\t\t\t\t\t\t\t\tlist.set(j, list.get(i));\r\n\t\t\t\t\t\t\t\t// Kopiramo temp (drugi elemenat) preko prvog elementa.\r\n\t\t\t\t\t\t\t\tlist.set(i, temp);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t}", "public void sort(){\n Collections.sort(list, new SortBySpecies());\n }", "@Override\r\n\tpublic void sort() {\r\n\t\tint minpos;\r\n\t\tfor (int i = 0; i < elements.length-1; i++) {\r\n\t\t\tminpos=AuxMethods.minPos(elements, i);\r\n\t\t\telements=AuxMethods.swapElements(elements, i, minpos);\r\n\t\t\t\r\n\t\t}\r\n\t}", "public static void sort(ArrayList<Integer> list) {\n\t\tint temp;\n\t\tfor (int i=0; i < list.size() ; i++) {\n\t\t\tfor (int j=i+1;j<list.size()-1;j++){\n\t\t\t\tif(list.get(i)>list.get(j)){\n\t\t\t\t\ttemp = list.get(i);\n\t\t\t\t\tlist.set(i,list.get(j));\n\t\t\t\t\tlist.set(j, temp);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static<E extends Comparable<E>> void sort(PositionalList<E> list) {\n Position<E> marker = list.first();\n while (marker!=list.last()){\n Position<E> pivot = list.after(marker);\n E value = pivot.getElement();\n if (value.compareTo(marker.getElement()) > 0) {\n marker = pivot;\n } else {\n Position<E> walk = marker;\n while (walk!=list.first() && list.before(walk).getElement().compareTo(value)<0){\n walk = list.before(walk);\n }\n list.remove(pivot);\n list.addAfter(walk,value);\n }\n }\n }", "public static List<Double> sortScores(List<Double> results) {\n\t\t\n\t\t\n\t\tfor (int i = 0; i < results.size()-1; i++) {\n\t\t\tif (results.get(i)>results.get(i+1)) {\n\t\t\t\t//highScore = results.get(i);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tDouble temp = results.get(i);\n\t\t\t\t\n\t\t\t\tresults.set(i, results.get(i+1));\n\t\t\t\t\n\t\t\tresults.set(i+1, temp);\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\n\t\t\n\t\treturn results;\n\t\t//return null;\n\t}", "public static ArrayList<Member> sortByNumber(ArrayList<Member> s) {\r\n\t\tArrayList<Member> output = new ArrayList<Member>();\r\n\t\twhile(s.size()>0) {\r\n\t\t\tint minNo=0;\r\n\t\t\tString min=s.get(0).getNumber();\r\n\t\t\tfor(int i=0;i<s.size();i++) {\r\n\t\t\t\tif(Member.numberSmaller(s.get(i).getNumber(),min)) {\r\n\t\t\t\t\tmin=s.get(i).getNumber();\r\n\t\t\t\t\tminNo=i;\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t}\r\n\t\t\toutput.add(s.get(minNo));\r\n\t\t\ts.remove(s.get(minNo));\r\n\t\t}\r\n\t\treturn output;\r\n\t}", "private static ArrayList<Integer> sort(ArrayList<Integer> v) {\n\t\tint key, i, j; \n\t\tfor (j = 1; j != v.size(); j++) {\n\t\t\tkey = v.get(j); \n\t\t\ti = j - 1; \n\t\t\twhile ((i >= 0) && (v.get(i) > key)) {\n\t\t\t\tv.set(i+1, v.get(i));\n\t\t\t\ti -= 1; \n\t\t\t}\n\t\t\tv.set(i+1, key); \n\t\t}\n\t\treturn v; \n\t}", "void sort();", "void sort();", "public static void sortX(ArrayList<Point> points) {\n\t\tCollections.sort(points, new Comparator<Point>() {\n\t\t\tpublic int compare(Point p1, Point p2) {\n\t\t\t\tif (p1.getX() < p2.getX())\n\t\t\t\t\treturn -1;\n\t\t\t\tif (p1.getX() > p2.getX())\n\t\t\t\t\treturn 1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t});\n\t}", "private void sort() {\n ScoreComparator comparator = new ScoreComparator();\n Collections.sort(scores, comparator);\n }", "public void SortByPrice() {\n for (int i = 1; i < LastIndex; i++) {\n int x = i;\n while (x >= 1) {\n if (ForChild[x - 1].getPrice() > ForChild[x].getPrice()) {\n Confectionery sweets = ForChild[x - 1];\n ForChild[x - 1] = ForChild[x];\n ForChild[x] = sweets;\n\n }\n x -= 1;\n }\n }\n }", "void sortV();", "@Override\r\n\tpublic List<T> sort(List<T> list) {\n\t\tassert list != null : \"list cannot be null\";\r\n\t\tfor(int i = 0; i < list.size() - 1; i ++){\r\n\t\t\tint min = i;\r\n\t\t\tfor(int j = i + 1; j < list.size(); j ++){\r\n\t\t\t\tint current = j;\r\n\t\t\t\tif(this.comparator.compare(list.get(min), list.get(current)) > 0){\r\n\t\t\t\t\tmin = current;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tswap(list, i, min);\r\n\t\t}\r\n\t\treturn list;\r\n\t}", "public void sort(){\n ListNode t, x, b = new ListNode(null, null);\n while (firstNode != null){\n t = firstNode; firstNode = firstNode.nextNode;\n for (x = b; x.nextNode != null; x = x.nextNode) //b is the first node of the new sorted list\n if (cmp.compare(x.nextNode.data, t.data) > 0) break;\n t.nextNode = x.nextNode; x.nextNode = t;\n if (t.nextNode==null) lastNode = t;\n }\n firstNode = b.nextNode;\n }", "public void shellSort(){\n int increment = list.size() / 2;\n while (increment > 0) {\n for (int i = increment; i < list.size(); i++) {\n int j = i;\n int temp = list.get(i);\n while (j >= increment && list.get(j - increment) > temp) {\n list.set(j, list.get(j - increment));\n j = j - increment;\n }\n list.set(j, temp);\n }\n if (increment == 2) {\n increment = 1;\n } else {\n increment *= (5.0 / 11);\n }\n }\n }", "public static List<Double> sortScores(List<Double> results) {\n\t\tfor (int i = 0; i < results.size(); i++) {\n\t\t\tint index = i;\n\t\t\tfor (int j = i + 1; j < results.size(); j++) {\n\t\t\t\tif (results.get(j) < results.get(index)) {\n\t\t\t\t\tindex = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdouble temp = results.get(index);\n\t\t\tresults.set(index, results.get(i));\n\t\t\tresults.set(i, temp);\n\t\t}\n\t\treturn results;\n\t}", "public static void main(String[] args) {\n sortGeneric list = new sortGeneric();\n list.add(100);\n list.add(7);\n list.add(6);\n list.add(20);\n list.add(1);\n list.add(15);\n System.out.print(\"trc khi sap xep : \");\n for (int i = 0; i < list.size(); i++) {\n System.out.print(list.get(i) + \" \");\n }\n System.out.println();\n list.sort();\n System.out.print(\"sau khi sap xep: \");\n for (int i = 0; i < list.size(); i++) {\n System.out.print(list.get(i) + \" \");\n }\n System.out.println();\n\n\n }", "Comparator<T> sortBy();", "public static void selectionSort2(IntList l) {\n\t\tIntListEntry input = l.getFirst();\n\t\tIntListEntry output = null;\n\t\twhile (input != null) {\n\t\t\tIntListEntry min = input;\n\t\t\tfor (IntListEntry e = input; e != null; e = e.getNext())\n\t\t\t\tif (e.getItem()<min.getItem())\n\t\t\t\t\tmin = e;\n\t\t\tif (min != input) {\n\t\t\t\tl.delete(min);\n\t\t\t\tif (output == null)\n\t\t\t\t\tl.prepend(min);\n\t\t\t\telse\n\t\t\t\t\tl.insertAfter(min,output);\n\t\t\t}\n\t\t\toutput = min;\n\t\t\tinput = min.getNext();\n\t\t}\n\t}", "public static void mySort(ArrayList<Integer> myList)\n {\n\n }", "static <T extends Comparable<T>> List<T> sort(List<T> list) {\n\t\tif (list == null || list.size() < 2) {\n\t\t\treturn list;\n\t\t}\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\t// the current is begin from index of 1\n\t\t\tT current = list.get(i);\n\t\t\tint j = i - 1;\n\t\t\tint origin = j;\n\t\t\twhile (j >= 0 && list.get(j).compareTo(current) > 0) {\n\t\t\t\t// insert into the head of the sorted list\n\t\t\t\t// or as the first element into an empty sorted list\n\t\t\t\t// last element of the sorted list\n\t\t\t\t// middle of the list\n\t\t\t\t// insert into middle of the sorted list or as the last element\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tlist.set(j + 1, current);\n\t\t\tprintInsertionSortAnimation(list, current, j, origin);\n\t\t\tSystem.out.println();\n\t\t}\n\n\t\treturn list;\n\t}", "public ListNode<Integer> partitionListAroundX(ListNode<Integer> head, int x){\r\n\t\t\r\n\t\tListNode<Integer> newHead = head;\r\n\t\tListNode<Integer> tail = head;\r\n\t\tListNode<Integer> p = head;\r\n\t\t\r\n\t\twhile(p != null){\r\n\t ListNode<Integer> next = p.next;\t\r\n\t if(p.data < x){\r\n\t \t //insert before head\r\n\t \t p.next = head;\r\n\t \t head = p;\r\n\t } else {\r\n\t \t //insert after tail\r\n\t \t tail.next = p;\r\n\t \t tail = p;\r\n\t }\r\n\t p = next;\r\n\t\t}\r\n\t\t\r\n\t\ttail.next = null;\r\n\t\t\r\n\t\treturn newHead;\r\n\t}", "private static void sortByVerified( ArrayList<Volunteer> list)\n {\n // Find the string reference that should go in each cell of\n // the array, from cell 0 to the end\n for ( int j = 0; j < list.size();j++ )\n {\n // Find min: the index of the string reference that should go into cell j.\n // Look through the unsorted strings (those at j or higher) for the one that is first in lexicographic order\n int min = j;\n for ( int k=j+1; k < list.size(); k++ ) {\n if (list.get(k).compareTo(list.get(min)) > 0) {\n min = k;\n }\n\n }\n\n // Swap the reference at j with the reference at min\n Collections.swap(list, j, min);\n }\n }", "private static void sort(long[] list) {\n\t\tint start = 0, limit = list.length;\n\t\t\n\t\tlong temp;\n\t\tint current;\n\t\tint lowestindex;\n\n\t\twhile (start < limit) {\n\t\t\tlowestindex = start;\n\t\t\tfor (current = start; current < limit; current++)\n\t\t\t\tif (list[current] < list[lowestindex])\n\t\t\t\t\tlowestindex = current;\n\t\t\t//swap\n\t\t\ttemp = list[start];\n\t\t\tlist[start] = list[lowestindex];\n\t\t\tlist[lowestindex] = temp;\n\t\t\tstart++;\n\t\t}\n\t}", "private void sortResults(){\r\n this.sortedPlayers = new ArrayList<>();\r\n int size = players.size();\r\n while (size > 0) {\r\n Player lowestPointsPlayer = this.players.get(0);\r\n for(int i = 0; i<this.players.size(); i++){\r\n if(lowestPointsPlayer.getPoints() <= this.players.get(i).getPoints()){\r\n lowestPointsPlayer = this.players.get(i);\r\n }\r\n }\r\n this.sortedPlayers.add(lowestPointsPlayer);\r\n this.players.remove(lowestPointsPlayer);\r\n size--;\r\n }\r\n\r\n\r\n }", "public static void sortitems(ArrayList<item> svd)\r\n{\n\r\n\tCollections.sort(svd, new Comparator<item>(){\r\n\t\tpublic int compare(item o1, item o2){\r\n\t\t\t\tif(o1.density == o2.density)\r\n\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\t\t\t\treturn o1.density > o2.density ? -1 : 1;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\r\n\r\n}", "public void sort() {\n ListNode start = head;\n ListNode position1;\n ListNode position2;\n\n // Going through each element of the array from the second element to the end\n while (start.next != null) {\n start = start.next;\n position1 = start;\n position2 = position1.previous;\n // Checks if previous is null and keeps swapping elements backwards till there\n // is an element that is bigger than the original element\n while (position2 != null && (position1.data < position2.data)) {\n swap(position1, position2);\n numberComparisons++;\n position1 = position2;\n position2 = position1.previous;\n }\n }\n }", "private static LinkedList<Integer> sortIntList(LinkedList<Integer> list)\n\t{\n\t\t// Sort LinkedList\n\t\tCollections.sort(list, new Comparator<Integer>()\n\t\t{\n\t\t\t @Override\n\t\t\t public int compare(Integer int1, Integer int2)\n\t\t\t {\n\t\t\t if(int1 < int2){\n\t\t\t return -1; \n\t\t\t }\n\t\t\t if(int1 > int2){\n\t\t\t return 1; \n\t\t\t }\n\t\t\t return 0;\n\t\t\t }\n\t\t});\n\t\treturn list;\n\t}", "public void sort(List<Integer> listToSort){\n\t\t\n\t\t//loop through all list value\n\t\tfor (int i = 0; i < listToSort.size() - 1; i++) {\n\t\t\tint index = i;//store value position to be swapped if required\n\t\t\t\n\t\t\t//loop through all list values looking for one that is lower than that of position index\n\t\t\tfor (int j = i + 1; j < listToSort.size(); j++) {\n\t\t\t\tif (listToSort.get(j) < listToSort.get(index)) {\n\t\t\t\t\tindex = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//swap values at position index and i if required\n\t\t\tif (index != i) {\n\t\t\t\tint temp = listToSort.get(index); \n\t\t\t\tlistToSort.set(index, listToSort.get(i));\n\t\t\t\tlistToSort.set(i, temp);\t\t\t\n\t\t\t}\n\t\t}\n\t}", "public void fletteSort(ArrayList<Integer> list) {\n\t\tmergesort(list, 0, list.size() - 1);\n\t}", "public static void main(String[] args) {\n ArrayList<Integer> mainList = new ArrayList<Integer>();\n mainList.add(5);\n mainList.add(2);\n mainList.add(10);\n mainList.add(14);\n mainList.add(3);\n mainList.add(6);\n mainList.add(9);\n boolean asc = false;\n System.out.println(listSort(mainList, asc));\n }", "@Override\n public <T extends Comparable<? super T>> List<T> sort(List<T> list){\n return pool.invoke(new ForkJoinSorter<T>(list));\n }", "private static void sortList(ArrayList<ArrayList<Integer>> list){\n for (int i = 0; i < list.size(); i++) {\n for (int j = list.size() - 1; j > i; j--) {\n if ( (getCustomerArrivalTime(list.get(i)) == getCustomerArrivalTime(list.get(j)) && getCustomerIndex(list.get(i)) > getCustomerIndex(list.get(j)))\n || getCustomerArrivalTime(list.get(i)) > getCustomerArrivalTime(list.get(j))) {\n\n ArrayList<Integer> tmp = list.get(i);\n list.set(i,list.get(j)) ;\n list.set(j,tmp);\n }\n }\n }\n }", "public static ArrayList<Process> sortList(ArrayList<Process> in, Process p) {\n\tProcess o1=in.get(0);\n\tint index=0;\n\tfor(int i=1; i<in.size();i++) {\n\t\tif(in.get(i).getCycleTracker()>p.getCycleTracker()) {\n\t\t\tindex=i;\n\t\t}\n\t\telse if(in.get(i).getCycleTracker()<p.getCycleTracker()) {\n\t\t\t//o1=in.get\n\t\t}\n\t\telse if(in.get(i).getCycleTracker()==p.getCycleTracker()){\n\t\t\tif(in.get(i).getA()> p.getA()) {\n\t\t\t\tindex=i;\n\t\t\t}\n\t\t\telse if(in.get(i).getA()==p.getA()) {\n\t\t\t\tif(in.get(i).getID()>p.getID()) {\n\t\t\t\t\tindex=i;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tin.add(index, p);\n\t\t\n\t\treturn in;\n\t\n}", "public static IntList selectionSort1(IntList input) {\n\t\tIntList output = new SimpleIntList();\n\t\twhile (!input.isEmpty()) {\n\t\t\tIntListEntry min = input.getFirst();\n\t\t\tfor (IntListEntry e = input.getFirst(); e != null; e = e.getNext())\n\t\t\t\tif (e.getItem()<min.getItem())\n\t\t\t\t\tmin = e;\n\t\t\tinput.delete(min);\n\t\t\toutput.append(min);\n\t\t}\n\t\treturn output;\n\t}", "Listof<V> sortedVals();", "public LinkedList<PostingsList> sortByIncreasingFrequency(LinkedList<PostingsList> l){\n Collections.sort(l, new Comparator<PostingsList>(){\n @Override\n public int compare(PostingsList p1, PostingsList p2){\n if(p1.size() < p2.size()){\n return -1;\n }\n if(p1.size() > p2.size()){\n return 1;\n }\n return 0;\n }\n });\n return l;\n }", "@Override\n\t\tpublic int compareTo(X o) {\n\t\t\treturn o.number - this.number; // 내림차순\n\t\t}", "public void sort() {\r\n int k = start;\r\n for (int i = 0; i < size - 1; i++) {\r\n int p = (k + 1) % cir.length;\r\n for (int j = i + 1; j < size; j++) {\r\n if ((int) cir[p] < (int) cir[k % cir.length]) {\r\n Object temp = cir[k];\r\n cir[k] = cir[p];\r\n cir[p] = temp;\r\n }\r\n p = (p + 1) % cir.length;\r\n }\r\n k = (k + 1) % cir.length;\r\n }\r\n }", "public void sort() {\n\t\tfor (int i = 1; i < this.dataModel.getLength(); i++) {\n\t\t\tfinal int x = this.dataModel.get(i);\n\n\t\t\t// Find location to insert using binary search\n\t\t\tfinal int j = Math.abs(this.dataModel.binarySearch(0, i, x) + 1);\n\n\t\t\t// Shifting array to one location right\n\t\t\tthis.dataModel.arrayCopy(j, j + 1, i - j);\n\n\t\t\t// Placing element at its correct location\n\t\t\tthis.dataModel.set(j, x);\n\t\t\tthis.repaint(this.count++);\n\t\t}\n\t}", "public void sortList() {\n Node3 current = front, index = null;\n student temp;\n\n if(front == null) {\n return;\n }\n else {\n while(current != null) {\n //Node index will point to node next to current\n index = current.getNext();\n\n while(index != null) {\n //If current node's data is greater than index's node data, swap the data between them\n if(current.getData().getRoll()> index.getData().getRoll()) {\n temp = current.getData();\n current.setData(index.getData());\n index.setData(temp);\n }\n index = index.getNext();\n }\n current = current.getNext();\n }\n }\n }", "protected void sort() {\n\n\t\tCollections.sort(this.myRRList);\n\t}", "public void sortGivenArray_popularity() { \n int i, j, k; \n for(i = movieList.size()/2; i > 0; i /= 2) {\n for(j = i; j < movieList.size(); j++) {\n Movie key = movieList.get(j);\n for(k = j; k >= i; k -= i) {\n if(key.rents > movieList.get(k-i).rents) {\n movieList.set(k, movieList.get(k-i));\n } else {\n break; \n }\n }\n movieList.set(k, key);\n }\n } \n }", "private void sortRating()\n {\n for(int i = 0; i < movieList.size(); i++){\n for(int j = 1; j < movieList.size() - i; j++)\n {\n Movie a = movieList.get(j-1);\n Movie b = movieList.get(j);\n int result = a.getRating().compareTo(b.getRating());\n if(result < 0)\n {\n movieList.set(j-1, b);\n movieList.set(j, a);\n }\n else if(result == 0)\n {\n result = a.getTitle().compareTo(b.getTitle());\n if(result > 0)\n {\n movieList.set(j-1, b);\n movieList.set(j, a);\n }\n }\n }\n }\n }", "public static void sortComparable ( Comparable[] x, int n ) {\r\n\t\t//int n=x.length;\r\n\t\tComparable target;\r\n\t\tint i,j;\r\n\t\tfor(i=1;i<n;i++){\r\n\t\t\tj=i;\r\n\t\t\ttarget=x[i];\r\n\t\t\twhile(j>0&&target.compareTo(x[j-1])==-1){\r\n\t\t\t\tx[j]=x[j-1];\r\n\t\t\t\tj--;\r\n\t\t\t}\r\n\t\t\tx[j]=target;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n\tprivate static ArrayList<Result> sortByScore(ArrayList<Result> sortThis){\n\t\tArrayList<Result> sorted = sortThis;\n\t\tCollections.sort(sorted, new Comparator(){\n\t\t\t\n\t\t\tpublic int compare(Object o1, Object o2){\n\t\t\t\tResult r1 = (Result) o1;\n\t\t\t\tResult r2 = (Result) o2;\n\n\t\t\t\tDouble Score1 = new Double(r1.getScore());\n\t\t\t\tDouble Score2 = new Double(r2.getScore());\n\t\t\t\treturn Score1.compareTo(Score2);\n\t\t\t}\n\t\t});\n\t\tCollections.reverse(sorted);\n\t\t\n\t\treturn sorted;\n\t}", "public void selectionSort(ArrayList <Comparable> list){\r\n\t\tsteps += 2;\r\n\t\tfor (int i = list.size() - 1; i >= 0; i--){\r\n\t\t\tsteps ++;\r\n\t\t\tint biggest = 0; \r\n\t\t\tsteps += 2;\r\n\t\t\tfor (int j = 0; j < i; j++){\r\n\t\t\t\tsteps += 4;\r\n\t\t\t\tif (list.get(j).compareTo(list.get(biggest)) > 0){\r\n\t\t\t\t\tsteps ++;\r\n\t\t\t\t\tbiggest = j;\r\n\t\t\t\t}\r\n\t\t\t\tsteps += 2;\r\n\t\t\t}\r\n\t\t\tsteps += 5;\r\n\t\t\tswap(list, i, biggest);\r\n\t\t\tsteps += 2;\r\n\t\t}\r\n\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println(\"Selection Sort\");\r\n\t\tSystem.out.println();\r\n\t}", "public static List<Integer> sortNumbers(List<Integer> unsortedList) {\n\n // naive sort\n if (unsortedList == null || unsortedList.size() <= 1) {\n return unsortedList;\n }\n\n int pivot = unsortedList.get(0);\n List<Integer> lessThanPivot = new ArrayList<>();\n List<Integer> greaterThanPivot = new ArrayList<>();\n\n unsortedList.subList(1, unsortedList.size()).forEach(number -> {\n if (number <= pivot) {\n lessThanPivot.add(number);\n } else {\n greaterThanPivot.add(number);\n }\n });\n\n System.out.printf(\"%15s %1s %-15s%n\", lessThanPivot, pivot, greaterThanPivot);\n\n List<Integer> sortedNumbers = new ArrayList<>(sortNumbers(lessThanPivot));\n sortedNumbers.add(pivot);\n sortedNumbers.addAll(sortNumbers(greaterThanPivot));\n return sortedNumbers;\n }", "public void sort(){\n listOperation.sort(Comparator.comparingInt(Operation::getiStartTime));\n }", "public void sortByGiftCardAmounts(ArrayList sortedList) {\r\n Collections.sort(sortedList, GIFT_CARD_AMOUNT_COMPARATOR);\r\n }", "private static ArrayList<Quest> sortAfterTimestamp(ArrayList<Quest> questListToSort) {\n\t\tfor (int i = 0; i < questListToSort.size() - 1; i++) {\n\t\t\tint index = i;\n\t\t\tfor (int j = i + 1; j < questListToSort.size(); j++) {\n\t\t\t\tif (questListToSort.get(j).getTimestamp() > questListToSort.get(index).getTimestamp()) {\n\t\t\t\t\tindex = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tCollections.swap(questListToSort, index, i);\n\t\t}\n\t\treturn questListToSort;\n\t}", "@Override\n\t\t\tpublic int compare(List<Integer> o1, List<Integer> o2) {\n\t\t\t\tif(o1.get(0)< o2.get(0)){\n\t\t\t\t\treturn -1;\n\t\t\t\t}else if(o1.get(0) > o2.get(0)){\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}", "public static void sort(java.util.List arg0)\n { return; }", "private List<Article> orderArticles(List<Article> things){\n\t\t Comparator<Article> comparatorPrizes = new Comparator<Article>() {\n\t public int compare(Article x, Article y) {\n\t return (int) (x.getPrize() - y.getPrize());\n\t }\n\t };\n\t Collections.sort(things,comparatorPrizes); \n\t Collections.reverse(things);\n\t return things;\n\t }", "private void sortByWeight()\n\t{\n\t\tfor(int i=1; i<circles.size(); i++)\n\t\t{\n\t\t\tPVCircle temp = circles.get(i);\n\t\t\tint thisWeight = circles.get(i).getWeight();\n\t\t\tint j;\n\t\t\tfor(j=i-1; j>=0; j--)\n\t\t\t{\n\t\t\t\tint compWeight = circles.get(j).getWeight();\n\t\t\t\tif(thisWeight < compWeight)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t\tcircles.set(j+1, circles.get(j));\n\t\t\t}\n\t\t\tcircles.set(j+1, temp);\n\t\t}\n\t\t\n\t}", "public static void selectionSort(double[] list) {\r\n for (int i = 0; i < list.length - 1; i++) {\r\n // Find the minimum in the list[i..list.length-1]\r\n \t\tint min_index = i;\r\n \t\tfor(int k = i+1; k < list.length; k++) {\r\n \t\t if(list[k] < list[min_index]) {\r\n \t\t min_index = k;\r\n }\r\n }\r\n\r\n // Swap list[i] with list[currentMinIndex] if necessary;\r\n \t\tdouble temp = list[i];\r\n \t\tlist[i] = list[min_index];\r\n \t\tlist[min_index] = temp;\r\n }\r\n }", "private void sortEntities(){\n for (int i = 1; i < sorted.size; i++) {\n for(int j = i ; j > 0 ; j--){\n \tEntity e1 = sorted.get(j);\n \tEntity e2 = sorted.get(j-1);\n if(getRL(e1) < getRL(e2)){\n sorted.set(j, e2);\n sorted.set(j-1, e1);\n }\n }\n }\n }", "public void selectionSort()\r\n {\r\n for(int x = 0; x < numItems; x++)\r\n {\r\n int smallestLoc = x;\r\n for(int y = x+1; y<numItems; y++)\r\n {\r\n if(mArray[y]< mArray[smallestLoc])\r\n {\r\n smallestLoc = y;\r\n }\r\n }\r\n int temp = mArray[x];\r\n mArray[x] = mArray[smallestLoc];\r\n mArray[smallestLoc] = temp;\r\n }\r\n }", "public void sort() {\n }", "public ListNode partition(ListNode head, int x) {\n ListNode before_head = new ListNode(0);\n ListNode before = before_head;\n ListNode after_head = new ListNode(0);\n ListNode after = after_head;\n\n while (head != null) {\n\n // If the original list node is lesser than the given x,\n // assign it to the before list.\n if (head.val < x) {\n before.next = head;\n before = before.next;\n } else {\n // If the original list node is greater or equal to the given x,\n // assign it to the after list.\n after.next = head;\n after = after.next;\n }\n\n // move ahead in the original list\n head = head.next;\n }\n\n // Last node of \"after\" list would also be ending node of the reformed list\n after.next = null;\n\n // Once all the nodes are correctly assigned to the two lists,\n // combine them to form a single list which would be returned.\n before.next = after_head.next;\n\n return before_head.next;\n }", "public static void minWithSort(List<Integer> list){\n Optional<Integer> max = list.stream().sorted().reduce((x, y)->x);\n System.out.println(max);\n }", "public void sortIncreasing()\n {\n int min;\n \n for (int i = 0; i < list.length - 1; i++)\n {\n min = i; \n for(int j = i+1; j < list.length; j++)\n {\n if(list[j] < list[min])\n min = j; \n }\n if(i != min && list[min] < list.length)\n {\n int temp = list[min];\n list[min] = list[i];\n list[i] = temp; \n }\n }\n }", "@Override\n\tpublic void sortList(ArrayList<Integer> list) {\n\t\tint largestNumber = 0;\n\t\tint index = 0;\n\t\t\n\t\tArrayList<ArrayList<Integer>> storageUnit = new ArrayList<ArrayList<Integer>>();\n\t\tArrayList<Integer> sortedList = new ArrayList<Integer>(list.size());\n\t\t\n\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\tsortedList.add(list.get(i));\n\t\t}\n\t\tfor(int i = 0; i < 10; i++){\n\t\t\tstorageUnit.add(new ArrayList<Integer>());\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\tif(list.get(i) > largestNumber){\n\t\t\t\tlargestNumber = list.get(i);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tfor(int i = 0; largestNumber != 0; largestNumber = largestNumber/10, i++){\n\t\t\tfor(int j = 0; j < sortedList.size(); j++){\n\t\t\t\tint key = (int) (sortedList.get(j)/Math.pow(10, i))%10;\n\t\t\t\tstorageUnit.get(key).add(sortedList.get(j));\n\t\t\t}\n\t\t\t\n\t\t\tfor(int k = 0; k < storageUnit.size(); k++){\n\t\t\t\tfor(int l = 0; l < storageUnit.get(k).size(); l++){\n\t\t\t\t\tsortedList.set(index, storageUnit.get(k).get(l));\n\t\t\t\t\tindex++;\n\t\t\t\t}\n\t\t\t\tstorageUnit.get(k).clear();\n\t\t\t}\n\t\t\tindex = 0;\n\t\t}\n\t\tCollections.copy(list, sortedList);\n\t}", "private List<Score> order(List<Score> s)\n {\n Collections.sort(s, new Comparator<Score>()\n {\n\n @Override\n public int compare(Score o1, Score o2) {\n // TODO Auto-generated method stub\n\n return o1.getSentId() - o2.getSentId();\n }\n });\n return s;\n }", "public static void selectionSort(double [] list1)\r\n\t{\r\n\t\tdouble temp= 0.0;\r\n\t\tint smallest=0;\r\n\t\r\n\t\tfor(int outside=0; outside<list1.length; outside++)\r\n\t\t{\r\n\t\t\t//System.out.println(\"Outside: \" + outside);\r\n\t\t\tsmallest=outside;\r\n\t\t\tfor(int inside=1+outside; inside<list1.length; inside++)\r\n\t\t\t{\r\n\t\t\t\tif(list1[inside]<list1[smallest])\r\n\t\t\t\t{\r\n\t\t\t\t\tsmallest = inside;\t\t\r\n\t\t\t\t\t//System.out.println(smallest);\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ttemp=list1[smallest];\r\n\t\t\tlist1[smallest]=list1[outside];\r\n\t\t\tlist1[outside]=temp;\r\n\t\t}\r\n\t}", "private static void SortHash(HashMap<String,ArrayList<input>> hashMap,Distribution list)\n\t{\n\t\tCollections.sort(list.First, new Comparator<input>() {\n\t\t public int compare(input one, input other) {\n\t\t \tif(one.sum>other.sum)\n\t\t \t{\n\t\t \t\treturn 1;\n\t\t \t}\n\t\t \telse\n\t\t \t{\n\t\t \t\treturn -1;\n\t\t \t}\n\t\t }\n\t\t}); \n\t\tCollections.sort(list.Second, new Comparator<input>() {\n\t\t public int compare(input one, input other) {\n\t\t \tif(one.sum>other.sum)\n\t\t \t{\n\t\t \t\treturn 1;\n\t\t \t}\n\t\t \telse\n\t\t \t{\n\t\t \t\treturn -1;\n\t\t \t}\n\t\t }\n\t\t}); \n\t\tCollections.sort(list.Third, new Comparator<input>() {\n\t\t public int compare(input one, input other) {\n\t\t \tif(one.sum>other.sum)\n\t\t \t{\n\t\t \t\treturn 1;\n\t\t \t}\n\t\t \telse\n\t\t \t{\n\t\t \t\treturn -1;\n\t\t \t}\n\t\t }\n\t\t}); \n\t\tCollections.sort(list.Fourth, new Comparator<input>() {\n\t\t public int compare(input one, input other) {\n\t\t \tif(one.sum>other.sum)\n\t\t \t{\n\t\t \t\treturn 1;\n\t\t \t}\n\t\t \telse\n\t\t \t{\n\t\t \t\treturn -1;\n\t\t \t}\n\t\t }\n\t\t}); \n\t\tCollections.sort(list.Fifth, new Comparator<input>() {\n\t\t public int compare(input one, input other) {\n\t\t \tif(one.sum>other.sum)\n\t\t \t{\n\t\t \t\treturn 1;\n\t\t \t}\n\t\t \telse\n\t\t \t{\n\t\t \t\treturn -1;\n\t\t \t}\n\t\t }\n\t\t}); \n\t\tCollections.reverse(list.First);\n\t\tCollections.reverse(list.Second);\n\t\tCollections.reverse(list.Third);\n\t\tCollections.reverse(list.Fourth);\n\t\tCollections.reverse(list.Fifth);\n\t\tputInHashMap(hashMap,list);\n\t}", "public List<GameStateChild> orderChildrenWithHeuristics(List<GameStateChild> children)\n {\n \tList<Double> childUtils = new ArrayList<Double>();\n \tList<Double> tempUtils = new ArrayList<Double>();\n \tList<GameStateChild> tempChildren = new ArrayList<GameStateChild>();\n \t\n \tdouble tempUtil;\n \tint tempIndex = 0;\n \tint priority = 1;\n \t\n \tfor(int i = 0; i < children.size(); i++) {\n \t\tGameStateChild child = children.get(i);\n \t\tSet<MapLocation> myUnitLocations = new HashSet<MapLocation>();\n \t\tchildUtils.add(i, child.state.getUtility());\n \t}\n \t\n \ttempUtils = childUtils;\n \tCollections.sort(childUtils);\n \t\n \tfor(int j = 0; j < children.size(); j++) {\n \t\t\n \t\t//Utility value to be found in unsorted array\n \t\ttempUtil = childUtils.get(j);\n \t\t\n \t\tfor(int k = 0; k < children.size(); k++) {\n \t\t\t\n \t\t\t//If the utility value is the same as this value in the unsorted array, store the index\n \t\t\tif(tempUtil == tempUtils.get(k))\n \t\t\t\ttempIndex = k;\n \t\t}\n \t\t\n \t\t//Add the child to the correct position in a temporary list\n \t\ttempChildren.add(j, children.get(tempIndex));\n \t} \t\n return tempChildren;\n }", "public void fastLexSort(List<TSPSolution> list ){\r\n\t\tlist.sort(new Comparator<TSPSolution>(){\r\n\t\t\tpublic int compare(TSPSolution o1, TSPSolution o2){\r\n\t\t\t\tint num11 = o1.gridIndex[0];\r\n\t\t\t\tint num12 = o1.gridIndex[1];\r\n\t\t\t\tint num21 = o2.gridIndex[0];\r\n\t\t\t\tint num22 = o2.gridIndex[1];\r\n\t\t\t\tif (num11*1000+num12 > num21*1000+num22){\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}else if(num11*1000+num12 < num21*1000+num22){\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t}\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@Override\n public void sort(List<T> items) {\n }", "public void sortCompetitors(){\n\t\t}", "private static void sortSlidesByNumberTags() {\n\t\tCollections.sort(slideList, new Comparator<Slide>() {\n\t\t\tpublic int compare(Slide s1, Slide s2) {\n\n\t\t\t\tInteger sS1 = s1.getTagList().size();\n\t\t\t\tInteger sS2 = s2.getTagList().size();\n\n\t\t\t\tint sComp = sS1.compareTo(sS2);\n\n\t\t\t\treturn -1 * sComp;\n\t\t\t}\n\t\t});\n\t}", "Vector<NewsArticle> insertionSort(Vector<NewsArticle> articles) {\n int i, j;\n int size = articles.size();\n NewsArticle sortedList[] = new NewsArticle[articles.size()];\n\n articles.copyInto(sortedList);\n NewsArticle temp;\n\n for (i = 1; i < size; i++) {\n temp = sortedList[i];\n\n j = i;\n while ((j > 0) && (sortedList[j - 1].getScore(filterType) < temp.getScore(filterType))) {\n sortedList[j] = sortedList[j - 1];\n j = j - 1;\n }\n sortedList[j] = temp;\n }\n Vector<NewsArticle> outList = new Vector<NewsArticle>();\n\n for (i = 0; i < size; i++) {\n temp = sortedList[i];\n outList.addElement(temp);\n }\n return outList;\n }", "public void sort() {\r\n Collections.sort(this.list, this);\r\n }", "private ArrayList<IPlayer> sortPlayerAfterPoints() {\n ArrayList<IPlayer> arrlist = new ArrayList<>();\n\n iPlayerList.entrySet().stream().map((pair) -> (IPlayer) pair.getValue()).forEachOrdered((ip) -> {\n arrlist.add(ip);\n });\n\n Collections.sort(arrlist, (IPlayer p1, IPlayer p2) -> {\n try {\n if (p1.getPoints() == p2.getPoints()) {\n return 0;\n } else if (p1.getPoints() > p2.getPoints()) {\n return -1;\n } else {\n return 1;\n }\n } catch (RemoteException e) {\n e.printStackTrace();\n }\n return 0;\n });\n\n return arrlist;\n }", "public static void insertionSort2(IntList l) {\n\t\tIntListEntry input = l.getFirst();\n\t\tl1:\twhile (input != null) {\n\t\t\tfor (IntListEntry e = l.getFirst(); e != input; e = e.getNext())\n\t\t\t\tif (e.getItem() > input.getItem()) {\n\t\t\t\t\tIntListEntry next = input.getNext();\n\t\t\t\t\tl.delete(input);\n\t\t\t\t\tl.insertBefore(input, e);\n\t\t\t\t\tinput = next;\n\t\t\t\t\tcontinue l1;\n\t\t\t\t}\n\t\t\tinput = input.getNext();\n\t\t}\n\t}", "public void sort(LinkedList<FlightDetails> myList) {\r\n Collections.sort(myList, new Comparator<FlightDetails>() {\r\n public int compare(FlightDetails f1, FlightDetails f2) {\r\n int fare = (int) (f1.getFare() - f2.getFare());\r\n\r\n\r\n\r\n if (fare == 0) {\r\n return Double.compare(f1.getDuration(), f2.getDuration());\r\n } else {\r\n return fare;\r\n }\r\n }\r\n });\r\n }", "public void sortManlist(){\r\n\t\tCollections.sort(Manlist, new MySort());\r\n\t}", "public void selectionSort(int[] x)\n {\n for (int i = 0; i < x.length-1; i++) {\n int minIndex = i;\n for (int j = i+1; j < x.length; j++) {\n if (x[minIndex] > x[j]) {\n minIndex = j;\n }\n }\n int temp = x[i];\n x[i] = x[minIndex];\n x[minIndex] = temp;\n }\n \n public void replaceFirst(int oldVal, int newVal)\n {\n \n }\n}", "public String doSort();", "public void sort()\n\t{\n\t\tfor(int i=0;i<bowlers.size()-1;i++)\n\t\t{\n\t\t\tfor(int j=i+1;j<bowlers.size();j++)\n\t\t\t{\n\t\t\t\tif(bowlers.get(i).getBall()<bowlers.get(j).getBall())\n\t\t\t\t{\n\t\t\t\t\tBowler bowler=bowlers.get(i);\n\t\t\t\t\tbowlers.set(i,bowlers.get(j));\n\t\t\t\t\tbowlers.set(j,bowler);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<bowlers.size();i++)\n\t\t{\n\t\tSystem.out.println(bowlers.get(i).getBall());\n\t\t}\n\t}", "public static ArrayList<IVertex> getSortedList (ArrayList<IVertex> list, int factor) {\n Comparator<IVertex> comparator;\n if(factor == 0) // trier la liste des sommets par celui qui a le plus grand nombre de sommets adjacents rouge\n comparator = Comparator.comparing(IVertex::getNumberRedAdjacents);\n else if(factor == 1) // trier la liste des sommets par celui qui a transforme le plus grand nombre de sommet rouge en bleu\n comparator = Comparator.comparing(IVertex::numberOfRedToBlue);\n else\n comparator = Comparator.comparing(IVertex::getNumberOfBlueEdge); // trier la liste des sommets par celui qui transforme le plus grand nombre de sommet rouge en bleu et le moins de sommet bleu en rouge\n\n list.sort(comparator.reversed());\n return list;\n }", "public ListNode partition(ListNode head, int x) {\n if (null == head || null == head.next) {\n return head;\n }\n ListNode smallHead = new ListNode(0);\n ListNode small = smallHead;\n ListNode bigHead = new ListNode(0);\n ListNode big = bigHead;\n\n ListNode cur = head;\n while (cur != null) {\n if (cur.val >= x) {\n big.next = cur;\n big = cur;\n } else {\n small.next = cur;\n small = cur;\n }\n cur = cur.next;\n }\n small.next = bigHead.next;\n big.next = cur;\n return smallHead.next;\n }", "public static void sortitems(ArrayList<item> svd)\n\t{\n\t\tCollections.sort(svd, new Comparator<item>(){\n\t\t public int compare(item o1, item o2){\n\t\t if(o1.density == o2.density)\n\t\t return 0;\n\t\t return o1.density > o2.density ? -1 : 1;\n\t\t }\n\t\t});\n\t\t\n\t\t\n\t}", "public void sortElements(Comparator<TLProperty> comparator);", "public void step3(){\n\n Collections.sort(names,(String a, String b) -> a.compareTo(b));\n }", "private static <T extends Comparable<T>> void sort(T[] list, int lo, int hi) {\n\t\tif (hi - lo <= 0) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tint splitPoint = splitList(list, lo, hi);\r\n\t\tSystem.out.println(\"splitPoint: \" + splitPoint);\r\n\t\tsort(list, lo, splitPoint - 1);\r\n\t\tsort(list, splitPoint + 1, hi);\r\n\t}", "public static <T extends Comparable<? super T>> void selectionSort(List<T> list){\n int size = list.size();\n if(size > 1){\n for(int i = 0; i < size; i++){\n int lowestIndex = i;\n for(int j = i; j < size; j++){\n if(list.get(lowestIndex).compareTo(list.get(j)) > 0){\n lowestIndex = j;\n }\n }\n if(lowestIndex != i){\n swap(list, i, lowestIndex);\n }\n }\n }\n }", "public ListNode<Integer> partitionListSpaceOptimised(ListNode<Integer> head , int x){\r\n\t\t\r\n\t\tListNode<Integer> head1 = null; // for elements lower than x;\r\n\t\tListNode<Integer> tail1 = null;\r\n\t\tListNode<Integer> head2 = null; // for elements greater than or equal to x;\r\n\t\tListNode<Integer> tail2 = null;\r\n\t\tListNode<Integer> p = head;\r\n\t\t\r\n\t\twhile( p != null ){\r\n\t\t\tListNode<Integer> next = p.next;\r\n\t\t\tp.next = null;\r\n\t\t\tif(p.data < x){\r\n\t\t\t\tif(head1 == null){\r\n\t\t\t\t\thead1 = p;\r\n\t\t\t\t\ttail1 = head1;\r\n\t\t\t\t} else{\r\n\t\t\t\t\ttail1.next = p;\r\n\t\t\t\t\ttail1 = tail1.next;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif(head2 == null){\r\n\t\t\t\t\thead2 = p;\r\n\t\t\t\t\ttail2 = head2;\r\n\t\t\t\t} else{\r\n\t\t\t\t\ttail2.next = p;\r\n\t\t\t\t\ttail2 = tail2.next;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tp = next;\r\n\t\t}\r\n\t\tif(head1 == null)\r\n\t\t\treturn head2;\r\n\t\t tail1.next = head2; // merge the lists;\r\n\t\treturn head1;\r\n\t}", "private void sortItems(List<Transaction> theList) {\n\t\tloadList(theList);\r\n\t\tCollections.sort(theList, new Comparator<Transaction>() {\r\n\t\t\tpublic int compare(Transaction lhs, Transaction rhs) {\r\n\t\t\t\t// String lhsName = lhs.getName();\r\n\t\t\t\t// String rhsName = rhs.getName();\r\n\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t}", "public static ArrayList<Member> sortByName(ArrayList<Member> s){\r\n\t\tArrayList<Member> output = new ArrayList<Member>();\r\n\t\twhile(s.size()>0) {\r\n\t\t\tint minNo=0;\r\n\t\t\tString min=s.get(0).getName();\r\n\t\t\tfor(int i=0;i<s.size();i++) {\r\n\t\t\t\tif(Member.nameSmaller(s.get(i).getName(), min)) {\t\t\t\t\t\r\n\t\t\t\t\tmin=s.get(i).getName();\r\n\t\t\t\t\tminNo=i;\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t}\r\n\t\t\toutput.add(s.get(minNo));\r\n\t\t\ts.remove(s.get(minNo));\r\n\t\t}\r\n\t\treturn output;\r\n\t}", "public static void sortMoney(List<? extends Valuable> money) {\n\t\tComparator<Valuable> com = new ValueComparator();\n\t\tCollections.sort(money, com);\n\t\tprintList(money);\n\t}", "public static void main(String[] args) {\n ArrayList<SortObjects> a = new ArrayList<SortObjects>();\n\n SortObjects o = new SortObjects(\"Latha\", 23, 26000);\n SortObjects o2= new SortObjects(\"Ramya\", 20, 11000);\n SortObjects o3= new SortObjects(\"Kalai\", 29, 30000);\n SortObjects o4= new SortObjects(\"Vidya\", 24, 25000);\n a.add(o);\n a.add(o2);\n a.add(o3);\n a.add(o4);\n SortComparator s = new SortComparator();\n a.sort(s);\n System.out.println(a);\n \n \n\n\t}", "public void step4(){\n\n Collections.sort(names,(a,b)->b.compareTo(a));\n\n\n System.out.println(\"names sorted are :\"+names);\n }" ]
[ "0.7241861", "0.64345014", "0.6421235", "0.6404217", "0.6379716", "0.6374726", "0.635708", "0.6326651", "0.63229215", "0.63138604", "0.62996024", "0.62951636", "0.6281118", "0.62643707", "0.62643707", "0.622044", "0.6215308", "0.62111247", "0.61990803", "0.6188171", "0.61839116", "0.6156219", "0.61527115", "0.61409754", "0.6126206", "0.61124825", "0.60828304", "0.60792845", "0.60792845", "0.6074399", "0.6072213", "0.6066936", "0.60665995", "0.60529035", "0.6048188", "0.60361356", "0.6005765", "0.59808624", "0.5958281", "0.59458977", "0.59396285", "0.59377795", "0.5935198", "0.5928716", "0.59266293", "0.5919298", "0.5916872", "0.59146625", "0.5899089", "0.58972305", "0.5886526", "0.5885607", "0.5885138", "0.5877555", "0.58574253", "0.58336705", "0.58219266", "0.5820047", "0.58109623", "0.5808734", "0.5806759", "0.5802963", "0.5779933", "0.5770581", "0.5769995", "0.5756932", "0.5756125", "0.5744203", "0.5743088", "0.57393235", "0.5737826", "0.57348734", "0.5733197", "0.573174", "0.5716833", "0.57124114", "0.5712022", "0.57053", "0.57040673", "0.56957996", "0.56934714", "0.56780154", "0.56722045", "0.5659594", "0.565634", "0.565268", "0.56468517", "0.5642609", "0.564223", "0.5641902", "0.5639509", "0.5633198", "0.56283253", "0.56267893", "0.56235456", "0.5621292", "0.56171036", "0.5616019", "0.5614901", "0.5607474" ]
0.60661066
33
calculate min / max x value
private void calcXSize(ArrayList<BarEntry> xValues) { for (int i = 0; i < xValues.size(); i++) { int xValue = xValues.get(i).getX(); mMaxX = Math.max(mMaxX, xValue); mMinX = Math.min(mMinX, xValue); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "float xMin();", "float xMax();", "public double getXRangeMax() {\n return xRangeMax;\n }", "public double getXRangeMin() {\n return xRangeMin;\n }", "private void findMinandMaxValues(SparklineValues values) {\n minY = values.getValues().stream().filter(value -> value.getValue() != null).mapToDouble(SparklineValues.SparklineValue::getValue).min().orElse(0.0);\n maxY = values.getValues().stream().filter(value -> value.getValue() != null).mapToDouble(SparklineValues.SparklineValue::getValue).max().orElse(0.0);\n\n if (Math.abs(minY) > 1E30 || Math.abs(maxY) > 1E30) {\n // something is probably wrong\n System.out.println(\"Unexpectedly small/large min or max: \");\n values.getValues().forEach(value -> {\n System.out.print(value.getValue() + \" \");\n });\n System.out.println();\n minY = -1.0;\n maxY = 1.0;\n }\n\n if (minY.equals(maxY)) {\n if (minY.equals(0.0)) {\n minY = -1.0;\n maxY = 1.0;\n } else {\n minY = minY - 0.1 * Math.abs(minY);\n maxY = maxY + 0.1 * Math.abs(maxY);\n }\n }\n }", "Double getMinimumValue();", "int getXMin();", "protected void calcMinMax() {\n }", "public double obterXmin() {\n\t\treturn xmin;\n\t}", "public double getMaximumX () {\n return minimumX + width;\n }", "float getXStepMax();", "static public double lim(double x,double min,double max) {\r\n\t\t if(x<min) return min;\r\n\t\t if(x>max) return max;\r\n\t\t return x;\r\n\t}", "public double getMaxX() {\n\treturn maxX;\n }", "double getMin();", "double getMin();", "public double getMaxX() {\n\t\treturn mx;\n\t}", "public double getMinDoubleValue();", "public double getMinimumX () {\n return minimumX;\n }", "public int getMinimumValue() {\n/* 276 */ return -this.s.getMaximumValue();\n/* */ }", "public Range FindXmaxmin(graph g) {\r\n\r\n\t\tdouble xmin=Double.MAX_VALUE; \r\n\t\tdouble xmax=Double.MIN_VALUE; \r\n\t\tCollection<node_data> nc = g.getV();\r\n\t\tfor(node_data n: nc) {\r\n\r\n\t\t\tdouble px=n.getLocation().x();\r\n\r\n\t\t\tif(px>xmax) {\r\n\t\t\t\txmax=px;\r\n\t\t\t}\r\n\r\n\t\t\tif(px<xmin) {\r\n\t\t\t\txmin=px;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn new Range(xmin-0.001,xmax+0.001);\r\n\t}", "private void calculateMinMaxPositions() {\n boundingVolume = null;\n if ( minMax == null ) {\n minMax = new double[6];\n\n double minX = Double.MAX_VALUE;\n double minY = Double.MAX_VALUE;\n double minZ = Double.MAX_VALUE;\n double maxX = -Double.MAX_VALUE;\n double maxY = -Double.MAX_VALUE;\n double maxZ = -Double.MAX_VALUE;\n int i;\n\n for ( i = 0; i < getNumVertices(); i++ ) {\n double x = vertexPositions[3*i+0];\n double y = vertexPositions[3*i+1];\n double z = vertexPositions[3*i+2];\n\n if ( x < minX ) minX = x;\n if ( y < minY ) minY = y;\n if ( z < minZ ) minZ = z;\n if ( x > maxX ) maxX = x;\n if ( y > maxY ) maxY = y;\n if ( z > maxZ ) maxZ = z;\n }\n minMax[0] = minX;\n minMax[1] = minY;\n minMax[2] = minZ;\n minMax[3] = maxX;\n minMax[4] = maxY;\n minMax[5] = maxZ;\n }\n }", "float getXStepMin();", "public int getxMin() {\n\t\treturn xMin;\n\t}", "public int getXMax(){\n\t\tDouble max = timeIncrements.get(timeIncrements.size()-1);\n\t\txMax = max.intValue();\n\t\treturn xMax;\n\t}", "private static double minMaxNormalization(final double value) {\n return (((value - Configuration.ACTUAL_MIN) / (Configuration.ACTUAL_MAX - Configuration.ACTUAL_MIN)) * (Configuration.NORMALIZED_MAX - Configuration.NORMALIZED_MIN)) + Configuration.NORMALIZED_MIN;\n }", "@Override\n public double[] getMinMax() {\n if ( minMax == null ) {\n calculateMinMaxPositions();\n }\n return minMax;\n }", "public double getMaxX() { return getX() + getWidth(); }", "public void initMaxMin(){\n\t\tmax = dja.max();\n\t\tmin = dja.min();\n\t}", "Double getMaximumValue();", "public double getMinX() {\n\treturn minX;\n }", "static int minValues(int[] x) {\n\t\tint min = 0;\n\n\t\tfor (int y : x) {\n\t\t\tif (y < min) {\n\t\t\t\tmin = y;\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}", "public float rms(int itmin, int itmax, float[][] x) {\n int nt = itmax-itmin+1;\n return (float)sqrt(dot(itmin,itmax,x,x)/x.length/nt);\n }", "public double getMinimumValue()\n {\n this.minimumValue = getMinNumber(allValues);\n this.maximumValue = getMaxNumber(allValues);\n return minimumValue;\n }", "private int unmapToInt(double x, double max, double min, int n) {\n\t\treturn (int) ( (x - max) * ( Math.pow(2, n) - 1 ) / (max - min) );\n\t}", "public double getMinRange() {\n return minRange;\n }", "public float getMaxX() {\n return maxX;\n }", "double getMax();", "double getMax();", "public double getMinimumValue() { return this.minimumValue; }", "float yMin();", "public void updateMinMax( ) {\r\n if( (data == null) || (data.size() < 1) ) {\r\n min = 0.0;\r\n max = 0.0;\r\n return;\r\n }\r\n\r\n min = data.get( 0 );\r\n max = data.get( 0 );\r\n\r\n for( int i = 1; i < data.size(); i++ ) {\r\n if( min > data.get( i ) )\r\n min = data.get( i );\r\n if( max < data.get( i ) )\r\n max = data.get( i );\r\n }\r\n\r\n }", "public float getMaxX(){\n return points.get(points.size()-1).getX();\n }", "private double getStartX() {\n\t\treturn Math.min(x1, x2);\n\t}", "protected void calcMinMax() {\n if (this.mDataSets != null) {\n T t;\n this.mYMax = -3.4028235E38f;\n this.mYMin = Float.MAX_VALUE;\n this.mXMax = -3.4028235E38f;\n this.mXMin = Float.MAX_VALUE;\n Iterator<T> iterator = this.mDataSets.iterator();\n while (iterator.hasNext()) {\n this.calcMinMax((IDataSet)iterator.next());\n }\n this.mLeftAxisMax = -3.4028235E38f;\n this.mLeftAxisMin = Float.MAX_VALUE;\n this.mRightAxisMax = -3.4028235E38f;\n this.mRightAxisMin = Float.MAX_VALUE;\n T t2 = this.getFirstLeft(this.mDataSets);\n if (t2 != null) {\n this.mLeftAxisMax = t2.getYMax();\n this.mLeftAxisMin = t2.getYMin();\n for (IDataSet iDataSet : this.mDataSets) {\n if (iDataSet.getAxisDependency() != YAxis.AxisDependency.LEFT) continue;\n if (iDataSet.getYMin() < this.mLeftAxisMin) {\n this.mLeftAxisMin = iDataSet.getYMin();\n }\n if (!(iDataSet.getYMax() > this.mLeftAxisMax)) continue;\n this.mLeftAxisMax = iDataSet.getYMax();\n }\n }\n if ((t = this.getFirstRight(this.mDataSets)) != null) {\n this.mRightAxisMax = t.getYMax();\n this.mRightAxisMin = t.getYMin();\n for (IDataSet iDataSet : this.mDataSets) {\n if (iDataSet.getAxisDependency() != YAxis.AxisDependency.RIGHT) continue;\n if (iDataSet.getYMin() < this.mRightAxisMin) {\n this.mRightAxisMin = iDataSet.getYMin();\n }\n if (!(iDataSet.getYMax() > this.mRightAxisMax)) continue;\n this.mRightAxisMax = iDataSet.getYMax();\n }\n }\n }\n }", "private void calculateMaxTemperatureNormalisation() {\n maxTemperatureNormalisation = (temperatureMax - temperatureMin) / 2;\n }", "public static void arrayAttributes(){\n int[] x= {1, 5, 10, -2};\n int[] y={0,0,0};\n int sum=0;\n int avg=0;\n int max=x[0];\n int min=x[0];\n for (int i =0; i<x.length; i++){\n sum=sum+x[i];\n if (x[i]>max){\n max=x[i];\n }\n if (x[i]<min){\n min=x[i];\n }\n }\n avg=sum/x.length;\n y[0]=max;\n y[1]=min;\n y[2]=avg;\n for (int j=0; j<y.length; j++){\n System.out.println(y[j]); \n }\n}", "public int GetMinVal();", "public Double getMinimumValue () {\r\n\t\treturn (minValue);\r\n\t}", "E minVal();", "Coordinate getMinX();", "public double getMinX() {\n\t\treturn nx;\n\t}", "public void setXDataRange(float min, float max);", "private float getMaxX(HomePieceOfFurniture piece) {\n float [][] points = piece.getPoints();\n float maxX = Float.NEGATIVE_INFINITY;\n for (float [] point : points) {\n maxX = Math.max(maxX, point [0]);\n } \n return maxX;\n }", "double getMin() {\n\t\t\treturn value_min;\n\t\t}", "public int getxMax() {\n\t\treturn xMax;\n\t}", "public float getMinX(){\n return points.get(0).getX();\n }", "public float min2DX() {\n return Math.min(stop2D.x, start2D.x);\n }", "public double valueAt(double x) {\r\n \treturn ((f.valueAt(x+epsilon)/2- f.valueAt(x-epsilon)/2)/epsilon);\r\n }", "public double min(){\r\n\t\t//variable for min val\r\n\t\tdouble min = this.data[0];\r\n\t\t\r\n\t\tfor (int i = 1; i < this.data.length; i++){\r\n\t\t\t//if the minimum is more than the current index, change min to that value\r\n\t\t\tif (min > this.data[i]){\r\n\t\t\t\tmin = this.data[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\t//return the minimum val\r\n\t\treturn min;\r\n\t}", "public final int getMaxX() {\n return getMinX() + getWidth();\n }", "public double getYRangeMin() {\n return yRangeMin;\n }", "public int getMaxX() {\n\t\treturn maxX;\n\t}", "protected final double getMinDifference() {\r\n \r\n double difference = 0;\r\n \r\n for(int i = 0; i < this.D; i++) {\r\n difference += Math.pow(this.f.max(i)-this.f.min(i), 2)*0.001;\r\n }\r\n \r\n return difference;\r\n \r\n }", "private double clamp(double v, double min, double max) { return (v < min ? min : (v > max ? max : v)); }", "public double getMaxCoordinateValue() {\n if (this.max_x > this.max_y)\n return this.max_x;\n else\n return this.max_y;\n }", "public float _getMin()\r\n {\r\n if (valueClass.equals(Float.class))\r\n {\r\n return (getMinimum() / max);\r\n } else\r\n {\r\n return getMinimum();\r\n }\r\n }", "protected void calcMinMax(T t) {\n if (this.mYMax < t.getYMax()) {\n this.mYMax = t.getYMax();\n }\n if (this.mYMin > t.getYMin()) {\n this.mYMin = t.getYMin();\n }\n if (this.mXMax < t.getXMax()) {\n this.mXMax = t.getXMax();\n }\n if (this.mXMin > t.getXMin()) {\n this.mXMin = t.getXMin();\n }\n if (t.getAxisDependency() == YAxis.AxisDependency.LEFT) {\n if (this.mLeftAxisMax < t.getYMax()) {\n this.mLeftAxisMax = t.getYMax();\n }\n if (!(this.mLeftAxisMin > t.getYMin())) return;\n {\n this.mLeftAxisMin = t.getYMin();\n return;\n }\n } else {\n if (this.mRightAxisMax < t.getYMax()) {\n this.mRightAxisMax = t.getYMax();\n }\n if (!(this.mRightAxisMin > t.getYMin())) return;\n {\n this.mRightAxisMin = t.getYMin();\n return;\n }\n }\n }", "public int projectX( double x ) {\n double dx = xoff_ + Math.round( x * scale_ );\n return (int) Math.max( (double) Integer.MIN_VALUE,\n Math.min( (double) Integer.MAX_VALUE, dx ) );\n }", "public abstract int getMinimumValue();", "public double getMaxX() {\n\t\tif (pointList.size()==0) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn pointList.get(pointList.size()-1 ).getX();\n\t}", "org.apache.xmlbeans.XmlDecimal xgetMultipleBetMinimum();", "public double getMinValue() {\n double min = Double.POSITIVE_INFINITY;\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n if (data[i][j] < min)\n min = data[i][j];\n }\n }\n return min;\n }", "private double getMin() {\n return Collections.min(values.values());\n }", "public double minXp(){\n\t\tmin = xp[0];\n\t\tfor(int i=1;i<xp.length;i++){\n\t\t\tif(xp[i]<min){\n\t\t\t\tmin=xp[i];\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}", "public double max()\n\n {\n double max=xyValueArray.get(0).getY();\n\n for (int i = 0; i < xyValueArray.size(); i++) {\n if (xyValueArray.get(i).getY() > max) {\n max = xyValueArray.get(i).getY();\n }\n }\n return max;\n }", "public static Point minmax (int[] a) {\n int n = a.length;\n Point mm = new Point (a[0], a[0]);\n\n for (int i=1; i<n; i++) {\n if (a[i] > mm.x) mm.x = a[i];\n if (a[i] < mm.y) mm.y = a[i];\n }\n return mm;\n }", "public double getValue(double x, double y){\n\n\tint i,j;\n\tdouble fracX,fracY;\n\tdouble Wxm, Wx0, Wxp, Wym, Wy0, Wyp;\n\tdouble Vm, V0, Vp;\n\n\n\tif(x < x_min || y < y_min || x > x_max || y > y_max){\n\t return z_min;\n\t}\n\n i = (int) ((x-x_min)/x_step + 0.5);\n j = (int) ((y-y_min)/y_step + 0.5);\n\n if( i < 1) i = 1;\n if( i > (nX-2)) i = nX-2;\n if( j < 1) j = 1;\n if( j > (nY-2)) j = nY-2;\t \n\n fracX = (x - x_min - i*x_step)/x_step;\n fracY = (y - y_min - j*y_step)/y_step;\n\n\tWxm = 0.5*(0.5 - fracX)*(0.5 - fracX);\n\tWxp = 0.5*(0.5 + fracX)*(0.5 + fracX);\n\tWx0 = 0.75 - fracX*fracX;\n\n\tWym = 0.5*(0.5 - fracY)*(0.5 - fracY);\n\tWyp = 0.5*(0.5 + fracY)*(0.5 + fracY);\n\tWy0 = 0.75 - fracY*fracY;\n\n\tVm = Wxm*gridData[i-1][j-1]+Wx0*gridData[i][j-1]+Wxp*gridData[i+1][j-1];\n\tV0 = Wxm*gridData[i-1][j] +Wx0*gridData[i][j] +Wxp*gridData[i+1][j];\n\tVp = Wxm*gridData[i-1][j+1]+Wx0*gridData[i][j+1]+Wxp*gridData[i+1][j+1];\n\n return Wym*Vm + Wy0*V0 + Wyp*Vp;\n }", "public void setMinValue(double x) {\r\n\t\tminValue = x;\r\n\t}", "private double getMin() {\n return min;\n }", "float yMax();", "org.apache.xmlbeans.XmlDecimal xgetSingleBetMinimum();", "public int getMinimumValue() {\n return -s.getMaximumValue();\n }", "public static double normalizeMapminmax(double num) {\r\n \t\tint MAXsetvaluefaktor = 1;\r\n \t\tint MINsetvaluefaktor = 1;\r\n \r\n \t\tswitch (GAMETYPE) {\r\n \t\tcase SAYISALLOTO: {\r\n \t\t\tif (INPUTVALUETYPE == DIGITAL) {\r\n \t\t\t\tMAXsetvaluefaktor = SAYISALMINSETVALUE1;\r\n \t\t\t\tMINsetvaluefaktor = 0;\r\n \t\t\t} else if (INPUTVALUETYPE == RAWVALUE) {\r\n \t\t\t\tMAXsetvaluefaktor = SAYISALMAXSETVALUE49;\r\n \t\t\t\tMINsetvaluefaktor = SAYISALMINSETVALUE1;\r\n \t\t\t}\r\n \t\t\tbreak;\r\n \t\t}\r\n \t\tdefault: {\r\n \r\n \t\t}\r\n \t\t}\r\n \r\n \t\tdouble result = ((MAPMAX - MAPMIN) * (num - MINsetvaluefaktor));\r\n \t\tresult = result / (MAXsetvaluefaktor - MINsetvaluefaktor);\r\n \t\tresult = result + MAPMIN;\r\n \t\treturn result;\r\n \t}", "@Override\n\tpublic double mShip(double x) {\n\t\tif (x <= a)\n\t\t\treturn 0.0;\n\t\tif ((x > a) && (x < b))\n\t\t\treturn (x - a) / (b - a);\n\t\telse\n\t\t\treturn 1.0;\n\t}", "private void findExtremes( Vector<? extends AbstractWirelessDevice> coll )\r\n {\r\n for( AbstractWirelessDevice e: coll )\r\n {\r\n double x = e.getLocation().getX();\r\n double y = e.getLocation().getY();\r\n \r\n if( x < minX )\r\n minX = x;\r\n \r\n if( x > maxX )\r\n maxX = x;\r\n \r\n if( y < minY )\r\n minY = y;\r\n \r\n if( y > maxY )\r\n maxY = y;\r\n }\r\n }", "org.apache.xmlbeans.XmlDecimal xgetWagerMinimum();", "public double getMinimumDouble() {\n/* 201 */ return this.min;\n/* */ }", "public float max2DX() {\n return Math.max(stop2D.x, start2D.x);\n }", "protected double getMinDouble() {\r\n boolean handleOutOfMemoryError = false;\r\n double min = Double.POSITIVE_INFINITY;\r\n Grids_GridDouble g = getGrid();\r\n int nrows = g.getChunkNRows(ChunkID, handleOutOfMemoryError);\r\n int ncols = g.getChunkNCols(ChunkID, handleOutOfMemoryError);\r\n double noDataValue = g.getNoDataValue(false);\r\n double value;\r\n int row;\r\n int col;\r\n for (row = 0; row < nrows; row++) {\r\n for (col = 0; col < ncols; col++) {\r\n value = getCell(\r\n row,\r\n col);\r\n if (value != noDataValue) {\r\n min = Math.min(\r\n min,\r\n value);\r\n }\r\n }\r\n }\r\n return min;\r\n }", "public double getMinimum() {\n return (min);\n }", "public int getMinRange() {\r\n return fMinRange;\r\n }", "public double get(int min, int max) {\r\n\t\treturn chart[min][max];\r\n\t}", "public Point getMin () {\r\n\r\n\treturn getA();\r\n }", "@Test\n\tpublic void testMinMinMax(){\n\t int min=3, mid=5, max=10;\n\t assertEquals( max, MaxDiTre.max(min, min, max) );\n\t}", "public double min(ArrayList<Double> x) {\n double round;\n round = Collections.min(x) * 100;\n round = Math.round(round);\n round /= 100;\n return round;\n }", "public void setMaxValue(double x) {\r\n\t\tmaxValue = x;\r\n\t}", "public void allMinMax() {\n\t\tthis.theMaxX();\n\t\tthis.theMinX();\n\t\tthis.theMaxY();\n\t\tthis.theMinY();\n\t}", "public int getXMax(){\n\t\treturn xDim;\n\t}", "static public final double map(double value, double dataMin, double dataMax, double plottedMin, double plottedMax) \n {\n return plottedMin+(plottedMax-plottedMin)*\n ((value-dataMin)/(dataMax-dataMin));\n }", "public float getMaxValue();" ]
[ "0.7327778", "0.7321723", "0.7117175", "0.70774186", "0.6957908", "0.69078857", "0.690423", "0.686218", "0.68097454", "0.6795887", "0.67931986", "0.6705169", "0.665531", "0.6632447", "0.6632447", "0.6588476", "0.65813", "0.6578077", "0.6531309", "0.64911574", "0.6481686", "0.647056", "0.6438173", "0.6427103", "0.6375226", "0.6358742", "0.63574576", "0.63194287", "0.6313833", "0.6298172", "0.6270577", "0.6267575", "0.625378", "0.6251032", "0.625074", "0.62451667", "0.62401223", "0.62401223", "0.62388074", "0.62262124", "0.62229884", "0.6212987", "0.6207813", "0.6205997", "0.62049323", "0.6164596", "0.6163096", "0.61567545", "0.6148095", "0.61456966", "0.61420834", "0.61326253", "0.6116855", "0.61102754", "0.6097585", "0.6088439", "0.608655", "0.6077237", "0.6075863", "0.6071846", "0.6068287", "0.6057674", "0.604589", "0.60446346", "0.6043421", "0.6040628", "0.60358226", "0.60358226", "0.6031765", "0.60312355", "0.60267603", "0.5976452", "0.59738666", "0.59593105", "0.5945046", "0.59387094", "0.5935709", "0.59306395", "0.59263784", "0.5925364", "0.5923568", "0.59118676", "0.59114754", "0.59106106", "0.5905515", "0.5893145", "0.5893057", "0.58925945", "0.58703357", "0.5855844", "0.58549523", "0.5851056", "0.58495563", "0.5840473", "0.58363754", "0.5821067", "0.581775", "0.5812079", "0.580945", "0.58091635" ]
0.60158575
71
calculate min / max y value
private void calcYSize(ArrayList<BarEntry> yValues) { for (int i = 0; i < yValues.size(); i++) { float yValue = yValues.get(i).getY(); mMaxY = Math.max(mMaxY, yValue); mMinY = Math.min(mMinY, yValue); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "float yMin();", "float yMax();", "public double getYRangeMin() {\n return yRangeMin;\n }", "private void findMinandMaxValues(SparklineValues values) {\n minY = values.getValues().stream().filter(value -> value.getValue() != null).mapToDouble(SparklineValues.SparklineValue::getValue).min().orElse(0.0);\n maxY = values.getValues().stream().filter(value -> value.getValue() != null).mapToDouble(SparklineValues.SparklineValue::getValue).max().orElse(0.0);\n\n if (Math.abs(minY) > 1E30 || Math.abs(maxY) > 1E30) {\n // something is probably wrong\n System.out.println(\"Unexpectedly small/large min or max: \");\n values.getValues().forEach(value -> {\n System.out.print(value.getValue() + \" \");\n });\n System.out.println();\n minY = -1.0;\n maxY = 1.0;\n }\n\n if (minY.equals(maxY)) {\n if (minY.equals(0.0)) {\n minY = -1.0;\n maxY = 1.0;\n } else {\n minY = minY - 0.1 * Math.abs(minY);\n maxY = maxY + 0.1 * Math.abs(maxY);\n }\n }\n }", "public int getyMin() {\n\t\treturn yMin;\n\t}", "public double getMinimumY () {\n return minimumY;\n }", "public double getMinY() {\n\treturn minY;\n }", "public double getMaximumY () {\n return minimumY + height;\n }", "Coordinate getMinY();", "@Override\n public int getMinY() {\n return this.minY;\n }", "public int getMinY() {\n return minY;\n }", "public double getYRangeMax() {\n return yRangeMax;\n }", "public double obterYmin() {\n\t\treturn ymin;\n\t}", "public double getMaxY() { return getY() + getHeight(); }", "public float getYChartMin() {\n return 0.0F;\n }", "public double getMaxY() {\n\treturn maxY;\n }", "protected void calcMinMax() {\n if (this.mDataSets != null) {\n T t;\n this.mYMax = -3.4028235E38f;\n this.mYMin = Float.MAX_VALUE;\n this.mXMax = -3.4028235E38f;\n this.mXMin = Float.MAX_VALUE;\n Iterator<T> iterator = this.mDataSets.iterator();\n while (iterator.hasNext()) {\n this.calcMinMax((IDataSet)iterator.next());\n }\n this.mLeftAxisMax = -3.4028235E38f;\n this.mLeftAxisMin = Float.MAX_VALUE;\n this.mRightAxisMax = -3.4028235E38f;\n this.mRightAxisMin = Float.MAX_VALUE;\n T t2 = this.getFirstLeft(this.mDataSets);\n if (t2 != null) {\n this.mLeftAxisMax = t2.getYMax();\n this.mLeftAxisMin = t2.getYMin();\n for (IDataSet iDataSet : this.mDataSets) {\n if (iDataSet.getAxisDependency() != YAxis.AxisDependency.LEFT) continue;\n if (iDataSet.getYMin() < this.mLeftAxisMin) {\n this.mLeftAxisMin = iDataSet.getYMin();\n }\n if (!(iDataSet.getYMax() > this.mLeftAxisMax)) continue;\n this.mLeftAxisMax = iDataSet.getYMax();\n }\n }\n if ((t = this.getFirstRight(this.mDataSets)) != null) {\n this.mRightAxisMax = t.getYMax();\n this.mRightAxisMin = t.getYMin();\n for (IDataSet iDataSet : this.mDataSets) {\n if (iDataSet.getAxisDependency() != YAxis.AxisDependency.RIGHT) continue;\n if (iDataSet.getYMin() < this.mRightAxisMin) {\n this.mRightAxisMin = iDataSet.getYMin();\n }\n if (!(iDataSet.getYMax() > this.mRightAxisMax)) continue;\n this.mRightAxisMax = iDataSet.getYMax();\n }\n }\n }\n }", "private double findMinY() {\n\t\tif (pointList.size()==0) {\n\t\t\treturn 0;\n\t\t}\n\t\tdouble min = pointList.get(0).getY();\n\t\tfor(int i=0; i<pointList.size(); i++)\n\t\t\tif (min>pointList.get(i).getY())\n\t\t\t\tmin = pointList.get(i).getY();\n\t\treturn min;\n\t}", "public double getMinY() {\n\t\treturn ny;\n\t}", "public int getMaxY() {\n return maxY;\n }", "private double findMaxY() {\n\t\tif (pointList.size()==0) {\n\t\t\treturn Double.NaN;\n\t\t}\n\t\tdouble max = pointList.get(0).getY();\n\t\tfor(int i=0; i<pointList.size(); i++)\n\t\t\tif (max<pointList.get(i).getY())\n\t\t\t\tmax = pointList.get(i).getY();\n\t\treturn max;\n\t}", "public Output<TFloat32> yMin() {\n return yMin;\n }", "public Range FindYmaxmin(graph g) {\r\n\r\n\t\tdouble ymin=Double.MAX_VALUE; \r\n\t\tdouble ymax=Double.MIN_VALUE; \r\n\t\tCollection<node_data> nc = g.getV();\r\n\t\tfor(node_data n: nc) {\r\n\r\n\t\t\tdouble py=n.getLocation().y();\r\n\r\n\t\t\tif(py>ymax) {\r\n\t\t\t\tymax=py;\r\n\t\t\t}\r\n\r\n\t\t\tif(py<ymin) {\r\n\t\t\t\tymin=py;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn new Range(ymin-0.001,ymax+0.001);\r\n\t}", "public void setYDataRange(float min, float max);", "protected void calcMinMax(T t) {\n if (this.mYMax < t.getYMax()) {\n this.mYMax = t.getYMax();\n }\n if (this.mYMin > t.getYMin()) {\n this.mYMin = t.getYMin();\n }\n if (this.mXMax < t.getXMax()) {\n this.mXMax = t.getXMax();\n }\n if (this.mXMin > t.getXMin()) {\n this.mXMin = t.getXMin();\n }\n if (t.getAxisDependency() == YAxis.AxisDependency.LEFT) {\n if (this.mLeftAxisMax < t.getYMax()) {\n this.mLeftAxisMax = t.getYMax();\n }\n if (!(this.mLeftAxisMin > t.getYMin())) return;\n {\n this.mLeftAxisMin = t.getYMin();\n return;\n }\n } else {\n if (this.mRightAxisMax < t.getYMax()) {\n this.mRightAxisMax = t.getYMax();\n }\n if (!(this.mRightAxisMin > t.getYMin())) return;\n {\n this.mRightAxisMin = t.getYMin();\n return;\n }\n }\n }", "public double getMaxCoordinateValue() {\n if (this.max_x > this.max_y)\n return this.max_x;\n else\n return this.max_y;\n }", "public double max()\n\n {\n double max=xyValueArray.get(0).getY();\n\n for (int i = 0; i < xyValueArray.size(); i++) {\n if (xyValueArray.get(i).getY() > max) {\n max = xyValueArray.get(i).getY();\n }\n }\n return max;\n }", "protected void calcMinMax() {\n }", "public float getYChartMax() {\n return 0.0F;\n }", "private double getStartY() {\n\t\treturn Math.min(y1, y2);\n\t}", "int getMinY(Long id) throws RemoteException;", "public double getYValue(){\r\n\t\treturn ((Double)(super.yValue) ).doubleValue(); \r\n\t}", "public int getMaxY() {\n\t\treturn maxY;\n\t}", "@Override\n public double[] getMinMax() {\n if ( minMax == null ) {\n calculateMinMaxPositions();\n }\n return minMax;\n }", "public final int getMaxY() {\n return getMinY() + getHeight();\n }", "private int getYmin(int[] yt){\n\t\tint min = 256;\n\t\tfor(int i = 0;i<=3;i++){\n\t\t\tif(min > yt[i]){\n\t\t\t\tmin = yt[i];\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}", "private void calculateMinMaxPositions() {\n boundingVolume = null;\n if ( minMax == null ) {\n minMax = new double[6];\n\n double minX = Double.MAX_VALUE;\n double minY = Double.MAX_VALUE;\n double minZ = Double.MAX_VALUE;\n double maxX = -Double.MAX_VALUE;\n double maxY = -Double.MAX_VALUE;\n double maxZ = -Double.MAX_VALUE;\n int i;\n\n for ( i = 0; i < getNumVertices(); i++ ) {\n double x = vertexPositions[3*i+0];\n double y = vertexPositions[3*i+1];\n double z = vertexPositions[3*i+2];\n\n if ( x < minX ) minX = x;\n if ( y < minY ) minY = y;\n if ( z < minZ ) minZ = z;\n if ( x > maxX ) maxX = x;\n if ( y > maxY ) maxY = y;\n if ( z > maxZ ) maxZ = z;\n }\n minMax[0] = minX;\n minMax[1] = minY;\n minMax[2] = minZ;\n minMax[3] = maxX;\n minMax[4] = maxY;\n minMax[5] = maxZ;\n }\n }", "public int getYMax(){\n\t\treturn yDim;\n\t}", "public double getMaxY() {\n\t\treturn my;\n\t}", "public double getXRangeMax() {\n return xRangeMax;\n }", "public int projectY( double y ) {\n double dy = yoff_ - Math.round( y * scale_ );\n return (int) Math.max( (double) Integer.MIN_VALUE,\n Math.min( (double) Integer.MAX_VALUE, dy ) );\n }", "public void theMinY() {\n\t\tfloat miny = coords.getFirst().getY(); // set the smallest y to the first one\n\t\tfor(Coord2D c: coords) { // go through the whole linked list\n\t\t\tif(c.getY() < miny) { // if the y of the current coordinate set is smaller than the current min\n\t\t\t\tminy = c.getY(); // make that current coordinate the new min\n\t\t\t}\n\t\t}\n\t\tthis.setMinY(miny);\n\t}", "public double getFrameMaxY() { return isRSS()? getFrame().getMaxY() : getMaxY(); }", "private float getMinY(HomePieceOfFurniture piece) {\n float [][] points = piece.getPoints();\n float minY = Float.POSITIVE_INFINITY;\n for (float [] point : points) {\n minY = Math.min(minY, point [1]);\n } \n return minY;\n }", "private int getYmax(int[] yt){\n\t\tint max = -1;\n\t\tfor(int i = 0;i<=3;i++){\n\t\t\tif(max < yt[i]){\n\t\t\t\tmax = yt[i];\n\t\t\t}\n\t\t}\n\t\treturn max;\n\t}", "public int getYMax(){\n\t\tDouble max = Collections.max(byteIncrements);\n\t\tyMax = max.intValue();\n\t\treturn yMax;\n\t}", "public void setYRangeMin(double yRangeMin) {\n this.yRangeMin = yRangeMin;\n }", "public int getyMax() {\n\t\treturn yMax;\n\t}", "public float min2DY() {\n return Math.min(stop2D.y, start2D.y);\n }", "public void initMaxMin(){\n\t\tmax = dja.max();\n\t\tmin = dja.min();\n\t}", "public double getYValue(){\n return(yValue);\n }", "public int getMinY() {\n return scroller.getMinY();\n }", "public float max2DY() {\n return Math.max(stop2D.y, start2D.y);\n }", "public void updateMinMax( ) {\r\n if( (data == null) || (data.size() < 1) ) {\r\n min = 0.0;\r\n max = 0.0;\r\n return;\r\n }\r\n\r\n min = data.get( 0 );\r\n max = data.get( 0 );\r\n\r\n for( int i = 1; i < data.size(); i++ ) {\r\n if( min > data.get( i ) )\r\n min = data.get( i );\r\n if( max < data.get( i ) )\r\n max = data.get( i );\r\n }\r\n\r\n }", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "double getY();", "public int lowerBoundary(){\r\n\t\treturn this.ypoints[0];\r\n\t}", "public double getY() { return y; }", "private float getMaxY(HomePieceOfFurniture piece) {\n float [][] points = piece.getPoints();\n float maxY = Float.NEGATIVE_INFINITY;\n for (float [] point : points) {\n maxY = Math.max(maxY, point [1]);\n } \n return maxY;\n }", "public int yPixScale( double y ) { return (int)(height / yRange * y); }", "public int getY() {\n return (int) Math.round(y);\n }", "public double getMaximumX () {\n return minimumX + width;\n }", "double getEndY();", "public double getY() { return _height<0? _y + _height : _y; }", "public double getYRangeIncr() {\n return yRangeIncr;\n }", "public double getY();", "public Range getYRange() {\r\n\t\treturn yRange;\r\n\t}", "float xMax();", "public double getValue(double x, double y){\n\n\tint i,j;\n\tdouble fracX,fracY;\n\tdouble Wxm, Wx0, Wxp, Wym, Wy0, Wyp;\n\tdouble Vm, V0, Vp;\n\n\n\tif(x < x_min || y < y_min || x > x_max || y > y_max){\n\t return z_min;\n\t}\n\n i = (int) ((x-x_min)/x_step + 0.5);\n j = (int) ((y-y_min)/y_step + 0.5);\n\n if( i < 1) i = 1;\n if( i > (nX-2)) i = nX-2;\n if( j < 1) j = 1;\n if( j > (nY-2)) j = nY-2;\t \n\n fracX = (x - x_min - i*x_step)/x_step;\n fracY = (y - y_min - j*y_step)/y_step;\n\n\tWxm = 0.5*(0.5 - fracX)*(0.5 - fracX);\n\tWxp = 0.5*(0.5 + fracX)*(0.5 + fracX);\n\tWx0 = 0.75 - fracX*fracX;\n\n\tWym = 0.5*(0.5 - fracY)*(0.5 - fracY);\n\tWyp = 0.5*(0.5 + fracY)*(0.5 + fracY);\n\tWy0 = 0.75 - fracY*fracY;\n\n\tVm = Wxm*gridData[i-1][j-1]+Wx0*gridData[i][j-1]+Wxp*gridData[i+1][j-1];\n\tV0 = Wxm*gridData[i-1][j] +Wx0*gridData[i][j] +Wxp*gridData[i+1][j];\n\tVp = Wxm*gridData[i-1][j+1]+Wx0*gridData[i][j+1]+Wxp*gridData[i+1][j+1];\n\n return Wym*Vm + Wy0*V0 + Wyp*Vp;\n }", "float getY();", "float getY();", "float getY();", "float getY();", "float getY();", "float getY();", "private long getAbsMax() {\n return Math.max(Math.abs(Visualizer.getLowerBound().get()),\n Visualizer.getUpperBound().get());\n }", "public Output<TFloat32> yMax() {\n return yMax;\n }", "public double getMaxX() { return getX() + getWidth(); }", "float getRenderableMinY(Long id) throws RemoteException;", "public double getY(){\r\n return y;\r\n }", "protected double getReferenceY() {\n if (isYAxisBoundsManual() && !mGraphView.getGridLabelRenderer().isHumanRoundingY()) {\n if (Double.isNaN(referenceY)) {\n referenceY = getMinY(false);\n }\n return referenceY;\n } else {\n // starting from 0 so that the steps have nice numbers\n return 0;\n }\n }", "public int getY() { return (int)y; }", "float getXStepMax();", "public double getBiggestY() {\r\n double y = 0;\r\n List<Enemy> enemyLowest = this.lowestLine();\r\n if (enemyLowest.size() > 0) {\r\n y = enemyLowest.get(0).getCollisionRectangle().getBoundaries().getLowY();\r\n for (Enemy e: enemyLowest) {\r\n if (e.getCollisionRectangle().getBoundaries().getLowY() > y) {\r\n y = e.getCollisionRectangle().getBoundaries().getLowY();\r\n }\r\n }\r\n return y;\r\n }\r\n return y;\r\n }", "Float getY();", "public int getMaxY() {\n return scroller.getMaxY();\n }", "public double getY(){\n return y;\n }", "public int getBlockY()\n\t {\n\t\t if(y >= 0.0) return (int)y;\n\t\t return -1 + (int)(y);\n\t }", "public double getHighestChildY() {\n\t\t/* Aucun enfant => aucune contrainte en y vers le bas */\n\t\tif (childrenEdges == null)\n\t\t\treturn Double.MAX_VALUE;\n\t\t\n\t\tdouble minY = Double.MAX_VALUE;\n\t\tfor (int i = 0; i < childrenEdges.size(); i++) {\n\t\t\t/*\n\t\t\t * Recherche de l'extrémité la plus basse de l'arête (la plus haute étant le noeud\n\t\t\t * courant)\n\t\t\t */\n\t\t\tEdge currentEdge = childrenEdges.elementAt(i);\n\t\t\tdouble y1 = currentEdge.getSource().getShape().getY();\n\t\t\tdouble y2 = currentEdge.getDestination().getShape().getY();\n\t\t\tdouble y = (y1 > y2) ? y1 : y2;\n\t\t\t\n\t\t\t/* Recherche de l'extrémité la plus haute parmi toutes les extrémités basses */\n\t\t\tif (y < minY)\n\t\t\t\tminY = y;\n\t\t}\n\t\t\n\t\treturn minY;\n\t}", "@Override\n public int getMinTileY() {\n return convertYToTileY(getMinY());\n }", "public float getY();", "public float getY();", "public double getMaxX() {\n\treturn maxX;\n }" ]
[ "0.78431803", "0.7607971", "0.745832", "0.7311128", "0.72310895", "0.7150767", "0.71384656", "0.7127707", "0.70788616", "0.7032275", "0.7002703", "0.6999642", "0.69626176", "0.6951471", "0.6927011", "0.6909292", "0.6907493", "0.689009", "0.68036395", "0.6759062", "0.6739006", "0.6723101", "0.6693303", "0.66864353", "0.6658311", "0.66573834", "0.66459024", "0.6614896", "0.6567902", "0.65590817", "0.65200955", "0.6494297", "0.647603", "0.64547706", "0.64504176", "0.6420758", "0.6391046", "0.6360697", "0.6349893", "0.63482225", "0.6348143", "0.6337626", "0.633585", "0.6322082", "0.63050413", "0.6303077", "0.62981564", "0.62915945", "0.62908185", "0.6285341", "0.62689745", "0.6239857", "0.6237187", "0.6235501", "0.61824113", "0.61824113", "0.61824113", "0.61824113", "0.61824113", "0.61824113", "0.61824113", "0.61824113", "0.61824113", "0.6181538", "0.6179949", "0.61793894", "0.6178074", "0.61694217", "0.61652625", "0.6154581", "0.6154314", "0.61503875", "0.6141443", "0.6139322", "0.60917836", "0.6085885", "0.6071573", "0.6071573", "0.6071573", "0.6071573", "0.6071573", "0.6071573", "0.6061823", "0.6044641", "0.6043541", "0.6042244", "0.6004428", "0.59989053", "0.5998766", "0.5996735", "0.5962485", "0.59539783", "0.5949161", "0.59466934", "0.59437084", "0.5928042", "0.5924772", "0.5920416", "0.5920416", "0.591276" ]
0.64812857
32
O(m + n) time, m and n are matrix dimension
public int countNegatives(int[][] grid) { int result = 0; int m = grid.length, n= grid[0].length; int[] pos = new int[] {0, n - 1}; while(pos[0] < m && pos[1] > -1) { if (grid[pos[0]][pos[1]] < 0) { result += (m - pos[0]); pos[1]--; } else { pos[0]++; } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int[][] generateMatrix(int n) {\n\t \n\t int matrix[][] = new int[n][n];\n\t int count = n * n +1;\n int topRow = 0;\n int bottomRow = n-1;\n int leftmostColumn = 0;\n int rightmostColumn = n -1;\n int added = 0;\n\t \n\t \n\t while(leftmostColumn <= rightmostColumn && topRow<= bottomRow && added <= count){\n \n \n \tif(added != count){\n for(int i = leftmostColumn; i <= rightmostColumn;i++){\n \t matrix[topRow][i] = added +1;\n // #arrList.add(matrix[topRow][i]);\n added = added+1;\n /* if(added == count)\n \tbreak;*/\n }\n topRow = topRow +1;\n \t}\n \n \n \tif(added != count){\t\n for(int j = topRow; j <= bottomRow;j++){\n //arrList.add(matrix[j][rightmostColumn]);\n \t matrix[j][rightmostColumn] = added+1;\n added = added+1;\n /*if(added == count)\n \tbreak;*/\n }\n rightmostColumn = rightmostColumn -1;\n \t} \n \t\n \t\n \tif(added != count){\t\n for(int k = rightmostColumn; k >= leftmostColumn; k--){\n \t matrix[bottomRow][k] = added +1;\n //arrList.add(matrix[bottomRow][k]);\n added = added+1;\n /*if(added == count)\n \tbreak;*/\n }\n bottomRow = bottomRow -1;\n \t}\n \t\n \t\n \tif(added != count){\t\n for(int l = bottomRow; l >= topRow ;l--){\n // arrList.add(matrix[l][leftmostColumn]);\n \t matrix[l][leftmostColumn] = added +1;\n added = added+1;\n /*if(added == count)\n \tbreak;*/\n }\n leftmostColumn = leftmostColumn +1;\n \t}\n \n }\n\t \n\t return matrix;\n \n}", "static Matrix vectorize(Matrix input) {\n int m = input.getRowDimension();\n int n = input.getColumnDimension();\n\n Matrix result = new Matrix(m * n, 1);\n for (int p = 0; p < n; p++) {\n for (int q = 0; q < m; q++) {\n result.set(p * m + q, 0, input.get(q, p));\n }\n }\n return result;\n }", "public static List<List<Integer>> findMatrix(List<List<Integer>> a) {\n List<List<Integer>> res = new ArrayList<>();\n for (int i = 0; i < a.size(); i++) {\n List<Integer> rowi = a.get(i);\n List<Integer> temp = new ArrayList<>();\n int prev = 0;\n for (int j = 0; j < rowi.size(); j++) {\n if (i == 0) {\n int curr = rowi.get(j);\n temp.add(prev + curr);\n prev += curr;\n } else {\n int curr = rowi.get(j);\n int lastSum = res.get(i - 1).get(j);\n temp.add(prev + curr + lastSum);\n prev += curr;\n }\n }\n res.add(temp);\n }\n return res;\n }", "private static void rotateMatrix(int[][] matrix) {\n\n\t\t// Assume: the elements are integer, and are unique values so that the result\n\t\t// can be tested for correctness.\n\t\t// Question: are the dimensions square? i.e. row and column count are the same?\n\t\t// Assume Yes.\n\t\t// Question: Which direction should the array be rotated - Assume clockwise\n\n\t\t// Iterate from counter min to max - 1\n\t\t// Copy top row first cell into a temp variable.\n\t\t// Copy each corner into the next corner. Use temp variable to fill the last\n\t\t// corner\n\t\t// Decrement counter and perform for next set of cells\n\t\t// Repeat for inner layers.\n\n\t\t// Bounding Co-ordinates: matrix[min][min], matrix[min, max], matrix[max, max],\n\t\t// matrix[max, min]\n\t\t// Initially: min = 0, max = N-1 (i.e. 0 based array positions)\n\t\t// pos = min\n\t\t// While pos < max\n\t\t// temp = matrix[min][pos]\n\t\t// matrix[min][pos] = matrix[max - pos + min][min]\n\t\t// matrix[max - pos + min][min] = matrix[max][max - pos + min]\n\t\t// matrix[max][max - pos + min] = matrix[pos][max]\n\t\t// matrix[pos][max] = temp\n\t\t// Increment pos\n\t\t// Increment min and decrement max\n\t\t// Break when min >= max\n\t\t// For even N, the last grid will be a 2 X 2 matrix, for odd N, the last grid\n\t\t// will be a single cell\n\n\t\t// T.C. N/2 iterations of the while loop (for even N)\n\t\t// T.C. = (N - 1) + (N-3) + .. 1\n\t\t// [first calls executes 5 for loops, each N-1 times. last call executes 2*2\n\t\t// matrix. i.e. N-1 = 1]\n\t\t// = (N-1 + N-3 + .. + 1) = (N-1 + N-3 + ... + N-(N-1))\n\t\t// = (N*N/2 - (1 + 3 + .. + N-1))\n\t\t// Sum of n even no.s = n(n+1)\n\t\t// Sum of n odd no.s = N(N+1)/2 - n(n+1). Where N = Max of odd no. + 1\n\t\t// T.C. = (N*N/2 - (N(N+1)/2 - N/2 * (N/2 + 1)))\n\t\t// = ( N*N/2 - (N*N/2 + N/2 - N*N/4 - N/2)) = (N*N/4)\n\t\t// T.C = O(N*N), this is the best possible T.C as each element needs to be\n\t\t// visited once.\n\t\t// S.C. O(1)\n\n\t\tif (matrix == null || matrix.length == 0)\n\t\t\treturn;\n\n\t\tif (matrix.length != matrix[0].length)\n\t\t\tthrow new NotASquareMatrixException(\"Not a square matrix. Cannot be rotated in place.\");\n\n\t\tint min = 0;\n\t\tint max = matrix.length - 1;\n\t\tprint(matrix);\n\n\t\twhile (min < max) {\n\t\t\trotateCellsInALayer(matrix, min, max);\n\t\t\tprint(matrix);\n\t\t\tmin++;\n\t\t\tmax--;\n\t\t}\n\t}", "public int[][] generateMatrix(int n) {\n int[][] matrix = new int[n][n];\n int counter = 1;\n for(int layer = 0; layer < (n + 1)/2; layer++){\n matrix[layer][layer] = counter++;\n for(int i = layer + 1; i < n - layer; i++) matrix[layer][i] = counter++;\n for(int i = layer + 1; i < n - layer; i++) matrix[i][n-layer-1] = counter++;\n //if(layer == (n + 1)/2 - 1 && n % 2 == 1) break;\n for(int i = n - layer - 2; i >= layer; i--) matrix[n-layer-1][i] = counter++;\n for(int i = n - layer - 2; i > layer; i--) matrix[i][layer] = counter++;\n }\n return matrix;\n }", "public static void LeMatriz(int M[ ][ ], int n) {\n\t\tint i,j;\n\t\tfor (i=0;i<n;i++){\n\t\t\tSystem.out.print( \"\\n\");\n\t\t\tfor (j=0;j<n;j++){\n\t\t\t\tM[i][j] = teclado1.nextInt();\n\t\t\t}\n\t\t}\n\t}", "public int[][] generateMatrix(int n) {\n int[][] result = new int[n][n];\n int val = 1;\n int rowBegin = 0;\n int colBegin = 0;\n int rowEnd = n - 1;\n int colEnd = n - 1;\n while (rowBegin <= rowEnd && colBegin <= colEnd) {\n // travel right\n for (int j = colBegin; j <= colEnd; j++) {\n result[rowBegin][j] = val++;\n }\n rowBegin++;\n // travel down\n for (int i = rowBegin; i <= rowEnd; i++) {\n result[i][colEnd] = val++;\n }\n colEnd--;\n // travel left\n if (rowBegin <= rowEnd) {\n for (int j = colEnd; j >= colBegin; j--) {\n result[rowEnd][j] = val++;\n }\n }\n rowEnd--;\n // travel up\n if (colBegin <= colEnd) {\n for (int i = rowEnd; i >= rowBegin; i--) {\n result[i][colBegin] = val++;\n }\n }\n colBegin++;\n }\n return result;\n\n }", "boolean ompleMatriuRestant(int i, int j) {\r\n // System.out.println(i+\" \"+j); \r\n if (j >= N && i < N - 1) {\r\n i = i + 1;\r\n j = 0;\r\n }\r\n if (i >= N && j >= N) {\r\n return true;\r\n }\r\n\r\n if (i < SRN) {\r\n if (j < SRN) {\r\n j = SRN;\r\n }\r\n } else if (i < N - SRN) {\r\n if (j == (int) (i / SRN) * SRN) {\r\n j = j + SRN;\r\n }\r\n } else {\r\n if (j == N - SRN) {\r\n i = i + 1;\r\n j = 0;\r\n if (i >= N) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n for (int num = 1; num <= N; num++) {\r\n if (validaNumero(i, j, num)) {\r\n mat[i][j] = num;\r\n if (ompleMatriuRestant(i, j + 1)) {\r\n return true;\r\n }\r\n\r\n mat[i][j] = 0;\r\n }\r\n }\r\n return false;\r\n }", "public int fillingOfMatrix(){\n int count=0;\n for (int i=0;i<m;i++)\n count+=matrix[i].size();\n return count;\n }", "public int matrixScore(int[][] A) {\n int n = A.length, m = A[0].length, ans = 0;\n for (int i = 0; i < n; ++i) {\n if (A[i][0] == 0) {\n flipRow(A, i);\n }\n }\n for (int j = 1; j < m; ++j) {\n int cnt = 0;\n for (int i = 0; i < n; ++i) {\n cnt += A[i][j];\n }\n if (cnt * 2 < n) {\n flipCol(A, j);\n }\n }\n for (int i = 0; i < n; ++i) {\n int cur = 0;\n for (int j = 0; j < m; ++j) {\n cur = (cur << 1) + A[i][j];\n }\n ans += cur;\n }\n return ans;\n}", "private final int m()\n\t { int n = 0;\n\t int i = 0;\n\t while(true)\n\t { if (i > j) return n;\n\t if (! cons(i)) break; i++;\n\t }\n\t i++;\n\t while(true)\n\t { while(true)\n\t { if (i > j) return n;\n\t if (cons(i)) break;\n\t i++;\n\t }\n\t i++;\n\t n++;\n\t while(true)\n\t { if (i > j) return n;\n\t if (! cons(i)) break;\n\t i++;\n\t }\n\t i++;\n\t }\n\t }", "private static int findCollision(int[][] matrix, int n) {\n int count = 0;\n for (int i = 0; i <= n - 1; i++) {\n for (int j = 0; j <= n - 1; j++) {\n if (matrix[i][j] == 1) {\n // left row\n for (int k = j - 1; k >= 0; k--) {\n if (matrix[i][k] == 2) {\n break;\n }\n if (matrix[i][k] == 1) {\n count++;\n }\n }\n // right row\n for (int k = j + 1; k <= n - 1; k++) {\n if (matrix[i][k] == 2) {\n break;\n }\n if (matrix[i][k] == 1) {\n count++;\n }\n }\n // up col\n for (int k = i - 1; k >= 0; k--) {\n if (matrix[k][j] == 2) {\n break;\n }\n if (matrix[k][j] == 1) {\n count++;\n }\n }\n // down col\n for (int k = i + 1; k <= n - 1; k++) {\n if (matrix[k][j] == 2) {\n break;\n }\n if (matrix[k][j] == 1) {\n count++;\n }\n }\n // up left\n for (int k = i - 1, l = j - 1; k >= 0 && l >= 0; k--, l--) {\n if (matrix[k][l] == 2) {\n break;\n }\n if (matrix[k][l] == 1) {\n count++;\n }\n }\n // down left\n for (int k = i + 1, l = j - 1; k <= n - 1 && l >= 0; k++, l--) {\n if (matrix[k][l] == 2) {\n break;\n }\n if (matrix[k][l] == 1) {\n count++;\n }\n }\n // up right\n for (int k = i - 1, l = j + 1; k >= 0 && l <= n - 1; k--, l++) {\n if (matrix[k][l] == 2) {\n break;\n }\n if (matrix[k][l] == 1) {\n count++;\n }\n }\n // down right\n for (int k = i + 1, l = j + 1; k <= n - 1 && l <= n - 1; k++, l++) {\n if (matrix[k][l] == 2) {\n break;\n }\n if (matrix[k][l] == 1) {\n count++;\n }\n }\n }\n }\n }\n return count / 2;\n }", "public int[][] updateMatrix(int[][] matrix) {\n for(int i = 0; i < matrix.length; i++) {\n for(int j = 0; j < matrix[0].length; j++) {\n if(matrix[i][j] == 0) continue;\n matrix[i][j] = 10; // You can use any integer bigger than 1 except Integer.MAX_VALUE, overflow.\n if(i > 0) matrix[i][j] = Math.min(matrix[i - 1][j] + 1, matrix[i][j]);\n if(j > 0) matrix[i][j] = Math.min(matrix[i][j - 1] + 1, matrix[i][j]);\n }\n }\n\n for(int i = matrix.length - 1; i >= 0; i--) {\n for(int j = matrix[0].length - 1; j >= 0; j--) {\n if(i < matrix.length - 1) matrix[i][j] = Math.min(matrix[i + 1][j] + 1, matrix[i][j]);\n if(j < matrix[0].length - 1) matrix[i][j] = Math.min(matrix[i][j + 1] + 1, matrix[i][j]);\n }\n }\n return matrix;\n }", "public static int f2(int N) { \n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n)\n // O(n)`\n for(int j = 0; j < i; j++) \n x++;\n return x;\n }", "public int m(){\n int m = 0;\n // looping through adj matrix to check if edge.\n // increments counter if so.\n for (int i = 0; i < n; i++){\n for (int j = 0; j < n; j++){\n if (edges[i][j] > 0){\n m++;\n }\n }\n }\n return m / 2;\n }", "public int[][] generateMatrix(int n) {\n\t\tint[][] res = new int[n][n];\r\n\t\tint x = 0;\r\n\t\tint num = 1;\r\n\t\twhile (n > 1) {\r\n\t\t\tfor (int i = x; i < x + n - 1; i++)\r\n\t\t\t\tres[x][i] = num++;\r\n\t\t\tfor (int i = x; i < x + n - 1; i++)\r\n\t\t\t\tres[i][x + n - 1] = num++;\r\n\t\t\tfor (int i = x + n - 1; i > x; i--)\r\n\t\t\t\tres[x + n - 1][i] = num++;\r\n\t\t\tfor (int i = x + n - 1; i > x; i--)\r\n\t\t\t\tres[i][x] = num++;\r\n\t\t\tn -= 2;\r\n\t\t\tx++;\r\n\t\t}\r\n\t\tif (n == 1)\r\n\t\t\tres[x][x] = num;\r\n\t\treturn res;\r\n\t}", "private void matrixChainOrder(int[] p) {\n // Initial the cost for the empty subproblems.\n for (int i = 1; i <= n; i++) {\n m[i][i] = 0;\n }\n\n // Solve for chains of increasing length l.\n for (int l = 2; l <= n; l++) {\n for (int i = 1; i <= n - l + 1; i++) {\n int j = i + l - 1;\n m[i][j] = Integer.MAX_VALUE;\n\n // Check each possible split to see if it's better\n // than all seen so far.\n for (int k = i; k < j; k++) {\n int q = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];\n if (q < m[i][j]) {\n // q is the best split for this subproblem so far.\n m[i][j] = q;\n s[i][j] = k;\n }\n }\n }\n }\n }", "protected abstract NDArray[] onMatrix(NDArray matrix);", "static int MatrixChainOrder(int p[], int n) {\n /* For simplicity of the program, one extra row and one\n extra column are allocated in m[][]. 0th row and 0th\n column of m[][] are not used */\n int m[][] = new int[n][n];\n\n int i, j, k, L, q;\n\n /* m[i,j] = Minimum number of scalar multiplications needed to compute the matrix\n A[i]A[i+1]...A[j] = A[i..j] where dimension of A[i] is p[i-1] x p[i] */\n\n // cost is zero when multiplying one matrix.\n for (i = 1; i < n; i++) m[i][i] = 0;\n\n // L is chain length.\n for (L = 2; L < n; L++) {\n for (i = 1; i < n - L + 1; i++) {\n j = i + L - 1;\n if (j == n) continue;\n m[i][j] = Integer.MAX_VALUE;\n for (k = i; k <= j - 1; k++) {\n // q = cost/scalar multiplications\n q = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];\n if (q < m[i][j])\n m[i][j] = q;\n }\n }\n }\n\n return m[1][n - 1];\n }", "public List<List<GenPolynomial<C>>> \n normalizeMatrix(int flen, List<List<GenPolynomial<C>>> M) { \n if ( M == null ) {\n return M;\n }\n if ( M.size() == 0 ) {\n return M;\n }\n List<List<GenPolynomial<C>>> N = new ArrayList<List<GenPolynomial<C>>>();\n List<List<GenPolynomial<C>>> K = new ArrayList<List<GenPolynomial<C>>>();\n int len = M.get( M.size()-1 ).size(); // longest row\n // pad / extend rows\n for ( List<GenPolynomial<C>> row : M ) {\n List<GenPolynomial<C>> nrow = new ArrayList<GenPolynomial<C>>( row );\n for ( int i = row.size(); i < len; i++ ) {\n nrow.add( null );\n }\n N.add( nrow );\n }\n // System.out.println(\"norm N fill = \" + N);\n // make zero columns\n int k = flen;\n for ( int i = 0; i < N.size(); i++ ) { // 0\n List<GenPolynomial<C>> row = N.get( i );\n if ( debug ) {\n logger.info(\"row = \" + row);\n }\n K.add( row );\n if ( i < flen ) { // skip identity part\n continue;\n }\n List<GenPolynomial<C>> xrow;\n GenPolynomial<C> a;\n //System.out.println(\"norm i = \" + i);\n for ( int j = i+1; j < N.size(); j++ ) {\n List<GenPolynomial<C>> nrow = N.get( j );\n //System.out.println(\"nrow j = \" +j + \", \" + nrow);\n if ( k < nrow.size() ) { // always true\n a = nrow.get( k );\n //System.out.println(\"k, a = \" + k + \", \" + a);\n if ( a != null && !a.isZERO() ) {\n xrow = blas.scalarProduct( a, row);\n xrow = blas.vectorAdd(xrow,nrow);\n //System.out.println(\"xrow = \" + xrow);\n N.set( j, xrow );\n }\n }\n }\n k++;\n }\n //System.out.println(\"norm K reduc = \" + K);\n // truncate \n N.clear();\n for ( List<GenPolynomial<C>> row: K ) {\n List<GenPolynomial<C>> tr = new ArrayList<GenPolynomial<C>>();\n for ( int i = 0; i < flen; i++ ) {\n tr.add( row.get(i) );\n }\n N.add( tr );\n }\n K = N;\n //System.out.println(\"norm K trunc = \" + K);\n return K;\n }", "@Override\n public Matrix idct(final MatrixView in) {\n check(in);\n double[][] out = new double[in.getRows()][in.getColumns()];\n double tmp1, tmp2, tmp3, tmp4;\n double tmpm0 = 0, tmpm1 = 0, tmpm2 = 0, tmpm3 = 0, tmpm4 = 0, tmpm5 = 0, tmpm6 = 0, tmpm7 = 0;\n double tmpm20, tmpm21, tmpm22, tmpm23, tmpm24, tmpm25, tmpm26, tmpm27 = 0;\n double[] outtmpmyi = null;\n\n for (int my = 0; my < in.getRows(); my += SIZE) {\n for (int mx = 0; mx < in.getColumns(); mx += SIZE) {\n for (int i = 0; i < 8; i++) {\n outtmpmyi = out[my + i];\n\n tmpm0 = in.getDouble(my + i, mx + 0);\n tmpm1 = in.getDouble(my + i, mx + 1);\n tmpm2 = in.getDouble(my + i, mx + 2);\n tmpm3 = in.getDouble(my + i, mx + 3);\n tmpm4 = in.getDouble(my + i, mx + 4);\n tmpm5 = in.getDouble(my + i, mx + 5);\n tmpm6 = in.getDouble(my + i, mx + 6);\n tmpm7 = in.getDouble(my + i, mx + 7);\n\n tmp1 = (tmpm1 * Z7) - (tmpm7 * Z1);\n tmp4 = (tmpm7 * Z7) + (tmpm1 * Z1);\n tmp2 = (tmpm5 * Z3) - (tmpm3 * Z5);\n tmp3 = (tmpm3 * Z3) + (tmpm5 * Z5);\n\n tmpm20 = (tmpm0 + tmpm4) * Z4;\n tmpm21 = (tmpm0 - tmpm4) * Z4;\n tmpm22 = (tmpm2 * Z6) - (tmpm6 * Z2);\n tmpm23 = (tmpm6 * Z6) + (tmpm2 * Z2);\n tmpm4 = tmp1 + tmp2;\n tmpm25 = tmp1 - tmp2;\n tmpm26 = tmp4 - tmp3;\n tmpm7 = tmp4 + tmp3;\n\n tmpm5 = (tmpm26 - tmpm25) * Z0;\n tmpm6 = (tmpm26 + tmpm25) * Z0;\n tmpm0 = tmpm20 + tmpm23;\n tmpm1 = tmpm21 + tmpm22;\n tmpm2 = tmpm21 - tmpm22;\n tmpm3 = tmpm20 - tmpm23;\n\n outtmpmyi[mx + 0] = tmpm0 + tmpm7;\n outtmpmyi[mx + 7] = tmpm0 - tmpm7;\n outtmpmyi[mx + 1] = tmpm1 + tmpm6;\n outtmpmyi[mx + 6] = tmpm1 - tmpm6;\n outtmpmyi[mx + 2] = tmpm2 + tmpm5;\n outtmpmyi[mx + 5] = tmpm2 - tmpm5;\n outtmpmyi[mx + 3] = tmpm3 + tmpm4;\n outtmpmyi[mx + 4] = tmpm3 - tmpm4;\n\n }\n\n for (int i = 0; i < 8; i++) {\n\n tmpm0 = out[my + 0][mx + i];\n tmpm1 = out[my + 1][mx + i];\n tmpm2 = out[my + 2][mx + i];\n tmpm3 = out[my + 3][mx + i];\n tmpm4 = out[my + 4][mx + i];\n tmpm5 = out[my + 5][mx + i];\n tmpm6 = out[my + 6][mx + i];\n tmpm7 = out[my + 7][mx + i];\n\n tmp1 = (tmpm1 * Z7) - (tmpm7 * Z1);\n tmp4 = (tmpm7 * Z7) + (tmpm1 * Z1);\n tmp2 = (tmpm5 * Z3) - (tmpm3 * Z5);\n tmp3 = (tmpm3 * Z3) + (tmpm5 * Z5);\n\n tmpm20 = (tmpm0 + tmpm4) * Z4;\n tmpm21 = (tmpm0 - tmpm4) * Z4;\n tmpm22 = (tmpm2 * Z6) - (tmpm6 * Z2);\n tmpm23 = (tmpm6 * Z6) + (tmpm2 * Z2);\n tmpm4 = tmp1 + tmp2;\n tmpm25 = tmp1 - tmp2;\n tmpm26 = tmp4 - tmp3;\n tmpm7 = tmp4 + tmp3;\n\n tmpm5 = (tmpm26 - tmpm25) * Z0;\n tmpm6 = (tmpm26 + tmpm25) * Z0;\n tmpm0 = tmpm20 + tmpm23;\n tmpm1 = tmpm21 + tmpm22;\n tmpm2 = tmpm21 - tmpm22;\n tmpm3 = tmpm20 - tmpm23;\n\n out[my + 0][mx + i] = tmpm0 + tmpm7;\n out[my + 7][mx + i] = tmpm0 - tmpm7;\n out[my + 1][mx + i] = tmpm1 + tmpm6;\n out[my + 6][mx + i] = tmpm1 - tmpm6;\n out[my + 2][mx + i] = tmpm2 + tmpm5;\n out[my + 5][mx + i] = tmpm2 - tmpm5;\n out[my + 3][mx + i] = tmpm3 + tmpm4;\n out[my + 4][mx + i] = tmpm3 - tmpm4;\n }\n }\n }\n\n return new DoubleMatrix(in.getRows(), in.getColumns(), out);\n }", "public static int[] findDiagonalOrder(int[][] matrix){\n if( matrix == null || matrix.length == 0)\n return new int[0];\n int i = 0;\n int j =0;\n int k = 0;\n int size = matrix.length * matrix[0].length;\n int[] result = new int[size];\n boolean moveUp =true;\n while(k< size){\n\n if(moveUp){\n for(;i >=0 && j<= matrix[0].length-1;i--, j++){\n result[k] = matrix[i][j];\n k++;\n }\n // while moving up there are two conditions\n// 1. only row moves beyod 0 th row and column is in range (check for both row and column)\n //2. both row and column moves out ( check for column only)\n //case 1\n if(i<0 && j <= matrix[0].length-1){\n i = 0; // reset row to 0 and move down\n moveUp = !moveUp;\n }\n //case 2\n if(j == matrix[0].length){\n i = i+2; // reset row\n j--; // reduce column and move down\n moveUp = !moveUp;\n }\n\n }\n else\n {\n // moving down increment row and decrement column\n for(;j>=0 && i <= matrix.length - 1; i++, j-- ){\n result[k] = matrix[i][j];\n k++;\n }\n // while moving down there are two cases\n // 1. column goes out but rows in order (we need to check both)\n // 2. both column and row goes out (we can only have row check)\n if(j < 0 && i<= matrix.length-1){\n j = 0;\n moveUp = !moveUp;\n }\n if( i == matrix.length){\n j = j+2;\n i--;\n moveUp = !moveUp;\n }\n\n }\n\n\n }\n return result;\n }", "public static void betterApproach(int matrix[][]){\n\t\t\n\t\tint m = matrix.length;\n\t\tint n = matrix[0].length;\n\t\tboolean auxR[] = new boolean[m];\n\t\tboolean auxC[] = new boolean[n];\n\t\t\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tauxR[i] = false;\n\t\t}\n\t\t\n\t\tfor(int j = 0;j<n;j++){\n\t\t\tauxC[j] = false;\n\t\t}\n\t\t\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tfor(int j = 0;j<n;j++){\n\t\t\t\tif(matrix[i][j] == 0){\n\t\t\t\t\tauxR[i] = true;\n\t\t\t\t\tauxC[j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tfor(int j = 0;j<n;j++){\n\t\t\t\tif(auxR[i] == true || auxC[j] == true){\n\t\t\t\t\tmatrix[i][j] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private int A(int n, int m) {\n int res = 1;\n for (int i = 0; i < m; n++)\n res *= n;\n return res;\n }", "static void update(int[][] matrix){\n\t\tboolean rowFlag = false;\n\t\tboolean colFlag = false;\n\t\tint n = matrix.length;\n int m = matrix[0].length;\n for(int i=0;i<n;i++){\n for(int j=0;j<m;j++){\n if(i==0 && matrix[i][j]==0){\n rowFlag =true;\n }\n if(j==0 && matrix[i][j]==0){\n colFlag = true;\n }\n if(matrix[i][j]==0){\n matrix[0][j] = 0;\n matrix[i][0] = 0;\n }\n }\n }\n for(int i=1;i<n;i++){\n for(int j=1;j<m;j++){\n if(matrix[i][0]==0||matrix[0][j]==0){\n matrix[i][j]=0;\n }\n }\n }\n if(rowFlag){\n for(int i=0;i<m;i++){\n matrix[0][i] =0 ;\n }\n }\n if(colFlag){\n for(int j=0;j<n;j++){\n matrix[j][0] = 0;\n }\n }\n\n\t}", "public int[] findDiagonalOrder(int[][] matrix) {\n \n int n = matrix.length; if(n == 0) return new int[0];\n int m = matrix[0].length; if(m == 0) return new int[0];\n int i = 0, j = 0, idx = 0;\n int[] ret = new int[n*m];\n boolean up = true;\n while(i < n && j < m){\n ret[idx++] = matrix[i][j];\n if(up){\n if(inBound(i-1, n, j+1, m)){\n i = i-1; j = j+1;\n }else if(inBound(i, n, j+1, m)){ //try right\n j = j+1; up = !up;\n }else if(inBound(i+1, n, j, m)){ // try bot\n i = i+1; up = !up;\n }else{\n i++; j++; // hit end;\n }\n }else{\n if(inBound(i+1, n, j-1, m)){\n i = i+1; j = j-1;\n }else if(inBound(i+1, n, j, m)){ // try bot\n i = i+1; up = !up;\n }else if(inBound(i, n, j+1, m)){ // try right\n j = j+1; up = !up;\n }else{\n i++; j++; // hit end;\n }\n }\n }\n return ret;\n }", "public int[][] generateMatrix(int n) {\n\t\tif (n <= 0) {\n\t\t\treturn new int[0][0];\n\t\t}\n\n\t\tint[][] res = new int[n][n];\n\t\tint num = 1;\n\t\tint r1 = 0, c1 = 0, r2 = n-1, c2 = n-1;\n\t\twhile (r1 <= r2 && c1 <= c2) {\n\t\t\tfor (int c = c1; c <= c2; c++) {\n\t\t\t\tres[r1][c] = num++;\n\t\t\t}\n\n\t\t\tfor (int r = r1 + 1; r <= r2; r++) {\n\t\t\t\tres[r][c2] = num++;\n\t\t\t}\n\n\t\t\tif (r1 < r2) {\n\t\t\t\tfor (int c = c2 - 1; c > c1; c--) {\n\t\t\t\t\tres[r2][c] = num++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (c1 < c2) {\n\t\t\t\tfor (int r = r2; r > r1; r--) {\n\t\t\t\t\tres[r][c1] = num++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tr1++;\n\t\t\tc1++;\n\t\t\tr2--;\n\t\t\tc2--;\n\t\t}\n\n\t\treturn res;\n\t}", "public static void bestApproach(int matrix[][]){\n\t\t\n\t\tint m = matrix.length;\n\t\tint n = matrix[0].length;\n\t\t\n\t\t//Taking two variables for storing status of first row and column\n\t\tboolean firstRow = false;\n\t\tboolean firstColumn = false;\n\t\t\n\t\t//any element except for first row and first column is zero\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tfor(int j = 0;j<n;j++){\n\t\t\t\tif(matrix[i][j] == 0){\n\t\t\t\t\tif(i == 0) firstRow == true;\n\t\t\t\t\tif(j == 0) firstColumn == true;\n\t\t\t\t\t//Making first row and first column as zero\n\t\t\t\t\tmatrix[i][0] = 0;\n\t\t\t\t\tmatrix[0][j] = 0;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//any element except for first row and first column is zero\n\t\tfor(int i = 1;i<m;i++){\n\t\t\t\n\t\t\tfor(int j = 1;j<n;j++){\n\t\t\t\t//based on first row and first column making the entire column and row as zero\n\t\t\t\tif(matrix[0][j] == 0 || matrix[i][0] == 0){\n\t\t\t\t\t//Making first row and first column as zero\n\t\t\t\t\tmatrix[i][j] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//Making every column value to 0 in first row\n\t\tif(firstRow){\n\t\t\t\n\t\t\tfor(int j = 0;j <n;j++){\n\t\t\t\tmatrix[0][j] = 0;\n\t\t\t}\n\t\t}\n\t\t//Making every row value to 0 in first column\n\t\tif(firstColumn){\n\t\t\t\n\t\t\tfor(int i = 0;i <m;i++){\n\t\t\t\tmatrix[i][0] = 0;\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t\tScanner input = new Scanner(System.in);\r\n\t\t\r\n\t\tSystem.out.print(\"Unesite velicinu n x n matrice: \");\r\n\t\tint n = input.nextInt(); // unos n x n matrice n = broj redova i kolona matrice\r\n\r\n\t\tint[][] matrix = new int[n][n];\r\n\t\tArrayList<Integer> maxR = new ArrayList<>();\r\n\t\tArrayList<Integer> maxK = new ArrayList<>();\r\n\r\n\t\tSystem.out.println(\"Matrica: \");\r\n\t\tfor(int i=0; i<matrix.length; i++) {\r\n\t\t\tfor(int j=0; j<matrix[0].length; j++) {\r\n\t\t\t\tmatrix[i][j] = (int)(Math.random()*2); // punjenje matrice integerima 0 i 1\r\n\t\t\t\tSystem.out.print(matrix[i][j] + \" \"); // ispis matrice u konzolu\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t\t\r\n\t\tint sumaR = 0, sumaK = 0, totalSumaR, totalSumaK, nula = 0;\r\n\t\t\r\n\t\tfor(int j=0; j<matrix[0].length; j++) {\r\n\t\t\tsumaR += matrix[0][j]; // suma reda matrice\r\n\t\t}\r\n\t\t\r\n\t\tfor(int i=0; i<matrix.length; i++) {\r\n\t\t\tsumaK += matrix[i][0]; // suma kolona matrice\r\n\t\t}\r\n\t\tfor(int i=0; i<matrix.length; i++) { // za sve elemente matrice\r\n\t\t\ttotalSumaR = 0;\r\n\t\t\ttotalSumaK = 0;\r\n\t\t\tfor(int j=0; j<matrix[i].length; j++) {\r\n\t\t\t\ttotalSumaR += matrix[i][j]; // suma svih redova matrice\r\n\t\t\t\ttotalSumaK += matrix[j][i]; // suma svih kolona matrice\r\n\t\t\t\tif(totalSumaR > sumaR) { // ako bilo koji red matrice ima vecu sumu od sume prvog reda matrice\r\n\t\t\t\t\tsumaR = totalSumaR; // taj red postaje red sa najvecom sumom\r\n\t\t\t\t\tmaxR.clear(); // brisu se stare pozicije redova sa najvecom sumom\r\n\t\t\t\t\tmaxR.add(i); // ubacivanje broja indexa reda sa najvecom sumom u listu\t\r\n\t\t\t\t} else if(totalSumaR == sumaR) { // ako je ukupna suma zadnjeg reda jednak najvecoj sumi reda\r\n\t\t\t\t\t//maxR.clear(); brisu se ostale pozicije redova sa najvecom sumom u listi (ako trazimo samo zadnji red sa najvise 1)\r\n\t\t\t\t\tmaxR.add(i); // dodaje se krajnja pozicija najvece sume reda u listi\r\n\t\t\t\t}\r\n\t\t\t\tif(totalSumaK > sumaK) { // ako bilo koja kolona matrice ima vecu sumu od sume prve kolone matrice\r\n\t\t\t\t\tsumaK = totalSumaK; // ta kolona postaje kolona sa najvecom sumom\r\n\t\t\t\t\tmaxK.clear(); // brisu se stare pozicije kolone sa najvecom sumom\r\n\t\t\t\t\tmaxK.add(i); // ubacivanje broja indexa kolone sa najvecom sumom u listu\r\n\t\t\t\t} else if(totalSumaK == sumaK) { // ako je ukupna suma zadnje kolone jednaka najvecoj sumi kolone\r\n\t\t\t\t\t//maxK.clear(); brisu se ostale pozicije kolona sa najvecom sumom u listi (ako trazimo samo zadnju kolonu sa najvise 1)\r\n\t\t\t\t\tmaxK.add(i); // dodaje se krajnja pozicija najvece sume kolone u listi\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(maxR.isEmpty()) { // ako je lista prazna\r\n\t\t\tmaxR.add(nula); // ubaci u listu 0\r\n\t\t}\r\n\t\tSystem.out.print(\"Redovi sa najvise jedinica su: \");\r\n\t\tfor(int i=0; i<maxR.size(); i++) {\r\n\t\t\tSystem.out.print(maxR.get(i) + \" \"); // ispis pozicija najvece sume redova iz liste\r\n\t\t}\r\n\t\tif(maxK.isEmpty()) { // ako je lista prazna\r\n\t\t\tmaxK.add(nula); // ubaci u listu 0\r\n\t\t}\r\n\t\tSystem.out.print(\"\\nKolone sa najvise jedinica su: \");\r\n\t\tfor(int i=0; i<maxK.size(); i++) {\r\n\t\t\tSystem.out.print(maxK.get(i) + \" \"); // ispis pozicija najvece sume kolona iz liste\r\n\t\t}\r\n\t\t\r\n\t\tinput.close();\r\n\t}", "public int[][] generateMatrix(int n) {\n\t\tint[][] res = {};\n\t\tif (n <= 0) {\n\t\t\treturn res;\n\t\t}\n\t\tres = new int[n][n];\n\t\tint x = 0;\n\t\tint y = 0;\n\t\tint count = 1;\n\n\t\twhile (n > 0) {\n\t\t\tif (n == 1) {\n\t\t\t\tres[x][y] = count;\n\t\t\t}\n\t\t\t// move right\n\t\t\tfor (int i = 0; i < n - 1; ++i) {\n\t\t\t\tres[x][y++] = count++;\n\t\t\t}\n\t\t\t// move down\n\t\t\tfor (int i = 0; i < n - 1; ++i) {\n\t\t\t\tres[x++][y] = count++;\n\t\t\t}\n\t\t\t// move left\n\t\t\tfor (int i = 0; i < n - 1; ++i) {\n\t\t\t\tres[x][y--] = count++;\n\t\t\t}\n\t\t\t// move up\n\t\t\tfor (int i = 0; i < n - 1; ++i) {\n\t\t\t\tres[x--][y] = count++;\n\t\t\t}\n\t\t\tx = x + 1;\n\t\t\ty = y + 1;\n\t\t\tn = n - 2;\n\t\t}\n\t\treturn res;\n\t}", "Matrix add(Matrix M) {\n if(getSize() != M.getSize()) {\n throw new RuntimeException(\"Matrix Error: Matrices not same size\");\n }\n if (M.equals(this)) return M.scalarMult(2);\n int c = 0, e2 = 0;\n double v1 = 0, v2 = 0;\n List temp1, temp2;\n Matrix addM = new Matrix(getSize());\n for(int i = 1; i <= rows.length; i++) {\n temp1 = M.rows[i-1];\n temp2 = this.rows[i-1];\n if(temp1.isEmpty() && !temp2.isEmpty()) {\n temp2.moveFront();\n while(temp2.index() != -1) {\n addM.changeEntry(i, ((Entry)temp2.get()).column, ((Entry)temp2.get()).value);\n temp2.moveNext();\n }\n }else if(!temp1.isEmpty() && temp2.isEmpty()) {\n temp1.moveFront();\n while(temp1.index() != -1) {\n addM.changeEntry(i, ((Entry)temp1.get()).column, ((Entry)temp1.get()).value);\n temp1.moveNext();\n }\n }else if(!temp1.isEmpty() && !temp2.isEmpty()) {\n temp2.moveFront();\n temp1.moveFront();\n while(temp1.index() != -1 && temp2.index() != -1) {\n if(((Entry)temp1.get()).column == ((Entry)temp2.get()).column) {\n v1 = ((Entry)temp1.get()).value;\n v2 = ((Entry)temp2.get()).value;\n c = ((Entry)temp2.get()).column;\n addM.changeEntry(i, c, (v1+v2));\n temp1.moveNext();\n if(!this.equals(M))\n temp2.moveNext();\n ///if temp1 < temp2\n //this < M\n }else if(((Entry)temp1.get()).column < ((Entry)temp2.get()).column) {\n v1 = ((Entry)temp1.get()).value;\n c = ((Entry)temp1.get()).column;\n addM.changeEntry(i, c, v1);\n temp1.moveNext();\n //if temp1>temp2\n }else if(((Entry)temp1.get()).column > ((Entry)temp2.get()).column) {\n v2 = ((Entry)temp2.get()).value;\n c = ((Entry)temp2.get()).column;\n addM.changeEntry(i, c, v2);\n temp2.moveNext();\n }\n }\n while(temp1.index() != -1) {\n addM.changeEntry( i, ((Entry)temp1.get()).column, ((Entry)temp1.get()).value);\n temp1.moveNext();\n }\n while(temp2.index() != -1) {\n addM.changeEntry(i, ((Entry)temp2.get()).column, ((Entry)temp2.get()).value);\n temp2.moveNext();\n }\n }\n }\n return addM;\n }", "private static int[][] fillWithSum(int[][] matrix) {\n if (null == matrix || matrix.length == 0) {\n return null;\n }\n\n int M = matrix.length;\n int N = matrix[0].length;\n\n // fill leetcoce.matrix such that at given [i,j] it carries the sum from [0,0] to [i,j];\n int aux[][] = new int[M][N];\n\n // 1 2 3\n // 4 5 6\n // 7 8 9\n\n // 1. copy first row of leetcoce.matrix to aux\n for (int j = 0; j < N; j++) {\n aux[0][j] = matrix[0][j];\n }\n // after 1,\n // 1 2 3\n // 0 0 0\n // 0 0 0\n\n // 2. Do column wise sum\n for (int i = 1; i < M; i++) {\n for (int j = 0; j < N; j++) {\n aux[i][j] = matrix[i][j] + aux[i-1][j]; // column wise sum\n }\n }\n // after 2,\n // 1 2 3\n // 5 7 9\n // 12 15 18\n\n // 3. Do row wise sum\n for (int i = 0; i < M; i++) {\n for (int j = 1; j < N; j++) {\n aux[i][j] += aux[i][j-1];\n }\n }\n // after 3,\n // 1 3 6\n // 5 12 21\n // 12 27 45\n\n // sum between [1,1] to [2,2] = 45 + 1 - 12 - 6 = 46 - 18 = 28\n return aux;\n }", "public void MatrixMultiplication(int[][] edges, int n){\n\t\t\n\t\tint[][] W = new int[n][n];\n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tfor(int j = 0; j < n; ++j){\n\t\t\t\tif(i==j) W[i][j] = 0;\n\t\t\t\telse W[i][j] = Integer.MAX_VALUE;\n\t\t\t}\n\t\t\t//init the array is null, means no paths between each node\n\t\t}\n\t\t\n\t\tint[][] pre = new int[n][n];\n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tArrays.fill(pre[i], -1);\n\t\t\tpre[i][i] = i;\n\t\t}\n\t\t\n\t\t//input the edges to the matrix\n\t\tfor(int[] edge: edges){\n\t\t\tW[edge[0]][edge[1]] = edge[2];\n\t\t\t//init predecessor graph\n\t\t\tpre[edge[0]][edge[1]] = edge[0];\n\t\t}\n\t\t\n\t\t//matrix multiply, at the first, L is the W\n\t\tint[][] L = W;\n\t\t\n\t\t//solution 1\n\t\tfor(int m = 1; m < n; ++m){\n\t\t\tL = extend_shortest_path(L, W, pre);\n\t\t\t//solution 2, improve time complexity\n\t\t\t//could use L = extend_shortest_path(L, L, pre); m=2*m \n\t\t\t//to help quickly get L, \n\t\t\t//however, using this method will get the wrong pre[][]\n\t\t}\n\t\t\n\t\t/*System.out.println(\"pre: \");\n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tfor(int j = 0; j < n; ++j){\n\t\t\t\tSystem.out.print(pre[i][j] + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}*/\n\t\t\n\t\tfor(int i = 0; i < n; ++i){\n\t\t\tfor(int j = 0; j < n; ++j){\n\t\t\t\tSystem.out.print(\"The shortest path from \" + i + \" to \" + j + \" is \" + L[i][j] + \" : \" );\n\t\t\t\tprint_path(pre, i, j);\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t}", "private void reduceMatrix( final double[][] matrix )\n\t{\n\n\t\tfor ( int i = 0; i < matrix.length; i++ )\n\t\t{\n\n\t\t\t// find the min value in the row\n\t\t\tdouble minValInRow = Double.MAX_VALUE;\n\t\t\tfor ( int j = 0; j < matrix[ i ].length; j++ )\n\t\t\t{\n\t\t\t\tif ( minValInRow > matrix[ i ][ j ] )\n\t\t\t\t{\n\t\t\t\t\tminValInRow = matrix[ i ][ j ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// subtract it from all values in the row\n\t\t\tfor ( int j = 0; j < matrix[ i ].length; j++ )\n\t\t\t{\n\t\t\t\tmatrix[ i ][ j ] -= minValInRow;\n\t\t\t}\n\t\t}\n\n\t\tfor ( int i = 0; i < matrix[ 0 ].length; i++ )\n\t\t{\n\t\t\tdouble minValInCol = Double.MAX_VALUE;\n\t\t\tfor ( int j = 0; j < matrix.length; j++ )\n\t\t\t{\n\t\t\t\tif ( minValInCol > matrix[ j ][ i ] )\n\t\t\t\t{\n\t\t\t\t\tminValInCol = matrix[ j ][ i ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( int j = 0; j < matrix.length; j++ )\n\t\t\t{\n\t\t\t\tmatrix[ j ][ i ] -= minValInCol;\n\t\t\t}\n\n\t\t}\n\n\t}", "public int uniquePaths(int m, int n) {\n \t\tint[] res = new int[n]; // contain steps by which to reach entry in each row\n \t\tres[0] = 1;\n \t\tfor (int i = 0; i < m; i++) {\n \t\t\tfor (int j = 1; j < n; j++) {\n \t\t\t\tres[j] = res[j] + res[j - 1]; // res[j]旧值相当于dp[i - 1][j]\n \t\t\t}\n \t\t}\n \t\treturn res[n - 1];\n \t}", "public static int[][] task10_spiralGenerate(int m, int n) {\n\t\tif (m <= 0) {\n\t\t\t// !!! only m <= 0, return a empty array\n\t\t\treturn new int[][] {};\n\t\t}\n\t\tint rLen = m;\n\t\tint cLen = n;\n\t\tint[][] matrix = new int[m][n];\n\t\tint leftB = 0, rightB = cLen - 1;\n\t\tint upperB = 0, lowerB = rLen - 1;\n\t\tint counter = 1;\n\t\twhile (true) {\n\t\t\tfor (int j = leftB; j <= rightB; j++) {\n\t\t\t\tmatrix[upperB][j] = counter++;\n\t\t\t}\n\t\t\tupperB++;\n\t\t\tif (leftB > rightB || upperB > lowerB) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor (int i = upperB; i <= lowerB; i++) {\n\t\t\t\tmatrix[i][rightB] = counter++;\n\t\t\t}\n\t\t\trightB--;\n\t\t\tif (leftB > rightB || upperB > lowerB) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor (int j = rightB; j >= leftB; j--) {\n\t\t\t\tmatrix[lowerB][j] = counter++;\n\t\t\t}\n\t\t\tlowerB--;\n\t\t\tif (leftB > rightB || upperB > lowerB) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfor (int i = lowerB; i >= upperB; i--) {\n\t\t\t\tmatrix[i][leftB] = counter++;\n\t\t\t}\n\t\t\tleftB++;\n\t\t\tif (leftB > rightB || upperB > lowerB) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn matrix;\n\t}", "static void printMatrix(int[][] inp){\n\n for(int i=0;i<inp.length;i++){\n for(int j=0;j<inp[0].length;j++){\n System.out.print(inp[i][j]+\" \");\n }\n System.out.println(\"\");\n }\n }", "public static void main(String[] args) throws IOException {\n int max = 100000;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n N = Integer.parseInt(br.readLine());\n\n int arr[] = new int[max+1];\n\n for (int p=2; p<=99999; p++)\n {\n if (arr[p] == 0)\n { arr[p] = 1;\n for (int i=p*2; i<=max; i += p) {\n arr[i]++;\n }\n }\n }\n\n int mat[][] = new int[6][max+1];\n// for (int i = 2; i < arr.length; i++) {\n// mat[arr[i]][i] = 1;\n// }\n\n for (int i = 1; i < 6; i++) {\n for (int j = 2; j < mat[0].length; j++) {\n if(arr[j] == i) {\n mat[i][j] = mat[i][j - 1]+1;\n } else {\n mat[i][j] = mat[i][j - 1];\n }\n }\n }\n\n\n for (int i = 0; i < N; i++) {\n String str[] = br.readLine().split(\" \");\n int a = Integer.parseInt(str[0]);\n int b = Integer.parseInt(str[1]);\n int k = Integer.parseInt(str[2]);\n int ans = mat[k][b]-mat[k][a-1];\n System.out.println(ans);\n }\n }", "public int[][] generateMatrix(int n) {\n \n int[][] matrix = new int[n][n];\n \n int i = 0, j = 0, direction = 0;\n \n int right = n - 1, left = 0, top = 1, bottom = n - 1, count = 1;\n \n while (count <= n * n && i >= 0 && i < n && j >= 0 && j < n) {\n switch (direction) {\n case 0:\n if (j == right) {\n matrix[i++][j] = count;\n right--;\n direction = 1;\n } else {\n matrix[i][j++] = count;\n }\n break;\n case 1:\n if (i == bottom) {\n matrix[i][j--] = count;\n bottom--;\n direction = 2;\n } else {\n matrix[i++][j] = count;\n }\n break;\n case 2:\n if (j == left) {\n matrix[i--][j] = count;\n left++;\n direction = 3;\n } else {\n matrix[i][j--] = count;\n }\n break;\n case 3:\n if (i == top) {\n matrix[i][j++] = count;\n top++;\n direction = 0;\n } else {\n matrix[i--][j] = count;\n }\n break;\n }\n count++;\n }\n \n return matrix;\n }", "public int[][] generateMatrix(int n) {\n // input checking\n if (n < 0) {\n return null;\n }\n\n // start fill in the matrix (consider what happen when n == 0)\n // test case: input == 0; expect [];\n int[][] matrix = new int[n][n];\n int lo = 0, hi = matrix.length - 1;\n int num = 1;\n while (lo <= hi) {\n // pay attention to when lo == hi\n if (lo == hi) {\n matrix[lo][lo] = num;\n break;\n }\n // otherwise, fill this layer\n for (int i = lo; i < hi; i++) { // attention i < hi not i <= hi\n matrix[lo][i] = num++;\n }\n for (int i = lo; i < hi; i++) {\n matrix[i][hi] = num++;\n }\n for (int i = hi; i > lo; i--) {\n matrix[hi][i] = num++;\n }\n for (int i = hi; i > lo; i--) {\n matrix[i][lo] = num++;\n }\n lo++;\n hi--;\n }\n return matrix;\n }", "Matrix inverse(Matrix m){\r\n Matrix mtemp = new Matrix(m.M);\r\n Matrix miden = new Matrix(m.rows,m.cols);\r\n miden = miden.identity();\r\n for(int i=0;i<mtemp.rows-1;i++){\r\n for(int j=i+1; j<mtemp.rows; j++){\r\n if(mtemp.M[i][i]<mtemp.M[j][i]){\r\n swapRow(mtemp,i,j);\r\n swapRow(miden,i,j);\r\n }\r\n }\r\n for(int k=i+1; k<mtemp.rows; k++){\r\n double ratio = mtemp.M[k][i]/mtemp.M[i][i];\r\n for(int j=0;j<mtemp.cols;j++){\r\n mtemp.M[k][j] -= ratio*mtemp.M[i][j];\r\n miden.M[k][j] -= ratio*miden.M[i][j];\r\n }\r\n\r\n }\r\n\r\n }\r\n for(int i=mtemp.rows-1;i>0;i--){\r\n for(int k=i-1; k>-1; k--){\r\n double ratio = mtemp.M[k][i]/mtemp.M[i][i];\r\n for(int j=mtemp.cols-1;j>-1;j--){\r\n mtemp.M[k][j] -= ratio*mtemp.M[i][j];\r\n miden.M[k][j] -= ratio*miden.M[i][j];\r\n }\r\n\r\n }\r\n\r\n }\r\n \r\n\r\n for(int i=0; i<mtemp.rows; i++){\r\n for(int j=0; j<mtemp.cols; j++){\r\n miden.M[i][j] /= mtemp.M[i][i];\r\n }\r\n }\r\n return miden;\r\n\r\n }", "public static int uniquePathsDP(int m, int n) {\n int [][] total = new int[m][n];\n for(int i=0;i<m;i++){\n for(int j=0;j<n;j++){\n if(i==0 || j==0)\n total[i][j]=1;\n else\n total[i][j]=total[i-1][j]+total[i][j-1];\n\n }\n }\n return total[m-1][n-1];\n }", "static long gridlandMetro(long n, int m, int k, int[][] track) {\n Map<Integer, Stack<int[]>> map = new HashMap<>();\n for (int i = 0; i < k; i++) {\n int r = track[i][0];\n int c1 = track[i][1];\n int c2 = track[i][2];\n Stack<int[]> stack = map.get(r);\n if (stack == null) {\n stack = new Stack<>();\n stack.push(new int[] { c1, c2 });\n map.put(r, stack);\n } else {\n int[] c = stack.peek();\n if (c[1] >= c1)\n c[1] = Math.max(c[1], c2);\n else\n stack.push(new int[] { c1, c2 });\n }\n }\n return (long) n * m - map.values().stream().flatMap(Collection::stream).mapToLong(c -> c[1] - c[0] + 1).sum();\n}", "public static String[] MatrixSolve(Matrix M){\n String[] retArray = new String[M.kol];\n for (int i=1; i<M.kol; i++) {\n retArray[i] = Character.toString((char) (i + 96));\n }\n for (int i=M.bar; i>=1; i--) {\n if (!M.IsRowCoefZero(i)) {\n if (M.OnlyLeadingOne(i)) {\n //Hanya ada leading one pada baris ke-i\n retArray[M.PosLeadingElmt(i)] = Double.toString(M.Elmt(i,M.kol));\n }else{\n //Ada elemen non-0 setelah leading one pada baris ke-i\n double resDouble = M.Elmt(i,M.kol);\n String resString = \"\";\n for (int j=M.PosLeadingElmt(i)+1; j<M.kol; j++) {\n if (M.Elmt(i,j) != 0) {\n //Kondisi elemen M ke i,j bukan 0\n try {\n //Jika hasil ke-x merupakan bilangan, maka jumlahkan dengan elemen hasil\n if (retArray[j].contains(\"d\")) {\n throw new NumberFormatException(\"contains d\");\n }\n resDouble += (-1)*M.Elmt(i,j)*Double.valueOf(retArray[j]);\n } catch(NumberFormatException e) {\n //Jika hasil ke-x bukan bilangan, sambungkan koefisien dengan parameter yang sesuai\n resString += ConCoefParam((-1)*M.Elmt(i,j),retArray[j]);\n }\n }\n }\n //Gabungkan bilangan hasil dengan parameter\n if (resDouble != 0) {\n retArray[M.PosLeadingElmt(i)] = String.format(\"%.3f\",resDouble) + resString;\n }else if (resDouble == 0 && resString == \"\"){\n retArray[M.PosLeadingElmt(i)] = String.format(\"%.3f\",resDouble);\n }else{\n retArray[M.PosLeadingElmt(i)] = resString;\n }\n\n if (retArray[M.PosLeadingElmt(i)].startsWith(\"+\")){\n retArray[M.PosLeadingElmt(i)] = retArray[M.PosLeadingElmt(i)].substring(1);\n }\n }\n }\n }\n return retArray;\n}", "private static long[] sums(Mat m,boolean byRow) {\r\n\t\tint rows = m.rows();\r\n\t\tint cols = m.cols();\r\n\t\tbyte[] data = new byte[rows*cols];\r\n\t\tlong[] retSums = null;\r\n\t\t\r\n\t\tint status = m.get(0, 0,data);\r\n\t\t\r\n\t\tlong total = 0;\r\n\t\tfor (int k=0;k<data.length;k++) {\r\n\t\t\ttotal += Byte.toUnsignedInt(data[k]);\r\n\t\t}\r\n\t\tif (byRow) {\r\n\t\t\tretSums = new long[cols];\r\n\t\t\tfor (int col=0;col<cols;col++) {\r\n\t\t\t\tretSums[col] = 0;\r\n\t\t\t\tfor (int row=0;row<rows;row++) {\r\n\t\t\t\t\tint k = row*cols+col;\r\n\t\t\t\t\tretSums[col] += Byte.toUnsignedInt(data[k]);\r\n\t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\telse {\r\n \t\t\tretSums = new long[rows];\r\n \t\t\tfor (int row=0;row<rows;row++) {\r\n \t\t\t\tretSums[row] = 0;\r\n \t\t\t\tfor (int col=0;col<cols;col++) {\r\n \t\t\t\t\tint k = row*cols+col;\r\n \t\t\t\t\tretSums[row] += Byte.toUnsignedInt(data[k]);\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n\t\t\r\n\t\tint total1 = 0;\r\n\t\tfor (int k=0; k < retSums.length; k++) {\r\n\t\t\ttotal1 += retSums[k];\r\n\t\t}\r\n\t\r\n\t\treturn retSums;\r\n\t}", "public static int sum2( int [][] m )\n {\n int sum = 0; //initialize sum\n int v = 0; //initialize a row counter\n for (int[] i : m) { //for each array in m, make an array called i\n\t sum += sumRow( v, m); //add the sumRow of the row counter and\n\t //original array to the stated sum\n\t v++; //add 1 to the counter\n }\n return sum; //return sum, an int\n }", "private void calculateIndex() {\n for(int i=0; i<matrix.length; i++) {\n for(int j=0; j<matrix.length; j++) {\n if(matrix[i][j] == 0) {\n index = (i*matrix.length)+(j+1);\n return;\n }\n }\n }\n }", "public static int calculateOpjectiveFunction(char[][] matrix ) {\n\n\n\n return (int)countNumberOfEmptyPosition(matrix)+countNmberOfCameras( matrix); \n\n}", "public int uniquePaths(int m, int n) {\n int[][] res = new int[m][n];\r\n res[0][0]=0;\r\n for (int i=1;i<m; i++) res[i][0]=1; //初始化边缘。\r\n for (int j=1;j<n; j++) res[0][j]=1;\r\n for (int i=1;i<m;i++) {\r\n for (int j=1;j<n;j++) \r\n res[i][j] = res[i-1][j]+res[i][j-1];\r\n }\r\n return res[m-1][n-1];\r\n }", "public int[] squareUp(int n) {\r\n int[]arreglo=new int[(n*n)]; // O(1)\r\n if(n==0){ // O(1)\r\n return arreglo; // O(1)\r\n }\r\n for(int i=n-1;i<arreglo.length;i=i+n){ // O(n)\r\n for (int j=i;j>=i-(i/n);j--){ // O(1)\r\n arreglo[j]=1+(i-j); // O(1)\r\n }\r\n }\r\n return arreglo; // O(1)\r\n}", "private Integer[][] getBase(int n, int m, int[][] ar) {\n\t\t\tInteger[][] dp = new Integer[n + 1][m + 1];\n\n\t\t\tboolean encounteredObstacle = false;\n\t\t\tfor (int i = 1; i <= n; i++) {\n\t\t\t\tif (ar[i - 1][0] == 1 || encounteredObstacle) {\n\t\t\t\t\tdp[i][1] = 0;\n\t\t\t\t\tencounteredObstacle = true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdp[i][1] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tencounteredObstacle = false;\n\t\t\tfor (int j = 1; j <= m; j++) {\n\t\t\t\tif (ar[0][j - 1] == 1 || encounteredObstacle) {\n\t\t\t\t\tdp[1][j] = 0;\n\t\t\t\t\tencounteredObstacle = true;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdp[1][j] = 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn dp;\n\t\t}", "static int[][] memoizedLCS(char[] X, char[] Y, int n, int m) {\r\n\t\tint cache[][] = new int[n + 1][m + 1];\r\n\r\n\t\t/*\r\n\t\t * Following steps build L[m+1][n+1] in bottom up fashion. Note that\r\n\t\t * L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]\r\n\t\t */\r\n\t\tfor (int i = 0; i < n + 1; i++) {\r\n\t\t\tfor (int j = 0; j < m + 1; j++) {\r\n\t\t\t\tcache[i][j] = -1;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tmemoizedLCS(X, Y, n, m, cache);\r\n\t\t\r\n\t\treturn cache;\r\n\t}", "void iniciaMatriz() {\r\n int i, j;\r\n for (i = 0; i < 5; i++) {\r\n for (j = 0; j <= i; j++) {\r\n if (j <= i) {\r\n m[i][j] = 1;\r\n } else {\r\n m[i][j] = 0;\r\n }\r\n }\r\n }\r\n m[0][1] = m[2][3] = 1;\r\n\r\n// Para los parentesis \r\n for (j = 0; j < 7; j++) {\r\n m[5][j] = 0;\r\n m[j][5] = 0;\r\n m[j][6] = 1;\r\n }\r\n m[5][6] = 0; // Porque el m[5][6] quedo en 1.\r\n \r\n for(int x=0; x<7; x++){\r\n for(int y=0; y<7; y++){\r\n // System.out.print(\" \"+m[x][y]);\r\n }\r\n //System.out.println(\"\");\r\n }\r\n \r\n }", "void ompleBloc(int row, int col) {\r\n int num;\r\n for (int i = 0; i < SRN; i++) {\r\n for (int j = 0; j < SRN; j++) {\r\n do {\r\n num = generadorAleatoris(N);\r\n } while (!comprovaNumerosQuadrant(row, col, num));\r\n\r\n mat[row + i][col + j] = num;\r\n }\r\n }\r\n }", "@Override\n protected int[] initMatrix(final int n) {\n final int[] matrix = new int[n * n];\n int k = 0;\n for (int i = 1; i <= n; ++i) {\n for (int j = 1; j <= n; ++j) {\n final int i2 = 2 * i;\n final int j2 = 2 * j - 1;\n if (mPrime.isPrime(i2 * i2 + j2 * j2)) {\n matrix[k] = 1;\n }\n ++k;\n }\n }\n return matrix;\n }", "public static int[][] solution(int[][] n, int k){\n if(k == 0){\n return buildMatrix(n);\n }\n if(k == 1){\n return n;\n }\n int[][] mat = buildMatrix(n);\n while (k > 0) {\n if (k % 2 == 1) mat = matricsMult(mat,n);\n n = matricsMult(n,n);\n k = k/2;\n }\n return mat;\n }", "private static int matrixMulNaive(int[] arr, int i, int n) {\n\t\t\n\t\tif(i == n) return 0;\n\t\t\n\t\tint min = Integer.MAX_VALUE;\n\t\tint count =0;\n\t\tfor(int k =i; k<n; k++)\n\t\t{\n\t\t\tcount = matrixMulNaive(arr,i,k)+matrixMulNaive(arr,k+1,n)\n\t\t\t+arr[i-1]*arr[k]*arr[n];\n\t\t}\n\t\tif(count < min) min = count;\n\t\t\n\t\treturn min;\n\t}", "public int[][] generateMatrix(int n) {\n int[][] matrix = new int[n][n];\r\n generateMatrix(matrix, 0, 1);\r\n return matrix;\r\n }", "private void generateMatrix(int n) throws InvalidSizeException{\n\t\tif(n%2 == 0 || n == 0 || n < 0) {\n\t\t\tthrow new InvalidSizeException(n);\n\t\t}else {\n\t\t\tmatrix = new int[n][n];\n\t\t\tsize = n;\n\t\t}\n\t}", "public static void printMatrix(int[][] m) {\n for (int i = 0; i < m.length; ++i) {\n for (int j = 0; j < m[i].length; ++j) {\n System.out.print(\" \" + m[i][j]);\n }\n System.out.println();\n }\n }", "public int[] findAnyPairIndexesWhileLCMMinimized() {\n if (seq.length < 2) {\n return null;\n }\n int size = 0;\n for (int i = 1; i <= m; i++) {\n size += m / i;\n }\n\n IntegerMultiWayDeque deque = new IntegerMultiWayDeque(m + 1, size);\n for (int i = 1; i <= m; i++) {\n for (int j = i; j <= m; j += i) {\n if (!indexesOfSeq.isEmpty(j)) {\n deque.addLast(i, j / i);\n }\n }\n }\n\n long lcm = INF;\n int v1 = 0;\n int v2 = 0;\n\n for (int i = 1; i <= m; i++) {\n if (!indexesOfSeq.isEmpty(i) && indexesOfSeq.peekFirst(i) != indexesOfSeq.peekLast(i)) {\n lcm = v1 = v2 = i;\n break;\n }\n }\n\n IntegerVersionArray iva = new IntegerVersionArray(m + 1);\n IntegerDequeImpl stack = new IntegerDequeImpl(m);\n for (int i = 1; i <= m; i++) {\n iva.clear();\n stack.clear();\n while (!deque.isEmpty(i)) {\n int last = deque.removeFirst(i);\n factorize(last);\n int total = ie(iva, allFactors.size() - 1, 1, 0);\n if (total > 0) {\n int pop = 0;\n while (total > 0) {\n pop = stack.removeLast();\n if (GCDs.gcd(pop, last) == 1) {\n total--;\n }\n add(iva, pop, -1);\n }\n long l = LCMs.lcm(last, pop) * i;\n if (l < lcm) {\n lcm = l;\n v1 = last * i;\n v2 = pop * i;\n }\n }\n add(iva, last, 1);\n stack.addLast(last);\n }\n }\n\n return new int[]{indexesOfSeq.peekFirst(v1), indexesOfSeq.peekLast(v2)};\n }", "private int[] columnSum(int[][] matrix) {\n int[] result = new int[matrix.length];\n for(int i = 0; i < matrix.length; i++) {\n result[i] = 0;\n for(int j = 0; j < matrix[i].length; j++) {\n result[i] += matrix[i][j];\n }\n }\n return result;\n }", "static void nextIteration(int matrix[][], int NUMBER_OF_ROWS, int NUMBER_OF_COLUMNS) {\n\t\t// variable to hold the matrix of original size of the matrix\n\t\tint[][] nextMatrixCycle = new int[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS];\n\n\t\t/**\n\t\t * Looping through each row cell of the matrix Starting from 1 as matrix[1][1]\n\t\t * is first cell with neighbours (in first row) Going only till rows-1 as last\n\t\t * cell with neighbours is matrix[#row-1][#col-1]\n\t\t */\n\t\tfor (int rowCellCounter = 1; rowCellCounter < NUMBER_OF_ROWS - 1; rowCellCounter++) {\n\t\t\t/**\n\t\t\t * Loop to iterate through each column till all columns have been visited\n\t\t\t * Starting from 1 as matrix[1][1] is first cell with neighbours (in first\n\t\t\t * column) Going only till rows-1 as last cell with neighbours is\n\t\t\t * matrix[#row-1][#col-1]\n\t\t\t */\n\t\t\tfor (int colVisitCounter = 1; colVisitCounter < NUMBER_OF_COLUMNS - 1; colVisitCounter++) {\n\t\t\t\t// Variable to store the number of live Neighbouring cells\n\t\t\t\tint liveNeighbourCells = 0;\n\t\t\t\t/**\n\t\t\t\t * Loop to get column neighbour cell values\n\t\t\t\t * Going only from -1 to 1 (0 to 2) as neighbours exists between 0 and 2 only\n\t\t\t\t */\n\t\t\t\tfor (int row = -1; row <= 1; row++)\n\t\t\t\t\t/**\n\t\t\t\t\t * Loop to get row neighbour cell values\n\t\t\t\t\t * Going only from -1 to 1 (0 to 2) as neighbours exists between 0 and 2 only\n\t\t\t\t\t */\n\t\t\t\t\tfor (int col = -1; col <= 1; col++)\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Add the matrix[x][y] cell value to live neighbour cell count\n\t\t\t\t\t\t * where x = rowCellCounter + i, and y = colVisitCounter + j\n\t\t\t\t\t\t * [x][y] ranges from [0][0] to [2][2], that is all neighbours\n\t\t\t\t\t\t * Including the current cell as well\n\t\t\t\t\t\t */\n\t\t\t\t\t\tliveNeighbourCells = liveNeighbourCells + matrix[rowCellCounter + row][colVisitCounter + col];\n\n\t\t\t\t// The current cell needs to be subtracted as it has been counted before already\n\t\t\t\tliveNeighbourCells = liveNeighbourCells - matrix[rowCellCounter][colVisitCounter];\n\n\t\t\t\t/**\n\t\t\t\t * The live cell dies if either The number of neighbouring cells is less than 2\n\t\t\t\t * for a live cell The number of neighbouring cells is more than 3 for a live\n\t\t\t\t * cell\n\t\t\t\t */\n\t\t\t\tif ((matrix[rowCellCounter][colVisitCounter] == 1)\n\t\t\t\t\t\t&& ((liveNeighbourCells < 2) || (liveNeighbourCells > 3))) {\n\t\t\t\t\tnextMatrixCycle[rowCellCounter][colVisitCounter] = 0;\n\t\t\t\t}\n\t\t\t\t// Dead cell becomes a live cell iff there are exactly 3 neighbouring cells\n\t\t\t\t// around it\n\t\t\t\telse if ((matrix[rowCellCounter][colVisitCounter] == 0) && (liveNeighbourCells == 3)) {\n\t\t\t\t\tnextMatrixCycle[rowCellCounter][colVisitCounter] = 1;\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * For any other condition, state of the cell does not change at all, and Just\n\t\t\t\t * take the value from the original matrix and copy it as is\n\t\t\t\t */\n\t\t\t\telse {\n\t\t\t\t\tnextMatrixCycle[rowCellCounter][colVisitCounter] = matrix[rowCellCounter][colVisitCounter];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Print the matrix\n\t\tprintMatrix(nextMatrixCycle, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS);\n\t}", "private static void longestIncPath(int[][] matrix) {\n\t\t \n\t\t int total_elem = matrix.length * (matrix[0].length);\n\t ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>();\n\t int[] outdegree = new int[total_elem];\n\t int[][] dp = new int[matrix.length][matrix[0].length];\n\t int m = matrix[0].length;\n\t \n\t for(int i=0;i<matrix.length;i++){\n\t for(int j=0;j<matrix[0].length;j++){\n\t \tg.add(new ArrayList<Integer>());\n\t }\n\t }\n\t \n\t for(int i=0;i<matrix.length;i++){\n\t for(int j=0;j<matrix[0].length;j++){\n\t \n\t int left=-1;\n\t int right=-1;\n\t int up=-1;\n\t int down=-1;\n\t int curr = matrix[i][j];\n\t if(j-1>=0)\n\t left = matrix[i][j-1]; \n\t if(j+1<matrix[0].length)\n\t right = matrix[i][j+1];\n\t if(i-1>=0)\n\t up=matrix[i-1][j];\n\t if(i+1<matrix.length)\n\t down=matrix[i+1][j];\n\t \n\t if(left!=-1 && curr>left)\n\t addedge(g,(m*i+(j-1)),(m*i+j),outdegree);\n\t if(right!=-1 && curr>right)\n\t addedge(g,(m*i+(j+1)),(m*i+j),outdegree);\n\t if(up!=-1 && curr>up)\n\t addedge(g,(m*(i-1)+j),(m*i+j),outdegree);\n\t if(down!=-1 && curr>down)\n\t addedge(g,(m*(i+1)+j),(m*i+j),outdegree);\n\t \n\t \n\t }\n\t }\n\t \n\t Queue<Integer> q = new LinkedList<Integer>();\n\t \n\t for(int i:outdegree){\n\t if(i==0)\n\t q.add(i);\n\t }\n\t \n\t \n\t while(!q.isEmpty()){\n\t int temp = q.poll();\n\t int r = temp/m;\n\t int c = temp - r*m;\n\t int max=0;\n\t \n\t for(int i:g.get(temp)){\n\t int row = i/m;\n\t int col = i - r*m;\n\t max=Math.max(max,dp[row][col]+1);\n\t outdegree[i]--;\n\t if(outdegree[i]==0)\n\t q.add(i);\n\t }\n\t \n\t dp[r][c]=max;\n\t }\n\t \n\t\t\n\t}", "public static long checksum(int[][] m){\n long s = 0;\n for (int i = 0; i < m.length; i++)\n for (int j = 0; j < m[0].length; j++)\n s += m[i][j];\n return s;\n }", "public int uniquePaths(int m, int n) {\n if(m < 1 || n < 1){\n return 0;\n }\n int[][] dp = new int[m][n];\n for(int i = 0; i < m; i++){\n dp[i][0] = 1;\n }\n for(int j = 0; j < n; j++){\n dp[0][j] = 1;\n }\n for(int i = 1; i < m; i++){\n for(int j = 1; j < n; j++){\n dp[i][j] = dp[i-1][j] + dp[i][j - 1];\n }\n }\n\n return dp[m-1][n-1];\n }", "public static void bruteForceSolution(int matrix[][]){\n\t\t\n\t\tint m = matrix.length;\n\t\tint n = matrix[0].length;\n\t\t\n\t\tint aux[][] = new int [m][n];\n\t\t\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tfor(int j = 0;j<n;j++){\n\t\t\t\taux[i][j] = 1;\n\t\t\t}\n\t\t}\n\t\t// if found 0 in main array making row and column in the auxilary row and column as 0\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tfor(int j = 0;j<n;j++){\n\t\t\t\tif(matrix[i][j] == 0){\n\t\t\t\t\t\n\t\t\t\t\tfor(int k = 0;k<m;k++){\n\t\t\t\t\t\taux[k][j] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tfor(int k = 0;k<n;k++){\n\t\t\t\t\t\taux[i][k] = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//copying elements back to main array\n\t\tfor(int i = 0;i<m;i++){\n\t\t\tfor(int j = 0;j<n;j++){\n\t\t\t\tmatrix[i][j] = aux[i][j];\n\t\t\t}\n\t\t}\n\t}", "public int longestIncreasingPath(int[][] matrix) {\n if (matrix == null || matrix.length == 0 || matrix[0] == null || matrix[0].length == 0) {\n return 0;\n }\n int m = matrix.length;\n int n = matrix[0].length;\n int[][] directions = new int[][]{{-1, 0}, {1, 0}, {0, -1}, {0, 1}};\n Map<Integer, Integer> map = new HashMap<>();\n Queue<Integer> queue = new LinkedList<>();\n //count indegree\n for (int i = 0; i < m; i++) {\n for (int j = 0; j < n; j++) {\n int index = i * n + j;\n for (int[] dir : directions) {\n int x = i + dir[0], y = j + dir[1];\n if (x >= 0 && x < m && y >= 0 && y < n && matrix[x][y] < matrix[i][j]) {\n if (map.containsKey(index)) {\n map.put(index, map.get(index) + 1);\n } else {\n map.put(index, 1);\n }\n }\n }\n }\n }\n //find nodes whose indegree is zero\n for (int i = 0; i < m * n; i++) {\n if (!map.containsKey(i)) {\n queue.offer(i);\n }\n }\n int layers = 0;\n while (!queue.isEmpty()) {\n int size = queue.size();\n for (int k = 0; k < size; k++) {\n int index = queue.poll();\n int i = index / n, j = index % n;\n for (int[] dir : directions) {\n int x = i + dir[0], y = j + dir[1];\n if (x >= 0 && x < m && y >= 0 && y < n && matrix[x][y] > matrix[i][j]) {\n int neighbor = x * n + y;\n map.put(neighbor, map.get(neighbor) - 1);\n if (map.get(neighbor) == 0) {\n queue.offer(neighbor);\n }\n }\n }\n }\n layers++;\n }\n return layers;\n }", "private ArrayList<ArrayList<Integer>> generateMatrixPrime(\r\n\t\t\tArrayList<Integer> binaryCodeList,\r\n\t\t\tHashMap<Integer, ArrayList<Integer>> codeToColumnHash, ArrayList<ArrayList<Integer>> tMat) {\r\n\t\tComparator<Integer> decreaseOrderComp = new decreasingOrderComparator();\r\n\t\tSet<Integer> tempSet = new TreeSet<Integer>(decreaseOrderComp);\r\n\t\ttempSet.addAll(binaryCodeList);\r\n\t\tArrayList<Integer> sortedCodes = new ArrayList<Integer>(tempSet);\r\n\t\treturn generateMatrixFromSortedCodes(sortedCodes, codeToColumnHash, tMat);\r\n\t}", "private int[] buildMatrix(Vector<Integer> first, Vector<Integer> second) {\n \tint[] res = new int[4];\n \tint fValue;\n \tint sValue;\n \t\n \tfor (int i = 0; i < first.size(); ++i) {\n \t\tfValue = first.get(i);\n \t\tsValue = second.get(i);\n \t\t\n \t\tif (fValue == sValue && fValue == 1) {\n \t\t\tres[0]++;\n \t\t}\n \t\telse if (fValue == sValue && fValue == 0) {\n \t\t\tres[3]++;\n \t\t}\n \t\telse if (fValue == 1) {\n \t\t\tres[1]++;\n \t\t}\n \t\telse {\n \t\t\tres[2]++;\n \t\t}\n \t}\n \t\n \treturn res;\n }", "public static void main(String[] args) {\n\n\t\tint n = Integer.parseInt(args[0]);\n\t\tint m = Integer.parseInt(args[1]);\n\t\t\n\t\tint[][] positions = new int[m][m];\n\t\t\n\t\tdouble[] arr = new double[m];\n\t\tarr[0] = 0;\n\t\tarr[1] = 1;\n\t\tarr[2] = 2;\n\t\tarr[3] = 3;\n\t\tarr[4] = 4;\n\t\t\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tshuffle(arr);\n\t\t\t\n\t\t\tfor (int j=0; j< arr.length; j++) {\n\t\t\t\tpositions[j][(int)arr[j]]++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprintTable(positions);\n\t\t//Entries are close to N/M\n\t}", "public void printMatrix(int n, int[][] A)\n {\n\t // go through by line, then by element, and print the output.\n\t for (int i = 0; i<n; i++) {\n\t\t for (int j = 0; j<n; j++) {\n\t\t\t System.out.print(A[i][j] + \" \");\n\t\t }\n\t\t // end the line at each new space. \n\t\t System.out.println(\" \");\n\t }\n }", "public static void generateMatrix() {\r\n Random random = new Random();\r\n for (int i = 0; i < dim; i++)\r\n {\r\n for (int j = 0; j < dim; j++)\r\n {\r\n if (i != j)\r\n \r\n adjacencyMatrix[i][j] = I; \r\n }\r\n }\r\n for (int i = 0; i < dim * dim * fill; i++)\r\n {\r\n adjacencyMatrix[random.nextInt(dim)][random.nextInt(dim)] =\r\n random.nextInt(maxDistance + 1);\r\n }\r\n \r\n\r\n\r\n \r\n //print(adjacencyMatrix);\r\n \r\n \r\n //This makes the main matrix d[][] ready\r\n for (int i = 0; i < dim; i++) {\r\n for (int j = 0; j < dim; j++)\r\n {\r\n d[i][j] = adjacencyMatrix[i][j];\r\n if (i == j)\r\n {\r\n d[i][j] = 0;\r\n }\r\n }\r\n }\r\n }", "public Matrix(int m, int n) {\n this.m = m;\n this.n = n;\n data = new double[m][n];\n }", "public static <T> void indexedMap(T[][] matrix, TriFunction<T, Integer, Integer, T> mapFunction){\n for (int i = 0; i != matrix.length; ++i) {\n for (int j = 0; j != matrix[0].length; ++i) {\n T value = matrix[i][j];\n matrix[i][j] = mapFunction.apply(value, i, j);\n }\n }\n }", "public boolean isToeplitzMatrix(int[][] matrix) {\n \t\n \t//將i取出作為local variable,使能夠讀取當前行的下一行\n \t//例如當前讀第0行,使得能夠先讀到第1行\n \tint i=0;\n \tList<Integer> list = new ArrayList<>();\n \t\n \t//若矩陣長度<=1 則回傳true\n \tif(matrix.length <= 1)\n \t\treturn true;\n \t/*以行為主走訪\n \t * 走訪第n與n+1行*/\n \t\n \t//因為要讓內層第二個迴圈走訪到最後一行,故最外層走訪0~(列數-1)行\n \tfor(i=0 ; i<matrix[0].length-1 ; i++){\n \t\t//走訪每行的元素,並加到list中\n \t\tfor(int j=0 ; j<matrix.length ; j++){\n \t\t\tlist.add(matrix[j][i]);\n \t\t\t//System.out.println(matrix[j][i]);\n \t\t}\n \t\t//走訪i+1行的元素,並加到list中\n \t\tfor(int k=0 ; k<matrix.length ; k++){\n \t\t\tlist.add(matrix[k][i+1]);\n \t\t\t//System.out.println(matrix[k][i+1]);\n \t\t}\n \t\t\n \t\t/*以[1,2,3,4],[5,1,2,3],[9,5,1,2]為例\n \t\t * 我們以行為主走訪,可得知每次只需要比較前兩筆資料是否與下一行的後兩筆資料相符,就可以判斷是否符合題目要求\n \t\t * 因此將list內元素拿出來做比較,經過上面兩個迴圈的走訪後,第一次list內會有1,5,9,2,1,5這些元素\n \t\t * 只需比較上述矩陣的前兩筆資料是否與後兩筆相同(h+matrix.length+1)就可確認是否符合題目要求\n \t\t*/\n \t\tfor(int h=0 ; h<matrix.length-1 ;h++){\n \t\t\tif(list.get(h) != list.get(h+matrix.length+1)){\n \t\t\t//\tSystem.out.println(list.get(h));\n \t\t\t// System.out.println(list.get(h+matrix.length+1));\n \t\t\t\treturn false;\n \t\t\t}\n \t\t}\n \t\tlist.clear();\n \t}\n \treturn true;\n }", "private static int[][] identifyMatrixWithZeros(int[][] matrix){\n\t\tboolean[] rowCheck = new boolean[matrix.length];\n\t\tboolean[] colCheck = new boolean[matrix[0].length];\n\n\t\tfor(int i=0;i<matrix.length ;i++) {\n\t\t\tfor(int j=0;j<matrix[0].length;j++) {\n\t\t\t\tif(matrix[i][j] == 0) {\n\t\t\t\t\trowCheck[i] = true;\n\t\t\t\t\tcolCheck[j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int row=0;row<rowCheck.length;row++) {\n\t\t\tif(rowCheck[row])\n\t\t\t\tnullifyRows(matrix, row);\n\t\t}\n\t\t\n\t\tfor(int col=0;col<colCheck.length;col++) {\n\t\t\tif(colCheck[col])\n\t\t\t\tnullifyColumns(matrix, col);\n\t\t}\n\t\treturn matrix;\n\t}", "public void compararMatrix(Estado_q es1, Estado_q es2, int filest,short tam,int tamañoEsta){\n if(es1.isFinal()==es2.isFinal()){\n //contador para vecto de alfabeto o transiciones\n int con=0;\n //si son inidistinguibles los estados, se insertan en la matriz sus estados destinos respecto a transiciones\n for(int cont=1;cont<=(int)tam;cont++){\n matrix[filest][cont].setEst1(es1.getTransiçaosE(con));\n matrix[filest][cont].setEst2(es2.getTransiçaosE(con)); \n con++;\n }\n //comparamos en la misma fila y distintas columnas, si hay alguna pareja igual a la original, para revisarla\n //pareja original es la de la columna 0, de donde se obtuvieron los estados de las columnas insertadas\n for(int k=1;k<=(int)tam;k++){\n if((matrix[filest][k].getEst1().getNombre()==es1.getNombre())&&(matrix[filest][k].getEst2().getNombre()\n ==es2.getNombre())){\n matrix[filest][k].setRevisado(true);\n }\n }\n //se setea verdadera la revision de la posicion donde estabamos\n matrix[filest][0].setRevisado(true);\n \n //terminado de insertar todos los estados es una fila(for de arriba), se lee la matrix a buscar nuevos estados sin revisar\n //para colocarlos una posicion mas abajo\n for(int fil=0;fil<=tamañoEsta;fil++){\n for(int col=0;col<=(int)tam;col++){\n \n //se busca en la matriz alguna pareja de estados que sea igual a la original para marcarla revisada\n if((matrix[fil][col]!=null)&&(matrix[fil][col].getEst1().getNombre()==es1.getNombre())&&\n (matrix[fil][col].getEst2().getNombre())==es2.getNombre()){\n matrix[fil][col].setRevisado(true);\n }\n \n //si la casilla no esta revisada\n if((matrix[fil][col].isRevisado()==false)&&(matrix[fil][col]!=null)){\n \n //vamos a buscar si no esta esta posicion ya verificada\n for(int row=0;row<=tamañoEsta;row++){\n for(int cols=0;cols<=(int)tam;cols++){\n if((matrix[fil][col].getEst1().getNombre()==matrix[row][cols].getEst1().getNombre())&&\n (matrix[fil][col].getEst2().getNombre()==matrix[row][cols].getEst2().getNombre())\n &&(matrix[row][cols].isRevisado()==true)){\n matrix[fil][col].setRevisado(true);\n }\n }\n }\n if((matrix[fil][col].isRevisado()==false)&&(matrix[fil][col]!=null)){\n \n //si la siguiente fila esta nula\n if(matrix[fil+1][0]==null){\n //se inerta la casilla con sus estados en una fila abajo\n matrix[fil+1][0].setEst1(matrix[fil][col].getEst1());\n matrix[fil+1][0].setEst2(matrix[fil][col].getEst2());\n tamañoEsta++;\n //se vuelve a llamar al metodo, para volver a verificar desde la columna e estados si son inidistinguibles\n compararMatrix(matrix[fil][col].getEst1(),matrix[fil][col].getEst2(),filest+1,tam,tamañoEsta);\n\n }\n else\n {\n matrix[col][0].setEst1(matrix[fil][col].getEst1());\n matrix[col][0].setEst2(matrix[fil][col].getEst2());\n //se vuelve a llamar al metodo, para volver a verificar desde la columna e estados si son inidistinguibles\n compararMatrix(matrix[fil][col].getEst1(),matrix[fil][col].getEst2(),filest+1,tam,tamañoEsta);\n\n }\n }\n }\n } \n }\n System.out.print(\"SI son equivalentes\");\n \n }\n else\n System.out.print(\"NO son equivalentes\");\n \n \n }", "int solve() {\n dp[0][0] = 1;\n IntStream.rangeClosed(1, m).forEach(i ->\n IntStream.rangeClosed(0, n).forEach(j ->\n dp[i][j] = j - i >= 0 ?\n (dp[i - 1][j] + dp[i][j - i]) % M :\n dp[i - 1][j]));\n return dp[m][n];\n }", "public static void main(String[] args) {\n int[][] matrix = {{1,2}, {3,4}};\n // int[][] matrix = {{1,2}, {3,4}};\n// printMatrixDiagonal (matrix, matrix.length);\n int[] result = findDiagonalOrder (matrix);\n for ( int i:result ){\n System.out.println (i);\n }\n\n }", "public Matrix calculate();", "private static void iterationArr(int n) {\n int[][] ints = new int[n][n];\n ints[0][0] = 1;\n for (int i = 0; i < n - 1; i++) {\n ints[i + 1][0] = ints[i][0] + i + 1;\n }\n for (int i = 1; i < n; i++) {//表列\n for (int j = 0; j < n - 1; j++) {//表行\n ints[j][i] = ints[j + 1][i - 1] + 1;\n }\n }\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n - i; j++) {\n System.out.printf(ints[i][j] + \"\\t\");\n }\n System.out.println();\n }\n }", "public int getAdjacentCount(int m, int n){\r\n\t\treturn count[m][n];\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tSystem.out.println(\"Enter n :\");\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint num = scanner.nextInt();\n\t\t\n\t\tint mat[][] = new int[num][num];\n\t\tint mirr[][] = new int[num][num];\n\t\t\n\t\tint sum =0;\n\t\t\n\t\tfor(int i =0; i<num;i++)\n\t\t{\n\t\t\tfor(int j=0;j<num;j++)\n\t\t\t{\n\t\t\t System.out.println(\"Enter \"+i+\"\"+j+\" matrix\");\n\t\t\t int data = scanner.nextInt();\n\t\t\t\tmat[i][j]=data;\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t System.out.println(\"Original Matrix is :\");\n\t \n\t \n\t for(int i =0; i<num;i++)\n\t\t\t{\n\t\t\t\tfor(int j=0;j<num;j++)\n\t\t\t\t{\n\t\t\t\t \n\t System.out.print(mat[i][j]+\" \");\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t \n\t\t\n\t\t\n\t\tfor(int i =0; i<num;i++)\n\t\t{\n\t\t\tint img = 0;\n\t\t\tfor(int j=num-1;j>=0;j--)\n\t\t\t{\n\t\t\t \n\n int temp = mat[i][j];\n mirr[i][img]=temp;\n img++;\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\n\t \n\t\t\n\t\t\n\t\t\n System.out.println(\"\\n2Mirror Matrix is :\");\n \n \n for(int i =0; i<num;i++)\n\t\t{\n\t\t\tfor(int j=0;j<num;j++)\n\t\t\t{\n\t\t\t \n System.out.print(mirr[i][j]+\" \");\n\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\n \n \n \n\t}", "public static void ImprimeParesBordasCol(int M[ ][ ], int n) {\n\t\tint i,j;\n\t\tfor (i=0;i<n;i++){\n\t\t\tfor (j=0;j<n;j++){\n\t\t\t\tif (j==0){\n\t\t\t\t\tif (M[i][j]%2==0){\n\t\t\t\t\t\tSystem.out.print( M[i][j]+\";\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print( \"\\n\");\n\t\tfor (i=0;i<n;i++){\n\t\t\tfor (j=0;j<n;j++){\n\t\t\t\tif (j==n-1){\n\t\t\t\t\tif (M[i][j]%2==0){\n\t\t\t\t\t\tSystem.out.print( M[i][j]+\";\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "boolean comprovaColumna(int j, int num) {\r\n //System.out.println(\"comprovacolumna\"+j+\"Numero:\"+num);\r\n for (int i = 0; i < N; i++) {\r\n if (mat[i][j] == num) {\r\n \r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }", "private void imprimirMatriz(int[][] m) {\n\n\t\tSystem.out.println(\"-------------------------------------------\");\n\t\tfor (int i = 0; i < 4; i++) {\n\t\t\tfor (int j = 0; j < 4; j++) {\n\t\t\t\tSystem.out.println(\"M[\" + i + \"][\" + j + \"] = \" + m[i][j]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"-------------------------------------------\");\n\t}", "@Override\n\tpublic int[][] computeAssignments( final double[][] matrix )\n\t{\n\t\tfinal int nlines = matrix.length;\n\t\tif ( nlines == 0 )\n\t\t{\n\t\t\t// no spot\n\t\t\treturn new int[][] { {} };\n\t\t}\n\t\tfinal int ncols = matrix[ 0 ].length;\n\t\tif ( nlines <= 1 && ncols <= 1 )\n\t\t\treturn new int[][] { {} };\n\n\t\t// subtract minimum value from rows and columns to create lots of zeroes\n\t\treduceMatrix( matrix );\n\n\t\t// non negative values are the index of the starred or primed zero in\n\t\t// the row or column\n\t\tfinal int[] starsByRow = new int[ matrix.length ];\n\t\tArrays.fill( starsByRow, -1 );\n\t\tfinal int[] starsByCol = new int[ matrix[ 0 ].length ];\n\t\tArrays.fill( starsByCol, -1 );\n\t\tfinal int[] primesByRow = new int[ matrix.length ];\n\t\tArrays.fill( primesByRow, -1 );\n\n\t\t// 1s mean covered, 0s mean not covered\n\t\tfinal int[] coveredRows = new int[ matrix.length ];\n\t\tfinal int[] coveredCols = new int[ matrix[ 0 ].length ];\n\n\t\t// star any zero that has no other starred zero in the same row or\n\t\t// column\n\t\tinitStars( matrix, starsByRow, starsByCol );\n\t\tcoverColumnsOfStarredZeroes( starsByCol, coveredCols );\n\n\t\twhile ( !allAreCovered( coveredCols ) )\n\t\t{\n\n\t\t\tint[] primedZero = primeSomeUncoveredZero( matrix, primesByRow, coveredRows, coveredCols );\n\n\t\t\twhile ( primedZero == null )\n\t\t\t{\n\t\t\t\t// keep making more zeroes until we find something that we can\n\t\t\t\t// prime (i.e. a zero that is uncovered)\n\t\t\t\tmakeMoreZeroes( matrix, coveredRows, coveredCols );\n\t\t\t\tprimedZero = primeSomeUncoveredZero( matrix, primesByRow, coveredRows, coveredCols );\n\t\t\t}\n\n\t\t\t// check if there is a starred zero in the primed zero's row\n\t\t\tfinal int columnIndex = starsByRow[ primedZero[ 0 ] ];\n\t\t\tif ( -1 == columnIndex )\n\t\t\t{\n\n\t\t\t\t// if not, then we need to increment the zeroes and start over\n\t\t\t\tincrementSetOfStarredZeroes( primedZero, starsByRow, starsByCol, primesByRow );\n\t\t\t\tArrays.fill( primesByRow, -1 );\n\t\t\t\tArrays.fill( coveredRows, 0 );\n\t\t\t\tArrays.fill( coveredCols, 0 );\n\t\t\t\tcoverColumnsOfStarredZeroes( starsByCol, coveredCols );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\n\t\t\t\t// cover the row of the primed zero and uncover the column of\n\t\t\t\t// the starred zero in the same row\n\t\t\t\tcoveredRows[ primedZero[ 0 ] ] = 1;\n\t\t\t\tcoveredCols[ columnIndex ] = 0;\n\t\t\t}\n\t\t}\n\n\t\t// ok now we should have assigned everything\n\t\t// take the starred zeroes in each column as the correct assignments\n\n\t\tfinal int[][] retval = new int[ matrix.length ][];\n\t\tfor ( int i = 0; i < starsByCol.length; i++ )\n\t\t{\n\t\t\tretval[ i ] = new int[] { starsByCol[ i ], i };\n\t\t}\n\t\treturn retval;\n\n\t}", "public static void rotate(int [][]matrix, int n){\n for(int layer = 0; layer < n / 2 ; ++layer){\n int first = layer;\n int last = n - 1 - layer;\n for(int i = first; i < last; ++i){\n int offset = i - first;\n //save top\n int top = matrix[first][i];\n //left to top\n matrix[first][i] = matrix[last-offset][first];\n //bottom to left\n matrix[last-offset][first] = matrix[last][last-offset];\n //right to bottom\n matrix[last][last-offset] = matrix[i][last];\n //top to right\n matrix[i][last] = top;\n }\n }\n }", "public int[] findAnyPairIndexesWhileLCMMaximized() {\n if (seq.length < 2) {\n return null;\n }\n int size = 0;\n for (int i = 1; i <= m; i++) {\n size += m / i;\n }\n\n IntegerMultiWayDeque deque = new IntegerMultiWayDeque(m + 1, size);\n for (int i = 1; i <= m; i++) {\n for (int j = i; j <= m; j += i) {\n if (!indexesOfSeq.isEmpty(j)) {\n deque.addLast(i, j / i);\n }\n }\n }\n\n long lcm = -1;\n int v1 = 0;\n int v2 = 0;\n\n for (int i = m; i >= 1; i--) {\n if (!indexesOfSeq.isEmpty(i) && indexesOfSeq.peekFirst(i) != indexesOfSeq.peekLast(i)) {\n lcm = v1 = v2 = i;\n break;\n }\n }\n\n IntegerVersionArray iva = new IntegerVersionArray(m + 1);\n IntegerDequeImpl stack = new IntegerDequeImpl(m);\n for (int i = 1; i <= m; i++) {\n iva.clear();\n stack.clear();\n while (!deque.isEmpty(i)) {\n int last = deque.removeLast(i);\n factorize(last);\n int total = ie(iva, allFactors.size() - 1, 1, 0);\n if (total > 0) {\n int pop = 0;\n while (total > 0) {\n pop = stack.removeLast();\n if (GCDs.gcd(pop, last) == 1) {\n total--;\n }\n add(iva, pop, -1);\n }\n long l = LCMs.lcm(last, pop) * i;\n if (l > lcm) {\n lcm = l;\n v1 = last * i;\n v2 = pop * i;\n }\n }\n add(iva, last, 1);\n stack.addLast(last);\n }\n }\n\n return new int[]{indexesOfSeq.peekFirst(v1), indexesOfSeq.peekLast(v2)};\n }", "public ParallelMatrix(int me,int n,int p,int m1[][] ,int m2[][],int res[][]) {\r\n B = n/p;\r\n this.me = me ;\r\n matrix1 = m1;\r\n matrix2 = m2;\r\n N = n;\r\n matrix = res;//new int[N][N];\r\n }", "private int getFuncValue(ArrayList<ArrayList<Integer>> matrixPrime, int i, int j) {\r\n\t\tif (j == 0) return 0;\r\n\t\tfor (int currCol = j-1; currCol >= 0; currCol--){\r\n\t\t\tif (matrixPrime.get(i).get(currCol) == 1) return currCol + 1;\r\n\t\t}\r\n\t\treturn 0;\r\n\t}", "public static ArrayList<Integer> findConflicts(ArrayList<ArrayList<Integer>> matrixPrime) {\r\n\t\tArrayList<ArrayList<Integer>> conflictMatrix = new ArrayList<ArrayList<Integer>>();\r\n\t\t//Makes the conflict matrix as according to Gusfield's algorithm\r\n\t\tfor (int i = 0; i < matrixPrime.size(); i++){\r\n\t\t\tconflictMatrix.add(new ArrayList<Integer>());\r\n\t\t\tint counter = 0;\r\n\t\t\tfor (int j = 0; j < matrixPrime.get(i).size(); j++){\r\n\t\t\t\tif (matrixPrime.get(i).get(j) == 1){\r\n\t\t\t\t\tconflictMatrix.get(i).add(counter);\r\n\t\t\t\t\tcounter = j + 1;\r\n\t\t\t\t} else conflictMatrix.get(i).add(-1);\r\n\t\t\t}\r\n\t\t}\r\n\t\t/**\r\n\t\t * Taken out for time testing\r\n\t\t */\r\n//\t\tSystem.out.println(\"ConflictMatrix:\");\r\n//\t\tprintMatrix(conflictMatrix);\r\n//\t\tSystem.out.println(\"--\");\r\n\t\tArrayList<Integer> conflictCols = new ArrayList<Integer>();\r\n\t\t/*\r\n\t\t * Vertex Cover Initialization - Creating Conflict Graph\r\n\t\t * 1. Create Nodes\r\n\t\t * 2. Create Edges by finding conflicts\r\n\t\t */\r\n\t\tSet<Integer> nodes = new HashSet<Integer>();\r\n\t\tSet<Pair<Integer>> edges = new HashSet<Pair<Integer>>(); \r\n\t\tArrayList<Integer> bCodeList = generateBinaryCodeList(transposeMatrix(matrixPrime));\r\n\t\tfor (int i = 0; i < numRows; i++) nodes.add(i);\r\n\t\tfor (int j = 0; j < conflictMatrix.get(0).size(); j++){\r\n//\t\t\tif (colHasConflicts(conflictMatrix, j)) {\r\n\t\t\t\tedges.addAll(findEdges(matrixPrime, j, bCodeList));\r\n//\t\t\t}\r\n\t\t}\r\n\t\t/**\r\n\t\t * Taken out for time testing\r\n\t\t */\r\n//\t\tSystem.out.println(\"Nodes: \" + nodes.toString());\r\n//\t\tSystem.out.println(\"Edges: \" + edges.toString());\r\n\t\tSet<Integer> vertexCover = new HashSet<Integer>();\r\n\t\t//Set<Integer> minCover = null;\r\n//\t\tfor (int k = 1; k < nodes.size(); k++){\r\n//\t\t\tvertexCover = recVertexCover(edges, k, new HashSet<Integer>());\r\n//\t\t\tif (vertexCover != null) break;\r\n//\t\t}\r\n\t\tminCover = null;\r\n\t\tmin = -1.00;\r\n\t\t//long startTime = System.nanoTime();\t\r\n\t\t//System.out.println(\"Start: \" + Long.toString(startTime));\r\n\t\t//recVertexCover(edges, nodes, vertexCover);\r\n\t\t//Do approximate vertex cover to find which conflicts to remove\r\n\t\tminCover = approxVertexCover(edges, nodes, vertexCover);\r\n\t\t//long endTime = System.nanoTime();\r\n\t\t//System.out.println(\"End: \" + Long.toString(endTime));\r\n\t\t//System.out.println(\"Took \"+(endTime - startTime) + \" ns for vertex cover\");\r\n\t\t//Add the result of approximate vertex cover\r\n\t\tconflictCols.addAll(minCover);\r\n\t\t//printMatrix(conflictMatrix);\r\n\t\tSet<Integer> nonConflictCols = getNonConflictCols(bCodeList);\r\n\t\tconflictCols.removeAll(nonConflictCols);\r\n\t\t/**\r\n\t\t * Taken out for time testing\r\n\t\t */\r\n//\t\tSystem.out.print(\"The following columns had conflicts: \");\r\n//\t\tfor (int i = 0; i < conflictCols.size(); i++){\r\n//\t\t\tSystem.out.print(conflictCols.get(i) + \" \");\r\n//\t\t}\r\n//\t\tSystem.out.println();\r\n\t\treturn conflictCols;\r\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int T = sc.nextInt();\n for(int i = 0 ; i < T; i++) {\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n PriorityQueue<Integer> queue = new PriorityQueue<Integer>();\n int[][] m = new int[n][n];\n //n^2 * log(n)\n for(int row = 0; row < n; row++) {\n for(int col = 0; col < n; col++) {\n if(row == 0 && col == 0 && n != 1) {\n continue;\n }else if(row == 0) {\n m[row][col] = m[row][col - 1] + a;\n }else if(col == 0) {\n m[row][col] = m[row-1][col] + b;\n }else {\n m[row][col] = m[row-1][col-1] + a + b;\n }\n\n if(row + col == (n -1)) {\n pool.add(m[row][col]); //log(n)\n }\n }\n }\n //O(n*log(n))\n for (Integer item:pool) {\n queue.add(item); //O(logn)\n }\n while(!queue.isEmpty()) {\n System.out.print(queue.poll() + \" \"); //O(1)\n }\n System.out.println();\n queue.clear();\n pool.clear();\n }\n }", "public static int[] minCostVC(int[][] M) {\n int n = M.length;\n int m = M[0].length;\n int[][] previous = new int[n][m];\n int[] cut = new int[2 * n];\n\n for (int i = 1; i < n; i++) {\n for (int j = 0; j < m; j++) {\n int min = M[i - 1][j];\n previous[i][j] = j;\n if (j > 0 && min > M[i - 1][j - 1]) {\n min = M[i - 1][j - 1];\n previous[i][j] = j - 1;\n }\n if (j < m - 1 && min > M[i - 1][j + 1]) {\n min = M[i - 1][j + 1];\n previous[i][j] = j + 1;\n }\n M[i][j] += min;\n }\n }\n\n int minCost = 0, minCostColumn = 0;\n for (int j = 0; j < m; j++) {\n if (j == 0) {\n minCost = M[n - 1][0];\n minCostColumn = 0;\n } else if (minCost > M[n - 1][j]) {\n minCost = M[n - 1][j];\n minCostColumn = j;\n }\n }\n cut[(n - 1) * 2] = n - 1;\n cut[(n - 1) * 2 + 1] = minCostColumn;\n for (int i = n - 2; i >= 0; i--) {\n cut[i * 2] = i;\n cut[i * 2 + 1] = previous[i + 1][cut[(i + 1) * 2 + 1]];\n }\n return cut;\n }", "private HashMap<Integer, ArrayList<Integer>> getHashFromTransMatrix(\r\n\t\t\tArrayList<ArrayList<Integer>> tMat){\r\n\t\tHashMap<Integer, ArrayList<Integer>> codeToColHash = \r\n\t\t\tnew HashMap<Integer, ArrayList<Integer>>();\r\n\t\tArrayList<Integer> binaryCodeList = generateBinaryCodeList(tMat);\r\n\t\tfor (int i = 0; i < binaryCodeList.size(); i++){\r\n\t\t\tif (codeToColHash.containsKey(binaryCodeList.get(i))){\r\n\t\t\t\tArrayList<Integer> currCols = codeToColHash.get(binaryCodeList.get(i));\r\n\t\t\t\tcurrCols.add(i);\r\n\t\t\t\tcodeToColHash.put(binaryCodeList.get(i), currCols);\r\n\t\t\t} else {\r\n\t\t\t\tArrayList<Integer> newColsList = new ArrayList<Integer>();\r\n\t\t\t\tnewColsList.add(i);\r\n\t\t\t\tcodeToColHash.put(binaryCodeList.get(i), newColsList);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn codeToColHash;\r\n\t}", "public static void exercise37(final int M, final int N) {\n final int[][] counts = new int[M][M];\n final int[] arr = new int[M];\n for (int i = 0; i < N; ++i) {\n for (int j = 0; j < M; ++j) {\n arr[j] = j;\n }\n __exercise37(arr);\n for (int j = 0; j < M; ++j) {\n ++counts[arr[j]][j];\n }\n }\n for (final int[] row : counts) {\n for (int i = 0; i < M; ++i) {\n StdOut.print((i > 0 ? \"\\t\" : \"\") + row[i]);\n }\n StdOut.println();\n }\n }", "private double[][] vett_mat( double[] d, double[] ds, double[] di, int n ) {\n double[][] A = new double[n][n];\n for( int i = 0; i < n; i++ ) {\n for( int j = 0; j < n; j++ )\n A[i][j] = 0.0;\n }\n A[0][1] = ds[0];\n A[n - 1][n - 2] = di[n - 2];\n for( int i = 0; i < n; i++ )\n A[i][i] = d[i];\n for( int i = 1; i < n - 1; i++ ) {\n A[i][i + 1] = ds[i];\n A[i][i - 1] = di[i - 1];\n }\n return A;\n }", "public static Matrix genTransFunction(Matrix m) {\n\t\tdouble[][] out = new double[m.getNumRows()][m.getNumCols()];\n\t\tfor(int i = 0; i < m.getNumRows(); i++) {\n\t\t\tfor(int j = 0; j < m.getNumCols(); j++) {\n\t\t\t\tif(j == 0) \n\t\t\t\t\tout[i][j] = sumRow(m.getRow(i), i);\n\t\t\t\telse if(j <= i)\n\t\t\t\t\tout[i][j] = m.get(i, i - j);\n\t\t\t\telse\n\t\t\t\t\tout[i][j] = 0;\n\t\t\t}\n\t\t}\n\t\treturn new Matrix(out);\n\t\t\n\t}", "static void rotate(int[][] matrix) {\n int n = matrix.length;\n for (int i = 0; i < (n + 1) / 2; i++) {\n for (int j = 0; j < n / 2; j++) {\n int temp = matrix[n - 1 - j][i];\n matrix[n - 1 - j][i] = matrix[n - 1 - i][n - j - 1];\n matrix[n - 1 - i][n - j - 1] = matrix[j][n - 1 - i];\n matrix[j][n - 1 - i] = matrix[i][j];\n matrix[i][j] = temp;\n }\n }\n }", "public static int sum2( int [][] m )\n {\n\t int sum = 0;\t\t\t\t\t\t\t//initialize variable to hold/track sum so far\n\t\n\t for (int i = 0; i < m.length; i++) { \t//loop through the arrays\n\n\t\t sum += sumRow1(i, m);\t\t\t\t//procure the sum of each row, and add it to the sum variable\n\n\t }\n\n\t return sum;\t\t\t\t\t\t\t//return the sum\n }" ]
[ "0.62753993", "0.6219348", "0.59808755", "0.5953927", "0.5893057", "0.58861697", "0.5865711", "0.58448124", "0.5812872", "0.5755281", "0.5748296", "0.57471454", "0.5737836", "0.571425", "0.56996983", "0.56978494", "0.56634456", "0.5639239", "0.56390876", "0.56388015", "0.56367487", "0.5623595", "0.56202257", "0.5593133", "0.5580292", "0.55649704", "0.5541989", "0.55404586", "0.5534077", "0.5527331", "0.55217093", "0.551017", "0.5502592", "0.5499704", "0.5491722", "0.5454404", "0.54504496", "0.5441918", "0.5430502", "0.54259247", "0.5424127", "0.54232466", "0.54221743", "0.54193217", "0.5415651", "0.54143304", "0.5408233", "0.539694", "0.5389636", "0.53874826", "0.5367631", "0.53650886", "0.53572965", "0.53537565", "0.5348692", "0.53441364", "0.5336483", "0.5327557", "0.5326297", "0.5322834", "0.53081274", "0.5302372", "0.53022665", "0.52926505", "0.52900463", "0.5274248", "0.5270671", "0.52491397", "0.5243103", "0.5242907", "0.5235842", "0.5233564", "0.52329934", "0.52308583", "0.5226564", "0.52176535", "0.52132195", "0.52078295", "0.52045584", "0.52042943", "0.5202534", "0.52003753", "0.5199904", "0.51951015", "0.51946336", "0.51888406", "0.51837677", "0.5182929", "0.5180004", "0.51794004", "0.51776063", "0.51772976", "0.51717776", "0.517046", "0.5169235", "0.5161217", "0.51608485", "0.51594144", "0.51563966", "0.5153777", "0.51509184" ]
0.0
-1
Test of cardSelectionIsValid method, of class utils.
@Test(expected = Exception.class) public void testCardSelectionIsValid_FALSE() throws Exception { System.out.println("cardSelectionIsValid not valid"); UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE); UnoCardColour wildColour = UnoCardColour.BLUE; utils.cardSelectionIsValid(cardSelection, drawCard, wildColour); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testCardSelectionIsValid_TRUE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n }", "private boolean validateCard() {\n Card card = new Card(\n editTextCreditCardNumber.getText().toString(),\n selectedMonth,\n selectedYear,\n editTextCCV.getText().toString()\n );\n boolean validation = card.validateCard();\n if (validation) {\n return true;\n } else if (!card.validateNumber()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardErrorNumber), Toast.LENGTH_SHORT).show();\n return false;\n } else if (!card.validateExpiryDate()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardErrorExpiryDate), Toast.LENGTH_SHORT).show();\n return false;\n } else if (!card.validateCVC()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardErrorCCV), Toast.LENGTH_SHORT).show();\n return false;\n } else {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardError), Toast.LENGTH_SHORT).show();\n return false;\n }\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Override\n public boolean isLegal(List<Integer> selectedCards)\n {\n //checks if the two cards selected added together equal 13\n if(selectedCards.size() == 2)\n {\n if(containsSum13(selectedCards))\n {\n \treturn true;\n }\n }\n \n //checks if the selected card is a K\n if(selectedCards.size() == 1)\n {\n \treturn containsK(selectedCards);\n }\n return false;\n \n }", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public void testCardCanPlay_FALSE() {\n System.out.println(\"cardCanPlay FALSE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_TRUE() {\n System.out.println(\"cardCanPlay TRUE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "private boolean validInput(Player player, int choice) {\n if (0 <= choice && choice < player.getCards().size()) {\n if(state.getWildDrawPenalty() != 1 && player.getCards().get(choice) instanceof WildDrawCard) {\n return true;\n }\n if( state.getWildDrawPenalty() != 1 && !(player.getCards().get(choice) instanceof WildDrawCard)) {\n System.out.println(\"You should put WildDraw card.\");\n return false;\n }\n if( player.getCards().get(choice) instanceof WildDrawCard){\n boolean validWildDraw = true;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard)) {\n validWildDraw = false;\n }\n }\n if (validWildDraw) {\n return true;\n }\n else {\n System.out.println(\"You can't put WildDraw card.\");\n return false;\n }\n }\n if(state.getDrawPenalty() != 1 && player.getCards().get(choice) instanceof Draw2Card) {\n return true;\n }\n if (state.getDrawPenalty() != 1 && !(player.getCards().get(choice) instanceof Draw2Card)) {\n System.out.println(\"You should put Draw2 card.\");\n return false;\n }\n if ( player.getCards().get(choice).isValidCard(currentCard)) {\n return true;\n }\n System.out.println(\"Enter valid card.\");\n return false;\n }\n System.out.println(\"Enter a number between 1-\" + player.getCards().size() );\n return false;\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public interface ValidateCardSelection {\n boolean validate(CardStack stack, Game g);\n}", "void checkValid();", "@Test\n public void checkValidityTest1() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n assert (g.checkValidity(g.getDeck()));\n }", "@Override\n\tboolean isValid(){\n\t\tif(size()==5) {\n\t\t\tint suite = getCard(0).suit;\n\t\t\tfor(int i = 1 ; i< size(); i++) {\n\t\t\t\tif(getCard(i).suit != suite) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tsort();\n\t\t\tint currRank = (getCard(0).rank +11)%13;\n\t\t\tfor(int i=0; i<size(); i++) {\n\t\t\t\tif((getCard(i).rank+11)%13 != currRank) return false;\n\t\t\t\tcurrRank++;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n public void testCardCanPlay_TRUE_VALUE() {\n System.out.println(\"cardCanPlay TRUE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE_VALUE() {\n System.out.println(\"cardCanPlay FALSE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "public boolean testSelected() {\n // test if set\n boolean set = Card.isSet(\n selectedCards.get(0).getCard(),\n selectedCards.get(1).getCard(),\n selectedCards.get(2).getCard()\n );\n\n // set currentlySelected to false and replace with new Cards (if applicable)\n for (BoardSquare bs : selectedCards)\n bs.setCurrentlySelected(false);\n\n // handle if set\n if (set) {\n if (!deck.isEmpty() && this.numCardsOnBoard() == 12) {\n for (BoardSquare bs : selectedCards)\n bs.setCard(deck.getTopCard());\n }\n else if (!deck.isEmpty() && this.numCardsOnBoard() < 12) {\n board.compressBoard(selectedCards);\n this.add3();\n }\n else {\n board.compressBoard(selectedCards);\n }\n }\n\n // clear ArrayList\n selectedCards.clear();\n\n // return bool\n return set;\n }", "public boolean checkValidSelection(Point start, Point end){\n \t\tboolean flag = false;\n \t\tif (start.x == end.x) {\n \t\t\tflag = true;\n \t\t}\n \t\telse if (start.y == end.y) {\n \t\t\tflag = true;\n \t\t}\n \t\telse if ((start.x - start.y) == (end.x - end.y)) {\n \t\t\tflag = true;\n \t\t}\n \t\telse if ((start.x + start.y) == (end.x + end.y)) {\n \t\t\tflag = true;\n \t\t}\n \t\treturn flag;\n \t}", "public boolean isValid() {\n\t\t\n\t\tif(this.size()!=2)\n\t\t\treturn false;\n\t\telse {\n\t\t\tint rank1=this.getCard(0).getRank();\n\t\t\tint rank2=this.getCard(1).getRank();\n\t\t\t\n\t\t\tif(rank1==rank2)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "public boolean isValid() {\n\t\tif (this.size()!=5) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.sort();\n\t\tif (this.getCard(2).getRank()==this.getCard(0).getRank() && this.getCard(3).getRank()==this.getCard(4).getRank()) {\n\t\t\treturn true;\n\t\t}\n\t\telse if (this.getCard(2).getRank()==this.getCard(4).getRank() && this.getCard(1).getRank()==this.getCard(0).getRank()) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public Boolean checkIfValidBuild(){\r\n int buildValue = 0;\r\n for (Card card: userChosenCards){\r\n buildValue += card.getNumValue();\r\n }\r\n\r\n buildValue += card.getNumValue();\r\n\r\n switch (option){\r\n case 1:\r\n if(userChosenCards.size() == 0){\r\n Toast.makeText(ChooseTableCardActivity.this,\r\n \"Invalid Build - Cannot create a build with just one card\",\r\n Toast.LENGTH_LONG).show();\r\n return false;\r\n }\r\n\r\n return player.checkBuildValueInHand(player.getPlayerHandVec(), buildValue);\r\n case 2:\r\n if (buildValue == round.getBuilds().get(player.getId()).getNumValue()){\r\n return true;\r\n }\r\n return false;\r\n }\r\n return false;\r\n }", "private boolean isCardValid(Card data) {\n // Check card if it valid to save isValid == true\n boolean isValid = (StringUtils.isEmpty(data.getName()) == false &&\n StringUtils.isEmpty(data.getAddress()) == false &&\n StringUtils.isEmpty(data.getPosition()) == false &&\n StringUtils.isEmpty(data.getGender()) == false);\n\n return isValid;\n }", "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "protected abstract boolean isValid();", "public boolean isValidMove(Card card)\n {\n return false;\n }", "@Then(\"^user selects and validates credit cards$\")\r\n\t public void selctcardstocompareandValidate(DataTable table) {\r\n\t\t try {\r\n\t\t WebElement ele;\r\n\t\t List<Map<String, String>> ccards = table.asMaps(String.class, String.class);\r\n\t String cc1 = ccards.get(0).get(\"card1\");\r\n\t String cc2 = ccards.get(0).get(\"card2\");\r\n\t \r\n\t\t//selecting card1\r\n\t ele=dbsdriver.findElement(By.xpath(\"//div[text()='\"+cc1+\"']/../../..//div[text()='Compare']/..//div\"));\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].scrollIntoView(true);\", ele);\r\n\t\twait.until(ExpectedConditions.elementToBeClickable(ele));\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].click();\",ele );\r\n\t\tThread.sleep(2500);\t\r\n\t\t\r\n\t\t//selecting card2\r\n\t\tele=dbsdriver.findElement(By.xpath(\"//div[text()='\"+cc2+\"']/../../..//div[text()='Compare']/..//div\"));\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].scrollIntoView(true);\", ele);\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].click();\", ele);\r\n\t\t\r\n\t\t//click on compare button\r\n\t\tdbsdriver.findElement(By.xpath(\"//button[@id='cardCompareBtn']\")).click();\r\n\t\ttest.log(LogStatus.PASS, \"user selected cards and clicked on compare button\");\r\n\t\t//validate the data displayed for each card for comparison\r\n\t\tcreditcardspage.validatecredicarddata(table);\r\n\t\t } catch (Exception e) {\r\n\t\t\t test.log(LogStatus.FAIL, e);\r\n\t\t\tcreditcardspage.aborttest(e+\"\");\r\n\t\t}\r\n\t }", "public boolean isValid() {\n\t\tif (this.size() != 5) return false;\n\t\tif (!((this.getCard(0).getSuit() == this.getCard(1).getSuit()) && (this.getCard(1).getSuit() == this.getCard(2).getSuit()) && (this.getCard(2).getSuit() == this.getCard(3).getSuit()) && (this.getCard(3).getSuit() == this.getCard(4).getSuit()))) return false;\n\t\t\n\t\tint[] cardsInHand= {this.getCard(0).getRank(), this.getCard(1).getRank(), this.getCard(2).getRank(), this.getCard(3).getRank(), this.getCard(4).getRank()};\n\t\t\n\t\tfor(int i=0;i<4;i++) {\n\t\t\tif (cardsInHand[i]==0) cardsInHand[i]=13;\n\t\t\telse if (cardsInHand[i]==1) cardsInHand[i]=14;\n\t\t}\n\t\t\n\t\tArrays.sort(cardsInHand);\n\t\tfor(int i=0;i<3;i++) {\n\t\t\tif(cardsInHand[i]!=cardsInHand[i+1]-1) return false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean validChoice() {\n\t\treturn validChoice;\n\t}", "public boolean isValid() {\r\n\t\tif (this.size() == 5) {\r\n\t\t\tthis.sort();\r\n\t\t\tif ((this.getCard(0).getRank() == this.getCard(1).getRank()) && (this.getCard(0).getRank() == this.getCard(2).getRank()) && (this.getCard(0).getRank() == this.getCard(3).getRank())) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse if ((this.getCard(1).getRank() == this.getCard(2).getRank()) && (this.getCard(1).getRank() == this.getCard(3).getRank()) && (this.getCard(1).getRank() == this.getCard(4).getRank())) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "@Test\n\tvoid test() {\n\t\t\n\t\tuserInput ui = new userInput();\n\t\t\n\t\tboolean test0 = ui.isValidChildcareType(0);\n\t\tboolean test1 = ui.isValidChildcareType(1);\n\t\tboolean test2 = ui.isValidChildcareType(2);\n\t\tboolean test3 = ui.isValidChildcareType(3);\n\t\tboolean test4 = ui.isValidChildcareType(4);\n\t\tboolean test5 = ui.isValidChildcareType(5);\n\t\tboolean test6 = ui.isValidChildcareType(-1);\n\t\t\n\t\tassertEquals(test0, false);\n\t\tassertEquals(test1, true);\n\t\tassertEquals(test2, true);\n\t\tassertEquals(test3, true);\n\t\tassertEquals(test4, true);\n\t\tassertEquals(test5, false);\n\t\tassertEquals(test6, false);\n\t}", "public static boolean isValid(int pos) {\n\n\t\t// Start at index jobsChosen-1 and go down to 0\n\t\tfor (int i = jobsChosen - 1; i >= 0; i--) {\n\t\t\tif (pos == currentCombo[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// Test passed, return true,position is not interfering with others\n\t\treturn true;\n\t}", "private static void validate(Card card) throws CardNumberException {\n card.validateNumber();\n }", "protected abstract boolean isInputValid();", "public boolean checkRequirements(PlayerBoard playerBoard);", "boolean checkValidity();", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "@Override\n public PlayingCard chooseCard() throws InterruptedException {\n\n boolean validInput = false;\n int max = hand.getSize();\n String inputStr;\n int inputInt = 0; // not ideal; but compiler is happier\n Scanner sc = new Scanner(System.in);\n\n while (!validInput) {\n this.hand.showCards();\n System.out.println(\"Choose a card from the above\");\n\n inputStr = Game.cleanStringInput(sc.nextLine());\n\n // only supports 0 ~ 9\n if (inputStr.matches(\"\\\\d\")) {\n\n if (inputStr.matches(\"0\")) {\n surrender(sc);\n inputStr = \"1\"; // to throw away last card\n }\n\n // - 1 is to allow usage of 1 - 9 for card selection instead\n // of 0 - 8...this converts card \"1\" into index 0.\n inputInt = (Integer.parseInt(inputStr)) - 1;\n\n // must be LESS than max...if size = 1, then \"max index\" == 0\n if (inputInt < max && inputInt >= 0) {\n validInput = true;\n } else {\n System.out.println(\"OOPS! Enter between 1 and \"\n + (max) + \"!\"); // \"between 1 and 1\" is acceptable\n Thread.sleep(1000);\n\n } // end check for acceptable index\n } else {\n System.out.println(\"OOPS! Enter a single digit ONLY!\");\n Thread.sleep(1000);\n } // end check for digit entered\n } // end \"while-loop\" check for valid input\n\n // if we're here, we can safely return the selected card\n return (PlayingCard) hand.removeCard(inputInt);\n }", "public Boolean isTradedCardSetValid() {\r\n\r\n\t\tif (lstTradedCards.size() == 3) {\r\n\r\n\t\t\tif (!isAWildCardSet()) {\r\n\t\t\t\t// If all the cards are same\r\n\t\t\t\tif (lstTradedCards.get(0).card_type.equals(lstTradedCards.get(1).card_type)\r\n\t\t\t\t\t\t&& lstTradedCards.get(1).card_type.equals(lstTradedCards.get(2).card_type)) {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Success\");\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// all 3 are different\r\n\t\t\t\telse if (!lstTradedCards.get(0).card_type.equals(lstTradedCards.get(1).card_type)\r\n\t\t\t\t\t\t&& !lstTradedCards.get(1).card_type.equals(lstTradedCards.get(2).card_type)\r\n\t\t\t\t\t\t&& !lstTradedCards.get(0).card_type.equals(lstTradedCards.get(2).card_type)) {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Success\");\r\n\t\t\t\t\tUtility.writeLog(\"card traded successfully\");\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (isValidCountWildCard()) {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Success\");\r\n\t\t\t\t\tUtility.writeLog(\"card traded successfully\");\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Please select only/atleast three cards!\");\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcardStatusLabel.setText(\"Please select only/atleast three cards!\");\r\n\t\treturn false;\r\n\t}", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Override\n public boolean isValid() {\n return (27 - Inventory.getAll().length <= Inventory.find(\"Soft clay\").length)\n || (Inventory.find(\"Soft clay\").length < 1 || Inventory\n .find(\"Astral rune\").length < 1)\n && !Banking.isBankScreenOpen()\n && GlassBlower.antiban.canInteractObject();\n }", "private boolean validateVisa() {\r\n\t\tString creditCardNumber = getCreditCardNumber();\r\n\t\t// checking the card number length\r\n\t\tif (creditCardNumber.length() != 13 && creditCardNumber.length() != 16 && creditCardNumber.length() != 19) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// checking the validity of the credit card number\r\n\t\tif (creditCardNumber.charAt(0) != '4') {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public boolean isValid() {\n\t\t//Check for size=3, then check if their ranks are same.\n\t\tif(this.size()==3) {\n\t\t\tif(this.getCard(0).getRank()==this.getCard(1).getRank()) {\n\t\t\t\tif(this.getCard(1).getRank()==this.getCard(2).getRank()){\n\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "private boolean isValidCard(int index)\n {\n if (index >= cards.size() || index < 0)\n return false;\n \n for (int i = index; i < cards.size() - 1; i++)\n if (!isDifferentColor(cards.get(i), cards.get(i + 1)) ||\n !isOneLess(cards.get(i + 1), cards.get(i)))\n return false;\n\n return true;\n }", "private boolean checkValid() {\n\t\tif(openRadio.isSelected()) {\n\t\t\t//Open loop mode.\n\t\t\treturn checkInfusionRate() && checkPumpSelected() && checkMonitorSelected();\n\t\t} else {\n\t\t\t//Closed loop mode.\n\t\t\t//Check patient selected\n\t\t\t//Check QCore selected\n\t\t\t//Check BP monitor selected\n\t\t\t//Check target BP range\n\t\t\t//Check infusion rate.\n\t\t\treturn checkTargetBPRange() && checkInfusionRate() && checkPumpSelected() && checkMonitorSelected();\n\t\t}\n\t}", "@Test\n\tpublic void testIsValid()\n\t{\n\t\tSystem.out.println(\"isValid\");\n\n\t\tUserTypeCode userTypeCode = new UserTypeCode();\n\t\tuserTypeCode.setCode(\"Test\");\n\t\tuserTypeCode.setDescription(\"Test\");\n\n\t\tValidationModel validateModel = new ValidationModel(userTypeCode);\n\t\tvalidateModel.setConsumeFieldsOnly(true);\n\n\t\tboolean expResult = true;\n\t\tboolean result = ValidationUtil.isValid(validateModel);\n\t\tassertEquals(expResult, result);\n\n\t\tvalidateModel = new ValidationModel(userTypeCode);\n\n\t\texpResult = false;\n\t\tresult = ValidationUtil.isValid(validateModel);\n\t\tassertEquals(expResult, result);\n\t}", "public CardChoice getCardChoices(PlayerPiece playerPiece) {\n System.out.println(\"Please select one of the following Rooms (Type in room name):\");\n System.out.println(this.getRoomCards());\n boolean validCard = false;\n RoomCard roomCard = this.findRoomCard(sc.nextLine());\n if (roomCard == null) {\n while (!validCard) {\n System.out.println(\"Invalid input! Please select one of the following Rooms (Type in room name):\");\n System.out.println(this.getRoomCards());\n roomCard = this.findRoomCard(sc.nextLine());\n if (roomCard != null) {\n validCard = true;\n }\n }\n }\n validCard = false;\n WeaponCard weaponCard = this.findWeaponCard(sc.nextLine());\n if (weaponCard == null) {\n while (!validCard) {\n System.out.println(\"Invalid input! Please select one of the following weapons (Type in room name):\");\n System.out.println(this.getRoomCards());\n weaponCard = this.findWeaponCard(sc.nextLine());\n if (weaponCard != null) {\n validCard = true;\n }\n }\n }\n validCard = false;\n SuspectCard suspectCard = this.findSuspectCard(sc.nextLine());\n if (suspectCard == null) {\n while (!validCard) {\n System.out.println(\"Invalid input! Please select one of the following suspect (Type in room name):\");\n System.out.println(this.getRoomCards());\n suspectCard = this.findSuspectCard(sc.nextLine());\n if (suspectCard != null) {\n validCard = true;\n }\n }\n }\n return new CardChoice(playerPiece, roomCard, weaponCard, suspectCard);\n\n }", "public abstract boolean isValid();", "public abstract boolean isValid();", "public abstract boolean isValid();", "public void validateSelection()\r\n {\r\n for (int i = 0; i<getSelectedElements().size(); ++i)\r\n {\r\n ReportElement re = (ReportElement)getSelectedElements().elementAt(i);\r\n if (!getCrosstabElement().getElements().contains( re ))\r\n {\r\n getSelectedElements().remove(re);\r\n --i;\r\n }\r\n }\r\n // UPDATE SELECTION NOW!!!\r\n }", "private boolean isValidOption(int option){\n return (option >= 0) && (option < this.count());\n }", "protected boolean isValid() {\n \t\treturn valid;\n \t}", "private void validate() {\n\n etCardNumber.validate();\n\n etCardExpiryDate.validate();\n\n etCardCvv.validate();\n\n etCardHolderName.validate();\n\n etPhoneNumber.validate();\n\n etCustomerName.validate();\n }", "@Test\n @SmallTest\n public void tesUiccCartdInfoSanity() {\n assertEquals(0, mUicccard.getNumApplications());\n assertNull(mUicccard.getCardState());\n assertNull(mUicccard.getUniversalPinState());\n assertNull(mUicccard.getOperatorBrandOverride());\n /* CarrierPrivilegeRule equals null, return true */\n assertTrue(mUicccard.areCarrierPriviligeRulesLoaded());\n for (IccCardApplicationStatus.AppType mAppType :\n IccCardApplicationStatus.AppType.values()) {\n assertFalse(mUicccard.isApplicationOnIcc(mAppType));\n }\n }", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean check(ArrayList<Card> cards){\n int val = cards.get(0).getVal();\n if(val == 2 || val == 10)\n return true;\n //sevens are special\n if(topCardVal() == 7)\n return (topCardVal() >= val);\n return (topCardVal() <= val);\n }", "@Override\n public boolean checkRequirement(PlayerContext playerContext) {\n int sumOfRightColourAndLevelCard = 0;\n for (DevelopmentCard developmentCard : playerContext.getAllDevelopmentCards()){\n if (developmentCard.getColour() == cardColour && developmentCard.getLevel() == cardLevel)\n sumOfRightColourAndLevelCard ++;\n }\n return sumOfRightColourAndLevelCard >= numberOfCards;\n }", "@Test\n\tpublic void testOptionsValid(){\n\t\t// TEST 1\n\t\tGameTypeOptions.TrumpSuit trump = GameTypeOptions.TrumpSuit.Clubs;\n\t\tGameTypeOptions.SkatHandType skathandType = GameTypeOptions.SkatHandType.Skat;\n\t\tGameTypeOptions.GameType actualGameType = GameTypeOptions.GameType.Suit;\n\t\tboolean ouvert = true;\n\t\tboolean schwarz = false;\n\t\tboolean schneider = true;\t\n\t\t// Create our GameType.\n\t\tGameTypeOptions gameType = new GameTypeOptions(skathandType, actualGameType, trump, ouvert, schneider, schwarz);\n\t\t\n\t\t// Assert our options.\n\t\tassertEquals(\"Invalid Trump Suit set in GameTypeOptions, should be \" + trump + \" got \" + gameType.getTrumpSuit(), trump, gameType.getTrumpSuit());\n\t\tassertEquals(\"Invalid Skat Hand Type set in GameTypeOptions, should be \" + skathandType + \" got \" + gameType.getHandType(), skathandType, gameType.getHandType());\n\t\tassertEquals(\"Invalid GameType set in GameTypeOptions, should be \" + actualGameType + \" got \" + gameType.getGameType(), actualGameType, gameType.getGameType());\n\t\tassertEquals(\"Invalid ouvert status in GameTypeOptions, should be \" + ouvert + \" got \" + gameType.getOuvert(), ouvert, gameType.getOuvert());\n\t\tassertEquals(\"Invalid schwarz status in GameTypeOptions, should be \" + schwarz + \" got \" + gameType.getSchwarz(), schwarz, gameType.getSchwarz());\n\t\tassertEquals(\"Invalid schneider status in GameTypeOptions, should be \" + schneider + \" got \" + gameType.getSchneider(), schneider, gameType.getSchneider());\n\t\t\n\t\t// TEST 2\n\t\ttrump = GameTypeOptions.TrumpSuit.None;\n\t\tskathandType = GameTypeOptions.SkatHandType.Hand;\n\t\tactualGameType = GameTypeOptions.GameType.Null;\n\t\touvert = true;\n\t\tschwarz = false;\n\t\tschneider = false;\t\n\t\t// Create our GameType.\n\t\tgameType = new GameTypeOptions(skathandType, actualGameType, trump, ouvert, schneider, schwarz);\n\t\t\n\t\t// Assert our options.\n\t\tassertEquals(\"Invalid Trump Suit set in GameTypeOptions, should be \" + trump + \" got \" + gameType.getTrumpSuit(), trump, gameType.getTrumpSuit());\n\t\tassertEquals(\"Invalid Skat Hand Type set in GameTypeOptions, should be \" + skathandType + \" got \" + gameType.getHandType(), skathandType, gameType.getHandType());\n\t\tassertEquals(\"Invalid GameType set in GameTypeOptions, should be \" + actualGameType + \" got \" + gameType.getGameType(), actualGameType, gameType.getGameType());\n\t\tassertEquals(\"Invalid ouvert status in GameTypeOptions, should be \" + ouvert + \" got \" + gameType.getOuvert(), ouvert, gameType.getOuvert());\n\t\tassertEquals(\"Invalid schwarz status in GameTypeOptions, should be \" + schwarz + \" got \" + gameType.getSchwarz(), schwarz, gameType.getSchwarz());\n\t\tassertEquals(\"Invalid schneider status in GameTypeOptions, should be \" + schneider + \" got \" + gameType.getSchneider(), schneider, gameType.getSchneider());\n\t\t\n\t\t// TEST 3\n\t\ttrump = GameTypeOptions.TrumpSuit.None;\n\t\tskathandType = GameTypeOptions.SkatHandType.Hand;\n\t\tactualGameType = GameTypeOptions.GameType.Grand;\n\t\touvert = false;\n\t\tschwarz = false;\n\t\tschneider = false;\t\n\t\t// Create our GameType.\n\t\tgameType = new GameTypeOptions(skathandType, actualGameType, trump, ouvert, schneider, schwarz);\n\t\t\n\t\t// Assert our options.\n\t\tassertEquals(\"Invalid Trump Suit set in GameTypeOptions, should be \" + trump + \" got \" + gameType.getTrumpSuit(), trump, gameType.getTrumpSuit());\n\t\tassertEquals(\"Invalid Skat Hand Type set in GameTypeOptions, should be \" + skathandType + \" got \" + gameType.getHandType(), skathandType, gameType.getHandType());\n\t\tassertEquals(\"Invalid GameType set in GameTypeOptions, should be \" + actualGameType + \" got \" + gameType.getGameType(), actualGameType, gameType.getGameType());\n\t\tassertEquals(\"Invalid ouvert status in GameTypeOptions, should be \" + ouvert + \" got \" + gameType.getOuvert(), ouvert, gameType.getOuvert());\n\t\tassertEquals(\"Invalid schwarz status in GameTypeOptions, should be \" + schwarz + \" got \" + gameType.getSchwarz(), schwarz, gameType.getSchwarz());\n\t\tassertEquals(\"Invalid schneider status in GameTypeOptions, should be \" + schneider + \" got \" + gameType.getSchneider(), schneider, gameType.getSchneider());\n\t\t\n\t}", "private boolean verifySelection() {\n String caseName = caseNameText.getText().trim();\n if (caseName.length() == 0) {\n MessageDialog.openError(shell, \"Error\", \"Enter a case name.\");\n return false;\n }\n\n File caseDir = new File(locationDir, caseName);\n if (caseDir.exists()) {\n MessageDialog.openError(shell, \"Error\",\n \"Case already exists choose another name.\");\n caseNameText.selectAll();\n caseNameText.setFocus();\n return false;\n }\n\n setReturnValue(caseDir);\n return true;\n }", "protected boolean isValid()\r\n {\r\n \treturn true;\r\n }", "@Test\n public void testCardCanPlay_WILD() {\n System.out.println(\"cardCanPlay WILD\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "private void checkValid() {\n getSimType();\n getInitialConfig();\n getIsOutlined();\n getEdgePolicy();\n getNeighborPolicy();\n getCellShape();\n }", "private boolean validateInputs(){\n if(jrTakeTest.isSelected()==false && jrViewScores.isSelected()==false && jrChangePassword.isSelected()==false)\n return false;\n return true;\n}", "public static boolean isValid(String _card){\r\n\t\t//communication with sumOfDoubleEvenPlace() and sumOfOddPlace()\r\n\t\tsumOfDoubleEvenPlace(_card);\r\n\t\tsumOfOddPlace(_card);\r\n\t\tgetCompany(_card);\r\n\t\tString _errorLength = \"Invalid number of digits.\";\r\n\t\tString _errorInvalid = \"Invalid credit card number.\";\r\n\t\t\r\n\t\t//condition for valid credit card.\r\n\t\tif((getCompany(_card) != _errorInvalid) && (getCompany(_card) != _errorLength)){\r\n\t\t\tif((sumOfDoubleEvenPlace(_card) + sumOfOddPlace(_card) != 0)){\t//if user enters all zeroes\r\n\t\t\t\tif ((sumOfDoubleEvenPlace(_card) + sumOfOddPlace(_card)) % 10 == 0 ){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\treturn false;\r\n\t\t\t\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\t\r\n\t}", "public boolean isValid() {\n //valid melds must have 3+ tile\n if (tiles.size() < 3) {\n //System.out.println(\"fail 1\");\n return false;\n }\n if (tiles.get(0).getColour() == tiles.get(1).getColour() &&\n\t\t\ttiles.get(0).getValue() != tiles.get(1).getValue()) { //test a run\n\t\t\tif (this.size() > 13) {\n //System.out.println(\"fail 2\");\n return false;\n }\n for (int i=1; i<tiles.size(); i++) {\n if (tiles.get(i).getColour() != tiles.get(0).getColour()) { //make sure all are same colour\n //System.out.println(\"fail 3\");\n return false;\n }\n if (tiles.get(i).getValue() != (tiles.get(0).getValue() + i)) { //make sure all values make a run\n //System.out.println(\"fail 4\");\n return false;\n }\n }\n } else { //test a set\n Set<Character> colours = new HashSet<>();\n for (int i=0; i<tiles.size(); i++) {\n if (tiles.get(i).getValue() != tiles.get(0).getValue()) { //all are same value\n //System.out.println(\"fail 5\");\n\t\t\t\t\treturn false;\n }\n\n if (colours.contains(tiles.get(i).getColour()) && tiles.get(i).getColour() != 'J') { //check for duplicate colours\n //System.out.println(\"fail 6\");\n\t\t\t\t\treturn false;\n } else {\n\t\t\t\t\tcolours.add(tiles.get(i).getColour()); //keep track of all the colours this set has\n }\n }\n if (this.size() > 4) { //only possible if there are 5 cards, including a joker\n //System.out.println(\"fail 7\");\n\t\t\t\treturn false;\n }\n }\n\n return true; \n }", "@Test\n public void CardRequirementError() {\n MSG_ACTION_ACTIVATE_LEADERCARD message = new MSG_ACTION_ACTIVATE_LEADERCARD(0);\n DevelopmentCard card1 = new DevelopmentCard(1, Color.GREEN, 0, null, null);\n p.getDevelopmentSlot().addCard(card1, 1);\n c.emptyQueue();\n assertFalse(am.activateLeaderCard(p, message));\n assertEquals(MessageType.MSG_ERROR, c.messages.get(0).getMessageType());\n assertEquals(1, c.messages.size());\n }", "protected abstract boolean isCardActivatable(Card card);", "public boolean isValid(){\r\n\t\t\r\n\t\t// TODO\r\n\t\t\r\n\t\treturn true;\r\n\t}", "private boolean isValid( int r, int c )\n {\n return r >= 0 && r < rows && c >= 0 && c < cols ; \n }", "protected boolean canChoose(int n, Board gameBoard) {\n Card chosenCard = myCards.get(n);// get the chosenCard\n Card groundCard = gameBoard.getGroundCard();\n if (chosenCard.getColor() == groundCard.getColor()) { // if they had same color\n return true;\n }\n if (chosenCard instanceof NumericCard && groundCard instanceof NumericCard) {// if they had same number\n NumericCard tempChosen = (NumericCard) chosenCard; // change the static type\n NumericCard tempground = (NumericCard) groundCard; // change the static type\n if (tempChosen.getNumber() == tempground.getNumber()) {\n return true;\n }\n }\n\n if (groundCard.getClass().equals(chosenCard.getClass()) && !(groundCard instanceof NumericCard)\n && !(chosenCard instanceof NumericCard)) {// if they were sameInstance\n return true;\n }\n return false;\n }", "abstract boolean allowedToAdd(Card card);", "@Override\r\n\tpublic boolean isValid(String ccNumber) \r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tvalidate(ccNumber);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "boolean hasAlreadFoldCard();", "@Test\n public void isCorrectTest(){\n BuyCard cardErr = new BuyCard(12,0);\n\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Row index out of bounds.\");\n cardErr.isCorrect();\n }", "public boolean isValid() {\n\t\t\n\t\tif (this.size() == 2)\n\t\t\tif (this.getCard(0).getRank() == this.getCard(1).getRank())\n\t\t\t\treturn true;\n\t\t\n\t\treturn false;\n\t}", "protected abstract int isValidInput();", "@Test\n\tpublic void furtherSelectionTest() {\n\t\tSelectionController selectionController = new SelectionController();\n\t\tint[] selection = { 1, 2, 3, 4, 5, 6 };\n\t\tint[] unSelecion = { 1, 2, 3 };\n\t\tint[] resultSelection = { 4, 5, 6 };\n\t\tint[] negativeSelection = { -1 };\n\n\t\t// select something and unselect parts of it\n\t\tselectionController.select(selection);\n\t\tassertArrayEquals(\"Selection was different\", selection, selectionController.getSelection());\n\t\tselectionController.unselect(unSelecion);\n\t\tassertArrayEquals(\"Selection was different after unselection\", resultSelection,\n\t\t\t\tselectionController.getSelection());\n\n\t\t// do a reselection\n\t\tselectionController.reselect(unSelecion);\n\t\tassertArrayEquals(\"Selection was different after reselection\", unSelecion, selectionController.getSelection());\n\n\t\tassertTrue(\"Item 1 is selected\", selectionController.isSelected(1));\n\t\tassertTrue(\"Item 2 is selected\", selectionController.isSelected(2));\n\t\tassertTrue(\"Item 3 is selected\", selectionController.isSelected(3));\n\t\tassertFalse(\"Item 4 is not selected\", selectionController.isSelected(4));\n\t\tassertFalse(\"Item 5 is not selected\", selectionController.isSelected(5));\n\t\tassertFalse(\"Item 6 is not selected\", selectionController.isSelected(6));\n\n\t\t// unselect all elements\n\t\tselectionController.unselect(unSelecion);\n\t\tassertFalse(\"Nothing was selected\", selectionController.isSomethingSelected());\n\t\tassertEquals(\"The array should have length zero\", 0, selectionController.getSelection().length);\n\n\t\t// select something negative\n\t\tselectionController.select(negativeSelection);\n\t\tassertFalse(\"Nothing should be selected\", selectionController.isSomethingSelected());\n\t\tassertEquals(\"The array should have length zero after selection\", 0, selectionController.getSelection().length);\n\n\t\t// reselect something negative\n\t\tselectionController.select(selection);\n\t\tselectionController.reselect(negativeSelection);\n\t\tassertFalse(\"Nothing should be reselected\", selectionController.isSomethingSelected());\n\t\tassertEquals(\"The array should have length zero after reselection\", 0,\n\t\t\t\tselectionController.getSelection().length);\n\n\t}", "public boolean isValid(GameState gameState);", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean checkBlackJack() {\r\n if(cards.size() == 2 && score() == 21){\r\n blackJack = true;\r\n over = true;\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }", "@Test\n\tpublic void argumentTest() {\n\t\tSelectionController selectionController = new SelectionController();\n\t\ttry {\n\t\t\tselectionController.select(null);\n\t\t\tAssert.fail(\"The new selection was null\");\n\t\t} catch (NullPointerException e) {\n\t\t}\n\n\t\ttry {\n\t\t\tselectionController.unselect(null);\n\t\t\tAssert.fail(\"The new unselection was null\");\n\t\t} catch (NullPointerException e) {\n\t\t}\n\n\t\ttry {\n\t\t\tselectionController.reselect(null);\n\t\t\tAssert.fail(\"The new reselection was null\");\n\t\t} catch (NullPointerException e) {\n\t\t}\n\t}", "public boolean checkCollection(Player player, PropertyCard card) {\n\t\tboolean almostComplete = false;\n\t\tfor(PropertyCard c: player.getCards()) {\n\t\t\tif(c.getTeam().equals(card.getTeam())) {\n\t\t\t\tif(countSameTeamCards(player, card) == card.getTeamSize()-1) {\n\t\t\t\t\talmostComplete = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn almostComplete;\n\t}", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\r\n public void testPlayer_getCautiousStrategyCardCard_numeric_matchColorNotNumber() {\n player2 = new Player(\"Player Two\", true);\r\n player2.setHand(strategyHand.getAllCards());\r\n\r\n // let the cpc be a yellow three\r\n // get rid of all non-numeric cards and the green three so the yellow six is the most attractive option\r\n player2.getHand().discard(wild);\r\n player2.getHand().discard(wildDrawFour);\r\n player2.getHand().discard(yellowReverse);\r\n player2.getHand().discard(redDrawTwo);\r\n player2.getHand().discard(greenThree);\r\n\r\n assertTrue(player2.getCautiousStrategyCard(yellowThree, yellowThree.getColor()).equals(yellowSix));\r\n }", "protected abstract boolean isValidOption(String option);", "private boolean checkAttemptValid( String attempt ) {\r\n String tokenString = attempt.replaceAll( \"[^\\\\d]\", \" \");\r\n StringTokenizer st = new StringTokenizer(tokenString);\r\n int[] userNums = new int[st.countTokens()];\r\n int i=0;\r\n while(st.hasMoreTokens()) {\r\n int num = Integer.parseInt( st.nextToken());\r\n userNums[i] = num;\r\n i++;\r\n }\r\n if( !numbersCorrect( userNums )) {\r\n target.reply(\"You used a number not in the selection!\");\r\n return false;\r\n }\r\n //all numbers are correct, so now check remaining operators.\r\n //we gradually strip away everything allowed. If anything is left after that,\r\n //the attempt is invalid.\r\n attempt = attempt.replaceAll(\"\\\\d\", \"\"); //strip all numbers\r\n attempt = attempt.replaceAll(\"/\", \"\"); //strip \\ sign\r\n attempt = attempt.replaceAll(\"\\\\*\", \"\"); //strip *\r\n attempt = attempt.replaceAll(\"\\\\+\", \"\"); //strip +\r\n attempt = attempt.replaceAll(\"\\\\-\", \"\"); //strip -\r\n attempt = attempt.replaceAll(\"\\\\)\", \"\"); //strip )\r\n attempt = attempt.replaceAll(\"\\\\(\", \"\"); //strip (\r\n attempt = attempt.replaceAll(\" \", \"\"); //zap spaces\r\n\r\n return attempt.length() <= 0;\r\n }", "public boolean canBecombo(){\n \treturn price <5;\n }", "@Test(expected = DidNotPickCardException.class)\n public void allow_discard_only_if_picked_before(){\n\n Deck deck = new Deck();\n deck.add(new Card(3,2,5));\n Game game = new Game(deck);\n\n game.join(\"susan\");\n game.join(\"peter\");\n\n game.discard(\"susan\");\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test\n\tprivate void checkPossibilityTest() {\n\t\tint[] input = new int[] {1,1,1};\n Assertions.assertThat(checkPossibility(input)).isTrue();\n\n input = new int[] {0,0,3};\n Assertions.assertThat(checkPossibility(input)).isTrue();\n\n input = new int[] {4,2,3};\n Assertions.assertThat(checkPossibility(input)).isTrue();\n\n input = new int[] {2,3,4,2,3};\n Assertions.assertThat(checkPossibility(input)).isFalse();\n\t}" ]
[ "0.8362122", "0.65338314", "0.63042736", "0.6287026", "0.62068903", "0.61873925", "0.6051241", "0.60474575", "0.6042071", "0.60165334", "0.59848005", "0.59839773", "0.5959615", "0.59477454", "0.5945105", "0.5931404", "0.5922863", "0.5861054", "0.5860923", "0.5840054", "0.5834779", "0.58204615", "0.5779997", "0.5743394", "0.57229227", "0.5694568", "0.5692016", "0.56874496", "0.5683491", "0.564167", "0.56247574", "0.56238675", "0.5599851", "0.5588364", "0.55853385", "0.5570431", "0.55355763", "0.55196303", "0.5518813", "0.5506359", "0.5506359", "0.5506359", "0.5506359", "0.5506359", "0.54986835", "0.5496579", "0.54917437", "0.549147", "0.54796", "0.5469198", "0.54667115", "0.54658127", "0.5455614", "0.5455614", "0.5455614", "0.54529583", "0.54484177", "0.54468197", "0.5440599", "0.54323745", "0.54291975", "0.54291975", "0.54291975", "0.54291975", "0.54291975", "0.54249704", "0.54230434", "0.54197246", "0.54122597", "0.5394834", "0.5393896", "0.5384674", "0.53827214", "0.5382404", "0.53780025", "0.5369822", "0.53673023", "0.536666", "0.53628045", "0.5361336", "0.5355549", "0.5354571", "0.53509027", "0.53484094", "0.53462064", "0.53235143", "0.5318453", "0.5314134", "0.5310445", "0.53085554", "0.53044146", "0.53015375", "0.5300149", "0.52899563", "0.5289383", "0.5285378", "0.52846885", "0.5284027", "0.527934", "0.5269651" ]
0.8222797
1
Test of cardSelectionIsValid method, of class utils.
@Test public void testCardSelectionIsValid_TRUE() throws Exception { System.out.println("cardSelectionIsValid not valid"); UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE); UnoCardColour wildColour = UnoCardColour.BLUE; utils.cardSelectionIsValid(cardSelection, drawCard, wildColour); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test(expected = Exception.class)\n public void testCardSelectionIsValid_FALSE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n \n }", "private boolean validateCard() {\n Card card = new Card(\n editTextCreditCardNumber.getText().toString(),\n selectedMonth,\n selectedYear,\n editTextCCV.getText().toString()\n );\n boolean validation = card.validateCard();\n if (validation) {\n return true;\n } else if (!card.validateNumber()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardErrorNumber), Toast.LENGTH_SHORT).show();\n return false;\n } else if (!card.validateExpiryDate()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardErrorExpiryDate), Toast.LENGTH_SHORT).show();\n return false;\n } else if (!card.validateCVC()) {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardErrorCCV), Toast.LENGTH_SHORT).show();\n return false;\n } else {\n Toast.makeText(getActivity(), getResources().getString(R.string.creditCardError), Toast.LENGTH_SHORT).show();\n return false;\n }\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Override\n public boolean isLegal(List<Integer> selectedCards)\n {\n //checks if the two cards selected added together equal 13\n if(selectedCards.size() == 2)\n {\n if(containsSum13(selectedCards))\n {\n \treturn true;\n }\n }\n \n //checks if the selected card is a K\n if(selectedCards.size() == 1)\n {\n \treturn containsK(selectedCards);\n }\n return false;\n \n }", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public void testCardCanPlay_FALSE() {\n System.out.println(\"cardCanPlay FALSE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_TRUE() {\n System.out.println(\"cardCanPlay TRUE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "private boolean validInput(Player player, int choice) {\n if (0 <= choice && choice < player.getCards().size()) {\n if(state.getWildDrawPenalty() != 1 && player.getCards().get(choice) instanceof WildDrawCard) {\n return true;\n }\n if( state.getWildDrawPenalty() != 1 && !(player.getCards().get(choice) instanceof WildDrawCard)) {\n System.out.println(\"You should put WildDraw card.\");\n return false;\n }\n if( player.getCards().get(choice) instanceof WildDrawCard){\n boolean validWildDraw = true;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard)) {\n validWildDraw = false;\n }\n }\n if (validWildDraw) {\n return true;\n }\n else {\n System.out.println(\"You can't put WildDraw card.\");\n return false;\n }\n }\n if(state.getDrawPenalty() != 1 && player.getCards().get(choice) instanceof Draw2Card) {\n return true;\n }\n if (state.getDrawPenalty() != 1 && !(player.getCards().get(choice) instanceof Draw2Card)) {\n System.out.println(\"You should put Draw2 card.\");\n return false;\n }\n if ( player.getCards().get(choice).isValidCard(currentCard)) {\n return true;\n }\n System.out.println(\"Enter valid card.\");\n return false;\n }\n System.out.println(\"Enter a number between 1-\" + player.getCards().size() );\n return false;\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public interface ValidateCardSelection {\n boolean validate(CardStack stack, Game g);\n}", "void checkValid();", "@Test\n public void checkValidityTest1() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n assert (g.checkValidity(g.getDeck()));\n }", "@Override\n\tboolean isValid(){\n\t\tif(size()==5) {\n\t\t\tint suite = getCard(0).suit;\n\t\t\tfor(int i = 1 ; i< size(); i++) {\n\t\t\t\tif(getCard(i).suit != suite) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tsort();\n\t\t\tint currRank = (getCard(0).rank +11)%13;\n\t\t\tfor(int i=0; i<size(); i++) {\n\t\t\t\tif((getCard(i).rank+11)%13 != currRank) return false;\n\t\t\t\tcurrRank++;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\n public void testCardCanPlay_TRUE_VALUE() {\n System.out.println(\"cardCanPlay TRUE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE_VALUE() {\n System.out.println(\"cardCanPlay FALSE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "public boolean testSelected() {\n // test if set\n boolean set = Card.isSet(\n selectedCards.get(0).getCard(),\n selectedCards.get(1).getCard(),\n selectedCards.get(2).getCard()\n );\n\n // set currentlySelected to false and replace with new Cards (if applicable)\n for (BoardSquare bs : selectedCards)\n bs.setCurrentlySelected(false);\n\n // handle if set\n if (set) {\n if (!deck.isEmpty() && this.numCardsOnBoard() == 12) {\n for (BoardSquare bs : selectedCards)\n bs.setCard(deck.getTopCard());\n }\n else if (!deck.isEmpty() && this.numCardsOnBoard() < 12) {\n board.compressBoard(selectedCards);\n this.add3();\n }\n else {\n board.compressBoard(selectedCards);\n }\n }\n\n // clear ArrayList\n selectedCards.clear();\n\n // return bool\n return set;\n }", "public boolean checkValidSelection(Point start, Point end){\n \t\tboolean flag = false;\n \t\tif (start.x == end.x) {\n \t\t\tflag = true;\n \t\t}\n \t\telse if (start.y == end.y) {\n \t\t\tflag = true;\n \t\t}\n \t\telse if ((start.x - start.y) == (end.x - end.y)) {\n \t\t\tflag = true;\n \t\t}\n \t\telse if ((start.x + start.y) == (end.x + end.y)) {\n \t\t\tflag = true;\n \t\t}\n \t\treturn flag;\n \t}", "public boolean isValid() {\n\t\t\n\t\tif(this.size()!=2)\n\t\t\treturn false;\n\t\telse {\n\t\t\tint rank1=this.getCard(0).getRank();\n\t\t\tint rank2=this.getCard(1).getRank();\n\t\t\t\n\t\t\tif(rank1==rank2)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "public boolean isValid() {\n\t\tif (this.size()!=5) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.sort();\n\t\tif (this.getCard(2).getRank()==this.getCard(0).getRank() && this.getCard(3).getRank()==this.getCard(4).getRank()) {\n\t\t\treturn true;\n\t\t}\n\t\telse if (this.getCard(2).getRank()==this.getCard(4).getRank() && this.getCard(1).getRank()==this.getCard(0).getRank()) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public Boolean checkIfValidBuild(){\r\n int buildValue = 0;\r\n for (Card card: userChosenCards){\r\n buildValue += card.getNumValue();\r\n }\r\n\r\n buildValue += card.getNumValue();\r\n\r\n switch (option){\r\n case 1:\r\n if(userChosenCards.size() == 0){\r\n Toast.makeText(ChooseTableCardActivity.this,\r\n \"Invalid Build - Cannot create a build with just one card\",\r\n Toast.LENGTH_LONG).show();\r\n return false;\r\n }\r\n\r\n return player.checkBuildValueInHand(player.getPlayerHandVec(), buildValue);\r\n case 2:\r\n if (buildValue == round.getBuilds().get(player.getId()).getNumValue()){\r\n return true;\r\n }\r\n return false;\r\n }\r\n return false;\r\n }", "private boolean isCardValid(Card data) {\n // Check card if it valid to save isValid == true\n boolean isValid = (StringUtils.isEmpty(data.getName()) == false &&\n StringUtils.isEmpty(data.getAddress()) == false &&\n StringUtils.isEmpty(data.getPosition()) == false &&\n StringUtils.isEmpty(data.getGender()) == false);\n\n return isValid;\n }", "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "protected abstract boolean isValid();", "public boolean isValidMove(Card card)\n {\n return false;\n }", "@Then(\"^user selects and validates credit cards$\")\r\n\t public void selctcardstocompareandValidate(DataTable table) {\r\n\t\t try {\r\n\t\t WebElement ele;\r\n\t\t List<Map<String, String>> ccards = table.asMaps(String.class, String.class);\r\n\t String cc1 = ccards.get(0).get(\"card1\");\r\n\t String cc2 = ccards.get(0).get(\"card2\");\r\n\t \r\n\t\t//selecting card1\r\n\t ele=dbsdriver.findElement(By.xpath(\"//div[text()='\"+cc1+\"']/../../..//div[text()='Compare']/..//div\"));\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].scrollIntoView(true);\", ele);\r\n\t\twait.until(ExpectedConditions.elementToBeClickable(ele));\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].click();\",ele );\r\n\t\tThread.sleep(2500);\t\r\n\t\t\r\n\t\t//selecting card2\r\n\t\tele=dbsdriver.findElement(By.xpath(\"//div[text()='\"+cc2+\"']/../../..//div[text()='Compare']/..//div\"));\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].scrollIntoView(true);\", ele);\r\n\t\t((JavascriptExecutor) dbsdriver).executeScript(\"arguments[0].click();\", ele);\r\n\t\t\r\n\t\t//click on compare button\r\n\t\tdbsdriver.findElement(By.xpath(\"//button[@id='cardCompareBtn']\")).click();\r\n\t\ttest.log(LogStatus.PASS, \"user selected cards and clicked on compare button\");\r\n\t\t//validate the data displayed for each card for comparison\r\n\t\tcreditcardspage.validatecredicarddata(table);\r\n\t\t } catch (Exception e) {\r\n\t\t\t test.log(LogStatus.FAIL, e);\r\n\t\t\tcreditcardspage.aborttest(e+\"\");\r\n\t\t}\r\n\t }", "public boolean isValid() {\n\t\tif (this.size() != 5) return false;\n\t\tif (!((this.getCard(0).getSuit() == this.getCard(1).getSuit()) && (this.getCard(1).getSuit() == this.getCard(2).getSuit()) && (this.getCard(2).getSuit() == this.getCard(3).getSuit()) && (this.getCard(3).getSuit() == this.getCard(4).getSuit()))) return false;\n\t\t\n\t\tint[] cardsInHand= {this.getCard(0).getRank(), this.getCard(1).getRank(), this.getCard(2).getRank(), this.getCard(3).getRank(), this.getCard(4).getRank()};\n\t\t\n\t\tfor(int i=0;i<4;i++) {\n\t\t\tif (cardsInHand[i]==0) cardsInHand[i]=13;\n\t\t\telse if (cardsInHand[i]==1) cardsInHand[i]=14;\n\t\t}\n\t\t\n\t\tArrays.sort(cardsInHand);\n\t\tfor(int i=0;i<3;i++) {\n\t\t\tif(cardsInHand[i]!=cardsInHand[i+1]-1) return false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean validChoice() {\n\t\treturn validChoice;\n\t}", "public boolean isValid() {\r\n\t\tif (this.size() == 5) {\r\n\t\t\tthis.sort();\r\n\t\t\tif ((this.getCard(0).getRank() == this.getCard(1).getRank()) && (this.getCard(0).getRank() == this.getCard(2).getRank()) && (this.getCard(0).getRank() == this.getCard(3).getRank())) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse if ((this.getCard(1).getRank() == this.getCard(2).getRank()) && (this.getCard(1).getRank() == this.getCard(3).getRank()) && (this.getCard(1).getRank() == this.getCard(4).getRank())) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "@Test\n\tvoid test() {\n\t\t\n\t\tuserInput ui = new userInput();\n\t\t\n\t\tboolean test0 = ui.isValidChildcareType(0);\n\t\tboolean test1 = ui.isValidChildcareType(1);\n\t\tboolean test2 = ui.isValidChildcareType(2);\n\t\tboolean test3 = ui.isValidChildcareType(3);\n\t\tboolean test4 = ui.isValidChildcareType(4);\n\t\tboolean test5 = ui.isValidChildcareType(5);\n\t\tboolean test6 = ui.isValidChildcareType(-1);\n\t\t\n\t\tassertEquals(test0, false);\n\t\tassertEquals(test1, true);\n\t\tassertEquals(test2, true);\n\t\tassertEquals(test3, true);\n\t\tassertEquals(test4, true);\n\t\tassertEquals(test5, false);\n\t\tassertEquals(test6, false);\n\t}", "public static boolean isValid(int pos) {\n\n\t\t// Start at index jobsChosen-1 and go down to 0\n\t\tfor (int i = jobsChosen - 1; i >= 0; i--) {\n\t\t\tif (pos == currentCombo[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// Test passed, return true,position is not interfering with others\n\t\treturn true;\n\t}", "private static void validate(Card card) throws CardNumberException {\n card.validateNumber();\n }", "protected abstract boolean isInputValid();", "public boolean checkRequirements(PlayerBoard playerBoard);", "boolean checkValidity();", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "@Override\n public PlayingCard chooseCard() throws InterruptedException {\n\n boolean validInput = false;\n int max = hand.getSize();\n String inputStr;\n int inputInt = 0; // not ideal; but compiler is happier\n Scanner sc = new Scanner(System.in);\n\n while (!validInput) {\n this.hand.showCards();\n System.out.println(\"Choose a card from the above\");\n\n inputStr = Game.cleanStringInput(sc.nextLine());\n\n // only supports 0 ~ 9\n if (inputStr.matches(\"\\\\d\")) {\n\n if (inputStr.matches(\"0\")) {\n surrender(sc);\n inputStr = \"1\"; // to throw away last card\n }\n\n // - 1 is to allow usage of 1 - 9 for card selection instead\n // of 0 - 8...this converts card \"1\" into index 0.\n inputInt = (Integer.parseInt(inputStr)) - 1;\n\n // must be LESS than max...if size = 1, then \"max index\" == 0\n if (inputInt < max && inputInt >= 0) {\n validInput = true;\n } else {\n System.out.println(\"OOPS! Enter between 1 and \"\n + (max) + \"!\"); // \"between 1 and 1\" is acceptable\n Thread.sleep(1000);\n\n } // end check for acceptable index\n } else {\n System.out.println(\"OOPS! Enter a single digit ONLY!\");\n Thread.sleep(1000);\n } // end check for digit entered\n } // end \"while-loop\" check for valid input\n\n // if we're here, we can safely return the selected card\n return (PlayingCard) hand.removeCard(inputInt);\n }", "public Boolean isTradedCardSetValid() {\r\n\r\n\t\tif (lstTradedCards.size() == 3) {\r\n\r\n\t\t\tif (!isAWildCardSet()) {\r\n\t\t\t\t// If all the cards are same\r\n\t\t\t\tif (lstTradedCards.get(0).card_type.equals(lstTradedCards.get(1).card_type)\r\n\t\t\t\t\t\t&& lstTradedCards.get(1).card_type.equals(lstTradedCards.get(2).card_type)) {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Success\");\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// all 3 are different\r\n\t\t\t\telse if (!lstTradedCards.get(0).card_type.equals(lstTradedCards.get(1).card_type)\r\n\t\t\t\t\t\t&& !lstTradedCards.get(1).card_type.equals(lstTradedCards.get(2).card_type)\r\n\t\t\t\t\t\t&& !lstTradedCards.get(0).card_type.equals(lstTradedCards.get(2).card_type)) {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Success\");\r\n\t\t\t\t\tUtility.writeLog(\"card traded successfully\");\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (isValidCountWildCard()) {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Success\");\r\n\t\t\t\t\tUtility.writeLog(\"card traded successfully\");\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcardStatusLabel.setText(\"Please select only/atleast three cards!\");\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcardStatusLabel.setText(\"Please select only/atleast three cards!\");\r\n\t\treturn false;\r\n\t}", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Override\n public boolean isValid() {\n return (27 - Inventory.getAll().length <= Inventory.find(\"Soft clay\").length)\n || (Inventory.find(\"Soft clay\").length < 1 || Inventory\n .find(\"Astral rune\").length < 1)\n && !Banking.isBankScreenOpen()\n && GlassBlower.antiban.canInteractObject();\n }", "private boolean validateVisa() {\r\n\t\tString creditCardNumber = getCreditCardNumber();\r\n\t\t// checking the card number length\r\n\t\tif (creditCardNumber.length() != 13 && creditCardNumber.length() != 16 && creditCardNumber.length() != 19) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t// checking the validity of the credit card number\r\n\t\tif (creditCardNumber.charAt(0) != '4') {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public boolean isValid() {\n\t\t//Check for size=3, then check if their ranks are same.\n\t\tif(this.size()==3) {\n\t\t\tif(this.getCard(0).getRank()==this.getCard(1).getRank()) {\n\t\t\t\tif(this.getCard(1).getRank()==this.getCard(2).getRank()){\n\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "private boolean isValidCard(int index)\n {\n if (index >= cards.size() || index < 0)\n return false;\n \n for (int i = index; i < cards.size() - 1; i++)\n if (!isDifferentColor(cards.get(i), cards.get(i + 1)) ||\n !isOneLess(cards.get(i + 1), cards.get(i)))\n return false;\n\n return true;\n }", "private boolean checkValid() {\n\t\tif(openRadio.isSelected()) {\n\t\t\t//Open loop mode.\n\t\t\treturn checkInfusionRate() && checkPumpSelected() && checkMonitorSelected();\n\t\t} else {\n\t\t\t//Closed loop mode.\n\t\t\t//Check patient selected\n\t\t\t//Check QCore selected\n\t\t\t//Check BP monitor selected\n\t\t\t//Check target BP range\n\t\t\t//Check infusion rate.\n\t\t\treturn checkTargetBPRange() && checkInfusionRate() && checkPumpSelected() && checkMonitorSelected();\n\t\t}\n\t}", "@Test\n\tpublic void testIsValid()\n\t{\n\t\tSystem.out.println(\"isValid\");\n\n\t\tUserTypeCode userTypeCode = new UserTypeCode();\n\t\tuserTypeCode.setCode(\"Test\");\n\t\tuserTypeCode.setDescription(\"Test\");\n\n\t\tValidationModel validateModel = new ValidationModel(userTypeCode);\n\t\tvalidateModel.setConsumeFieldsOnly(true);\n\n\t\tboolean expResult = true;\n\t\tboolean result = ValidationUtil.isValid(validateModel);\n\t\tassertEquals(expResult, result);\n\n\t\tvalidateModel = new ValidationModel(userTypeCode);\n\n\t\texpResult = false;\n\t\tresult = ValidationUtil.isValid(validateModel);\n\t\tassertEquals(expResult, result);\n\t}", "public CardChoice getCardChoices(PlayerPiece playerPiece) {\n System.out.println(\"Please select one of the following Rooms (Type in room name):\");\n System.out.println(this.getRoomCards());\n boolean validCard = false;\n RoomCard roomCard = this.findRoomCard(sc.nextLine());\n if (roomCard == null) {\n while (!validCard) {\n System.out.println(\"Invalid input! Please select one of the following Rooms (Type in room name):\");\n System.out.println(this.getRoomCards());\n roomCard = this.findRoomCard(sc.nextLine());\n if (roomCard != null) {\n validCard = true;\n }\n }\n }\n validCard = false;\n WeaponCard weaponCard = this.findWeaponCard(sc.nextLine());\n if (weaponCard == null) {\n while (!validCard) {\n System.out.println(\"Invalid input! Please select one of the following weapons (Type in room name):\");\n System.out.println(this.getRoomCards());\n weaponCard = this.findWeaponCard(sc.nextLine());\n if (weaponCard != null) {\n validCard = true;\n }\n }\n }\n validCard = false;\n SuspectCard suspectCard = this.findSuspectCard(sc.nextLine());\n if (suspectCard == null) {\n while (!validCard) {\n System.out.println(\"Invalid input! Please select one of the following suspect (Type in room name):\");\n System.out.println(this.getRoomCards());\n suspectCard = this.findSuspectCard(sc.nextLine());\n if (suspectCard != null) {\n validCard = true;\n }\n }\n }\n return new CardChoice(playerPiece, roomCard, weaponCard, suspectCard);\n\n }", "public abstract boolean isValid();", "public abstract boolean isValid();", "public abstract boolean isValid();", "public void validateSelection()\r\n {\r\n for (int i = 0; i<getSelectedElements().size(); ++i)\r\n {\r\n ReportElement re = (ReportElement)getSelectedElements().elementAt(i);\r\n if (!getCrosstabElement().getElements().contains( re ))\r\n {\r\n getSelectedElements().remove(re);\r\n --i;\r\n }\r\n }\r\n // UPDATE SELECTION NOW!!!\r\n }", "private boolean isValidOption(int option){\n return (option >= 0) && (option < this.count());\n }", "protected boolean isValid() {\n \t\treturn valid;\n \t}", "private void validate() {\n\n etCardNumber.validate();\n\n etCardExpiryDate.validate();\n\n etCardCvv.validate();\n\n etCardHolderName.validate();\n\n etPhoneNumber.validate();\n\n etCustomerName.validate();\n }", "@Test\n @SmallTest\n public void tesUiccCartdInfoSanity() {\n assertEquals(0, mUicccard.getNumApplications());\n assertNull(mUicccard.getCardState());\n assertNull(mUicccard.getUniversalPinState());\n assertNull(mUicccard.getOperatorBrandOverride());\n /* CarrierPrivilegeRule equals null, return true */\n assertTrue(mUicccard.areCarrierPriviligeRulesLoaded());\n for (IccCardApplicationStatus.AppType mAppType :\n IccCardApplicationStatus.AppType.values()) {\n assertFalse(mUicccard.isApplicationOnIcc(mAppType));\n }\n }", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean check(ArrayList<Card> cards){\n int val = cards.get(0).getVal();\n if(val == 2 || val == 10)\n return true;\n //sevens are special\n if(topCardVal() == 7)\n return (topCardVal() >= val);\n return (topCardVal() <= val);\n }", "@Override\n public boolean checkRequirement(PlayerContext playerContext) {\n int sumOfRightColourAndLevelCard = 0;\n for (DevelopmentCard developmentCard : playerContext.getAllDevelopmentCards()){\n if (developmentCard.getColour() == cardColour && developmentCard.getLevel() == cardLevel)\n sumOfRightColourAndLevelCard ++;\n }\n return sumOfRightColourAndLevelCard >= numberOfCards;\n }", "@Test\n\tpublic void testOptionsValid(){\n\t\t// TEST 1\n\t\tGameTypeOptions.TrumpSuit trump = GameTypeOptions.TrumpSuit.Clubs;\n\t\tGameTypeOptions.SkatHandType skathandType = GameTypeOptions.SkatHandType.Skat;\n\t\tGameTypeOptions.GameType actualGameType = GameTypeOptions.GameType.Suit;\n\t\tboolean ouvert = true;\n\t\tboolean schwarz = false;\n\t\tboolean schneider = true;\t\n\t\t// Create our GameType.\n\t\tGameTypeOptions gameType = new GameTypeOptions(skathandType, actualGameType, trump, ouvert, schneider, schwarz);\n\t\t\n\t\t// Assert our options.\n\t\tassertEquals(\"Invalid Trump Suit set in GameTypeOptions, should be \" + trump + \" got \" + gameType.getTrumpSuit(), trump, gameType.getTrumpSuit());\n\t\tassertEquals(\"Invalid Skat Hand Type set in GameTypeOptions, should be \" + skathandType + \" got \" + gameType.getHandType(), skathandType, gameType.getHandType());\n\t\tassertEquals(\"Invalid GameType set in GameTypeOptions, should be \" + actualGameType + \" got \" + gameType.getGameType(), actualGameType, gameType.getGameType());\n\t\tassertEquals(\"Invalid ouvert status in GameTypeOptions, should be \" + ouvert + \" got \" + gameType.getOuvert(), ouvert, gameType.getOuvert());\n\t\tassertEquals(\"Invalid schwarz status in GameTypeOptions, should be \" + schwarz + \" got \" + gameType.getSchwarz(), schwarz, gameType.getSchwarz());\n\t\tassertEquals(\"Invalid schneider status in GameTypeOptions, should be \" + schneider + \" got \" + gameType.getSchneider(), schneider, gameType.getSchneider());\n\t\t\n\t\t// TEST 2\n\t\ttrump = GameTypeOptions.TrumpSuit.None;\n\t\tskathandType = GameTypeOptions.SkatHandType.Hand;\n\t\tactualGameType = GameTypeOptions.GameType.Null;\n\t\touvert = true;\n\t\tschwarz = false;\n\t\tschneider = false;\t\n\t\t// Create our GameType.\n\t\tgameType = new GameTypeOptions(skathandType, actualGameType, trump, ouvert, schneider, schwarz);\n\t\t\n\t\t// Assert our options.\n\t\tassertEquals(\"Invalid Trump Suit set in GameTypeOptions, should be \" + trump + \" got \" + gameType.getTrumpSuit(), trump, gameType.getTrumpSuit());\n\t\tassertEquals(\"Invalid Skat Hand Type set in GameTypeOptions, should be \" + skathandType + \" got \" + gameType.getHandType(), skathandType, gameType.getHandType());\n\t\tassertEquals(\"Invalid GameType set in GameTypeOptions, should be \" + actualGameType + \" got \" + gameType.getGameType(), actualGameType, gameType.getGameType());\n\t\tassertEquals(\"Invalid ouvert status in GameTypeOptions, should be \" + ouvert + \" got \" + gameType.getOuvert(), ouvert, gameType.getOuvert());\n\t\tassertEquals(\"Invalid schwarz status in GameTypeOptions, should be \" + schwarz + \" got \" + gameType.getSchwarz(), schwarz, gameType.getSchwarz());\n\t\tassertEquals(\"Invalid schneider status in GameTypeOptions, should be \" + schneider + \" got \" + gameType.getSchneider(), schneider, gameType.getSchneider());\n\t\t\n\t\t// TEST 3\n\t\ttrump = GameTypeOptions.TrumpSuit.None;\n\t\tskathandType = GameTypeOptions.SkatHandType.Hand;\n\t\tactualGameType = GameTypeOptions.GameType.Grand;\n\t\touvert = false;\n\t\tschwarz = false;\n\t\tschneider = false;\t\n\t\t// Create our GameType.\n\t\tgameType = new GameTypeOptions(skathandType, actualGameType, trump, ouvert, schneider, schwarz);\n\t\t\n\t\t// Assert our options.\n\t\tassertEquals(\"Invalid Trump Suit set in GameTypeOptions, should be \" + trump + \" got \" + gameType.getTrumpSuit(), trump, gameType.getTrumpSuit());\n\t\tassertEquals(\"Invalid Skat Hand Type set in GameTypeOptions, should be \" + skathandType + \" got \" + gameType.getHandType(), skathandType, gameType.getHandType());\n\t\tassertEquals(\"Invalid GameType set in GameTypeOptions, should be \" + actualGameType + \" got \" + gameType.getGameType(), actualGameType, gameType.getGameType());\n\t\tassertEquals(\"Invalid ouvert status in GameTypeOptions, should be \" + ouvert + \" got \" + gameType.getOuvert(), ouvert, gameType.getOuvert());\n\t\tassertEquals(\"Invalid schwarz status in GameTypeOptions, should be \" + schwarz + \" got \" + gameType.getSchwarz(), schwarz, gameType.getSchwarz());\n\t\tassertEquals(\"Invalid schneider status in GameTypeOptions, should be \" + schneider + \" got \" + gameType.getSchneider(), schneider, gameType.getSchneider());\n\t\t\n\t}", "private boolean verifySelection() {\n String caseName = caseNameText.getText().trim();\n if (caseName.length() == 0) {\n MessageDialog.openError(shell, \"Error\", \"Enter a case name.\");\n return false;\n }\n\n File caseDir = new File(locationDir, caseName);\n if (caseDir.exists()) {\n MessageDialog.openError(shell, \"Error\",\n \"Case already exists choose another name.\");\n caseNameText.selectAll();\n caseNameText.setFocus();\n return false;\n }\n\n setReturnValue(caseDir);\n return true;\n }", "protected boolean isValid()\r\n {\r\n \treturn true;\r\n }", "@Test\n public void testCardCanPlay_WILD() {\n System.out.println(\"cardCanPlay WILD\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "private void checkValid() {\n getSimType();\n getInitialConfig();\n getIsOutlined();\n getEdgePolicy();\n getNeighborPolicy();\n getCellShape();\n }", "private boolean validateInputs(){\n if(jrTakeTest.isSelected()==false && jrViewScores.isSelected()==false && jrChangePassword.isSelected()==false)\n return false;\n return true;\n}", "public static boolean isValid(String _card){\r\n\t\t//communication with sumOfDoubleEvenPlace() and sumOfOddPlace()\r\n\t\tsumOfDoubleEvenPlace(_card);\r\n\t\tsumOfOddPlace(_card);\r\n\t\tgetCompany(_card);\r\n\t\tString _errorLength = \"Invalid number of digits.\";\r\n\t\tString _errorInvalid = \"Invalid credit card number.\";\r\n\t\t\r\n\t\t//condition for valid credit card.\r\n\t\tif((getCompany(_card) != _errorInvalid) && (getCompany(_card) != _errorLength)){\r\n\t\t\tif((sumOfDoubleEvenPlace(_card) + sumOfOddPlace(_card) != 0)){\t//if user enters all zeroes\r\n\t\t\t\tif ((sumOfDoubleEvenPlace(_card) + sumOfOddPlace(_card)) % 10 == 0 ){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\treturn false;\r\n\t\t\t\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\t\r\n\t}", "public boolean isValid() {\n //valid melds must have 3+ tile\n if (tiles.size() < 3) {\n //System.out.println(\"fail 1\");\n return false;\n }\n if (tiles.get(0).getColour() == tiles.get(1).getColour() &&\n\t\t\ttiles.get(0).getValue() != tiles.get(1).getValue()) { //test a run\n\t\t\tif (this.size() > 13) {\n //System.out.println(\"fail 2\");\n return false;\n }\n for (int i=1; i<tiles.size(); i++) {\n if (tiles.get(i).getColour() != tiles.get(0).getColour()) { //make sure all are same colour\n //System.out.println(\"fail 3\");\n return false;\n }\n if (tiles.get(i).getValue() != (tiles.get(0).getValue() + i)) { //make sure all values make a run\n //System.out.println(\"fail 4\");\n return false;\n }\n }\n } else { //test a set\n Set<Character> colours = new HashSet<>();\n for (int i=0; i<tiles.size(); i++) {\n if (tiles.get(i).getValue() != tiles.get(0).getValue()) { //all are same value\n //System.out.println(\"fail 5\");\n\t\t\t\t\treturn false;\n }\n\n if (colours.contains(tiles.get(i).getColour()) && tiles.get(i).getColour() != 'J') { //check for duplicate colours\n //System.out.println(\"fail 6\");\n\t\t\t\t\treturn false;\n } else {\n\t\t\t\t\tcolours.add(tiles.get(i).getColour()); //keep track of all the colours this set has\n }\n }\n if (this.size() > 4) { //only possible if there are 5 cards, including a joker\n //System.out.println(\"fail 7\");\n\t\t\t\treturn false;\n }\n }\n\n return true; \n }", "@Test\n public void CardRequirementError() {\n MSG_ACTION_ACTIVATE_LEADERCARD message = new MSG_ACTION_ACTIVATE_LEADERCARD(0);\n DevelopmentCard card1 = new DevelopmentCard(1, Color.GREEN, 0, null, null);\n p.getDevelopmentSlot().addCard(card1, 1);\n c.emptyQueue();\n assertFalse(am.activateLeaderCard(p, message));\n assertEquals(MessageType.MSG_ERROR, c.messages.get(0).getMessageType());\n assertEquals(1, c.messages.size());\n }", "protected abstract boolean isCardActivatable(Card card);", "public boolean isValid(){\r\n\t\t\r\n\t\t// TODO\r\n\t\t\r\n\t\treturn true;\r\n\t}", "private boolean isValid( int r, int c )\n {\n return r >= 0 && r < rows && c >= 0 && c < cols ; \n }", "protected boolean canChoose(int n, Board gameBoard) {\n Card chosenCard = myCards.get(n);// get the chosenCard\n Card groundCard = gameBoard.getGroundCard();\n if (chosenCard.getColor() == groundCard.getColor()) { // if they had same color\n return true;\n }\n if (chosenCard instanceof NumericCard && groundCard instanceof NumericCard) {// if they had same number\n NumericCard tempChosen = (NumericCard) chosenCard; // change the static type\n NumericCard tempground = (NumericCard) groundCard; // change the static type\n if (tempChosen.getNumber() == tempground.getNumber()) {\n return true;\n }\n }\n\n if (groundCard.getClass().equals(chosenCard.getClass()) && !(groundCard instanceof NumericCard)\n && !(chosenCard instanceof NumericCard)) {// if they were sameInstance\n return true;\n }\n return false;\n }", "abstract boolean allowedToAdd(Card card);", "@Override\r\n\tpublic boolean isValid(String ccNumber) \r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tvalidate(ccNumber);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "boolean hasAlreadFoldCard();", "@Test\n public void isCorrectTest(){\n BuyCard cardErr = new BuyCard(12,0);\n\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Row index out of bounds.\");\n cardErr.isCorrect();\n }", "public boolean isValid() {\n\t\t\n\t\tif (this.size() == 2)\n\t\t\tif (this.getCard(0).getRank() == this.getCard(1).getRank())\n\t\t\t\treturn true;\n\t\t\n\t\treturn false;\n\t}", "protected abstract int isValidInput();", "@Test\n\tpublic void furtherSelectionTest() {\n\t\tSelectionController selectionController = new SelectionController();\n\t\tint[] selection = { 1, 2, 3, 4, 5, 6 };\n\t\tint[] unSelecion = { 1, 2, 3 };\n\t\tint[] resultSelection = { 4, 5, 6 };\n\t\tint[] negativeSelection = { -1 };\n\n\t\t// select something and unselect parts of it\n\t\tselectionController.select(selection);\n\t\tassertArrayEquals(\"Selection was different\", selection, selectionController.getSelection());\n\t\tselectionController.unselect(unSelecion);\n\t\tassertArrayEquals(\"Selection was different after unselection\", resultSelection,\n\t\t\t\tselectionController.getSelection());\n\n\t\t// do a reselection\n\t\tselectionController.reselect(unSelecion);\n\t\tassertArrayEquals(\"Selection was different after reselection\", unSelecion, selectionController.getSelection());\n\n\t\tassertTrue(\"Item 1 is selected\", selectionController.isSelected(1));\n\t\tassertTrue(\"Item 2 is selected\", selectionController.isSelected(2));\n\t\tassertTrue(\"Item 3 is selected\", selectionController.isSelected(3));\n\t\tassertFalse(\"Item 4 is not selected\", selectionController.isSelected(4));\n\t\tassertFalse(\"Item 5 is not selected\", selectionController.isSelected(5));\n\t\tassertFalse(\"Item 6 is not selected\", selectionController.isSelected(6));\n\n\t\t// unselect all elements\n\t\tselectionController.unselect(unSelecion);\n\t\tassertFalse(\"Nothing was selected\", selectionController.isSomethingSelected());\n\t\tassertEquals(\"The array should have length zero\", 0, selectionController.getSelection().length);\n\n\t\t// select something negative\n\t\tselectionController.select(negativeSelection);\n\t\tassertFalse(\"Nothing should be selected\", selectionController.isSomethingSelected());\n\t\tassertEquals(\"The array should have length zero after selection\", 0, selectionController.getSelection().length);\n\n\t\t// reselect something negative\n\t\tselectionController.select(selection);\n\t\tselectionController.reselect(negativeSelection);\n\t\tassertFalse(\"Nothing should be reselected\", selectionController.isSomethingSelected());\n\t\tassertEquals(\"The array should have length zero after reselection\", 0,\n\t\t\t\tselectionController.getSelection().length);\n\n\t}", "public boolean isValid(GameState gameState);", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean checkBlackJack() {\r\n if(cards.size() == 2 && score() == 21){\r\n blackJack = true;\r\n over = true;\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }", "@Test\n\tpublic void argumentTest() {\n\t\tSelectionController selectionController = new SelectionController();\n\t\ttry {\n\t\t\tselectionController.select(null);\n\t\t\tAssert.fail(\"The new selection was null\");\n\t\t} catch (NullPointerException e) {\n\t\t}\n\n\t\ttry {\n\t\t\tselectionController.unselect(null);\n\t\t\tAssert.fail(\"The new unselection was null\");\n\t\t} catch (NullPointerException e) {\n\t\t}\n\n\t\ttry {\n\t\t\tselectionController.reselect(null);\n\t\t\tAssert.fail(\"The new reselection was null\");\n\t\t} catch (NullPointerException e) {\n\t\t}\n\t}", "public boolean checkCollection(Player player, PropertyCard card) {\n\t\tboolean almostComplete = false;\n\t\tfor(PropertyCard c: player.getCards()) {\n\t\t\tif(c.getTeam().equals(card.getTeam())) {\n\t\t\t\tif(countSameTeamCards(player, card) == card.getTeamSize()-1) {\n\t\t\t\t\talmostComplete = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn almostComplete;\n\t}", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\r\n public void testPlayer_getCautiousStrategyCardCard_numeric_matchColorNotNumber() {\n player2 = new Player(\"Player Two\", true);\r\n player2.setHand(strategyHand.getAllCards());\r\n\r\n // let the cpc be a yellow three\r\n // get rid of all non-numeric cards and the green three so the yellow six is the most attractive option\r\n player2.getHand().discard(wild);\r\n player2.getHand().discard(wildDrawFour);\r\n player2.getHand().discard(yellowReverse);\r\n player2.getHand().discard(redDrawTwo);\r\n player2.getHand().discard(greenThree);\r\n\r\n assertTrue(player2.getCautiousStrategyCard(yellowThree, yellowThree.getColor()).equals(yellowSix));\r\n }", "protected abstract boolean isValidOption(String option);", "private boolean checkAttemptValid( String attempt ) {\r\n String tokenString = attempt.replaceAll( \"[^\\\\d]\", \" \");\r\n StringTokenizer st = new StringTokenizer(tokenString);\r\n int[] userNums = new int[st.countTokens()];\r\n int i=0;\r\n while(st.hasMoreTokens()) {\r\n int num = Integer.parseInt( st.nextToken());\r\n userNums[i] = num;\r\n i++;\r\n }\r\n if( !numbersCorrect( userNums )) {\r\n target.reply(\"You used a number not in the selection!\");\r\n return false;\r\n }\r\n //all numbers are correct, so now check remaining operators.\r\n //we gradually strip away everything allowed. If anything is left after that,\r\n //the attempt is invalid.\r\n attempt = attempt.replaceAll(\"\\\\d\", \"\"); //strip all numbers\r\n attempt = attempt.replaceAll(\"/\", \"\"); //strip \\ sign\r\n attempt = attempt.replaceAll(\"\\\\*\", \"\"); //strip *\r\n attempt = attempt.replaceAll(\"\\\\+\", \"\"); //strip +\r\n attempt = attempt.replaceAll(\"\\\\-\", \"\"); //strip -\r\n attempt = attempt.replaceAll(\"\\\\)\", \"\"); //strip )\r\n attempt = attempt.replaceAll(\"\\\\(\", \"\"); //strip (\r\n attempt = attempt.replaceAll(\" \", \"\"); //zap spaces\r\n\r\n return attempt.length() <= 0;\r\n }", "public boolean canBecombo(){\n \treturn price <5;\n }", "@Test(expected = DidNotPickCardException.class)\n public void allow_discard_only_if_picked_before(){\n\n Deck deck = new Deck();\n deck.add(new Card(3,2,5));\n Game game = new Game(deck);\n\n game.join(\"susan\");\n game.join(\"peter\");\n\n game.discard(\"susan\");\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test\n\tprivate void checkPossibilityTest() {\n\t\tint[] input = new int[] {1,1,1};\n Assertions.assertThat(checkPossibility(input)).isTrue();\n\n input = new int[] {0,0,3};\n Assertions.assertThat(checkPossibility(input)).isTrue();\n\n input = new int[] {4,2,3};\n Assertions.assertThat(checkPossibility(input)).isTrue();\n\n input = new int[] {2,3,4,2,3};\n Assertions.assertThat(checkPossibility(input)).isFalse();\n\t}" ]
[ "0.8222797", "0.65338314", "0.63042736", "0.6287026", "0.62068903", "0.61873925", "0.6051241", "0.60474575", "0.6042071", "0.60165334", "0.59848005", "0.59839773", "0.5959615", "0.59477454", "0.5945105", "0.5931404", "0.5922863", "0.5861054", "0.5860923", "0.5840054", "0.5834779", "0.58204615", "0.5779997", "0.5743394", "0.57229227", "0.5694568", "0.5692016", "0.56874496", "0.5683491", "0.564167", "0.56247574", "0.56238675", "0.5599851", "0.5588364", "0.55853385", "0.5570431", "0.55355763", "0.55196303", "0.5518813", "0.5506359", "0.5506359", "0.5506359", "0.5506359", "0.5506359", "0.54986835", "0.5496579", "0.54917437", "0.549147", "0.54796", "0.5469198", "0.54667115", "0.54658127", "0.5455614", "0.5455614", "0.5455614", "0.54529583", "0.54484177", "0.54468197", "0.5440599", "0.54323745", "0.54291975", "0.54291975", "0.54291975", "0.54291975", "0.54291975", "0.54249704", "0.54230434", "0.54197246", "0.54122597", "0.5394834", "0.5393896", "0.5384674", "0.53827214", "0.5382404", "0.53780025", "0.5369822", "0.53673023", "0.536666", "0.53628045", "0.5361336", "0.5355549", "0.5354571", "0.53509027", "0.53484094", "0.53462064", "0.53235143", "0.5318453", "0.5314134", "0.5310445", "0.53085554", "0.53044146", "0.53015375", "0.5300149", "0.52899563", "0.5289383", "0.5285378", "0.52846885", "0.5284027", "0.527934", "0.5269651" ]
0.8362122
0
Test of cardCanPlay method, of class utils.
@Test public void testCardCanPlay_TRUE() { System.out.println("cardCanPlay TRUE COLOUR"); UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE); UnoCardColour wildColour = UnoCardColour.BLUE; boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour); assertEquals(true, result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "@Test\n public void testCardCanPlay_TRUE_VALUE() {\n System.out.println(\"cardCanPlay TRUE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE() {\n System.out.println(\"cardCanPlay FALSE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_FALSE_VALUE() {\n System.out.println(\"cardCanPlay FALSE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_WILD() {\n System.out.println(\"cardCanPlay WILD\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "boolean isPlayable();", "private boolean isValidPlay(ICard cardToPlay) {\n return cardToPlay.isValidOn(getTopCard());\n }", "boolean hasPlayCardRequest();", "@Override\n\tpublic void playCard() {\n\t\t\n\t}", "@Test\r\n public void testHasAtLeastTwoPlayableCards() {\n Player player2 = new Player(\"Three Playable Cards Test\", true);\r\n Hand threePlayableCardsHand = strategyHand;\r\n player2.setHand(threePlayableCardsHand.getAllCards());\r\n\r\n // Make it harder to find playable cards:\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD, cvm));\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD_DRAW_FOUR, cvm));\r\n\r\n Card currentPlayedCard_1 = new Card(Card.YELLOW, Card.ONE, cvm);\r\n assertTrue(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_1, Card.BLUE));\r\n\r\n Card currentPlayedCard_2 = new Card(Card.BLUE, Card.SEVEN, cvm);\r\n assertFalse(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_2, Card.BLUE));\r\n }", "@Override\r\n\tpublic void playCard() {\n\t\t\r\n\t}", "protected abstract boolean isCardActivatable(Card card);", "public boolean checkPlays(Player player){\n return true;\n }", "void playMonumentCard();", "@Test\n public void testPlay1()\n {\n List<Card> hand = new ArrayList<Card>();\n hand.add(new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 4));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.NUMBER, 7));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.REVERSE, -1));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.NUMBER, 2));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.SKIP, -1));\n hand.add(new Card(UnoPlayer.Color.NONE, UnoPlayer.Rank.WILD, -1));\n\n Card upCard = new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 7);\n int cardPlayed = thePlayer.play(hand, upCard, UnoPlayer.Color.RED, new\n GameState(upCard));\n\n // Let's see whether the card played was legit.\n assertTrue(\"Player didn't think a card could be played.\\nThis is an \"\n + \"error, since cards 0, 1, and 5 are legal plays.\",\n cardPlayed >= 0);\n assertTrue(\"Player tried to play \" + hand.get(cardPlayed)\n + \", which is an error.\", cardPlayed == 0 || cardPlayed == 1\n || cardPlayed == 5);\n System.out.println(\"Player played \" + hand.get(cardPlayed));\n }", "@Override\n public boolean anotherPlayIsPossible()\n {\n \t\n List<Integer> test = cardIndexes();\n return containsSum13(test) || containsK(test);\n \n }", "public void playCard(int player, int card) {\n }", "public void testGetCard() {\n System.out.println(\"getCard\");\n Card expResult = new Card(Rank.QUEEN, Suit.SPADES);\n Play instance = new Play(\"Player1\", expResult);\n Card result = instance.getCard();\n assertEquals(expResult, result);\n }", "public boolean canUseCard(Card card) {\r\n\t\tif (card.cardColor.contains(CardColor.GREEN)\r\n\t\t\t\t|| card.cardColor.contains(CardColor.GREY)) {\r\n\t\t\treturn false;\r\n\t\t} else if (this.blackTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.PURPLE)\r\n\t\t\t\t&& this.purpleTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.RED) && this.redTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BLUE)\r\n\t\t\t\t&& this.blueTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BROWN)\r\n\t\t\t\t&& this.brownTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "public boolean playCard(Card card){\n boolean b = effectHandler.playCard( card , null);\n return b;\n }", "boolean isPlayableInGame();", "@Test(expected = NotPlayingException.class)\n public void not_allow_picking_cards_if_not_playing(){\n\n Deck deck = new Deck();\n Game game = new Game(deck);\n\n game.join(\"susan\");\n\n game.pickCard(\"susan\");\n }", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test(expected = DoesNotOwnException.class)\n\tpublic void cannotPlayDevCardTest() throws DoesNotOwnException, CannotPlayException\n\t{\n\t\tp.playDevelopmentCard(c, game.getBank());\n\t}", "@Test\n public void receiveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0, 0);\n x.receiveCard(4, 4);\n assertTrue(x.getCards().get(4) == 4);\n }", "boolean hasPlaySingleCardResponse();", "@Override\r\n\tpublic void playMonumentCard() {\n\t\t\r\n\t}", "@Test\n public void playMonopolyCard() throws Exception {\n ResourceType type = ResourceType.ORE;\n when(devCardFacade.canUseMonopolyCard(noDevCardsPlayer, type)).thenReturn(false);\n dcc.playMonopolyCard(type);\n verify(devCardFacade, never()).useMonopolyCard(noDevCardsPlayer, type);\n //Player 1; has devCards\n when(devCardFacade.canUseMonopolyCard(currentPlayer, type)).thenReturn(true);\n dcc.playMonopolyCard(type);\n }", "public void testGetIsPlayable()\n {\n assertEquals(b1.getIsPlayable(), false);\n b1.setIsPlayable(true);\n assertEquals(b1.getIsPlayable(), true);\n }", "protected abstract boolean isPlayerActivatable(PlayerSimple player);", "@Test\n public void giveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(5,3);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 3);\n }", "public abstract CardAction play(Player p);", "@Test\n public void startPlayTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n int players = 4;\n int current = 0;\n g.startPlay(players, deck);\n for (Card c : deck) {\n assertTrue(g.getPlayers().get(current).contains(c));\n current++;\n if (current == players) {\n current = 0;\n }\n }\n }", "public Card PlayCard() {\n\t Card ret = null;\n\t Card card;\n\t if (mCardCount > 0) {\n\t\t // To work out what card to play, see what cards can be played\n\t\t \tCard[] playableCards;\n\t\t \tplayableCards = mRules.GetPlayableCards();\n\t\t \tCard[] selectedCards;\n\t\t \tselectedCards = new Card[8];\n\t\t \tint iNumSelectableCards = 0;\n\t\t \tfor (int i = 0; i < 8; i++)\n\t\t \t\tselectedCards[i] = null;\n\t \tfor (int i = 0; i < mCardCount; i++){\n\t \t\tcard = mCard[i];\n\t \t\tswitch (card.GetSuit()){\n\t \t\tcase Card.HEARTS:\n\t \t\t\t\n\t \t\t\t// Card is a heart, can it be played?\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t// and must be played first\n\t \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n\t \n\t \t\t\t\treturn card;\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()-1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\tcase Card.DIAMONDS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.CLUBS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.SPADES:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\tbreak;\n\n\t \t\t\t\t \t\t\t\n\t \t\t}\n\t\n\t \t}\t\n\t \t\n\t \t// Now go through the selectable cards and see which is best to be played\n\t \tif (iNumSelectableCards == 0)\n\t \t\treturn ret;\n\t \t\n\t \tint iPos;\n\t \tcard = null;\n\t \tif (iNumSelectableCards == 1){\n\t\t\t \tfor (int i = 0; i < 8; i++)\n\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t \t\t\tcard = selectedCards[i];\n\t\t\t \t\t\tbreak;\n\t\t\t \t\t}\n\t\t\t \t\t\t \t\n\t \t}\n\t \telse {\n\t\t\t String sDifficulty = mRules.mView.GetSettings().getString(\"Difficulty\", \"0\");// 0 = hard, 1 = easy\n\t\t\t int iDifficulty = Integer.parseInt(sDifficulty);\n\t\t\t if (iDifficulty == EASY){\n\t\t\t \t// Get a random card from the playable ones\n\t\t\t\t\t Random generator = new Random();\n\t\t\t\t\t int randomIndex = generator.nextInt( iNumSelectableCards );\n\t\t\t\t\t int iCount = 0;\n\t\t\t\t\t \tfor (int i = 0; i < 8; i++){\n\t\t\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t\t\t \t\t\tif (iCount == randomIndex){\n\t\t\t\t\t \t\t\t\tcard = selectedCards[i];\n\t\t\t\t\t \t\t\t\tbreak;\n\t\t\t\t\t \t\t\t}\n\t\t\t\t\t \t\t\telse iCount++;\n\t\t\t\t\t \t\t}\t\n\t\t\t\t\t \t}\n\t\t\t }\n\t\t\t else {\n\t\t\t \tiPos = GetBestCard(selectedCards);\n\t\t\t \tcard = selectedCards[iPos];\n\t\t\t }\n\t \t}\n\t \t\n\t \tswitch (card.GetSuit()){\n \t\tcase Card.HEARTS:\t \t\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\t// and must be played first\n \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n \n \t\t\t\treturn card;\n \t\t\t}\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n \t\t\t\t\tplayableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\tcase Card.DIAMONDS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(8,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(6,Card.DIAMONDS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(card.GetValue()-1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(card.GetValue()+1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\t\t\n \t\tcase Card.CLUBS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(8,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.CLUBS6] = new Card(6,Card.CLUBS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n \t\t\t\t\tplayableCards[Rules.CLUBS6] = new Card(card.GetValue()-1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n \t\t\t\t\tLog.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.CLUBS);\n \t\t\t\t\tplayableCards[Rules.CLUBS8] = new Card(card.GetValue()+1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\tbreak; \n \t\tcase Card.SPADES:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(8,Card.SPADES);\n\t \t\t\t\tplayableCards[Rules.SPADES6] = new Card(6,Card.SPADES);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES6] = new Card(card.GetValue()-1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES8] = new Card(card.GetValue()+1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\tbreak;\n \t\t\t\n\t \t}\n\t \n\t }\n\t return ret;\n }", "@Test\n public void giveCard2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 0);\n }", "boolean play();", "@Test\n public void checkBook2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n boolean gotBook = x.checkBook();\n assertTrue(!gotBook);\n }", "@Override\r\n\tpublic boolean canPlay() {\n\t\treturn false;\r\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "protected boolean canPlay(Board gameBoard) {\n if (canPlayWithoutWild(gameBoard)) {\n return true;\n }\n Iterator<Card> it = myCards.iterator();\n while (it.hasNext()) { // check if the player has wild card\n Card temp = it.next();\n if (temp instanceof WildDrawCard || temp instanceof ColorChangeCard) {\n return true;\n }\n }\n return false;\n }", "private boolean canPlay(UnoCard topCard, UnoCard newCard) {\n\n\t\t// Color or value matches\n\t\tif (topCard.getColor().equals(newCard.getColor())\n\t\t\t\t|| topCard.getValue().equals(newCard.getValue()))\n\t\t\treturn true;\n\t\t// if chosen wild card color matches\n\t\telse if (topCard instanceof WildCard)\n\t\t\treturn ((WildCard) topCard).getWildColor().equals(newCard.getColor());\n\n\t\t// suppose the new card is a wild card\n\t\telse if (newCard instanceof WildCard)\n\t\t\treturn true;\n\n\t\t// else\n\t\treturn false;\n\t}", "public abstract boolean isPlayer();", "@Test\n public void testCardSelectionIsValid_TRUE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n }", "boolean hasAlreadShowCard();", "private void playThisCard(UnoCard clickedCard) throws NotYourTurnException, InvalidMoveException {\n\t\t// Check player's turn\n\t\tif (!isHisTurn(clickedCard)) {\n\t\t\tthrow new NotYourTurnException();\n\t\t} else {\n\n\t\t\t// Card validation\n\t\t\tif (isValidMove(clickedCard)) {\n\n\t\t\t\tplayedCards().add(clickedCard);\n\n\t\t\t\tremovePlayedCard(clickedCard);\n\n\t\t\t\t// function cards ??\n if (clickedCard instanceof ActionCard) {\n performAction(clickedCard);\n\n }\n\n\t\t\t\tfor (GameListener listener : gameListeners) {\n\t\t\t\t\tlistener.cardPlayed(clickedCard);\n\t\t\t\t}\n\n\t\t\t\tcheckResults();\n\t\t\t} else {\n\t\t\t\tthrow new InvalidMoveException();\n\n\t\t\t}\n\t\t}\n\t}", "@Test\n void play_BranchThree()\n {\n dealer = 21;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(dealer, result);\n }", "@Test \n public void testDetectPlayer(){\n assertTrue(controller.detect());\n }", "boolean CanBuyDevCard();", "public boolean playCard(Card card, Enemy enemy){\n if( isGameOver() )return false;\n if( card.isHasTarget() && !enemyController.hasEnemy(enemy) )return false;\n\n System.out.println(\"IN PLAYCARD METHOD\");\n boolean b = effectHandler.playCard( card , enemy);\n System.out.println( \"HAND CARDS : \");\n for( int i = 0 ; i < piles.getHandPile().getCards().size() ; i++ ){\n System.out.println( piles.getHandPile().getCards().get(i).getName() );\n }\n\n return b;\n }", "static boolean playBlackjack() {\n\n Deck mazo; // Un mazo de cartas. Una nueva baraja para cada juego.\n BlackjackHand manoRepartidor; // La mano del repartidor.\n BlackjackHand manoUsuario; // La mano del usuario.\n \n mazo = new Deck();\n manoRepartidor = new BlackjackHand();\n manoUsuario = new BlackjackHand();\n\n // Baraja el mazo, luego reparte dos cartas a cada jugador.\n \n mazo.barajar();\n manoRepartidor.agregarCarta( mazo.cartaReparto());\n manoRepartidor.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n \n System.out.println();\n System.out.println();\n \n /* Marque si uno de los jugadores tiene Blackjack (dos cartas con un total de 21).\n El jugador con Blackjack gana el juego. El repartidor gana empates.\n */\n \n if (manoRepartidor.obtenerValorBlackjack() == 21) {\n String m=\"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"El repartidor tiene Blackjack. El repartidor gana.\";\n JOptionPane.showMessageDialog(null, m);\n \n return false;\n }\n \n if (manoUsuario.obtenerValorBlackjack() == 21) {\n String m1 = \"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"Tienes Blackjack. Tú ganas.\";\n JOptionPane.showMessageDialog(null, m1);\n return true;\n }\n \n /* Si ninguno de los dos jugadores tiene Blackjack, juega el juego. Primero el usuario \n tiene la oportunidad de robar cartas (es decir,\"Golpear\"). El bucle while termina \n cuando el usuario elige \"Stand\". Si el usuario supera los 21,\n el usuario pierde inmediatamente.\n */\n \n while (true) {\n \n /* Muestra las cartas de los usuarios y deja que el usuario decida si golpea o se para. */\n\n System.out.println();\n System.out.println();\n System.out.println();\n String aux1=\"\";\n for ( int i = 0; i < manoUsuario.obtenerConteoCartas(); i++ ){\n aux1=aux1+\" \"+manoUsuario.obtenerCarta(i)+\"\\n\";\n }\n JOptionPane.showMessageDialog(null, \"Tus cartas son: \\n\" \n + aux1+\"\\n\"\n + \"Su total es \" + manoUsuario.obtenerValorBlackjack()+\"\\n\\n\"\n +\"El concesionario está mostrando el \" + manoRepartidor.obtenerCarta(0));\n \n char userAction= JOptionPane.showInputDialog(null,\"¿Pulse (H) o Pararse (S)? \").charAt(0);\n \n // char x = JOptionPane.showInputDialog(null,\"Ingres... el dato\").charAt(0);\n char opcion;\n do {\n opcion=Character.toUpperCase(userAction);\n if (opcion != 'H' && opcion != 'S')\n \n JOptionPane.showMessageDialog(null,\"Por favor responda H o S: \" );\n } while (opcion != 'H' && opcion != 'S');\n\n /* Si el usuario acierta, el usuario recibe una tarjeta. Si el usuario se para, el bucle termina \n (y es el turno de la banca para robar cartas).\n */\n \n if ( opcion == 'S' ) {\n // Termina el bucle; el usuario termina de coger las tarjetas.\n break;\n }\n else { // La accion del usuario es' H'. Dar al usuario una tarjeta. \n // Si el usuario pasa de 21, el usuario pierde.\n Card newCard = mazo.cartaReparto();\n manoUsuario.agregarCarta(newCard);\n \n System.out.println();\n System.out.println();\n System.out.println();\n \n JOptionPane.showMessageDialog(null, \"Aciertos de usuario.\\n\"\n + \"Su carta es el \" + newCard+\"\\n\"\n + \"Su total es ahora \" + manoUsuario.obtenerValorBlackjack());\n if (manoUsuario.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Pasaste por encima de los 21. Tú pierdes.\\n\"\n + \"La otra carta del repartidor era el \" + manoRepartidor.obtenerCarta(1));\n return false; \n }\n }\n \n } // end while loop\n \n /* Si llegamos a este punto, el usuario tiene un nivel Ahora, es\n la oportunidad del traficante de dibujar. El Dealer coge cartas hasta que el dealer\n total es > 16. Si el concesionario pasa de 21, pierde.\n */\n\n \n JOptionPane.showMessageDialog(null, \"Usuario parado.\\n\"\n +\"Las cartas del distribuidor son\\n\"\n +\" \" + manoRepartidor.obtenerCarta(0)+\"\\n\"\n + \" \" + manoRepartidor.obtenerCarta(1));\n while (manoRepartidor.obtenerValorBlackjack() <= 16) {\n Card newCard = mazo.cartaReparto();\n \n JOptionPane.showMessageDialog(null, \"El distribuidor golpea y obtiene el \" + newCard);\n manoRepartidor.agregarCarta(newCard);\n if (manoRepartidor.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Distribuidor detenido por pasar de 21. Usted gana.\");\n return true;\n }\n }\n \n JOptionPane.showMessageDialog(null, \"El total del distribuidor es \" + manoRepartidor.obtenerValorBlackjack());\n /* Si llegamos a este punto, ambos jugadores tienen 21 o menos. \n Podemos determinar el ganador comparando los valores de sus manos. */\n \n System.out.println();\n if (manoRepartidor.obtenerValorBlackjack() == manoUsuario.obtenerValorBlackjack()) {\n JOptionPane.showMessageDialog(null, \"El concesionario gana por empate. Tú pierdes.\");\n \n return false;\n }\n else if (manoRepartidor.obtenerValorBlackjack() > manoUsuario.obtenerValorBlackjack()) {\n \n JOptionPane.showMessageDialog(null, \"El concesionario gana, \" + manoRepartidor.obtenerValorBlackjack() \n + \" puntos para \" + manoUsuario.obtenerValorBlackjack() + \".\");\n return false;\n }\n else {\n \n JOptionPane.showMessageDialog(null, \"Tu ganas, \" + manoUsuario.obtenerValorBlackjack() \n + \" puntos para \" + manoRepartidor.obtenerValorBlackjack() + \".\");\n return true;\n }\n\n }", "public void playCard(ActionCard card, Integer selectedPlayer)\n {\n System.out.println(\"gui: playCard: \" + card + \", selected: \" + selectedPlayer);\n // Guard against this\n if (!isTurn || this.played)\n {\n return;\n }\n \n if(card instanceof PrivateTip || card instanceof Snoop) \n {\n if(selectedPlayer == null) \n {\n JOptionPane.showMessageDialog(null, \"Please select \"\n + \"a player in the \"\n + \"Player Listing (Upper right) that is not yourself!\", \n \"Warning\", \n JOptionPane.ERROR_MESSAGE); \n return;\n }\n }\n\n if (card instanceof Suggestion)\n {\n this.played = true;\n // prompt for solution\n suggestionScreen = new AccusationScreen(this, true, (Suggestion)card);\n suggestionScreen.setVisible(true);\n }\n else\n {\n this.played = clientController.playActionCard(card, selectedPlayer);\n if(!this.played)\n {\n mainGameScreen.notifyUser(\"Play failed: To Play this card,\"\n + \" please select a CluePlayer from the 'Players' list,\"\n + \" then click on this card.\");\n }\n }\n\n }", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Test\r\n\tpublic void testPlayableCards2()\r\n\t{\n\t\t\r\n\t\tCardList clubList = new CardList();\r\n\t\tclubList.add(AllCards.a6C);\r\n\t\tclubList.add(AllCards.aTC);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.CLUBS, null).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tCardList diamondsList = new CardList();\r\n\t\tdiamondsList.add(AllCards.a7D);\r\n\t\tdiamondsList.add(AllCards.aQD);\r\n\t\tdiamondsList.add(AllCards.aKD);\r\n//\t\tassertTrue( h.playableCards(Suit.DIAMONDS, null).toString().equals(diamondsList.toString()));\r\n\t\t\r\n\t\tCardList heartsList = new CardList();\r\n\t\theartsList.add(AllCards.a9H);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.HEARTS, null).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tCardList spadesList = new CardList();\r\n\t\tspadesList.add(AllCards.aTS);\r\n\t\tspadesList.add(AllCards.a7S);\r\n\t\tspadesList.add(AllCards.aJS);\r\n\t\tspadesList.add(AllCards.aKS);\r\n//\t\tassertTrue( h.playableCards(Suit.SPADES, null).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\tCardList joker = new CardList();\t\t\t\r\n\t\tjoker.add(AllCards.aLJo);\t\t\r\n\t\tjoker.add(AllCards.aHJo);\r\n//\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, null).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\t\r\n\t\t// Trump\r\n\t\tclubList.add(AllCards.aJS);\r\n\t\tclubList.add(AllCards.aLJo);\r\n\t\tclubList = clubList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.CLUBS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tdiamondsList.add(AllCards.aLJo);\r\n\t\tdiamondsList = diamondsList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(diamondsList.toString()));\r\n\r\n\t\theartsList = heartsList.sort(new Card.ByRankComparator());\t\t\r\n\t\tassertTrue( h.playableCards(Suit.HEARTS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tspadesList.remove(AllCards.aJS);\r\n\t\tspadesList = spadesList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.SPADES, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\t// no Trump in hand\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\tCardList jackList = new CardList();\r\n\t\tjackList.add(AllCards.aJS);\r\n\t\tjackList.add(AllCards.aJC);\r\n\t\tassertTrue(jackHand.playableCards(Suit.CLUBS, Suit.SPADES).sort(new Card.ByRankComparator()).toString().equals(jackList.toString()));\r\n\t\t\r\n\t}", "private boolean canPut(Player player) {\n boolean haveValidCart = false;\n boolean can = false;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard) || temp instanceof WildCard) {\n haveValidCart = true;\n can = true;\n break;\n }\n }\n if (!haveValidCart) {\n player.addCard(cards.get(0));\n cards.remove(0);\n if (player.getCards().get(player.getCards().size()-1).isValidCard(currentCard)) {\n show();\n System.out.println(player.getName() + \"! You were given a card because you didn't have any valid choice.\");\n can = true;\n }\n else {\n show();\n System.out.println(player.getName() + \"! You were given a card but you don't have any valid choice yet.\");\n }\n }\n return can;\n }", "public boolean playerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(playerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "void playCurrentStationCard();", "@org.junit.Test\n public void test_PlayerWinOfBlackJack(){\n deck.add(new Card(Suit.Club ,10)); //player\n deck.add(new Card(Suit.Diamond, 10)); //dealer\n deck.add(new Card(Suit.Spade, 11)); //player\n deck.add(new Card(Suit.Heart, 8)); //dealer\n deck.add(new Card(Suit.Diamond, 8)); //player\n\n Start start=new Start(player,dealer,deck,table);\n Assert.assertTrue(start.checkBetValidity());\n start.deal();\n Assert.assertTrue(start.checkBlackJack());\n Assert.assertEquals(Status.Players_wins,start.getGameStatus());\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Test\n void play_BranchOne()\n {\n dealer = 22;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(0, result);\n }", "@Override\n\tpublic void onCouldNotPlayCardListener(int position) {\n\n\t}", "@Test\n void play_BranchTwo()\n {\n dealer = 22;\n player = 21;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(player, result);\n }", "private void testHand(List<Card> hand, Card upCard,\n UnoPlayer.Color calledColor, ArrayList<Integer> validPlays, int n)\n {\n int cardPlayed = thePlayer.play(hand, upCard, calledColor,\n new GameState(upCard));\n\n if (!validPlays.contains(new Integer(cardPlayed)))\n {\n String error = printCardError(hand, upCard, calledColor,\n validPlays, cardPlayed);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n UnoPlayer.Color color = thePlayer.callColor(hand);\n\n if (color != UnoPlayer.Color.RED && color != UnoPlayer.Color.BLUE\n && color != UnoPlayer.Color.GREEN\n && color != UnoPlayer.Color.YELLOW)\n {\n String error = printColorError(hand, upCard, calledColor,\n validPlays, color);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n }", "boolean hasAlreadCheckCard();", "public abstract boolean play(DiscardPile discardPile, Stack<Card> drawPile, ArrayList<Player> players);", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest6() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(5, new ArrayList<Card>());\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "boolean CanDiscardCards(Resources resources);", "boolean hasFairplay();", "@Test\n public void testAddCard() {\n d_gameData.getD_playerList().get(1).addCard(GameCard.BLOCKADE);\n assertEquals(true, d_gameData.getD_playerList().get(1).getD_cards().contains(GameCard.BLOCKADE));\n }", "@Test\n public void buyCard() throws Exception {\n model.getTurnTracker().setCurrentTurn(PlayerIndex.FIRST);\n when(devCardFacade.canBuyDevCard(currentPlayer)).thenReturn(true);\n dcc.buyCard();\n verify(devCardFacade, atMost(1)).buyDevCard(currentPlayer);\n }", "@Test\n void play()\n {\n dealer = 21;\n player = 20;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(Math.max(dealer, player), result);\n }", "boolean canBeAdded(ICard toBeAddedCard);", "@Test\n public void buyCardWithNoResources() throws Exception {\n when(devCardFacade.canBuyDevCard(noDevCardsPlayer)).thenReturn(false);\n dcc.buyCard();\n verify(devCardFacade, never()).buyDevCard(noDevCardsPlayer);\n }", "@Test\r\n public void testGetSpecificCard() {\r\n Deck instance = new Deck();\r\n System.out.println(\"Testing getSpecificCard\");\r\n Card result = instance.getSpecificCard(51);\r\n System.out.println('\\t' + \"Card toString: \" + result.toString());\r\n assertNotNull(result);\r\n }", "private static void testPlayer() {\r\n\t\t\tnew AccessChecker(Player.class).pM(\"getName\").pM(\"getMark\").pM(\"toString\").checkAll();\r\n\t\t\tPlayer p = new Player(\"Test\", 'X');\r\n\t\t\tcheckEq(p.getName(), \"Test\", \"Player.getName\");\r\n\t\t\tcheckEq(p.getMark(), 'X', \"Player.getMark\");\r\n\t\t\tcheckEqStr(p, \"Test(X)\", \"Player.toString\");\t\t\r\n\t\t}", "void playMonopolyCard(String resource);", "public boolean computerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(computerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "@Test(suiteName = \"NowPlaying\", testName = \"DMCA Restricted\", description = \"Now Playing - Live - DMCA Restricted - Player controls\", enabled = true, groups = {\n\t\t\t\"MOBANDEVER-227:EVQAAND-307\" })\n\tpublic void dmcaRestrictedPlayerControl() {\n\t\tCommon common = new Common(driver);\n\t\tCommon.log(\"verifying DMCA Restricted - Player controls MOBANDEVER-227\");\n\t\ttry {\n\t\t\tgetPageFactory().getEvehome().clickonMusic();\n\t\t\tcommon.scrollUntilTextExists(\"Dance/Electronic\");\n\t\t\tgetPageFactory().getEvehome().clickMucisSubRock();\n\t\t\tgetPageFactory().getEvehome().popChannel1();\n\t\t\tgetPageFactory().getCategory().nplChnumber();\n\t\t\tgetPageFactory().getEvehome().clickminimize();\n\t\t} catch (AndriodException ex) {\n\t\t\tCommon.errorlog(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t\tAssert.fail(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t}\n\t}", "boolean hasCardType();", "abstract boolean allowedToAdd(Card card);", "@Override\n public boolean canUseCard(){\n return false;\n }", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest4() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(0, g.getDeck());\n }", "public abstract boolean doTurn(Deck theDeck);", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public final void testPlayer2Win() {\n checkPlayerWin(player2);\n }", "public boolean checkRequirements(PlayerBoard playerBoard);", "@Test\n public final void testPlayer1Win() {\n checkPlayerWin(player1);\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\n void checkAmmoResources() {\n ArrayList<Player> array = new ArrayList<>();\n AlphaGame game = new AlphaGame(1, array, false, 5);\n RealPlayer rp = new RealPlayer('b', \"rp\");\n rp.setPlayerPosition(Board.getSpawnpoint('b'));\n array.add(rp);\n char[] cost = new char[3];\n cost[0] = 'b';\n cost[1] = 'r';\n\n assertTrue(rp.checkAmmoResources(cost));\n\n cost[0] = 'b';\n cost[1] = 'b';\n\n assertFalse(rp.checkAmmoResources(cost));\n }", "@Test\n public void testNextCardGood() {\n System.out.println(\"nextCardGood\");\n Deck deck = new Deck();\n Card card = deck.nextCard();\n ////since the deck is unshuffled, that last card should be WILDCARD\n assertEquals(CardType.WILDCARD, card.getValue());\n }", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "public boolean isCard() {\n\t\treturn id > 0 && id < 53;\n\t}", "public abstract boolean isPossible(Player p);", "@Test(expected = Exception.class)\n public void testCardSelectionIsValid_FALSE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n \n }", "private boolean offerCard(Player p) {\n\n //Offer card (take or pass)\n p.sendMessage(\"TAKE OR PASS\");\n\n //Wait until they take the card\n waitForPlayerAction(p, \"TAKE\", \"PASS\");\n\n if(actionChosen.equals(\"TAKE\")) {\n\n giveCard(p);\n return true;\n\n } else if(actionChosen.equals(\"PASS\")) {\n //Don't give card\n\n cList.sendToAll(\"Player \" + p.getUsername() + \" passes\");\n return false;\n }\n\n return false;\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "boolean hasPlayready();" ]
[ "0.7659382", "0.7539191", "0.7412345", "0.7284266", "0.7250692", "0.6787191", "0.6725207", "0.6694125", "0.6676907", "0.6633777", "0.6591471", "0.65719104", "0.65429306", "0.6541443", "0.65411043", "0.65345496", "0.6495341", "0.64626014", "0.64570975", "0.6431492", "0.6426719", "0.6378933", "0.6372066", "0.63294333", "0.63272184", "0.6266896", "0.6262256", "0.6240708", "0.6240149", "0.6146987", "0.61394435", "0.61211514", "0.61171293", "0.6084959", "0.6070099", "0.60580873", "0.6023855", "0.6007266", "0.5989935", "0.5985366", "0.5973349", "0.5960403", "0.5958512", "0.5951363", "0.5950308", "0.5937089", "0.5930786", "0.5907961", "0.5903844", "0.589059", "0.5888103", "0.5866878", "0.58665043", "0.5841053", "0.5824271", "0.5807972", "0.5796643", "0.578707", "0.5780152", "0.57779497", "0.57732564", "0.57704306", "0.57631034", "0.5758579", "0.57483935", "0.5745572", "0.574198", "0.5740751", "0.5723554", "0.5716258", "0.57160014", "0.5713931", "0.5713826", "0.57131183", "0.57119846", "0.57112557", "0.5710174", "0.57070404", "0.5696961", "0.5683724", "0.567602", "0.56705374", "0.5669256", "0.56689835", "0.56651807", "0.5648963", "0.56482226", "0.5645222", "0.5627901", "0.5624333", "0.5620258", "0.5619998", "0.5617427", "0.56077766", "0.5602424", "0.5595697", "0.55876154", "0.5570578", "0.556642", "0.5565973" ]
0.75819266
1
Test of cardCanPlay method, of class utils.
@Test public void testCardCanPlay_FALSE() { System.out.println("cardCanPlay FALSE COLOUR"); UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE); UnoCardColour wildColour = UnoCardColour.BLUE; boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour); assertEquals(false, result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "@Test\n public void testCardCanPlay_TRUE() {\n System.out.println(\"cardCanPlay TRUE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_TRUE_VALUE() {\n System.out.println(\"cardCanPlay TRUE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE_VALUE() {\n System.out.println(\"cardCanPlay FALSE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_WILD() {\n System.out.println(\"cardCanPlay WILD\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "boolean isPlayable();", "private boolean isValidPlay(ICard cardToPlay) {\n return cardToPlay.isValidOn(getTopCard());\n }", "boolean hasPlayCardRequest();", "@Override\n\tpublic void playCard() {\n\t\t\n\t}", "@Test\r\n public void testHasAtLeastTwoPlayableCards() {\n Player player2 = new Player(\"Three Playable Cards Test\", true);\r\n Hand threePlayableCardsHand = strategyHand;\r\n player2.setHand(threePlayableCardsHand.getAllCards());\r\n\r\n // Make it harder to find playable cards:\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD, cvm));\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD_DRAW_FOUR, cvm));\r\n\r\n Card currentPlayedCard_1 = new Card(Card.YELLOW, Card.ONE, cvm);\r\n assertTrue(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_1, Card.BLUE));\r\n\r\n Card currentPlayedCard_2 = new Card(Card.BLUE, Card.SEVEN, cvm);\r\n assertFalse(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_2, Card.BLUE));\r\n }", "@Override\r\n\tpublic void playCard() {\n\t\t\r\n\t}", "protected abstract boolean isCardActivatable(Card card);", "public boolean checkPlays(Player player){\n return true;\n }", "@Test\n public void testPlay1()\n {\n List<Card> hand = new ArrayList<Card>();\n hand.add(new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 4));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.NUMBER, 7));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.REVERSE, -1));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.NUMBER, 2));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.SKIP, -1));\n hand.add(new Card(UnoPlayer.Color.NONE, UnoPlayer.Rank.WILD, -1));\n\n Card upCard = new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 7);\n int cardPlayed = thePlayer.play(hand, upCard, UnoPlayer.Color.RED, new\n GameState(upCard));\n\n // Let's see whether the card played was legit.\n assertTrue(\"Player didn't think a card could be played.\\nThis is an \"\n + \"error, since cards 0, 1, and 5 are legal plays.\",\n cardPlayed >= 0);\n assertTrue(\"Player tried to play \" + hand.get(cardPlayed)\n + \", which is an error.\", cardPlayed == 0 || cardPlayed == 1\n || cardPlayed == 5);\n System.out.println(\"Player played \" + hand.get(cardPlayed));\n }", "void playMonumentCard();", "@Override\n public boolean anotherPlayIsPossible()\n {\n \t\n List<Integer> test = cardIndexes();\n return containsSum13(test) || containsK(test);\n \n }", "public void playCard(int player, int card) {\n }", "public void testGetCard() {\n System.out.println(\"getCard\");\n Card expResult = new Card(Rank.QUEEN, Suit.SPADES);\n Play instance = new Play(\"Player1\", expResult);\n Card result = instance.getCard();\n assertEquals(expResult, result);\n }", "public boolean canUseCard(Card card) {\r\n\t\tif (card.cardColor.contains(CardColor.GREEN)\r\n\t\t\t\t|| card.cardColor.contains(CardColor.GREY)) {\r\n\t\t\treturn false;\r\n\t\t} else if (this.blackTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.PURPLE)\r\n\t\t\t\t&& this.purpleTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.RED) && this.redTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BLUE)\r\n\t\t\t\t&& this.blueTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BROWN)\r\n\t\t\t\t&& this.brownTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "public boolean playCard(Card card){\n boolean b = effectHandler.playCard( card , null);\n return b;\n }", "boolean isPlayableInGame();", "@Test(expected = NotPlayingException.class)\n public void not_allow_picking_cards_if_not_playing(){\n\n Deck deck = new Deck();\n Game game = new Game(deck);\n\n game.join(\"susan\");\n\n game.pickCard(\"susan\");\n }", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test(expected = DoesNotOwnException.class)\n\tpublic void cannotPlayDevCardTest() throws DoesNotOwnException, CannotPlayException\n\t{\n\t\tp.playDevelopmentCard(c, game.getBank());\n\t}", "@Test\n public void receiveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0, 0);\n x.receiveCard(4, 4);\n assertTrue(x.getCards().get(4) == 4);\n }", "boolean hasPlaySingleCardResponse();", "@Test\n public void playMonopolyCard() throws Exception {\n ResourceType type = ResourceType.ORE;\n when(devCardFacade.canUseMonopolyCard(noDevCardsPlayer, type)).thenReturn(false);\n dcc.playMonopolyCard(type);\n verify(devCardFacade, never()).useMonopolyCard(noDevCardsPlayer, type);\n //Player 1; has devCards\n when(devCardFacade.canUseMonopolyCard(currentPlayer, type)).thenReturn(true);\n dcc.playMonopolyCard(type);\n }", "@Override\r\n\tpublic void playMonumentCard() {\n\t\t\r\n\t}", "public void testGetIsPlayable()\n {\n assertEquals(b1.getIsPlayable(), false);\n b1.setIsPlayable(true);\n assertEquals(b1.getIsPlayable(), true);\n }", "protected abstract boolean isPlayerActivatable(PlayerSimple player);", "@Test\n public void giveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(5,3);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 3);\n }", "public abstract CardAction play(Player p);", "@Test\n public void startPlayTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n int players = 4;\n int current = 0;\n g.startPlay(players, deck);\n for (Card c : deck) {\n assertTrue(g.getPlayers().get(current).contains(c));\n current++;\n if (current == players) {\n current = 0;\n }\n }\n }", "public Card PlayCard() {\n\t Card ret = null;\n\t Card card;\n\t if (mCardCount > 0) {\n\t\t // To work out what card to play, see what cards can be played\n\t\t \tCard[] playableCards;\n\t\t \tplayableCards = mRules.GetPlayableCards();\n\t\t \tCard[] selectedCards;\n\t\t \tselectedCards = new Card[8];\n\t\t \tint iNumSelectableCards = 0;\n\t\t \tfor (int i = 0; i < 8; i++)\n\t\t \t\tselectedCards[i] = null;\n\t \tfor (int i = 0; i < mCardCount; i++){\n\t \t\tcard = mCard[i];\n\t \t\tswitch (card.GetSuit()){\n\t \t\tcase Card.HEARTS:\n\t \t\t\t\n\t \t\t\t// Card is a heart, can it be played?\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t// and must be played first\n\t \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n\t \n\t \t\t\t\treturn card;\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()-1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\tcase Card.DIAMONDS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.CLUBS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.SPADES:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\tbreak;\n\n\t \t\t\t\t \t\t\t\n\t \t\t}\n\t\n\t \t}\t\n\t \t\n\t \t// Now go through the selectable cards and see which is best to be played\n\t \tif (iNumSelectableCards == 0)\n\t \t\treturn ret;\n\t \t\n\t \tint iPos;\n\t \tcard = null;\n\t \tif (iNumSelectableCards == 1){\n\t\t\t \tfor (int i = 0; i < 8; i++)\n\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t \t\t\tcard = selectedCards[i];\n\t\t\t \t\t\tbreak;\n\t\t\t \t\t}\n\t\t\t \t\t\t \t\n\t \t}\n\t \telse {\n\t\t\t String sDifficulty = mRules.mView.GetSettings().getString(\"Difficulty\", \"0\");// 0 = hard, 1 = easy\n\t\t\t int iDifficulty = Integer.parseInt(sDifficulty);\n\t\t\t if (iDifficulty == EASY){\n\t\t\t \t// Get a random card from the playable ones\n\t\t\t\t\t Random generator = new Random();\n\t\t\t\t\t int randomIndex = generator.nextInt( iNumSelectableCards );\n\t\t\t\t\t int iCount = 0;\n\t\t\t\t\t \tfor (int i = 0; i < 8; i++){\n\t\t\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t\t\t \t\t\tif (iCount == randomIndex){\n\t\t\t\t\t \t\t\t\tcard = selectedCards[i];\n\t\t\t\t\t \t\t\t\tbreak;\n\t\t\t\t\t \t\t\t}\n\t\t\t\t\t \t\t\telse iCount++;\n\t\t\t\t\t \t\t}\t\n\t\t\t\t\t \t}\n\t\t\t }\n\t\t\t else {\n\t\t\t \tiPos = GetBestCard(selectedCards);\n\t\t\t \tcard = selectedCards[iPos];\n\t\t\t }\n\t \t}\n\t \t\n\t \tswitch (card.GetSuit()){\n \t\tcase Card.HEARTS:\t \t\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\t// and must be played first\n \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n \n \t\t\t\treturn card;\n \t\t\t}\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n \t\t\t\t\tplayableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\tcase Card.DIAMONDS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(8,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(6,Card.DIAMONDS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(card.GetValue()-1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(card.GetValue()+1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\t\t\n \t\tcase Card.CLUBS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(8,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.CLUBS6] = new Card(6,Card.CLUBS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n \t\t\t\t\tplayableCards[Rules.CLUBS6] = new Card(card.GetValue()-1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n \t\t\t\t\tLog.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.CLUBS);\n \t\t\t\t\tplayableCards[Rules.CLUBS8] = new Card(card.GetValue()+1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\tbreak; \n \t\tcase Card.SPADES:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(8,Card.SPADES);\n\t \t\t\t\tplayableCards[Rules.SPADES6] = new Card(6,Card.SPADES);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES6] = new Card(card.GetValue()-1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES8] = new Card(card.GetValue()+1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\tbreak;\n \t\t\t\n\t \t}\n\t \n\t }\n\t return ret;\n }", "@Test\n public void giveCard2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 0);\n }", "boolean play();", "@Test\n public void checkBook2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n boolean gotBook = x.checkBook();\n assertTrue(!gotBook);\n }", "@Override\r\n\tpublic boolean canPlay() {\n\t\treturn false;\r\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "protected boolean canPlay(Board gameBoard) {\n if (canPlayWithoutWild(gameBoard)) {\n return true;\n }\n Iterator<Card> it = myCards.iterator();\n while (it.hasNext()) { // check if the player has wild card\n Card temp = it.next();\n if (temp instanceof WildDrawCard || temp instanceof ColorChangeCard) {\n return true;\n }\n }\n return false;\n }", "private boolean canPlay(UnoCard topCard, UnoCard newCard) {\n\n\t\t// Color or value matches\n\t\tif (topCard.getColor().equals(newCard.getColor())\n\t\t\t\t|| topCard.getValue().equals(newCard.getValue()))\n\t\t\treturn true;\n\t\t// if chosen wild card color matches\n\t\telse if (topCard instanceof WildCard)\n\t\t\treturn ((WildCard) topCard).getWildColor().equals(newCard.getColor());\n\n\t\t// suppose the new card is a wild card\n\t\telse if (newCard instanceof WildCard)\n\t\t\treturn true;\n\n\t\t// else\n\t\treturn false;\n\t}", "public abstract boolean isPlayer();", "@Test\n public void testCardSelectionIsValid_TRUE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n }", "boolean hasAlreadShowCard();", "private void playThisCard(UnoCard clickedCard) throws NotYourTurnException, InvalidMoveException {\n\t\t// Check player's turn\n\t\tif (!isHisTurn(clickedCard)) {\n\t\t\tthrow new NotYourTurnException();\n\t\t} else {\n\n\t\t\t// Card validation\n\t\t\tif (isValidMove(clickedCard)) {\n\n\t\t\t\tplayedCards().add(clickedCard);\n\n\t\t\t\tremovePlayedCard(clickedCard);\n\n\t\t\t\t// function cards ??\n if (clickedCard instanceof ActionCard) {\n performAction(clickedCard);\n\n }\n\n\t\t\t\tfor (GameListener listener : gameListeners) {\n\t\t\t\t\tlistener.cardPlayed(clickedCard);\n\t\t\t\t}\n\n\t\t\t\tcheckResults();\n\t\t\t} else {\n\t\t\t\tthrow new InvalidMoveException();\n\n\t\t\t}\n\t\t}\n\t}", "@Test\n void play_BranchThree()\n {\n dealer = 21;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(dealer, result);\n }", "@Test \n public void testDetectPlayer(){\n assertTrue(controller.detect());\n }", "boolean CanBuyDevCard();", "public boolean playCard(Card card, Enemy enemy){\n if( isGameOver() )return false;\n if( card.isHasTarget() && !enemyController.hasEnemy(enemy) )return false;\n\n System.out.println(\"IN PLAYCARD METHOD\");\n boolean b = effectHandler.playCard( card , enemy);\n System.out.println( \"HAND CARDS : \");\n for( int i = 0 ; i < piles.getHandPile().getCards().size() ; i++ ){\n System.out.println( piles.getHandPile().getCards().get(i).getName() );\n }\n\n return b;\n }", "static boolean playBlackjack() {\n\n Deck mazo; // Un mazo de cartas. Una nueva baraja para cada juego.\n BlackjackHand manoRepartidor; // La mano del repartidor.\n BlackjackHand manoUsuario; // La mano del usuario.\n \n mazo = new Deck();\n manoRepartidor = new BlackjackHand();\n manoUsuario = new BlackjackHand();\n\n // Baraja el mazo, luego reparte dos cartas a cada jugador.\n \n mazo.barajar();\n manoRepartidor.agregarCarta( mazo.cartaReparto());\n manoRepartidor.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n \n System.out.println();\n System.out.println();\n \n /* Marque si uno de los jugadores tiene Blackjack (dos cartas con un total de 21).\n El jugador con Blackjack gana el juego. El repartidor gana empates.\n */\n \n if (manoRepartidor.obtenerValorBlackjack() == 21) {\n String m=\"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"El repartidor tiene Blackjack. El repartidor gana.\";\n JOptionPane.showMessageDialog(null, m);\n \n return false;\n }\n \n if (manoUsuario.obtenerValorBlackjack() == 21) {\n String m1 = \"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"Tienes Blackjack. Tú ganas.\";\n JOptionPane.showMessageDialog(null, m1);\n return true;\n }\n \n /* Si ninguno de los dos jugadores tiene Blackjack, juega el juego. Primero el usuario \n tiene la oportunidad de robar cartas (es decir,\"Golpear\"). El bucle while termina \n cuando el usuario elige \"Stand\". Si el usuario supera los 21,\n el usuario pierde inmediatamente.\n */\n \n while (true) {\n \n /* Muestra las cartas de los usuarios y deja que el usuario decida si golpea o se para. */\n\n System.out.println();\n System.out.println();\n System.out.println();\n String aux1=\"\";\n for ( int i = 0; i < manoUsuario.obtenerConteoCartas(); i++ ){\n aux1=aux1+\" \"+manoUsuario.obtenerCarta(i)+\"\\n\";\n }\n JOptionPane.showMessageDialog(null, \"Tus cartas son: \\n\" \n + aux1+\"\\n\"\n + \"Su total es \" + manoUsuario.obtenerValorBlackjack()+\"\\n\\n\"\n +\"El concesionario está mostrando el \" + manoRepartidor.obtenerCarta(0));\n \n char userAction= JOptionPane.showInputDialog(null,\"¿Pulse (H) o Pararse (S)? \").charAt(0);\n \n // char x = JOptionPane.showInputDialog(null,\"Ingres... el dato\").charAt(0);\n char opcion;\n do {\n opcion=Character.toUpperCase(userAction);\n if (opcion != 'H' && opcion != 'S')\n \n JOptionPane.showMessageDialog(null,\"Por favor responda H o S: \" );\n } while (opcion != 'H' && opcion != 'S');\n\n /* Si el usuario acierta, el usuario recibe una tarjeta. Si el usuario se para, el bucle termina \n (y es el turno de la banca para robar cartas).\n */\n \n if ( opcion == 'S' ) {\n // Termina el bucle; el usuario termina de coger las tarjetas.\n break;\n }\n else { // La accion del usuario es' H'. Dar al usuario una tarjeta. \n // Si el usuario pasa de 21, el usuario pierde.\n Card newCard = mazo.cartaReparto();\n manoUsuario.agregarCarta(newCard);\n \n System.out.println();\n System.out.println();\n System.out.println();\n \n JOptionPane.showMessageDialog(null, \"Aciertos de usuario.\\n\"\n + \"Su carta es el \" + newCard+\"\\n\"\n + \"Su total es ahora \" + manoUsuario.obtenerValorBlackjack());\n if (manoUsuario.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Pasaste por encima de los 21. Tú pierdes.\\n\"\n + \"La otra carta del repartidor era el \" + manoRepartidor.obtenerCarta(1));\n return false; \n }\n }\n \n } // end while loop\n \n /* Si llegamos a este punto, el usuario tiene un nivel Ahora, es\n la oportunidad del traficante de dibujar. El Dealer coge cartas hasta que el dealer\n total es > 16. Si el concesionario pasa de 21, pierde.\n */\n\n \n JOptionPane.showMessageDialog(null, \"Usuario parado.\\n\"\n +\"Las cartas del distribuidor son\\n\"\n +\" \" + manoRepartidor.obtenerCarta(0)+\"\\n\"\n + \" \" + manoRepartidor.obtenerCarta(1));\n while (manoRepartidor.obtenerValorBlackjack() <= 16) {\n Card newCard = mazo.cartaReparto();\n \n JOptionPane.showMessageDialog(null, \"El distribuidor golpea y obtiene el \" + newCard);\n manoRepartidor.agregarCarta(newCard);\n if (manoRepartidor.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Distribuidor detenido por pasar de 21. Usted gana.\");\n return true;\n }\n }\n \n JOptionPane.showMessageDialog(null, \"El total del distribuidor es \" + manoRepartidor.obtenerValorBlackjack());\n /* Si llegamos a este punto, ambos jugadores tienen 21 o menos. \n Podemos determinar el ganador comparando los valores de sus manos. */\n \n System.out.println();\n if (manoRepartidor.obtenerValorBlackjack() == manoUsuario.obtenerValorBlackjack()) {\n JOptionPane.showMessageDialog(null, \"El concesionario gana por empate. Tú pierdes.\");\n \n return false;\n }\n else if (manoRepartidor.obtenerValorBlackjack() > manoUsuario.obtenerValorBlackjack()) {\n \n JOptionPane.showMessageDialog(null, \"El concesionario gana, \" + manoRepartidor.obtenerValorBlackjack() \n + \" puntos para \" + manoUsuario.obtenerValorBlackjack() + \".\");\n return false;\n }\n else {\n \n JOptionPane.showMessageDialog(null, \"Tu ganas, \" + manoUsuario.obtenerValorBlackjack() \n + \" puntos para \" + manoRepartidor.obtenerValorBlackjack() + \".\");\n return true;\n }\n\n }", "public void playCard(ActionCard card, Integer selectedPlayer)\n {\n System.out.println(\"gui: playCard: \" + card + \", selected: \" + selectedPlayer);\n // Guard against this\n if (!isTurn || this.played)\n {\n return;\n }\n \n if(card instanceof PrivateTip || card instanceof Snoop) \n {\n if(selectedPlayer == null) \n {\n JOptionPane.showMessageDialog(null, \"Please select \"\n + \"a player in the \"\n + \"Player Listing (Upper right) that is not yourself!\", \n \"Warning\", \n JOptionPane.ERROR_MESSAGE); \n return;\n }\n }\n\n if (card instanceof Suggestion)\n {\n this.played = true;\n // prompt for solution\n suggestionScreen = new AccusationScreen(this, true, (Suggestion)card);\n suggestionScreen.setVisible(true);\n }\n else\n {\n this.played = clientController.playActionCard(card, selectedPlayer);\n if(!this.played)\n {\n mainGameScreen.notifyUser(\"Play failed: To Play this card,\"\n + \" please select a CluePlayer from the 'Players' list,\"\n + \" then click on this card.\");\n }\n }\n\n }", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Test\r\n\tpublic void testPlayableCards2()\r\n\t{\n\t\t\r\n\t\tCardList clubList = new CardList();\r\n\t\tclubList.add(AllCards.a6C);\r\n\t\tclubList.add(AllCards.aTC);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.CLUBS, null).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tCardList diamondsList = new CardList();\r\n\t\tdiamondsList.add(AllCards.a7D);\r\n\t\tdiamondsList.add(AllCards.aQD);\r\n\t\tdiamondsList.add(AllCards.aKD);\r\n//\t\tassertTrue( h.playableCards(Suit.DIAMONDS, null).toString().equals(diamondsList.toString()));\r\n\t\t\r\n\t\tCardList heartsList = new CardList();\r\n\t\theartsList.add(AllCards.a9H);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.HEARTS, null).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tCardList spadesList = new CardList();\r\n\t\tspadesList.add(AllCards.aTS);\r\n\t\tspadesList.add(AllCards.a7S);\r\n\t\tspadesList.add(AllCards.aJS);\r\n\t\tspadesList.add(AllCards.aKS);\r\n//\t\tassertTrue( h.playableCards(Suit.SPADES, null).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\tCardList joker = new CardList();\t\t\t\r\n\t\tjoker.add(AllCards.aLJo);\t\t\r\n\t\tjoker.add(AllCards.aHJo);\r\n//\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, null).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\t\r\n\t\t// Trump\r\n\t\tclubList.add(AllCards.aJS);\r\n\t\tclubList.add(AllCards.aLJo);\r\n\t\tclubList = clubList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.CLUBS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tdiamondsList.add(AllCards.aLJo);\r\n\t\tdiamondsList = diamondsList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(diamondsList.toString()));\r\n\r\n\t\theartsList = heartsList.sort(new Card.ByRankComparator());\t\t\r\n\t\tassertTrue( h.playableCards(Suit.HEARTS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tspadesList.remove(AllCards.aJS);\r\n\t\tspadesList = spadesList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.SPADES, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\t// no Trump in hand\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\tCardList jackList = new CardList();\r\n\t\tjackList.add(AllCards.aJS);\r\n\t\tjackList.add(AllCards.aJC);\r\n\t\tassertTrue(jackHand.playableCards(Suit.CLUBS, Suit.SPADES).sort(new Card.ByRankComparator()).toString().equals(jackList.toString()));\r\n\t\t\r\n\t}", "private boolean canPut(Player player) {\n boolean haveValidCart = false;\n boolean can = false;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard) || temp instanceof WildCard) {\n haveValidCart = true;\n can = true;\n break;\n }\n }\n if (!haveValidCart) {\n player.addCard(cards.get(0));\n cards.remove(0);\n if (player.getCards().get(player.getCards().size()-1).isValidCard(currentCard)) {\n show();\n System.out.println(player.getName() + \"! You were given a card because you didn't have any valid choice.\");\n can = true;\n }\n else {\n show();\n System.out.println(player.getName() + \"! You were given a card but you don't have any valid choice yet.\");\n }\n }\n return can;\n }", "public boolean playerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(playerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "void playCurrentStationCard();", "@org.junit.Test\n public void test_PlayerWinOfBlackJack(){\n deck.add(new Card(Suit.Club ,10)); //player\n deck.add(new Card(Suit.Diamond, 10)); //dealer\n deck.add(new Card(Suit.Spade, 11)); //player\n deck.add(new Card(Suit.Heart, 8)); //dealer\n deck.add(new Card(Suit.Diamond, 8)); //player\n\n Start start=new Start(player,dealer,deck,table);\n Assert.assertTrue(start.checkBetValidity());\n start.deal();\n Assert.assertTrue(start.checkBlackJack());\n Assert.assertEquals(Status.Players_wins,start.getGameStatus());\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Test\n void play_BranchOne()\n {\n dealer = 22;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(0, result);\n }", "@Override\n\tpublic void onCouldNotPlayCardListener(int position) {\n\n\t}", "@Test\n void play_BranchTwo()\n {\n dealer = 22;\n player = 21;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(player, result);\n }", "private void testHand(List<Card> hand, Card upCard,\n UnoPlayer.Color calledColor, ArrayList<Integer> validPlays, int n)\n {\n int cardPlayed = thePlayer.play(hand, upCard, calledColor,\n new GameState(upCard));\n\n if (!validPlays.contains(new Integer(cardPlayed)))\n {\n String error = printCardError(hand, upCard, calledColor,\n validPlays, cardPlayed);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n UnoPlayer.Color color = thePlayer.callColor(hand);\n\n if (color != UnoPlayer.Color.RED && color != UnoPlayer.Color.BLUE\n && color != UnoPlayer.Color.GREEN\n && color != UnoPlayer.Color.YELLOW)\n {\n String error = printColorError(hand, upCard, calledColor,\n validPlays, color);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n }", "boolean hasAlreadCheckCard();", "public abstract boolean play(DiscardPile discardPile, Stack<Card> drawPile, ArrayList<Player> players);", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest6() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(5, new ArrayList<Card>());\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "boolean CanDiscardCards(Resources resources);", "@Test\n public void testAddCard() {\n d_gameData.getD_playerList().get(1).addCard(GameCard.BLOCKADE);\n assertEquals(true, d_gameData.getD_playerList().get(1).getD_cards().contains(GameCard.BLOCKADE));\n }", "@Test\n void play()\n {\n dealer = 21;\n player = 20;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(Math.max(dealer, player), result);\n }", "boolean hasFairplay();", "@Test\n public void buyCard() throws Exception {\n model.getTurnTracker().setCurrentTurn(PlayerIndex.FIRST);\n when(devCardFacade.canBuyDevCard(currentPlayer)).thenReturn(true);\n dcc.buyCard();\n verify(devCardFacade, atMost(1)).buyDevCard(currentPlayer);\n }", "boolean canBeAdded(ICard toBeAddedCard);", "@Test\n public void buyCardWithNoResources() throws Exception {\n when(devCardFacade.canBuyDevCard(noDevCardsPlayer)).thenReturn(false);\n dcc.buyCard();\n verify(devCardFacade, never()).buyDevCard(noDevCardsPlayer);\n }", "@Test\r\n public void testGetSpecificCard() {\r\n Deck instance = new Deck();\r\n System.out.println(\"Testing getSpecificCard\");\r\n Card result = instance.getSpecificCard(51);\r\n System.out.println('\\t' + \"Card toString: \" + result.toString());\r\n assertNotNull(result);\r\n }", "private static void testPlayer() {\r\n\t\t\tnew AccessChecker(Player.class).pM(\"getName\").pM(\"getMark\").pM(\"toString\").checkAll();\r\n\t\t\tPlayer p = new Player(\"Test\", 'X');\r\n\t\t\tcheckEq(p.getName(), \"Test\", \"Player.getName\");\r\n\t\t\tcheckEq(p.getMark(), 'X', \"Player.getMark\");\r\n\t\t\tcheckEqStr(p, \"Test(X)\", \"Player.toString\");\t\t\r\n\t\t}", "void playMonopolyCard(String resource);", "public boolean computerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(computerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "@Test(suiteName = \"NowPlaying\", testName = \"DMCA Restricted\", description = \"Now Playing - Live - DMCA Restricted - Player controls\", enabled = true, groups = {\n\t\t\t\"MOBANDEVER-227:EVQAAND-307\" })\n\tpublic void dmcaRestrictedPlayerControl() {\n\t\tCommon common = new Common(driver);\n\t\tCommon.log(\"verifying DMCA Restricted - Player controls MOBANDEVER-227\");\n\t\ttry {\n\t\t\tgetPageFactory().getEvehome().clickonMusic();\n\t\t\tcommon.scrollUntilTextExists(\"Dance/Electronic\");\n\t\t\tgetPageFactory().getEvehome().clickMucisSubRock();\n\t\t\tgetPageFactory().getEvehome().popChannel1();\n\t\t\tgetPageFactory().getCategory().nplChnumber();\n\t\t\tgetPageFactory().getEvehome().clickminimize();\n\t\t} catch (AndriodException ex) {\n\t\t\tCommon.errorlog(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t\tAssert.fail(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t}\n\t}", "boolean hasCardType();", "abstract boolean allowedToAdd(Card card);", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest4() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(0, g.getDeck());\n }", "@Override\n public boolean canUseCard(){\n return false;\n }", "public abstract boolean doTurn(Deck theDeck);", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public final void testPlayer2Win() {\n checkPlayerWin(player2);\n }", "public boolean checkRequirements(PlayerBoard playerBoard);", "@Test\n public final void testPlayer1Win() {\n checkPlayerWin(player1);\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\n void checkAmmoResources() {\n ArrayList<Player> array = new ArrayList<>();\n AlphaGame game = new AlphaGame(1, array, false, 5);\n RealPlayer rp = new RealPlayer('b', \"rp\");\n rp.setPlayerPosition(Board.getSpawnpoint('b'));\n array.add(rp);\n char[] cost = new char[3];\n cost[0] = 'b';\n cost[1] = 'r';\n\n assertTrue(rp.checkAmmoResources(cost));\n\n cost[0] = 'b';\n cost[1] = 'b';\n\n assertFalse(rp.checkAmmoResources(cost));\n }", "@Test\n public void testNextCardGood() {\n System.out.println(\"nextCardGood\");\n Deck deck = new Deck();\n Card card = deck.nextCard();\n ////since the deck is unshuffled, that last card should be WILDCARD\n assertEquals(CardType.WILDCARD, card.getValue());\n }", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "public boolean isCard() {\n\t\treturn id > 0 && id < 53;\n\t}", "public abstract boolean isPossible(Player p);", "@Test(expected = Exception.class)\n public void testCardSelectionIsValid_FALSE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n \n }", "private boolean offerCard(Player p) {\n\n //Offer card (take or pass)\n p.sendMessage(\"TAKE OR PASS\");\n\n //Wait until they take the card\n waitForPlayerAction(p, \"TAKE\", \"PASS\");\n\n if(actionChosen.equals(\"TAKE\")) {\n\n giveCard(p);\n return true;\n\n } else if(actionChosen.equals(\"PASS\")) {\n //Don't give card\n\n cList.sendToAll(\"Player \" + p.getUsername() + \" passes\");\n return false;\n }\n\n return false;\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "boolean hasPlayready();" ]
[ "0.766006", "0.7582534", "0.75396067", "0.72848463", "0.7251435", "0.6786447", "0.6728943", "0.6695245", "0.66777945", "0.663576", "0.6592336", "0.6573874", "0.6544196", "0.6543028", "0.6540786", "0.65356755", "0.64972013", "0.6465106", "0.64584273", "0.64336264", "0.64276546", "0.6380248", "0.6372509", "0.6331446", "0.6328685", "0.6268373", "0.62631047", "0.6241555", "0.6240799", "0.6146921", "0.61405337", "0.61221516", "0.61188", "0.6086538", "0.6070806", "0.60591984", "0.6022707", "0.60073286", "0.59889364", "0.59879386", "0.59746957", "0.59618926", "0.59599185", "0.5952169", "0.5950983", "0.593871", "0.59319025", "0.5907731", "0.59037185", "0.589253", "0.58880347", "0.5868666", "0.5867999", "0.5842847", "0.582513", "0.5812029", "0.5796239", "0.5789374", "0.5781705", "0.57790303", "0.5773666", "0.5771543", "0.576358", "0.57593733", "0.57496536", "0.57469463", "0.57439303", "0.574331", "0.57230735", "0.57190365", "0.5715433", "0.57152957", "0.5715084", "0.571474", "0.571268", "0.57124317", "0.5711675", "0.57073385", "0.57003963", "0.5683156", "0.5678626", "0.56720656", "0.56707597", "0.56701416", "0.5665546", "0.5650559", "0.56498516", "0.5645713", "0.5629505", "0.5626145", "0.56223446", "0.5620661", "0.56186014", "0.56095445", "0.5605055", "0.5596507", "0.5588696", "0.5572243", "0.5567589", "0.55645883" ]
0.7413086
3
Test of cardCanPlay method, of class utils.
@Test public void testCardCanPlay_TRUE_VALUE() { System.out.println("cardCanPlay TRUE VALUE"); UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO); UnoCardColour wildColour = UnoCardColour.BLUE; boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour); assertEquals(true, result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "@Test\n public void testCardCanPlay_TRUE() {\n System.out.println(\"cardCanPlay TRUE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE() {\n System.out.println(\"cardCanPlay FALSE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_FALSE_VALUE() {\n System.out.println(\"cardCanPlay FALSE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_WILD() {\n System.out.println(\"cardCanPlay WILD\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "boolean isPlayable();", "private boolean isValidPlay(ICard cardToPlay) {\n return cardToPlay.isValidOn(getTopCard());\n }", "boolean hasPlayCardRequest();", "@Override\n\tpublic void playCard() {\n\t\t\n\t}", "@Test\r\n public void testHasAtLeastTwoPlayableCards() {\n Player player2 = new Player(\"Three Playable Cards Test\", true);\r\n Hand threePlayableCardsHand = strategyHand;\r\n player2.setHand(threePlayableCardsHand.getAllCards());\r\n\r\n // Make it harder to find playable cards:\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD, cvm));\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD_DRAW_FOUR, cvm));\r\n\r\n Card currentPlayedCard_1 = new Card(Card.YELLOW, Card.ONE, cvm);\r\n assertTrue(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_1, Card.BLUE));\r\n\r\n Card currentPlayedCard_2 = new Card(Card.BLUE, Card.SEVEN, cvm);\r\n assertFalse(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_2, Card.BLUE));\r\n }", "@Override\r\n\tpublic void playCard() {\n\t\t\r\n\t}", "protected abstract boolean isCardActivatable(Card card);", "public boolean checkPlays(Player player){\n return true;\n }", "void playMonumentCard();", "@Test\n public void testPlay1()\n {\n List<Card> hand = new ArrayList<Card>();\n hand.add(new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 4));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.NUMBER, 7));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.REVERSE, -1));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.NUMBER, 2));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.SKIP, -1));\n hand.add(new Card(UnoPlayer.Color.NONE, UnoPlayer.Rank.WILD, -1));\n\n Card upCard = new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 7);\n int cardPlayed = thePlayer.play(hand, upCard, UnoPlayer.Color.RED, new\n GameState(upCard));\n\n // Let's see whether the card played was legit.\n assertTrue(\"Player didn't think a card could be played.\\nThis is an \"\n + \"error, since cards 0, 1, and 5 are legal plays.\",\n cardPlayed >= 0);\n assertTrue(\"Player tried to play \" + hand.get(cardPlayed)\n + \", which is an error.\", cardPlayed == 0 || cardPlayed == 1\n || cardPlayed == 5);\n System.out.println(\"Player played \" + hand.get(cardPlayed));\n }", "@Override\n public boolean anotherPlayIsPossible()\n {\n \t\n List<Integer> test = cardIndexes();\n return containsSum13(test) || containsK(test);\n \n }", "public void playCard(int player, int card) {\n }", "public void testGetCard() {\n System.out.println(\"getCard\");\n Card expResult = new Card(Rank.QUEEN, Suit.SPADES);\n Play instance = new Play(\"Player1\", expResult);\n Card result = instance.getCard();\n assertEquals(expResult, result);\n }", "public boolean canUseCard(Card card) {\r\n\t\tif (card.cardColor.contains(CardColor.GREEN)\r\n\t\t\t\t|| card.cardColor.contains(CardColor.GREY)) {\r\n\t\t\treturn false;\r\n\t\t} else if (this.blackTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.PURPLE)\r\n\t\t\t\t&& this.purpleTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.RED) && this.redTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BLUE)\r\n\t\t\t\t&& this.blueTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BROWN)\r\n\t\t\t\t&& this.brownTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "public boolean playCard(Card card){\n boolean b = effectHandler.playCard( card , null);\n return b;\n }", "boolean isPlayableInGame();", "@Test(expected = NotPlayingException.class)\n public void not_allow_picking_cards_if_not_playing(){\n\n Deck deck = new Deck();\n Game game = new Game(deck);\n\n game.join(\"susan\");\n\n game.pickCard(\"susan\");\n }", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test(expected = DoesNotOwnException.class)\n\tpublic void cannotPlayDevCardTest() throws DoesNotOwnException, CannotPlayException\n\t{\n\t\tp.playDevelopmentCard(c, game.getBank());\n\t}", "@Test\n public void receiveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0, 0);\n x.receiveCard(4, 4);\n assertTrue(x.getCards().get(4) == 4);\n }", "boolean hasPlaySingleCardResponse();", "@Override\r\n\tpublic void playMonumentCard() {\n\t\t\r\n\t}", "@Test\n public void playMonopolyCard() throws Exception {\n ResourceType type = ResourceType.ORE;\n when(devCardFacade.canUseMonopolyCard(noDevCardsPlayer, type)).thenReturn(false);\n dcc.playMonopolyCard(type);\n verify(devCardFacade, never()).useMonopolyCard(noDevCardsPlayer, type);\n //Player 1; has devCards\n when(devCardFacade.canUseMonopolyCard(currentPlayer, type)).thenReturn(true);\n dcc.playMonopolyCard(type);\n }", "public void testGetIsPlayable()\n {\n assertEquals(b1.getIsPlayable(), false);\n b1.setIsPlayable(true);\n assertEquals(b1.getIsPlayable(), true);\n }", "protected abstract boolean isPlayerActivatable(PlayerSimple player);", "@Test\n public void giveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(5,3);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 3);\n }", "public abstract CardAction play(Player p);", "@Test\n public void startPlayTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n int players = 4;\n int current = 0;\n g.startPlay(players, deck);\n for (Card c : deck) {\n assertTrue(g.getPlayers().get(current).contains(c));\n current++;\n if (current == players) {\n current = 0;\n }\n }\n }", "public Card PlayCard() {\n\t Card ret = null;\n\t Card card;\n\t if (mCardCount > 0) {\n\t\t // To work out what card to play, see what cards can be played\n\t\t \tCard[] playableCards;\n\t\t \tplayableCards = mRules.GetPlayableCards();\n\t\t \tCard[] selectedCards;\n\t\t \tselectedCards = new Card[8];\n\t\t \tint iNumSelectableCards = 0;\n\t\t \tfor (int i = 0; i < 8; i++)\n\t\t \t\tselectedCards[i] = null;\n\t \tfor (int i = 0; i < mCardCount; i++){\n\t \t\tcard = mCard[i];\n\t \t\tswitch (card.GetSuit()){\n\t \t\tcase Card.HEARTS:\n\t \t\t\t\n\t \t\t\t// Card is a heart, can it be played?\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t// and must be played first\n\t \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n\t \n\t \t\t\t\treturn card;\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()-1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\tcase Card.DIAMONDS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.CLUBS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.SPADES:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\tbreak;\n\n\t \t\t\t\t \t\t\t\n\t \t\t}\n\t\n\t \t}\t\n\t \t\n\t \t// Now go through the selectable cards and see which is best to be played\n\t \tif (iNumSelectableCards == 0)\n\t \t\treturn ret;\n\t \t\n\t \tint iPos;\n\t \tcard = null;\n\t \tif (iNumSelectableCards == 1){\n\t\t\t \tfor (int i = 0; i < 8; i++)\n\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t \t\t\tcard = selectedCards[i];\n\t\t\t \t\t\tbreak;\n\t\t\t \t\t}\n\t\t\t \t\t\t \t\n\t \t}\n\t \telse {\n\t\t\t String sDifficulty = mRules.mView.GetSettings().getString(\"Difficulty\", \"0\");// 0 = hard, 1 = easy\n\t\t\t int iDifficulty = Integer.parseInt(sDifficulty);\n\t\t\t if (iDifficulty == EASY){\n\t\t\t \t// Get a random card from the playable ones\n\t\t\t\t\t Random generator = new Random();\n\t\t\t\t\t int randomIndex = generator.nextInt( iNumSelectableCards );\n\t\t\t\t\t int iCount = 0;\n\t\t\t\t\t \tfor (int i = 0; i < 8; i++){\n\t\t\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t\t\t \t\t\tif (iCount == randomIndex){\n\t\t\t\t\t \t\t\t\tcard = selectedCards[i];\n\t\t\t\t\t \t\t\t\tbreak;\n\t\t\t\t\t \t\t\t}\n\t\t\t\t\t \t\t\telse iCount++;\n\t\t\t\t\t \t\t}\t\n\t\t\t\t\t \t}\n\t\t\t }\n\t\t\t else {\n\t\t\t \tiPos = GetBestCard(selectedCards);\n\t\t\t \tcard = selectedCards[iPos];\n\t\t\t }\n\t \t}\n\t \t\n\t \tswitch (card.GetSuit()){\n \t\tcase Card.HEARTS:\t \t\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\t// and must be played first\n \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n \n \t\t\t\treturn card;\n \t\t\t}\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n \t\t\t\t\tplayableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\tcase Card.DIAMONDS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(8,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(6,Card.DIAMONDS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(card.GetValue()-1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(card.GetValue()+1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\t\t\n \t\tcase Card.CLUBS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(8,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.CLUBS6] = new Card(6,Card.CLUBS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n \t\t\t\t\tplayableCards[Rules.CLUBS6] = new Card(card.GetValue()-1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n \t\t\t\t\tLog.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.CLUBS);\n \t\t\t\t\tplayableCards[Rules.CLUBS8] = new Card(card.GetValue()+1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\tbreak; \n \t\tcase Card.SPADES:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(8,Card.SPADES);\n\t \t\t\t\tplayableCards[Rules.SPADES6] = new Card(6,Card.SPADES);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES6] = new Card(card.GetValue()-1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES8] = new Card(card.GetValue()+1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\tbreak;\n \t\t\t\n\t \t}\n\t \n\t }\n\t return ret;\n }", "@Test\n public void giveCard2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 0);\n }", "boolean play();", "@Test\n public void checkBook2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n boolean gotBook = x.checkBook();\n assertTrue(!gotBook);\n }", "@Override\r\n\tpublic boolean canPlay() {\n\t\treturn false;\r\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "protected boolean canPlay(Board gameBoard) {\n if (canPlayWithoutWild(gameBoard)) {\n return true;\n }\n Iterator<Card> it = myCards.iterator();\n while (it.hasNext()) { // check if the player has wild card\n Card temp = it.next();\n if (temp instanceof WildDrawCard || temp instanceof ColorChangeCard) {\n return true;\n }\n }\n return false;\n }", "private boolean canPlay(UnoCard topCard, UnoCard newCard) {\n\n\t\t// Color or value matches\n\t\tif (topCard.getColor().equals(newCard.getColor())\n\t\t\t\t|| topCard.getValue().equals(newCard.getValue()))\n\t\t\treturn true;\n\t\t// if chosen wild card color matches\n\t\telse if (topCard instanceof WildCard)\n\t\t\treturn ((WildCard) topCard).getWildColor().equals(newCard.getColor());\n\n\t\t// suppose the new card is a wild card\n\t\telse if (newCard instanceof WildCard)\n\t\t\treturn true;\n\n\t\t// else\n\t\treturn false;\n\t}", "public abstract boolean isPlayer();", "@Test\n public void testCardSelectionIsValid_TRUE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n }", "boolean hasAlreadShowCard();", "private void playThisCard(UnoCard clickedCard) throws NotYourTurnException, InvalidMoveException {\n\t\t// Check player's turn\n\t\tif (!isHisTurn(clickedCard)) {\n\t\t\tthrow new NotYourTurnException();\n\t\t} else {\n\n\t\t\t// Card validation\n\t\t\tif (isValidMove(clickedCard)) {\n\n\t\t\t\tplayedCards().add(clickedCard);\n\n\t\t\t\tremovePlayedCard(clickedCard);\n\n\t\t\t\t// function cards ??\n if (clickedCard instanceof ActionCard) {\n performAction(clickedCard);\n\n }\n\n\t\t\t\tfor (GameListener listener : gameListeners) {\n\t\t\t\t\tlistener.cardPlayed(clickedCard);\n\t\t\t\t}\n\n\t\t\t\tcheckResults();\n\t\t\t} else {\n\t\t\t\tthrow new InvalidMoveException();\n\n\t\t\t}\n\t\t}\n\t}", "@Test\n void play_BranchThree()\n {\n dealer = 21;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(dealer, result);\n }", "@Test \n public void testDetectPlayer(){\n assertTrue(controller.detect());\n }", "boolean CanBuyDevCard();", "public boolean playCard(Card card, Enemy enemy){\n if( isGameOver() )return false;\n if( card.isHasTarget() && !enemyController.hasEnemy(enemy) )return false;\n\n System.out.println(\"IN PLAYCARD METHOD\");\n boolean b = effectHandler.playCard( card , enemy);\n System.out.println( \"HAND CARDS : \");\n for( int i = 0 ; i < piles.getHandPile().getCards().size() ; i++ ){\n System.out.println( piles.getHandPile().getCards().get(i).getName() );\n }\n\n return b;\n }", "static boolean playBlackjack() {\n\n Deck mazo; // Un mazo de cartas. Una nueva baraja para cada juego.\n BlackjackHand manoRepartidor; // La mano del repartidor.\n BlackjackHand manoUsuario; // La mano del usuario.\n \n mazo = new Deck();\n manoRepartidor = new BlackjackHand();\n manoUsuario = new BlackjackHand();\n\n // Baraja el mazo, luego reparte dos cartas a cada jugador.\n \n mazo.barajar();\n manoRepartidor.agregarCarta( mazo.cartaReparto());\n manoRepartidor.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n \n System.out.println();\n System.out.println();\n \n /* Marque si uno de los jugadores tiene Blackjack (dos cartas con un total de 21).\n El jugador con Blackjack gana el juego. El repartidor gana empates.\n */\n \n if (manoRepartidor.obtenerValorBlackjack() == 21) {\n String m=\"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"El repartidor tiene Blackjack. El repartidor gana.\";\n JOptionPane.showMessageDialog(null, m);\n \n return false;\n }\n \n if (manoUsuario.obtenerValorBlackjack() == 21) {\n String m1 = \"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"Tienes Blackjack. Tú ganas.\";\n JOptionPane.showMessageDialog(null, m1);\n return true;\n }\n \n /* Si ninguno de los dos jugadores tiene Blackjack, juega el juego. Primero el usuario \n tiene la oportunidad de robar cartas (es decir,\"Golpear\"). El bucle while termina \n cuando el usuario elige \"Stand\". Si el usuario supera los 21,\n el usuario pierde inmediatamente.\n */\n \n while (true) {\n \n /* Muestra las cartas de los usuarios y deja que el usuario decida si golpea o se para. */\n\n System.out.println();\n System.out.println();\n System.out.println();\n String aux1=\"\";\n for ( int i = 0; i < manoUsuario.obtenerConteoCartas(); i++ ){\n aux1=aux1+\" \"+manoUsuario.obtenerCarta(i)+\"\\n\";\n }\n JOptionPane.showMessageDialog(null, \"Tus cartas son: \\n\" \n + aux1+\"\\n\"\n + \"Su total es \" + manoUsuario.obtenerValorBlackjack()+\"\\n\\n\"\n +\"El concesionario está mostrando el \" + manoRepartidor.obtenerCarta(0));\n \n char userAction= JOptionPane.showInputDialog(null,\"¿Pulse (H) o Pararse (S)? \").charAt(0);\n \n // char x = JOptionPane.showInputDialog(null,\"Ingres... el dato\").charAt(0);\n char opcion;\n do {\n opcion=Character.toUpperCase(userAction);\n if (opcion != 'H' && opcion != 'S')\n \n JOptionPane.showMessageDialog(null,\"Por favor responda H o S: \" );\n } while (opcion != 'H' && opcion != 'S');\n\n /* Si el usuario acierta, el usuario recibe una tarjeta. Si el usuario se para, el bucle termina \n (y es el turno de la banca para robar cartas).\n */\n \n if ( opcion == 'S' ) {\n // Termina el bucle; el usuario termina de coger las tarjetas.\n break;\n }\n else { // La accion del usuario es' H'. Dar al usuario una tarjeta. \n // Si el usuario pasa de 21, el usuario pierde.\n Card newCard = mazo.cartaReparto();\n manoUsuario.agregarCarta(newCard);\n \n System.out.println();\n System.out.println();\n System.out.println();\n \n JOptionPane.showMessageDialog(null, \"Aciertos de usuario.\\n\"\n + \"Su carta es el \" + newCard+\"\\n\"\n + \"Su total es ahora \" + manoUsuario.obtenerValorBlackjack());\n if (manoUsuario.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Pasaste por encima de los 21. Tú pierdes.\\n\"\n + \"La otra carta del repartidor era el \" + manoRepartidor.obtenerCarta(1));\n return false; \n }\n }\n \n } // end while loop\n \n /* Si llegamos a este punto, el usuario tiene un nivel Ahora, es\n la oportunidad del traficante de dibujar. El Dealer coge cartas hasta que el dealer\n total es > 16. Si el concesionario pasa de 21, pierde.\n */\n\n \n JOptionPane.showMessageDialog(null, \"Usuario parado.\\n\"\n +\"Las cartas del distribuidor son\\n\"\n +\" \" + manoRepartidor.obtenerCarta(0)+\"\\n\"\n + \" \" + manoRepartidor.obtenerCarta(1));\n while (manoRepartidor.obtenerValorBlackjack() <= 16) {\n Card newCard = mazo.cartaReparto();\n \n JOptionPane.showMessageDialog(null, \"El distribuidor golpea y obtiene el \" + newCard);\n manoRepartidor.agregarCarta(newCard);\n if (manoRepartidor.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Distribuidor detenido por pasar de 21. Usted gana.\");\n return true;\n }\n }\n \n JOptionPane.showMessageDialog(null, \"El total del distribuidor es \" + manoRepartidor.obtenerValorBlackjack());\n /* Si llegamos a este punto, ambos jugadores tienen 21 o menos. \n Podemos determinar el ganador comparando los valores de sus manos. */\n \n System.out.println();\n if (manoRepartidor.obtenerValorBlackjack() == manoUsuario.obtenerValorBlackjack()) {\n JOptionPane.showMessageDialog(null, \"El concesionario gana por empate. Tú pierdes.\");\n \n return false;\n }\n else if (manoRepartidor.obtenerValorBlackjack() > manoUsuario.obtenerValorBlackjack()) {\n \n JOptionPane.showMessageDialog(null, \"El concesionario gana, \" + manoRepartidor.obtenerValorBlackjack() \n + \" puntos para \" + manoUsuario.obtenerValorBlackjack() + \".\");\n return false;\n }\n else {\n \n JOptionPane.showMessageDialog(null, \"Tu ganas, \" + manoUsuario.obtenerValorBlackjack() \n + \" puntos para \" + manoRepartidor.obtenerValorBlackjack() + \".\");\n return true;\n }\n\n }", "public void playCard(ActionCard card, Integer selectedPlayer)\n {\n System.out.println(\"gui: playCard: \" + card + \", selected: \" + selectedPlayer);\n // Guard against this\n if (!isTurn || this.played)\n {\n return;\n }\n \n if(card instanceof PrivateTip || card instanceof Snoop) \n {\n if(selectedPlayer == null) \n {\n JOptionPane.showMessageDialog(null, \"Please select \"\n + \"a player in the \"\n + \"Player Listing (Upper right) that is not yourself!\", \n \"Warning\", \n JOptionPane.ERROR_MESSAGE); \n return;\n }\n }\n\n if (card instanceof Suggestion)\n {\n this.played = true;\n // prompt for solution\n suggestionScreen = new AccusationScreen(this, true, (Suggestion)card);\n suggestionScreen.setVisible(true);\n }\n else\n {\n this.played = clientController.playActionCard(card, selectedPlayer);\n if(!this.played)\n {\n mainGameScreen.notifyUser(\"Play failed: To Play this card,\"\n + \" please select a CluePlayer from the 'Players' list,\"\n + \" then click on this card.\");\n }\n }\n\n }", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Test\r\n\tpublic void testPlayableCards2()\r\n\t{\n\t\t\r\n\t\tCardList clubList = new CardList();\r\n\t\tclubList.add(AllCards.a6C);\r\n\t\tclubList.add(AllCards.aTC);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.CLUBS, null).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tCardList diamondsList = new CardList();\r\n\t\tdiamondsList.add(AllCards.a7D);\r\n\t\tdiamondsList.add(AllCards.aQD);\r\n\t\tdiamondsList.add(AllCards.aKD);\r\n//\t\tassertTrue( h.playableCards(Suit.DIAMONDS, null).toString().equals(diamondsList.toString()));\r\n\t\t\r\n\t\tCardList heartsList = new CardList();\r\n\t\theartsList.add(AllCards.a9H);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.HEARTS, null).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tCardList spadesList = new CardList();\r\n\t\tspadesList.add(AllCards.aTS);\r\n\t\tspadesList.add(AllCards.a7S);\r\n\t\tspadesList.add(AllCards.aJS);\r\n\t\tspadesList.add(AllCards.aKS);\r\n//\t\tassertTrue( h.playableCards(Suit.SPADES, null).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\tCardList joker = new CardList();\t\t\t\r\n\t\tjoker.add(AllCards.aLJo);\t\t\r\n\t\tjoker.add(AllCards.aHJo);\r\n//\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, null).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\t\r\n\t\t// Trump\r\n\t\tclubList.add(AllCards.aJS);\r\n\t\tclubList.add(AllCards.aLJo);\r\n\t\tclubList = clubList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.CLUBS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tdiamondsList.add(AllCards.aLJo);\r\n\t\tdiamondsList = diamondsList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(diamondsList.toString()));\r\n\r\n\t\theartsList = heartsList.sort(new Card.ByRankComparator());\t\t\r\n\t\tassertTrue( h.playableCards(Suit.HEARTS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tspadesList.remove(AllCards.aJS);\r\n\t\tspadesList = spadesList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.SPADES, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\t// no Trump in hand\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\tCardList jackList = new CardList();\r\n\t\tjackList.add(AllCards.aJS);\r\n\t\tjackList.add(AllCards.aJC);\r\n\t\tassertTrue(jackHand.playableCards(Suit.CLUBS, Suit.SPADES).sort(new Card.ByRankComparator()).toString().equals(jackList.toString()));\r\n\t\t\r\n\t}", "private boolean canPut(Player player) {\n boolean haveValidCart = false;\n boolean can = false;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard) || temp instanceof WildCard) {\n haveValidCart = true;\n can = true;\n break;\n }\n }\n if (!haveValidCart) {\n player.addCard(cards.get(0));\n cards.remove(0);\n if (player.getCards().get(player.getCards().size()-1).isValidCard(currentCard)) {\n show();\n System.out.println(player.getName() + \"! You were given a card because you didn't have any valid choice.\");\n can = true;\n }\n else {\n show();\n System.out.println(player.getName() + \"! You were given a card but you don't have any valid choice yet.\");\n }\n }\n return can;\n }", "public boolean playerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(playerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "void playCurrentStationCard();", "@org.junit.Test\n public void test_PlayerWinOfBlackJack(){\n deck.add(new Card(Suit.Club ,10)); //player\n deck.add(new Card(Suit.Diamond, 10)); //dealer\n deck.add(new Card(Suit.Spade, 11)); //player\n deck.add(new Card(Suit.Heart, 8)); //dealer\n deck.add(new Card(Suit.Diamond, 8)); //player\n\n Start start=new Start(player,dealer,deck,table);\n Assert.assertTrue(start.checkBetValidity());\n start.deal();\n Assert.assertTrue(start.checkBlackJack());\n Assert.assertEquals(Status.Players_wins,start.getGameStatus());\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Test\n void play_BranchOne()\n {\n dealer = 22;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(0, result);\n }", "@Override\n\tpublic void onCouldNotPlayCardListener(int position) {\n\n\t}", "@Test\n void play_BranchTwo()\n {\n dealer = 22;\n player = 21;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(player, result);\n }", "private void testHand(List<Card> hand, Card upCard,\n UnoPlayer.Color calledColor, ArrayList<Integer> validPlays, int n)\n {\n int cardPlayed = thePlayer.play(hand, upCard, calledColor,\n new GameState(upCard));\n\n if (!validPlays.contains(new Integer(cardPlayed)))\n {\n String error = printCardError(hand, upCard, calledColor,\n validPlays, cardPlayed);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n UnoPlayer.Color color = thePlayer.callColor(hand);\n\n if (color != UnoPlayer.Color.RED && color != UnoPlayer.Color.BLUE\n && color != UnoPlayer.Color.GREEN\n && color != UnoPlayer.Color.YELLOW)\n {\n String error = printColorError(hand, upCard, calledColor,\n validPlays, color);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n }", "boolean hasAlreadCheckCard();", "public abstract boolean play(DiscardPile discardPile, Stack<Card> drawPile, ArrayList<Player> players);", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest6() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(5, new ArrayList<Card>());\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "boolean CanDiscardCards(Resources resources);", "boolean hasFairplay();", "@Test\n public void testAddCard() {\n d_gameData.getD_playerList().get(1).addCard(GameCard.BLOCKADE);\n assertEquals(true, d_gameData.getD_playerList().get(1).getD_cards().contains(GameCard.BLOCKADE));\n }", "@Test\n public void buyCard() throws Exception {\n model.getTurnTracker().setCurrentTurn(PlayerIndex.FIRST);\n when(devCardFacade.canBuyDevCard(currentPlayer)).thenReturn(true);\n dcc.buyCard();\n verify(devCardFacade, atMost(1)).buyDevCard(currentPlayer);\n }", "@Test\n void play()\n {\n dealer = 21;\n player = 20;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(Math.max(dealer, player), result);\n }", "boolean canBeAdded(ICard toBeAddedCard);", "@Test\n public void buyCardWithNoResources() throws Exception {\n when(devCardFacade.canBuyDevCard(noDevCardsPlayer)).thenReturn(false);\n dcc.buyCard();\n verify(devCardFacade, never()).buyDevCard(noDevCardsPlayer);\n }", "@Test\r\n public void testGetSpecificCard() {\r\n Deck instance = new Deck();\r\n System.out.println(\"Testing getSpecificCard\");\r\n Card result = instance.getSpecificCard(51);\r\n System.out.println('\\t' + \"Card toString: \" + result.toString());\r\n assertNotNull(result);\r\n }", "private static void testPlayer() {\r\n\t\t\tnew AccessChecker(Player.class).pM(\"getName\").pM(\"getMark\").pM(\"toString\").checkAll();\r\n\t\t\tPlayer p = new Player(\"Test\", 'X');\r\n\t\t\tcheckEq(p.getName(), \"Test\", \"Player.getName\");\r\n\t\t\tcheckEq(p.getMark(), 'X', \"Player.getMark\");\r\n\t\t\tcheckEqStr(p, \"Test(X)\", \"Player.toString\");\t\t\r\n\t\t}", "void playMonopolyCard(String resource);", "public boolean computerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(computerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "@Test(suiteName = \"NowPlaying\", testName = \"DMCA Restricted\", description = \"Now Playing - Live - DMCA Restricted - Player controls\", enabled = true, groups = {\n\t\t\t\"MOBANDEVER-227:EVQAAND-307\" })\n\tpublic void dmcaRestrictedPlayerControl() {\n\t\tCommon common = new Common(driver);\n\t\tCommon.log(\"verifying DMCA Restricted - Player controls MOBANDEVER-227\");\n\t\ttry {\n\t\t\tgetPageFactory().getEvehome().clickonMusic();\n\t\t\tcommon.scrollUntilTextExists(\"Dance/Electronic\");\n\t\t\tgetPageFactory().getEvehome().clickMucisSubRock();\n\t\t\tgetPageFactory().getEvehome().popChannel1();\n\t\t\tgetPageFactory().getCategory().nplChnumber();\n\t\t\tgetPageFactory().getEvehome().clickminimize();\n\t\t} catch (AndriodException ex) {\n\t\t\tCommon.errorlog(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t\tAssert.fail(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t}\n\t}", "boolean hasCardType();", "abstract boolean allowedToAdd(Card card);", "@Override\n public boolean canUseCard(){\n return false;\n }", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest4() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(0, g.getDeck());\n }", "public abstract boolean doTurn(Deck theDeck);", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public final void testPlayer2Win() {\n checkPlayerWin(player2);\n }", "public boolean checkRequirements(PlayerBoard playerBoard);", "@Test\n public final void testPlayer1Win() {\n checkPlayerWin(player1);\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\n void checkAmmoResources() {\n ArrayList<Player> array = new ArrayList<>();\n AlphaGame game = new AlphaGame(1, array, false, 5);\n RealPlayer rp = new RealPlayer('b', \"rp\");\n rp.setPlayerPosition(Board.getSpawnpoint('b'));\n array.add(rp);\n char[] cost = new char[3];\n cost[0] = 'b';\n cost[1] = 'r';\n\n assertTrue(rp.checkAmmoResources(cost));\n\n cost[0] = 'b';\n cost[1] = 'b';\n\n assertFalse(rp.checkAmmoResources(cost));\n }", "@Test\n public void testNextCardGood() {\n System.out.println(\"nextCardGood\");\n Deck deck = new Deck();\n Card card = deck.nextCard();\n ////since the deck is unshuffled, that last card should be WILDCARD\n assertEquals(CardType.WILDCARD, card.getValue());\n }", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "public boolean isCard() {\n\t\treturn id > 0 && id < 53;\n\t}", "public abstract boolean isPossible(Player p);", "@Test(expected = Exception.class)\n public void testCardSelectionIsValid_FALSE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n \n }", "private boolean offerCard(Player p) {\n\n //Offer card (take or pass)\n p.sendMessage(\"TAKE OR PASS\");\n\n //Wait until they take the card\n waitForPlayerAction(p, \"TAKE\", \"PASS\");\n\n if(actionChosen.equals(\"TAKE\")) {\n\n giveCard(p);\n return true;\n\n } else if(actionChosen.equals(\"PASS\")) {\n //Don't give card\n\n cList.sendToAll(\"Player \" + p.getUsername() + \" passes\");\n return false;\n }\n\n return false;\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "boolean hasPlayready();" ]
[ "0.7659382", "0.75819266", "0.7412345", "0.7284266", "0.7250692", "0.6787191", "0.6725207", "0.6694125", "0.6676907", "0.6633777", "0.6591471", "0.65719104", "0.65429306", "0.6541443", "0.65411043", "0.65345496", "0.6495341", "0.64626014", "0.64570975", "0.6431492", "0.6426719", "0.6378933", "0.6372066", "0.63294333", "0.63272184", "0.6266896", "0.6262256", "0.6240708", "0.6240149", "0.6146987", "0.61394435", "0.61211514", "0.61171293", "0.6084959", "0.6070099", "0.60580873", "0.6023855", "0.6007266", "0.5989935", "0.5985366", "0.5973349", "0.5960403", "0.5958512", "0.5951363", "0.5950308", "0.5937089", "0.5930786", "0.5907961", "0.5903844", "0.589059", "0.5888103", "0.5866878", "0.58665043", "0.5841053", "0.5824271", "0.5807972", "0.5796643", "0.578707", "0.5780152", "0.57779497", "0.57732564", "0.57704306", "0.57631034", "0.5758579", "0.57483935", "0.5745572", "0.574198", "0.5740751", "0.5723554", "0.5716258", "0.57160014", "0.5713931", "0.5713826", "0.57131183", "0.57119846", "0.57112557", "0.5710174", "0.57070404", "0.5696961", "0.5683724", "0.567602", "0.56705374", "0.5669256", "0.56689835", "0.56651807", "0.5648963", "0.56482226", "0.5645222", "0.5627901", "0.5624333", "0.5620258", "0.5619998", "0.5617427", "0.56077766", "0.5602424", "0.5595697", "0.55876154", "0.5570578", "0.556642", "0.5565973" ]
0.7539191
2
Test of cardCanPlay method, of class utils.
@Test public void testCardCanPlay_FALSE_VALUE() { System.out.println("cardCanPlay FALSE VALUE"); UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE); UnoCardColour wildColour = UnoCardColour.BLUE; boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour); assertEquals(false, result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "@Test\n public void testCardCanPlay_TRUE() {\n System.out.println(\"cardCanPlay TRUE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_TRUE_VALUE() {\n System.out.println(\"cardCanPlay TRUE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE() {\n System.out.println(\"cardCanPlay FALSE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_WILD() {\n System.out.println(\"cardCanPlay WILD\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "boolean isPlayable();", "private boolean isValidPlay(ICard cardToPlay) {\n return cardToPlay.isValidOn(getTopCard());\n }", "boolean hasPlayCardRequest();", "@Override\n\tpublic void playCard() {\n\t\t\n\t}", "@Test\r\n public void testHasAtLeastTwoPlayableCards() {\n Player player2 = new Player(\"Three Playable Cards Test\", true);\r\n Hand threePlayableCardsHand = strategyHand;\r\n player2.setHand(threePlayableCardsHand.getAllCards());\r\n\r\n // Make it harder to find playable cards:\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD, cvm));\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD_DRAW_FOUR, cvm));\r\n\r\n Card currentPlayedCard_1 = new Card(Card.YELLOW, Card.ONE, cvm);\r\n assertTrue(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_1, Card.BLUE));\r\n\r\n Card currentPlayedCard_2 = new Card(Card.BLUE, Card.SEVEN, cvm);\r\n assertFalse(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_2, Card.BLUE));\r\n }", "@Override\r\n\tpublic void playCard() {\n\t\t\r\n\t}", "protected abstract boolean isCardActivatable(Card card);", "public boolean checkPlays(Player player){\n return true;\n }", "void playMonumentCard();", "@Test\n public void testPlay1()\n {\n List<Card> hand = new ArrayList<Card>();\n hand.add(new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 4));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.NUMBER, 7));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.REVERSE, -1));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.NUMBER, 2));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.SKIP, -1));\n hand.add(new Card(UnoPlayer.Color.NONE, UnoPlayer.Rank.WILD, -1));\n\n Card upCard = new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 7);\n int cardPlayed = thePlayer.play(hand, upCard, UnoPlayer.Color.RED, new\n GameState(upCard));\n\n // Let's see whether the card played was legit.\n assertTrue(\"Player didn't think a card could be played.\\nThis is an \"\n + \"error, since cards 0, 1, and 5 are legal plays.\",\n cardPlayed >= 0);\n assertTrue(\"Player tried to play \" + hand.get(cardPlayed)\n + \", which is an error.\", cardPlayed == 0 || cardPlayed == 1\n || cardPlayed == 5);\n System.out.println(\"Player played \" + hand.get(cardPlayed));\n }", "@Override\n public boolean anotherPlayIsPossible()\n {\n \t\n List<Integer> test = cardIndexes();\n return containsSum13(test) || containsK(test);\n \n }", "public void playCard(int player, int card) {\n }", "public void testGetCard() {\n System.out.println(\"getCard\");\n Card expResult = new Card(Rank.QUEEN, Suit.SPADES);\n Play instance = new Play(\"Player1\", expResult);\n Card result = instance.getCard();\n assertEquals(expResult, result);\n }", "public boolean canUseCard(Card card) {\r\n\t\tif (card.cardColor.contains(CardColor.GREEN)\r\n\t\t\t\t|| card.cardColor.contains(CardColor.GREY)) {\r\n\t\t\treturn false;\r\n\t\t} else if (this.blackTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.PURPLE)\r\n\t\t\t\t&& this.purpleTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.RED) && this.redTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BLUE)\r\n\t\t\t\t&& this.blueTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BROWN)\r\n\t\t\t\t&& this.brownTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "public boolean playCard(Card card){\n boolean b = effectHandler.playCard( card , null);\n return b;\n }", "boolean isPlayableInGame();", "@Test(expected = NotPlayingException.class)\n public void not_allow_picking_cards_if_not_playing(){\n\n Deck deck = new Deck();\n Game game = new Game(deck);\n\n game.join(\"susan\");\n\n game.pickCard(\"susan\");\n }", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test(expected = DoesNotOwnException.class)\n\tpublic void cannotPlayDevCardTest() throws DoesNotOwnException, CannotPlayException\n\t{\n\t\tp.playDevelopmentCard(c, game.getBank());\n\t}", "@Test\n public void receiveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0, 0);\n x.receiveCard(4, 4);\n assertTrue(x.getCards().get(4) == 4);\n }", "boolean hasPlaySingleCardResponse();", "@Override\r\n\tpublic void playMonumentCard() {\n\t\t\r\n\t}", "@Test\n public void playMonopolyCard() throws Exception {\n ResourceType type = ResourceType.ORE;\n when(devCardFacade.canUseMonopolyCard(noDevCardsPlayer, type)).thenReturn(false);\n dcc.playMonopolyCard(type);\n verify(devCardFacade, never()).useMonopolyCard(noDevCardsPlayer, type);\n //Player 1; has devCards\n when(devCardFacade.canUseMonopolyCard(currentPlayer, type)).thenReturn(true);\n dcc.playMonopolyCard(type);\n }", "public void testGetIsPlayable()\n {\n assertEquals(b1.getIsPlayable(), false);\n b1.setIsPlayable(true);\n assertEquals(b1.getIsPlayable(), true);\n }", "protected abstract boolean isPlayerActivatable(PlayerSimple player);", "@Test\n public void giveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(5,3);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 3);\n }", "public abstract CardAction play(Player p);", "@Test\n public void startPlayTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n int players = 4;\n int current = 0;\n g.startPlay(players, deck);\n for (Card c : deck) {\n assertTrue(g.getPlayers().get(current).contains(c));\n current++;\n if (current == players) {\n current = 0;\n }\n }\n }", "public Card PlayCard() {\n\t Card ret = null;\n\t Card card;\n\t if (mCardCount > 0) {\n\t\t // To work out what card to play, see what cards can be played\n\t\t \tCard[] playableCards;\n\t\t \tplayableCards = mRules.GetPlayableCards();\n\t\t \tCard[] selectedCards;\n\t\t \tselectedCards = new Card[8];\n\t\t \tint iNumSelectableCards = 0;\n\t\t \tfor (int i = 0; i < 8; i++)\n\t\t \t\tselectedCards[i] = null;\n\t \tfor (int i = 0; i < mCardCount; i++){\n\t \t\tcard = mCard[i];\n\t \t\tswitch (card.GetSuit()){\n\t \t\tcase Card.HEARTS:\n\t \t\t\t\n\t \t\t\t// Card is a heart, can it be played?\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t// and must be played first\n\t \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n\t \n\t \t\t\t\treturn card;\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()-1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\tcase Card.DIAMONDS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.CLUBS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.SPADES:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\tbreak;\n\n\t \t\t\t\t \t\t\t\n\t \t\t}\n\t\n\t \t}\t\n\t \t\n\t \t// Now go through the selectable cards and see which is best to be played\n\t \tif (iNumSelectableCards == 0)\n\t \t\treturn ret;\n\t \t\n\t \tint iPos;\n\t \tcard = null;\n\t \tif (iNumSelectableCards == 1){\n\t\t\t \tfor (int i = 0; i < 8; i++)\n\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t \t\t\tcard = selectedCards[i];\n\t\t\t \t\t\tbreak;\n\t\t\t \t\t}\n\t\t\t \t\t\t \t\n\t \t}\n\t \telse {\n\t\t\t String sDifficulty = mRules.mView.GetSettings().getString(\"Difficulty\", \"0\");// 0 = hard, 1 = easy\n\t\t\t int iDifficulty = Integer.parseInt(sDifficulty);\n\t\t\t if (iDifficulty == EASY){\n\t\t\t \t// Get a random card from the playable ones\n\t\t\t\t\t Random generator = new Random();\n\t\t\t\t\t int randomIndex = generator.nextInt( iNumSelectableCards );\n\t\t\t\t\t int iCount = 0;\n\t\t\t\t\t \tfor (int i = 0; i < 8; i++){\n\t\t\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t\t\t \t\t\tif (iCount == randomIndex){\n\t\t\t\t\t \t\t\t\tcard = selectedCards[i];\n\t\t\t\t\t \t\t\t\tbreak;\n\t\t\t\t\t \t\t\t}\n\t\t\t\t\t \t\t\telse iCount++;\n\t\t\t\t\t \t\t}\t\n\t\t\t\t\t \t}\n\t\t\t }\n\t\t\t else {\n\t\t\t \tiPos = GetBestCard(selectedCards);\n\t\t\t \tcard = selectedCards[iPos];\n\t\t\t }\n\t \t}\n\t \t\n\t \tswitch (card.GetSuit()){\n \t\tcase Card.HEARTS:\t \t\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\t// and must be played first\n \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n \n \t\t\t\treturn card;\n \t\t\t}\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n \t\t\t\t\tplayableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\tcase Card.DIAMONDS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(8,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(6,Card.DIAMONDS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(card.GetValue()-1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(card.GetValue()+1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\t\t\n \t\tcase Card.CLUBS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(8,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.CLUBS6] = new Card(6,Card.CLUBS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n \t\t\t\t\tplayableCards[Rules.CLUBS6] = new Card(card.GetValue()-1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n \t\t\t\t\tLog.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.CLUBS);\n \t\t\t\t\tplayableCards[Rules.CLUBS8] = new Card(card.GetValue()+1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\tbreak; \n \t\tcase Card.SPADES:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(8,Card.SPADES);\n\t \t\t\t\tplayableCards[Rules.SPADES6] = new Card(6,Card.SPADES);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES6] = new Card(card.GetValue()-1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES8] = new Card(card.GetValue()+1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\tbreak;\n \t\t\t\n\t \t}\n\t \n\t }\n\t return ret;\n }", "@Test\n public void giveCard2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 0);\n }", "boolean play();", "@Test\n public void checkBook2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n boolean gotBook = x.checkBook();\n assertTrue(!gotBook);\n }", "@Override\r\n\tpublic boolean canPlay() {\n\t\treturn false;\r\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "protected boolean canPlay(Board gameBoard) {\n if (canPlayWithoutWild(gameBoard)) {\n return true;\n }\n Iterator<Card> it = myCards.iterator();\n while (it.hasNext()) { // check if the player has wild card\n Card temp = it.next();\n if (temp instanceof WildDrawCard || temp instanceof ColorChangeCard) {\n return true;\n }\n }\n return false;\n }", "private boolean canPlay(UnoCard topCard, UnoCard newCard) {\n\n\t\t// Color or value matches\n\t\tif (topCard.getColor().equals(newCard.getColor())\n\t\t\t\t|| topCard.getValue().equals(newCard.getValue()))\n\t\t\treturn true;\n\t\t// if chosen wild card color matches\n\t\telse if (topCard instanceof WildCard)\n\t\t\treturn ((WildCard) topCard).getWildColor().equals(newCard.getColor());\n\n\t\t// suppose the new card is a wild card\n\t\telse if (newCard instanceof WildCard)\n\t\t\treturn true;\n\n\t\t// else\n\t\treturn false;\n\t}", "public abstract boolean isPlayer();", "@Test\n public void testCardSelectionIsValid_TRUE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n }", "boolean hasAlreadShowCard();", "private void playThisCard(UnoCard clickedCard) throws NotYourTurnException, InvalidMoveException {\n\t\t// Check player's turn\n\t\tif (!isHisTurn(clickedCard)) {\n\t\t\tthrow new NotYourTurnException();\n\t\t} else {\n\n\t\t\t// Card validation\n\t\t\tif (isValidMove(clickedCard)) {\n\n\t\t\t\tplayedCards().add(clickedCard);\n\n\t\t\t\tremovePlayedCard(clickedCard);\n\n\t\t\t\t// function cards ??\n if (clickedCard instanceof ActionCard) {\n performAction(clickedCard);\n\n }\n\n\t\t\t\tfor (GameListener listener : gameListeners) {\n\t\t\t\t\tlistener.cardPlayed(clickedCard);\n\t\t\t\t}\n\n\t\t\t\tcheckResults();\n\t\t\t} else {\n\t\t\t\tthrow new InvalidMoveException();\n\n\t\t\t}\n\t\t}\n\t}", "@Test\n void play_BranchThree()\n {\n dealer = 21;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(dealer, result);\n }", "@Test \n public void testDetectPlayer(){\n assertTrue(controller.detect());\n }", "boolean CanBuyDevCard();", "public boolean playCard(Card card, Enemy enemy){\n if( isGameOver() )return false;\n if( card.isHasTarget() && !enemyController.hasEnemy(enemy) )return false;\n\n System.out.println(\"IN PLAYCARD METHOD\");\n boolean b = effectHandler.playCard( card , enemy);\n System.out.println( \"HAND CARDS : \");\n for( int i = 0 ; i < piles.getHandPile().getCards().size() ; i++ ){\n System.out.println( piles.getHandPile().getCards().get(i).getName() );\n }\n\n return b;\n }", "static boolean playBlackjack() {\n\n Deck mazo; // Un mazo de cartas. Una nueva baraja para cada juego.\n BlackjackHand manoRepartidor; // La mano del repartidor.\n BlackjackHand manoUsuario; // La mano del usuario.\n \n mazo = new Deck();\n manoRepartidor = new BlackjackHand();\n manoUsuario = new BlackjackHand();\n\n // Baraja el mazo, luego reparte dos cartas a cada jugador.\n \n mazo.barajar();\n manoRepartidor.agregarCarta( mazo.cartaReparto());\n manoRepartidor.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n \n System.out.println();\n System.out.println();\n \n /* Marque si uno de los jugadores tiene Blackjack (dos cartas con un total de 21).\n El jugador con Blackjack gana el juego. El repartidor gana empates.\n */\n \n if (manoRepartidor.obtenerValorBlackjack() == 21) {\n String m=\"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"El repartidor tiene Blackjack. El repartidor gana.\";\n JOptionPane.showMessageDialog(null, m);\n \n return false;\n }\n \n if (manoUsuario.obtenerValorBlackjack() == 21) {\n String m1 = \"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"Tienes Blackjack. Tú ganas.\";\n JOptionPane.showMessageDialog(null, m1);\n return true;\n }\n \n /* Si ninguno de los dos jugadores tiene Blackjack, juega el juego. Primero el usuario \n tiene la oportunidad de robar cartas (es decir,\"Golpear\"). El bucle while termina \n cuando el usuario elige \"Stand\". Si el usuario supera los 21,\n el usuario pierde inmediatamente.\n */\n \n while (true) {\n \n /* Muestra las cartas de los usuarios y deja que el usuario decida si golpea o se para. */\n\n System.out.println();\n System.out.println();\n System.out.println();\n String aux1=\"\";\n for ( int i = 0; i < manoUsuario.obtenerConteoCartas(); i++ ){\n aux1=aux1+\" \"+manoUsuario.obtenerCarta(i)+\"\\n\";\n }\n JOptionPane.showMessageDialog(null, \"Tus cartas son: \\n\" \n + aux1+\"\\n\"\n + \"Su total es \" + manoUsuario.obtenerValorBlackjack()+\"\\n\\n\"\n +\"El concesionario está mostrando el \" + manoRepartidor.obtenerCarta(0));\n \n char userAction= JOptionPane.showInputDialog(null,\"¿Pulse (H) o Pararse (S)? \").charAt(0);\n \n // char x = JOptionPane.showInputDialog(null,\"Ingres... el dato\").charAt(0);\n char opcion;\n do {\n opcion=Character.toUpperCase(userAction);\n if (opcion != 'H' && opcion != 'S')\n \n JOptionPane.showMessageDialog(null,\"Por favor responda H o S: \" );\n } while (opcion != 'H' && opcion != 'S');\n\n /* Si el usuario acierta, el usuario recibe una tarjeta. Si el usuario se para, el bucle termina \n (y es el turno de la banca para robar cartas).\n */\n \n if ( opcion == 'S' ) {\n // Termina el bucle; el usuario termina de coger las tarjetas.\n break;\n }\n else { // La accion del usuario es' H'. Dar al usuario una tarjeta. \n // Si el usuario pasa de 21, el usuario pierde.\n Card newCard = mazo.cartaReparto();\n manoUsuario.agregarCarta(newCard);\n \n System.out.println();\n System.out.println();\n System.out.println();\n \n JOptionPane.showMessageDialog(null, \"Aciertos de usuario.\\n\"\n + \"Su carta es el \" + newCard+\"\\n\"\n + \"Su total es ahora \" + manoUsuario.obtenerValorBlackjack());\n if (manoUsuario.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Pasaste por encima de los 21. Tú pierdes.\\n\"\n + \"La otra carta del repartidor era el \" + manoRepartidor.obtenerCarta(1));\n return false; \n }\n }\n \n } // end while loop\n \n /* Si llegamos a este punto, el usuario tiene un nivel Ahora, es\n la oportunidad del traficante de dibujar. El Dealer coge cartas hasta que el dealer\n total es > 16. Si el concesionario pasa de 21, pierde.\n */\n\n \n JOptionPane.showMessageDialog(null, \"Usuario parado.\\n\"\n +\"Las cartas del distribuidor son\\n\"\n +\" \" + manoRepartidor.obtenerCarta(0)+\"\\n\"\n + \" \" + manoRepartidor.obtenerCarta(1));\n while (manoRepartidor.obtenerValorBlackjack() <= 16) {\n Card newCard = mazo.cartaReparto();\n \n JOptionPane.showMessageDialog(null, \"El distribuidor golpea y obtiene el \" + newCard);\n manoRepartidor.agregarCarta(newCard);\n if (manoRepartidor.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Distribuidor detenido por pasar de 21. Usted gana.\");\n return true;\n }\n }\n \n JOptionPane.showMessageDialog(null, \"El total del distribuidor es \" + manoRepartidor.obtenerValorBlackjack());\n /* Si llegamos a este punto, ambos jugadores tienen 21 o menos. \n Podemos determinar el ganador comparando los valores de sus manos. */\n \n System.out.println();\n if (manoRepartidor.obtenerValorBlackjack() == manoUsuario.obtenerValorBlackjack()) {\n JOptionPane.showMessageDialog(null, \"El concesionario gana por empate. Tú pierdes.\");\n \n return false;\n }\n else if (manoRepartidor.obtenerValorBlackjack() > manoUsuario.obtenerValorBlackjack()) {\n \n JOptionPane.showMessageDialog(null, \"El concesionario gana, \" + manoRepartidor.obtenerValorBlackjack() \n + \" puntos para \" + manoUsuario.obtenerValorBlackjack() + \".\");\n return false;\n }\n else {\n \n JOptionPane.showMessageDialog(null, \"Tu ganas, \" + manoUsuario.obtenerValorBlackjack() \n + \" puntos para \" + manoRepartidor.obtenerValorBlackjack() + \".\");\n return true;\n }\n\n }", "public void playCard(ActionCard card, Integer selectedPlayer)\n {\n System.out.println(\"gui: playCard: \" + card + \", selected: \" + selectedPlayer);\n // Guard against this\n if (!isTurn || this.played)\n {\n return;\n }\n \n if(card instanceof PrivateTip || card instanceof Snoop) \n {\n if(selectedPlayer == null) \n {\n JOptionPane.showMessageDialog(null, \"Please select \"\n + \"a player in the \"\n + \"Player Listing (Upper right) that is not yourself!\", \n \"Warning\", \n JOptionPane.ERROR_MESSAGE); \n return;\n }\n }\n\n if (card instanceof Suggestion)\n {\n this.played = true;\n // prompt for solution\n suggestionScreen = new AccusationScreen(this, true, (Suggestion)card);\n suggestionScreen.setVisible(true);\n }\n else\n {\n this.played = clientController.playActionCard(card, selectedPlayer);\n if(!this.played)\n {\n mainGameScreen.notifyUser(\"Play failed: To Play this card,\"\n + \" please select a CluePlayer from the 'Players' list,\"\n + \" then click on this card.\");\n }\n }\n\n }", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Test\r\n\tpublic void testPlayableCards2()\r\n\t{\n\t\t\r\n\t\tCardList clubList = new CardList();\r\n\t\tclubList.add(AllCards.a6C);\r\n\t\tclubList.add(AllCards.aTC);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.CLUBS, null).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tCardList diamondsList = new CardList();\r\n\t\tdiamondsList.add(AllCards.a7D);\r\n\t\tdiamondsList.add(AllCards.aQD);\r\n\t\tdiamondsList.add(AllCards.aKD);\r\n//\t\tassertTrue( h.playableCards(Suit.DIAMONDS, null).toString().equals(diamondsList.toString()));\r\n\t\t\r\n\t\tCardList heartsList = new CardList();\r\n\t\theartsList.add(AllCards.a9H);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.HEARTS, null).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tCardList spadesList = new CardList();\r\n\t\tspadesList.add(AllCards.aTS);\r\n\t\tspadesList.add(AllCards.a7S);\r\n\t\tspadesList.add(AllCards.aJS);\r\n\t\tspadesList.add(AllCards.aKS);\r\n//\t\tassertTrue( h.playableCards(Suit.SPADES, null).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\tCardList joker = new CardList();\t\t\t\r\n\t\tjoker.add(AllCards.aLJo);\t\t\r\n\t\tjoker.add(AllCards.aHJo);\r\n//\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, null).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\t\r\n\t\t// Trump\r\n\t\tclubList.add(AllCards.aJS);\r\n\t\tclubList.add(AllCards.aLJo);\r\n\t\tclubList = clubList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.CLUBS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tdiamondsList.add(AllCards.aLJo);\r\n\t\tdiamondsList = diamondsList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(diamondsList.toString()));\r\n\r\n\t\theartsList = heartsList.sort(new Card.ByRankComparator());\t\t\r\n\t\tassertTrue( h.playableCards(Suit.HEARTS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tspadesList.remove(AllCards.aJS);\r\n\t\tspadesList = spadesList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.SPADES, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\t// no Trump in hand\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\tCardList jackList = new CardList();\r\n\t\tjackList.add(AllCards.aJS);\r\n\t\tjackList.add(AllCards.aJC);\r\n\t\tassertTrue(jackHand.playableCards(Suit.CLUBS, Suit.SPADES).sort(new Card.ByRankComparator()).toString().equals(jackList.toString()));\r\n\t\t\r\n\t}", "private boolean canPut(Player player) {\n boolean haveValidCart = false;\n boolean can = false;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard) || temp instanceof WildCard) {\n haveValidCart = true;\n can = true;\n break;\n }\n }\n if (!haveValidCart) {\n player.addCard(cards.get(0));\n cards.remove(0);\n if (player.getCards().get(player.getCards().size()-1).isValidCard(currentCard)) {\n show();\n System.out.println(player.getName() + \"! You were given a card because you didn't have any valid choice.\");\n can = true;\n }\n else {\n show();\n System.out.println(player.getName() + \"! You were given a card but you don't have any valid choice yet.\");\n }\n }\n return can;\n }", "public boolean playerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(playerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "void playCurrentStationCard();", "@org.junit.Test\n public void test_PlayerWinOfBlackJack(){\n deck.add(new Card(Suit.Club ,10)); //player\n deck.add(new Card(Suit.Diamond, 10)); //dealer\n deck.add(new Card(Suit.Spade, 11)); //player\n deck.add(new Card(Suit.Heart, 8)); //dealer\n deck.add(new Card(Suit.Diamond, 8)); //player\n\n Start start=new Start(player,dealer,deck,table);\n Assert.assertTrue(start.checkBetValidity());\n start.deal();\n Assert.assertTrue(start.checkBlackJack());\n Assert.assertEquals(Status.Players_wins,start.getGameStatus());\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Test\n void play_BranchOne()\n {\n dealer = 22;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(0, result);\n }", "@Override\n\tpublic void onCouldNotPlayCardListener(int position) {\n\n\t}", "@Test\n void play_BranchTwo()\n {\n dealer = 22;\n player = 21;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(player, result);\n }", "private void testHand(List<Card> hand, Card upCard,\n UnoPlayer.Color calledColor, ArrayList<Integer> validPlays, int n)\n {\n int cardPlayed = thePlayer.play(hand, upCard, calledColor,\n new GameState(upCard));\n\n if (!validPlays.contains(new Integer(cardPlayed)))\n {\n String error = printCardError(hand, upCard, calledColor,\n validPlays, cardPlayed);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n UnoPlayer.Color color = thePlayer.callColor(hand);\n\n if (color != UnoPlayer.Color.RED && color != UnoPlayer.Color.BLUE\n && color != UnoPlayer.Color.GREEN\n && color != UnoPlayer.Color.YELLOW)\n {\n String error = printColorError(hand, upCard, calledColor,\n validPlays, color);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n }", "boolean hasAlreadCheckCard();", "public abstract boolean play(DiscardPile discardPile, Stack<Card> drawPile, ArrayList<Player> players);", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest6() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(5, new ArrayList<Card>());\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "boolean CanDiscardCards(Resources resources);", "boolean hasFairplay();", "@Test\n public void testAddCard() {\n d_gameData.getD_playerList().get(1).addCard(GameCard.BLOCKADE);\n assertEquals(true, d_gameData.getD_playerList().get(1).getD_cards().contains(GameCard.BLOCKADE));\n }", "@Test\n public void buyCard() throws Exception {\n model.getTurnTracker().setCurrentTurn(PlayerIndex.FIRST);\n when(devCardFacade.canBuyDevCard(currentPlayer)).thenReturn(true);\n dcc.buyCard();\n verify(devCardFacade, atMost(1)).buyDevCard(currentPlayer);\n }", "@Test\n void play()\n {\n dealer = 21;\n player = 20;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(Math.max(dealer, player), result);\n }", "boolean canBeAdded(ICard toBeAddedCard);", "@Test\n public void buyCardWithNoResources() throws Exception {\n when(devCardFacade.canBuyDevCard(noDevCardsPlayer)).thenReturn(false);\n dcc.buyCard();\n verify(devCardFacade, never()).buyDevCard(noDevCardsPlayer);\n }", "@Test\r\n public void testGetSpecificCard() {\r\n Deck instance = new Deck();\r\n System.out.println(\"Testing getSpecificCard\");\r\n Card result = instance.getSpecificCard(51);\r\n System.out.println('\\t' + \"Card toString: \" + result.toString());\r\n assertNotNull(result);\r\n }", "private static void testPlayer() {\r\n\t\t\tnew AccessChecker(Player.class).pM(\"getName\").pM(\"getMark\").pM(\"toString\").checkAll();\r\n\t\t\tPlayer p = new Player(\"Test\", 'X');\r\n\t\t\tcheckEq(p.getName(), \"Test\", \"Player.getName\");\r\n\t\t\tcheckEq(p.getMark(), 'X', \"Player.getMark\");\r\n\t\t\tcheckEqStr(p, \"Test(X)\", \"Player.toString\");\t\t\r\n\t\t}", "void playMonopolyCard(String resource);", "public boolean computerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(computerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "@Test(suiteName = \"NowPlaying\", testName = \"DMCA Restricted\", description = \"Now Playing - Live - DMCA Restricted - Player controls\", enabled = true, groups = {\n\t\t\t\"MOBANDEVER-227:EVQAAND-307\" })\n\tpublic void dmcaRestrictedPlayerControl() {\n\t\tCommon common = new Common(driver);\n\t\tCommon.log(\"verifying DMCA Restricted - Player controls MOBANDEVER-227\");\n\t\ttry {\n\t\t\tgetPageFactory().getEvehome().clickonMusic();\n\t\t\tcommon.scrollUntilTextExists(\"Dance/Electronic\");\n\t\t\tgetPageFactory().getEvehome().clickMucisSubRock();\n\t\t\tgetPageFactory().getEvehome().popChannel1();\n\t\t\tgetPageFactory().getCategory().nplChnumber();\n\t\t\tgetPageFactory().getEvehome().clickminimize();\n\t\t} catch (AndriodException ex) {\n\t\t\tCommon.errorlog(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t\tAssert.fail(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t}\n\t}", "boolean hasCardType();", "abstract boolean allowedToAdd(Card card);", "@Override\n public boolean canUseCard(){\n return false;\n }", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest4() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(0, g.getDeck());\n }", "public abstract boolean doTurn(Deck theDeck);", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public final void testPlayer2Win() {\n checkPlayerWin(player2);\n }", "public boolean checkRequirements(PlayerBoard playerBoard);", "@Test\n public final void testPlayer1Win() {\n checkPlayerWin(player1);\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\n void checkAmmoResources() {\n ArrayList<Player> array = new ArrayList<>();\n AlphaGame game = new AlphaGame(1, array, false, 5);\n RealPlayer rp = new RealPlayer('b', \"rp\");\n rp.setPlayerPosition(Board.getSpawnpoint('b'));\n array.add(rp);\n char[] cost = new char[3];\n cost[0] = 'b';\n cost[1] = 'r';\n\n assertTrue(rp.checkAmmoResources(cost));\n\n cost[0] = 'b';\n cost[1] = 'b';\n\n assertFalse(rp.checkAmmoResources(cost));\n }", "@Test\n public void testNextCardGood() {\n System.out.println(\"nextCardGood\");\n Deck deck = new Deck();\n Card card = deck.nextCard();\n ////since the deck is unshuffled, that last card should be WILDCARD\n assertEquals(CardType.WILDCARD, card.getValue());\n }", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "public boolean isCard() {\n\t\treturn id > 0 && id < 53;\n\t}", "public abstract boolean isPossible(Player p);", "@Test(expected = Exception.class)\n public void testCardSelectionIsValid_FALSE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n \n }", "private boolean offerCard(Player p) {\n\n //Offer card (take or pass)\n p.sendMessage(\"TAKE OR PASS\");\n\n //Wait until they take the card\n waitForPlayerAction(p, \"TAKE\", \"PASS\");\n\n if(actionChosen.equals(\"TAKE\")) {\n\n giveCard(p);\n return true;\n\n } else if(actionChosen.equals(\"PASS\")) {\n //Don't give card\n\n cList.sendToAll(\"Player \" + p.getUsername() + \" passes\");\n return false;\n }\n\n return false;\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "boolean hasPlayready();" ]
[ "0.7659382", "0.75819266", "0.7539191", "0.7412345", "0.7250692", "0.6787191", "0.6725207", "0.6694125", "0.6676907", "0.6633777", "0.6591471", "0.65719104", "0.65429306", "0.6541443", "0.65411043", "0.65345496", "0.6495341", "0.64626014", "0.64570975", "0.6431492", "0.6426719", "0.6378933", "0.6372066", "0.63294333", "0.63272184", "0.6266896", "0.6262256", "0.6240708", "0.6240149", "0.6146987", "0.61394435", "0.61211514", "0.61171293", "0.6084959", "0.6070099", "0.60580873", "0.6023855", "0.6007266", "0.5989935", "0.5985366", "0.5973349", "0.5960403", "0.5958512", "0.5951363", "0.5950308", "0.5937089", "0.5930786", "0.5907961", "0.5903844", "0.589059", "0.5888103", "0.5866878", "0.58665043", "0.5841053", "0.5824271", "0.5807972", "0.5796643", "0.578707", "0.5780152", "0.57779497", "0.57732564", "0.57704306", "0.57631034", "0.5758579", "0.57483935", "0.5745572", "0.574198", "0.5740751", "0.5723554", "0.5716258", "0.57160014", "0.5713931", "0.5713826", "0.57131183", "0.57119846", "0.57112557", "0.5710174", "0.57070404", "0.5696961", "0.5683724", "0.567602", "0.56705374", "0.5669256", "0.56689835", "0.56651807", "0.5648963", "0.56482226", "0.5645222", "0.5627901", "0.5624333", "0.5620258", "0.5619998", "0.5617427", "0.56077766", "0.5602424", "0.5595697", "0.55876154", "0.5570578", "0.556642", "0.5565973" ]
0.7284266
4
Test of cardCanPlay method, of class utils.
@Test public void testCardCanPlay_WILD() { System.out.println("cardCanPlay WILD"); UnoCard cardSelection = new UnoCard(UnoCardColour.WILD, UnoCardValue.ONE); UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE); UnoCardColour wildColour = UnoCardColour.BLUE; boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour); assertEquals(true, result); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testCanPlayOn() {\n \n DrawCard redDraw2 = new DrawCard(Card.COLOUR_RED, 2);\n \n // create another 4 normal cards\n \n Card card1 = new Card(Card.COLOUR_BLUE, 5);\n Card card2 = new Card(Card.COLOUR_BLUE,2);\n \n //card 1 and card 2 should yield false on the method\n assertFalse(redDraw2.canPlayOn(card1));\n assertFalse(redDraw2.canPlayOn(card2));\n \n Card card3 = new Card(Card.COLOUR_RED, 5);\n Card card4 = new Card(Card.COLOUR_RED,2);\n \n // card 3 and card 4 should gives true\n \n assertTrue(redDraw2.canPlayOn(card3));\n assertTrue(redDraw2.canPlayOn(card4));\n \n }", "@Test\n public void testCardCanPlay_TRUE() {\n System.out.println(\"cardCanPlay TRUE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_TRUE_VALUE() {\n System.out.println(\"cardCanPlay TRUE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(true, result);\n }", "@Test\n public void testCardCanPlay_FALSE() {\n System.out.println(\"cardCanPlay FALSE COLOUR\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "@Test\n public void testCardCanPlay_FALSE_VALUE() {\n System.out.println(\"cardCanPlay FALSE VALUE\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.THREE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n boolean result = utils.cardCanPlay(cardSelection, drawCard, wildColour);\n assertEquals(false, result);\n }", "boolean isPlayable();", "private boolean isValidPlay(ICard cardToPlay) {\n return cardToPlay.isValidOn(getTopCard());\n }", "boolean hasPlayCardRequest();", "@Override\n\tpublic void playCard() {\n\t\t\n\t}", "@Test\r\n public void testHasAtLeastTwoPlayableCards() {\n Player player2 = new Player(\"Three Playable Cards Test\", true);\r\n Hand threePlayableCardsHand = strategyHand;\r\n player2.setHand(threePlayableCardsHand.getAllCards());\r\n\r\n // Make it harder to find playable cards:\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD, cvm));\r\n player2.getHand().discard(new Card(Card.COLORLESS, Card.WILD_DRAW_FOUR, cvm));\r\n\r\n Card currentPlayedCard_1 = new Card(Card.YELLOW, Card.ONE, cvm);\r\n assertTrue(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_1, Card.BLUE));\r\n\r\n Card currentPlayedCard_2 = new Card(Card.BLUE, Card.SEVEN, cvm);\r\n assertFalse(player2.hasAtLeastTwoPlayableCards(currentPlayedCard_2, Card.BLUE));\r\n }", "@Override\r\n\tpublic void playCard() {\n\t\t\r\n\t}", "protected abstract boolean isCardActivatable(Card card);", "public boolean checkPlays(Player player){\n return true;\n }", "void playMonumentCard();", "@Test\n public void testPlay1()\n {\n List<Card> hand = new ArrayList<Card>();\n hand.add(new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 4));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.NUMBER, 7));\n hand.add(new Card(UnoPlayer.Color.GREEN, UnoPlayer.Rank.REVERSE, -1));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.NUMBER, 2));\n hand.add(new Card(UnoPlayer.Color.BLUE, UnoPlayer.Rank.SKIP, -1));\n hand.add(new Card(UnoPlayer.Color.NONE, UnoPlayer.Rank.WILD, -1));\n\n Card upCard = new Card(UnoPlayer.Color.RED, UnoPlayer.Rank.NUMBER, 7);\n int cardPlayed = thePlayer.play(hand, upCard, UnoPlayer.Color.RED, new\n GameState(upCard));\n\n // Let's see whether the card played was legit.\n assertTrue(\"Player didn't think a card could be played.\\nThis is an \"\n + \"error, since cards 0, 1, and 5 are legal plays.\",\n cardPlayed >= 0);\n assertTrue(\"Player tried to play \" + hand.get(cardPlayed)\n + \", which is an error.\", cardPlayed == 0 || cardPlayed == 1\n || cardPlayed == 5);\n System.out.println(\"Player played \" + hand.get(cardPlayed));\n }", "@Override\n public boolean anotherPlayIsPossible()\n {\n \t\n List<Integer> test = cardIndexes();\n return containsSum13(test) || containsK(test);\n \n }", "public void playCard(int player, int card) {\n }", "public void testGetCard() {\n System.out.println(\"getCard\");\n Card expResult = new Card(Rank.QUEEN, Suit.SPADES);\n Play instance = new Play(\"Player1\", expResult);\n Card result = instance.getCard();\n assertEquals(expResult, result);\n }", "public boolean canUseCard(Card card) {\r\n\t\tif (card.cardColor.contains(CardColor.GREEN)\r\n\t\t\t\t|| card.cardColor.contains(CardColor.GREY)) {\r\n\t\t\treturn false;\r\n\t\t} else if (this.blackTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.PURPLE)\r\n\t\t\t\t&& this.purpleTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.RED) && this.redTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BLUE)\r\n\t\t\t\t&& this.blueTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else if (card.cardColor.contains(CardColor.BROWN)\r\n\t\t\t\t&& this.brownTurns > 0) {\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "public boolean playCard(Card card){\n boolean b = effectHandler.playCard( card , null);\n return b;\n }", "boolean isPlayableInGame();", "@Test(expected = NotPlayingException.class)\n public void not_allow_picking_cards_if_not_playing(){\n\n Deck deck = new Deck();\n Game game = new Game(deck);\n\n game.join(\"susan\");\n\n game.pickCard(\"susan\");\n }", "@Test\n public void checkBook() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(3,4);\n boolean gotBook = x.checkBook();\n assertTrue(gotBook);\n }", "public boolean canUseCard() {\n \t\tif (usedCard)\n \t\t\treturn false;\n \n \t\tfor (int i = 0; i < cards.length; i++) {\n \t\t\tif (cards[i] > 0)\n \t\t\t\treturn true;\n \t\t}\n \n \t\treturn false;\n \t}", "@Test(expected = DoesNotOwnException.class)\n\tpublic void cannotPlayDevCardTest() throws DoesNotOwnException, CannotPlayException\n\t{\n\t\tp.playDevelopmentCard(c, game.getBank());\n\t}", "@Test\n public void receiveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0, 0);\n x.receiveCard(4, 4);\n assertTrue(x.getCards().get(4) == 4);\n }", "boolean hasPlaySingleCardResponse();", "@Override\r\n\tpublic void playMonumentCard() {\n\t\t\r\n\t}", "@Test\n public void playMonopolyCard() throws Exception {\n ResourceType type = ResourceType.ORE;\n when(devCardFacade.canUseMonopolyCard(noDevCardsPlayer, type)).thenReturn(false);\n dcc.playMonopolyCard(type);\n verify(devCardFacade, never()).useMonopolyCard(noDevCardsPlayer, type);\n //Player 1; has devCards\n when(devCardFacade.canUseMonopolyCard(currentPlayer, type)).thenReturn(true);\n dcc.playMonopolyCard(type);\n }", "public void testGetIsPlayable()\n {\n assertEquals(b1.getIsPlayable(), false);\n b1.setIsPlayable(true);\n assertEquals(b1.getIsPlayable(), true);\n }", "protected abstract boolean isPlayerActivatable(PlayerSimple player);", "@Test\n public void giveCard() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n x.setCards(5,3);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 3);\n }", "public abstract CardAction play(Player p);", "@Test\n public void startPlayTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n int players = 4;\n int current = 0;\n g.startPlay(players, deck);\n for (Card c : deck) {\n assertTrue(g.getPlayers().get(current).contains(c));\n current++;\n if (current == players) {\n current = 0;\n }\n }\n }", "public Card PlayCard() {\n\t Card ret = null;\n\t Card card;\n\t if (mCardCount > 0) {\n\t\t // To work out what card to play, see what cards can be played\n\t\t \tCard[] playableCards;\n\t\t \tplayableCards = mRules.GetPlayableCards();\n\t\t \tCard[] selectedCards;\n\t\t \tselectedCards = new Card[8];\n\t\t \tint iNumSelectableCards = 0;\n\t\t \tfor (int i = 0; i < 8; i++)\n\t\t \t\tselectedCards[i] = null;\n\t \tfor (int i = 0; i < mCardCount; i++){\n\t \t\tcard = mCard[i];\n\t \t\tswitch (card.GetSuit()){\n\t \t\tcase Card.HEARTS:\n\t \t\t\t\n\t \t\t\t// Card is a heart, can it be played?\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t// and must be played first\n\t \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n\t \n\t \t\t\t\treturn card;\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()-1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){\n\t \t\t\t\t\tselectedCards[Rules.HEARTS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t\t//Log.i(\"\",\" Playing card \" + (card.GetValue()) + \" , \" +card.GetSuit());\n\t \t\t\t\t\t//Log.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.HEARTS);\t \t\t\t\t\t\n\t \t\t\t\t\t//playableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n\t \t\t\t\t\t//return card;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\tcase Card.DIAMONDS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\n\t \t\t\t\t\tselectedCards[Rules.DIAMONDS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.CLUBS:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n\t \t\t\t\t\tselectedCards[Rules.CLUBS8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t\t \t\t\t\n\t \t\t\tbreak;\n\t \t\t\t\n\t \t\tcase Card.SPADES:\n\t \t\t\t// Is it a seven, it can be played...\n\t \t\t\tif (card.GetValue() == 7){\n\t \t\t\t\tif (card.Equals(playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\t \t\t\t\t\n\t \t\t\t}\n\t \t\t\t\n\t \t\t\tif (card.GetValue() < 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES6] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t\tif (card.GetValue() > 7){\n\t \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\n\t \t\t\t\t\tselectedCards[Rules.SPADES8] = card;\n\t \t\t\t\t\tiNumSelectableCards++;\n\t \t\t\t\t}\n\t \t\t\t}\t \t\t\t\n\t \t\t\tbreak;\n\n\t \t\t\t\t \t\t\t\n\t \t\t}\n\t\n\t \t}\t\n\t \t\n\t \t// Now go through the selectable cards and see which is best to be played\n\t \tif (iNumSelectableCards == 0)\n\t \t\treturn ret;\n\t \t\n\t \tint iPos;\n\t \tcard = null;\n\t \tif (iNumSelectableCards == 1){\n\t\t\t \tfor (int i = 0; i < 8; i++)\n\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t \t\t\tcard = selectedCards[i];\n\t\t\t \t\t\tbreak;\n\t\t\t \t\t}\n\t\t\t \t\t\t \t\n\t \t}\n\t \telse {\n\t\t\t String sDifficulty = mRules.mView.GetSettings().getString(\"Difficulty\", \"0\");// 0 = hard, 1 = easy\n\t\t\t int iDifficulty = Integer.parseInt(sDifficulty);\n\t\t\t if (iDifficulty == EASY){\n\t\t\t \t// Get a random card from the playable ones\n\t\t\t\t\t Random generator = new Random();\n\t\t\t\t\t int randomIndex = generator.nextInt( iNumSelectableCards );\n\t\t\t\t\t int iCount = 0;\n\t\t\t\t\t \tfor (int i = 0; i < 8; i++){\n\t\t\t\t\t \t\tif (selectedCards[i] != null){\n\t\t\t\t\t \t\t\tif (iCount == randomIndex){\n\t\t\t\t\t \t\t\t\tcard = selectedCards[i];\n\t\t\t\t\t \t\t\t\tbreak;\n\t\t\t\t\t \t\t\t}\n\t\t\t\t\t \t\t\telse iCount++;\n\t\t\t\t\t \t\t}\t\n\t\t\t\t\t \t}\n\t\t\t }\n\t\t\t else {\n\t\t\t \tiPos = GetBestCard(selectedCards);\n\t\t\t \tcard = selectedCards[iPos];\n\t\t\t }\n\t \t}\n\t \t\n\t \tswitch (card.GetSuit()){\n \t\tcase Card.HEARTS:\t \t\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\t// and must be played first\n \t\t\t\tplayableCards[Rules.HEARTS8] = new Card(8,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.HEARTS6] = new Card(6,Card.HEARTS);\n \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(7,Card.CLUBS);\n \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(7,Card.DIAMONDS);\n \t\t\t\tplayableCards[Rules.SPADES8] = new Card(7,Card.SPADES);\n \n \t\t\t\treturn card;\n \t\t\t}\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.HEARTS6])){\n \t\t\t\t\tplayableCards[Rules.HEARTS6] = new Card(card.GetValue()-1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.HEARTS8])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.HEARTS8] = new Card(card.GetValue()+1,Card.HEARTS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\tcase Card.DIAMONDS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(8,Card.DIAMONDS);\n\t \t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(6,Card.DIAMONDS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS6])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS6] = new Card(card.GetValue()-1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.DIAMONDS8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.DIAMONDS8] = new Card(card.GetValue()+1,Card.DIAMONDS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\t\n \t\t\tbreak; \n \t\t\t\n \t\tcase Card.CLUBS:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.CLUBS8] = new Card(8,Card.CLUBS);\n\t \t\t\t\tplayableCards[Rules.CLUBS6] = new Card(6,Card.CLUBS);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS6])){\n \t\t\t\t\tplayableCards[Rules.CLUBS6] = new Card(card.GetValue()-1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals(playableCards[Rules.CLUBS8])){\n \t\t\t\t\tLog.i(\"\",\" Updating playable card \" + (card.GetValue()+1) + \" , \" +Card.CLUBS);\n \t\t\t\t\tplayableCards[Rules.CLUBS8] = new Card(card.GetValue()+1,Card.CLUBS);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t\t \t\t\t\n \t\t\tbreak; \n \t\tcase Card.SPADES:\n \t\t\t// Is it a seven, it can be played...\n \t\t\tif (card.GetValue() == 7){\n \t\t\t\tif (playableCards[Rules.HEARTS8] != null && playableCards[Rules.HEARTS8].GetValue() > 7){\n\t \t\t\t\tplayableCards[Rules.SPADES8] = new Card(8,Card.SPADES);\n\t \t\t\t\tplayableCards[Rules.SPADES6] = new Card(6,Card.SPADES);\t \t\t\t\t\t\n \t\t\t\t\treturn card;\n \t\t\t\t}\t \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\tif (card.GetValue() < 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES6])){ \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES6] = new Card(card.GetValue()-1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (card.GetValue() > 7){\n \t\t\t\tif (card.Equals( playableCards[Rules.SPADES8])){\t \t\t\t\t\t\n \t\t\t\t\tplayableCards[Rules.SPADES8] = new Card(card.GetValue()+1,Card.SPADES);\n \t\t\t\t\treturn card;\n \t\t\t\t}\n \t\t\t}\t \t\t\t\n \t\t\tbreak;\n \t\t\t\n\t \t}\n\t \n\t }\n\t return ret;\n }", "@Test\n public void giveCard2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n int numberOfCardsToGive = x.giveCard(5);\n assertTrue(numberOfCardsToGive == 0);\n }", "boolean play();", "@Test\n public void checkBook2() throws Exception {\n SmartPlayer x = new SmartPlayer(0,0);\n boolean gotBook = x.checkBook();\n assertTrue(!gotBook);\n }", "@Override\r\n\tpublic boolean canPlay() {\n\t\treturn false;\r\n\t}", "public boolean validCardPlay(UnoCard card) {\r\n return card.getColor() == validColor || card.getValue() == validValue;\r\n }", "protected boolean canPlay(Board gameBoard) {\n if (canPlayWithoutWild(gameBoard)) {\n return true;\n }\n Iterator<Card> it = myCards.iterator();\n while (it.hasNext()) { // check if the player has wild card\n Card temp = it.next();\n if (temp instanceof WildDrawCard || temp instanceof ColorChangeCard) {\n return true;\n }\n }\n return false;\n }", "private boolean canPlay(UnoCard topCard, UnoCard newCard) {\n\n\t\t// Color or value matches\n\t\tif (topCard.getColor().equals(newCard.getColor())\n\t\t\t\t|| topCard.getValue().equals(newCard.getValue()))\n\t\t\treturn true;\n\t\t// if chosen wild card color matches\n\t\telse if (topCard instanceof WildCard)\n\t\t\treturn ((WildCard) topCard).getWildColor().equals(newCard.getColor());\n\n\t\t// suppose the new card is a wild card\n\t\telse if (newCard instanceof WildCard)\n\t\t\treturn true;\n\n\t\t// else\n\t\treturn false;\n\t}", "public abstract boolean isPlayer();", "@Test\n public void testCardSelectionIsValid_TRUE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.BLUE, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n }", "boolean hasAlreadShowCard();", "private void playThisCard(UnoCard clickedCard) throws NotYourTurnException, InvalidMoveException {\n\t\t// Check player's turn\n\t\tif (!isHisTurn(clickedCard)) {\n\t\t\tthrow new NotYourTurnException();\n\t\t} else {\n\n\t\t\t// Card validation\n\t\t\tif (isValidMove(clickedCard)) {\n\n\t\t\t\tplayedCards().add(clickedCard);\n\n\t\t\t\tremovePlayedCard(clickedCard);\n\n\t\t\t\t// function cards ??\n if (clickedCard instanceof ActionCard) {\n performAction(clickedCard);\n\n }\n\n\t\t\t\tfor (GameListener listener : gameListeners) {\n\t\t\t\t\tlistener.cardPlayed(clickedCard);\n\t\t\t\t}\n\n\t\t\t\tcheckResults();\n\t\t\t} else {\n\t\t\t\tthrow new InvalidMoveException();\n\n\t\t\t}\n\t\t}\n\t}", "@Test\n void play_BranchThree()\n {\n dealer = 21;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(dealer, result);\n }", "@Test \n public void testDetectPlayer(){\n assertTrue(controller.detect());\n }", "boolean CanBuyDevCard();", "public boolean playCard(Card card, Enemy enemy){\n if( isGameOver() )return false;\n if( card.isHasTarget() && !enemyController.hasEnemy(enemy) )return false;\n\n System.out.println(\"IN PLAYCARD METHOD\");\n boolean b = effectHandler.playCard( card , enemy);\n System.out.println( \"HAND CARDS : \");\n for( int i = 0 ; i < piles.getHandPile().getCards().size() ; i++ ){\n System.out.println( piles.getHandPile().getCards().get(i).getName() );\n }\n\n return b;\n }", "static boolean playBlackjack() {\n\n Deck mazo; // Un mazo de cartas. Una nueva baraja para cada juego.\n BlackjackHand manoRepartidor; // La mano del repartidor.\n BlackjackHand manoUsuario; // La mano del usuario.\n \n mazo = new Deck();\n manoRepartidor = new BlackjackHand();\n manoUsuario = new BlackjackHand();\n\n // Baraja el mazo, luego reparte dos cartas a cada jugador.\n \n mazo.barajar();\n manoRepartidor.agregarCarta( mazo.cartaReparto());\n manoRepartidor.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n manoUsuario.agregarCarta( mazo.cartaReparto() );\n \n System.out.println();\n System.out.println();\n \n /* Marque si uno de los jugadores tiene Blackjack (dos cartas con un total de 21).\n El jugador con Blackjack gana el juego. El repartidor gana empates.\n */\n \n if (manoRepartidor.obtenerValorBlackjack() == 21) {\n String m=\"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"El repartidor tiene Blackjack. El repartidor gana.\";\n JOptionPane.showMessageDialog(null, m);\n \n return false;\n }\n \n if (manoUsuario.obtenerValorBlackjack() == 21) {\n String m1 = \"El distribuidor tiene el \" + manoRepartidor.obtenerCarta(0) + \" y el \" + manoRepartidor.obtenerCarta(1) + \".\\n\"\n + \"El usuario tiene el \" + manoUsuario.obtenerCarta(0) + \" y el \" + manoUsuario.obtenerCarta(1) + \".\\n\"\n + \"Tienes Blackjack. Tú ganas.\";\n JOptionPane.showMessageDialog(null, m1);\n return true;\n }\n \n /* Si ninguno de los dos jugadores tiene Blackjack, juega el juego. Primero el usuario \n tiene la oportunidad de robar cartas (es decir,\"Golpear\"). El bucle while termina \n cuando el usuario elige \"Stand\". Si el usuario supera los 21,\n el usuario pierde inmediatamente.\n */\n \n while (true) {\n \n /* Muestra las cartas de los usuarios y deja que el usuario decida si golpea o se para. */\n\n System.out.println();\n System.out.println();\n System.out.println();\n String aux1=\"\";\n for ( int i = 0; i < manoUsuario.obtenerConteoCartas(); i++ ){\n aux1=aux1+\" \"+manoUsuario.obtenerCarta(i)+\"\\n\";\n }\n JOptionPane.showMessageDialog(null, \"Tus cartas son: \\n\" \n + aux1+\"\\n\"\n + \"Su total es \" + manoUsuario.obtenerValorBlackjack()+\"\\n\\n\"\n +\"El concesionario está mostrando el \" + manoRepartidor.obtenerCarta(0));\n \n char userAction= JOptionPane.showInputDialog(null,\"¿Pulse (H) o Pararse (S)? \").charAt(0);\n \n // char x = JOptionPane.showInputDialog(null,\"Ingres... el dato\").charAt(0);\n char opcion;\n do {\n opcion=Character.toUpperCase(userAction);\n if (opcion != 'H' && opcion != 'S')\n \n JOptionPane.showMessageDialog(null,\"Por favor responda H o S: \" );\n } while (opcion != 'H' && opcion != 'S');\n\n /* Si el usuario acierta, el usuario recibe una tarjeta. Si el usuario se para, el bucle termina \n (y es el turno de la banca para robar cartas).\n */\n \n if ( opcion == 'S' ) {\n // Termina el bucle; el usuario termina de coger las tarjetas.\n break;\n }\n else { // La accion del usuario es' H'. Dar al usuario una tarjeta. \n // Si el usuario pasa de 21, el usuario pierde.\n Card newCard = mazo.cartaReparto();\n manoUsuario.agregarCarta(newCard);\n \n System.out.println();\n System.out.println();\n System.out.println();\n \n JOptionPane.showMessageDialog(null, \"Aciertos de usuario.\\n\"\n + \"Su carta es el \" + newCard+\"\\n\"\n + \"Su total es ahora \" + manoUsuario.obtenerValorBlackjack());\n if (manoUsuario.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Pasaste por encima de los 21. Tú pierdes.\\n\"\n + \"La otra carta del repartidor era el \" + manoRepartidor.obtenerCarta(1));\n return false; \n }\n }\n \n } // end while loop\n \n /* Si llegamos a este punto, el usuario tiene un nivel Ahora, es\n la oportunidad del traficante de dibujar. El Dealer coge cartas hasta que el dealer\n total es > 16. Si el concesionario pasa de 21, pierde.\n */\n\n \n JOptionPane.showMessageDialog(null, \"Usuario parado.\\n\"\n +\"Las cartas del distribuidor son\\n\"\n +\" \" + manoRepartidor.obtenerCarta(0)+\"\\n\"\n + \" \" + manoRepartidor.obtenerCarta(1));\n while (manoRepartidor.obtenerValorBlackjack() <= 16) {\n Card newCard = mazo.cartaReparto();\n \n JOptionPane.showMessageDialog(null, \"El distribuidor golpea y obtiene el \" + newCard);\n manoRepartidor.agregarCarta(newCard);\n if (manoRepartidor.obtenerValorBlackjack() > 21) {\n \n JOptionPane.showMessageDialog(null, \"Distribuidor detenido por pasar de 21. Usted gana.\");\n return true;\n }\n }\n \n JOptionPane.showMessageDialog(null, \"El total del distribuidor es \" + manoRepartidor.obtenerValorBlackjack());\n /* Si llegamos a este punto, ambos jugadores tienen 21 o menos. \n Podemos determinar el ganador comparando los valores de sus manos. */\n \n System.out.println();\n if (manoRepartidor.obtenerValorBlackjack() == manoUsuario.obtenerValorBlackjack()) {\n JOptionPane.showMessageDialog(null, \"El concesionario gana por empate. Tú pierdes.\");\n \n return false;\n }\n else if (manoRepartidor.obtenerValorBlackjack() > manoUsuario.obtenerValorBlackjack()) {\n \n JOptionPane.showMessageDialog(null, \"El concesionario gana, \" + manoRepartidor.obtenerValorBlackjack() \n + \" puntos para \" + manoUsuario.obtenerValorBlackjack() + \".\");\n return false;\n }\n else {\n \n JOptionPane.showMessageDialog(null, \"Tu ganas, \" + manoUsuario.obtenerValorBlackjack() \n + \" puntos para \" + manoRepartidor.obtenerValorBlackjack() + \".\");\n return true;\n }\n\n }", "public void playCard(ActionCard card, Integer selectedPlayer)\n {\n System.out.println(\"gui: playCard: \" + card + \", selected: \" + selectedPlayer);\n // Guard against this\n if (!isTurn || this.played)\n {\n return;\n }\n \n if(card instanceof PrivateTip || card instanceof Snoop) \n {\n if(selectedPlayer == null) \n {\n JOptionPane.showMessageDialog(null, \"Please select \"\n + \"a player in the \"\n + \"Player Listing (Upper right) that is not yourself!\", \n \"Warning\", \n JOptionPane.ERROR_MESSAGE); \n return;\n }\n }\n\n if (card instanceof Suggestion)\n {\n this.played = true;\n // prompt for solution\n suggestionScreen = new AccusationScreen(this, true, (Suggestion)card);\n suggestionScreen.setVisible(true);\n }\n else\n {\n this.played = clientController.playActionCard(card, selectedPlayer);\n if(!this.played)\n {\n mainGameScreen.notifyUser(\"Play failed: To Play this card,\"\n + \" please select a CluePlayer from the 'Players' list,\"\n + \" then click on this card.\");\n }\n }\n\n }", "private boolean canAcceptCard(Card card) {\n return cardSet.canAcceptCard(card);\n }", "@Test\r\n\tpublic void testPlayableCards2()\r\n\t{\n\t\t\r\n\t\tCardList clubList = new CardList();\r\n\t\tclubList.add(AllCards.a6C);\r\n\t\tclubList.add(AllCards.aTC);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.CLUBS, null).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tCardList diamondsList = new CardList();\r\n\t\tdiamondsList.add(AllCards.a7D);\r\n\t\tdiamondsList.add(AllCards.aQD);\r\n\t\tdiamondsList.add(AllCards.aKD);\r\n//\t\tassertTrue( h.playableCards(Suit.DIAMONDS, null).toString().equals(diamondsList.toString()));\r\n\t\t\r\n\t\tCardList heartsList = new CardList();\r\n\t\theartsList.add(AllCards.a9H);\t\t\r\n//\t\tassertTrue( h.playableCards(Suit.HEARTS, null).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tCardList spadesList = new CardList();\r\n\t\tspadesList.add(AllCards.aTS);\r\n\t\tspadesList.add(AllCards.a7S);\r\n\t\tspadesList.add(AllCards.aJS);\r\n\t\tspadesList.add(AllCards.aKS);\r\n//\t\tassertTrue( h.playableCards(Suit.SPADES, null).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\tCardList joker = new CardList();\t\t\t\r\n\t\tjoker.add(AllCards.aLJo);\t\t\r\n\t\tjoker.add(AllCards.aHJo);\r\n//\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, null).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\t\r\n\t\t// Trump\r\n\t\tclubList.add(AllCards.aJS);\r\n\t\tclubList.add(AllCards.aLJo);\r\n\t\tclubList = clubList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.CLUBS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(clubList.toString()));\r\n\t\t\r\n\t\tdiamondsList.add(AllCards.aLJo);\r\n\t\tdiamondsList = diamondsList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(diamondsList.toString()));\r\n\r\n\t\theartsList = heartsList.sort(new Card.ByRankComparator());\t\t\r\n\t\tassertTrue( h.playableCards(Suit.HEARTS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(heartsList.toString()));\r\n\t\t\r\n\t\tspadesList.remove(AllCards.aJS);\r\n\t\tspadesList = spadesList.sort(new Card.ByRankComparator());\r\n\t\tassertTrue( h.playableCards(Suit.SPADES, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(spadesList.toString()));\r\n\t\t\r\n\t\t// no Trump in hand\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.DIAMONDS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\tassertTrue(jokerhand.playableCards(Suit.DIAMONDS, Suit.CLUBS).sort(new Card.ByRankComparator()).toString().equals(joker.toString()));\r\n\t\t\r\n\t\tCardList jackList = new CardList();\r\n\t\tjackList.add(AllCards.aJS);\r\n\t\tjackList.add(AllCards.aJC);\r\n\t\tassertTrue(jackHand.playableCards(Suit.CLUBS, Suit.SPADES).sort(new Card.ByRankComparator()).toString().equals(jackList.toString()));\r\n\t\t\r\n\t}", "private boolean canPut(Player player) {\n boolean haveValidCart = false;\n boolean can = false;\n for (Card temp: player.getCards()) {\n if(temp.isValidCard(currentCard) || temp instanceof WildCard) {\n haveValidCart = true;\n can = true;\n break;\n }\n }\n if (!haveValidCart) {\n player.addCard(cards.get(0));\n cards.remove(0);\n if (player.getCards().get(player.getCards().size()-1).isValidCard(currentCard)) {\n show();\n System.out.println(player.getName() + \"! You were given a card because you didn't have any valid choice.\");\n can = true;\n }\n else {\n show();\n System.out.println(player.getName() + \"! You were given a card but you don't have any valid choice yet.\");\n }\n }\n return can;\n }", "public boolean playerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(playerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "void playCurrentStationCard();", "@org.junit.Test\n public void test_PlayerWinOfBlackJack(){\n deck.add(new Card(Suit.Club ,10)); //player\n deck.add(new Card(Suit.Diamond, 10)); //dealer\n deck.add(new Card(Suit.Spade, 11)); //player\n deck.add(new Card(Suit.Heart, 8)); //dealer\n deck.add(new Card(Suit.Diamond, 8)); //player\n\n Start start=new Start(player,dealer,deck,table);\n Assert.assertTrue(start.checkBetValidity());\n start.deal();\n Assert.assertTrue(start.checkBlackJack());\n Assert.assertEquals(Status.Players_wins,start.getGameStatus());\n }", "@Test\n public void testIsValidTap() {\n setUpCorrect();\n assertTrue(boardManager.isValidTap(11));\n assertTrue(boardManager.isValidTap(14));\n assertFalse(boardManager.isValidTap(10));\n }", "@Test\n void play_BranchOne()\n {\n dealer = 22;\n player = 22;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(0, result);\n }", "@Override\n\tpublic void onCouldNotPlayCardListener(int position) {\n\n\t}", "@Test\n void play_BranchTwo()\n {\n dealer = 22;\n player = 21;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(player, result);\n }", "private void testHand(List<Card> hand, Card upCard,\n UnoPlayer.Color calledColor, ArrayList<Integer> validPlays, int n)\n {\n int cardPlayed = thePlayer.play(hand, upCard, calledColor,\n new GameState(upCard));\n\n if (!validPlays.contains(new Integer(cardPlayed)))\n {\n String error = printCardError(hand, upCard, calledColor,\n validPlays, cardPlayed);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n UnoPlayer.Color color = thePlayer.callColor(hand);\n\n if (color != UnoPlayer.Color.RED && color != UnoPlayer.Color.BLUE\n && color != UnoPlayer.Color.GREEN\n && color != UnoPlayer.Color.YELLOW)\n {\n String error = printColorError(hand, upCard, calledColor,\n validPlays, color);\n fail(\"Failed test \" + n + \".\\n\" + error);\n }\n\n }", "boolean hasAlreadCheckCard();", "public abstract boolean play(DiscardPile discardPile, Stack<Card> drawPile, ArrayList<Player> players);", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest6() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(5, new ArrayList<Card>());\n }", "@Test\r\n public void testIsValidTap() {\r\n assertTrue(boardManager3.isValidTap(7));\r\n assertTrue(boardManager3.isValidTap(5));\r\n assertFalse(boardManager3.isValidTap(0));\r\n }", "public boolean validMove(int playerID, Card selectedCard){\n // turn == playerID\n if(gameStage == 3){\n if(numPlays == 0){\n if(playerID == 0){\n player1Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player1Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player2Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player3Play.getSuit();\n }\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n // card goes to middle\n //checks suit of the jack if played first and sets first played suit to the correct suit\n //according to which suit is trump\n if(selectedCard.getValue() == Card.NUMBER.JACK){\n if(currentTrumpSuit == Card.SUIT.DIAMONDS && selectedCard.getSuit() == Card.SUIT.HEARTS){\n firstPlayedSuit = Card.SUIT.DIAMONDS;\n }\n if(currentTrumpSuit == Card.SUIT.HEARTS && selectedCard.getSuit() == Card.SUIT.DIAMONDS){\n firstPlayedSuit = Card.SUIT.HEARTS;\n }\n if(currentTrumpSuit == Card.SUIT.CLUBS && selectedCard.getSuit() == Card.SUIT.SPADES){\n firstPlayedSuit = Card.SUIT.CLUBS;\n }\n if(currentTrumpSuit == Card.SUIT.SPADES && selectedCard.getSuit() == Card.SUIT.CLUBS){\n firstPlayedSuit = Card.SUIT.SPADES;\n }\n }\n else{\n firstPlayedSuit = player4Play.getSuit();\n }\n numPlays++;\n turn = 0;\n return true;\n }\n }\n else if(numPlays < 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n turn++;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n turn = 0;\n return true;\n }\n }\n // if three cards have been played this is the last card\n else if(numPlays == 3){\n if(playerID == 0){\n player1Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 1){\n player2Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 2){\n player3Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n else if(playerID == 3){\n player4Play = selectedCard;\n numPlays++;\n firstPlayedSuit = null;\n return true;\n }\n }\n }\n return false;\n }", "boolean CanDiscardCards(Resources resources);", "boolean hasFairplay();", "@Test\n public void testAddCard() {\n d_gameData.getD_playerList().get(1).addCard(GameCard.BLOCKADE);\n assertEquals(true, d_gameData.getD_playerList().get(1).getD_cards().contains(GameCard.BLOCKADE));\n }", "@Test\n public void buyCard() throws Exception {\n model.getTurnTracker().setCurrentTurn(PlayerIndex.FIRST);\n when(devCardFacade.canBuyDevCard(currentPlayer)).thenReturn(true);\n dcc.buyCard();\n verify(devCardFacade, atMost(1)).buyDevCard(currentPlayer);\n }", "@Test\n void play()\n {\n dealer = 21;\n player = 20;\n result = BlackjackSimple.play(dealer, player);\n\n assertEquals(Math.max(dealer, player), result);\n }", "boolean canBeAdded(ICard toBeAddedCard);", "@Test\n public void buyCardWithNoResources() throws Exception {\n when(devCardFacade.canBuyDevCard(noDevCardsPlayer)).thenReturn(false);\n dcc.buyCard();\n verify(devCardFacade, never()).buyDevCard(noDevCardsPlayer);\n }", "@Test\r\n public void testGetSpecificCard() {\r\n Deck instance = new Deck();\r\n System.out.println(\"Testing getSpecificCard\");\r\n Card result = instance.getSpecificCard(51);\r\n System.out.println('\\t' + \"Card toString: \" + result.toString());\r\n assertNotNull(result);\r\n }", "private static void testPlayer() {\r\n\t\t\tnew AccessChecker(Player.class).pM(\"getName\").pM(\"getMark\").pM(\"toString\").checkAll();\r\n\t\t\tPlayer p = new Player(\"Test\", 'X');\r\n\t\t\tcheckEq(p.getName(), \"Test\", \"Player.getName\");\r\n\t\t\tcheckEq(p.getMark(), 'X', \"Player.getMark\");\r\n\t\t\tcheckEqStr(p, \"Test(X)\", \"Player.toString\");\t\t\r\n\t\t}", "void playMonopolyCard(String resource);", "public boolean computerCardCheck(Card card)\n {\n int diff = Card.valueOfCard(computerCard) - Card.valueOfCard(card);\n // If player wins\n if( diff == 1 || diff == -1)\n {\n return true;\n }\n return false;\n }", "@Test(suiteName = \"NowPlaying\", testName = \"DMCA Restricted\", description = \"Now Playing - Live - DMCA Restricted - Player controls\", enabled = true, groups = {\n\t\t\t\"MOBANDEVER-227:EVQAAND-307\" })\n\tpublic void dmcaRestrictedPlayerControl() {\n\t\tCommon common = new Common(driver);\n\t\tCommon.log(\"verifying DMCA Restricted - Player controls MOBANDEVER-227\");\n\t\ttry {\n\t\t\tgetPageFactory().getEvehome().clickonMusic();\n\t\t\tcommon.scrollUntilTextExists(\"Dance/Electronic\");\n\t\t\tgetPageFactory().getEvehome().clickMucisSubRock();\n\t\t\tgetPageFactory().getEvehome().popChannel1();\n\t\t\tgetPageFactory().getCategory().nplChnumber();\n\t\t\tgetPageFactory().getEvehome().clickminimize();\n\t\t} catch (AndriodException ex) {\n\t\t\tCommon.errorlog(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t\tAssert.fail(\"Exception occured in : \" + this.getClass().getSimpleName() + \" : \" + ex.getMessage());\n\t\t}\n\t}", "boolean hasCardType();", "abstract boolean allowedToAdd(Card card);", "@Override\n public boolean canUseCard(){\n return false;\n }", "@Test(expected = IllegalArgumentException.class)\n public void startPlayTest4() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n g.startPlay(0, g.getDeck());\n }", "public abstract boolean doTurn(Deck theDeck);", "public static boolean validateCard(String[] args) {\n return true;\n }", "@Test\n public final void testPlayer2Win() {\n checkPlayerWin(player2);\n }", "public boolean checkRequirements(PlayerBoard playerBoard);", "@Test\n public final void testPlayer1Win() {\n checkPlayerWin(player1);\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public boolean CheckForUnwinnableCondition(){\n int humanSize = GetSizeOfHumanHand();\n int computerSize = GetSizeOfComputerHand();\n\n for(int i = 0; i < humanSize; i++) {\n //Human can play a card\n String card = handHuman.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n for(int i = 0; i < computerSize; i++){\n //Human can play a card\n String card = handComputer.get(i);\n\n String firstLetter = Character.toString(card.charAt(0));\n String topFirstLetter = Character.toString(topCard.charAt(0));\n\n if (topCard.contains(\"8\")) {\n //Can play any card ontop to determine suite\n return true;\n }\n\n if (card.contains(\"8\")) {\n //valid because 8s are wild cards, human can place it\n return true;\n }\n\n //the cards match in suite, doesn't matter what it is\n else if (firstLetter.equals(topFirstLetter)) {\n return true;\n }\n\n else {\n if (topFirstLetter.equals(\"c\")) {\n String temp = topCard.substring(5, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"h\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"d\")) {\n String temp = topCard.substring(8, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n\n } else if (topFirstLetter.equals(\"s\")) {\n String temp = topCard.substring(6, topCard.length());\n\n if (card.contains(temp)) {\n return true;\n }\n }\n }\n }\n\n //Human and computer can't play a card\n return false;\n }", "@Test\n void checkAmmoResources() {\n ArrayList<Player> array = new ArrayList<>();\n AlphaGame game = new AlphaGame(1, array, false, 5);\n RealPlayer rp = new RealPlayer('b', \"rp\");\n rp.setPlayerPosition(Board.getSpawnpoint('b'));\n array.add(rp);\n char[] cost = new char[3];\n cost[0] = 'b';\n cost[1] = 'r';\n\n assertTrue(rp.checkAmmoResources(cost));\n\n cost[0] = 'b';\n cost[1] = 'b';\n\n assertFalse(rp.checkAmmoResources(cost));\n }", "@Test\n public void testNextCardGood() {\n System.out.println(\"nextCardGood\");\n Deck deck = new Deck();\n Card card = deck.nextCard();\n ////since the deck is unshuffled, that last card should be WILDCARD\n assertEquals(CardType.WILDCARD, card.getValue());\n }", "public boolean isWin_CommanderVimes(){\r\n // player got LordSelachii card\r\n Player playerHoldCard = null;\r\n for (Player player : discWorld.getPlayer_HASH().values()) {\r\n if (player.getPersonalityCardID() == 7) {\r\n playerHoldCard = player;\r\n break;\r\n }\r\n }\r\n \r\n if(playerHoldCard != null){\r\n if(discWorld.getShuffled_PlayerCard().size() == 0){\r\n return true;\r\n }\r\n } \r\n \r\n return false;\r\n }", "public boolean isCard() {\n\t\treturn id > 0 && id < 53;\n\t}", "public abstract boolean isPossible(Player p);", "@Test(expected = Exception.class)\n public void testCardSelectionIsValid_FALSE() throws Exception {\n System.out.println(\"cardSelectionIsValid not valid\");\n UnoCard cardSelection = new UnoCard(UnoCardColour.RED, UnoCardValue.TWO);\n UnoCard drawCard = new UnoCard(UnoCardColour.BLUE, UnoCardValue.ONE);\n UnoCardColour wildColour = UnoCardColour.BLUE;\n utils.cardSelectionIsValid(cardSelection, drawCard, wildColour);\n \n }", "private boolean offerCard(Player p) {\n\n //Offer card (take or pass)\n p.sendMessage(\"TAKE OR PASS\");\n\n //Wait until they take the card\n waitForPlayerAction(p, \"TAKE\", \"PASS\");\n\n if(actionChosen.equals(\"TAKE\")) {\n\n giveCard(p);\n return true;\n\n } else if(actionChosen.equals(\"PASS\")) {\n //Don't give card\n\n cList.sendToAll(\"Player \" + p.getUsername() + \" passes\");\n return false;\n }\n\n return false;\n }", "public void checkPlay(int[][] boardState)\n {\n if(ai)\n {\n takeTurn(boardState);\n }\n }", "boolean hasPlayready();" ]
[ "0.7659382", "0.75819266", "0.7539191", "0.7412345", "0.7284266", "0.6787191", "0.6725207", "0.6694125", "0.6676907", "0.6633777", "0.6591471", "0.65719104", "0.65429306", "0.6541443", "0.65411043", "0.65345496", "0.6495341", "0.64626014", "0.64570975", "0.6431492", "0.6426719", "0.6378933", "0.6372066", "0.63294333", "0.63272184", "0.6266896", "0.6262256", "0.6240708", "0.6240149", "0.6146987", "0.61394435", "0.61211514", "0.61171293", "0.6084959", "0.6070099", "0.60580873", "0.6023855", "0.6007266", "0.5989935", "0.5985366", "0.5973349", "0.5960403", "0.5958512", "0.5951363", "0.5950308", "0.5937089", "0.5930786", "0.5907961", "0.5903844", "0.589059", "0.5888103", "0.5866878", "0.58665043", "0.5841053", "0.5824271", "0.5807972", "0.5796643", "0.578707", "0.5780152", "0.57779497", "0.57732564", "0.57704306", "0.57631034", "0.5758579", "0.57483935", "0.5745572", "0.574198", "0.5740751", "0.5723554", "0.5716258", "0.57160014", "0.5713931", "0.5713826", "0.57131183", "0.57119846", "0.57112557", "0.5710174", "0.57070404", "0.5696961", "0.5683724", "0.567602", "0.56705374", "0.5669256", "0.56689835", "0.56651807", "0.5648963", "0.56482226", "0.5645222", "0.5627901", "0.5624333", "0.5620258", "0.5619998", "0.5617427", "0.56077766", "0.5602424", "0.5595697", "0.55876154", "0.5570578", "0.556642", "0.5565973" ]
0.7250692
5
Created by wgoris31 on 1/24/2018.
public interface WifiCredentialsStoreInterface { String getSSID(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "protected MetadataUGWD() {/* intentionally empty block */}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n public int describeContents() { return 0; }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\n protected void initialize() {\n }", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "public void mo38117a() {\n }", "@Override\n public void init() {\n\n }", "@Override\n protected void initialize() {\n\n \n }", "private Rekenhulp()\n\t{\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n public void init() {\n }", "@Override\n void init() {\n }", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "private void poetries() {\n\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "public Pitonyak_09_02() {\r\n }", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n public void init() {}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "Petunia() {\r\n\t\t}", "public void mo4359a() {\n }", "@Override\n public void memoria() {\n \n }", "@Override\n protected void getExras() {\n }", "private MetallicityUtils() {\n\t\t\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "private TMCourse() {\n\t}", "private static void cajas() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n protected void init() {\n }", "@Override\r\n\tpublic void init() {}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "@Override\n public void initialize() {}", "private void m50366E() {\n }", "@Override\n public void initialize() {\n \n }", "@Override public int describeContents() { return 0; }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public int getSize() {\n return 1;\n }", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "private void init() {\n\n\t}", "@Override\n public void initialize() { \n }", "public void mo6081a() {\n }", "Consumable() {\n\t}", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tprotected void initialize() {\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "private Singletion3() {}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "protected void mo6255a() {\n }", "@SuppressWarnings(\"unused\")\n\tprivate void version() {\n\n\t}", "@Override\n\t\tpublic void init() {\n\t\t}", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void init() {\n\t}", "public void gored() {\n\t\t\n\t}", "private ReportGenerationUtil() {\n\t\t\n\t}" ]
[ "0.59523463", "0.5812119", "0.56720155", "0.55393875", "0.55220175", "0.5520773", "0.5520773", "0.5495857", "0.5467442", "0.5460743", "0.5452715", "0.54375046", "0.5429094", "0.5429094", "0.5429094", "0.5429094", "0.5429094", "0.5429094", "0.53997153", "0.53607535", "0.5359848", "0.5347055", "0.5345399", "0.533213", "0.5325247", "0.53158545", "0.5313087", "0.531169", "0.5309693", "0.52950925", "0.52931345", "0.5292312", "0.5292116", "0.5292116", "0.52884126", "0.52866703", "0.52755404", "0.5275202", "0.5272585", "0.5263182", "0.52629304", "0.525353", "0.525353", "0.5250442", "0.52469456", "0.5246258", "0.5244635", "0.52413076", "0.5240618", "0.5235991", "0.52300966", "0.52260673", "0.5219088", "0.5219088", "0.5219088", "0.5219088", "0.5219088", "0.52166903", "0.5213045", "0.51967806", "0.5190493", "0.518806", "0.518806", "0.518806", "0.5168724", "0.51637495", "0.51512134", "0.51503086", "0.5149336", "0.51482135", "0.51482135", "0.51482135", "0.514804", "0.514804", "0.514804", "0.514804", "0.514804", "0.514804", "0.514804", "0.5146596", "0.5143676", "0.51411337", "0.5140808", "0.5135758", "0.5135758", "0.51302785", "0.51302785", "0.51302785", "0.511945", "0.511945", "0.51081556", "0.5105926", "0.5103108", "0.5090334", "0.50894475", "0.50863266", "0.5085536", "0.5074869", "0.5073557", "0.50688535", "0.5065336" ]
0.0
-1
TODO Autogenerated method stub
@Override public void onClick(View v) { new Thread(new Runnable(){ public void run(){ for(int i = 0; i<10; i++){ try{ Thread.sleep(100);//0.1초 대기 //핸들러 호출 h.sendEmptyMessage(5); }catch(Exception e){ } } switch(n){ case 0 : h.sendEmptyMessage(0); break; case 1 : h.sendEmptyMessage(1); break; case 2 : h.sendEmptyMessage(2); break; case 3 : h.sendEmptyMessage(3); break; case 4 : h.sendEmptyMessage(4); break; } } }).start(); Log.e("yut", String.valueOf(n)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Return the number of matching entities in the database.
@Transactional(readOnly = true) public long countByCriteria(AccbillnoCriteria criteria) { log.debug("count by criteria : {}", criteria); final Specification<Accbillno> specification = createSpecification(criteria); return accbillnoRepository.count(specification); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int findAllCount() ;", "public int count() {\n\t Query count = getEntityManager().createQuery(\"select count(u) from \" + getEntityClass().getSimpleName() + \" u\");\n\t return Integer.parseInt(count.getSingleResult().toString());\n\t }", "public int count() {\n return Query.count(iterable);\n }", "public Integer entitiesCount() {\n return this.entitiesCount;\n }", "long countNumberOfProductsInDatabase();", "public long getPersonesCount()throws personNotFoundExeption{\n EntityManager em = emf.createEntityManager();\n try{\n long personesCount = (long)em.createQuery(\"SELECT COUNT(p) FROM Person p\").getSingleResult();\n return personesCount;\n }finally{ \n em.close();\n }\n }", "@Override\r\n\tpublic int count() throws StrumentoNotFoundException {\n\t\treturn (int) strumentoRepository.count();\r\n\t}", "public int count() {\r\n Session session = getSession();\r\n Long count = new Long(0);\r\n try {\r\n count = (Long) session.createQuery(\"select count(t) from \" + getPersistentClass().getName() + \" t \").uniqueResult();\r\n } catch (HibernateException e) {\r\n LOG.error(MODULE + \"Exception in count Method:\" + e, e);\r\n } finally {\r\n// if (session.isOpen()) {\r\n// session.close();\r\n// }\r\n }\r\n return count.intValue();\r\n }", "public int getNumEntities()\n\t{\n\t\treturn this.entities.size();\n\t}", "public int findAllCount() {\n\t\treturn mapper.selectCount(null);\n\t}", "public int getMatchesRowNumber() {\n\t\tint nMatches = 0;\n\t\tPreparedStatement statement = null;\n\t\tResultSet rs = null;\n\t\tString teamByIdRecords_sql = \"SELECT COUNT(*) FROM \" + match_table;\n\t\tconnection = connector.getConnection();\n\t\ttry {\n\t\t\tstatement = connection.prepareStatement(teamByIdRecords_sql);\n\t\t\trs = statement.executeQuery();\n\t\t\tif (rs.next()) {\n\t\t\t\tnMatches = rs.getInt(1);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t}\n\t\treturn nMatches;\n\t}", "public Long getCountAllResults() {\n\n //create a querybuilder for count\n QueryBuilder queryBuilderCount = dao.getQueryBuilder()\n .from(dao.getEntityClass(), (joinBuilder != null ? joinBuilder.getRootAlias() : null))\n .join(joinBuilder)\n .add(getCurrentQueryRestrictions())\n .debug(debug);\n\n Long rowCount;\n //added distinct verification\n if (joinBuilder != null && joinBuilder.isDistinct()) {\n rowCount = queryBuilderCount.countDistinct(joinBuilder.getRootAlias());\n } else {\n rowCount = queryBuilderCount.count();\n }\n\n return rowCount;\n }", "@Override\r\n\tpublic int countAll() {\r\n\t\tLong count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,\r\n\t\t\t\tFINDER_ARGS_EMPTY, this);\r\n\r\n\t\tif (count == null) {\r\n\t\t\tSession session = null;\r\n\r\n\t\t\ttry {\r\n\t\t\t\tsession = openSession();\r\n\r\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_SHARE);\r\n\r\n\t\t\t\tcount = (Long)q.uniqueResult();\r\n\r\n\t\t\t\tfinderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,\r\n\t\t\t\t\tcount);\r\n\t\t\t}\r\n\t\t\tcatch (Exception e) {\r\n\t\t\t\tfinderCache.removeResult(FINDER_PATH_COUNT_ALL,\r\n\t\t\t\t\tFINDER_ARGS_EMPTY);\r\n\r\n\t\t\t\tthrow processException(e);\r\n\t\t\t}\r\n\t\t\tfinally {\r\n\t\t\t\tcloseSession(session);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn count.intValue();\r\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "public static int countAll() {\n\t\treturn getPersistence().countAll();\n\t}", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\tFINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_CAMPUS);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,\n\t\t\t\t\tcount);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tfinderCache.removeResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\t\tFINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(e);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "public int bookCount() {\r\n\t\tint rowCount = jdbcTemplate.queryForInt(\"select count(1) from persone\");\r\n\t\treturn rowCount;\r\n\t}", "@SuppressWarnings(\"deprecation\")\r\n\tprivate int countEntities(){\r\n\t\tQuery query = new Query(\"UserProfile\");\r\n\t\treturn datastore.prepare(query).countEntities();\r\n\t}", "public long countAllUserEntitys() {\n return userEntityRepository.count();\n }", "Object getNumberMatched();", "public static int getCountofPeople(){\n int training_set = 0;\n \n try (Connection con = DriverManager.getConnection(url, user, password)){\n String query = \"SELECT count(*) FROM \"+DATABASE_NAME+\".People;\";\n Statement st = con.createStatement();\n ResultSet rs = st.executeQuery(query);\n if (rs.next()) {\n training_set = rs.getInt(1);\n }\n con.close();\n }catch (SQLException ex) {\n ex.printStackTrace();\n } \n\n return training_set;\n }", "int getResultsCount();", "int getResultsCount();", "public int numMatches();", "@Override\n\tpublic Integer findCount() {\n\t\tInteger total;\n\t\tString hql=\"from Commodity\";\n\t\tList<Commodity> commoditylist=(List<Commodity>) this.getHibernateTemplate().find(hql, null);\n\t\ttotal=commoditylist.size();\n\t\treturn total;\n\t}", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\tFINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_VCMSPORTION);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,\n\t\t\t\t\tcount);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tfinderCache.removeResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\t\tFINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(e);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "int findCount();", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\tFINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_APPROVATORE);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,\n\t\t\t\t\tcount);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tfinderCache.removeResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\t\tFINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(e);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "@Override\n\tpublic int findCounts(DetachedCriteria detachedCriteria) {\n\t\treturn scoreDao.findCounts(detachedCriteria);\n\t}", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(\n\t\t\t_finderPathCountAll, FINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_ANSWER);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(\n\t\t\t\t\t_finderPathCountAll, FINDER_ARGS_EMPTY, count);\n\t\t\t}\n\t\t\tcatch (Exception exception) {\n\t\t\t\tfinderCache.removeResult(\n\t\t\t\t\t_finderPathCountAll, FINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(exception);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "Long queryCount(ProductSearchParm productSearchParm);", "public int getSize(){\r\n return repo.findAll().size();\r\n }", "public int countAll() throws SQLException\n {\n return countWhere(\"\");\n }", "public int countAll() throws SQLException\n {\n return countWhere(\"\");\n }", "public int countAll() throws SQLException\n {\n return countWhere(\"\");\n }", "Long count();", "Long count();", "Long count();", "Long count();", "Long count();", "@Override\n\tpublic int queryCount() {\n\t\treturn (int) tBasUnitClassRepository.count();\n\t}", "@Override\n\tpublic int queryCountOfRows() {\n\t\treturn parentDao.queryCountOfRows();\n\t}", "@Transactional\n\tpublic Integer countProductImagess() {\n\t\treturn ((Long) productImagesDAO.createQuerySingleResult(\"select count(o) from ProductImages o\").getSingleResult()).intValue();\n\t}", "Long getAllCount();", "Long recordCount();", "public int countAll() throws DAOException;", "int get_row_count(String table) {\n //table does not exist\n if (!get_table_names().contains(table) && !table.equals(\"relationship\")) {\n throw new RuntimeException(\"Table does not exist.\");\n }\n\n //maybe use select count(id) from table instead\n String sql = \"select * from \" + table;\n int count = 0;\n\n ResultSet resultSet = execute_statement(sql, true);\n try {\n while (resultSet.next()) {\n count++; //count number of entities\n }\n } catch (SQLException e) {\n e.printStackTrace();\n }\n\n\n try {\n this.disconnect(resultSet, null, null); //disconnect from database\n } catch (SQLException e) {\n e.printStackTrace();\n }\n return count;\n }", "public int size()\n {\n return queries.size();\n }", "public int getCount() {\n\n int counter = 0;\n SQLiteDatabase db = getReadableDatabase();\n String GOALS_SELECT_QUERY =\n String.format(\"SELECT * FROM %s \", TABLE_GOALS);\n Cursor cursor = db.rawQuery(GOALS_SELECT_QUERY, null);\n\n try {\n counter = cursor.getCount();\n } catch (Exception e) {\n Log.d(TAG, \"Error while trying to get count from database\");\n } finally {\n if (cursor != null && !cursor.isClosed()) {\n cursor.close();\n }\n }\n return counter;\n }", "int getQueriesCount();", "@Override\n public int countAll() {\n\n Query qry = this.em.createQuery(\n \"select count(assoc) \" +\n \"from WorkToSubjectEntity assoc\");\n\n return ((Long) qry.getSingleResult()).intValue();\n }", "public int getNumOfMatchedBets();", "public int countEntities(Map<String, Object> parms) {\n\t\treturn 0;\n\t}", "public int countEntities(Map<String, Object> parms) {\n\t\treturn 0;\n\t}", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\tFINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_TESTUNIT);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,\n\t\t\t\t\tcount);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tfinderCache.removeResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\t\tFINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(e);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "@Transactional(readOnly = true)\n\t@Override\n\tpublic long count() throws Exception {\n\t\treturn personaRepository.count();\n\t}", "public long countRecords();", "@Query(\"SELECT count(*) FROM DemoEntity d\")\r\n\tpublic Integer countDemo();", "public int searchRowsCount(SearchCriteria cri);", "public int getListCount() {\n String countQuery = \"SELECT * FROM \" + TABLE_NAME;\n SQLiteDatabase db = this.getReadableDatabase();\n Cursor cursor = db.rawQuery(countQuery, null);\n cursor.close();\n return cursor.getCount();\n }", "@Transactional(propagation=Propagation.SUPPORTS,readOnly=true)\r\n\tpublic Integer queryCount() {\n\t\tInteger count = musicdao.selectCount();\r\n\t\treturn count;\r\n\t}", "public int query() {\n return count;\n }", "protected static int countQuestionByText(Question entity, Connection connection)\n throws ApplicationException {\n\n int result = 0;\n\n StringBuilder query = new StringBuilder(\"\");\n query.append(\"SELECT COUNT (*)\");\n query.append(\" FROM \" + TABLE);\n query.append(\" WHERE (\" + COL_QUESTION_TEXT);\n query.append(\" = ?\");\n query.append(\" AND \" + COL_REPORTED);\n query.append(\" <= 3);\");\n\n PreparedStatement statement = null;\n try {\n try {\n // set parameters and execute query\n statement = connection.prepareStatement(query.toString());\n statement.setString(1, entity.getQuestionText());\n ResultSet resultSet = statement.executeQuery();\n\n if (resultSet.next()) {\n result = resultSet.getInt(1);\n }\n } finally {\n if (statement != null) {\n statement.close();\n }\n }\n } catch (SQLException e) {\n throw new ApplicationException(\"Failed to fetch\", e);\n }\n\n return result;\n }", "public int countArticle(){\n\n DatabaseHelper databaseHelper = DatabaseHelper.getInstance(this.mExecutionContext);\n SQLiteDatabase sqLiteDatabase = databaseHelper.getReadableDatabase();\n\n Cursor Count= sqLiteDatabase.rawQuery(\"select count(*) from\"+ ConfigDAO.TABLE_AISLE, null);\n Count.moveToFirst();\n int count= Count.getInt(0);\n Count.close();\n return count;\n }", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(\n\t\t\t_finderPathCountAll, FINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_PHATVAY);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(\n\t\t\t\t\t_finderPathCountAll, FINDER_ARGS_EMPTY, count);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tfinderCache.removeResult(\n\t\t\t\t\t_finderPathCountAll, FINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(e);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "public int getcount() {\n\t\tString countQuery = \"SELECT * FROM \" + DATABASE_TABLE1;\n\t \n\t Cursor cursor = ourDatabase.rawQuery(countQuery, null);\n\t int cnt = cursor.getCount();\n\t cursor.close();\n\t return cnt;\n\t\n\t}", "public int numberOfRows(){\n SQLiteDatabase db = this.getReadableDatabase();\n int numRows = (int) DatabaseUtils.queryNumEntries(db,TABLE_NAME);\n return numRows;\n }", "long count(String query);", "long count(String query);", "@Override\n public long count() {\n String countQuery = \"SELECT COUNT(*) FROM \" + getTableName();\n return getJdbcTemplate().query(countQuery, SingleColumnRowMapper.newInstance(Long.class))\n .get(0);\n }", "default long count() {\n\t\treturn select(Wildcard.count).fetchCount();\n\t}", "public int size() {\n\t\treturn db.size();\n\t}", "public void executeRowCountCriteria() {\n Session session = getSession();\n Transaction transaction = session.beginTransaction();\n\n // SELECT COUNT(*)\n // FROM Product p\n Criteria criteria = session.createCriteria(Product.class);\n criteria.setProjection(Projections.rowCount());\n\n displayObjectList(criteria.list());\n transaction.commit();\n }", "@IntRange(from = 0)\n public int getEntityCount() {\n return mEntityConfidence.getEntities().size();\n }", "public static int countQuestionByText(Question entity) throws ApplicationException {\n int result = 0;\n\n Connection connection = null;\n\n try {\n connection = ConnectionPool.getConnection();\n result = QuestionDatabaseAccess.countQuestionByText(entity, connection);\n } finally {\n ConnectionPool.releaseConnection(connection);\n }\n\n return result;\n }", "@Override\n\tpublic int countAll() {\n\t\tLong count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\tFINDER_ARGS_EMPTY, this);\n\n\t\tif (count == null) {\n\t\t\tSession session = null;\n\n\t\t\ttry {\n\t\t\t\tsession = openSession();\n\n\t\t\t\tQuery q = session.createQuery(_SQL_COUNT_PAPER);\n\n\t\t\t\tcount = (Long)q.uniqueResult();\n\n\t\t\t\tfinderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,\n\t\t\t\t\tcount);\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tfinderCache.removeResult(FINDER_PATH_COUNT_ALL,\n\t\t\t\t\tFINDER_ARGS_EMPTY);\n\n\t\t\t\tthrow processException(e);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tcloseSession(session);\n\t\t\t}\n\t\t}\n\n\t\treturn count.intValue();\n\t}", "@Override\n public int countAll() throws SystemException {\n Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,\n FINDER_ARGS_EMPTY, this);\n\n if (count == null) {\n Session session = null;\n\n try {\n session = openSession();\n\n Query q = session.createQuery(_SQL_COUNT_ENTITYDEALER);\n\n count = (Long) q.uniqueResult();\n\n FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,\n FINDER_ARGS_EMPTY, count);\n } catch (Exception e) {\n FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,\n FINDER_ARGS_EMPTY);\n\n throw processException(e);\n } finally {\n closeSession(session);\n }\n }\n\n return count.intValue();\n }", "int countAssociations();", "public int countAll() {\n\t\treturn transactionDAO.countAll();\n\t}", "long getDbCount();", "public int size() {\n return results.size();\n }", "int findCountByCriteria(String eCriteria, Object... parameters);", "@Override\n\tpublic Integer getItemCount() {\n\t\t\n\t\tInteger countRows = 0;\n\t\t\n\t\t/*\n\t\t * Count of items will be retrieved from MainQuery.xml\n\t\t */\n\t\ttry {\n\t\t\tconnection = DBConnectionUtil.getDBConnection();\n\t\t\tpreparedStatement = connection.prepareStatement(QueryUtil.queryByID(CommonConstants.QUERY_ID_GET_ITEM_COUNT));\n\t\t\tResultSet resultSet = preparedStatement.executeQuery();\n\t\t\t\n\t\t\twhile(resultSet.next()){\n\t\t\t\tcountRows = resultSet.getInt(1);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t} catch (SQLException | SAXException | IOException | ParserConfigurationException | ClassNotFoundException e) {\n\t\t\tlog.log(Level.SEVERE, e.getMessage());\n\t\t} finally {\n\t\t\t/*\n\t\t\t * Close prepared statement and database connectivity at the end of transaction\n\t\t\t */\n\t\t\ttry {\n\t\t\t\tif (preparedStatement != null) {\n\t\t\t\t\tpreparedStatement.close();\n\t\t\t\t}\n\t\t\t\tif (connection != null) {\n\t\t\t\t\tconnection.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException e) {\n\t\t\t\tlog.log(Level.SEVERE, e.getMessage());\n\t\t\t}\n\t\t}\n\t\treturn countRows;\n\t}", "@Override\n\tpublic Integer getItemCount() {\n\t\t\n\t\tInteger countRows = 0;\n\t\t\n\t\t/*\n\t\t * Count of items will be retrieved from MainQuery.xml\n\t\t */\n\t\ttry {\n\t\t\tconnection = DBConnectionUtil.getDBConnection();\n\t\t\tpreparedStatement = connection.prepareStatement(QueryUtil.queryByID(CommonConstants.QUERY_ID_GET_ITEM_COUNT));\n\t\t\tResultSet resultSet = preparedStatement.executeQuery();\n\t\t\t\n\t\t\twhile(resultSet.next()){\n\t\t\t\tcountRows = resultSet.getInt(1);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t} catch (SQLException | SAXException | IOException | ParserConfigurationException | ClassNotFoundException e) {\n\t\t\tlog.log(Level.SEVERE, e.getMessage());\n\t\t} finally {\n\t\t\t/*\n\t\t\t * Close prepared statement and database connectivity at the end of transaction\n\t\t\t */\n\t\t\ttry {\n\t\t\t\tif (preparedStatement != null) {\n\t\t\t\t\tpreparedStatement.close();\n\t\t\t\t}\n\t\t\t\tif (connection != null) {\n\t\t\t\t\tconnection.close();\n\t\t\t\t}\n\t\t\t} catch (SQLException e) {\n\t\t\t\tlog.log(Level.SEVERE, e.getMessage());\n\t\t\t}\n\t\t}\n\t\treturn countRows;\n\t}", "public int getMembreCount() {\n try {\n// CriteriaQuery cq = entManager.getCriteriaBuilder().createQuery();\n// Root<Membre> rt = cq.from(Membre.class);\n// cq.select(entManager.getCriteriaBuilder().count(rt));\n// Query q = entManager.createQuery(cq);\n// return ((Long) q.getSingleResult()).intValue();\n \n Query q = entManager.createNamedQuery(\"Membre.findAll\");\n return q.getResultList().size();\n \n } finally {\n// em.close();\n }\n }", "@Override\n\tpublic int incheoncount() throws Exception {\n\t\treturn dao.incheoncount();\n\t}", "int getGrammarMatchCount();", "private int countMatchingPerson(final ExpressionJpa expression) {\n\n int matchCount = 0;\n\n for (MarcDataField field700 : this.marcRecord.getDataFields(\"700\")) {\n for (String relatorSubfield : field700.getValueList('4')) {\n if (\"prf\".equals(relatorSubfield)\n || \"cnd\".equals(relatorSubfield)) {\n final String persAuthIdent =\n PersonMapper.getAuthIdent(field700);\n // now have a personIdent from the MarcRecord\n // is there a matching persisted personIdent\n // under the expression.realizedBy relationship\n for (ExpressionToResponsibleParty realizedBy :\n expression.getHasRealizers()) {\n // this should be a PersonJpa, but ...\n // TODO better way to screen ResponsiblePartyJpa subclasses?\n try {\n final PersonJpa responPers =\n (PersonJpa) realizedBy.\n getTargetResponsibleParty();\n if (persAuthIdent.equals(responPers.getAuthIdent())) {\n matchCount++;\n }\n } catch (ClassCastException notPerson) {\n // not a PersonJpa\n }\n }\n }\n }\n }\n\n return matchCount;\n }", "public int getSearchResultsCount() {\n return searchResultsList.size();\n }", "int getNumberOfResults();", "int getEntryCount();", "public long getCount() {\n return getCount(new BasicDBObject(), new DBCollectionCountOptions());\n }", "public int numberOfRows(){\n int numRows = (int) DatabaseUtils.queryNumEntries(db, TRACKINGS_TABLE_NAME);\n return numRows;\n }" ]
[ "0.72055745", "0.7112963", "0.7040392", "0.6930659", "0.6835712", "0.6823517", "0.6775256", "0.67737544", "0.6716066", "0.6703935", "0.66931164", "0.66503805", "0.66427094", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6639231", "0.6600916", "0.6595538", "0.65883136", "0.65668726", "0.65490055", "0.6548163", "0.65458274", "0.65458274", "0.6543795", "0.6542109", "0.65409493", "0.64883584", "0.6482766", "0.6469149", "0.6468853", "0.642194", "0.64217895", "0.64018846", "0.64018846", "0.64018846", "0.64006865", "0.64006865", "0.64006865", "0.64006865", "0.64006865", "0.63895786", "0.6381241", "0.6380681", "0.63747543", "0.63744247", "0.63663566", "0.63531417", "0.63497454", "0.6343935", "0.6340019", "0.6339959", "0.63278925", "0.63152474", "0.63152474", "0.6311246", "0.63079417", "0.6299475", "0.6294323", "0.62940884", "0.62934625", "0.6292069", "0.6289897", "0.6285537", "0.62807864", "0.6277845", "0.627098", "0.6258978", "0.6252132", "0.6252132", "0.62367713", "0.6224649", "0.62076414", "0.6200036", "0.6197492", "0.6197106", "0.6195209", "0.6191631", "0.6185228", "0.61812896", "0.6176652", "0.6166418", "0.61582184", "0.6155591", "0.6155591", "0.61554873", "0.615518", "0.61546546", "0.61495847", "0.61427605", "0.61326104", "0.61259687", "0.6124277", "0.61238605" ]
0.0
-1
~ constructors Constructs a new instance of the program
public AR_v4() { super(); loadConfig(); setSockets(); setName("GUI"); initGUI(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Main() {\n\t\tsuper();\n\t}", "public Main() {\r\n\t}", "Program createProgram();", "Program createProgram();", "Program createProgram();", "private Main() {\n\n super();\n }", "public Main() {}", "public Main() {\r\n\t\tsuper();\r\n\t\tinitialize();\r\n\r\n\t}", "public Main() {\r\n }", "public Main() {\r\n }", "public Main() {\n }", "public Main() {\n }", "public Main() {\n }", "public Main() {\n \n \n }", "private Main ()\n {\n super ();\n }", "private CommandLine() {\n\t}", "public ProgramWilmaa()\n\t{\n\t}", "private Main()\n {{\n System.err.println ( \"Internal error: \"+\n\t \"unexpected call to default constructor for Main.\" );\n System.exit(-127);\n }}", "public Main() {\n // Required empty public constructor\n }", "public static void main(String[] args) {\n\t\tthisconstructor rv = new thisconstructor();\n\t\n\t\n\t}", "public static void main(String[] args) {\n\t\tConstructor cn=new Constructor(); \r\n\t\t// Note: no need to create object for constructor\r\n\t\r\n\t}", "private Main() {}", "private Instantiation(){}", "public Simulator(){}", "public static void main(String[] args) {\n\t\t\n\t\tConstructor obj = new Constructor(1);\n\t\t\n\t\n\t\t\n\t\t\n\n\t}", "private Main() {\n }", "public Main() {\n this(DEFAULT_SIZE);\n }", "public Main() {\n this(DEFAULT_SIZE);\n }", "Reproducible newInstance();", "private AlgorithmRegistryCLI() {\n super();\n }", "private TetrisMain() {\r\n //prevents instantiation\r\n }", "public static void main(String[] args) {\n new Program();\n }", "public static void main(String[] args) {\n\r\n ContaEspecial contaEspecial1 = new ContaEspecial(\"\", \"\");\r\n // ContaEspecial contaEspecial2 = new ContaEspecial();\r\n }", "private TetrisMain() {\r\n //ensure uninstantiability\r\n }", "public static void main(String[] args) {\n new Main();\n }", "public static void main(String[] args) {\nnew Employee();// Calling the Constructor.\r\n\t}", "public static void main(String[] args) {\r\n\r\n // create new Lab3 objects\r\n Lab3 lab = new Lab3();\r\n\r\n Lab3 lab2 = new Lab3(24);\r\n\r\n Lab3 lab3 = new Lab3(\"James\");\r\n\r\n\r\n // Display lab 3 objects\r\n System.out.println(lab);\r\n\r\n System.out.println(lab2);\r\n\r\n System.out.println(lab3);\r\n }", "public Excellon ()\n {}", "public Calculator() {\r\n\t\t/*\r\n\t\t * Constructor - Method name which has the same class name is called a Consatructor\r\n\t\t */\r\n\t\tSystem.out.println(\"Calling constructor\");\r\n\t}", "public Laboratorio() {}", "public Program7()\n { \n _tc = new TravelingCreature( 200, 200 );\n }", "public ExamMB() {\n }", "public static void main(String[] args) {\n\t\tnew FirstConstructor();\r\n\t\tnew FirstConstructor(\"Baxter\");\r\n\t}", "public HelloWorldProgramOutput ()\n {\n initialize();\n }", "public Programa(ProgramaTokenManager tm) {\n if (jj_initialized_once) {\n System.out.println(\"ERROR: Second call to constructor of static parser. \");\n System.out.println(\" You must either use ReInit() or set the JavaCC option STATIC to false\");\n System.out.println(\" during parser generation.\");\n throw new Error();\n }\n jj_initialized_once = true;\n token_source = tm;\n token = new Token();\n jj_ntk = -1;\n jj_gen = 0;\n for (int i = 0; i < 2; i++) jj_la1[i] = -1;\n }", "private SudokuSolverApplication() {\n\t}", "public static void main(String[] args) throws CloneNotSupportedException {\n\t\tCloneProgram c1=new CloneProgram(1, \"Sagar\");\r\n\t\tCloneProgram c2=(CloneProgram) c1.clone();\r\n\t\tSystem.out.println(c1.id+ \" \"+c1.name);\r\n\t\tSystem.out.println(\"After Cloning\");\r\n\t\t\r\n\t\tSystem.out.println(c2.id+ \" \"+c2.name);\r\n\t\t\r\n\r\n\t}", "private Shell() { }", "public static void main(String[] args) {\n\t\tRoom ru= null;\n\t\t\n\t\tpublic School(Room ru){\n\t\t\tthis.ru= ru;\n\t\t}\n\t\t\n School sc= new School();\n \n\t}", "public VMProcess() \n\t{\n\t\tsuper();\n\t}", "public static void main(String[] args) {\n ConstructorIntro obj2 = new ConstructorIntro(10);\n\n }", "public Game() \n {\n Logger.setLogger(null);\n createInstances();\n parser = new Parser();\n player = new Player();\n userInputs = new ArrayList<String>();\n }", "public Constructor(){\n\t\t\n\t}", "public static void main(String[] args) {\n\t\tThisExample A=new ThisExample(7,8);\n\t}", "public ProgramManager() {\n display = new DisplayManager();\n fileName = \"resources/aLargeFile\";\n try {\n fileReader = new BufferedReader(new FileReader(fileName));\n } catch (FileNotFoundException e) {\n logger.error(e.getMessage());\n }\n wordStorage = new WordStorage();\n }", "public Ruby() {}", "RoverProgram createRoverProgram();", "public static void main(String[] args) {\n PessoaBuilder builder = new PessoaBuilder();\n builder.comNome(\"Roberto\").comAltura(2.).comCorDosOlhos(\"Azul\").comEtnia(\"Afrodescendente\").comPeso(75.);\n Pessoa pessoa = builder.build();\n System.out.println(pessoa);\n\n //Agora usaremos a classe Director, onde podemos ter perfis pré-definidos\n builder.reset();\n Director director = new Director(builder);\n\n //Primeiro uma pessoa obesa\n director.buildFatPerson();\n Pessoa fatPerson = builder.build();\n System.out.println(fatPerson);\n\n //Agora criaremos o Bruce Wayne (ou será o Batman)1\n director.buildBruceWayne();\n Pessoa batman = builder.build();\n System.out.println(batman);\n }", "public Evaluador() {\n aL = new Arguments();\n }", "public static void main(String[] args) {\n new DynamicTicTacToe(); // Let the constructor do the job\n }", "public Playground() {\n }", "public static void main(String[] args) throws IOException {\n\t\t// creating local class objects \n\t\t\n\t}", "public static void main(String args[]) {\n\t\tMaze newMaze = new Maze(2,0);\n\t\n\t}", "public Hacker() {\r\n \r\n }", "public static void main(String[] args) {\n\t\tnew Compo();\r\n\t}", "Cab(){\n\t\tSystem.out.println(\"Cab Object Constructed..\");\n\t}", "public static void main( String[] args ) {\n\t\t\n\t\t//Taking it in order, let's instantiate this first so it can\n\t\t// run the constructor that is just a few lines above us.\n\t\tMainClass main = new MainClass();\n\t\t\n\t\t//After that, we can run the other constructor in the other\n\t\t// class.\n\t\tConstructorClass constructor = new ConstructorClass();\n\t\t\n\t}", "public FeatureSynthesisMain() {\n super();\n }", "public VMProcess() {\n\t\tsuper();\n\t}", "private MazeBuilder() {\n\t}", "public Process() {\n PC.MakeProcess();\n\n }", "public static void main(String[] args) {\n\t\tConstructor con=new Constructor();\n\t\tcon.Print();\n\t\tConstructor co=new Constructor(10,25);\n\t\tco.Print();\n\t\t\n\t\t\n\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\tStudentConstructor S=new StudentConstructor(101,\"ABC\");\r\n\t}", "public ApplicationCreator() {\n }", "private AlgorithmTools() {}", "private Launcher(String[] args) {\n\n\t\t// parse commandline parameters\n\t\tString name = ManagementFactory.getRuntimeMXBean().getName();\n\t\tString home = System.getProperty(Jyro.JYRO_HOME, \".\");\n\t\tfor (String arg : args) {\n\n\t\t\thome = arg;\n\t\t}\n\t\tthis.home = new File(home);\n\t\tthis.name = name;\n\t\tlogger.info(Jyro.JYRO_HOME + \"=\" + this.home);\n\t\treturn;\n\t}", "public static void main(String[] args) {\n\t\tnew Actions();\r\n\t\t//call constructor\r\n\t}", "public Job() {\r\n\t\tSystem.out.println(\"Constructor\");\r\n\t}", "public static void main(String[] args) {\n /**\n * Construction par defaut\n */\n Personne p = new Personne();\n System.out.println(p.toString());\n /**\n * Construction avec comme parametre nom et prenom\n */\n Personne p1 = new Personne(\"Thiaw\",\"Serigne Cheikh Mbacke\");\n System.out.println(p1.toString());\n /**\n * Construction avec comme parametre nom, prenom et age\n */\n Personne p2 = new Personne(\"Thiaw\",\"Serigne Cheikh Mbacke\",22);\n System.out.println(p2.toString());\n /**\n * Construction tous les parametres\n */\n Personne p3= new Personne(\"Thiaw\",\"Serigne Cheikh Mbacke\",22,Sexe.Masculin);\n System.out.println(p3.toString());\n }", "ConstructorPractice () {\n\t\tSystem.out.println(\"Default Constructor\");\n\t}", "public static void main(String[] args) {\n for(int i=0; i<10; i++){\n Constructor c=new Constructor (i);\n c.Constructor(\"Who\");\n \n } \n }", "public static void main(String[] args) {\n\t\tnew Programa();\n\t}", "public Main()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(600, 600, 1); \n\n prepare();\n }", "public Programa(java.io.InputStream stream, String encoding) {\n if (jj_initialized_once) {\n System.out.println(\"ERROR: Second call to constructor of static parser. \");\n System.out.println(\" You must either use ReInit() or set the JavaCC option STATIC to false\");\n System.out.println(\" during parser generation.\");\n throw new Error();\n }\n jj_initialized_once = true;\n try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }\n token_source = new ProgramaTokenManager(jj_input_stream);\n token = new Token();\n jj_ntk = -1;\n jj_gen = 0;\n for (int i = 0; i < 2; i++) jj_la1[i] = -1;\n }", "public Launcher() {\n this((java.lang.System[]) null);\n Launcher$$init$S();\n }", "public static void main(String[] args) {\n car car = new car(8,\"Base Car\");\n System.out.println(car.startEngine());\n System.out.println(car.accelerate());\n System.out.println(car.brake());\n\n //output for the lamborghini car\n lambo gall = new lambo(8,\"Gallardo\");\n System.out.println(gall.startEngine());\n System.out.println(gall.accelerate());\n System.out.println(gall.brake());\n\n //output for the ferrari car\n ferrari ferr = new ferrari(6,\"F30\");\n System.out.println(ferr.startEngine());\n System.out.println(ferr.accelerate());\n System.out.println(ferr.brake());\n\n }", "public Assignement1aMain() {\n\t\t\n\t\t// create components\n\t\tComponent time = create(JavaTimer.class);\n\t\tComponent network = create(MinaNetwork.class);\n\t\tComponent con = create(JavaConsole.class);\n\t\tComponent pp2p = create(DelayLink.class);\n\t\tComponent pfd = create(PFD.class);\n\t\tComponent app = create(Application1a.class);\n\n\t\t// handle possible faults in the components\n\t\tsubscribe(handleFault, time.control());\n\t\tsubscribe(handleFault, network.control());\n\t\tsubscribe(handleFault, con.control());\n\t\tsubscribe(handleFault, pp2p.control());\n\t\tsubscribe(handleFault, pfd.control());\n\t\tsubscribe(handleFault, app.control());\n\n\t\t// initialize the components\n\t\tlong gama=1000;\n\t\tlong delta=4000;\n\t\t\n\t\tAddress self = topology.getSelfAddress();\n\t\tSet<Address> neighborSet = topology.getNeighbors(self);\n\n\t\ttrigger(new MinaNetworkInit(self, 5), network.control());\n\t\ttrigger(new DelayLinkInit(topology), pp2p.control());\n\t\ttrigger(new Application1aInit(commandScript, neighborSet, self, gama, delta), app.control());\n\t\ttrigger(new PfdInit(topology, gama, delta), pfd.control());\n\n\t\t// connect the components\n\t\tconnect(app.required(Console.class),\n\t\t\t\tcon.provided(Console.class));\n\t\tconnect(app.required(PerfectFailureDetector.class),\n\t\t\t\tpfd.provided(PerfectFailureDetector.class));\n\t\tconnect(pfd.required(PerfectPointToPointLink.class),\n\t\t\t\tpp2p.provided(PerfectPointToPointLink.class));\n\t\tconnect(app.required(Timer.class), time.provided(Timer.class));\n\t\t\n\t\tconnect(pfd.required(Timer.class), time.provided(Timer.class));\n\t\tconnect(pp2p.required(Timer.class), time.provided(Timer.class));\n\t\tconnect(pp2p.required(Network.class), network.provided(Network.class));\n\t}", "public Process() {\n\t\tthis(null);\n\t}", "public GuiMainImpl() {\r\n this(null, null, \"\");\r\n }", "public Program3 (String empName) {\r\n\t\tname = empName;\r\n\t}", "public static void main(String[] args) {\n new Main();\r\n }", "public Produto() {}", "public static void main(String[] args){\r\n\t\tnew Book();\r\n\t}", "public static void main(String[] args) {\n\n Sport sport1 = new Sport(\"Ice Hockey\");\n //sport1.setName(\"ice hockey\");\n System.out.println(sport1.getName());\n sport1.description();\n\n Running running = new Running(\"Running\");\n// running.setName(\"Running\");\n running.setDistance(10);\n running.description();\n\n\n //more examples about super\n\n\n\n\n //toString()\n\n //abstract class / method example\n\n //interface\n\n //is-a relationship (instanceof)\n\n //final keyword\n\n }", "public static void main(String[] args) {\n\t\ttoString Obj = new toString(7,7,2015);\n\n\t}", "public static void main(String[] args) throws IOException {\n// new Homework01();\n new Homework02();\n }", "public static void main(String[] args) {\n Computer computer = new Computer.Builder()\n .withCase(\"Tower\")\n .withCPU(\"Intel i5\")\n .withMotherboard(\"MSI B360M-MORTAR\")\n .withGPU(\"nVidia Geforce GTX 750ti\")\n .withHDD(\"Toshiba 1TB\")\n .withOperatingSystem(\"Windows 10\")\n .withPowerSupply(500)\n .withAmountOfRam(8)\n .build();\n /* Not as clean as first example\n\n Computer computer = new Computer(\"Tower\", \"Intel i5\", \"MSI B360M-MORTAR\",\n \"nVidia GeForce GTX 750ti\", \"Toshiba 1TB\", \"Windows 10\", 500, 8);\n */\n }", "public Construct() {\n\tprefixes = new StringBuilder();\n\tvariables = new StringBuilder();\n\twheres = new StringBuilder();\n }", "public Terminal() {\n initComponents();\n }", "public static void main(String[] args) {\n\t\tCar car = new Car(2);\n\t}", "public MonHoc() {\n }" ]
[ "0.73197126", "0.7205143", "0.71512514", "0.71512514", "0.71512514", "0.7134954", "0.7095566", "0.70924395", "0.7033384", "0.7033384", "0.69661415", "0.6944747", "0.6944747", "0.6936601", "0.69190717", "0.6913991", "0.68647724", "0.6828724", "0.67431957", "0.67151153", "0.6700227", "0.6694026", "0.6658847", "0.6631686", "0.66103446", "0.6561119", "0.6528314", "0.6528314", "0.64832985", "0.64723384", "0.6469146", "0.64511216", "0.64131844", "0.6361217", "0.63457257", "0.63367784", "0.6323533", "0.63206494", "0.6303793", "0.62814486", "0.62714833", "0.6268151", "0.626183", "0.62585646", "0.6253013", "0.6245605", "0.6244759", "0.624386", "0.6227546", "0.62188196", "0.62185234", "0.6205889", "0.6203728", "0.6196062", "0.6196011", "0.61933553", "0.61916256", "0.6181811", "0.6166595", "0.6164356", "0.61636263", "0.61627483", "0.6161706", "0.61487997", "0.6118496", "0.6105486", "0.61029667", "0.6100758", "0.60990524", "0.60974354", "0.6097131", "0.6094502", "0.6093296", "0.6093008", "0.6090959", "0.6089084", "0.60885626", "0.6083304", "0.6082069", "0.60755396", "0.60751414", "0.60738", "0.60729074", "0.60728663", "0.60712385", "0.60691375", "0.6053874", "0.60508233", "0.6050811", "0.6045297", "0.6041428", "0.6040124", "0.60366756", "0.6036446", "0.6033453", "0.602597", "0.6019229", "0.601918", "0.6012962", "0.60111237", "0.6010283" ]
0.0
-1
~ methods Main method for running the program
public static void main(final String[] args) { final AR_v4 inst = new AR_v4(); inst.setVisible(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main()\n\t{\n\t}", "public static void main() {\n \n }", "public static void main(){\n\t}", "public void runProgram()\n\t{\n\t\tintro();\n\t\tfindLength();\n\t\tguessLetter();\n\t\tguessName();\n\t}", "public static void main() {\n }", "public static void main(String[] args) throws IOException{\n\t\trunProgram();\n\t}", "public static void main (String [] args){\n\n\n\n \n\n\n\n\n\n \n\n\n\n\n\n\n\n }", "public static void main(String[] args) {\n \n \n \n \n }", "public static void main(String[] args) {\n \n \n \n\t}", "public static void main(String[] args){\r\n\t\t\r\n\tSystem.out.println(\"main method(-)\");\r\n\t\r\n\t}", "public void main(){\n }", "public static void main(String[] args){\n\t\t\n\t\t\n \t}", "public static void main(String args[]) throws Exception\n {\n \n \n \n }", "public static void main(String[] args) {\n \n\n }", "public static void main (String args[]) {\n\t\t\n }", "public static void main(String[] args) {\r\n \r\n }", "public static void main(String[] args) {\r\n \r\n }", "public static void main (String[] args) {\r\n\t\t \r\n\t\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public static void main (String []args){\n }", "public void runProgram() {\n\n\t\tSystem.out.println(\"\\n Time to start the machine... \\n\");\n\n\t\tpress.pressOlive(myOlives);\n\n\t\tSystem.out.println(\"Total amount of oil \" + press.getTotalOil());\n\t}", "public static void main(String[] args){\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n }", "public static void main(String[]args) {\n\t\n\t\t\n\n}", "public static void main(String[] args) {\n \r\n\t}", "public static void main (String [] args){\n\t}", "public static void main(String[] args) {\n\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public static void main(String args[]){\n\t\t\n\t\n\t}", "public static void main(String[] args) {\r\n// Use for unit testing\r\n }", "public static void main(String[] args) {\n\t \t\n\t \t\n\t }", "public static void main(String[] args) \n {\n\t \n\t \n\t \n}", "public static void main (String[] args) {\n\t\t\n\t}", "public static void main(String[] args)\r\n {\r\n \r\n \r\n \r\n }", "public static void main(String[] args) {\n \n \n }", "public static void main(String[] args) {\n \n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n }", "public static void main (String[]args) throws IOException {\n }", "public static void main(String[] args) {\n \n\t}", "public static void main(String... args) {\n doMain().run();\n }", "public static void main(String []args){\n\n }", "public static void main(String[] args) {\n\t \t\n\t \t\n\t}", "public Main() {\n \n \n }", "public static void main(String[] args) {\n\n ArrayClone();\n //ArrayToString();\n //ArrayReverse();\n\n //ForToForeach();\n //SaveOurRAM();\n\n //Homework_Example_1();\n //Homework_Example_2();\n }", "public static void main(String[] args){\n \t\n }", "public static void main(String[] args) {\n\r\n\t\t\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n \n\t}", "public static void main(String[] args){\n\t\t\r\n\t}", "public void Main(){\n }", "public static void main(String[] args)\r\n {\n \r\n \r\n }", "public static void main(String[] args) {\n\n\n\n\n\n\n\n }", "public static void main(String[] args) throws Exception {\n\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t}", "public Main() {\r\n\t\tsuper();\r\n\t\tinitialize();\r\n\r\n\t}", "public static void main(String[] args) {\n\r\n\t\t\r\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t\t\n\n\t}", "public static void main(String args[]) throws IOException {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\tSystem.out.println(\"main method\");\n\t\ttest();\n\t\t//RunprogramwithoutObject.test();// no need to create any object of class\n\t\tcover();\n\n\t}", "public static void main(String[] args) {\n\n experiment();\n }", "public static void main(String[] args) {}", "public static void main(String[] args) {}", "public static void main(String[] args) {\n\t\t\r\n\t\t\r\n\r\n\t}", "public static void main(String args[]) {\r\n }", "public static void main(String[] args) {\r\n\t\t\r\n\t\t\r\n\t}", "public static void main(String []args){\n }", "public static void main(String []args){\n }", "public static void main(String[] args) {\n \n }", "public static void main(String[] args) {\n \n\t\t}", "public static void main(String args[]){\n\t\t\r\n\t}", "public static void main(String args[]){\n\t\t\n\t}", "public static void main(String[] args) {\t\n\t\t\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\t\r\n\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\r\n\r\n\t}", "public static void main(String args[]){\n \t\n \t\n }", "public Main() {\n\t\tsuper();\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\r\n\t\t//method body\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n //launch it\n launch();\n }", "public static void main(String[] args) {\n\t\t \n\t}", "static void main(String[] args)\n {\n }", "public static void main(String[] args) {\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\tSystem.out.println(\"Start main\");\r\n\t\tSystem.out.println(\"sum of two num :\"+ new AppManager().sum(5,10));\r\n\t\tSystem.out.println(\"End main\");\r\n\t\t\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t\t\n\n\t}", "public static void main(String args[]){\n }", "public static void main(String[] args) {\r\n\t\t\r\n\t\t\r\n\r\n\t}", "public static void main(String[] args) {\t}", "public static void main(String[] args) {\n\t\t\n\t\t\n\n\t}", "public static void main(String[] args)\n\t{\n\n\n\n\n\n\n\t}" ]
[ "0.80214846", "0.79791105", "0.78950727", "0.77257246", "0.7657479", "0.7609547", "0.7553716", "0.75410146", "0.7501752", "0.7500031", "0.74919444", "0.7487801", "0.7472238", "0.7459233", "0.74519867", "0.744447", "0.744447", "0.74396247", "0.7433389", "0.7433389", "0.74326414", "0.74325657", "0.74250406", "0.74071026", "0.7405719", "0.73921335", "0.7366225", "0.73624027", "0.7352529", "0.7347788", "0.7344013", "0.73408186", "0.7338065", "0.7336856", "0.7336856", "0.7321515", "0.7321515", "0.7321515", "0.7321515", "0.7321515", "0.7321515", "0.7313234", "0.73063934", "0.73026836", "0.7302214", "0.7301339", "0.729196", "0.7289787", "0.7289604", "0.7289425", "0.7278881", "0.7274412", "0.72714555", "0.72681385", "0.7264952", "0.7261375", "0.7259166", "0.7257934", "0.7257899", "0.7257208", "0.7253358", "0.725192", "0.72507405", "0.72496164", "0.72496164", "0.72494435", "0.72451043", "0.72328806", "0.7231786", "0.7231786", "0.723127", "0.7231082", "0.7229574", "0.72252434", "0.7225225", "0.7224798", "0.7221891", "0.72208005", "0.72187555", "0.72187555", "0.72187555", "0.72187555", "0.7217279", "0.72138965", "0.72138965", "0.72138965", "0.72138965", "0.72117096", "0.72095394", "0.7208017", "0.7207885", "0.7207885", "0.7207885", "0.7207885", "0.72023445", "0.71968704", "0.71964973", "0.7194846", "0.71936077", "0.7193143", "0.71913326" ]
0.0
-1
Upon minimization, the frame is hidden and an icon is added to the system tray
public void windowIconified(WindowEvent arg0) { ti.setImageAutoSize(true); try { SystemTray.getSystemTray().add(ti); cms.setVisible(false); ti.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent arg0) { SystemTray.getSystemTray().remove(ti); cms.setVisible(true); cms.setState(JFrame.NORMAL); } public void mouseEntered(MouseEvent arg0) { // Unused } public void mouseExited(MouseEvent arg0) { // Unused } public void mousePressed(MouseEvent arg0) { // Unused } public void mouseReleased(MouseEvent arg0) { // Unused } }); } catch (AWTException e) { e.printStackTrace(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void minimize()\n {\n this.setExtendedState(JFrame.ICONIFIED);\n }", "public void setTrayIcon()\n\t{\n\t\tImage image = new Image(display, PropertyManager.getInstance().getProperty(\"ICON_FOLDER\"));\n\t\tfinal Tray tray = display.getSystemTray();\n\n\t\tif (tray == null)\n\t\t{\n\t\t\tSystem.out.println(\"The system tray is not available\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfinal TrayItem item = new TrayItem(tray, SWT.NONE);\n\t\t\titem.setToolTipText(PropertyManager.getInstance().getProperty(\"SOFT_INFO\"));\n\n\t\t\tfinal Menu menu = new Menu(shell, SWT.POP_UP);\n\n\t\t\tMenuItem mi1 = new MenuItem(menu, SWT.PUSH);\n\t\t\tMenuItem mi2 = new MenuItem(menu, SWT.PUSH);\n\t\t\tMenuItem mi3 = new MenuItem(menu, SWT.PUSH);\n\t\t\tMenuItem mi4 = new MenuItem(menu, SWT.PUSH);\n\n\t\t\tmi1.setText(\"Show\");\n\t\t\tmi1.addListener(SWT.Selection, new Listener()\n\t\t\t{\n\t\t\t\tpublic void handleEvent(Event event)\n\t\t\t\t{\n\t\t\t\t\tshell.setVisible(true);\n\t\t\t\t\tSystem.out.println(\"selection \" + event.widget);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tmi2.setText(\"Hide\");\n\t\t\tmi2.addListener(SWT.Selection, new Listener()\n\t\t\t{\n\t\t\t\tpublic void handleEvent(Event event)\n\t\t\t\t{\n\t\t\t\t\tshell.setVisible(false);\n\t\t\t\t\tSystem.out.println(\"selection \" + event.widget);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tmi3.setText(\"Change Operator\");\n\t\t\tmi3.addListener(SWT.Selection, new Listener()\n\t\t\t{\n\t\t\t\tpublic void handleEvent(Event event)\n\t\t\t\t{\n\t\t\t\t\tlogin = \"\";\n\t\t\t\t\tpassword = \"\";\n\t\t\t\t\tInputDialog opDialog = new InputDialog(shell, SWT.DIALOG_TRIM);\n\t\t\t\t\tshell.setEnabled(!shell.getEnabled());\n\t\t\t\t\tshell.setCursor(new Cursor(display, SWT.CURSOR_WAIT));\n\t\t\t\t\tString credential = opDialog.createDialogArea();\n\t\t\t\t\tlogin = credential.substring(0, credential.indexOf(File.separator));\n\t\t\t\t\tpassword = credential.substring(credential.indexOf(File.separator));\n\t\t\t\t\tshell.setEnabled(true);\n\t\t\t\t\tshell.setCursor(new Cursor(display, SWT.CURSOR_ARROW));\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tmi4.setText(\"Close\");\n\t\t\tmi4.addListener(SWT.Selection, new Listener()\n\t\t\t{\n\t\t\t\tpublic void handleEvent(Event event)\n\t\t\t\t{\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t\tSystem.out.println(\"selection \" + event.widget);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\titem.addListener(SWT.MenuDetect, new Listener()\n\t\t\t{\n\t\t\t\tpublic void handleEvent(Event event)\n\t\t\t\t{\n\t\t\t\t\tmenu.setVisible(true);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\titem.setImage(image);\n\t\t}\n\t}", "public void iconify(final GFrame frame) {\r\n\r\n\t\tframe.setVisible(false);\r\n\r\n\t\taddButton(frame);\r\n\t}", "public void minimizeProgram() {\n Stage stage = (Stage) minimize.getScene().getWindow();\n stage.setIconified(true);\n }", "public static void startTrayIcon() {\r\n try {\r\n \tUIManager.setLookAndFeel(\"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel\");\r\n } catch (Exception ex) {\r\n \tJOptionPane.showMessageDialog(null, \"Error setting Look & Feel \"+ex, \"Error setting Look & Feel\", JOptionPane.ERROR_MESSAGE);\r\n }\r\n /* Turn off metal's use of bold fonts */\r\n UIManager.put(\"swing.boldMetal\", Boolean.FALSE);\r\n //Schedule a job for the event-dispatching thread:\r\n //adding TrayIcon.\r\n SwingUtilities.invokeLater(new Runnable() {\r\n public void run() {\r\n createAndShowGUI();\r\n }\r\n });\r\n }", "private void jb_minimizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_minimizeActionPerformed\n this.setState(MainFrame.ICONIFIED);\n }", "public void becomeEaten(){\n\t\tthis.setIcon(null);\n\t}", "private void jb_MinimizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_MinimizeActionPerformed\n this.setState(HomeFrame.ICONIFIED);\n }", "public void setFrameIcon()\n {\n URL imageURL = HelpWindow.class.getResource(\"/resources/images/frameicon.png\");\n Image img = Toolkit.getDefaultToolkit().getImage(imageURL);\n \n if(imageURL != null)\n {\n ImageIcon icon = new ImageIcon(img);\n super.setIconImage(icon.getImage());//window icon\n }\n }", "public void maximalizeIconClicked(MouseEvent event) {\n if (stage.isFullScreen())\n stage.setFullScreen(false);\n else\n stage.setFullScreen(true);\n }", "public void windowIconified(WindowEvent arg0) {\n //textArea1.append(\"Window is minimized\");\n\n }", "private void updateDockIconPreviewLater() {\n\t\tEventQueue.invokeLater( () -> {\n\t\t\tif( dockIcon != null )\n\t\t\t\tupdateDockIconPreview();\n\t\t} );\n\t}", "@FXML\n private void minimizeSystem(){\n Stage obj = (Stage) minimizeButton.getScene().getWindow();\n obj.setIconified(true);\n }", "@Override\n\t\t\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\tpublic void windowIconified(WindowEvent arg0) {\n\n\t}", "public void clearMainIcon();", "@Override\n\tpublic void windowIconified(WindowEvent arg0)\n\t{\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent arg0)\n\t{\n\t\t\n\t}", "private void setIcon() {\n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"iconeframe.png\")));\n }", "private void setIcon() {\n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"iconeframe.png\")));\n }", "@Override\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\t\t\r\n\t\t\t}", "public void showIcon(){\n\n lockScreenImageView.animate()\n .alpha(1.0f)\n .setDuration(iconHidingAnimationTime);\n shiftIconToScreenSide(2, -delta/2,\n screenWidth - iconWidth - delta/2);\n }", "public void windowIconified(WindowEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\r\n\t}", "@Override\n\t\tpublic void windowIconified(WindowEvent arg0) {\n\t\t\t\n\t\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t}", "@Override\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\n\t\t\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\n\t}", "@Override\n public void windowIconified(WindowEvent e)\n {\n\n }", "private void minimizeBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_minimizeBtnMouseClicked\n this.setState(JFrame.ICONIFIED);\n }", "@Override\r\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\r\n\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent e) {\n\t\t\r\n\t}", "@Override\n public void windowIconified(WindowEvent arg0) {\n\n }", "private void addApplicationSystemTray()\n {\n // Check if the OS has a system tray\n if (SystemTray.isSupported())\n {\n SystemTray tray = SystemTray.getSystemTray();\n \n // Create the popup menu of the system tray\n GenericPopupMenu.PopupMenuType popupMenuType = (OSUtil.IS_MAC ? GenericPopupMenu.PopupMenuType.AWT : GenericPopupMenu.PopupMenuType.SWING);\n this.popupMenu = new GenericPopupMenu(popupMenuType, \"\");\n GenericMenuItem.MenuItemType menuItemType = (OSUtil.IS_MAC ? GenericMenuItem.MenuItemType.AWT : GenericMenuItem.MenuItemType.SWING);\n GenericMenuItemSeparator.MenuItemSeparatorType menuItemSeparatorType = (OSUtil.IS_MAC ? GenericMenuItemSeparator.MenuItemSeparatorType.AWT : GenericMenuItemSeparator.MenuItemSeparatorType.SWING);\n this.popupMenu_ShowApp = new GenericMenuItem(menuItemType, \"Afficher l'application\");\n this.popupMenu_Blanc1 = new GenericMenuItemSeparator(menuItemSeparatorType);\n this.popupMenu_PauseStart = new GenericMenuItem(menuItemType, \"Pause\");\n this.popupMenu_Blanc2 = new GenericMenuItemSeparator(menuItemSeparatorType);\n this.popupMenu_Profiles = new GenericMenuItem(menuItemType, \"Profils\");\n this.popupMenu_Blanc3 = new GenericMenuItemSeparator(menuItemSeparatorType);\n this.popupMenu_Logs = new GenericMenuItem(menuItemType, \"Consulter les logs\");\n this.popupMenu_Parameters = new GenericMenuItem(menuItemType, \"Paramètres\");\n this.popupMenu_Blanc4 = new GenericMenuItemSeparator(menuItemSeparatorType);\n this.popupMenu_Quit = new GenericMenuItem(menuItemType, \"Quitter\");\n \n // Display the top item in bold only on Windows\n if (OSUtil.IS_WINDOWS)\n this.popupMenu_ShowApp.setFont(new Font(menuProfiles.getFont().getName(), Font.BOLD, menuProfiles.getFont().getSize()));\n \n this.popupMenu_Quit.addActionListener( new ActionListener()\n {\n @Override\n public void actionPerformed(ActionEvent e)\n {\n System.exit(0);\n }\n });\n this.popupMenu_ShowApp.addActionListener( new ActionListener()\n {\n @Override\n public void actionPerformed(ActionEvent e)\n {\n setState(FrmMain.NORMAL);\n setVisible(true);\n }\n });\n this.popupMenu_PauseStart.addActionListener( new ActionListener()\n {\n @Override\n public void actionPerformed(ActionEvent e)\n {\n if (popupMenu_PauseStart.getLabel().equalsIgnoreCase(I18nUtil.getInstance().getI18nMsg(\"fr.davidbrun.wifiautoconnect.views.FrmMain.popupMenu_PauseStart.Start\")))\n {\n popupMenu_PauseStart.setLabel(I18nUtil.getInstance().getI18nMsg(\"fr.davidbrun.wifiautoconnect.views.FrmMain.popupMenu_PauseStart.Pause\"));\n }\n else if (popupMenu_PauseStart.getLabel().equalsIgnoreCase(I18nUtil.getInstance().getI18nMsg(\"fr.davidbrun.wifiautoconnect.views.FrmMain.popupMenu_PauseStart.Pause\")))\n {\n popupMenu_PauseStart.setLabel(I18nUtil.getInstance().getI18nMsg(\"fr.davidbrun.wifiautoconnect.views.FrmMain.popupMenu_PauseStart.Start\"));\n }\n }\n });\n this.popupMenu_Parameters.addActionListener( new ActionListener()\n {\n @Override\n public void actionPerformed(ActionEvent e)\n {\n new FrmParameters(FrmMain.this, true).setVisible(true);\n }\n });\n this.popupMenu.addMenuItem(this.popupMenu_ShowApp);\n this.popupMenu.addMenuItemSeparator(this.popupMenu_Blanc1);\n this.popupMenu.addMenuItem(this.popupMenu_PauseStart);\n this.popupMenu.addMenuItemSeparator(this.popupMenu_Blanc2);\n this.popupMenu.addMenuItem(this.popupMenu_Profiles);\n this.popupMenu.addMenuItemSeparator(this.popupMenu_Blanc3);\n this.popupMenu.addMenuItem(this.popupMenu_Logs);\n this.popupMenu.addMenuItem(this.popupMenu_Parameters);\n this.popupMenu.addMenuItemSeparator(this.popupMenu_Blanc4);\n this.popupMenu.addMenuItem(this.popupMenu_Quit);\n \n // Create the system tray\n GenericTrayIcon.TrayIconType trayIconType = (OSUtil.IS_MAC ? GenericTrayIcon.TrayIconType.DEFAULT : GenericTrayIcon.TrayIconType.CUSTOM);\n systemTray = new GenericTrayIcon(trayIconType,\n ResourcesUtil.SYSTEM_TRAY_IMAGE_ICON.getImage(),\n FrmMainController.APP_NAME,\n this.popupMenu.getCurrentPopupMenu());\n \n //To catch events on the popup menu\n systemTray.setImageAutoSize(true);\n systemTray.addActionListener(new ActionListener()\n {\n @Override\n public void actionPerformed(ActionEvent e)\n {\n // TODO: manage double-click\n }\n });\n \n try\n {\n if (OSUtil.IS_MAC)\n tray.add((TrayIcon)systemTray.getCurrentTrayIcon());\n else\n tray.add((JTrayIcon)systemTray.getCurrentTrayIcon());\n }\n catch (Exception e)\n { }\n }\n else // If there is no system tray, we don't do anything\n { }\n }", "@Override\n\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\n\t\t}", "@Override\n\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\n\t\t}", "public ShutDown() {\n initComponents();\n this.setPreferredSize(new Dimension(365, 335));\n this.setMaximumSize(new Dimension(365, 335));\n this.setMinimumSize(new Dimension(365, 335));\n this.setBounds(600, 80, 365, 335);\n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"/Pictures/icon.jpg\")));\n\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\n public void windowIconified(WindowEvent e) {\n }", "@Override\r\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void windowIconified(WindowEvent e) {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n public void windowIconified(WindowEvent e) {\n }", "@Override\n\tpublic void windowIconified(WindowEvent e)\n\t{\n\n\t}", "private void SetIcon() {\n \n setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(\"appIcon.png\")));\n }", "@Override\n\t\t\tpublic void windowIconified(WindowEvent arg0) {\n\n\t\t\t}", "@Override\r\n\tpublic void windowIconified(WindowEvent e) {\n\r\n\t}" ]
[ "0.7059582", "0.684424", "0.6839764", "0.66774565", "0.66717494", "0.66469055", "0.6638335", "0.659402", "0.6584175", "0.6559478", "0.6513597", "0.64635444", "0.64329535", "0.6431871", "0.6431871", "0.643182", "0.6429016", "0.64060575", "0.64060575", "0.6405762", "0.6405762", "0.6400573", "0.6400573", "0.6400573", "0.6400573", "0.6400573", "0.6399936", "0.63936406", "0.6387732", "0.63859713", "0.63859713", "0.63859713", "0.63859713", "0.63859713", "0.63859713", "0.63859713", "0.63859713", "0.6378951", "0.6349909", "0.6345058", "0.6345058", "0.6345058", "0.6345058", "0.6345058", "0.6336825", "0.6336825", "0.6336825", "0.6336825", "0.6336825", "0.6336825", "0.6336825", "0.63341135", "0.63341135", "0.63341135", "0.63341135", "0.63341135", "0.63341135", "0.63341135", "0.63341135", "0.63341135", "0.6334073", "0.63337183", "0.6328999", "0.6328999", "0.6328999", "0.6328999", "0.6328999", "0.63183486", "0.63144445", "0.63128275", "0.63128275", "0.6307873", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.63061607", "0.6305692", "0.6305692", "0.6293247", "0.6293209", "0.6288312", "0.62876314", "0.6286108" ]
0.7433465
0
Overrides the default JPanel paint method to paint the background image
public void paintComponent(Graphics g) { g.drawImage(back, 0, 0, null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public void paintComponent(Graphics g) {\r\n\r\n //Paint background\r\n g.drawImage (background, 0, 0, null);\r\n }", "@Override\r\n\tpublic void paintComponent (Graphics g) {\r\n\t\tsuper.paintComponent(g);\r\n\t\tg.drawImage(background, 0, 0, 800, 660, null);\r\n\t}", "@Override\n public void paintComponent(Graphics g) {\n super.paintComponent(g); // paint parent's background\n setBackground(Color.WHITE); // set background color for this JPanel\n if (img != null) {\n g.drawImage(img, 100, 100, this);\n }\n }", "@Override\n protected void paintBackground(Graphics2D g) {\n g.drawImage(image, 0, 0, this);\n }", "@Override\n\t\t\tpublic void paintControl(PaintEvent arg0) {\n\t\t\t\tgc.drawImage(background,0,0);\n\t\t\t}", "@Override\n public void paintComponent(Graphics g) {\n super.paintComponent(g);\n\n paintBackground(g);\n }", "@Override\n\t\t\tprotected void paintComponent(Graphics g) {\n\t\t\t\tGraphics2D g2d = (Graphics2D) g;\n\t\t g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\n\t\t RenderingHints.VALUE_ANTIALIAS_ON);\n\t\t \n\t\t GradientPaint gp = new GradientPaint(0, 0,\n\t\t Const.BACKGROUND_COLOR.brighter(), 0, getHeight(),\n\t\t Color.BLUE);\n\t\t \n\t\t g2d.setPaint(gp);\n\t\t g2d.fillRect(0, 0, getWidth(), getHeight());\n\n\t\t\t\tsuper.paintComponent(g);\n\t\t\t}", "public void paintComponent(Graphics graphics) {\n graphics.drawImage(background, 0, 0, null);\n }", "@Override\n protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {\n }", "@Override\n public void paint(Graphics g) {\n\tsuper.paint(g);\n\t// getContentPane().setBackground(Color.orange);\n\timg = Util.createImage(getContentPane());\n\tbackColor = new Color(img.getRGB(3, 3));\n\t// img.getGraphics().setColor(Color.blue);\n\t// img.getGraphics().fillRect(0, 0, img.getWidth(), img.getHeight());\n\tdrawEntrance(new Point(557, 70), 0, img.getGraphics());\n\tgetContentPane().getGraphics().drawImage(img, 0, 0, null);\n\tanimate(g);\n\t// img = Util.createImage(getContentPane());\n\n }", "@Override\n public void paint(Graphics g) {\n g.drawImage(imgFond.getImage(), 0, 0, getWidth(), getHeight(),this);\n setOpaque(false);\n super.paint(g);\n }", "public void paintComponent(Graphics g) {\r\n super.paintComponent(g);\r\n if (isDrawBackground()) {\r\n paintComponentBackground(g, getBackgroundInsets(), getUiPrefs().getBackgroundColor());\r\n } else if (!isBackgroundTransparent()) {\r\n paintComponentBackground(g, null, Color.WHITE);\r\n }\r\n if (isDrawBorder()) {\r\n paintComponentBorder(g);\r\n }\r\n }", "@Override\n protected void paintComponent(final Graphics g) {\n super.paintComponent(g);\n g.drawImage(image, 0, 0, this);\n }", "private void drawBackground() {\n\t\timgG2.setColor(Color.BLACK);\n\t\timgG2.fillRect(0,0,512, 512);\n\t\t\n\t\timgG2.setColor(Color.BLACK);\n\t\timgG2.fillRect(128, 0, 256, 512);\n\t}", "@Override\n public void paintComponent(Graphics g) {\n super.paintComponent(g);\n g.drawImage(img, 0, 0, null);\n }", "@Override\n\tpublic void paintComponent(Graphics g) {\n\t\tsuper.paintComponents(g);\n\t\tg.drawImage(img, 0, 0, sizeX, sizeY, this);\n\t}", "@Override\n\tpublic void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\t\tg.drawImage(image, 310, 40, 200, 150, this);\n\t}", "public void paintComponent(Graphics g) {\n\t\tImage bg1 = null;\r\n\t\ttry {\r\n\t\t\t bg1 = ImageIO.read(new File(\"background.png\"));\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t\r\n\t\tg.drawImage(bg1,0,0,null);\r\n\t\trepaint();\t\r\n\t\r\n\t}", "@Override\r\n public void paintComponent(Graphics g) {\n super.paintComponent(g);\r\n Graphics2D g2d = (Graphics2D) g;\r\n g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r\n RenderingHints.VALUE_ANTIALIAS_ON);\r\n g2d.setRenderingHint(RenderingHints.KEY_RENDERING,\r\n RenderingHints.VALUE_RENDER_QUALITY);\r\n \r\n\r\n Image icon = new ImageIcon(getClass().getClassLoader().getResource(\"wallpaper.jpg\")).getImage();\r\n g2d.drawImage(icon,0,0,this);\r\n //drawScenario(g2d);\r\n if(currentState == Common.GAME_STATE.INGAME){\r\n drawGaming(g2d);\r\n }\r\n if(currentState == Common.GAME_STATE.MENU || currentState == Common.GAME_STATE.LOSE){\r\n drawMenu(g2d);\r\n }\r\n\r\n Toolkit.getDefaultToolkit().sync();\r\n }", "@Override\n\tpublic void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\t\tg.drawImage(image, 0, 0, getWidth(), getHeight(), null);\n\t}", "@Override\n public void paintComponent(Graphics g) {\n // Paint image on panel\n if (paint && image != null) {\n g.drawImage(image, 0, 0, this);\n } else {\n // Paint panel black\n g.setColor(Color.white);\n g.fillRect(0, 0, getWidth(), getHeight());\n }\n }", "@Override\n protected void paintBackground(Graphics2D g) {\n super.paintBackground(g);\n if (Game.level == 0) {\n g.drawImage(bg, 0, 0, this);\n } else if (Game.level == 1) {\n g.drawImage(bg, 0, 0, this);\n } else if (Game.level == 2) {\n g.drawImage(bg2, 0, 0, this);\n } else if (Game.level == 3) {\n g.drawImage(bg3, 0, 0, this);\n }\n\n }", "public void paintComponent(Graphics g) {\n super.paintComponent(g);\n drawImage(g);\n }", "public void paint(Graphics g){\n\t\tsuper.paint(g);\n\t\t//the Background\n\t\tg.drawImage(background, 0, 0, null);\n\t\t\n\t\t//Pad 1\n\t\tg.drawImage(pad1, pad1_x, pad1_y, null);\n\t\t\n\t\t//Pad 2\n\t\tg.drawImage(pad2, pad2_x, pad2_y, null);\n\t}", "protected void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\t\tImageIcon background = new ImageIcon(\"pictures\\\\到达单填写right.png\");\n\t\tImage bg = background.getImage();\n\t\tg.drawImage(bg, 0, 0, frameWidth / 4 * 3, frameHeight, null);\n\t}", "@Override\r\n\tprotected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {\n\t\tResourceLocation texture = new ResourceLocation(\"textures/gui/container/hopper.png\");\r\n\t\tthis.mc.renderEngine.bindTexture(texture);\r\n\t\tint x = (width - xSize) / 2;\r\n\t\tint y = (height - ySize) / 2;\r\n\t\tthis.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);\r\n\t\t\r\n\t\t/*int progress = Math.round(24 * (40 - te.getTime()) / 40.0f);\r\n\t\tif(te.getTime() == 0) {\r\n\t\t\tprogress = 0;\r\n\t\t}\r\n\t\tthis.drawTexturedModalRect(x+79, y+29, 176, 0, 17, progress);*/\r\n\t}", "@Override\n public void paintComponent (Graphics g)\n {\n ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\n g.setColor(BACKGROUND_COLOR);\n g.fillRect(0, 0, getHeight(), getHeight());\n g.setColor(color);\n g.fillOval(0, 0, 30, 30);\n }", "public void paint() {\n BufferStrategy bs;\n bs = this.getBufferStrategy();\n\n Graphics g = bs.getDrawGraphics();\n g.drawImage(background, 0, 0, this.getWidth(), this.getHeight(), null);\n if (this.blackHoles != null) {\n for (BlackHole blackHole : this.blackHoles) {\n blackHole.paint(g);\n }\n }\n if (this.balls != null) {\n for (int i = 0; i <this.balls.size() ; i++) {\n this.balls.get(i).paint(g);\n }\n\n }\n\n bs.show();\n g.dispose();\n\n }", "protected void paintBackground(Graphics g){\n Dimension size = getSize();\n\n g.setColor(properties.backgroundColor);\n g.fillRect(0,0,size.width,size.height);\n\n }", "public void paintComponent(Graphics g) {\r\n\t\tsuper.paintComponent(g);\r\n\t\ttry {\r\n\t\t\tBufferedImage image = ImageIO.read(new File(\r\n\t\t\t\t\tGraphicalParameters.BACKGROUND_IMAGE_PATH_NAME));\r\n\t\t\tg.drawImage(image, 0, 0, null);\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "@Override\r\n\tpublic void paint(Graphics g) {\n\t\tg.drawImage(BG_LIST.get(this.dto.getNowlevel()%BG_LIST.size()), 0, 0,1200,700, null);\r\n\t\t\r\n\r\n\t}", "@Override\n\t\tprotected void paintComponent(Graphics g) {\n\t\t\tint width = getWidth();\n\t\t\tint height = getHeight();\n\t\t\tint x = (width - icon.getIconWidth()) / 2;\n\t\t\tint y = icon.getIconHeight() / 2;\n\t\t\tg.setColor(Color.darkGray);\n\t\t\tg.fillRect(0, 0, width, height);\n\t\t\ticon.paintIcon(this, g, x, y);\n\t\t}", "@Override\n\n protected void paintComponent(Graphics g) {\n\n\t\tint width = getWidth();\n\t\tint height = getHeight();\n\t\t \n\t\tsuper.paintComponent(g);\n\t\t\n\t\t// draw the landscape in greyscale as an image\n\t\tif (land.getImage() != null){\n\t\t\tg.drawImage(land.getImage(), 0, 0, null);\n\t\t}\n\t\t//?paid overlay image graphic from water.getImage()\n\t\tflood.deriveImage();\n\t\tif(flood.getImage() != null){\n\t\t\tg.drawImage(flood.getImage(),0,0,null);\n\t\t}\n\t\t/**\n\t\tBufferedImage background = land.getImage();\n\t\tBufferedImage foreground = flood.getImage();\n\t\tBufferedImage overlayedImage = overLa\n\t\t**/\n\t}", "@Override\r\n\tpublic void renderBackground() {\n\r\n\t}", "public void paint(Graphics g){\r\n \t/*\r\n \t * override default paint to draw \r\n \t * screen image in panel using current\r\n \t * scn_background.\r\n \t */\r\n \tg.drawImage(scn_image,0,0,scn_width,scn_height,scn_background_color,this);\r\n }", "@Override\n protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)\n {\n GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);\n this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);\n int i = (this.width - this.xSize) / 2;\n int j = (this.height - this.ySize) / 2;\n this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);\n this.drawTexturedModalRect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);\n }", "private void draw() {\n Graphics2D g2 = (Graphics2D) image.getGraphics();\n\n g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\n g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);\n\n AffineTransform transform = AffineTransform.getTranslateInstance(0, height);\n transform.concatenate(AffineTransform.getScaleInstance(1, -1));\n g2.setTransform(transform);\n\n int width = this.width;\n int height = this.height;\n if (scale != 1) {\n g2.scale(scale, scale);\n width = (int) Math.round(width / scale);\n height = (int) Math.round(height / scale);\n }\n AbstractGraphics g = new GraphicsSWT(g2);\n\n g.setScale(scale);\n if (background != null) {\n g.drawImage(background, 0, 0, width, height);\n }\n\n synchronized (WFEventsLoader.GLOBAL_LOCK) {\n for (Widget widget : widgets) {\n if (widget != null) widget.paint(g, width, height);\n }\n }\n // draw semi-transparent pixel in top left corner to workaround famous OpenGL feature\n g.drawRect(0, 0, 1, 1, Color.WHITE, .5, PlateStyle.RectangleType.SOLID);\n\n g2.dispose();\n }", "public void paintComponent(Graphics g)\n\t\t{\n\t\t super.paintComponents(g);\n\t\t g.drawImage(img,0,0,this.getWidth(),this.getHeight(),this);\n\t\n\t\t}", "protected void drawForegroundToBackground() {\n if (backgroundColor == null) { return; }\n\n final BufferedImage backgroundBufferedImage = new BufferedImage(dimension.width, dimension.height, this.bufferedImage.getType());\n final Graphics graphics = backgroundBufferedImage.getGraphics();\n\n // draw current color\n graphics.setColor(backgroundColor);\n graphics.fillRect(0, 0, dimension.width, dimension.height);\n graphics.drawImage(bufferedImage, 0, 0, null);\n\n // draw back to original\n final Graphics graphics2 = bufferedImage.getGraphics();\n graphics2.drawImage(backgroundBufferedImage, 0, 0, null);\n }", "protected void paintComponent(Graphics g) {\n super.paintComponent(g);\n g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters \n }", "private void drawBackground(Graphics2D g2d, ScreenParameters screenParameters) {\n Composite defaultComposite = g2d.getComposite();\n g2d.setComposite(LOW_OPACITY);\n g2d.drawImage(background, 0, 0, screenParameters.x, screenParameters.y, null);\n g2d.setComposite(defaultComposite);\n }", "protected void paintComponent(Graphics g) {\n g.setColor(getBackground());\n g.fillRect(0, 0, getWidth(), getHeight());\n int x = (getWidth() - image.getWidth(null)) / 2;\n int y = (getHeight() - image.getHeight(null)) / 2;\n if (((BufferedImage) image).getType() != BufferedImage.BITMASK) {\n g.drawImage(image, x, y, this);\n }\n }", "public void paintComponent(Graphics thing)\n {\n int frameHeigth = PiSaver.getFrameHeight();\n int frameWidth = PiSaver.getFrameWidth();\n \n super.paintComponent(thing);\n if (frameHeigth > 0 && frameWidth > 0)\n {\n thing.drawImage(backgroundList.get(g_iBackgroundIndex), 0, 0, this);\n }\n \n thing.setColor(Color.yellow);\n thing.fillPolygon(myPi);\n }", "protected void paintComponentWithPainter(Graphics2D g)\n/* */ {\n/* 200 */ if (this.ui != null)\n/* */ {\n/* */ \n/* */ \n/* 204 */ Graphics2D scratchGraphics = (Graphics2D)g.create();\n/* */ try {\n/* 206 */ scratchGraphics.setColor(getBackground());\n/* 207 */ scratchGraphics.fillRect(0, 0, getWidth(), getHeight());\n/* 208 */ paintPainter(g);\n/* 209 */ this.ui.paint(scratchGraphics, this);\n/* */ }\n/* */ finally {\n/* 212 */ scratchGraphics.dispose();\n/* */ }\n/* */ }\n/* */ }", "@Override\n\tprotected void drawBackground(Graphics2D g2) {\n\t\tg2.setColor(BACKGROUND_FILL_COLOR);\n\t\tg2.fillRect(0, 0, this.getWidth(), this.getHeight());\n\t}", "public void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\t\tGraphics2D graphic = (Graphics2D) g;\n\t\tgraphic.setColor(new Color(221, 48, 60));\n\t\tgraphic.fillRect(0, 0, rectWidth, rectHeight);\n\t\tImage img = ImportServerImages.logoBackground;\n\t\tgraphic.drawImage(img, rectWidth/6, rectHeight/6, rectWidth-rectWidth/3, rectHeight-rectHeight/3, this);\n\t\t\t\n\t\t}", "protected void drawGUI() {\n batch.draw(background, 0, 0);\n }", "@Override\r\n\tprotected void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\r\n\t\tImageIcon img = new ImageIcon(this.getClass().getResource(\"After-Noon.png\"));\r\n\t\tg.drawImage(img.getImage(), 0, 0, this.getWidth(), this.getHeight(), null);\r\n\t}", "@Override\r\n protected void paintIconImpl(Component c, Graphics2D g2, int x, int y, int width, int height) {\r\n Paint background = getBackground();\r\n if (background == null) {\r\n background = c == null ? Color.WHITE : c.getBackground();\r\n }\r\n\r\n if (background != null) {\r\n if (background instanceof Color) {\r\n g2.setColor((Color) background);\r\n } else {\r\n background = PaintUtils.resizeGradient(background, width, height);\r\n g2.setPaint(background);\r\n }\r\n g2.fillRect(x, y, width, height);\r\n }\r\n }", "@Override\n\tpublic void render(Graphics g) {\n\t\tg.drawImage(Game.background, 0, 0, 5200, 700, null);\n\t}", "@Override\n protected void drawGuiContainerBackgroundLayer(final float opacity, final int x, final int y)\n {\n GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);\n ResourceHandler.bindGUI(mc, EnumModeled.machineGrinder.name());\n final int xStart = (width - xSize) / 2;\n final int yStart = (height - ySize) / 2;\n drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);\n int scale;\n if (grinderL.canRun())\n {\n scale = grinderL.getProgressScaled(24);\n drawTexturedModalRect(xStart + 79, yStart + 31, 176, 0, 20, scale);\n }\n }", "protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY)\r\n\t{\r\n\t\tGL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);\r\n\t\tmc.getTextureManager().bindTexture(iconLocation);\r\n\t\tdrawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);\r\n\t\tdrawPlayerModel(guiLeft + 51, guiTop + 75, 30, guiLeft + 51 - xSize_lo, guiTop + 25 - ySize_lo, mc.thePlayer);\r\n\t}", "public Paint getBackground() {\r\n return background;\r\n }", "@Override\r\n\tpublic void paintComponent(Graphics g)\r\n {\r\n\t\tsuper.paintComponent(g);\r\n\t\tg.setColor(getForeground());\r\n\t\tg.fillOval(0,0, this.getWidth(),this.getHeight());\r\n }", "private void drawBackground() {\n g2.setColor(SquareRenderer.BLANK_CELL_COLOR);\n g2.fillRect(BORDER_SIZE, BORDER_SIZE, BOARD_SIZE, BOARD_SIZE);\n }", "private void drawBackground(Graphics g){\r\n g.setColor(Colors.ColorAlpha(Colors.blacks,a1));\r\n g.fillRect(0,0,w,h);\r\n if(moving){\r\n g.drawImage(Assets.burst.get((int)((game.counter%8)*0.625)),(int)(w*0.472),(int)(h*0.455),null);\r\n g.drawImage(Assets.sparks.get(((game.counter%20)/2)),(int)(w*0.465),(int)(h*0.345),null);\r\n }\r\n drawWires(g);\r\n }", "@Override\n\t\tpublic void paint(Graphics g) {\n\t\t\tsuper.paint(g);\n\t\t\tg.drawImage(photoImage, 10, 2, 110, 130, this);\t\t\n\t\t}", "@Override\n public void paintComponent(Graphics g) {\n super.paintComponent(g);\n\n if (this.backImg != null) {\n g.drawImage(backImg, 0, 0, null);\n }\n\n if (this.img != null) {\n int x = getWidth() / 2 - img.getWidth() / 2;\n int y = getHeight() / 2 - img.getHeight() / 2;\n g.drawImage(img, x, y, null);\n }\n\n }", "@Override\r\n\tpublic void paintComponent(Graphics g)\r\n\t{\r\n\t\tif(_StartFinish)\r\n\t\t\tsetBackground(Color.WHITE);\r\n\t\telse\r\n\t\t\tsetBackground(Color.DARK_GRAY);\r\n\t\t\r\n\t\tsuper.paintComponent(g);\r\n\t}", "protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {\n\t\tsuper.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);\n\n\t\tGlStateManager.color(1, 1, 1,1 );\n\t\tthis.mc.getTextureManager().bindTexture(getTexture());\n\t\tthis.drawTexturedModalRect(xBase, yBase, 0, 0, xSize, container.inventoryRows * 18 + 17);\n\t\tthis.drawTexturedModalRect(xBase, yBase + container.inventoryRows * 18 + 17, 0, 126, xSize, 96);\n\t}", "@Override\r\n\tpublic void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\r\n\t\t\tthis.draw(g);\r\n\t\t\r\n\t\r\n\t}", "@Override\n public void paintComponent(Graphics g)\n {\n super.paintComponent(g); \n Graphics2D g2d = (Graphics2D) g; // cast g to Graphics2D\n\n // draw 2D ellipse filled with a blue-yellow gradient\n g2d.setPaint(new GradientPaint(5, 30, Color.BLUE, 35, 100, \n Color.YELLOW, true)); \n g2d.fill(new Ellipse2D.Double(5, 30, 65, 100));\n\n // draw 2D rectangle in red\n g2d.setPaint(Color.RED); \n g2d.setStroke(new BasicStroke(10.0f)); \n g2d.draw(new Rectangle2D.Double(80, 30, 65, 100));\n\n // draw 2D rounded rectangle with a buffered background\n BufferedImage buffImage = new BufferedImage(10, 10, \n BufferedImage.TYPE_INT_RGB);\n\n // obtain Graphics2D from buffImage and draw on it\n Graphics2D gg = buffImage.createGraphics(); \n gg.setColor(Color.YELLOW); \n gg.fillRect(0, 0, 10, 10); \n gg.setColor(Color.BLACK); \n gg.drawRect(1, 1, 6, 6); \n gg.setColor(Color.BLUE); \n gg.fillRect(1, 1, 3, 3); \n gg.setColor(Color.RED); \n gg.fillRect(4, 4, 3, 3); \n\n // paint buffImage onto the JFrame\n g2d.setPaint(new TexturePaint(buffImage, \n new Rectangle(10, 10)));\n g2d.fill(\n new RoundRectangle2D.Double(155, 30, 75, 100, 50, 50));\n\n // draw 2D pie-shaped arc in white\n g2d.setPaint(Color.WHITE);\n g2d.setStroke(new BasicStroke(6.0f)); \n g2d.draw(\n new Arc2D.Double(240, 30, 75, 100, 0, 270, Arc2D.PIE));\n\n // draw 2D lines in green and yellow\n g2d.setPaint(Color.GREEN);\n g2d.draw(new Line2D.Double(395, 30, 320, 150));\n\n // draw 2D line using stroke\n float[] dashes = {10}; // specify dash pattern\n g2d.setPaint(Color.YELLOW); \n g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND,\n BasicStroke.JOIN_ROUND, 10, dashes, 0)); \n g2d.draw(new Line2D.Double(320, 30, 395, 150));\n }", "public void paintComponent(Graphics g)\r\n\t{\r\n\t\t// Set a base background color\r\n\t\tg.setColor(new Color(0,0, 150));\r\n\t\tg.fillRect(0,0, this.getWidth(), this.getHeight());\r\n\t\t\r\n\t\t// Load the background image if its not already \r\n\t\tif(background == null){\r\n\t\t\tbackground = loadImage(\"HaloBackground.jpg\");\r\n\t\t}\r\n\t\t\r\n\t\t// Draw the background image to the screen at a third of the scroll rate\r\n\t\tg.drawImage(background,(int)(0 - model.mario.x)/3, -400, null);\r\n\t\tg.drawImage(background, (int)(0 - model.mario.x)/3, -400, -background.getWidth(), background.getHeight(), null);\r\n\r\n\t\t\r\n\t\t// Load the ground image if its not already\r\n\t\tif(ground == null){\r\n\t\t\tground = loadImage(\"Metal_Ground.png\");\r\n\t\t}\r\n\t\t\r\n\t\t// Count variable to indicate how many bricks are printed to the screen\r\n\t\tint count = 0;\r\n\t\tg.drawImage(ground, 0 - model.mario.x, this.getHeight() - 50, 50, 50, null);\r\n\t\t\r\n\t\t// Draw the middle set of bricks\r\n\t\tfor(int i = 0; i < (model.mario.x + this.getWidth())/50; i++){\r\n\t\t\tcount++;\r\n\t\t\t// Adjust the printing position to scroll with the characters\r\n\t\t\tg.drawImage(ground, 50 * i - model.mario.x, this.getHeight() - 50, 50, 50, null);\r\n\t\t}\r\n\t\t\r\n\t\t// Draw the last brick adjusted to the scroll position\r\n\t\t//int remainingSpace = (model.mario.x + this.getWidth()) % 100;\r\n\t\tg.drawImage(ground, count * 50 - model.mario.x, this.getHeight() - 50, 50, 50, null);\r\n\t\t\r\n\t\t// Draw all the sprites\r\n\t\tfor(int i = 0; i < model.sprites.size(); i++){\r\n\t\t\tmodel.sprites.get(i).draw(g);\r\n\t\t}\r\n\t\t\r\n\t}", "public void setBackground(Image i)\n {\n background=i;\n imageLabel.setIcon(new ImageIcon(i));\n imageLabel.setBounds(0,0,700,600);\n add(imageLabel);\n }", "private void drawBackground() {\r\n\r\n\t\tGL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);\r\n\t\tthis.mc.renderEngine.bindTexture(BACKGROUND_RESOURCE);\r\n\t\tString text = \"Nitro Teleport Waypoints\";\r\n\t\tint posX = (width - SIZE_X) / 2;\r\n\t\tint posY = (height - SIZE_Y) / 2;\r\n\t\tint strWidth = this.fontRendererObj.getStringWidth(text);\r\n\r\n\t\tthis.drawTexturedModalRect(posX, posY, 0, 0, SIZE_X, SIZE_Y);\r\n\t\tthis.drawCenteredString(this.fontRendererObj, text, width / 2, posY - 17, 0xFFFFFF);\r\n\t}", "@Override\r\n protected void paintComponent(Graphics g) {\r\n\r\n Graphics2D g2d = (Graphics2D) g;\r\n\r\n g2d.setColor(new Color(52, 73, 94));\r\n g2d.fillRect(0, 0, getWidth(), getHeight());\r\n }", "@Override\n public void paintComponent(Graphics g) \n {\n super.paintComponent(g);\n doDrawing(g);\n }", "public void paintComponent(Graphics g)\n {\n super.paintComponent(g);\n\n // safest to create a copy of the graphics component -- one must\n // ensure that no changes are made to the original\n Graphics2D graphics = (Graphics2D) g.create();\n\n JViewport viewport = null;\n JScrollPane scrollPane = null;\n Insets borders = null;\n\n int viewportWidth = 0;\n int viewportHeight = 0;\n int agentGUISize = Parameters.getAgentGUISize();\n int imageWidth = gridWidth * agentGUISize;\n int imageHeight = gridHeight * agentGUISize;\n\n // make sure that we're grabbing onto the viewport of the scroll pane\n Component ancestor = getParent();\n if (ancestor == null || !(ancestor instanceof JViewport))\n {\n //Exception e = new Exception(\n // \"AgentCanvas instance must be within JScrollPane instance\");\n //e.printStackTrace();\n //return;\n\n viewportWidth = imageWidth;\n viewportHeight = imageHeight;\n\n borders = new Insets(5,5,5,5);\n }\n else\n {\n // presumably we have the viewport of scroll pane containing 'this'\n viewport = (JViewport) ancestor;\n\n viewportWidth = viewport.getWidth();\n viewportHeight = viewport.getHeight();\n\n scrollPane = (JScrollPane) viewport.getParent();\n borders = scrollPane.getInsets();\n }\n\n // Note that drawImage automatically scales the image to fit that \n // rectangle.\n int renderWidth = gridWidth * agentGUISize;\n int renderHeight = gridHeight * agentGUISize;\n\n // determine the starting (x,y) in the viewport where the image\n // will be drawn\n viewportX = 10 + Math.max((viewportWidth - renderWidth) / 2, 0);\n viewportY = 20 + Math.max((viewportHeight - renderHeight) / 2, 0);\n\n // in case there was a previous image, clear things out\n //graphics.clearRect(0, 0, viewportWidth, viewportHeight);\n //graphics.clearRect(viewportX, viewportY, viewportWidth, viewportHeight);\n graphics.clearRect(viewportX, viewportY, renderWidth, renderHeight);\n\n // now draw the shelters\n for (int col = 0; col < gridWidth; col++ )\n {\n for (int row = 0; row < gridHeight; row++ )\n {\n Shelter s = shelters.getShelterAt( col, row ); //shelterGrid[col][row];\n\n // make sure not to draw any agent outside the image boundaries;\n // remember that graphics x corresponds to column and graphics y\n // corresponds to row\n if ((row >= 0) && (col >= 0) &&\n ((row * agentGUISize) + agentGUISize <= renderHeight) &&\n ((col * agentGUISize) + agentGUISize <= renderWidth))\n {\n int guiX = GUI_XPAD + viewportX + (col * agentGUISize);\n int guiY = GUI_YPAD + viewportY + (row * agentGUISize);\n\n int occupants = s.getCurrentOccupancy();\n int capacity = s.getMaxCapacity();\n int infested = s.getInfestedCount();\n int infected = s.getInfectedCount();\n \n if ( DEBUG ){\n if ( infested > occupants || infected > occupants ) {\n System.out.println(\n \"Shelter(\" + col + \", \" + row + \") \" + \n \" occupants = \" + occupants + \n \" infested = \" + infested + \n \" infected = \" + infected );\n }\n }\n \n double proportionInfested = infested / (double) occupants;\n double proportionInfected = infected / (double) occupants;\n if ( occupants == 0 ){\n proportionInfested = 0.0;\n proportionInfected = 0.0;\n }\n double proportionOccupied = occupants / (double) capacity;\n double proportionUnoccupied = 1.0 - proportionOccupied;\n \n // Shelter Occupancy info\n \n graphics.setPaint( Color.white );\n int unoccupiedHeight = \n (int) Math.round(agentGUISize * proportionUnoccupied);\n int occupiedHeight = agentGUISize - unoccupiedHeight;\n \n // Proportion of shelter currently not in use\n graphics.fillRect( guiX, guiY, \n OCCUPANCY_BAR_WIDTH, unoccupiedHeight );\n \n graphics.setPaint( Color.black );\n graphics.fillRect(guiX, guiY + unoccupiedHeight, \n OCCUPANCY_BAR_WIDTH, occupiedHeight );\n \n if (occupants > 0){\n graphics.setPaint( Color.white );\n String str = \"\"+occupants;\n graphics.drawString(str, guiX + 2, guiY + unoccupiedHeight + 15);\n graphics.setPaint( Color.black );\n }\n \n // Infestation info\n \n // Color of upper half of grid square should get more purple\n // as more Hosts are infested\n int red = 255 - (int) Math.round( 255 * proportionInfested);\n int green = 255 - (int) Math.round( 255 * proportionInfested);\n int blue = 255;\n \n Color infestColor = null;\n try{\n infestColor = new Color( red, green, blue );\n } catch (IllegalArgumentException ie ) {\n System.out.println(\"Weird color for infested block: (\" \n + red + \", \" + green + \", \" + blue + \")\");\n System.out.println(\"Shelter at (\" + row + \", \" + col +\")\");\n System.out.println(\"Usually means infested count is off.\");\n infestColor = Color.white;\n }\n\n graphics.setPaint( infestColor );\n\n graphics.fillRect(guiX + OCCUPANCY_BAR_WIDTH, guiY, STATUS_BAR_WIDTH, agentGUISize / 2);\n \n String data = \"\" + occupants + \"/\" + infested;\n graphics.setPaint( Color.black );\n graphics.drawString(data, guiX + OCCUPANCY_BAR_WIDTH + 5, guiY + agentGUISize/2 - 10 );\n \n // Infection info\n \n // Color of lower half of grid square should get redder\n // as more Hosts are infected.\n red = 255;\n green = 255 - (int) Math.round( 255 * proportionInfected);\n blue = 255 - (int) Math.round( 255 * proportionInfected);\n \n Color infectColor = null;\n try {\n infectColor = new Color( red, green, blue );\n } catch (IllegalArgumentException ie) {\n System.out.println(\"Weird color for infected block: (\" \n + red + \", \" + green + \", \" + blue + \")\");\n System.out.println(\"Shelter at (\" + row + \", \" + col +\")\");\n System.out.println(\"Usually means infected count is off.\");\n infestColor = Color.white; \n }\n\n graphics.setPaint( infectColor );\n\n graphics.fillRect(guiX + OCCUPANCY_BAR_WIDTH, \n guiY + agentGUISize/2, \n STATUS_BAR_WIDTH, \n agentGUISize / 2);\n \n data = \"\" + occupants + \"/\" + infected;\n graphics.setPaint( Color.black );\n graphics.drawString(data, guiX + OCCUPANCY_BAR_WIDTH + 5, guiY + agentGUISize - 10 );\n \n // Color of lower half of grid square should get bluer\n // as more Hosts are infected\n\n /*\n if (a.isTreated())\n {\n // if treated with antibiotic, draw a little dot in the\n // middle of the rendered agent\n int dotSize = 2;\n graphics.setPaint(Color.black);\n graphics.fillRect(guiX + ((agentGUISize - dotSize) / 2),\n guiY + ((agentGUISize - dotSize) / 2),\n dotSize, dotSize);\n }\n */\n \n drawShelterFrame(graphics, \n guiX, guiY, agentGUISize, agentGUISize );\n }\n }\n }\n\n // draw the grid last so that it will overlay the agent squares \n //drawGrid(graphics, viewportX, viewportY, renderWidth, renderHeight);\n drawGrid(graphics, viewportX + GUI_XPAD, viewportY + GUI_YPAD, renderWidth, renderHeight);\n\n // show the number of infected/uninfected agents\n drawAgentInfo(graphics, viewportX, viewportY, \n renderWidth, renderHeight, borders);\n\n revalidate();\n\n // get rid of the graphics copy\n graphics.dispose();\n }", "protected void drawGuiContainerBackgroundLayer(float f, int x, int y)\n {\n GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);\n super.mc.getTextureManager().bindTexture(background);\n int j = (super.width - super.xSize) / 2;\n int k = (super.height - super.ySize) / 2;\n this.drawTexturedModalRect(j, k, 0, 0, super.xSize, super.ySize);\n int i1;\n\n if (this.container.tileEntity.energy > 0)\n {\n i1 = this.container.tileEntity.energy * 14 / 200;\n\n if (i1 > 14)\n {\n i1 = 14;\n }\n\n this.drawTexturedModalRect(j + 62, k + 36 + 14 - i1, 176, 14 - i1, 14, i1);\n }\n\n i1 = this.container.tileEntity.pumpCharge * 41 / 200;\n\n if (i1 > 41)\n {\n i1 = 41;\n }\n\n this.drawTexturedModalRect(j + 99, k + 61 - i1, 176, 55, 12, 5);\n\n if (i1 > 0)\n {\n this.drawTexturedModalRect(j + 99, k + 25 + 41 - i1, 176, 14, 12, i1);\n }\n\n this.drawTexturedModalRect(j + 98, k + 19, 188, 14, 13, 47);\n }", "@Override\n public void paintComponent(Graphics g) {\n super.paintComponent(g); \n bground.paintIcon(this,g,0,0);\n importState().paintIcon(this,g,impButX,impButY);\n exportState().paintIcon(this,g,expButX,expButY);\n if(isExHover)\n if(isExportError())\n exError.paintIcon(this,g,errorX,errorY);\n }", "protected void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\n\t\tGraphics2D g2 = (Graphics2D) g.create();\n\t\tg2.drawImage(img, 0, 0, width, height, null);\n\t}", "public void setBackground(){\r\n Image background = new Image(\"Cards/table.jpg\", 192, 80, false, true);\r\n BackgroundImage backgroundImg = new BackgroundImage(background, BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT,BackgroundPosition.DEFAULT, null);\r\n mainPane.setBackground(new Background(backgroundImg));\r\n }", "@Override\r\n public void paintComponent(Graphics2D g) {\r\n g.drawImage(img, x, y, null);\r\n }", "public void paintComponent(Graphics page) {\r\n super.paintComponent(page);\r\n IMAGE.paintIcon(this, page, x, y);\r\n }", "public void paintComponent(Graphics g) {\n\n Graphics2D g2 = (Graphics2D) g;\n g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\n\n Color bg = new Color(237,237,237,0);//getBackground();\n g2.setColor(new Color(bg.getRed(),bg.getGreen(),bg.getBlue()));\n g2.fillRoundRect(0,0, getWidth()-1, getHeight()-1, radius, radius);\n g2.setColor(new Color(164,164,164));\n g2.drawRoundRect(0,0, getWidth()-1, getHeight()-1, radius, radius);\n }", "public MainSlot_JPanel(){\n //load background image\n try {\n Image img = ImageIO.read(getClass()\n .getResource(\"./graphics/slot_BackGround.jpg\"));\n backgroundImg = img\n .getScaledInstance(800,580,java.awt.Image.SCALE_SMOOTH );\n } catch(IOException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void paint(final Graphics g)\n {\n try\n {\n offScreenG.setColor(getBackground());\n offScreenG.fillRect(0, 0, getSize().width, getSize().height);\n\n if(offG == null)\n \toffG = offScreenG.create();\n\n if(backGround != null)\n {\n \t//System.out.println(\"drawing the loaded background image\");\n \toffG.drawImage(backGround, 0, 0, this);\n \tfinal int h = backGround.getHeight(this);\n \tfinal int w = backGround.getWidth(this);\n \toffG.setColor(Color.BLACK);\n \t//offG.drawRect(0, 0, w, h);\n }\n\n offScreenG.setColor(Color.BLACK);\n //offScreenG.drawRect(0, 0, this.getWidth()-1, this.getHeight()-1); //disable drawing of bounding box\n\n final Graphics2D g2 = (Graphics2D)offG;\n\t\t\tfinal Composite normC = g2.getComposite();\n\t\t\tg2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,(float)0.8));\n for(int i=0; i < associations.size(); i++)\n \tassociations.elementAt(i).render(offG);\n if(mpos != null && start != null)\n {\n \toffG.setColor(Color.DARK_GRAY);\n \tfinal Point rPoint = start.getPoint(mpos);\n \toffG.drawLine(rPoint.x, rPoint.y, mpos.x, mpos.y);\n \tif(retType.equals(\"pair\"))\n \t{\n \t\tdrawArrow(g2, mpos.x, mpos.y, rPoint.x, rPoint.y, 1);\n \t}\n \tdrawArrow(g2, rPoint.x, rPoint.y, mpos.x, mpos.y, 1);\n }\n\t\t\tif(hotspots != null)\n\t\t\t{\n\t\t\t\tfor(int i=0; i < hotspots.size(); i++)\n\t\t\t\t\thotspots.elementAt(i).render(g2);\n\t\t\t}\n\n\t\t\tif(movableObjects != null)\n\t\t\t{\n\t\t\t\tfor(int i=0; i < movableObjects.size(); i++)\n\t\t\t\t{\n\t\t\t\t\tmovableObjects.elementAt(i).render2(g2);\n\t\t\t\t}\n\t\t\t}\n g2.setComposite(normC);\n if(drawHSLabel != null)\n {\n \tif(drawHSLabel.hotSpotLabel != null && !drawHSLabel.hotSpotLabel.equals(\"\"))\n \t{\n\n \t\tfinal Rectangle2D bounds = (new TextLayout(drawHSLabel.hotSpotLabel,g2.getFont(),g2.getFontRenderContext())).getBounds();\n \t\tg2.setColor(Color.YELLOW);\n \t\tg2.fillRect(mpos.x, mpos.y-((int)bounds.getHeight()+4), (int)bounds.getWidth()+10, (int)bounds.getHeight()+8);\n \t\tg2.setColor(Color.BLACK);\n \t\tg2.drawRect(mpos.x, mpos.y-((int)bounds.getHeight()+4), (int)bounds.getWidth()+10, (int)bounds.getHeight()+8);\n \t\tg2.drawString(drawHSLabel.hotSpotLabel, mpos.x+5, mpos.y);\n \t}\n }\n\n g.drawImage(offScreenImg, 0, 0, this);\n\n if (om.equals(\"figure_placement_interaction\")) {\n for (int h=0; h < hotspots.size(); h++) {\n //g.drawRect(hotspots.elementAt(h).coords[0],hotspots.elementAt(h).coords[1],hotspots.elementAt(h).coords[2],hotspots.elementAt(h).coords[3]);\n }\n }\n }\n catch(final Exception exception)\n {\n \texception.printStackTrace();\n }\n }", "@Override\n public void paint (Graphics graphics) \n {\n if (image_ == null) return;\n //graphics.drawImage (image_, 0, 0, width_, height_, this);\n Graphics2D g2d=(Graphics2D)graphics;\n g2d.drawImage(image_,null,0,0);\n g2d.setComposite(AlphaComposite.Src);\n g2d.dispose();\n }", "public void repaint() {\n setBackground(Color.white);\n super.repaint();\n setVisible(true);\n\n }", "private void createBackground()\n {\n GreenfootImage background = getBackground();\n background.setColor(Color.BLACK);\n background.fill();\n }", "@Override\n public final void paint(float delta) {\n game.graphics.drawImage(\n image,\n centerX - (width / 2),\n centerY - (height / 2),\n scale, 0);\n }", "@Override\n protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {\n switch (state) {\n case BACKGROUND_ENABLED:\n paintBackgroundEnabled(g);\n break;\n case BACKGROUND_DISABLED:\n paintBackgroundDisabled(g);\n break;\n case BACKGROUND_ENABLED_MOUSEOVER:\n paintBackgroundEnabledAndMouseOver(g);\n break;\n case BACKGROUND_ENABLED_PRESSED:\n paintBackgroundEnabledAndPressed(g);\n break;\n }\n }", "protected void paintComponent(Graphics g) {\n super.paintComponent(g);\n \n // Are we dragging?\n if(dragging && currentMouseLocation != null && tabImage != null) {\n // Draw the dragged tab\n g.drawImage(tabImage, currentMouseLocation.x, currentMouseLocation.y, this);\n }\n }", "@Override\n public void paintComponent(Graphics g) {\n Graphics2D g2 = (Graphics2D) g;\n g2.setStroke(new BasicStroke(WALL));\n int[] xs = {BORDER + WALL, BORDER, BORDER, BORDER + (width-1)*SIZE + WALL};\n int[] ys = {BORDER, BORDER, BORDER + height*SIZE, BORDER + height*SIZE};\n g2.drawPolyline(xs, ys, 4);\n int[] xs2 = {BORDER + SIZE - WALL, BORDER + width*SIZE, BORDER + width*SIZE, BORDER + width*SIZE - WALL};\n g2.drawPolyline(xs2, ys, 4);\n // code that was used to create the intermediate images\n// g2.setColor(Color.LIGHT_GRAY);\n// for(int i = 1; i < height; i++) {\n// int where = BORDER + i*SIZE;\n// g2.drawLine(BORDER + WALL, where, BORDER + width * SIZE - WALL, where);\n// }\n// for(int i = 1; i < width; i++) {\n// int where = BORDER + i*SIZE;\n// g2.drawLine(where, BORDER + WALL, where, BORDER + height * SIZE - WALL);\n// }\n g2.setColor(Color.blue);\n for(Wall wall : walls) {\n drawWall(g2, wall);\n }\n }", "protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)\n\t{\n\t\tint var4 = this.mc.renderEngine.getTexture(\"/luxcraft/gui/luxRitualTable.png\");\n\t\tGL11.glColor4f(1.0F, 1F, 1F, 1.0F);\n\t\tthis.mc.renderEngine.bindTexture(var4);\n\t\tint var5 = (this.width - this.xSize) / 2;\n\t\tint var6 = (this.height - this.ySize) / 2;\n\t\tthis.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);\n\n\t\tif(this.ritualtableInventory.schemaMaxAnalyseTime != 0){\n\t\t\tint w = 2+(this.ritualtableInventory.schemaAnalyseTime * 41)/this.ritualtableInventory.schemaMaxAnalyseTime;\n\t\t\tthis.drawTexturedModalRect(var5 + 30, var6 + 37, 176, 14, w, 16);\n\t\t\tthis.drawTexturedModalRect(var5 + 103+43-w, var6 + 37, 176+43-w, 31, w, 16);\n\t\t}\n\n\n\t}", "protected void paintComponent(Graphics g)\n/* */ {\n/* 126 */ if ((this.painter != null) || (isNimbus()))\n/* */ {\n/* */ \n/* */ \n/* */ \n/* 131 */ if (isOpaque())\n/* */ {\n/* 133 */ paintComponentWithPainter((Graphics2D)g);\n/* */ }\n/* */ else {\n/* 136 */ paintPainter(g);\n/* 137 */ super.paintComponent(g);\n/* */ }\n/* */ }\n/* */ else {\n/* 141 */ super.paintComponent(g);\n/* */ }\n/* */ }", "protected void paintComponent(Graphics g) {\n if (getModel().isPressed()) {\n g.setColor(pressedBackgroundColor);\n } else if (getModel().isRollover()) {\n g.setColor(hoverBackgroundColor);\n } else {\n g.setColor(getBackground());\n }\n g.fillRect(0, 0, getWidth(), getHeight());\n super.paintComponent(g);\n }", "private void drawBackground(Graphics2D g2) {\n\t\t\tg2.fillRect(0, 0, WIDTHBG, HEIGHTBG);\n\t\t}", "public void paintComponent(Graphics g){\n Dimension tam = this.getSize();\n g.drawImage(this.image, 0, 0, tam.width, tam.height, null);\n super.paintComponent(g);\n }", "public void paintComponent(Graphics g){\n Dimension tam = this.getSize();\n g.drawImage(this.image, 0, 0, tam.width, tam.height, null);\n super.paintComponent(g);\n }", "public void paintComponent(Graphics g){\n\t\t Graphics2D g2 = (Graphics2D) g;\n\t\t URL trainanimalsURL = getClass().getResource(\"graphics/trainanimals.jpg\");\n\t\t Image animals = new ImageIcon(trainanimalsURL).getImage();\t \n\t\t //super.paintComponent(g); //replace current painting\n\t\t g.drawImage(animals, 0, 0, this); \n\t\n\t }", "@Override\n public void paint(Graphics g) {\n g.drawImage(carretera.getImage(),5,5,1200,80,this); //agrego la imagen de la carretera\n g.drawImage(imagen,x,y,ancho,alto,this); // agrego la imagen del carro\n setOpaque(false);\n super.paint(g); // pinto \n\n \n }", "@Environment(EnvType.CLIENT)\n\t@Override\n\tpublic WPanel setBackgroundPainter(BackgroundPainter painter) {\n\t\tsuper.setBackgroundPainter(null);\n\t\tinv.setBackgroundPainter(painter);\n\t\thotbar.setBackgroundPainter(painter);\n\t\treturn this;\n\t}", "@Override\n\tpublic void draw(Batch batch, float parentAlpha) {\n\t\tbatch.draw(leftBorder, getX(), getY());\n\t\t// Save variables to restore their state after drawing\n\t\tfloat prevX = getX();\n\t\tfloat prevWidth = getWidth();\n\t\t// Set the variables which are used to draw the background\n\t\tsetX(prevX + leftBorder.getRegionWidth());\n\t\tsetWidth(prevWidth - leftBorder.getRegionWidth() - rightBorder.getRegionWidth());\n\t\t// Draw the progress bar as it would be without borders\n\t\tsuper.draw(batch, parentAlpha);\n\t\t// Set the variables to draw the right border\n\t\tsetX(getX() + getWidth());\n\t\t// Draw the right border\n\t\tbatch.draw(rightBorder, getX(), getY());\n\t\t// Reset the state of the variables so next cycle the drawing is done at correct position\n\t\tsetX(prevX);\n\t\tsetWidth(prevWidth);\n\t}", "public MatteIcon(Paint background) {\r\n this(32, 32, background);\r\n }", "@Override\n public void paintComponent(final Graphics g) {\n if (!isOpaque()) {\n super.paintComponent(g);\n return;\n }\n \n // use value of JTextField for consistency\n g.setColor(UIManager.getColor(\"TextField.inactiveBackground\"));\n g.fillRect(3, 3, getWidth() - 6, getHeight() - 6);\n \n // do rest, changing opaque to ensure background is not overwritten\n setOpaque(false);\n super.paintComponent(g);\n setOpaque(true);\n }", "protected void paintComponent(Graphics g) {\r\n super.paintComponent(g);\r\n g.drawImage(i, 0, 0, null); // see javadoc for more info on the parameters \r\n }", "void paintComponent();", "public void paintComponent(Graphics g) {\n\n\t\tg.drawImage(bImage, 0, 0, this);\n\n\n\n\t}", "@Override\r\n\t\tpublic void paint(Graphics g) {\n\t\t\tsuper.paint(g);\r\n\t\t}", "@Override\n\t\t\tprotected void paintComponent(Graphics g) {\n\t\t\t\tsuper.paintComponent(g);\n\t\t\t\tGraphics2D g2d = (Graphics2D) g;\n\t\t\t\tg2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);\n\t\t\t\tint w = getWidth();\n\t\t\t\tint h = getHeight();\n//\t\t\t\tColor color1 = new Color(30, 255, 90);\n//\t\t\t\tColor color2 = new Color(45, 110, 35);\n\t\t\t\tGradientPaint gp = new GradientPaint(0, 0, color1, 0, h, color2);\n\t\t\t\tg2d.setPaint(gp);\n\t\t\t\tg2d.fillRect(0, 0, w, h);\n\t\t\t}" ]
[ "0.8319506", "0.7943576", "0.7739777", "0.76958925", "0.7502797", "0.7492258", "0.70634353", "0.70232505", "0.6897336", "0.6888526", "0.68806535", "0.6878743", "0.6816207", "0.68051976", "0.67983747", "0.6785183", "0.6769256", "0.6763155", "0.67466843", "0.6743983", "0.67165834", "0.6678063", "0.6676381", "0.6668671", "0.66565216", "0.6606763", "0.6580162", "0.6577519", "0.65335906", "0.6529741", "0.65290517", "0.6525622", "0.65241224", "0.6510203", "0.6509222", "0.6508003", "0.64822567", "0.64370704", "0.642914", "0.6426549", "0.64229447", "0.64048433", "0.639247", "0.6363733", "0.6358045", "0.6352081", "0.63363165", "0.63285935", "0.6318161", "0.63149464", "0.63082623", "0.62861556", "0.6251477", "0.62501204", "0.62476254", "0.62430924", "0.6231764", "0.62205607", "0.62205607", "0.6211428", "0.62091047", "0.620781", "0.61687046", "0.6154497", "0.6153846", "0.6147901", "0.61463743", "0.61463", "0.6122531", "0.6113262", "0.6110574", "0.6100425", "0.6098412", "0.6096159", "0.6095895", "0.60952425", "0.6090385", "0.6073775", "0.60602444", "0.604059", "0.6033561", "0.60255396", "0.60229665", "0.6012399", "0.6008129", "0.59948295", "0.5990093", "0.59866166", "0.598575", "0.598575", "0.59852815", "0.5977625", "0.59747905", "0.5974778", "0.5973935", "0.5965372", "0.5965236", "0.5952538", "0.59523755", "0.5951649", "0.5948762" ]
0.0
-1
Allows the user to select if he wishes to be notified of program events
public void actionPerformed(ActionEvent arg0) { userAlert = chkAlert.getState(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ProgramEventEvent createProgramEventEvent();", "public void askForType() {\n System.out.println(\"What type of event will this be?\");\n System.out.println(\"1) Normal 2) Multi-Speaker 3) VIP\");\n }", "public abstract boolean listenerUserInput();", "public void askForEventID() {\n System.out.println(\"What is the event ID?\");\n }", "void onDeviceSelected(String address);", "public void scheduleOptions() {\n System.out.println(\"Would you like to (1) Add an Event, (2) Remove an Event, (3) Exit this menu\");\n }", "void onApplicationEvent(ApplicationEvent e);", "@Override\r\n\t\t\tpublic void documentAboutToBeChanged(DocumentEvent event) {\n\t\t\t\tif (event.fText.indexOf('\\r') != -1 || event.fText.indexOf('\\n') != -1) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tITypedRegion partition = event.fDocument.getPartition(event.fOffset);\r\n\t\t\t\t\t\tif (partition instanceof IOConsolePartition) {\r\n\t\t\t\t\t\t\tIOConsolePartition p = (IOConsolePartition) partition;\r\n\t\t\t\t\t\t\t// check if that is user input\r\n\t\t\t\t\t\t\tif (p.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {\r\n\t\t\t\t\t\t\t\tif (event.fText.length() <= 2) {\r\n\t\t\t\t\t\t\t\t\tfinal String inputFound = p.getString();\r\n\t\t\t\t\t\t\t\t\tif (inputFound.length() > 0)\r\n\t\t\t\t\t\t\t\t\t\tfConsoleInterpreter.postSessionPrompt(inputFound);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} catch (BadLocationException e) {\r\n\t\t\t\t\t\tLog.log(IStatus.ERROR, \"Error in RIDE console Listener.\", e);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}", "public interface ChoosableEvent extends Event{\n\n void chooseAnswer(String answer, String username);\n}", "void eventChanged();", "public void runInUi(ElexisEvent ev){}", "@Override\r\n\t\t\t\tpublic void documentAboutToBeChanged(DocumentEvent event) {\n\t\t\t\t\tif (event.fText.indexOf('\\r') != -1 || event.fText.indexOf('\\n') != -1) {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tITypedRegion partition = event.fDocument.getPartition(event.fOffset);\r\n\t\t\t\t\t\t\tif (partition instanceof IOConsolePartition) {\r\n\t\t\t\t\t\t\t\tIOConsolePartition p = (IOConsolePartition) partition;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// check if that is user input\r\n\t\t\t\t\t\t\t\tif (p.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {\r\n\t\t\t\t\t\t\t\t\tif (event.fText.length() <= 2) {\r\n\t\t\t\t\t\t\t\t\t\tfinal String inputFound = p.getString();\r\n\t\t\t\t\t\t\t\t\t\tWriteRIDE(\"PROC_TYPE: \" + inputFound);\r\n//\t\t\t\t\t\t\t\t\t\tfor (IConsoleInputListener listener : partcipants) {\r\n//\t\t\t\t\t\t\t\t\t\t\tlistener.newLineReceived(inputFound, target);\r\n//\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\t\t\tLog.log(IStatus.ERROR, \"Error listen input for process console\", e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "void addEventPowerUp(DefaultPowerUp powerUp);", "private void notifyAutomatically(){\n System.out.println(\"Notificando automaticamente...\");\n }", "public interface PromptListener {\n /**\n * On Prompt\n * @param promptText String\n */\n void OnPrompt(String promptText);\n}", "private void SelectionChanged(String type) {\n try {\n VaadinSession.getCurrent().getLockInstance().lock();\n Listeners_Map.values().stream().forEach((filter) -> {\n filter.selectionChanged(type);\n });\n } finally {\n VaadinSession.getCurrent().getLockInstance().unlock();\n busyTask.setVisible(false);\n }\n\n }", "public void onEventSelected(int position);", "@Override\r\n\tpublic void onEvent(Object e) {\n\t}", "void onHisNotify();", "SystemEvent createSystemEvent();", "public void checkEvents()\n\t{\n\t\t((MBoxStandalone)events).processMessages();\n\t}", "private void listen() {\n try {\n this.console.println(MapControl.checkListen(FireSwamp.getPlayer().getPlayerPosition(),\n FireSwamp.getCurrentGame().getGameMap()));\n } catch (MapControlException ex) {\n Logger.getLogger(GameMenuView.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public void addInputListener(int selector, UpdateListener whom) {\r\n String whar = \"\";\r\n if (selector == Arduino.REPORT_VERSION) { // = 0xF9 (249)\r\n whar = \" VERSION\";\r\n FirmwareUpdate = whom;\r\n } else if (selector == Arduino.REPORT_MISCELLANY) {\r\n whar = \" MISCELLANY\"; // = 0xFD (253)\r\n FeedbackUpdate = whom;\r\n } else if (selector == Arduino.DEADMAN_MESSAGE) {\r\n whar = \" DEADMAN\"; // = 0xFB (251)\r\n DeadManUpdate = whom;\r\n } else if ((selector == Arduino.INPUT)\r\n || (selector == Arduino.REPORT_DIGITAL)) {\r\n whar = \" DIGITAL\"; // = 0xD0 (208)\r\n DigiPinUpdate = whom;\r\n } else if ((selector == Arduino.ANALOG)\r\n || (selector == Arduino.REPORT_ANALOG)) {\r\n whar = \" ANALOG\"; // = 0xC0 (192)\r\n AnaPinUpdate = whom;\r\n } else if ((selector == Arduino.PULSECOUNT)\r\n || (selector == Arduino.REPORT_PULSECOUNT)) {\r\n whar = \" PULSECOUNT\"; // = 0xA0 (160)\r\n PulseCountUpdate = whom;\r\n }\r\n if (SpeakEasy) {\r\n if (whom != null) whar = whar + \" -> \" + whom.toString();\r\n System.out.println(\"F%%F/addInList #\" + selector + whar);\r\n }\r\n }", "public void ingresar_a_la_Opcion_de_eventos() {\n\t\t\n\t}", "@Override\n\tpublic void eventSelectTracker() {\n\t\t\n\t}", "public void consulterEvent() {\n\t\t\n\t}", "@Override\r\n\t\t\t\tpublic void documentAboutToBeChanged(DocumentEvent event) {\n\t\t\t\t\tif (event.fText.indexOf('\\r') != -1 || event.fText.indexOf('\\n') != -1) {\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tITypedRegion partition = event.fDocument.getPartition(event.fOffset);\r\n\t\t\t\t\t\t\tif (partition instanceof IOConsolePartition) {\r\n\t\t\t\t\t\t\t\tIOConsolePartition p = (IOConsolePartition) partition;\r\n\t\t\t\t\t\t\t\t// check if that is user input\r\n\t\t\t\t\t\t\t\tif (p.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {\r\n\t\t\t\t\t\t\t\t\tif (event.fText.length() <= 2) {\r\n\t\t\t\t\t\t\t\t\t\tfinal String inputFound = p.getString();\r\n\t\t\t\t\t\t\t\t\t\tfConsoleInterpreter.postRIDECommand(inputFound);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} catch (BadLocationException e) {\r\n\t\t\t\t\t\t\tLog.log(IStatus.ERROR, \"Error in RIDE console Listener.\", e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "public void notifyStartup();", "public void notify(final int device, final int keyCode, final int type);", "public void signUpForEventReporter(int type) {\n switch (type) {\n case 1:\n System.out.println(\"Here are the available Events\");\n break;\n case 2:\n System.out.println(\"Please select one of the available eventID or print '0' to exit\");\n break;\n case 3:\n System.out.println(\"The signup is cancelled\");\n break;\n case 4:\n System.out.println(\"Event Detail\");\n break;\n }\n\n }", "private void showProgramData(ItemEvent itemEvent) {\n\n if (itemEvent.getStateChange() == ItemEvent.SELECTED) {\n\n setCurrentChannel(itemEvent.getItem().toString());\n scheduledUpdate();\n\n }\n }", "@FXML\n public void dmcEvent() {\n emulator.dmcEvent(dmcCheckbox.isSelected());\n }", "public interface SettingsSelectedListener\t{\n\t}", "public void generalPrompt() {\n System.out.println(\"What would you like to do?\");\n }", "public abstract void onInput();", "public void chooseYourMode(){\r\n ActionHandlers.ChooseModeHandler chooseModeHandler = (s) -> {\r\n try {\r\n choice.put(s);\r\n } catch (InterruptedException e) {\r\n e.printStackTrace();\r\n }\r\n };\r\n runLater(() -> main.run(chooseModeHandler));\r\n }", "public void windowActivated(WindowEvent event) {}", "@DISPID(-2147412032) //= 0x800117c0. The runtime will prefer the VTID if present\n @VTID(9)\n void onselectionchange(\n @MarshalAs(NativeType.VARIANT) java.lang.Object p);", "@DISPID(-2147412075)\n @PropGet\n java.lang.Object onselectstart();", "public void optionsForSubscriber() throws RemoteException {\r\n Scanner in = new Scanner(System.in);\r\n boolean breakLoop = false;\r\n\r\n do {\r\n System.out.println(\"What would you like to do as a Subscriber:\");\r\n System.out.println(\" 1: Subscribe to a Topic.\");\r\n System.out.println(\" 2: Unsubscribe from a Topic.\");\r\n System.out.println(\" 3: Unsubscribe from all Topics.\");\r\n System.out.println(\" 4: Display subscribed topics.\");\r\n System.out.println(\" 5: View all available topics.\");\r\n System.out.println(\" 6: View all received events.\");\r\n System.out.println(\" 7: Save & Quit.\");\r\n System.out.print(\"Enter an Option: \");\r\n\r\n int choice = in.nextInt();\r\n Topic topic = null;\r\n\r\n\r\n switch (choice) {\r\n case 1: {\r\n topic = findTopic();\r\n if (topic != null) {\r\n subscribe(topic);\r\n }\r\n break;\r\n }\r\n case 2: {\r\n topic = findTopic();\r\n if (topic != null) {\r\n unsubscribe(topic);\r\n }\r\n break;\r\n }\r\n case 3: {\r\n unsubscribe();\r\n break;\r\n }\r\n case 4: {\r\n listSubscribedTopics();\r\n break;\r\n }\r\n case 5: {\r\n try {\r\n ArrayList<Topic> allTopics = server.getTopics();\r\n for (Topic t : allTopics)\r\n System.out.print(t);\r\n } catch (RemoteException e) {\r\n System.out.println(\"Couldn't Connect to Server. Try again\");\r\n }\r\n break;\r\n }\r\n case 6: {\r\n listReceivedEvents();\r\n break;\r\n }\r\n case 7: {\r\n breakLoop = true;\r\n in.close();\r\n saveState();\r\n break;\r\n }\r\n default:\r\n System.out.println(\"Please enter a valid option.\");\r\n }\r\n } while (!breakLoop);\r\n }", "public void showTriggered();", "public void select() {\n \t\t\tString sinput = \"\";\r\n \t\t\tOption selected = null;\r\n \t\t\tErrorLog.debug(name + \" selected.\");\r\n \t\t\t\r\n \t\t\twhile (true) {\r\n \t\t\t\tSystem.out.println(toString()); //Print menu.\r\n \t\t\t\tsinput = read(); //Get user selection.\r\n \t\t\t\tif (!sinput.equalsIgnoreCase(\"exit\")) {\r\n \t\t\t\t\tselected = options.get(sinput); //Find corresponding option.\r\n \r\n \t\t\t\t\tif (selected != null) //Sinput corresponds to an extant option.\r\n \t\t\t\t\t\tselected.select(); //Select the selected.\r\n \t\t\t\t\telse\r\n \t\t\t\t\t\tprint(sinput + \" is not a valid option\");\r\n \t\t\t\t} else\r\n \t\t\t\t\t{print(\"Returning to previous menu.\"); break;}\r\n \t\t\t}\r\n \t\t\t\r\n \t\t\tErrorLog.debug (\"Quitting \" + name + \". Sinput:\"+sinput);\r\n \t\t\t\r\n \t\t\treturn;\r\n \t\t}", "boolean getUserChooseTrigger();", "public synchronized void alertChosen( int r, int c ) {\n\t\ttry {\n\t\t\tvListen.select( r, c );\n\t\t} catch (IOException exc) {\n\t\t\terrorIOError();\n\t\t}\n\t}", "EventType getEvent();", "boolean isSetEvent();", "void notify(IUISemanticEvent event);", "private void fireSelectionChangeNotification () {\r\n\t\tif ( selectionChangeListener!=null)\r\n\t\t\tselectionChangeListener.execute();\r\n\t}", "protected void inputListener(){\n }", "public void actionPerformed( ActionEvent event )\n {\n if ( !getEnvironmentWindow().getEnvironment().getLock().equals(\n KalumetConsoleApplication.getApplication().getUserid() ) )\n {\n KalumetConsoleApplication.getApplication().getLogPane().addWarning(\n Messages.getString( \"environment.locked\" ), getEnvironmentWindow().getEnvironmentName() );\n return;\n }\n // check if the user can do it\n if ( !getEnvironmentWindow().adminPermission && !getEnvironmentWindow().softwareChangePermission )\n {\n KalumetConsoleApplication.getApplication().getLogPane().addWarning(\n Messages.getString( \"action.restricted\" ), getEnvironmentWindow().getEnvironmentName() );\n return;\n }\n // looking for the location object\n Location location = software.getLocation( event.getActionCommand() );\n if ( location == null )\n {\n KalumetConsoleApplication.getApplication().getLogPane().addWarning(\n Messages.getString( \"location.notfound\" ), getEnvironmentWindow().getEnvironmentName() );\n return;\n }\n // change the state and add an event\n if ( location.isActive() )\n {\n location.setActive( false );\n parent.getEnvironmentWindow().getChangeEvents().add(\n \"Disable software \" + name + \" location \" + location.getName() );\n }\n else\n {\n location.setActive( true );\n parent.getEnvironmentWindow().getChangeEvents().add(\n \"Enable software \" + name + \" location \" + location.getName() );\n }\n // change the update flag\n parent.getEnvironmentWindow().setUpdated( true );\n // update the journal pane\n parent.getEnvironmentWindow().updateJournalPane();\n // update the pane\n update();\n }", "public void mainMenuOption() {\n\t\tScanner keyboard = new Scanner( System.in );\n\t\t\n\t\tfirstMenu();\n\t\t\n\t\tString input = keyboard.nextLine();\n\t\twhile(input != \"0\"){\n\t\t\t\n\t\t\t switch(input){\n\t case \"0\" : System.out.println(\"You close the App\"); \n\t \t\t\tSystem.exit(0);\n\t break;\n\t \n\t case \"1\" : IdentityMenu();\n\t break;\n\t \n\t case \"2\" : AddressMenu();\n\t \tbreak;\n\t \n\t default :\tSystem.out.println(\"Invalid selection\"); \n\t \t\t\tmainMenuOption();\n\t break;\t\n\t \n\t\t\t }\n\t\t break;\n\t\t}\n\t}", "public interface SelectionListener {\n void selected();\n}", "Event () {\n // Nothing to do here.\n }", "private void mainMenu() {\r\n System.out.println(\"Please choose an option: \");\r\n System.out.println(\"1. New Player\");\r\n System.out.println(\"2. New VIP Player\");\r\n System.out.println(\"3. Quit\");\r\n }", "public void actionPerformed( ActionEvent event )\n {\n if ( !getEnvironmentWindow().getEnvironment().getLock().equals(\n KalumetConsoleApplication.getApplication().getUserid() ) )\n {\n KalumetConsoleApplication.getApplication().getLogPane().addWarning(\n Messages.getString( \"environment.locked\" ), getEnvironmentWindow().getEnvironmentName() );\n return;\n }\n // check if the user can do it\n if ( !getEnvironmentWindow().adminPermission && !getEnvironmentWindow().softwareChangePermission )\n {\n KalumetConsoleApplication.getApplication().getLogPane().addWarning(\n Messages.getString( \"action.restricted\" ), getEnvironmentWindow().getEnvironmentName() );\n return;\n }\n // looking for the command object\n Command command = software.getCommand( event.getActionCommand() );\n if ( command == null )\n {\n KalumetConsoleApplication.getApplication().getLogPane().addWarning(\n Messages.getString( \"command.notfound\" ), getEnvironmentWindow().getEnvironmentName() );\n return;\n }\n // change the state and add an event\n if ( command.isActive() )\n {\n command.setActive( false );\n parent.getEnvironmentWindow().getChangeEvents().add(\n \"Disable software \" + name + \" command \" + command.getName() );\n }\n else\n {\n command.setActive( true );\n parent.getEnvironmentWindow().getChangeEvents().add(\n \"Enable software \" + name + \" command \" + command.getName() );\n }\n // change the update flag\n parent.getEnvironmentWindow().setUpdated( true );\n // update the journal pane\n parent.getEnvironmentWindow().updateJournalPane();\n // update the pane\n update();\n }", "@Override\n\t\tpublic void mouseClicked(MouseEvent e) {\n\t\t\tJOptionPane.showMessageDialog(theText, \"Other stuff is to be added here\");\n\t\t\tif(e.getSource().toString() == \"*.jar\")\n\t\t\t{\n\t\t\t\tJOptionPane.showMessageDialog(theText, \"launch the Installer\");\n\t\t\t\t\n\t\t\t}\n\t\t\telse if(e.getSource().toString() == \"*.exe\")\n\t\t\t{\n\t\t\t\tJOptionPane.showMessageDialog(theText, \"launch the Installer\");\n\t\t\t}\n\t\t}", "void notify(HorseFeverEvent e);", "@Override\r\n public void processEvent(IAEvent e) {\n\r\n }", "public void alertSelection() {\n JOptionPane.showMessageDialog(gui.getFrame(),\n \"`Please select a choice.\",\n \"Invalid Selection Error\",\n JOptionPane.ERROR_MESSAGE);\n }", "@Override\n public boolean usesEvents()\n {\n return false;\n }", "@FXML\n public void pulse1Event() {\n emulator.pulse1Event(pulse1Checkbox.isSelected());\n }", "@Override\n\t\t\t\t\tpublic void onEvent(Event event) throws Exception {\n\t\t\t\t\t\tMessagebox.Button button = (Messagebox.Button) event.getData();\n\t\t\t\t\t\tif (button == Messagebox.Button.YES) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tanalista.setiEstatus(EstatusPersonaFactory.getEstatusActivo());\n\t\t\t\t\t\t\t\t//EL METODO DICE ACTUTALIZARPERSONA\n\t\t\t\t\t\t\t\tsMaestros.acutalizarPersona(analista);\n\t\t\t\t\t\t\t\tcambiarAnalistas(0, null, null);\n\t\t\t\t\t\t\t\tnotifyChange(\"analistas\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t}", "public interface IMainEvent {\n\n void showEvent(String data);\n}", "public interface OnOptionSelectedListener {\n // TODO: Update argument type and name\n void goToNext(boolean isCorrect);\n }", "public interface IGUIEvent {\n\n\n /**\n * Returns the source of the event.\n * \n * @return the source.\n */\n public abstract Object getSource();\n\n\n /**\n * Consumes the event.\n */\n public abstract void consume();\n\n\n /**\n * Returns whether this event has been consumed.\n * \n * @return <CODE>true</CODE> if the event has been consumed;\n * <CODE>false</CODE> otherwise.\n */\n public abstract boolean isConsumed();\n}", "public void windowActivated(WindowEvent event)\n {\n\n\n }", "void onNewEvent(Event event);", "private void instruct() {\n\t\tif (vsComputer) {\n\t\t\tSystem.out.println(\"\"\"\n 1. Stone\n 2. Paper\n 3. Scissors\n You have to enter your choice\n \"\"\");\n\t\t}\n\t}", "public static void main(String[] args)\n {\n MyApp theApp = new MyApp(); \n theApp.enterEventDispatcher();\n }", "public void onEulaAction(boolean isAccepted);", "public void interactWhenSteppingOn() {\r\n\t\t\r\n\t}", "public void testEventStatusFilter(final String programName) throws ParseException;", "boolean hasChangeEvent();", "void onInstallerEvent(String eventName, Object... args);", "public interface NotifyListener {\n void onDateClick(Date date);\n}", "public interface SelectBatchSnsListener {\n void ClickBatchSns(String sns, boolean isselected);\n}", "public void onInputSignalChange(String input, boolean hasSignal) {\n\n\t\t}", "public interface MDDChannelListener {\r\n /**\r\n * Called on receipt of CHANNEL events\r\n * @param channel String containing the name of the channel\r\n * @param title String containing the title of the program\r\n * @param subtitle String containing the subtitle of the program\r\n */\r\n public void onChannel(String channel, String title, String subtitle);\r\n /**\r\n * Called on receipt of PROGRESS events\r\n * @param pos int representing current position\r\n */\r\n public void onProgress(int pos);\r\n /**\r\n * Called on receipt of EXIT event\r\n */\r\n public void onExit();\r\n}", "public static void userSelection(){\n\t\tint selection;\n\t\tScanner input = new Scanner(System.in);\n\t\tSystem.out.println(\"Which program would you like to run?\");\n\t\tselection=input.nextInt();\n\n\t\tif(selection == 1)\n\t\t\tmazeUnion();\n\t\tif(selection == 2)\n\t\t\tunionPathCompression();\n\t\tif(selection == 3)\n\t\t\tmazeHeight();\n\t\tif(selection == 4)\n\t\t\tmazeSize();\n\t\tif(selection == 5)\n\t\t\tsizePathCompression();\n\t}", "@Override\n public void mouseClicked(MouseEvent evt) {\n if (evt.getButton() == MouseEvent.BUTTON1 && parent.getExtendedState() == JFrame.ICONIFIED) {\n MensajeTrayIcon(\"Modulo Envio ejecutandose en segundo plano\", TrayIcon.MessageType.INFO);\n }\n }", "@Override\n\tpublic void windowActivated(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowActivated(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowActivated(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowActivated(WindowEvent arg0) {\n\t\t\n\t}", "@Override\n\tpublic void windowActivated(WindowEvent arg0) {\n\t\t\n\t}", "public interface ApplicationListener extends EventListener {\n\n /**\n * Handle an application event\n *\n * @param e event to respond to\n */\n void onApplicationEvent(ApplicationEvent e);\n\n}", "@Override\r\n public void windowActivated(WindowEvent arg0) {}", "public void ResultVoiceIn(EventVoice event);", "@Override\r\n\tpublic void onEvent(Event arg0) {\n\r\n\t}", "@Override\n\t\tpublic void windowActivated(WindowEvent arg0) {\n\t\t\t\n\t\t}", "@FXML\n public void pulse2Event() {\n emulator.pulse2Event(pulse2Checkbox.isSelected());\n }", "public void runEvent();", "public interface OnEventAvailableListener {\n\tpublic void OnEventAvailable(Message msg);\n}", "boolean onEvent(Event event);", "@Override\r\n\tpublic void windowActivated(WindowEvent arg0) {\n\t}", "public void accept()\n { ua.accept();\n changeStatus(UA_ONCALL);\n if (ua_profile.hangup_time>0) automaticHangup(ua_profile.hangup_time); \n printOut(\"press 'enter' to hangup\"); \n }", "public void optionsForPublisher() throws RemoteException {\r\n Scanner in = new Scanner(System.in);\r\n boolean breakLoop = false;\r\n do {\r\n System.out.println(\"What would you like to do as a Publisher:\");\r\n System.out.println(\" 1: Create and Advertise a topic.\");\r\n System.out.println(\" 2: Create and Publish an event.\");\r\n System.out.println(\" 3: List your advertised topics.\");\r\n System.out.println(\" 4: List your created events.\");\r\n System.out.println(\" 5: Save & Quit.\");\r\n System.out.print(\"Enter an option: \");\r\n\r\n int choice = in.nextInt();\r\n\r\n\r\n switch (choice) {\r\n case 1: {\r\n System.out.println(\"Enter topic name:\");\r\n in = new Scanner(System.in);\r\n String name = in.nextLine().trim();\r\n System.out.println(\"Enter keywords separated by commas: \");\r\n in = new Scanner(System.in);\r\n String keywords = in.nextLine().trim();\r\n Topic t = new Topic(name, keywords);\r\n advertise(t);\r\n break;\r\n }\r\n case 2:{\r\n Topic topic = findTopic();\r\n if ( topic != null) {\r\n System.out.println(\"Enter title for event: \");\r\n in = new Scanner(System.in);\r\n String title = in.nextLine().trim();\r\n System.out.println(\"Enter keywords for event separated by commas [OPTIONAL]: \");\r\n in = new Scanner(System.in);\r\n String keywords = in.nextLine().trim();\r\n if (keywords.length() == 0) {\r\n keywords = null;\r\n }\r\n System.out.println(\"Enter content for the event [OPTIONAL]: \");\r\n String content = \"\";\r\n in = new Scanner(System.in);\r\n String line = in.nextLine();\r\n content += line;\r\n Event e = new Event(topic, title, content, keywords);\r\n publish(e);\r\n }\r\n\r\n break;\r\n }\r\n case 3: {\r\n topicsAdvertisedByPub();\r\n break;\r\n }\r\n case 4: {\r\n eventsPublishedByPub();\r\n break;\r\n\r\n }\r\n case 5: {\r\n breakLoop = true;\r\n in.close();\r\n saveState();\r\n break;\r\n }\r\n default:\r\n System.out.println(\"Please enter a Valid Option.\\n\");\r\n }\r\n } while (!breakLoop);\r\n }", "public interface OnDatePickListener {\n public void OnDatePick(Calendar pickedDate);\n}", "@MenuCallback(id=3)\n public void inputControlHasChanged(Object sender, EnumMenuItem item) {\n }", "@Override\n protected boolean isPersonalTell(ChatEvent evt){\n String type = evt.getType();\n return \"tell\".equals(type) || \"say\".equals(type) || \"ptell\".equals(type);\n }", "@Override\r\n\tpublic ActionMenu getContextMenuActions(final Program program) {\n\t\tfinal AbstractAction action = new AbstractAction() {\r\n\t\t public void actionPerformed(ActionEvent evt) {\r\n\t\t \tString title = program.getTitle();\r\n\t\t \tDate date = program.getDate();\r\n\t\t \tString startTime = program.getTimeString();\r\n\t\t \tString cannelId = program.getChannel().getUniqueId();\r\n\t\t \tif(channelMap.containsKey(cannelId)){\r\n\t\t \t\tint cannel = channelMap.get(cannelId);\r\n\t\t \t\tBongTVService.setBonguser(mBongTVData);\r\n\t\t \t\tif(BongTVService.getInstance().recordProgram(title, date.getFormattedString(\"dd-MM-yyyy\"), startTime, cannel)){\r\n\t\t \t\t\tprogram.mark(BongTVPlugin.getInstance());\r\n\t\t \t\t\tprogram.validateMarking();\r\n\t\t \t\t} else {\r\n\t\t \t\t // TODO NLS\r\n\t\t \t\t\tString sMsg = \"Das Programm konnte nicht gefunden werden.\\n\" +\r\n\t\t \t\t\t\t\t\"Evl. wird das Programm auf Bong.tv unter einen abweichenden Namen geführt.\\n\" +\r\n\t\t \t\t\t\t\t\"Zur Programmierung sollten sie Bong.tv direkt verwenden.\";\r\n\t\t \t\t\tJOptionPane.showMessageDialog(getParentFrame(), sMsg);\r\n\t\t \t\t}\r\n\t\t \t}\r\n\t\t }\r\n\t\t };\r\n\t\t \r\n\t\t // Enable menue only for channels provided by Bong.tv and User is validated\r\n\t\t if( !mBongTVData.isValid() ||\r\n\t\t program == null || \r\n\t\t\t program.getChannel() == null || \r\n\t\t\t program.getChannel().getName().equals(\"Channel 1\") ||\r\n\t\t\t !channelMap.containsKey(program.getChannel().getUniqueId())){\r\n\t\t\t action.setEnabled(false);\r\n\t\t }\r\n\t\t // Der Aktion einen Namen geben. Dieser Name wird dann im Kontextmenü gezeigt\r\n\t\t // TODO NLS\r\n\t\t action.putValue(Action.NAME, \"Bong.tv Aufnahme\");\r\n\r\n\t\t // Der Aktion ein Icon geben. Dieses Icon wird mit dem Namen im Kontextmenü gezeigt\r\n\t\t // Das Icon sollte 16x16 Pixel groß sein\r\n\t\t action.putValue(Action.SMALL_ICON, new ImageIcon(\r\n\t\t\t\t getClass().getResource(\"icons/16x16/default/Icon-BONGTV.png\")));\r\n\r\n\t\t // Das Aktions-Menü erzeugen und zurückgeben\r\n\t\t return new ActionMenu(action); \t\r\n\t}" ]
[ "0.6177857", "0.60922253", "0.6048394", "0.60190535", "0.5914247", "0.5877903", "0.58492124", "0.5764276", "0.5757778", "0.5730352", "0.57244277", "0.56794", "0.5627752", "0.5623946", "0.5571634", "0.55616564", "0.5560269", "0.55495495", "0.553183", "0.55263263", "0.55009186", "0.54799366", "0.5479429", "0.547696", "0.54504985", "0.5426507", "0.540458", "0.5389009", "0.5381468", "0.53627133", "0.5350298", "0.533692", "0.53320706", "0.5309864", "0.5307124", "0.5304465", "0.5286952", "0.52797794", "0.5266969", "0.5260664", "0.52576506", "0.52467453", "0.5246561", "0.5236774", "0.5234338", "0.5225222", "0.52222925", "0.5212921", "0.5209976", "0.5208691", "0.5205863", "0.51997805", "0.51967305", "0.51958185", "0.51934713", "0.51917607", "0.5183248", "0.5178151", "0.51772773", "0.51732856", "0.51718664", "0.51677036", "0.51663053", "0.51656556", "0.51609963", "0.5160197", "0.51590586", "0.51575756", "0.5156054", "0.515521", "0.5149272", "0.51490796", "0.5148174", "0.51451665", "0.51418364", "0.51405674", "0.51397204", "0.51392496", "0.5138495", "0.5138052", "0.5138017", "0.5138017", "0.5138017", "0.5138017", "0.5138017", "0.51338226", "0.5132831", "0.513197", "0.5130059", "0.51260734", "0.51259476", "0.51233834", "0.5118221", "0.5117539", "0.51127815", "0.51124483", "0.5111627", "0.51108414", "0.5109227", "0.5107106", "0.5106943" ]
0.0
-1
Loads the configuration file which contains: 1) Number of lines to read from the server's response 2) What to look for in the server's response 3) Available socket selection If the configuration file does not exist the program terminates
private void loadConfig() { File config = new File("config.ini"); if (config.exists()) { try { BufferedReader in = new BufferedReader(new FileReader(config)); configLine = Integer.parseInt(in.readLine()); configString = in.readLine(); socketSelect = (in.readLine()).split(","); in.close(); } catch (Exception e) { System.exit(1); } } else { System.exit(1); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static int getConfigFromFile(){\n\t\tint ret = -1;\n\t\ttry(BufferedReader r = new BufferedReader(new FileReader(\"./configFile\"))){\n\t\t\tTCPIP = new String(r.readLine().split(\":\")[1]);\n\t\t\tTCPSERVERPORT = Integer.parseInt((r.readLine().split(\":\")[1]));\n\t\t\tMCPORT = Integer.parseInt((r.readLine().split(\":\")[1]));\n\t\t\tMCIP = new String(r.readLine().split(\":\")[1]);\n\t\t\tRMISERVERPORT = Integer.parseInt((r.readLine().split(\":\")[1]));\n\t\t\tret = 0;\n\t\t} catch (FileNotFoundException e) {\n\t\t\tSystem.out.println(\"Config file not found. Please put it in the execution directory then restart.\");\n\t\t} catch(NumberFormatException e){\n\t\t\tSystem.out.println(\"Config file has an unsupported format. Please check it and restart.\");\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Some error occurred while reading from config file: \"+e.getMessage()+\"\\nPlease restart.\");\n\t\t}\n\t\treturn ret;\n\t}", "private void parseClientConfigFile(){\n\n boolean isClientFile = false; //states if the config-file is a clients file\n String line = \"\";\n\n try{\n buffReader = new BufferedReader(new FileReader (new File(logFileName) ));\n\n while( buffReader.ready()) {\n line = buffReader.readLine().trim();\n //check to see if <client> tag exists\n if (line.startsWith(\"<client>\")){\n isClientFile = true;\n }\n \n if (isClientFile){\n if (line.startsWith(\"<name>\")){\n this.name = line.substring(6, line.length()-7);\n } else if (line.startsWith(\"<key>\")){\n this.key = line.substring(5, line.length()-6);\n } else if (line.startsWith(\"<serverip>\")){\n this.serverIpString = line.substring(10, line.length()-11);\n } else if (line.startsWith(\"<serverport>\")){\n this.serverPort = Integer.valueOf(line.substring(12, line.length()-13));\n } else if (line.startsWith(\"<clientListenPort>\")){\n clientListenPort = Integer.valueOf(line.substring(18, line.length()-19));\n }\n else\n continue;\n } else\n initializeNA();\n }\n\n } catch (FileNotFoundException fnfEx){\n ClientInterface.getjTextArea1().append(\"Could not FIND client's Configuration File.\");\n initializeNA();\n } catch (IOException ioEx){\n ClientInterface.getjTextArea1().append(\"Could not OPEN client's Configuration File.\");\n initializeNA();\n }\n }", "public static void loadConfig() throws IOException {\n\t\t// initialize hash map\n\t\tserverOptions = new HashMap<>();\n\t\t// Get config from file system\n\t\tClass<ConfigurationHandler> configurationHandler = ConfigurationHandler.class;\n\t\tInputStream inputStream = configurationHandler.getResourceAsStream(\"/Config/app.properties\");\n\t\tInputStreamReader isReader = new InputStreamReader(inputStream);\n\t //Creating a BufferedReader object\n\t BufferedReader reader = new BufferedReader(isReader);\n\t String str;\n\t while((str = reader.readLine())!= null){\n\t \t if (str.contains(\"=\")) {\n\t \t\t String[] config = str.split(\" = \", 2);\n\t \t serverOptions.put(config[0], config[1]);\n\t \t }\n\t }\n\t}", "private static void loadConfig()\n\t{\n\t\ttry\n\t\t{\n\t\t\tfinal Properties props = ManagerServer.loadProperties(ManagerServer.class, \"/resources/conf.properties\");\n\t\t\tasteriskIP = props.getProperty(\"asteriskIP\");\n\t\t\tloginName = props.getProperty(\"userName\");\n\t\t\tloginPwd = props.getProperty(\"password\");\n\t\t\toutboundproxy = props.getProperty(\"outBoundProxy\");\n\t\t\tasteriskPort = Integer.parseInt(props.getProperty(\"asteriskPort\"));\n\t\t}\n\t\tcatch (IOException ex)\n\t\t{\n\t\t\tLOG.error(\"IO Exception while reading the configuration file.\", ex);\n\t\t}\n\t}", "public void loadConfigurationFromDisk() {\r\n try {\r\n FileReader fr = new FileReader(CONFIG_FILE);\r\n BufferedReader rd = new BufferedReader(fr);\r\n\r\n String line;\r\n while ((line = rd.readLine()) != null) {\r\n if (line.startsWith(\"#\")) continue;\r\n if (line.equalsIgnoreCase(\"\")) continue;\r\n\r\n StringTokenizer str = new StringTokenizer(line, \"=\");\r\n if (str.countTokens() > 1) {\r\n String aux;\r\n switch (str.nextToken().trim()) {\r\n case \"system.voidchain.protocol_version\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.protocolVersion = aux;\r\n continue;\r\n case \"system.voidchain.transaction.max_size\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.transactionMaxSize = Integer.parseInt(aux);\r\n continue;\r\n case \"system.voidchain.block.num_transaction\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.numTransactionsInBlock = Integer.parseInt(aux);\r\n continue;\r\n case \"system.voidchain.storage.data_file_extension\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.dataFileExtension = aux;\r\n }\r\n continue;\r\n case \"system.voidchain.storage.block_file_base_name\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.blockFileBaseName = aux;\r\n }\r\n continue;\r\n case \"system.voidchain.storage.wallet_file_base_name\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.walletFileBaseName = aux;\r\n }\r\n continue;\r\n case \"system.voidchain.storage.data_directory\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null) {\r\n aux = aux.replace('/', File.separatorChar);\r\n if (!aux.endsWith(File.separator))\r\n //aux = aux.substring(0, aux.length() - 1);\r\n aux = aux.concat(File.separator);\r\n this.dataDirectory = aux;\r\n }\r\n }\r\n continue;\r\n case \"system.voidchain.storage.block_file_directory\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null) {\r\n aux = aux.replace('/', File.separatorChar);\r\n if (!aux.endsWith(File.separator))\r\n //aux = aux.substring(0, aux.length() - 1);\r\n aux = aux.concat(File.separator);\r\n this.blockFileDirectory = aux;\r\n }\r\n }\r\n continue;\r\n case \"system.voidchain.storage.wallet_file_directory\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null) {\r\n aux = aux.replace('/', File.separatorChar);\r\n if (!aux.endsWith(File.separator))\r\n //aux = aux.substring(0, aux.length() - 1);\r\n aux = aux.concat(File.separator);\r\n this.walletFileDirectory = aux;\r\n }\r\n }\r\n continue;\r\n case \"system.voidchain.memory.block_megabytes\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.memoryUsedForBlocks = Integer.parseInt(aux);\r\n continue;\r\n case \"system.voidchain.sync.block_sync_port\":\r\n if (firstRun) {\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.blockSyncPort = Integer.parseInt(aux);\r\n }\r\n continue;\r\n case \"system.voidchain.crypto.ec_param\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.ecParam = aux;\r\n continue;\r\n case \"system.voidchain.core.block_proposal_timer\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.blockProposalTimer = Integer.parseInt(aux) * 1000;\r\n continue;\r\n case \"system.voidchain.blockchain.chain_valid_timer\":\r\n aux = str.nextToken().trim();\r\n if (aux != null)\r\n this.blockchainValidTimer = Integer.parseInt(aux) * 1000;\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n fr.close();\r\n rd.close();\r\n\r\n if (this.firstRun)\r\n this.firstRun = false;\r\n } catch (IOException e) {\r\n logger.error(\"Could not load configuration\", e);\r\n }\r\n }", "private void processConfigurationFile() throws RuntimeException {\n try {\n // Read all the lines and join them in a single string\n List<String> lines = Files.readAllLines(Paths.get(this.confFile));\n String content = lines.stream().reduce(\"\", (a, b) -> a + b);\n\n // Use the bson document parser to extract the info\n Document doc = Document.parse(content);\n this.mongoDBHostname = doc.getString(\"CLARUS_keystore_db_hostname\");\n this.mongoDBPort = doc.getInteger(\"CLARUS_keystore_db_port\");\n this.clarusDBName = doc.getString(\"CLARUS_keystore_db_name\");\n } catch (IOException e) {\n throw new RuntimeException(\"CLARUS configuration file could not be processed\", e);\n }\n }", "private void GetConfig()\n {\n boolean useClassPath = false;\n if(configFile_ == null)\n {\n useClassPath = true;\n configFile_ = \"data.config.lvg\";\n }\n // read in configuration file\n if(conf_ == null)\n {\n conf_ = new Configuration(configFile_, useClassPath);\n }\n }", "public void loadConfiguration(){\n\t\t\n\t\tString jarLoc = this.getJarLocation();\n\t\tTicklerVars.jarPath = jarLoc;\n\t\tTicklerVars.configPath=TicklerVars.jarPath+TicklerConst.configFileName;\n\t\t\n\t\t//Read configs from conf file\n\t\tif (new File(TicklerVars.configPath).exists()){\n\t\t\ttry {\n\t\t\t\tString line;\n\t\t\t\tBufferedReader reader = new BufferedReader(new FileReader(TicklerVars.configPath));\n\t\t\t\twhile ((line =reader.readLine())!= null) {\n\t\t\t\t\tif (line.contains(\"Tickler_local_directory\")){\n\t\t\t\t\t\tString loc = line.substring(line.indexOf(\"=\")+1, line.length());\n\t\t\t\t\t\tTicklerVars.ticklerDir = this.correctJarLoc(loc);\n\t\t\t\t\t}\n\t\t\t\t\telse if (line.contains(\"Tickler_sdcard_directory\")){\n\t\t\t\t\t\tString loc = line.substring(line.indexOf(\"=\")+1, line.length()-1);\n\t\t\t\t\t\tTicklerVars.sdCardPath = this.correctJarLoc(loc);\n\t\t\t\t\t}\n\t\t\t\t\telse if (line.contains(\"Frida_server_path\")){\n\t\t\t\t\t\tString loc = line.substring(line.indexOf(\"=\")+1, line.length());\n\t\t\t\t\t\tTicklerVars.fridaServerLoc = loc;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\treader.close();\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t//Config path does not exist\n\t\t\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"WARNING...... Configuration file does not exist!!!!\\nThe following default configurations are set:\\n\");\n\t\t\tTicklerVars.ticklerDir = TicklerVars.jarPath+TicklerConst.defaultTicklerDirName;\n\t\t\tSystem.out.println(\"Tickler Workspace directory on host: \"+TicklerVars.ticklerDir);\n\t\t\tSystem.out.println(\"Tickler temporary directory on device: \"+TicklerConst.sdCardPathDefault);\n\t\t}\n\t\t\n\t\tString x = TicklerVars.ticklerDir;\n\t\tif (TicklerVars.ticklerDir == null || TicklerVars.ticklerDir.matches(\"\\\\s*/\") ){\n\t\t\tTicklerVars.ticklerDir = TicklerVars.jarPath+TicklerConst.defaultTicklerDirName;\n//\t\t\tOutBut.printWarning(\"Configuration File \"+TicklerVars.configPath+ \" doesn't specify Tickler_local_directory. Workspace is set at \"+ TicklerVars.ticklerDir);\n\t\t\tOutBut.printStep(\"Tickler Workspace directory on host: \"+TicklerVars.ticklerDir);\n\t\t}\n\t\t\n\t\tif (TicklerVars.sdCardPath == null || TicklerVars.sdCardPath.matches(\"\\\\s*/\")) {\n\t\t\tTicklerVars.sdCardPath = TicklerConst.sdCardPathDefault;\t\n//\t\t\tOutBut.printWarning(\"Configuration File \"+TicklerVars.configPath+ \" doesn't specify Tickler's temp directory on the device. It is set to \"+ TicklerVars.sdCardPath);\n\t\t\tOutBut.printStep(\"Tickler temporary directory on device: \"+TicklerConst.sdCardPathDefault);\n\t\t}\n\t\t\t\n\t}", "private void getData() {\r\n Properties config = new Properties();\r\n\tFileInputStream input = null;\r\n\ttry {\r\n input = new FileInputStream(\"src/signupsigninserver/config/connection.properties\");\r\n config.load(input);\r\n port=Integer.parseInt(config.getProperty(\"port\"));\r\n maxThreads=Integer.parseInt(config.getProperty(\"max_threads\"));\r\n \r\n } catch (FileNotFoundException ex) {\r\n LOGGER.info(\"No encuentra archivo\");\r\n } catch (IOException ex) {\r\n Logger.getLogger(ILogicImplementation.class.getName()).log(Level.SEVERE, null, ex);\r\n } finally {\r\n if (input != null)\r\n\t\ttry {\r\n input.close();\r\n } catch (IOException ex) {\r\n Logger.getLogger(ILogicImplementation.class.getName()).log(Level.SEVERE, null, ex);\r\n } \r\n\t}\r\n }", "private void load() {\n if (loaded) {\n return;\n }\n loaded = true;\n\n if(useDefault){\n ConfigFileLoader.setSource(\n new MhttpdBaseConfigurationSource(\n Bootstrap.getMhttpdBaseFile(), \"server-embed.xml\"));\n }else {\n ConfigFileLoader.setSource(\n new MhttpdBaseConfigurationSource(\n Bootstrap.getMhttpdBaseFile(), getConfigFile()));\n }\n Digester digester = createStartDigester();\n try (ConfigurationSource.Resource resource = ConfigFileLoader.getSource().getServerXml()) {\n InputStream inputStream = resource.getInputStream();\n InputSource inputSource = new InputSource(resource.getUri().toURL().toString());\n inputSource.setByteStream(inputStream);\n digester.push(this);\n digester.parse(inputSource);\n } catch (Exception e) {\n return;\n }\n\n }", "public ConnectionConfiguration loadConnectionConfiguration(){\n\t\tConnectionConfiguration savedconfig = null;\n\t\ttry {\n\t\t FileInputStream propInFile = new FileInputStream( getConnConfigFile());\n\t\t Properties p = new Properties();\n\t\t p.load( propInFile );\n\n\t\t String server = p.getProperty(\"server\");\n\t\t String user = p.getProperty(\"user\");\n\t\t String passwd = p.getProperty(\"passwd\");\n\t\t \n\t\t if (server != null & user != null & passwd != null){\n\t\t\t savedconfig = new ConnectionConfiguration();\n\t\t\t savedconfig.setServer(server);\n\t\t\t savedconfig.setUser(user);\n\t\t\t savedconfig.setPasswd(passwd);\n\t\t }\n\t\t \n\t\t }\n\t\t catch ( FileNotFoundException e ) {\n\t\t //createConnectionConfigurationDialog(Resources.getString(\"msg_no_config_file\"));\n\t\t }\n\t\t catch ( IOException e ) {\n\t\t //createConnectionConfigurationDialog(Resources.getString(\"msg_config_file_not_readable\"));\n\t }\n\t\t return savedconfig; \n\t}", "private static void loadConfig() throws IOException { \t\t\n final InputStream input = Main.class.getResourceAsStream(\"/configuration.properties\");\n final Properties prop = new Properties();\n \n prop.load(input);\n System.out.println(\"Configuration loaded:\"); \n\n // PostgreSQL server access config\n dbmsUrl = prop.getProperty(\"dbms_url\");\n System.out.println(\"- dbms_url: \" + dbmsUrl);\n\n dbmsUser = prop.getProperty(\"dbms_user\");\n System.out.println(\"- dbms_user: \" + dbmsUser);\n\n userPw = prop.getProperty(\"user_pw\"); \n System.out.println(\"- user_pw: \" + userPw);\n\n\n // Benchmarks config\n noTransactions = Integer.parseInt(prop.getProperty(\"no_transactions\"));\n System.out.println(\"- no_transactions: \" + noTransactions);\n\n noStatementsPerTransaction = Integer.parseInt(prop.getProperty(\"no_statements_per_transaction\")); \n System.out.println(\"- no_statements_per_transaction: \" + noStatementsPerTransaction);\n\n noSelectStatements = Integer.parseInt(prop.getProperty(\"no_select_statements\")); \n System.out.println(\"- no_select_statements: \" + noSelectStatements + \"\\n\");\n\n input.close();\n }", "private static void loadConfig(String configFile) throws Exception {\n\t\t// System.out.println(\"Loading configuration from file \" + configFile);\n\t\tProperties props = new Properties();\n\t\tFileInputStream fis = new FileInputStream(configFile);\n\t\tprops.load(fis);\n\t\tfis.close();\n\n\t\tfor (String key : props.stringPropertyNames()) {\n\t\t\tif (key.startsWith(\"engine.\")) {\n\t\t\t\tif (key.startsWith(\"engine.jmxport.\")) {\n\t\t\t\t\tString port = props.getProperty(key, \"\").trim();\n\t\t\t\t\tif (port.length() > 0) {\n\t\t\t\t\t\tString host = props.getProperty(key.replaceFirst(\"jmxport\", \"jmxhost\"), \"localhost\").trim();\n\t\t\t\t\t\tString user = props.getProperty(key.replaceFirst(\"jmxport\", \"username\"), \"\").trim();\n\t\t\t\t\t\tString passwd = props.getProperty(key.replaceFirst(\"jmxport\", \"password\"), \"\").trim();\n\t\t\t\t\t\tString name = props.getProperty(key.replaceFirst(\"jmxport\", \"name\"), \"BE\").trim();\n\t\t\t\t\t\tif (user.length() == 0 || passwd.length() == 0) {\n\t\t\t\t\t\t\t// do not use authentication if user or password is\n\t\t\t\t\t\t\t// blank\n\t\t\t\t\t\t\tuser = null;\n\t\t\t\t\t\t\tpasswd = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tString jmxKey = host + \":\" + port;\n\t\t\t\t\t\tif (!clientMap.containsKey(jmxKey)) {\n\t\t\t\t\t\t\t// connect to JMX and initialize it for stat\n\t\t\t\t\t\t\t// collection\n\t\t\t\t\t\t\t// System.out.println(String.format(\"Connect to\n\t\t\t\t\t\t\t// engine %s at %s:%s\", name, host, port));\n\t\t\t\t\t\t\tClient c = new Client(name, host, Integer.parseInt(port), user, passwd);\n\t\t\t\t\t\t\tclientMap.put(jmxKey, c);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (key.startsWith(\"report.\")) {\n\t\t\t\tString type = props.getProperty(key, \"\").trim();\n\t\t\t\tif (type.length() > 0) {\n\t\t\t\t\tif (!statTypes.containsKey(type)) {\n\t\t\t\t\t\t// default no special includes, i.e., report all\n\t\t\t\t\t\t// entities\n\t\t\t\t\t\tstatTypes.put(type, null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// System.out.println(\"Add report type \" + type);\n\t\t\t} else if (key.startsWith(\"include.\")) {\n\t\t\t\t// add included entity pattern to specified stat type\n\t\t\t\tString[] tokens = key.split(\"\\\\.\");\n\t\t\t\tSet<String> includes = statTypes.get(tokens[1]);\n\t\t\t\tif (null == includes) {\n\t\t\t\t\tincludes = new HashSet<String>();\n\t\t\t\t\tstatTypes.put(tokens[1], includes);\n\t\t\t\t}\n\t\t\t\tString pattern = props.getProperty(key, \"\").trim();\n\t\t\t\tif (pattern.length() > 0) {\n\t\t\t\t\tincludes.add(pattern);\n\t\t\t\t}\n\t\t\t\t// System.out.println(String.format(\"Report %s includes entity\n\t\t\t\t// pattern %s\", tokens[1], pattern));\n\t\t\t} else if (key.equals(\"interval\")) {\n\t\t\t\tinterval = Integer.parseInt(props.getProperty(key, \"30\").trim());\n\t\t\t\t// System.out.println(\"Write stats every \" + interval + \"\n\t\t\t\t// seconds\");\n\t\t\t} else if (key.equals(\"ignoreInternalEntity\")) {\n\t\t\t\tignoreInternalEntity = Boolean.parseBoolean(props.getProperty(key, \"false\").trim());\n\t\t\t\tif (ignoreInternalEntity) {\n\t\t\t\t\t// System.out.println(\"Ignore stats of BE internal\n\t\t\t\t\t// entities\");\n\t\t\t\t}\n\t\t\t} else if (key.equals(\"reportFolder\")) {\n\t\t\t\treportFolder = props.getProperty(key, \"\").trim();\n\t\t\t\tif (0 == reportFolder.length()) {\n\t\t\t\t\treportFolder = null;\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"Statistics report is in folder \" + reportFolder);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"ignore config property \" + key);\n\t\t\t}\n\t\t}\n\t}", "public static void load() {\n try {\n File confFile = SessionService.getConfFileByPath(Const.FILE_CONFIGURATION);\n UtilSystem.recoverFileIfRequired(confFile);\n // Conf file doesn't exist at first launch\n if (confFile.exists()) {\n // Now read the conf file\n InputStream str = new FileInputStream(confFile);\n try {\n properties.load(str);\n } finally {\n str.close();\n }\n }\n } catch (Exception e) {\n Log.error(e);\n Messages.showErrorMessage(114);\n }\n }", "public void InitLinuxStart() throws IOException {\n\t\ttry {\n\t\t\t/**\n\t\t\t * Path to the <strong>preferences.conf</strong> file.\n\t\t\t */\n\t\t\tString preferencesPath = System.getProperty(\"user.dir\");\n\n\t\t\t/**\n\t\t\t * Creates a <em>File</em> object to the\n\t\t\t * <strong>preferences.conf</strong> file.\n\t\t\t */\n\t\t\tFile preferences = new File(preferencesPath + \"/preferences.conf\");\n\n\t\t\t/**\n\t\t\t * <em>FileReader</em> object to read from the\n\t\t\t * <strong>preferences.conf</strong> file.\n\t\t\t */\n\t\t\tFileReader prefRead = new FileReader(preferences);\n\n\t\t\t/**\n\t\t\t * <em>BufferedReader</em> object to read lines from the\n\t\t\t * <strong>preferences.conf</strong> file.\n\t\t\t */\n\t\t\tBufferedReader prefer = new BufferedReader(prefRead);\n\n\t\t\t/**\n\t\t\t * <em>StringTokenizer</em> object which reads contents from the\n\t\t\t * <strong>preferences.conf</strong> file as tokens.\n\t\t\t */\n\t\t\tStringTokenizer token;\n\n\t\t\t/**\n\t\t\t * Contains lines reads from the <strong>preferences.conf</strong>\n\t\t\t * file.\n\t\t\t */\n\t\t\tString str = prefer.readLine();\n\t\t\ttoken = new StringTokenizer(str, \":\");\n\t\t\ttry {\n\t\t\t\ttoken.nextToken();\n\t\t\t\tString port = token.nextToken().trim();\n\t\t\t\t/*\n\t\t\t\t * portNumber is initialized here\n\t\t\t\t */\n\t\t\t\tportNumber = Integer.parseInt(port);\n\t\t\t} catch (NoSuchElementException e) {\n\t\t\t\tportNumber = 65530;\n\t\t\t}\n\t\t\tstr = prefer.readLine();\n\t\t\ttoken = new StringTokenizer(str, \":\");\n\t\t\ttry {\n\t\t\t\ttoken.nextToken();\n\t\t\t\tString autoRep = token.nextToken().trim();\n\n\t\t\t\t/*\n\t\t\t\t * The boolean variable AutoRepeat is initialized in the\n\t\t\t\t * following lines.\n\t\t\t\t */\n\t\t\t\tif (Integer.parseInt(autoRep) == 1) {\n\t\t\t\t\tAutoRepeat = true;\n\t\t\t\t} else if (Integer.parseInt(autoRep) == 0) {\n\t\t\t\t\tAutoRepeat = false;\n\t\t\t\t} else {\n\t\t\t\t\tAutoRepeat = true;\n\t\t\t\t}\n\t\t\t} catch (NoSuchElementException e) {\n\t\t\t\tAutoRepeat = true;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * If the file preferences.conf is not present, initialize it to\n\t\t\t * default values.\n\t\t\t */\n\t\t} catch (FileNotFoundException f) {\n\t\t\tportNumber = 65530;\n\t\t\tAutoRepeat = true;\n\t\t}\n\n\t\t/*\n\t\t * Initialize the socket variable here.\n\t\t */\n\t\ttry {\n\t\t\tsocket = new ServerSocket(portNumber);\n\t\t} catch (BindException e) {\n\n\t\t\t/*\n\t\t\t * This displays a message box which notifies if another instance of\n\t\t\t * indic-keyboards is already running on the specified port.\n\t\t\t */\n\t\t\tDisplay display = Display.getCurrent();\n\t\t\tShell shell = new Shell(display);\n\t\t\tMessageBox messageBox = new MessageBox(shell, SWT.OK\n\t\t\t\t\t| SWT.ICON_ERROR);\n\t\t\tmessageBox.setText(\"Duplicate Instance\");\n\t\t\tmessageBox.setMessage(\"There is already an instance of indic-keyboards running. \"\n\t\t\t\t\t\t\t+ \"Close it first. If \"\n\t\t\t\t\t\t\t+ \"another instance isn't running, close any connections on port \"\n\t\t\t\t\t\t\t+ portNumber\n\t\t\t\t\t\t\t+ \" and try again.\"\n\t\t\t\t\t\t\t+ \" Alternatively, you can view the preferences.conf file to check the\"\n\t\t\t\t\t\t\t+ \" port number.\");\n\t\t\tmessageBox.open();\n\t\t\tshell.dispose();\n\t\t\tSystem.exit(0);\n\n\t\t}\n\t\t/*\n\t\t * Contains the pid of the JVM which runs indic-keyboards. This can be\n\t\t * used to kill the JVM in case indic-keyboards stops responding.\n\t\t */\n\t\tString pid = ManagementFactory.getRuntimeMXBean().getName();\n\t\tint index = pid.indexOf(\"@\");\n\n\t\t/*\n\t\t * Debug messages which will be shown on the console\n\t\t */\n\t\tSystem.out.println(\"This is the process ID : \"\n\t\t\t\t+ pid.substring(0, index));\n\t\tSystem.out.println(\"indic-keyboards listening on port \"\n\t\t\t\t+ socket.getLocalPort());\n\t\tif (AutoRepeat == false) {\n\t\t\tSystem.out.println(\"Auto Repeat is turned OFF\");\n\t\t}\n\t\tif (AutoRepeat == true) {\n\t\t\tSystem.out.println(\"Auto Repeat is turned ON\");\n\t\t}\n\n\t\t/*\n\t\t * Get the name of the main thread.\n\t\t */\n\t\tSystem.out.println(Thread.currentThread().getName());\n\n\t\t/*\n\t\t * The following lines creates a new thread which will run the key\n\t\t * logger. The key presses are monitored by this thread. The thread is\n\t\t * named as \"Key Monitor\"\n\t\t */\n\t\tRunnable r = new KeyMonitor();\n\t\tThread t = new Thread(r);\n\t\tt.setName(\"Key Monitor\");\n\t\tt.start();\n\t}", "private static HisPatientInfoConfiguration loadConfiguration(String filePath) throws HisServiceException{\n File file = new File(filePath);\n if(file != null && file.exists() && file.isFile() ) {\n try {\n configuration = new Yaml().loadAs(new FileInputStream(file), HisPatientInfoConfiguration.class);\n } catch(FileNotFoundException e) {\n log.error(e.getMessage());\n isOK = false;\n throw new HisServiceException(HisServerStatusEnum.NO_CONFIGURATION);\n }\n }\n else {\n isOK = false;\n }\n return configuration;\n }", "public void loadConfig() {\n\t}", "private static void processConfig() throws IOException, IllegalArgumentException, UnknownHostException {\n //\n // Use the defaults if there is no configuration file\n //\n File configFile = new File(dataPath+Main.fileSeparator+\"BitcoinWallet.conf\");\n if (!configFile.exists())\n return;\n //\n // Process the configuration file\n //\n List<PeerAddress> addressList = new ArrayList<>(5);\n try (BufferedReader in = new BufferedReader(new FileReader(configFile))) {\n String line;\n while ((line=in.readLine()) != null) {\n line = line.trim();\n if (line.length() == 0 || line.charAt(0) == '#')\n continue;\n int sep = line.indexOf('=');\n if (sep < 1)\n throw new IllegalArgumentException(String.format(\"Invalid configuration option: %s\", line));\n String option = line.substring(0, sep).trim().toLowerCase();\n String value = line.substring(sep+1).trim();\n switch (option) {\n case \"connect\":\n PeerAddress addr = new PeerAddress(value);\n addressList.add(addr);\n break;\n case \"passphrase\":\n Parameters.passPhrase = value;\n break;\n default:\n throw new IllegalArgumentException(String.format(\"Invalid configuration option: %s\", line));\n }\n }\n }\n if (!addressList.isEmpty())\n peerAddresses = addressList.toArray(new PeerAddress[addressList.size()]);\n }", "private void loadConfig() throws IOException {\n File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), \"bStats\");\n File configFile = new File(bStatsFolder, \"config.yml\");\n Config config = new Config(configFile);\n \n // Check if the config file exists\n if (!config.exists(\"serverUuid\")) {\n // Add default values\n config.set(\"enabled\", true);\n // Every server gets it's unique random id.\n config.set(\"serverUuid\", UUID.randomUUID().toString());\n // Should failed request be logged?\n config.set(\"logFailedRequests\", false);\n // Should the sent data be logged?\n config.set(\"logSentData\", false);\n // Should the response text be logged?\n config.set(\"logResponseStatusText\", false);\n \n DumperOptions dumperOptions = new DumperOptions();\n dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);\n writeFile(configFile,\n \"# bStats collects some data for plugin authors like how many servers are using their plugins.\",\n \"# To honor their work, you should not disable it.\",\n \"# This has nearly no effect on the server performance!\",\n \"# Check out https://bStats.org/ to learn more :)\",\n new Yaml(dumperOptions).dump(config.getRootSection()));\n }\n \n // Load the data\n enabled = config.getBoolean(\"enabled\", true);\n serverUUID = config.getString(\"serverUuid\");\n logFailedRequests = config.getBoolean(\"logFailedRequests\", false);\n logSentData = config.getBoolean(\"logSentData\", false);\n logResponseStatusText = config.getBoolean(\"logResponseStatusText\", false);\n }", "private void init() {\r\n this.configMapping = ChannelConfigHolder.getInstance().getConfigs();\r\n if (!isValid(this.configMapping)) {\r\n SystemExitHelper.exit(\"Cannot load the configuations from the configuration file please check the channelConfig.xml\");\r\n }\r\n }", "public void loadConfig(){\r\n File config = new File(\"config.ini\");\r\n if(config.exists()){\r\n try {\r\n Scanner confRead = new Scanner(config);\r\n \r\n while(confRead.hasNextLine()){\r\n String line = confRead.nextLine();\r\n if(line.indexOf('=')>0){\r\n String setting,value;\r\n setting = line.substring(0,line.indexOf('='));\r\n value = line.substring(line.indexOf('=')+1,line.length());\r\n \r\n //Perform the actual parameter check here\r\n if(setting.equals(\"romfile\")){\r\n boolean result;\r\n result = hc11_Helpers.loadBinary(new File(value.substring(value.indexOf(',')+1,value.length())),board,\r\n Integer.parseInt(value.substring(0,value.indexOf(',')),16));\r\n if(result)\r\n System.out.println(\"Loaded a rom file.\");\r\n else\r\n System.out.println(\"Error loading rom file.\");\r\n }\r\n }\r\n }\r\n confRead.close();\r\n } catch (FileNotFoundException ex) {\r\n ex.printStackTrace();\r\n }\r\n }\r\n }", "private static void checkConfiguration() {\n try {\n ClientManager.rebuildSocket();\n ClientManager.closeSocket();\n } catch (IOException e) {\n new NetworkNotAvailableErrorStarter(NetworkNotAvailableError.class, null);\n }\n }", "@Test\n public final void testConfigurationParser() {\n URL resourceUrl = this.getClass().getResource(configPath);\n File folder = new File(resourceUrl.getFile());\n for (File configFile : folder.listFiles()) {\n try {\n System.setProperty(\"loadbalancer.conf.file\", configFile.getAbsolutePath());\n LoadBalancerConfiguration.getInstance();\n } finally {\n LoadBalancerConfiguration.clear();\n }\n }\n }", "private void loadData() {\n\t\tlogger.trace(\"loadData() is called\");\n\t\t\n\t\ttry {\n\t\t\tFileInputStream fileIn = new FileInputStream(\"server-info.dat\");\n\t\t\tObjectInputStream in = new ObjectInputStream(fileIn);\n\t\t\tjokeFile = (String ) in.readObject();\n\t\t\tkkServerPort = (int) in.readObject();\n\t\t\tin.close();\n\t\t} catch (Exception e) {\n\t\t\tjokeFile = \"kk-jokes.txt\";\n\t\t\tkkServerPort = 5555;\n\t\t\t//e.printStackTrace();\n\t\t\tSystem.err.println(\"server-info.dat file is likely missing but it should be created automatically when this app is closed.\");\n\t\t\tlogger.info(\"server-info.dat file is likely missing but it should be created automatically when this app is closed.\");\n\t\t}\t\n\t}", "protected void printServerConfig(){\n\t\t/*String filePrefix = System.getProperty(\"user.dir\")+\"/src/server/\"+gameName;\n\t\tFile gameFolderServ = new File(filePrefix);\n\t\tString filePrefix2 = System.getProperty(\"user.dir\")+\"/src/auctions/\"+gameName;\n\t\tFile gameFolderAuct = new File(filePrefix2);\n\n\t\tFile server_config = new File(filePrefix+\"/Config_AuctionServer.txt\");\n\t\t*/\n\t\tFile server_config = new File(\"src/server/\"+\"Config_AuctionServer.txt\");\n\t\tif(!server_config.exists()){\n\n\t\t\t try{\n\n\t\t\t\t //gameFolderServ.mkdir();\n\t\t\t\t // gameFolderAuct.mkdir();\n\t\t\t\t server_config.createNewFile();\n\t\t\t\t FileWriter fstream = new FileWriter(server_config);\n\t\t\t\t BufferedWriter out = new BufferedWriter(fstream);\n\t\t\t\t if(localIP){\n\t\t\t\t\t out.write(\"Host_IP:local\\n\");\n\t\t\t\t }else{\n\t\t\t\t\t out.write(\"Host_IP:public\\n\");\n\t\t\t\t }\n\n\t\t\t\t out.write(\"Port_Number:\"+port+\"\\n\");\n\t\t\t\t //out.newLine();\n\n\t\t\t\t out.write(\"Min_Number_Clients:\"+minClients+\"\\n\");\n\t\t\t\t out.write(\"Max_Number_Clients:\"+maxClients+\"\\n\");\n\t\t\t\t out.write(\"Max_Wait_For_Clients:\"+maxWait+\"\\n\");\n\t\t\t\t out.write(\"Response_Time:\"+responseTime);\n\t\t\t\t out.newLine();\n\t\t\t\t if(respTime){\n\t\t\t\t\t out.write(\"Full_Response_Time:true\");\n\t\t\t\t }else{\n\t\t\t\t\t out.write(\"Full_Response_Time:false\");\n\t\t\t\t }\n\t\t\t\t out.newLine();\n\t\t\t\t out.write(\"Server_Log_File:Log_AuctionServer.txt\");\n\t\t\t\t out.newLine();\n\t\t\t\t out.write(\"Server_Results_File:Results_AuctionServer.txt\");\n\t\t\t\t out.newLine();\n\n\t\t\t\t if(maxSeq>1 && maxSim>1){\n\t\t\t\t\t out.write(\"Auction_Type:SequentialAuction\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t\t out.write(\"Auction_Config_File:Config_Sequential_of_Simultaneous.txt\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t }else if(maxSeq>1){\n\t\t\t\t\t out.write(\"Auction_Type:SequentialAuction\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t\t out.write(\"Auction_Config_File:Config_SequentialAuction_0.txt\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t }else if(maxSim>1){\n\t\t\t\t\t out.write(\"Auction_Type:SimultaneousAuction\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t\t out.write(\"Auction_Config_File:Config_SimultaneousAuction_0.txt\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t }else if(maxSeq==1 && maxSim==1){\n\t\t\t\t\t out.write(\"Auction_Type:\"+getAuctionName(auctionsSchedule[0])+\"\\n\");\n\t\t\t\t\t out.write(\"Auction_Config_File:Config_\"+getAuctionName(auctionsSchedule[0])+\"_0_0.txt\");\n\t\t\t\t\t out.newLine();\n\t\t\t\t }else{\n\t\t\t\t\t System.out.println(\"ERROR: no auctions\");\n\t\t\t\t }\n\n\t\t\t\t out.write(\"Valuation_Type:\"+valueFxn);\n\t\t\t\t out.newLine();\n\t\t\t\t out.write(\"Valuation_Config_File:Config_Valuation\"+valueFxn+\".txt\");\n\n\t\t\t\t out.close();\n\n\t\t\t }catch (IOException e){\n\t\t\t\t\tSystem.out.println(\"file error creating Server Config.\");\n\t\t\t}\n\t\t}\n\t}", "public static void loadFromFile() {\n\t\tloadFromFile(Main.getConfigFile(), Main.instance.getServer());\n\t}", "private static void loadConfig() {\n\t\trxID = (Integer) ConfigStoreRedstoneWireless.getInstance(\n\t\t\t\t\"WirelessRedstone\").get(\"Receiver.ID\", Integer.class,\n\t\t\t\tnew Integer(rxID));\n\t\ttxID = (Integer) ConfigStoreRedstoneWireless.getInstance(\n\t\t\t\t\"WirelessRedstone\").get(\"Transmitter.ID\", Integer.class,\n\t\t\t\tnew Integer(txID));\n\t}", "public String readConfiguration(String path);", "private static void readConfigFile() {\n\n BufferedReader input = null;\n try {\n input = new BufferedReader(new FileReader(getConfigFile()));\n String sLine = null;\n while ((sLine = input.readLine()) != null) {\n final String[] sTokens = sLine.split(\"=\");\n if (sTokens.length == 2) {\n m_Settings.put(sTokens[0], sTokens[1]);\n }\n }\n }\n catch (final FileNotFoundException e) {\n }\n catch (final IOException e) {\n }\n finally {\n try {\n if (input != null) {\n input.close();\n }\n }\n catch (final IOException e) {\n Sextante.addErrorToLog(e);\n }\n }\n\n }", "public abstract void loaded() throws ConfigurationException;", "private void defaultConfig(){\n\t\t\n\t\t String status =\"\";\n\t\t try {\n\t\t \tstatus =\"reading control file\";\n\t\t \tString aFile = controlfileTF.getText();\n\t\t\t config.controlfile = aFile;\n\n\t\t BufferedReader input = new BufferedReader(new FileReader(aFile));\n\t\t try {\n\t\t \n\t\t config.outputdir = input.readLine();\t\t \n\t\t outputdirTF.setText(config.outputdir);\n\t\t config.reginputdir = input.readLine();\t\t \n\t\t reginputdirTF.setText(config.reginputdir);\n\t\t config.grdinputdir = input.readLine();\t\t \n\t\t grdinputdirTF.setText(config.grdinputdir);\n\t\t config.eqchtinputdir = input.readLine();\t\t \n\t\t eqchtinputdirTF.setText(config.eqchtinputdir);\n\t\t config.spchtinputdir = input.readLine();\t\t \n\t\t spchtinputdirTF.setText(config.spchtinputdir);\n\t\t config.trchtinputdir = input.readLine();\t\t \n\t\t trchtinputdirTF.setText(config.trchtinputdir);\n\t\t config.restartinputdir = input.readLine();\t\t \n\t\t restartinputdirTF.setText(config.restartinputdir);\n\t\t config.calibrationdir = input.readLine();\t\t \n\t\t calibrationdirTF.setText(config.calibrationdir);\n\t\t \n\t\t config.runstage = input.readLine();\n\t\t if (config.runstage.equalsIgnoreCase(\"eq\")) {\n\t\t \trunstageRB[0].setSelected(true);\n\t\t } else if (config.runstage.equalsIgnoreCase(\"sp\")) {\n\t\t \trunstageRB[1].setSelected(true);\t\t \t\n\t\t } else if (config.runstage.equalsIgnoreCase(\"tr\")) {\n\t\t \trunstageRB[2].setSelected(true);\t\t \t\n\t\t } else if (config.runstage.equalsIgnoreCase(\"sptr\")) {\n\t\t \trunstageRB[3].setSelected(true);\t\t \t\n\t\t }\n\t\t \n\t\t config.initmode = input.readLine();\t\t \n\t\t if (config.initmode.equalsIgnoreCase(\"lookup\")) {\n\t\t \tinitmodeRB[0].setSelected(true);\n\t\t } else if (config.initmode.equalsIgnoreCase(\"restart\")) {\n\t\t \tinitmodeRB[1].setSelected(true);\n\t\t } else if (config.initmode.equalsIgnoreCase(\"sitein\")) {\n\t\t \tinitmodeRB[2].setSelected(true);\t\t \t\n\t\t }\n\t\t \n\t\t config.climatemode = input.readLine();\t\t \n\t\t if (config.climatemode.equalsIgnoreCase(\"normal\")) {\n\t\t \tclmmodeRB[0].setSelected(true);\n\t\t } else if (config.climatemode.equalsIgnoreCase(\"dynamic\")) {\n\t\t \tclmmodeRB[1].setSelected(true);\t\t \t\n\t\t }\n\n\t\t config.co2mode = input.readLine();\t\t \n\t\t if (config.co2mode.equalsIgnoreCase(\"initial\")) {\n\t\t \tco2modeRB[0].setSelected(true);\n\t\t } else if (config.co2mode.equalsIgnoreCase(\"dynamic\")) {\n\t\t \tco2modeRB[1].setSelected(true);\n\t\t }\n\n\t\t config.casename = input.readLine();\t\t \n\t\t casenameTF.setText(config.casename);\n \n\t\t }catch (Exception e){\n\t\t \t JOptionPane.showMessageDialog(f, status+\" failed\");\n\t\t }\n\t\t finally {\n\t\t input.close();\n\t\t }\n\t\t }\n\t\t catch (IOException ex){\n\t\t ex.printStackTrace();\n\t\t }\t\t\n\t\t}", "public static void acceptConfig() {\r\n\t\t//Here, it tries to read over the config file using try-catch in case of Exception\r\n\t\ttry {\r\n\t\t\tProperties properties = new Properties();\r\n\t\t\tFileInputStream fis = new FileInputStream(new File(\"config.properties\"));\r\n\t\t\tproperties.load(fis);\r\n\t\t\tString storage = properties.getProperty(\"storage\");\r\n\t\t\tif(storage == null) \r\n\t\t\t\tthrow new IllegalArgumentException(\"Property 'storage' not found\");\r\n\t\t\tif(storage.equals(\"tree\"))\r\n\t\t\t\tdata = new BinarySearchTree();\r\n\t\t\tif(storage.equals(\"trie\"))\r\n\t\t\t\tdata = new Trie();\r\n\t\t\tif(data == null) \r\n\t\t\t\tthrow new IllegalArgumentException(\"Not valid storage configuration.\");\r\n\t\t}\r\n\t\t//If an Exception occurs, it just prints a message\r\n\t\tcatch (FileNotFoundException e) {\r\n\t\t\tSystem.out.println(\"Configuration file not found.\");\r\n\t\t\tSystem.exit(1);\r\n\t\t} catch (IllegalArgumentException e) {\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t\tSystem.exit(1);\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\"Error reading the configuration file.\");\r\n\t\t\tSystem.exit(1);\r\n\t\t}\r\n\t}", "private void loadProperties() {\n\t\t\n\t\tString fldr = env.getProperty(\"response.folder\");\n\t\tthis.repo.setRootFolder( new File(fldr));;\n\t\t\n\t\tint nthConfigItem = 1;\n\t\twhile(true) {\n\t\t\tString seq = (\"\"+nthConfigItem++).trim();\n\t\t\t\n\t\t\tString xpathPropName = \"request.\" + seq + \".xpath\";\n\t\t\tString responseTextFilePropName = \"request.\" + seq + \".response.file\";\n\t\t\tString xpath = env.getProperty(xpathPropName);\n\t\t\tString responseTextFileName = env.getProperty(responseTextFilePropName);\n\t\t\tif (xpath!=null && !\"\".equals(xpath.trim())\n\t\t\t\t&& responseTextFileName!=null & !\"\".equals(responseTextFileName.trim())\t) {\n\t\t\t\t\n\t\t\t\trepo.addFile(xpath, responseTextFileName);\n\t\t\t\tController.logAlways(\"Loading config item [\" + seq + \"] xpath: [\" + rpad(xpath, 60) + \"] data file: [\" + rpad(responseTextFileName,25) + \"]\" );\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tController.logAlways(\"End of littleMock initialization. No more properties from application.properties will be loaded because either [\" + xpathPropName + \"] or [\" + responseTextFilePropName + \"] was not found in application.properties.\");\n\t\t\t\t//parameters in application.properties must be\n\t\t\t\t//in sequential order, starting at 1.\n\t\t\t\t//When we discover the first missing one, stop looking for more.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\thumanReadableConfig = PlaybackRepository.SINGLETON.humanReadable();\n\t}", "private void checkConfig(String path) {\n\t\tLog.i(\"ChooseFileActivity\", \"Path: \" + path);\n\t\ttry {\n\t\t\tFileInputStream fis = new FileInputStream(path);\n\t\t\tBufferedReader myReader = new BufferedReader(new InputStreamReader(\n\t\t\t\t\tfis));\n\t\t\tboolean gotoNeighbor = false;\n\t\t\tif (myReader.readLine().equals(confProof)) {\n\t\t\t\tgotoNeighbor = true;\n\t\t\t\tString Fileline = myReader.readLine();\n\t\t\t\tlocationNames = \"\";\n\n\t\t\t\twhile (Fileline != null) {\n\t\t\t\t\tif (Fileline.substring(0, 1).equals(\"#\")) {\n\t\t\t\t\t\tString[] refreshDataSplit = Fileline.split(\":\");\n\t\t\t\t\t\trefreshTime = Integer.parseInt(refreshDataSplit[1]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlocationNames += Fileline;\n\t\t\t\t\t}\n\t\t\t\t\tFileline = myReader.readLine();\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tshowToast(\"Wrong Configuration File!\");\n\t\t\t}\n\n\t\t\tmyReader.close();\n\t\t\tif (gotoNeighbor) {\n\t\t\t\tIntent intent = new Intent(getApplicationContext(), MainActivity.class);\n\t\t\t\tif (refreshTime != 0) {\n\t\t\t\t\tintent.putExtra(MessageTypes.REFRESH_TIME.toString(), refreshTime);\n\t\t\t\t}\n\t\t\t\tintent.putExtra(MessageTypes.CONFIGFILE.toString(), getExtensionOrFileName(path, false));\n\t\t\t\tintent.putExtra(MessageTypes.LOCATION_NAMES.toString(), locationNames);\n\t\t\t\tsetResult(RESULT_OK, intent);\n\t\t\t\tfinish();\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "private void loadFtpConfiguration(){\n\t\t//Get the active profile\n\t\tProfile activeProfile = settingsService.getActiveProfile();\n\t\tHOST = activeProfile.getIpNmt();\n\t\t\n\t\tString puerto = activeProfile.getFtpPort();\n\t\tif (null != puerto && !\"\".equals(puerto)){\n\t\t\tPORT = Integer.valueOf(puerto);\t\t\n\t\t} else {\n\t\t\tPORT = 21; //DEFAULT PORT\n\t\t}\n\t\tUSERNAME = activeProfile.getFtpUser();\n\t\tPASSWORD = activeProfile.getFtpPassword();\t\t\n\t}", "private void doLoad( InputStream res )\n {\n try\n {\n String str = IOUtils.toString( res, UTF_8 );\n String md5 = DigestUtils.md5Hex( str ).toUpperCase();\n if ( md5.equals( md5Hex ) )\n {\n logger.info( \"Skip, NO_CHANGE\" );\n return;\n }\n\n ProxyConfiguration parsed = parseConfig( str );\n logger.info( \"Loaded: {}\", parsed );\n\n if ( parsed.readTimeout != null )\n {\n this.readTimeout = parsed.readTimeout;\n }\n\n if ( this.retry == null )\n {\n this.retry = parsed.retry;\n }\n else if ( parsed.retry != null )\n {\n this.retry.copyFrom( parsed.retry );\n }\n\n if ( parsed.services != null )\n {\n parsed.services.forEach( sv -> {\n overrideIfPresent( sv );\n } );\n }\n\n if ( md5Hex != null )\n {\n bus.publish( EVENT_PROXY_CONFIG_CHANGE, \"\" );\n }\n\n md5Hex = md5;\n }\n catch ( IOException e )\n {\n logger.error( \"Load failed\", e );\n }\n }", "public void loadConfiguration() {\n Properties prop = new Properties();\n String propFileName = \".env_\" + this.dbmode.name().toLowerCase();\n InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);\n try {\n if (inputStream != null) {\n prop.load(inputStream);\n } else {\n System.err.println(\"property file '\" + propFileName + \"' not found in the classpath\");\n }\n this.jdbc = prop.getProperty(\"jdbc\");\n this.host = prop.getProperty(\"host\");\n this.port = prop.getProperty(\"port\");\n this.database = prop.getProperty(\"database\");\n this.user = prop.getProperty(\"user\");\n this.password = prop.getProperty(\"password\");\n // this.sslFooter = prop.getProperty(\"sslFooter\");\n } catch (Exception e) {\n System.err.println(\"can't read property file\");\n }\n try {\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public void readInit(String filename) {\n\t\ttry {\n\t\t\tprefs = new IniPreferences(new Ini(new File(filename)));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tif (prefs != null) {\n\t\t\ttry {\n\t\t\t\tif (prefs.nodeExists(MODNAME)) {\n\t\t\t\t\tport = Integer.valueOf(prefs.node(MODNAME).get(\"port\", \"9099\"));\n\t\t\t\t}\n\t\t\t} catch (BackingStoreException ex) {\n\t\t\t\tex.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "public void load() throws Exception\n {\n String id = request.getParameter(\"config\");\n if (id != null && id.length() > 0)\n {\n List<DDVConfig> configs = this.getConfigs();\n for (DDVConfig c:configs)\n {\n if (c.getId().equals(id))\n {\n this.config = c;\n return;\n }\n }\n }\n }", "@Test\n public void getUsingMoreSources() throws Exception {\n ReadConfig conf = new ReadConfig();\n try {\n conf.getFileName();\n } catch (Exception e) {\n assertTrue(e.getMessage().equals(\"Try to access config file before reading it.\") );\n }\n try {\n conf.readFile();\n } catch (IOException e) {\n e.printStackTrace();\n }\n assertNotNull(conf.getFileName());\n assertTrue(conf.getFileName().size() == 1);\n assertFalse(conf.getUsingMoreSources());\n }", "public static void load() {\r\n\r\n log.info(\"Config : loading Listener info\"); //$NON-NLS-1$\r\n\r\n Collection children = Collections.EMPTY_LIST;\r\n\r\n try {\r\n\r\n Content startPage = ContentRepository.getHierarchyManager(ContentRepository.CONFIG).getContent(CONFIG_PAGE);\r\n Content configNode = startPage.getContent(\"IPConfig\");\r\n children = configNode.getChildren(ItemType.CONTENTNODE); //$NON-NLS-1$\r\n }\r\n catch (RepositoryException re) {\r\n log.error(\"Config : Failed to load Listener info\"); //$NON-NLS-1$\r\n log.error(re.getMessage(), re);\r\n }\r\n\r\n Listener.cachedContent.clear();\r\n Listener.cacheContent(children);\r\n log.info(\"Config : Listener info loaded\"); //$NON-NLS-1$\r\n }", "public static void readConfig() {\n\t\tint[] defaultBanned = Loader.isModLoaded(\"twilightforest\") ? new int[]{7} : new int[0];\n\t\t\n\t\tDIMENSION_LIST = ConfigHelpers.getIntArray(config, \"dimensionIdList\", \"general\", defaultBanned, \"The list of dimension IDs, used as a allow-list or deny-list, depending on your other config settings. Internal numeric IDs, please.\");\n\t\t\n\t\tMODE = ConfigHelpers.getEnum(config, \"mode\", \"general\", ListMode.DENY_LIST, \"What mode should Broken Wings operate under?\", (mode) -> {\n\t\t\tswitch (mode) {\n\t\t\t\tcase DENY_LIST: return \"Flying is disabled in only the dimensions listed in \\\"dimensionList\\\".\";\n\t\t\t\tcase ALLOW_LIST: return \"Flying is disabled in all dimensions, except the ones listed in \\\"dimensionList\\\".\";\n\t\t\t\tcase ALWAYS_DENY: return \"Flying is always disabled, regardless of dimension ID.\";\n\t\t\t\tcase ALWAYS_ALLOW: return \"Flying is never disabled (it's like the mod isn't even installed)\";\n\t\t\t\tdefault: return \"h\";\n\t\t\t}\n\t\t}, ListMode.class);\n\t\t\n\t\tARMOR_BYPASS_KEYS = ConfigHelpers.getItemList(config, \"bypassKeyArmor\", \"general\", new ItemList(), \"A player wearing one of these armor pieces will be immune to the no-flight rule.\");\n\t\t\n\t\tINVENTORY_BYPASS_KEYS = ConfigHelpers.getItemList(config, \"bypassKeyInventory\", \"general\", new ItemList(), \"A player with one of these items in their inventory will be immune to the no-flight rule.\");\n\t\t\n\t\tif(Loader.isModLoaded(\"baubles\")) {\n\t\t\tBUBBLE_BYPASS_KEYS = ConfigHelpers.getItemList(config, \"bypassKeyBauble\", \"general\", new ItemList(), \"A player wearing one of these Baubles will be immune to the no-flight rule.\");\n\t\t} else {\n\t\t\tBUBBLE_BYPASS_KEYS = new ItemList();\n\t\t}\n\t\t\n\t\t//Countermeasures\n\t\tCountermeasures.readConfig(config);\n\t\t\n\t\t//Effects\n\t\tPRINT_TO_LOG = config.getBoolean(\"printToLog\", \"effects\", true, \"Should a message be printed to the server console when a player is dropped from the sky?\");\n\t\t\n\t\tSEND_STATUS_MESSAGE = config.getBoolean(\"sendStatusMessage\", \"effects\", true, \"Should players receive a status message when they are dropped from the sky?\");\n\t\t\n\t\tSHOW_PARTICLES = config.getBoolean(\"showParticles\", \"effects\", true, \"Should players create particle effects when they are dropped from the sky?\");\n\t\t\n\t\tEFFECT_INTERVAL = config.getInt(\"effectInterval\", \"effects\", 3, 0, Integer.MAX_VALUE, \"To prevent spamming players and the server console, how many seconds will need to pass before performing another effect? (Players will still drop out of the sky if they try to fly faster than this interval.)\");\n\t\t\n\t\tFIXED_MESSAGE = config.getString(\"fixedStatusMessage\", \"effects\", \"\", \"Whatever you enter here will be sent to players when they are dropped out of the sky if 'effects.sendStatusMessage' is enabled. If this is empty, I'll choose from my own internal list of (tacky) messages.\").trim();\n\t\t\n\t\t//Client\n\t\tSHOW_BYPASS_KEY_TOOLTIP = config.getBoolean(\"showBypassKeyTooltip\", \"client\", true, \"Show a tooltip on items that are bypass-keys informing the player that they can use this item to bypass the rule.\");\n\t\t\n\t\tif(config.hasChanged()) config.save();\n\t}", "public Configuration() {\r\n\t\tthis.serverAddress = \"127.0.0.1\";\r\n\t\tthis.serverPort = \"2586\";\r\n\t}", "public Component(Reference xmlConfigReference) {\r\n this();\r\n DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\r\n dbf.setNamespaceAware(false);\r\n dbf.setValidating(false);\r\n \r\n try {\r\n DocumentBuilder db = dbf.newDocumentBuilder();\r\n Document document = db.parse(new FileInputStream(\r\n new LocalReference(xmlConfigReference).getFile()));\r\n \r\n // Look for clients\r\n NodeList clientNodes = document.getElementsByTagName(\"client\");\r\n \r\n for (int i = 0; i < clientNodes.getLength(); i++) {\r\n Node clientNode = clientNodes.item(i);\r\n Node item = clientNode.getAttributes().getNamedItem(\"protocol\");\r\n Client client = null;\r\n \r\n if (item == null) {\r\n item = clientNode.getAttributes().getNamedItem(\"protocols\");\r\n \r\n if (item != null) {\r\n String[] protocols = item.getNodeValue().split(\" \");\r\n List<Protocol> protocolsList = new ArrayList<Protocol>();\r\n \r\n for (int j = 0; j < protocols.length; j++) {\r\n protocolsList.add(getProtocol(protocols[j]));\r\n }\r\n \r\n client = new Client(getContext(), protocolsList);\r\n }\r\n } else {\r\n client = new Client(getContext(), getProtocol(item\r\n .getNodeValue()));\r\n }\r\n \r\n if (client != null) {\r\n this.getClients().add(client);\r\n }\r\n }\r\n \r\n // Look for servers\r\n NodeList serverNodes = document.getElementsByTagName(\"server\");\r\n \r\n for (int i = 0; i < serverNodes.getLength(); i++) {\r\n Node serverNode = serverNodes.item(i);\r\n Node node = serverNode.getAttributes().getNamedItem(\"protocol\");\r\n Node portNode = serverNode.getAttributes().getNamedItem(\"port\");\r\n Server server = null;\r\n \r\n if (node == null) {\r\n node = serverNode.getAttributes().getNamedItem(\"protocols\");\r\n \r\n if (node != null) {\r\n String[] protocols = node.getNodeValue().split(\" \");\r\n List<Protocol> protocolsList = new ArrayList<Protocol>();\r\n \r\n for (int j = 0; j < protocols.length; j++) {\r\n protocolsList.add(getProtocol(protocols[j]));\r\n }\r\n \r\n int port = getInt(portNode, Protocol.UNKNOWN_PORT);\r\n \r\n if (port == Protocol.UNKNOWN_PORT) {\r\n getLogger()\r\n .warning(\r\n \"Please specify a port when defining a list of protocols.\");\r\n } else {\r\n server = new Server(getContext(), protocolsList,\r\n getInt(portNode, Protocol.UNKNOWN_PORT),\r\n this.getServers().getTarget());\r\n }\r\n }\r\n } else {\r\n Protocol protocol = getProtocol(node.getNodeValue());\r\n server = new Server(getContext(), protocol, getInt(\r\n portNode, protocol.getDefaultPort()), this\r\n .getServers().getTarget());\r\n }\r\n \r\n if (server != null) {\r\n this.getServers().add(server);\r\n }\r\n \r\n // Look for default host\r\n NodeList defaultHostNodes = document\r\n .getElementsByTagName(\"defaultHost\");\r\n \r\n if (defaultHostNodes.getLength() > 0) {\r\n parseHost(this.getDefaultHost(), defaultHostNodes.item(0));\r\n }\r\n \r\n // Look for other virtual hosts\r\n NodeList hostNodes = document.getElementsByTagName(\"host\");\r\n \r\n for (int j = 0; j < hostNodes.getLength(); j++) {\r\n VirtualHost host = new VirtualHost();\r\n parseHost(host, hostNodes.item(j));\r\n this.getHosts().add(host);\r\n }\r\n }\r\n \r\n // Look for internal router\r\n NodeList internalRouterNodes = document\r\n .getElementsByTagName(\"internalRouter\");\r\n \r\n if (internalRouterNodes.getLength() > 0) {\r\n Node node = internalRouterNodes.item(0);\r\n Node item = node.getAttributes().getNamedItem(\r\n \"defaultMatchingMode\");\r\n if (item != null) {\r\n this.getInternalRouter().setDefaultMatchingMode(\r\n getInt(item, getInternalRouter()\r\n .getDefaultMatchingMode()));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"maxAttempts\");\r\n if (item != null) {\r\n this.getInternalRouter().setMaxAttempts(\r\n getInt(item, this.getInternalRouter()\r\n .getMaxAttempts()));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"routingMode\");\r\n if (item != null) {\r\n this.getInternalRouter().setRoutingMode(\r\n getInt(item, this.getInternalRouter()\r\n .getRoutingMode()));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"requiredScore\");\r\n if (item != null) {\r\n this.getInternalRouter().setRequiredScore(\r\n getFloat(item, this.getInternalRouter()\r\n .getRequiredScore()));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"retryDelay\");\r\n if (item != null) {\r\n this.getInternalRouter().setRetryDelay(\r\n getLong(item, this.getInternalRouter()\r\n .getRetryDelay()));\r\n }\r\n \r\n // Loops the list of \"attach\" instructions\r\n setAttach(getInternalRouter(), node);\r\n }\r\n \r\n // Look for logService\r\n NodeList logServiceNodes = document\r\n .getElementsByTagName(\"logService\");\r\n \r\n if (logServiceNodes.getLength() > 0) {\r\n Node node = logServiceNodes.item(0);\r\n Node item = node.getAttributes().getNamedItem(\"logFormat\");\r\n \r\n if (item != null) {\r\n this.getLogService().setLogFormat(item.getNodeValue());\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"loggerName\");\r\n \r\n if (item != null) {\r\n this.getLogService().setLoggerName(item.getNodeValue());\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"enabled\");\r\n \r\n if (item != null) {\r\n this.getLogService().setEnabled(getBoolean(item, true));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"identityCheck\");\r\n \r\n if (item != null) {\r\n this.getLogService().setIdentityCheck(\r\n getBoolean(item, true));\r\n }\r\n }\r\n \r\n // Look for statusService\r\n NodeList statusServiceNodes = document\r\n .getElementsByTagName(\"statusService\");\r\n \r\n if (statusServiceNodes.getLength() > 0) {\r\n Node node = statusServiceNodes.item(0);\r\n Node item = node.getAttributes().getNamedItem(\"contactEmail\");\r\n \r\n if (item != null) {\r\n this.getStatusService()\r\n .setContactEmail(item.getNodeValue());\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"enabled\");\r\n \r\n if (item != null) {\r\n this.getStatusService().setEnabled(getBoolean(item, true));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"homeRef\");\r\n \r\n if (item != null) {\r\n this.getStatusService().setHomeRef(\r\n new Reference(item.getNodeValue()));\r\n }\r\n \r\n item = node.getAttributes().getNamedItem(\"overwrite\");\r\n \r\n if (item != null) {\r\n this.getStatusService()\r\n .setOverwrite(getBoolean(item, true));\r\n }\r\n }\r\n } catch (Exception e) {\r\n getLogger().log(Level.WARNING,\r\n \"Unable to parse the Component XML configuration.\", e);\r\n }\r\n }", "public void parse(){\n\t\tFile file = new File(fileLocation);\n\n\t\tlong seed = ConfigurationData.DEFAULT_SEED;\n\t\tString outputDest = ConfigurationData.DEFAULT_OUTPUT_DESTINATION;\n\t\tLong tickLength = ConfigurationData.DEFAULT_TICK_LENGTH;\n\t\tint port = ConfigurationData.DEFAULT_PORT;\n\n\t\ttry {\n\n\t\t\tScanner sc = new Scanner(file);\n\n\t\t\twhile(sc.hasNext()){\n\t\t\t\tString[] tok = sc.next().split(\"=\");\n\t\t\t\tswitch(tok[0]){\n\t\t\t\tcase \"seed\":\n\t\t\t\t\tseed = Long.parseLong(tok[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"outputDestination\":\n\t\t\t\t\toutputDest = tok[1];\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"tickLength\":\n\t\t\t\t\ttickLength = Long.parseLong(tok[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"port\":\n\t\t\t\t\tport = Integer.parseInt(tok[1]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsc.close();\n\n\t\t\tconfigurationData = new ConfigurationData(seed, outputDest, tickLength, port);\n\t\t} \n\t\tcatch (FileNotFoundException e) {\n\t\t\tPrintWriter writer;\n\t\t\ttry {\n\t\t\t\twriter = new PrintWriter(fileLocation, \"UTF-8\");\n\t\t\t\twriter.println(\"seed=\"+seed);\n\t\t\t\twriter.println(\"outputDestination=\"+outputDest);\n\t\t\t\twriter.println(\"tickLength=\"+tickLength);\n\t\t\t\twriter.println(\"port=\"+port);\n\t\t\t\twriter.close();\n\t\t\t} catch (FileNotFoundException e1) {\n\t\t\t\te1.printStackTrace();\n\t\t\t} catch (UnsupportedEncodingException e1) {\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\t\t\tconfigurationData = ConfigurationData.makeDefault();\n\t\t\tSystem.out.println(\"Default file created\");\n\t\t}\n\t}", "Config(InfoHandler info){\n \n this.info = info;\n \n config_list = new ArrayList<>();\n \n File test = new File(config_path);\n \n if(test.exists()){ //plik istnieje\n \n info.mode=1; //wlaczenie trybu dla obslugi pliku konfiguracyjnego\n \n \n //tutaj pobieranie informacji z pliku konfiguracyjnego\n //do ciała funkcji\n \n config_file = new DictReader(config_path,info);\n \n //tutaj dodajemy funkcjonalnosci\n \n config_list.add(config_file.szukaj(\"%imie\"));\n config_list.add(config_file.szukaj(\"%dict_path\"));\n \n config = get_config();\n \n info.mode=0;\n \n is_alive = true;\n }\n else{\n config = new ArrayList<>();\n config_file = new DictReader(config_path,info);\n first_start = 1;\n }\n }", "public boolean loadFile() {\n\n\t\tboolean result = false;\n\n\t\tSystem.out.println(\"Checking configuration file: \"+ cnfFile.getAbsolutePath());\n\n\t\tif (!cnfFile.exists()) {\n\t\t\tSystem.out.println(\"ERROR: config file doesn't exist\");\n\t\t} else if (!cnfFile.isFile()) {\n\t\t\tSystem.out.println(\"ERROR: config file is not a file\");\n\t\t} else {\n\t\t\tSystem.out.println(\"SUCCESS: config file exists\");\n\n\t\t\t// Force read from file. Need to clean the currently read in data first\n\t\t\tcnfData = new CnfData();\n\n\t\t\tresult = readFile();\n\t\t}\n\t\treturn result;\n\t}", "private static void readSiteConfig() {\n\n\t\ttry(BufferedReader br = new BufferedReader(new FileReader(\"SiteConfiguration.txt\"))) {\n\t\t\twhile (br.ready()) {\n\t\t\t\tString line = br.readLine().strip().toUpperCase();\n\t\t\t\tSite readSite = new Site(line);\n\n\t\t\t\tsites.putIfAbsent(readSite.getSiteName(), readSite);\n\t\t\t}\n\t\t}catch (IOException ioe) {\n\t\t\tlogger.log(Level.WARNING, \"Could not read SiteConfig file properly! \" + ioe);\n\t\t}\n\t}", "private void setConfiguration() throws IOException{\n\t\tString confPath = \"mapreduce.conf\";\n\t\tFileInputStream fis = new FileInputStream(confPath);\n\t\tthis.load(fis);\n\t\tfis.close();\n\t}", "@Test\n public void serverConfiguration() throws IOException {\n initJadlerUsing(new JettyStubHttpServer());\n \n try {\n onRequest().respond().withStatus(EXPECTED_STATUS);\n assertExpectedStatus();\n }\n finally {\n closeJadler();\n }\n }", "private ApolloConfig loadApolloConfig() {\n if (!m_loadConfigRateLimiter.tryAcquire(5, TimeUnit.SECONDS)) {\n //wait at most 5 seconds\n try {\n TimeUnit.SECONDS.sleep(5);\n } catch (InterruptedException e) {\n }\n }\n String appId = m_configUtil.getAppId();\n String cluster = m_configUtil.getCluster();\n String dataCenter = m_configUtil.getDataCenter();\n Tracer.logEvent(\"Apollo.Client.ConfigMeta\", STRING_JOINER.join(appId, cluster, m_namespace));\n int maxRetries = m_configNeedForceRefresh.get() ? 2 : 1;\n long onErrorSleepTime = 0; // 0 means no sleep\n Throwable exception = null;\n\n List<ServiceDTO> configServices = getConfigServices();\n String url = null;\n for (int i = 0; i < maxRetries; i++) {\n List<ServiceDTO> randomConfigServices = Lists.newLinkedList(configServices);\n Collections.shuffle(randomConfigServices);\n //Access the server which notifies the client first\n if (m_longPollServiceDto.get() != null) {\n randomConfigServices.add(0, m_longPollServiceDto.getAndSet(null));\n }\n\n for (ServiceDTO configService : randomConfigServices) {\n if (onErrorSleepTime > 0) {\n logger.warn(\n \"Load config failed, will retry in {} {}. appId: {}, cluster: {}, namespaces: {}\",\n onErrorSleepTime, m_configUtil.getOnErrorRetryIntervalTimeUnit(), appId, cluster, m_namespace);\n\n try {\n m_configUtil.getOnErrorRetryIntervalTimeUnit().sleep(onErrorSleepTime);\n } catch (InterruptedException e) {\n //ignore\n }\n }\n\n url = assembleQueryConfigUrl(configService.getHomepageUrl(), appId, cluster, m_namespace,\n dataCenter, m_remoteMessages.get(), m_configCache.get());\n\n logger.debug(\"Loading config from {}\", url);\n HttpRequest request = new HttpRequest(url);\n\n\n HttpResponse<ApolloConfig> response = m_httpUtil.doGet(request, ApolloConfig.class);\n m_configNeedForceRefresh.set(false);\n m_loadConfigFailSchedulePolicy.success();\n\n\n if (response.getStatusCode() == 304) {\n logger.debug(\"Config server responds with 304 HTTP status code.\");\n return m_configCache.get();\n }\n\n ApolloConfig result = response.getBody();\n\n logger.debug(\"Loaded config for {}: {}\", m_namespace, result);\n\n return result;\n\n // if force refresh, do normal sleep, if normal config load, do exponential sleep\n// onErrorSleepTime = m_configNeedForceRefresh.get() ? m_configUtil.getOnErrorRetryInterval() :\n// m_loadConfigFailSchedulePolicy.fail();\n }\n\n }\n String message = String.format(\n \"Load Apollo Config failed - appId: %s, cluster: %s, namespace: %s, url: %s\",\n appId, cluster, m_namespace, url);\n throw new ApolloConfigException(message, exception);\n }", "private static void readCommonInfoConfigFile() {\n\t\t// reading from common.cfg\n\t\ttry {\n\n\t\t\tScanner commonInfoScanner = new Scanner(new FileReader(commonInfoFile));\n\t\t\twhile (commonInfoScanner.hasNextLine()) {\n\t\t\t\tString commonInfoLine = commonInfoScanner.nextLine();\n\t\t\t\tString[] commonInfoLineSplitBySpaceArray = commonInfoLine.split(\"[ ]+\");\n\t\t\t\tswitch (commonInfoLineSplitBySpaceArray[0]) {\n\t\t\t\tcase ConfigurationSetup.FILE_NAME:\n\t\t\t\t\tfileName = commonInfoLineSplitBySpaceArray[1];\n\t\t\t\t\tbreak;\n\t\t\t\tcase ConfigurationSetup.FILE_SIZE:\n\t\t\t\t\tfileSize = Integer.parseInt(commonInfoLineSplitBySpaceArray[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ConfigurationSetup.NUMBER_OF_PREFERRED_NEIGHBORS_K:\n\t\t\t\t\tnumberOfPreferredNeighbors = Integer.parseInt(commonInfoLineSplitBySpaceArray[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ConfigurationSetup.OPTIMISTIC_UNCHOKING_INTERVAL_M:\n\t\t\t\t\toptimisticUnchokingInterval = Integer.parseInt(commonInfoLineSplitBySpaceArray[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ConfigurationSetup.PIECE_SIZE:\n\t\t\t\t\tpieceSize = Integer.parseInt(commonInfoLineSplitBySpaceArray[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ConfigurationSetup.UNCHOKING_INTERVAL_P:\n\t\t\t\t\tunchokingInterval = Integer.parseInt(commonInfoLineSplitBySpaceArray[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tSystem.err.println(\"\\nError in reading Common.cfg. Illegal parameter encountered.\\n\");\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnumberOfPieces = (int) Math.ceil((float) fileSize / pieceSize);\n\n\t\t\tcommonInfoScanner.close();\n\n\t\t} catch (Exception e) { // FileNotFoundException\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\r\n\tpublic void init() throws ServletException {\n\t\tBufferedReader in = new BufferedReader(\r\n new InputStreamReader(getClass().getResourceAsStream(\"/config.ini\")));\r\n String inputLine;\r\n String response = \"\";\r\n try {\r\n while((inputLine=in.readLine())!=null){\r\n response += inputLine;\r\n }\r\n } catch (IOException ex) {\r\n Logger.getLogger(ParameterServlet.class.getName()).log(Level.SEVERE, null, ex);\r\n }finally{\r\n \ttry {\r\n\t\t\t\tin.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n }\r\n model = new ParameterModel();\r\n model.setAddress(response.split(\" \")[0]);\r\n model.setPort( Integer.parseInt(response.split(\" \")[1]));\r\n model.setAddressIp(response.split(\" \")[2]);\r\n\t}", "public static void ReadConfig() throws IOException\r\n {\r\n ReadConfiguration read= new ReadConfiguration(\"settings/FabulousIngest.properties\");\r\n \t \r\n fedoraStub =read.getvalue(\"fedoraStub\");\r\n \t username = read.getvalue(\"fedoraUsername\");\r\n \t password =read.getvalue(\"fedoraPassword\");\r\n \t pidNamespace =read.getvalue(\"pidNamespace\");\r\n \t contentAltID=read.getvalue(\"contentAltID\");\r\n \t \r\n \t \r\n \t ingestFolderActive =read.getvalue(\"ingestFolderActive\");\r\n \t ingestFolderInActive =read.getvalue(\"ingestFolderInActive\");\r\n \t\r\n logFileNameInitial=read.getvalue(\"logFileNameInitial\");\r\n \r\n DataStreamID=read.getvalue(\"DataStreamID\");\r\n \t DataStreamLabel=read.getvalue(\"DataStreamLabel\");\r\n \r\n \r\n \r\n }", "public ServerConfiguration(InputStream in) throws IOException, URISyntaxException {\n super(in);\n\n\n Objects.requireNonNull(properties.getProperty(BIND_ADDRESS), \"Host and port are required\");\n Objects.requireNonNull(getMesosMaster(), \"Mesos address must not be empty\");\n\n uri = new URI(properties.getProperty(BIND_ADDRESS));\n // List<String> invalidBindAddresses = Arrays.asList(INVALID_BIND_ADDRESS);\n // loopback addresses must also be checked, but for now inttest uses localhost address\n if (uri.getHost().equals(\"0.0.0.0\")) {\n LOG.error(\"retz.bind is told to Mesos; {}/32 should not be assigned\", uri.getHost());\n throw new IllegalArgumentException();\n }\n if (uri.getPort() < 1024 || 65536 < uri.getPort()) {\n LOG.error(\"retz.bind must not use well known port, or just too large: {}\", uri.getPort());\n throw new IllegalArgumentException();\n }\n\n maxSimultaneousJobs = Integer.parseInt(properties.getProperty(MAX_SIMULTANEOUS_JOBS, DEFAULT_MAX_SIMULTANEOUS_JOBS));\n if (maxSimultaneousJobs < 1) {\n throw new IllegalArgumentException(MAX_SIMULTANEOUS_JOBS + \" must be positive\");\n }\n\n databaseURL = properties.getProperty(DATABASE_URL, DEFAULT_DATABASE_URL);\n databaseDriver = properties.getProperty(DATABASE_DRIVER_CLASS, DEFAULT_DATABASE_DRIVER_CLASS);\n\n if (\"root\".equals(getUserName()) || getUserName().isEmpty()) {\n LOG.error(\"{} must not be 'root' nor empty\", USER_NAME);\n throw new IllegalArgumentException(\"Invalid parameter: \" + USER_NAME);\n }\n\n if (getRefuseSeconds() < 1) {\n throw new IllegalArgumentException(MESOS_REFUSE_SECONDS + \" must be positive integer\");\n }\n\n if (getJobQueueType() == null) {\n throw new IllegalArgumentException(JOB_QUEUE_TYPE + \" must be either fir or all\");\n }\n\n LOG.info(\"Mesos master={}, principal={}, role={}, {}={}, {}={}, {}={}, {}={}, {}={}, {}={}, {}={}, {}={}, {}={}, {}={}\",\n getMesosMaster(), getPrincipal(), getRole(), MAX_SIMULTANEOUS_JOBS, maxSimultaneousJobs,\n DATABASE_URL, databaseURL,\n MAX_STOCK_SIZE, getMaxStockSize(),\n USER_NAME, getUserName(),\n MESOS_REFUSE_SECONDS, getRefuseSeconds(),\n GC_LEEWAY, getGcLeeway(),\n GC_INTERVAL, getGcInterval(),\n MAX_LIST_JOB_SIZE, getMaxJobSize(),\n MAX_FILE_SIZE, getMaxFileSize(),\n JOB_QUEUE_TYPE, getJobQueueType());\n LOG.info(\"{}={}\", MESOS_FAILOVER_TIMEOUT, getFailoverTimeout());\n }", "public static void initConfig()\r\n {\r\n try\r\n {\r\n ip = ConfigProperties.getKey(ConfigList.BASIC, \"AgentGateway_IP\");\r\n localIP = ConfigProperties.getKey(ConfigList.BASIC, \"Local_IP\");\r\n port = Integer.parseInt(ConfigProperties.getKey(ConfigList.BASIC, \"AgentGateway_PORT\"));\r\n }\r\n catch (NumberFormatException e)\r\n {\r\n log.error(\"read properties failed --\", e);\r\n }\r\n }", "private void initConfig() {\n Path walletPath;\n Wallet wallet;\n\n // load a CCP\n Path networkConfigPath; \n \n try {\n \t\n \tif (!isLoadFile) {\n // Load a file system based wallet for managing identities.\n walletPath = Paths.get(\"wallet\");\n wallet = Wallet.createFileSystemWallet(walletPath);\n\n // load a CCP\n networkConfigPath = Paths.get(\"\", \"..\", \"basic-network\", configFile);\n \n builder = Gateway.createBuilder();\n \n \tbuilder.identity(wallet, userId).networkConfig(networkConfigPath).discovery(false);\n \t\n \tisLoadFile = true;\n \t}\n } catch (Exception e) {\n \te.printStackTrace();\n \tthrow new RuntimeException(e);\n }\n\t}", "public Properties loadConfig(){\n\t\tprintln(\"Begin loadConfig \");\n\t\tProperties prop = null;\n\t\t prop = new Properties();\n\t\ttry {\n\t\t\t\n\t\t\tprop.load(new FileInputStream(APIConstant.configFullPath));\n\n\t } catch (Exception ex) {\n\t ex.printStackTrace();\n\t println(\"Exception \"+ex.toString());\n\t \n\t }\n\t\tprintln(\"End loadConfig \");\n\t\treturn prop;\n\t\t\n\t}", "public static void setHostDetails(String configuration_filename,\n String local_host) {\n crashNode = \"\";\n try {\n Properties prop = new Properties();\n prop.load(new FileInputStream(configuration_filename));\n LOGGER_NAME = prop.getProperty(\"LOGGER\");\n COORDINATOR = prop.getProperty(\"COORDINATOR\");\n host_initial_load = host_reserved_load = 10;\n } catch (FileNotFoundException ex) {\n Logger.getLogger(Preferences.class.getName()).log(Level.SEVERE, null, ex);\n } catch (IOException ex) {\n Logger.getLogger(Preferences.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "private boolean readFile() {\n\t\ttry {\n\n\t\t\tDocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();\n\t\t\tDocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();\n\t\t\tDocument doc = docBuilder.parse(cnfFile);\n\n\t\t\t// normalize text representation\n\t\t\tdoc.getDocumentElement().normalize();\n\t\t\tSystem.out.println(\"Root element of the doc is \" + doc.getDocumentElement().getNodeName());\n\t\t\tdoc.getDocumentElement().getAttributeNode(\"version\");\n\n\t\t\tNodeList rootNode = doc.getElementsByTagName(\"SCMS_DATA\");\n\t\t\tif (rootNode.getLength() < 1) {\n\t\t\t\tSystem.out.println(\"ERROR in config data file: there is no SCMS_DATA element\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tString version = rootNode.item(0).getAttributes().getNamedItem(\"version\").getNodeValue();\n\t\t\tfinal String dataVersion = \"0.1\";\n\t\t\tif (!version.equals(dataVersion)) {\n\t\t\t\tSystem.out.println(\"ERROR in config data file: required version is \" + dataVersion);\n\t\t\t\tSystem.out.println(\"Version \" + version + \" is not supported.\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tNodeList listOfDevices = doc.getElementsByTagName(\"DEVICE\");\n\t\t\tint totalDevices = listOfDevices.getLength();\n\t\t\tSystem.out.println(\"Total no of devices : \" + totalDevices);\n\n\t\t\tHashMap<String, CnfDevice> devices = new HashMap<>();\n\t\t\tfor (int s = 0; s < listOfDevices.getLength(); s++) {\n\n\t\t\t\tNode node = listOfDevices.item(s);\n\t\t\t\tif (node.getNodeType() == Node.ELEMENT_NODE) {\n\n\t\t\t\t\tString id = node.getAttributes().getNamedItem(\"id\").getNodeValue();\n\t\t\t\t\tString name = node.getAttributes().getNamedItem(\"name\").getNodeValue();\n\t\t\t\t\tString description = node.getAttributes().getNamedItem(\"description\").getNodeValue();\n\t\t\t\t\tString pi_name = node.getAttributes().getNamedItem(\"PI_Name\").getNodeValue();\n\t\t\t\t\tString pixHor = node.getAttributes().getNamedItem(\"pixHor\").getNodeValue();\n\t\t\t\t\tString pixVer = node.getAttributes().getNamedItem(\"pixVer\").getNodeValue();\n\t\t\t\t\tString location = node.getAttributes().getNamedItem(\"location\").getNodeValue();\n\n\t\t\t\t\tdevices.put(id, new CnfDevice(id, name, description, pi_name,\n\t\t\t\t\t\t\tInteger.valueOf(pixHor), Integer.valueOf(pixVer),location));\n\t\t\t\t}\n\t\t\t}\n\t\t\tcnfData.setDevices(devices);\n\n\t\t\tNodeList listOfViews = doc.getElementsByTagName(\"VIEW\");\n\t\t\tint totalViews = listOfViews.getLength();\n\t\t\tSystem.out.println(\"Total no of views : \" + totalViews);\n\n\t\t\tHashMap<String, CnfView> views = new HashMap<>();\n\t\t\tfor (int s = 0; s < listOfViews.getLength(); s++) {\n\n\t\t\t\tNode node = listOfViews.item(s);\n\n\t\t\t\tif (node.getNodeType() == Node.ELEMENT_NODE) {\n\t\t\t\t\tString id = node.getAttributes().getNamedItem(\"id\").getNodeValue();\n\t\t\t\t\tString name = node.getAttributes().getNamedItem(\"name\").getNodeValue();\n\t\t\t\t\tString description = node.getAttributes().getNamedItem(\"description\").getNodeValue();\n\t\t\t\t\tString pixHor = node.getAttributes().getNamedItem(\"pixHor\").getNodeValue();\n\t\t\t\t\tString pixVer = node.getAttributes().getNamedItem(\"pixVer\").getNodeValue();\n\t\t\t\t\tString asso_device = node.getAttributes().getNamedItem(\"associatedDevice\").getNodeValue();\n\n\t\t\t\t\tElement element = (Element) node;\n\t\t\t\t\tNodeList listOfImages = ((Element) node).getElementsByTagName(\"IMAGE\");\n\t\t\t\t\tElement iElement = (Element) listOfImages.item(0);\n\t\t\t\t\tString[] images = new String[listOfImages.getLength()];\n\t\t\t\t\tfor (int i = 0; i < listOfImages.getLength(); i++) {\n\n\t\t\t\t\t\tNode iNode = listOfImages.item(i);\n\t\t\t\t\t\timages[i] = iNode.getAttributes().getNamedItem(\"name\").getNodeValue();\n\t\t\t\t\t}\n\n\t\t\t\t\tviews.put(id, new CnfView(id, name, description,\n\t\t\t\t\t\t\tInteger.valueOf(pixHor), Integer.valueOf(pixVer), asso_device, images));\n\t\t\t\t}\n\t\t\t}\n\t\t\tcnfData.setViews(views);\n\n\t\t\tNodeList listOfSections = doc.getElementsByTagName(\"SECTION\");\n\t\t\tint totalSections = listOfSections.getLength();\n\t\t\tSystem.out.println(\"Total no of sections : \" + totalSections);\n\n\t\t\tHashMap<String, CnfSection> sections = new HashMap<>();\n\t\t\tfor (int s = 0; s < totalSections; s++) {\n\t\t\t\tNode node = listOfSections.item(s);\n\n\t\t\t\tif (node.getNodeType() == Node.ELEMENT_NODE) {\n\t\t\t\t\tString sectionId = node.getAttributes().getNamedItem(\"sectionId\").getNodeValue();\n\t\t\t\t\tString deviceId = node.getAttributes().getNamedItem(\"deviceId\").getNodeValue();\n\t\t\t\t\tString positionId = node.getAttributes().getNamedItem(\"positionId\").getNodeValue();\n\t\t\t\t\tString vOffset = node.getAttributes().getNamedItem(\"vOffset\").getNodeValue();\n\n\t\t\t\t\t// A section is invalid if the deviceId doesn't exist\n\t\t\t\t\tif (null == cnfData.getDeviceById(deviceId)) {\n\t\t\t\t\t\tSystem.out.println(\"ERROR in SECTION config data: deviceId \" + deviceId + \" sectionId \" + sectionId);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsections.put(deviceId, new CnfSection(sectionId, deviceId, positionId, vOffset));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcnfData.setSections(sections);\n\t\t\treturn true;\n\n\t\t} catch (SAXParseException err) {\n\t\t\tSystem.out.println(\"** Parsing error\" + \", line \" + err.getLineNumber() + \", uri \" + err.getSystemId());\n\t\t\tSystem.out.println(\" \" + err.getMessage());\n\n\t\t} catch (SAXException e) {\n\t\t\tException x = e.getException();\n\t\t\t((x == null) ? e : x).printStackTrace();\n\n\t\t} catch (Throwable t) {\n\t\t\tt.printStackTrace();\n\t\t}\n\t\treturn false;\n\t}", "public static void main(String[] args) throws RemoteException, UnknownHostException, IOException\n {\n BufferedReader in = null;\n in = new BufferedReader(new FileReader(NN_ConfigFile));\n String line = null;\n ArrayList<String> config = new ArrayList<String>();\n while((line = in.readLine()) != null){\n config.add(line);\n }\n in.close();\n String name = config.get(0).split(\":\")[1];\n String ip = config.get(1).split(\":\")[1];\n int port = Integer.parseInt(config.get(2).split(\":\")[1]);\n //Intitalize the Client\n Client Me = new Client();\n Me.heartbeat = Integer.parseInt(config.get(5).split(\":\")[1]);\n Me.block_size = Integer.parseInt(config.get(6).split(\":\")[1]);\n Me.NNStub = Me.GetNNStub(name,ip,port);\n System.out.println(\"Welcome to HDFS!!\");\n Scanner Scan = new Scanner(System.in);\n while(true)\n {\n //Scanner, prompt and then call the functions according to the command\n System.out.print(\"$> \"); //Prompt\n String Command = Scan.nextLine();\n String[] Split_Commands = Command.split(\" \");\n\n if(Split_Commands[0].equals(\"help\"))\n {\n System.out.println(\"The following are the Supported Commands\");\n System.out.println(\"1. put filename ## To put a file in HDFS\");\n System.out.println(\"2. get filename ## To get a file in HDFS\"); System.out.println(\"2. list ## To get the list of files in HDFS\");\n }\n else if(Split_Commands[0].equals(\"put\")) // put Filename\n {\n //Put file into HDFS\n String Filename;\n try{\n Filename = Split_Commands[1];\n Me.PutFile(Filename);\n }catch(ArrayIndexOutOfBoundsException e){\n System.out.println(\"Please type 'help' for instructions\");\n continue;\n }\n }\n else if(Split_Commands[0].equals(\"get\"))\n {\n //Get file from HDFS\n String Filename;\n try{\n Filename = Split_Commands[1];\n Me.GetFile(Filename);\n }catch(ArrayIndexOutOfBoundsException e){\n System.out.println(\"Please type 'help' for instructions\");\n continue;\n }\n }\n else if(Split_Commands[0].equals(\"list\"))\n {\n System.out.println(\"List request\");\n //Get list of files in HDFS\n Me.List();\n }\n else\n {\n System.out.println(\"Please type 'help' for instructions\");\n }\n }\n }", "public void readConfigFile() throws IOException {\r\n Wini iniFileParser = new Wini(new File(configFile));\r\n\r\n databaseDialect = iniFileParser.get(DATABASESECTION, \"dialect\", String.class);\r\n databaseDriver = iniFileParser.get(DATABASESECTION, \"driver\", String.class);\r\n databaseUrl = iniFileParser.get(DATABASESECTION, \"url\", String.class);\r\n databaseUser = iniFileParser.get(DATABASESECTION, \"user\", String.class);\r\n databaseUserPassword = iniFileParser.get(DATABASESECTION, \"userPassword\", String.class);\r\n\r\n repositoryName = iniFileParser.get(REPOSITORYSECTION, \"name\", String.class);\r\n\r\n partitions = iniFileParser.get(DEFAULTSECTION, \"partitions\", Integer.class);\r\n logFilename = iniFileParser.get(DEFAULTSECTION, \"logFilename\", String.class);\r\n logLevel = iniFileParser.get(DEFAULTSECTION, \"logLevel\", String.class);\r\n\r\n maxNGramSize = iniFileParser.get(FEATURESSECTION, \"maxNGramSize\", Integer.class);\r\n maxNGramFieldSize = iniFileParser.get(FEATURESSECTION, \"maxNGramFieldSize\", Integer.class);\r\n String featureGroupsString = iniFileParser.get(FEATURESSECTION, \"featureGroups\", String.class);\r\n\r\n if ( databaseDialect == null )\r\n throw new IOException(\"Database dialect not found in config\");\r\n if ( databaseDriver == null )\r\n throw new IOException(\"Database driver not found in config\");\r\n if ( databaseUrl == null )\r\n throw new IOException(\"Database URL not found in config\");\r\n if ( databaseUser == null )\r\n throw new IOException(\"Database user not found in config\");\r\n if ( databaseUserPassword == null )\r\n throw new IOException(\"Database user password not found in config\");\r\n\r\n if (repositoryName == null)\r\n throw new IOException(\"Repository name not found in config\");\r\n\r\n if (partitions == null)\r\n partitions = 250;\r\n if ( logFilename == null )\r\n logFilename = \"FeatureExtractor.log\";\r\n if ( logLevel == null )\r\n logLevel = \"INFO\";\r\n\r\n if ( featureGroupsString != null ) {\r\n featureGroups = Arrays.asList(featureGroupsString.split(\"\\\\s*,\\\\s*\"));\r\n }\r\n if (maxNGramSize == null)\r\n maxNGramSize = 5;\r\n if (maxNGramFieldSize == null)\r\n maxNGramFieldSize = 500;\r\n\r\n }", "public static void readConfiguration() throws IOException {\n synchronized (Configuration.class) {\n Properties props = new Properties();\n InputStream is = new FileInputStream(Constants.ROOT_PATH + \"/opencraft.properties\");\n try {\n props.load(is);\n configuration = new Configuration(props);\n } finally {\n is.close();\n }\n }\n }", "@Override\n public String getDefaultConfig(Log log) throws CommandLineException {\n File defaultCfg = null;\n if (DEFAULT_CONFIG_FILE.equals(defaultConfigFile)) {\n final String conf = ExecutionUtils.executeCommand(log, \"\\\"\" + this.executable + \"\\\" -V SERVER_CONFIG_FILE\");\n final Pattern pattern = Pattern.compile(\"^\\\\s*-D\\\\s*SERVER_CONFIG_FILE=\\\"(.*)?\\\"$\");\n final Matcher matcher = pattern.matcher(conf);\n final String result = matcher.group(1);\n defaultCfg = new File(result);\n if (defaultCfg.isAbsolute()) {\n if (defaultCfg.exists()) {\n return ConfigUtils.readConfigFile(defaultCfg);\n }\n } else {\n final String exec = ExecutionUtils.searchExecutable(log, this.executable);\n if (exec != null) {\n final File execFile = new File(exec);\n File execDir = execFile.getParentFile();\n if (\"bin\".equals(execDir.getName())) {\n execDir = execDir.getParentFile();\n }\n File confDir = new File(execDir, \"conf\");\n if (!confDir.exists()) {\n confDir = execDir;\n }\n defaultCfg = new File(confDir, \"httpd.conf\");\n if (defaultCfg.exists()) {\n return ConfigUtils.readConfigFile(defaultCfg);\n }\n }\n }\n } else {\n defaultCfg = new File(this.defaultConfigFile);\n if (defaultCfg.exists()) {\n return ConfigUtils.readConfigFile(defaultCfg);\n }\n }\n return null;\n }", "public void readFile(String configFileName){\n\t\tBufferedReader readLine_br = null;\r\n\t\tFileReader readLine_fr = null;\r\n\t\tString line;\r\n\t\tString searchLink = \"LINK:\";\r\n\t\tString searchNetwork = \"NETWORK:\";\r\n\t\tString selfHop = \"0.0.0.0:0\";\r\n\t\tint selfCost = 0;\r\n\t\troutingTableClass routingTableObject = new routingTableClass();\r\n\t\t\t\t\r\n\t\ttry{\r\n\t\t\treadLine_fr = new FileReader(configFileName);\r\n\t\t\treadLine_br = new BufferedReader(readLine_fr);\r\n\t\t\t\r\n\t\t\t// reading line by line\r\n\t\t\twhile((line = readLine_br.readLine()) != null){\r\n\t\t\t\t\r\n\t\t\t\t// making an array of the input\r\n\t\t\t\tString[] ipArray_1 = line.split(\" \");\r\n\t\t\t\t\r\n\t\t\t\t// for LINKS\r\n\t\t\t\tif(ipArray_1[0].equals(searchLink))\r\n\t\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\t\tString[] ipArray = {ipArray_1[0],ipArray_1[1],ipArray_1[2]};\r\n\t\t\t\t\t//segregating the IP's and the Port Numbers\r\n\t\t\t\t\tString ip_1 = ipArray[1].split(\":\")[0];\r\n\t\t\t\t\tint port_1 = Integer.parseInt(ipArray[1].split(\":\")[1]);\r\n\t\t\t\t\tString ip_2 = ipArray[2].split(\":\")[0];\r\n\t\t\t\t\tint port_2 = Integer.parseInt(ipArray[2].split(\":\")[1]);\r\n\t\t\t\t\t\r\n\t\t\t\t\t//making objects for receiving and sending\r\n\t\t\t\t\tRunnable senderObject = new Sender(ip_2,port_2, port_1, routingTableObject);\r\n\t\t\t\t\tRunnable receiverObject = new Receiver(ip_1, port_1,ip_2,port_2,routingTableObject);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// making Receiver and Sender Thread\r\n\t\t\t\t\tThread receiverThread = new Thread(receiverObject);\r\n\t\t\t\t\tThread senderThread = new Thread(senderObject);\r\n\t\t\t\t\t\r\n\t\t\t\t\t//starting the sending and receiving Threads\r\n\t\t\t\t\tsenderThread.start();\r\n\t\t\t\t\treceiverThread.start();\r\n\t\t\t\t}\r\n\t\t\t\t// for NETWORKS\r\n\t\t\t\telse if(ipArray_1[0].equals(searchNetwork))\r\n\t\t\t\t{\r\n\t\t\t\t\tString[] ipArray = {ipArray_1[0],ipArray_1[1]};\r\n\t\t\t\t\tArrayList addEntry = new ArrayList();\r\n\t\t\t\t\taddEntry.add(ipArray[1]);\r\n\t\t\t\t\taddEntry.add(selfHop);\r\n\t\t\t\t\taddEntry.add(selfCost);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t// making entry in the routing table\r\n\t\t\t\t\tsynchronized (routingTableObject) {\r\n\t\t\t\t\t\troutingTableObject.routingTable.add(addEntry);\r\n\t\t\t\t\t\troutingTableObject.printTable();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch(IOException exc){\r\n\t\t\texc.printStackTrace();\r\n\t\t}\r\n\t}", "private void loadWiperConfig(String mSubPath,boolean bQuiet)\n {\n FileReader mWiperConfigReader;\n\n // Environment.getRootDirectory() = /system\".\n final File mFileName = new File(Environment.getRootDirectory(), mSubPath);\n try\n {\n mWiperConfigReader = new FileReader(mFileName);\n }\n catch (FileNotFoundException e)\n {\n if (!bQuiet)\n {\n Log.e(TAG, \"wiperconfig file read/open error \" + mFileName);\n }\n bWiperConfigReadError = true;\n return;\n }\n\n try\n {\n XmlPullParser mParser = Xml.newPullParser();\n mParser.setInput(mWiperConfigReader);\n\n XmlUtils.beginDocument(mParser, \"wiperconfig\");\n\n while (true)\n {\n XmlUtils.nextElement(mParser);\n\n String szName = mParser.getName();\n if (!\"configparam\".equals(szName))\n {\n break;\n }\n\n szUsername = mParser.getAttributeValue(null, \"username\");\n szRealm = mParser.getAttributeValue(null, \"realm\");\n\n String szHighFreqPeriodMs = mParser.getAttributeValue(null, \"highFreqPeriodMs\");\n lHighFreqPeriodMs = Long.parseLong(szHighFreqPeriodMs);\n\n String szLowFreqPeriodMs = mParser.getAttributeValue(null, \"lowFreqPeriodMs\");\n lLowFreqPeriodMs = Long.parseLong(szLowFreqPeriodMs);\n\n szTilingPath = mParser.getAttributeValue(null, \"tilingPath\");\n\n String szMaxDataSizePerSession = mParser.getAttributeValue(null, \"maxDataSizePerSession\");\n lMaxDataSizePerSession = Long.parseLong(szMaxDataSizePerSession);\n\n String szMaxDataSizeTotal = mParser.getAttributeValue(null, \"maxDataSizeTotal\");\n lMaxDataSizeTotal = Long.parseLong(szMaxDataSizeTotal);\n\n String szNetworkPvdEnabled = mParser.getAttributeValue(null, \"networkPvdEnabled\");\n bNetworkPvdEnabled = Boolean.parseBoolean(szNetworkPvdEnabled);\n\n }\n }\n catch (XmlPullParserException e)\n {\n Log.e(TAG, \"WiperConfig parsing exception \", e);\n bWiperConfigReadError = true;\n }\n catch (IOException e)\n {\n Log.e(TAG, \"WiperConfig parsing exception\", e);\n bWiperConfigReadError = true;\n }\n\n if(Config.LOGV)\n {\n Log.v(TAG,\"WiperConfig uname:\"+szUsername+\", realm:\"+szRealm+\",hi:\"+lHighFreqPeriodMs+\",lo:\"+lLowFreqPeriodMs+\":tPath:\"+szTilingPath);\n }\n return;\n }", "public static void processConfig() {\r\n\t\tLOG.info(\"Loading Properties from {} \", propertiesPath);\r\n\t\tLOG.info(\"Opening configuration file ({})\", propertiesPath);\r\n\t\ttry {\r\n\t\t\treadPropertiesFile();\r\n\r\n\t\t} catch (Exception e) {\r\n\t\t\tLOG.error(\r\n\t\t\t\t\t\"Monitoring system encountered an error while processing config file, Exiting\",\r\n\t\t\t\t\te);\r\n\t\t}\r\n\t}", "public T loadConfig(File file) throws IOException;", "protected abstract void onLoad() throws IOException, ConfigInvalidException;", "@Override\n public void initEndpoint() throws IOException, InstantiationException {\n SelectorThreadConfig.configure(this);\n \n initFileCacheFactory();\n initAlgorithm();\n initPipeline();\n initMonitoringLevel();\n \n setName(\"SelectorThread-\" + getPort());\n \n try{\n if (getInet() == null) {\n setServerSocket(getServerSocketFactory().createSocket(getPort(),\n getSsBackLog()));\n } else {\n setServerSocket(getServerSocketFactory().createSocket(getPort(), \n getSsBackLog(), getInet()));\n }\n getServerSocket().setReuseAddress(true); \n } catch (SocketException ex){\n throw new BindException(ex.getMessage() + \": \" + getPort());\n }\n \n getServerSocket().setSoTimeout(getServerTimeout());\n initReadBlockingTask(getMinReadQueueLength());\n \n setInitialized(true); \n getLogger().log(Level.FINE,\"Initializing Grizzly Blocking Mode\"); \n // Since NIO is not used, rely on Coyote for buffering the response.\n setBufferResponse(true);\n }", "public String readConfig(Context context) {\n\n String ret = \"\";\n\n try {\n InputStream inputStream = context.openFileInput(\"config.txt\");\n\n if (inputStream != null) {\n InputStreamReader inputStreamReader = new InputStreamReader(inputStream);\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n String receiveString = \"\";\n StringBuilder stringBuilder = new StringBuilder();\n\n while ((receiveString = bufferedReader.readLine()) != null) {\n stringBuilder.append(receiveString);\n }\n\n inputStream.close();\n ret = stringBuilder.toString();\n }\n } catch (FileNotFoundException e) {\n Log.e(\"Config\", \"File not found: \" + e.toString());\n } catch (IOException e) {\n Log.e(\"Config\", \"Can not read file: \" + e.toString());\n }\n\n return ret;\n }", "public static void loadGameConfiguration() {\n File configFile = new File(FileUtils.getRootFile(), Constant.CONFIG_FILE_NAME);\n manageGameConfigFile(configFile);\n }", "public static ConfigServer createConfigServer(String fileConfigjSon){\n\t\tMap<String, String> json = new HashMap<String, String>();\n\t\tObjectMapper mapper = new ObjectMapper();\n\t\t\n\t\ttry {\n\t\t\tjson = mapper.readValue(new File(fileConfigjSon),\n\t\t\t\t\tnew TypeReference<HashMap<String, String>>() {\n\t\t\t\t\t});\n\t\t} catch (JsonParseException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (JsonMappingException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\tint port = Integer.parseInt(json.get(\"Port\"));\n\t\tString logs = json.get(\"LogsPath\");\n\t\tString answers = json.get(\"AnswersPath\");\n\t\tint maxFileSize = Integer.parseInt(json.get(\"MaxFileSize\"));\n\t\tlong comeback = Long.parseLong(json.get(\"Comeback\"));\n\t\t\n\t\treturn new ConfigServer(port, logs, answers, maxFileSize, comeback);\n\t}", "Collection<String> readConfigs();", "@Test\n public void testLoadConfiguration() throws ConfigurationException\n {\n factory.setFile(TEST_FILE);\n checkConfiguration();\n }", "private void generateConfigurationFile() throws IOException {\n // Use a template file to generate the configuration to be used in the sever side\n String srcFileName = \"resources/servlet.config.prop\";\n String destFileName = FIConfiguration.getConfiguration().get(\"SERVLET_CONFIG_FILE\");\n FileUtility fu = new FileUtility();\n fu.setInput(srcFileName);\n fu.setOutput(destFileName);\n String line = null;\n Map<String, String> keyToFileName = getKeyToFileNameMap();\n while ((line = fu.readLine()) != null) {\n for (String key : keyToFileName.keySet()) {\n if (line.startsWith(key)) {\n String value = FIConfiguration.getConfiguration().get(keyToFileName.get(key));\n logger.info(key + \": \" + value);\n // Just need the file only\n File file = new File(value);\n if (!file.exists()) {\n// throw new IllegalStateException(\"Cannot find file for \" + key + \": \" + value);\n logger.error(\"Cannot find file for \" + key + \": \" + value);\n }\n line = assignValue(line, file.getName());\n break;\n }\n }\n // Two special cases\n if (line.startsWith(\"Reactome.src.dbName\") || line.startsWith(\"elv.dbName\")) {\n String value = FIConfiguration.getConfiguration().get(\"REACTOME_SOURCE_DB_NAME\");\n int index = line.indexOf(\"=\");\n line = line.substring(0, index + 1) + \"test_\" + value; // This name pattern should be followed always\n }\n String year = FIConfiguration.getConfiguration().get(\"YEAR\");\n line = line.replaceAll(\"caBigR3WebApp\", \"caBigR3WebApp\" + year);\n fu.printLine(line);\n }\n fu.close();\n }", "private void getConf(HashMap confMap) throws ConfigurationException {\n //get test mode\n if (!confMap.containsKey(\"TestMode\"))\n throw new ConfigurationException(\"Test Mode setting was not found in Configuration YAML file.\");\n String test_mode = confMap.get(\"TestMode\").toString().trim();\n if ((test_mode == null) || (test_mode.trim().equals(\"\")))\n throw new ConfigurationException(\"Test mode setting should not be empty or null.\");\n this.testMode = test_mode;\n\n //get locator yaml file path\n if (!confMap.containsKey(\"LocatorFile\"))\n throw new ConfigurationException(\"Locator YAML file path setting was not found in Configuration YAML file.\");\n String lf = confMap.get(\"LocatorFile\").toString();\n if ((lf == null) || (lf.trim().equals(\"\")))\n throw new ConfigurationException(\"Locator file path setting should not be empty or null.\");\n this.locatorFile = lf;\n\n //get timout setting\n if (confMap.containsKey(\"TimeoutInSecond\")) {\n int wt = Integer.parseInt(confMap.get(\"TimeoutInSecond\").toString());\n if (wt < 0)\n throw new ConfigurationException(\"Timeout value should be positive integer. [\" + wt + \"]\");\n if (wt == 0)\n this.timeoutInSecond = this.DEFAULT_TIMEOUT;\n if (wt > 0)\n this.timeoutInSecond = Integer.parseInt(confMap.get(\"TimeoutInSecond\").toString());\n }\n else\n this.timeoutInSecond = this.DEFAULT_TIMEOUT;\n\n }", "public ReadConfig() \n\t{\n\t\tFile scr = new File(\"./Configuration/config.properties\"); //property file\n\n\t\tFileInputStream fis;\n\t\ttry {\n\t\t\tfis = new FileInputStream(scr); // READ the DATA (read mode)\n\t\t\tpro = new Properties(); // pro object\n\t\t\tpro.load(fis); // Load method -load at the \n\n\t\t} catch (final Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tSystem.out.println(\"Except is \" + e.getMessage());\n\t\t} \n\t}", "@Test\n public void testLoadDifferentSources() throws ConfigurationException\n {\n factory.setFile(MULTI_FILE);\n Configuration config = factory.getConfiguration();\n assertFalse(config.isEmpty());\n assertTrue(config instanceof CombinedConfiguration);\n CombinedConfiguration cc = (CombinedConfiguration) config;\n assertEquals(\"Wrong number of configurations\", 1, cc\n .getNumberOfConfigurations());\n\n assertNotNull(config\n .getProperty(\"tables.table(0).fields.field(2).name\"));\n assertNotNull(config.getProperty(\"element2.subelement.subsubelement\"));\n assertEquals(\"value\", config.getProperty(\"element3\"));\n assertEquals(\"foo\", config.getProperty(\"element3[@name]\"));\n assertNotNull(config.getProperty(\"mail.account.user\"));\n\n // test JNDIConfiguration\n assertNotNull(config.getProperty(\"test.onlyinjndi\"));\n assertTrue(config.getBoolean(\"test.onlyinjndi\"));\n\n Configuration subset = config.subset(\"test\");\n assertNotNull(subset.getProperty(\"onlyinjndi\"));\n assertTrue(subset.getBoolean(\"onlyinjndi\"));\n\n // test SystemConfiguration\n assertNotNull(config.getProperty(\"java.version\"));\n assertEquals(System.getProperty(\"java.version\"), config\n .getString(\"java.version\"));\n\n // test INIConfiguration\n assertEquals(\"Property from ini file not found\", \"yes\",\n config.getString(\"testini.loaded\"));\n\n // test environment configuration\n EnvironmentConfiguration envConf = new EnvironmentConfiguration();\n for (Iterator<String> it = envConf.getKeys(); it.hasNext();)\n {\n String key = it.next();\n String combinedKey = \"env.\" + key;\n assertEquals(\"Wrong value for env property \" + key,\n envConf.getString(key), config.getString(combinedKey));\n }\n }", "public ReadConfigFile (){\n\t\ttry {\n\t\t\tinput = ReadConfigFile.class.getClassLoader().getResourceAsStream(Constant.CONFIG_PROPERTIES_DIRECTORY);\n\t\t\tprop = new Properties();\n\t\t\tprop.load(input);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}catch ( IOException e ) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\t\t\n\t}", "@Override\n public void configure(Context context) {\n this.pollFrequency = context.getInteger(this.CONF_POLL_FREQUENCY, DEFAULT_POLL_FREQUENCY);\n //zabbix hosts\n String hosts = context.getString(this.CONF_HOSTS);\n if (hosts == null || hosts.isEmpty()) {\n throw new ConfigurationException(\"Hosts list cannot be empty.\");\n }\n parseHostsFromString(hosts);\n\n }", "protected void initializeCommandLineConfiguration(RacfConfiguration config) throws IOException {\r\n config.setHostNameOrIpAddr(HOST_NAME);\r\n config.setUseSsl(USE_SSL);\r\n config.setHostTelnetPortNumber(HOST_TELNET_PORT);\r\n config.setCommandTimeout(60*1000);\r\n config.setReaperMaximumIdleTime(15*60*1000);\r\n config.setConnectScript(getLoginScript());\r\n config.setDisconnectScript(getLogoffScript());\r\n config.setUserNames(new String[] {SYSTEM_USER} );\r\n config.setPasswords(new GuardedString[] {new GuardedString(SYSTEM_PASSWORD.toCharArray())});\r\n config.setSegmentNames(new String[] { \r\n \"ACCOUNT.RACF\", \"ACCOUNT.TSO\", \"ACCOUNT.NETVIEW\",\r\n \"ACCOUNT.CICS\", \"ACCOUNT.OMVS\", \"ACCOUNT.CATALOG\", \r\n \"ACCOUNT.OMVS\", \"GROUP.RACF\" });\r\n config.setSegmentParsers(new String[] { \r\n loadParserFromFile(RACF_PARSER), loadParserFromFile(TSO_PARSER), loadParserFromFile(NETVIEW_PARSER), \r\n loadParserFromFile(CICS_PARSER), loadParserFromFile(OMVS_PARSER), loadParserFromFile(CATALOG_PARSER), \r\n loadParserFromFile(OMVS_PARSER), loadParserFromFile(GROUP_RACF_PARSER) });\r\n //config.setConnectionClassName(\"org.identityconnectors.rw3270.wrq.WrqConnection\");\r\n config.setConnectionClassName(\"org.identityconnectors.rw3270.hod.HodConnection\");\r\n //config.setConnectionClassName(\"org.identityconnectors.rw3270.freehost3270.FH3270Connection\");\r\n }", "public interface ConfigurationReader {\n\n /**\n * Read a configuration file. If there are *any* errors reading the file, the method should return an empty string \"\".\n */\n public String readConfiguration(String path);\n}", "private void loadRemoteConfig()\n {\n try\n {\n if ( Config.getInstance().getProperty( GlobalIds.CONFIG_REALM ) == null )\n {\n LOG.warn( \"Config realm not enabled\" );\n return;\n }\n // Retrieve parameters from the config node stored in target LDAP DIT:\n String realmName = config.getString( GlobalIds.CONFIG_REALM, \"DEFAULT\" );\n if ( realmName != null && realmName.length() > 0 )\n {\n LOG.info( \"static init: load config realm [{}]\", realmName );\n Properties props = getRemoteConfig( realmName );\n if ( props != null )\n {\n for ( Enumeration<?> e = props.propertyNames(); e.hasMoreElements(); )\n {\n String key = ( String ) e.nextElement();\n String val = props.getProperty( key );\n config.setProperty( key, val );\n }\n }\n\n //init ldap util vals since config is stored on server\n boolean ldapfilterSizeFound = ( getProperty( GlobalIds.LDAP_FILTER_SIZE_PROP ) != null );\n LdapUtil.getInstance().setLdapfilterSizeFound(ldapfilterSizeFound);\n LdapUtil.getInstance().setLdapMetaChars( loadLdapEscapeChars() );\n LdapUtil.getInstance().setLdapReplVals( loadValidLdapVals() );\n try\n {\n String lenProp = getProperty( GlobalIds.LDAP_FILTER_SIZE_PROP );\n if ( ldapfilterSizeFound )\n {\n LdapUtil.getInstance().setLdapFilterSize(Integer.valueOf( lenProp ));\n }\n }\n catch ( java.lang.NumberFormatException nfe )\n {\n String error = \"loadRemoteConfig caught NumberFormatException=\" + nfe;\n LOG.warn( error );\n }\n remoteConfigLoaded = true;\n }\n else\n {\n LOG.info( \"static init: config realm not setup\" );\n }\n }\n catch ( SecurityException se )\n {\n String error = \"static init: Error loading from remote config: SecurityException=\"\n + se;\n LOG.error( error );\n throw new CfgRuntimeException( GlobalErrIds.FT_CONFIG_INITIALIZE_FAILED, error, se );\n }\n }", "private void parseConfig() throws CatascopiaException {\n\t\tthis.config = new Properties();\n\t\t//load config properties file\n\t\ttry {\t\t\t\t\n\t\t\tFileInputStream fis = new FileInputStream(JCATASCOPIA_AGENT_HOME + File.separator + CONFIG_PATH);\n\t\t\tconfig.load(fis);\n\t\t\tif (fis != null)\n\t \t\tfis.close();\n\t\t} \n\t\tcatch (FileNotFoundException e) {\n\t\t\tthrow new CatascopiaException(\"config file not found\", CatascopiaException.ExceptionType.FILE_ERROR);\n\t\t} \n\t\tcatch (IOException e) {\n\t\t\tthrow new CatascopiaException(\"config file parsing error\", CatascopiaException.ExceptionType.FILE_ERROR);\n\t\t}\n\t}", "private void loadLocalConfig()\n {\n try\n {\n // Load the system config file.\n URL fUrl = Config.class.getClassLoader().getResource( PROP_FILE );\n config.setDelimiterParsingDisabled( true );\n if ( fUrl == null )\n {\n String error = \"static init: Error, null cfg file: \" + PROP_FILE;\n LOG.warn( error );\n }\n else\n {\n LOG.info( \"static init: found from: {} path: {}\", PROP_FILE, fUrl.getPath() );\n config.load( fUrl );\n LOG.info( \"static init: loading from: {}\", PROP_FILE );\n }\n\n URL fUserUrl = Config.class.getClassLoader().getResource( USER_PROP_FILE );\n if ( fUserUrl != null )\n {\n LOG.info( \"static init: found user properties from: {} path: {}\", USER_PROP_FILE, fUserUrl.getPath() );\n config.load( fUserUrl );\n }\n }\n catch ( org.apache.commons.configuration.ConfigurationException ex )\n {\n String error = \"static init: Error loading from cfg file: [\" + PROP_FILE\n + \"] ConfigurationException=\" + ex;\n LOG.error( error );\n throw new CfgRuntimeException( GlobalErrIds.FT_CONFIG_BOOTSTRAP_FAILED, error, ex );\n }\n }", "private void loadSettings() {\r\n \tString fname = baseDir + \"/\" + configFile;\r\n\t\tString line = null;\r\n\r\n\t\t// Load the settings hash with defaults\r\n\t\tsettings.put(\"db_url\", \"\");\r\n\t\tsettings.put(\"db_user\", \"\");\r\n\t\tsettings.put(\"db_pass\", \"\");\r\n\t\tsettings.put(\"db_min\", \"2\");\r\n\t\tsettings.put(\"db_max\", \"10\");\r\n\t\tsettings.put(\"db_query\", \"UPDATE members SET is_activated=1 WHERE memberName=? AND is_activated=3\");\r\n\t\t// Read the current file (if it exists)\r\n\t\ttry {\r\n \t\tBufferedReader input = new BufferedReader(new FileReader(fname));\r\n \t\twhile (( line = input.readLine()) != null) {\r\n \t\t\tline = line.trim();\r\n \t\t\tif (!line.startsWith(\"#\") && line.contains(\"=\")) {\r\n \t\t\t\tString[] pair = line.split(\"=\", 2);\r\n \t\t\t\tsettings.put(pair[0], pair[1]);\r\n \t\t\t}\r\n \t\t}\r\n \t}\r\n \tcatch (FileNotFoundException e) {\r\n\t\t\tlogger.warning( \"[SMF] Error reading \" + e.getLocalizedMessage() + \", using defaults\" );\r\n \t}\r\n \tcatch (Exception e) {\r\n \t\te.printStackTrace();\r\n \t}\r\n }", "public boolean init()\n\t{\n\t\tboolean ret = false;\n\t\ttry\n\t\t{\n\t\t\tsocket = new Socket(Setting.SERVER_IP, Setting.SERVER_PORT);\n\t\t\tis = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n\t\t\tos = new PrintWriter(socket.getOutputStream());\n\t\t\t\n\t\t\tsentInitInfo();\n\t\t\t\n\t\t\tThread listeningThread = new Thread(listenRunnable);\n\t\t\tlisteningThread.start();\n\t\t\t\n\t\t\tret = true;\n\t\t}\n\t\tcatch (UnknownHostException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\tcatch (IOException e)\n\t\t{\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn ret;\n\t}", "public HashMap<Integer, String> getPLNConfigurationFiles() throws SQLException{\n\t\tConnection dbConnection = null;\n\t\tHashMap<Integer,String> configurationFiles = new HashMap<Integer,String>(); \n\n\t\ttry {\t\t\t\t\t\t\t\n\t\t\tString configUrlQuery = \"SELECT config_url, id from plnmonitor.pln\";\n\n\t\t\tdbConnection = getDBConnection();\n\n\t\t\tStatement stmt = dbConnection.createStatement();\n\t\t\tResultSet rs = stmt.executeQuery(configUrlQuery);\n\t\t\twhile (rs.next()) {\n\t\t\t\tconfigurationFiles.put(rs.getInt(\"id\"),rs.getString(\"config_url\"));\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\t\t\tLOGGER.error(\"Please check that the database is running and/or plnmonitor has been properly configured:\");\n\t\t\tLOGGER.error(\"$ java -jar plnmonitor-daemon.jar config\");\n\n\t\t\tLOGGER.error(e.getMessage());\n\t\t} finally {\n\t\t\tif (dbConnection != null) {\n\t\t\t\tdbConnection.close();\n\t\t\t}\n\t\t}\n\t\treturn (configurationFiles);\n\t}", "protected synchronized void loadConfiguration() throws ServletException {\r\n\r\n\t\tif (configFileName == null) {\r\n\t\t\t// Missing init parameter? That's okay, perhaps there is nothing to\r\n\t\t\t// redirect. \r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tFile configFile = new File(configFileName);\r\n\t\tDocumentBuilderFactory docBuildFac = DocumentBuilderFactory.newInstance();\r\n\t\t\r\n\t\tDocumentBuilder docBuild;\r\n\t\ttry {\r\n\t\t\tif (docBuildFac.isValidating())\r\n\t\t\t\tdocBuildFac.setValidating(false);\r\n\t\t\tdocBuild = docBuildFac.newDocumentBuilder();\r\n\t\t} catch (ParserConfigurationException e) {\r\n\t\t\t// Problems with the XML parser? Very unlikely, the container wouldn't \r\n\t\t\t// work at all. Whatever it is, it is serious, we give up.\r\n\t\t\tthrow new ServletException(e.getMessage());\r\n\t\t}\r\n\r\n\t\tDocument doc;\r\n\t\ttry {\r\n\t\t\tdoc = docBuild.parse(configFile);\r\n\t\t} catch (IOException e) {\r\n\t\t\t// File configFile not found, or similar.\r\n\t\t\tthrow new ServletException(e.getMessage());\r\n\t\t} catch (SAXException e) {\r\n\t\t\t// Invalid XML in configFile, or similar.\r\n\t\t\tthrow new ServletException(e.getMessage());\r\n\t\t}\r\n\t\t\r\n\t\tredirectRules = new Vector<RedirectRule>();\r\n\t\t\r\n\t\tNode node = doc.getDocumentElement();\r\n\t\twhile (node != null) {\r\n\t\t\tif (node.getNodeType() == Node.ELEMENT_NODE) {\r\n\t\t\t\tRedirectRule rule = loadRule((Element) node);\r\n\t\t\t\tif (rule != null)\r\n\t\t\t\t\tredirectRules.add(rule);\r\n\t\t\t}\r\n\t\t\tif (node.hasChildNodes() == true)\r\n\t\t\t\tnode = node.getFirstChild();\r\n\t\t\telse if (node.getNextSibling() != null)\r\n\t\t\t\tnode = node.getNextSibling();\r\n\t\t\telse if (node.getParentNode() != null)\r\n\t\t\t\tnode = node.getParentNode().getNextSibling();\r\n\t\t\telse\r\n\t\t\t\tnode = null;\r\n\t\t}\r\n\t\t\t\t\r\n\t\tfilterConfig.getServletContext().log(filterName + \": Loaded \" +\r\n\t\t\t\tredirectRules.size() + \" rule(s).\");\r\n\t}", "public void parseServerFile() throws IOException {\r\n /* Creates new Scanner object of the filePath */\r\n Scanner scan = new Scanner(filePath).useDelimiter(\"version=\");\r\n /* Creates new Scanner object for the server version */\r\n Scanner scanVersion = new Scanner(scan.next()).useDelimiter(\"name=\");\r\n /* Sets the server version number */\r\n this.setVersion(scanVersion.next());\r\n /* Creates new Scanner object for the server name */\r\n Scanner scanName = \r\n new Scanner(scanVersion.next()).useDelimiter(\"host=\");\r\n /* Sets the server name */\r\n this.setName(scanName.next());\r\n /* Creates new Scanner object for the server ip address */\r\n Scanner scanAddress = new Scanner(scanName.next());\r\n /* Sets the server ip address */\r\n this.setIPAddress(scanAddress.next()); \r\n }", "private void cargarConfiguracionBBDD()\r\n\t{\r\n\t\tjava.io.InputStream IO = null;\r\n\r\n\t\ttry {\r\n\t\t\tIO = getClass().getClassLoader().getResourceAsStream(\"configuracion.properties\");\r\n\r\n\t\t // load a properties file\r\n\t\t prop.load(IO);\r\n\t\t \r\n\t\t \r\n\t\t host=prop.getProperty(\"host\");\r\n\t\t database=prop.getProperty(\"database\");\r\n\t\t username=prop.getProperty(\"username\");\r\n\t\t password=prop.getProperty(\"password\");\r\n\t\t \r\n\t\t System.out.println(host);\r\n\r\n\t\t \r\n\t\t \r\n\t\t} catch (IOException ex) {\r\n\t\t ex.printStackTrace();\r\n\t\t} finally {\r\n\t\t if (IO != null) {\r\n\t\t try {\r\n\t\t IO.close();\r\n\t\t } catch (IOException e) {\r\n\t\t e.printStackTrace();\r\n\t\t }\r\n\t\t }\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "private void ReadConfig()\n {\n try\n {\n Yaml yaml = new Yaml();\n\n BufferedReader reader = new BufferedReader(new FileReader(confFileName));\n\n yamlConfig = yaml.loadAll(reader);\n\n for (Object confEntry : yamlConfig)\n {\n //System.out.println(\"Configuration object type: \" + confEntry.getClass());\n\n Map<String, Object> confMap = (Map<String, Object>) confEntry;\n //System.out.println(\"conf contents: \" + confMap);\n\n\n for (String keyName : confMap.keySet())\n {\n //System.out.println(keyName + \" = \" + confMap.get(keyName).toString());\n\n switch (keyName)\n {\n case \"lineInclude\":\n\n for ( String key : ((Map<String, String>) confMap.get(keyName)).keySet())\n {\n lineFindReplace.put(key, ((Map<String, String>) confMap.get(keyName)).get(key).toString());\n }\n\n lineIncludePattern = ConvertToPattern(lineFindReplace.keySet().toString());\n\n break;\n case \"lineExclude\":\n lineExcludePattern = ConvertToPattern(confMap.get(keyName).toString());\n break;\n case \"fileExclude\":\n fileExcludePattern = ConvertToPattern(confMap.get(keyName).toString());\n break;\n case \"fileInclude\":\n fileIncludePattern = ConvertToPattern(confMap.get(keyName).toString());\n break;\n case \"dirExclude\":\n dirExcludePattern = ConvertToPattern(confMap.get(keyName).toString());\n break;\n case \"dirInclude\":\n dirIncludePattern = ConvertToPattern(confMap.get(keyName).toString());\n break;\n case \"urlPattern\":\n urlPattern = ConvertToPattern(confMap.get(keyName).toString());\n break;\n }\n }\n }\n\n } catch (Exception e)\n {\n System.err.format(\"Exception occurred trying to read '%s'.\", confFileName);\n e.printStackTrace();\n }\n }", "private static ServerConfigPOJO defaultServerConfig() {\n return ServerConfigParser.readServerConfig();\n }", "private void loadData() {\n\n \tInputStream inputStream = this.getClass().getResourceAsStream(propertyFilePath);\n \n //Read configuration.properties file\n try {\n //prop.load(new FileInputStream(propertyFilePath));\n \tprop.load(inputStream);\n //prop.load(this.getClass().getClassLoader().getResourceAsStream(\"configuration.properties\"));\n } catch (IOException e) {\n System.out.println(\"Configuration properties file cannot be found\");\n }\n \n //Get properties from configuration.properties\n browser = prop.getProperty(\"browser\");\n testsiteurl = prop.getProperty(\"testsiteurl\");\n defaultUserName = prop.getProperty(\"defaultUserName\");\n defaultPassword = prop.getProperty(\"defaultPassword\");\n }", "public static void load(String filename, Supervisor k) throws FileNotFoundException{\n String source = \"\";\n try {\n Scanner in = new Scanner(new FileReader(filename));\n while(in.hasNext()){\n source = source + in.next();\n }\n } catch (FileNotFoundException ex) {\n //throw ex;\n System.out.println(\"Could not read config file: \" + ex);\n System.out.println(\"trying to create a new one...\");\n String stsa = \"Done!\\n\";\n try (\n Writer writer = new BufferedWriter(new OutputStreamWriter(\n new FileOutputStream(filename), \"utf-8\"))) {\n writer.write(\"\");\n writer.close();\n }\n \n catch (IOException ex1) {\n stsa = \"\";\n System.out.println(\"FAILED, SKIPPING CONFIG READ BECOUSE:\");\n Logger.getGlobal().warning(ex1.toString());\n System.out.println(\"Console version: \" + ex1.toString());\n }\n System.out.print(stsa);\n }\n LinkedList<String[]> raw = fetch(source);\n \n if(k.Logic == null){\n Logger.getGlobal().warning(\"ENGINE NOT INITIALIZED PROPERLY, ABORTING APPLYING CONFIG\");\n return;\n }\n if(k.Logic.Vrenderer == null){\n Logger.getGlobal().warning(\"ENGINE RENDERER NOT INITIALIZED PROPERLY, ABORTING APPLYING CONFIG\");\n return;\n }\n \n for(String[] x: raw){\n String value = x[1];\n if(!k.features_overrideAllStandard)\n switch(x[0]){\n case \"nausea\":\n int numValue = 0;\n try{\n numValue = Integer.parseInt(value);\n }\n catch(Exception e){\n quickTools.alert(\"configReader\", \"invalid nausea value\");\n break;\n }\n if(numValue > 0){\n k.Logic.Vrenderer.dispEffectsEnabled = true;\n }\n //k.Logic.Vrenderer.di\n break;\n default:\n\n break;\n }\n customFeatures(x[0], x[1], k);\n }\n }", "public static Socket ConnectionToServer(){\n try {\n // Gathers the information from server.config file\n resources.GetPropertyValues properties = new resources.GetPropertyValues();\n properties.ReadPropertyFile();\n\n // Create a socket connect If the server connection was made\n return new Socket(properties.serverName, GetPropertyValues.port);\n } catch (IOException e) {\n\n // Alert the user that the server is offline. Produce a pop up window\n DialogWindow.ShowErrorPane(\"Server is offline\", \"Error\");\n return new Socket();\n }\n }", "public JCiscoConfParse(String path) throws IOException {\n\t\tList<String> config = Files.readAllLines(Paths.get(path), Charset.defaultCharset());\n\t\tList<String> block = new ArrayList<>();\n\n\t\tfor (String line : config) {\n\t\t\tif (line.isEmpty() || line.startsWith(\"!\")) {\n\t\t\t\tcontinue;\n\t\t\t} else if (line.startsWith(\" \") || line.startsWith(\" \")) {\n\t\t\t\t// Zum letzten Block hinzufügen, welcher über \"block\" noch referenziert sein sollte.\n\t\t\t\tblock.add(line);\n\t\t\t} else {\n\t\t\t\tblock = new ArrayList<>();\n\t\t\t\tblock.add(line);\n\t\t\t\trunningConfig.add(block);\n\t\t\t}\n\t\t}\n\t}", "public ZwischenServer() throws IOException{\n\t\tFile paramfile = new File(\"/home/tobi/uniworks/netzwerke/UE2/Parameter.txt\");\n\t\tif(paramfile.canRead()){\n\t\t\tInputStream paramIs = new FileInputStream(paramfile);\n\t\t\tInputStreamReader paramIsr = new InputStreamReader(paramIs);\n\t\t\tBufferedReader paramBr = new BufferedReader(paramIsr);\n\t\t\tth = paramBr.readLine();\n\t\t\tcontent = th.substring(th.indexOf(' ', 0), th.length());\n\t\t\tth = th.substring(0, th.indexOf(' ', 0));\n\t\t\texchangeContent = content.substring(content.indexOf(';'), content.indexOf(')')-1);\n\t\t\tcontent = content.substring(content.indexOf('('), content.indexOf(';'));\n\t\t\tsocket8082 = new Socket(\"127.0.0.1\",8082);\n\t\t\tsocket80 = new Socket(th,80);\n\t\t}\n\t\telse\n\t\t\tSystem.out.println(\"Error file not found\");\n\t}", "public void load()\n\t{\n\t\ttry {\n\t\t\tIFile file = project.getFile(PLAM_FILENAME);\n\t\t if (file.exists()) {\n\t\t\t\tInputStream stream= null;\n\t\t\t\ttry {\n\t\t\t\t\tstream = new BufferedInputStream(file.getContents(true));\n\t\t\t\t SAXReader reader = new SAXReader();\n\t\t\t\t Document document = reader.read(stream);\n\t\t\t\t \n\t\t\t\t Element root = document.getRootElement();\n\n\t\t\t\t String url = root.elementTextTrim(\"server-url\");\n\t\t\t\t setServerURL((url != null) ? new URL(url) : null);\n\t\t\t\t \n\t\t\t\t setUserName(root.elementTextTrim(\"username\"));\n\t\t\t\t setPassword(root.elementTextTrim(\"password\"));\n\t\t\t\t setProductlineId(root.elementTextTrim(\"pl-id\"));\n \n\t\t\t\t} catch (CoreException e) {\n\t\t\t\t\t\n\t\t\t\t} finally {\n\t\t\t\t if (stream != null)\n\t\t\t\t stream.close();\n\t\t\t\t}\n\t\t }\n\t\t} catch (DocumentException e) {\n\t\t\tlogger.info(\"Error while parsing PLAM config.\", e);\n\t\t} catch (IOException e) {\n\t\t}\n\t}" ]
[ "0.6797185", "0.6549543", "0.63759804", "0.62364817", "0.60215443", "0.58813643", "0.58374226", "0.5834773", "0.57615906", "0.5760422", "0.5749631", "0.5741468", "0.57278425", "0.57212687", "0.57165915", "0.5692627", "0.56628305", "0.56626946", "0.56467974", "0.5642955", "0.56206936", "0.56130546", "0.5553801", "0.5535267", "0.5523708", "0.55025584", "0.5497217", "0.5484219", "0.54559606", "0.5428028", "0.5426421", "0.54204553", "0.53887105", "0.5375898", "0.53471005", "0.53374183", "0.53267574", "0.53214943", "0.5292619", "0.52887017", "0.52865714", "0.52829266", "0.52818877", "0.5279762", "0.5275159", "0.52580357", "0.5255311", "0.524106", "0.5237105", "0.52221054", "0.5219806", "0.52196014", "0.5206415", "0.51876366", "0.51864773", "0.51796305", "0.51695865", "0.5167434", "0.51658833", "0.51566064", "0.5156333", "0.5150134", "0.5147152", "0.51467174", "0.5139662", "0.51327777", "0.5128462", "0.5125294", "0.51006305", "0.50781226", "0.5068594", "0.50671726", "0.5059039", "0.5057622", "0.5053862", "0.5053796", "0.5030367", "0.5029417", "0.5028641", "0.5026719", "0.5023485", "0.50186414", "0.5013764", "0.5006728", "0.5006417", "0.5005455", "0.50038975", "0.4996662", "0.49955988", "0.4995533", "0.49651536", "0.49612656", "0.4958783", "0.49536467", "0.49467748", "0.49466", "0.49324825", "0.4929257", "0.49265325", "0.49200326" ]
0.7742123
0
Paints the foreground and background of all objects that are allowed to be changed/controlled by the user
private void paintAllObjects() { for (int i = 0; i < allObjects.size(); i++) { JComponent c = (JComponent) allObjects.get(i); c.setBackground(backgroundColor); c.setForeground(foregroundColor); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void paintComponent(final Graphics g) {\n if (!isOpaque()) {\n super.paintComponent(g);\n return;\n }\n \n // use value of JTextField for consistency\n g.setColor(UIManager.getColor(\"TextField.inactiveBackground\"));\n g.fillRect(3, 3, getWidth() - 6, getHeight() - 6);\n \n // do rest, changing opaque to ensure background is not overwritten\n setOpaque(false);\n super.paintComponent(g);\n setOpaque(true);\n }", "protected void drawGUI() {\n batch.draw(background, 0, 0);\n }", "public void paint() {\n BufferStrategy bs;\n bs = this.getBufferStrategy();\n\n Graphics g = bs.getDrawGraphics();\n g.drawImage(background, 0, 0, this.getWidth(), this.getHeight(), null);\n if (this.blackHoles != null) {\n for (BlackHole blackHole : this.blackHoles) {\n blackHole.paint(g);\n }\n }\n if (this.balls != null) {\n for (int i = 0; i <this.balls.size() ; i++) {\n this.balls.get(i).paint(g);\n }\n\n }\n\n bs.show();\n g.dispose();\n\n }", "@Override\r\n\tprotected void init() {\r\n\r\n\t\t// enable:\r\n\t\tObject obj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[Enabled].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorEnabled = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorEnabled = this.color2;\r\n\t\t}\r\n\r\n\t\t// disable:\r\n\t\tobj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[Disabled].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorDisabled = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorDisabled = this.color1;\r\n\t\t}\r\n\r\n\t\t// pressed:\r\n\t\tobj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[Pressed].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorPressed = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorPressed = this.color3;\r\n\t\t}\r\n\r\n\t\t// mouseover:\r\n\t\tobj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[MouseOver].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorMouseOver = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorMouseOver = this.color4;\r\n\t\t}\r\n\r\n\t}", "@Override\r\n\tpublic void paintComponent(Graphics g)\r\n {\r\n\t\tsuper.paintComponent(g);\r\n\t\tg.setColor(getForeground());\r\n\t\tg.fillOval(0,0, this.getWidth(),this.getHeight());\r\n }", "public void initGui() {\n setOpaque(true);\n // Setter utgangsfargen til ruten\n if (this.farge.equals(\"hvit\")) setBackground(GUISettings.Hvit());\n if (this.farge.equals(\"sort\")) setBackground(GUISettings.Sort());\n if (this.farge.equals(\"roed\")) setBackground(GUISettings.Roed());\n if (this.farge.equals(\"blaa\")) setBackground(GUISettings.Blaa());\n }", "@Override\n protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {\n }", "public void paint(Graphics g) {\n\t\tfor(int i = 0; i < handler.object.size(); i++){\r\n\t\t\tObjectsInGame tempObject = handler.object.get(i);\r\n\t\t\tif(tempObject.getId() == IDOfObjects.Paddle1)\r\n\t\t\t\tg.setColor(Color.blue);\r\n\t\t\telse\r\n\t\t\tif(tempObject.getId() == IDOfObjects.Paddle2)\r\n\t\t\t\tg.setColor(Color.green);\r\n\t\tg.fillRect(x, y, 100, 15);\r\n\t\t\r\n\t\t}\r\n\r\n\t}", "@Override\n protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {\n switch (state) {\n case BACKGROUND_ENABLED:\n paintBackgroundEnabled(g);\n break;\n case BACKGROUND_DISABLED:\n paintBackgroundDisabled(g);\n break;\n case BACKGROUND_ENABLED_MOUSEOVER:\n paintBackgroundEnabledAndMouseOver(g);\n break;\n case BACKGROUND_ENABLED_PRESSED:\n paintBackgroundEnabledAndPressed(g);\n break;\n }\n }", "public Feux() {\n initComponents();\n \n rouge.setEnabled(true);\n orange.setEnabled(false);\n vert.setEnabled(false);\n \n start();\n \n }", "private void setIncognito()\n\t{\n\t\t\teToPower.setBackground (black);\n\t\t\ttwoPower.setBackground (black);\n\t\t\tln.setBackground (black);\n\t\t\txCube.setBackground (black);\n\t\t\txSquare.setBackground (black);\n\t\t\tdel.setBackground (black);\n\t\t\tcubeRoot.setBackground (black);\n\t\t\tC.setBackground (black);\n\t\t\tnegate.setBackground (black);\n\t\t\tsquareRoot.setBackground (black);\n\t\t\tnine.setBackground (black);\n\t\t\teight.setBackground (black);\n\t\t\tseven.setBackground (black);\n\t\t\tsix.setBackground (black);\n\t\t\tfive.setBackground (black);\n\t\t\tfour.setBackground (black);\n\t\t\tthree.setBackground (black);\n\t\t\ttwo.setBackground (black);\n\t\t\tone.setBackground (black);\n\t\t\tzero.setBackground (black);\n\t\t\tdivide.setBackground (black);\n\t\t\tpercent.setBackground (black);\n\t\t\tmultiply.setBackground (black);\n\t\t\treciprocal.setBackground (black);\n\t\t\tadd.setBackground (black);\n\t\t\tsubtract.setBackground (black);\n\t\t\tdecimalPoint.setBackground (black);\n\t\t\tequals.setBackground (black);\n\t\t\te.setBackground (black);\n\t\t\tPI.setBackground (black);\n\t\t\t\n\t\t\teToPower.setForeground (white);\n\t\t\ttwoPower.setForeground (white);\n\t\t\tln.setForeground (white);\n\t\t\txCube.setForeground (white);\n\t\t\txSquare.setForeground (white);\n\t\t\tdel.setForeground (white);\n\t\t\tcubeRoot.setForeground (white);\n\t\t\tC.setForeground (white);\n\t\t\tnegate.setForeground (white);\n\t\t\tsquareRoot.setForeground (white);\n\t\t\tnine.setForeground (white);\n\t\t\teight.setForeground (white);\n\t\t\tseven.setForeground (white);\n\t\t\tsix.setForeground (white);\n\t\t\tfive.setForeground (white);\n\t\t\tfour.setForeground (white);\n\t\t\tthree.setForeground (white);\n\t\t\ttwo.setForeground (white);\n\t\t\tone.setForeground (white);\n\t\t\tzero.setForeground (white);\n\t\t\tdivide.setForeground (white);\n\t\t\tpercent.setForeground (white);\n\t\t\tmultiply.setForeground (white);\n\t\t\treciprocal.setForeground (white);\n\t\t\tadd.setForeground (white);\n\t\t\tsubtract.setForeground (white);\n\t\t\tdecimalPoint.setForeground (white);\n\t\t\tequals.setForeground (white);\n\t\t\te.setForeground (white);\n\t\t\tPI.setForeground (white);\n\t\t\t\t\t\n\t\t\tentry.setBackground (black);\n\t\t\tentry.setForeground(white);\n\n\t\t\tmenuBar.setBackground(black);\n\t\t\tmenuBar.setForeground(white);\n\t\t\tfileMenu.setForeground(white);\n\t\t\thelpMenu.setForeground (white);\n\t\t\ttoolsMenu.setForeground(white);\n\t\t\t\n\t\t\texit.setBackground(black);\n\t\t\tsettings.setBackground(black);\n\t\t\treadme.setBackground(black);\n\t\t\tabout.setBackground(black);\n\t\t\t\t\t\t\n\t\t\texit.setForeground(white);\n\t\t\tsettings.setForeground(white);\n\t\t\treadme.setForeground(white);\n\t\t\tabout.setForeground(white);\n\t}", "@Override\r\n\tprotected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {\n\t\tthis.componentColors = extendedCacheKeys;\r\n\r\n\t\tswitch (this.state) {\r\n\r\n\t\tcase FOREGROUND_DISABLED:\r\n\t\t\tthis.paintForegroundDisabled(g, width, height);\r\n\t\t\tbreak;\r\n\r\n\t\tcase FOREGROUND_ENABLED:\r\n\t\t\tthis.paintForegroundEnabled(g, width, height);\r\n\t\t\tbreak;\r\n\r\n\t\tcase FOREGROUND_PRESSED:\r\n\t\t\tthis.paintForegroundPressed(g, width, height);\r\n\t\t\tbreak;\r\n\r\n\t\tcase FOREGROUND_MOUSEOVER:\r\n\t\t\tthis.paintForegroundMouseOver(g, width, height);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "@Override\n\tprotected void paintComponent(Graphics g) {\n\t\tsuper.paintComponent(g);\n\t\tGraphics2D g2 = (Graphics2D) g; \n\t\tg2.setColor(Color.lightGray);\n\t\tg2.fill(model.bg);\n\t\tg2.setColor(Color.darkGray);\n\t\tg2.fillPolygon(model.terrain);\n\t\tg2.setColor(Color.gray);\n\t\tfor (int i = 0; i < 20; i++) {\n\t\t\tg2.draw(model.circles.get(i));\n\t\t}\n\t\tif (model.curCircleSel != -1) {\n\t\t\tg2.setColor(Color.white);\n\t\t\tg2.setStroke(new BasicStroke(3));\n\t\t\tg2.draw(model.circles.get(model.curCircleSel));\n\t\t}\n\t\tg2.setColor(Color.RED);\n\t\tg2.fill(model.pad);\n\t\tif (curPadSel) {\n\t\t\tg2.setColor(Color.white);\n\t\t\tg2.setStroke(new BasicStroke(3));\n\t\t\tg2.draw(model.pad);\n\t\t}\n\t}", "@Override\n public void handlePaint()\n {\n for(GraphicObject obj : this.graphicObjects)\n {\n obj.draw();\n }\n \n }", "public void paint(Graphics g)\r\n {\r\n \r\n super.paint(g);\r\n g.drawImage(backgroundImage, 0, 0, null); //Draws Background image in background of panel\r\n \r\n if(mode == 0)\r\n {\r\n g.setColor(Color.magenta); \r\n g.setFont(new Font(\"Copperplate Gothic Bold\", Font.BOLD, 50));\r\n g.drawString(\"Yeet Fighter\",37,300); //Draws Title in magenta in font specified\r\n \r\n \r\n g.setColor(Color.gray);\r\n g.setFont(new Font(\"Impact\", Font.ITALIC, 20));\r\n g.drawString(\"Press any key to start\",700,550); //Draws prompt to start specification in gray in font specified\r\n }\r\n else if(mode == 1)\r\n {\r\n\r\n g.setColor(Color.white);\r\n g.fillRect(0,yMin, 1000, 10); //rectangle platform is drawn\r\n Color healthbar1 = new Color(255-(int)((dFs[0].getHealth()/totalH) * 255),(int)((dFs[0].getHealth()/totalH) * 255),0);\r\n g.setColor(healthbar1); \r\n g.fillRect(10,10,(int)((dFs[0].getHealth()/totalH) * 465),10); // health bar is drawn with color in spectrum of red through green based on red fighter health\r\n Color healthbar2 = new Color(255-(int)((dFs[1].getHealth()/totalH) * 255),(int)((dFs[1].getHealth()/totalH) * 255),0);\r\n g.setColor(healthbar2);\r\n g.fillRect(480+(465-(int)((dFs[1].getHealth()/totalH) * 465)),10,(int)((dFs[1].getHealth()/totalH) * 465),10); \r\n // health bar is drawn with color in spectrum of red through green based on red fighter health with x coordinates so that health bar moves away from center\r\n\r\n g.setColor(Color.red);\r\n \r\n \r\n if(dFs[0].getAttacking() == 2)\r\n {\r\n g.setColor(new Color(150, 0, 0)); //the fighter is drawn darker if they are in cooldown\r\n }else\r\n {\r\n g.setColor(new Color(255, 0, 0));\r\n }\r\n\r\n g.fillRect((int)dFs[0].getPos()[0],(int)dFs[0].getPos()[1],dFs[0].getSize(),dFs[0].getSize()); //red fighter is drawn\r\n //sets color of fighter to darker color if attack is in cooldown method else in norml state\r\n\r\n if(dFs[0].getAttacking() == 1)\r\n {\r\n g.setColor(Color.red);\r\n \r\n int[] i = new int[4];\r\n i = attackHitBox(dFs[0]);\r\n\r\n g.fillRect(i[0],i[1],i[2],i[3]); //draws the attack onto the screen\r\n }\r\n\r\n if(dFs[0].getBlocking() != 0)\r\n {\r\n if(dFs[0].getBlocking() == 1)\r\n {\r\n g.setColor(new Color(255, 255, 255)); //draws a white box if blocking\r\n }else\r\n {\r\n g.setColor(new Color(150, 150, 150)); //draws a gray box if in cooldown\r\n }\r\n g.fillRect((int) (dFs[0].getPos()[0] + 10) ,(int) (dFs[0].getPos()[1] + 10), dFs[0].getSize() -20 , dFs[0].getSize() - 20); \r\n //draws square used to indicate blocking on fighter that is blocking and in color based on whether block is in active state\r\n }\r\n\r\n\r\n if(dFs[1].getAttacking() == 2)\r\n {\r\n g.setColor(new Color(0, 150, 150));\r\n }else\r\n {\r\n g.setColor(new Color(0, 255, 255));\r\n }\r\n\r\n g.fillRect((int)dFs[1].getPos()[0],(int)dFs[1].getPos()[1],dFs[1].getSize(),dFs[1].getSize()); //blue fighter is drawn\r\n //sets color of fighter to darker color if attack is in cooldown method else in norml state\r\n\r\n if(dFs[1].getAttacking() == 1)\r\n {\r\n g.setColor(new Color(0, 255, 255));\r\n \r\n int[] i = new int[4];\r\n i = attackHitBox(dFs[1]);\r\n\r\n g.fillRect(i[0],i[1],i[2],i[3]);\r\n }\r\n\r\n if(dFs[1].getBlocking() != 0)\r\n {\r\n if(dFs[1].getBlocking() == 1)\r\n {\r\n g.setColor(new Color(255, 255, 255));\r\n }else\r\n {\r\n g.setColor(new Color(150, 150, 150));\r\n }\r\n g.fillRect((int) (dFs[1].getPos()[0] + 10) ,(int) (dFs[1].getPos()[1] + 10), dFs[1].getSize() -20 , dFs[1].getSize() - 20);\r\n //draws square used to indicate blocking on fighter that is blocking and in color based on whether block is in active state\r\n }\r\n\r\n\r\n\r\n\r\n }else if(mode == 2)\r\n {\r\n \r\n g.setFont(new Font(\"Agency FB\", Font.BOLD, 30)); \r\n g.setColor(Color.white);\r\n g.drawString(\"Developed By Joseph Rother & Akshan Sameullah\",200,570); //draws author label with color white and specified font\r\n \r\n if(dFs[0].getHealth() > 0)\r\n {\r\n g.setFont(new Font(\"Agency FB\", Font.BOLD, 190));\r\n g.setColor(Color.red);\r\n g.drawString(\"Red\",500,200);\r\n g.drawString(\"Wins\",500,400); //Draws Red Wins in specified font and in red if Red wins\r\n \r\n \r\n }else\r\n {\r\n \r\n \r\n g.setColor(Color.cyan);\r\n g.setFont(new Font(\"Agency FB\", Font.BOLD, 190));\r\n g.drawString(\"Blue\",500,200);\r\n g.drawString(\"Wins\",500,400); //Draws Blue Wins in specified font if red health is 0\r\n \r\n \r\n }\r\n Graphics2D g2 = (Graphics2D) g;\r\n AffineTransform at = new AffineTransform();\r\n at.setToRotation(Math.toRadians(270), 440, 380);\r\n g2.setTransform(at);\r\n g2.setColor(Color.magenta);\r\n g2.setFont(new Font(\"Magneto\", Font.BOLD, 170));\r\n g2.drawString(\"Game\",250,80);\r\n g2.drawString(\"Over\",300,250); //draws game over in vertical position in font specified and in pink (same color as title)\r\n }\r\n \r\n g.dispose();\r\n }", "public void paintControl(PaintEvent e) {\n\t\t\t\te.gc.setAntialias(SWT.ON);\n\t\t\t\te.gc.setForeground(((Text) e.widget).getForeground());\n\t\t\t\tif (editable)\n\t\t\t\t\te.gc.drawRoundRectangle(e.x, e.y, e.width - 1, e.height - 1, 6, 6);\n\t\t\t}", "protected void setBoxBackground() { Console.setBackground(Console.RED); }", "@Override\n protected void drawGuiContainerBackgroundLayer(final float opacity, final int x, final int y)\n {\n GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);\n ResourceHandler.bindGUI(mc, EnumModeled.machineGrinder.name());\n final int xStart = (width - xSize) / 2;\n final int yStart = (height - ySize) / 2;\n drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);\n int scale;\n if (grinderL.canRun())\n {\n scale = grinderL.getProgressScaled(24);\n drawTexturedModalRect(xStart + 79, yStart + 31, 176, 0, 20, scale);\n }\n }", "@Override\n\t protected void paintComponent(Graphics g) {\n\t super.paintComponent(g);\n\t for (int y = 0; y < MAX_Y; y++) {\n\t for (int x = 0; x < MAX_X; x++) { \n\t if(seed[x][y].isAlive) {\n\t g.setColor(FILL_COLOR);\n\t g.fillRect(x * CELL_WIDTH, y * CELL_WIDTH, CELL_WIDTH, CELL_WIDTH);\n\t }\n\t else{\n\t g.setColor(defaultBackground);\n\t g.fillRect(x * CELL_WIDTH, y * CELL_WIDTH, CELL_WIDTH, CELL_WIDTH);\n\t }//end if..\n\t g.setColor(Color.GRAY);\n\t g.drawRect(x * CELL_WIDTH, y * CELL_WIDTH, CELL_WIDTH, CELL_WIDTH);\n\t }//end for x\n\t }//end for y\n\t }", "@Override\n public void paintComponent(Graphics g) {\n // always clear the screen first!\n g.clearRect(0, 0, WIDTH, HEIGHT);\n\n // GAME DRAWING GOES HERE\n \n \n // draw the blocks\n g.setColor(Color.black);\n for(int i = 0; i < blocks.length; i++){\n g.fillRect(blocks[i].x, blocks[i].y, blocks[i].width, blocks[i].height);\n }\n \n // middle ref (no longer needed)\n //g.setColor(Color.black);\n //g.drawRect(WIDTH/2 - 1, 0, 1, HEIGHT);\n \n // scores\n g.setFont(biggerFont);\n g.setColor(Color.blue);\n g.drawString(\"\" + tobyScore, WIDTH/2-100, 75);\n if(tobyWin){\n g.drawString(\"Toby Wins!\", WIDTH/2-115, 120);\n }\n g.setColor(Color.red);\n if(maxWin){\n g.drawString(\"Max Wins!\", WIDTH/2-115, 120);\n }\n g.drawString(\"\" + maxScore, WIDTH/2+100, 75);\n g.setColor(Color.white);\n g.setFont(titleFont);\n g.drawString(\"Toby N' Max: Capture the Flag!\", 25, 20);\n \n // draw the player\n g.setColor(Color.red);\n g.fillRect(max.x, max.y, max.width, max.height);\n g.setColor(Color.blue);\n g.fillRect(toby.x, toby.y, toby.width, toby.height);\n \n // draw the flag\n g.setColor(brown);\n for(int i = 0; i < flagPole.length; i++){\n g.fillRect(flagPole[i].x, flagPole[i].y, flagPole[i].width, flagPole[i].height);\n }\n \n g.setColor(purple);\n for(int i = 0; i < flag.length; i++){\n g.fillRect(flag[i].x, flag[i].y, flag[i].width, flag[i].height);\n }\n \n g.setColor(Color.white);\n for(int i = 0; i < flagLogo.length; i++){\n g.fillRect(flagLogo[i].x, flagLogo[i].y, flagLogo[i].width, flagLogo[i].height);\n }\n \n //g.setColor(Color.gray);\n // for(int i = 0; i < bombs.length; i++){\n // g.fillRect(bombs[i].x, bombs[i].y, bombs[i].width, bombs[i].height); \n //}\n \n \n // GAME DRAWING ENDS HERE\n }", "@Override\n public void paintComponent(Graphics g){\n super.paintComponent(g);\n if(ingame){\n\n int screenWidth = this.getWidth();\n int screenHeight = this.getHeight();\n\n\n for(int i = 0; i < end_positions.size(); i++){\n End_position item = end_positions.get(i);\n g.setColor(Color.green);\n g.fillRect(item.getDestinationX()*screenWidth/LEVEL_WIDTH,item.getDestinationY()*screenHeight/LEVEL_HEIGHT,item.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,item.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n }\n\n g.setColor(Color.white);\n g.fillRect(player.getCurrentX()*screenWidth/LEVEL_WIDTH,player.getCurrentY()*screenHeight/LEVEL_HEIGHT,player.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,player.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n\n\n for(int i = 0; i < boxes.size(); i++){\n Box item = boxes.get(i);\n g.setColor(Color.yellow);\n g.fillRect(item.getCurrentX()*screenWidth/LEVEL_WIDTH,item.getCurrentY()*screenHeight/LEVEL_HEIGHT,item.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,item.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n }\n for(int i = 0; i < walls.size(); i++){\n Wall item = walls.get(i);\n\n g.setColor(Color.red);\n g.fillRect(item.getDestinationX()*screenWidth/LEVEL_WIDTH,item.getDestinationY()*screenHeight/LEVEL_HEIGHT,item.getImage().getWidth(null)*screenWidth/LEVEL_WIDTH,item.getImage().getWidth(null)*screenHeight/LEVEL_HEIGHT);\n\n }\n\n }\n\n }", "public void paint() {\r\n\r\n\t\tsuper.paint();\r\n\t\r\n\t\tint len = _composites.size();\r\n\t\tfor (int i = 0; i < len; i++) {\r\n\t\t\tComposite c = _composites.get(i);\r\n\t\t\tc.paint();\r\n\t\t}\t\t\t\t\t\t\r\n\t}", "@Override\n public void paintComponent(Graphics gg){\n \tGraphics2D g = (Graphics2D) gg;\n \tg.setColor(new Color(0,0,0));\n \tg.fillRect(0, 0, width, height);\n \t/// Draw Functions ///\n \t//menus.drawMenus(g);\n \t/// Rest ///\n \tfor(PhysicsObject obj: objects){\n \t\tobj.drawSelf(g);\n \t}\n \tg.setColor(new Color(255,255,255));\n \tg.fillOval(mx-3, my-3, 5, 5);\n }", "@Override\n\tpublic void paintComponent(Graphics g)\n\t{\n\t\tsuper.paintComponent(g);\n\t\t//Draw the board and the table\n\t\tif (isTableVisible) {\n\t\t\tdrawBackground(this, g, gameInstance);\n\t\t}\n\n\t\tGraphics2D g2 = (Graphics2D)g;\n\t\tRenderingHints rh = new RenderingHints(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);\n\t\tg2.setRenderingHints(rh);\n\t\tg2.setTransform(boardToScreenTransformation);\n\t\tdrawPlayerIcons(this, g, gameInstance);\n\t\t//Draw all player related information\n\t\tdrawPlayerPositions(this, g, gameInstance, player, infoText);\n\n\t\t//Draw all objects not in some private area\n\t\tObjectFunctions.getDrawOrder(gameInstance, ial);\n\t\toiList.clear();\n\t\tgameInstance.getObjects(oiList);\n\t\tArrayList<ObjectInstance> drawableObjects = new ArrayList<>();\n\t\tCheckFunctions.drawableObjectsOnTable(oiList, drawableObjects);\n\t\tdrawableObjects.sort(ObjectFunctions.objectInstanceDrawValueComparator);\n\t\tial.clear();\n\t\tObjectFunctions.addObjectListToIdList(drawableObjects, ial);\n\t\tdrawObjectsFromList(this,g,gameInstance,player, ial);\n\n\t\t//Draw selection rectangle\n\t\tdrawSelection(this, g, player);\n\n\t\t//Draw Private Area\n\t\tif (!player.visitor) {\n\t\t\tdrawPrivateArea(this, g);\n\t\t}\n\n\n\t\tAffineTransform tmp = g2.getTransform();\n\t\tg2.setTransform(boardToScreenTransformation);\n\n\t\t//Redraw selected objects not in some private area\n\t\tial.clear();\n\t\tIntegerArrayList selectedObjects = new IntegerArrayList();\n\t\tObjectFunctions.getSelectedObjects(gameInstance, selectedObjects);\n\t\tfor (int id : selectedObjects){\n\t\t ial.addUnique(id);\n\t\t\tObjectFunctions.getAllAboveLyingObjects(gameInstance, player, gameInstance.getObjectInstanceById(id), ial2);\n ial.addUnique(ial2);\n\t\t}\n\t\tObjectFunctions.sortByDrawValue(gameInstance, ial);\n\t\t//ArrayUtil.unifySorted(ial);\n\t\tdrawObjectsFromList(this, g, gameInstance, player, ial, ial2);\n\n\n\t\t//Draw objects in private area\n\t\tif (!player.visitor && privateArea.zooming != 0) {\n\t\t\tdrawTokensInPrivateArea(this, g, gameInstance, player, hoveredObject);\n\t\t}\n\n\n\t\tg2.setTransform(tmp);\n\n\t\t//Draw debug informations\n\t\tif (isDebug) {\n\t\t\tDrawFunctions.drawDebugInfo(this, g2, gameInstance, player);\n\t\t}\n\t\tif (show_ping) {\n\t\t\tg2.drawString(\"Last Signal\", getWidth() - 100, 80);\n\t\t\tfor (int i = 0; i < gameInstance.getPlayerCount(); ++i)\n\t\t\t{\n\t\t\t\tPlayer pl = gameInstance.getPlayerByIndex(i);\n\t\t\t\tg2.drawString(pl.getName() + \" \" + ((System.nanoTime() - pl.lastReceivedSignal) / 100000000) / 10f, getWidth() - 100, 100 + 20 * i);\n\t\t\t}\n\t\t}\n\t}", "protected void paintComponent(Graphics g) {\n if (getModel().isArmed()) {\n g.setColor(Color.lightGray);\n } else {\n g.setColor(getBackground());\n }\n g.fillOval(0, 0, getSize().width-1, getSize().height-1);\n super.paintComponent(g);\n }", "protected void paintComponent(Graphics g) {\n if (getModel().isPressed()) {\n g.setColor(pressedBackgroundColor);\n } else if (getModel().isRollover()) {\n g.setColor(hoverBackgroundColor);\n } else {\n g.setColor(getBackground());\n }\n g.fillRect(0, 0, getWidth(), getHeight());\n super.paintComponent(g);\n }", "@Override\r\n\tpublic void drawBackground(Graphics g, ImageObserver observer) {\n\t\tfor (int i = 0; i < buttons.length; i++) {\r\n\t\t\tbuttons[i].drawBackground(g, observer);\r\n\t\t}\r\n\t\t\r\n\t\t// draw selected screen background\r\n\t\tthis.screens[this.selectedIndex].drawBackground(g, observer);\r\n\t}", "@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tsetBackground(color);\t\r\n\t\t\t\tvazioSouth.setBackground(color);\r\n\t\t\t\tvazioEast.setBackground(color);\r\n\t\t\t\tbtsPaintJPanel.setBackground(color);\r\n\t\t\t\tbotaoJPanel.setBackground(color);\r\n\t\t\t}", "private void renderUI()\n\t{\n\t\ttry\n\t\t{\n\t\t\tFile image = new File(BASE_DIREC + \"foreground.png\");\n\t\t\tforeground = ImageResizer.resizeImage(ImageIO.read(image), scale * BASE_SCALE);\n\t\t}\n\t\tcatch (IOException ioe)\n\t\t{\n\t\t\t// System.err.println(ioe);\n\t\t\t// Oh well\n\t\t}\n\t\t\n\t\ttry\n\t\t{\n\t\t\tFile image = new File(BASE_DIREC + \"continue.png\");\n\t\t\tcontinueImage = ImageResizer.resizeImage(ImageIO.read(image), scale * BASE_SCALE);\n\t\t}\n\t\tcatch (IOException ioe)\n\t\t{\n\t\t\t// System.err.println(ioe);\n\t\t\t// Oh well\n\t\t}\n\t}", "public void highlightEnable() {\n actualFillColor = new Color(0, 255, 0, 150);\n repaint();\n revalidate();\n }", "@Override\n public void paint(final Graphics g)\n {\n try\n {\n offScreenG.setColor(getBackground());\n offScreenG.fillRect(0, 0, getSize().width, getSize().height);\n\n if(offG == null)\n \toffG = offScreenG.create();\n\n if(backGround != null)\n {\n \t//System.out.println(\"drawing the loaded background image\");\n \toffG.drawImage(backGround, 0, 0, this);\n \tfinal int h = backGround.getHeight(this);\n \tfinal int w = backGround.getWidth(this);\n \toffG.setColor(Color.BLACK);\n \t//offG.drawRect(0, 0, w, h);\n }\n\n offScreenG.setColor(Color.BLACK);\n //offScreenG.drawRect(0, 0, this.getWidth()-1, this.getHeight()-1); //disable drawing of bounding box\n\n final Graphics2D g2 = (Graphics2D)offG;\n\t\t\tfinal Composite normC = g2.getComposite();\n\t\t\tg2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,(float)0.8));\n for(int i=0; i < associations.size(); i++)\n \tassociations.elementAt(i).render(offG);\n if(mpos != null && start != null)\n {\n \toffG.setColor(Color.DARK_GRAY);\n \tfinal Point rPoint = start.getPoint(mpos);\n \toffG.drawLine(rPoint.x, rPoint.y, mpos.x, mpos.y);\n \tif(retType.equals(\"pair\"))\n \t{\n \t\tdrawArrow(g2, mpos.x, mpos.y, rPoint.x, rPoint.y, 1);\n \t}\n \tdrawArrow(g2, rPoint.x, rPoint.y, mpos.x, mpos.y, 1);\n }\n\t\t\tif(hotspots != null)\n\t\t\t{\n\t\t\t\tfor(int i=0; i < hotspots.size(); i++)\n\t\t\t\t\thotspots.elementAt(i).render(g2);\n\t\t\t}\n\n\t\t\tif(movableObjects != null)\n\t\t\t{\n\t\t\t\tfor(int i=0; i < movableObjects.size(); i++)\n\t\t\t\t{\n\t\t\t\t\tmovableObjects.elementAt(i).render2(g2);\n\t\t\t\t}\n\t\t\t}\n g2.setComposite(normC);\n if(drawHSLabel != null)\n {\n \tif(drawHSLabel.hotSpotLabel != null && !drawHSLabel.hotSpotLabel.equals(\"\"))\n \t{\n\n \t\tfinal Rectangle2D bounds = (new TextLayout(drawHSLabel.hotSpotLabel,g2.getFont(),g2.getFontRenderContext())).getBounds();\n \t\tg2.setColor(Color.YELLOW);\n \t\tg2.fillRect(mpos.x, mpos.y-((int)bounds.getHeight()+4), (int)bounds.getWidth()+10, (int)bounds.getHeight()+8);\n \t\tg2.setColor(Color.BLACK);\n \t\tg2.drawRect(mpos.x, mpos.y-((int)bounds.getHeight()+4), (int)bounds.getWidth()+10, (int)bounds.getHeight()+8);\n \t\tg2.drawString(drawHSLabel.hotSpotLabel, mpos.x+5, mpos.y);\n \t}\n }\n\n g.drawImage(offScreenImg, 0, 0, this);\n\n if (om.equals(\"figure_placement_interaction\")) {\n for (int h=0; h < hotspots.size(); h++) {\n //g.drawRect(hotspots.elementAt(h).coords[0],hotspots.elementAt(h).coords[1],hotspots.elementAt(h).coords[2],hotspots.elementAt(h).coords[3]);\n }\n }\n }\n catch(final Exception exception)\n {\n \texception.printStackTrace();\n }\n }", "public DrawGraphics() {\r\n box = new BouncingBox(200, 50, Color.RED);\r\n\tbox.setMovementVector(1,1);\r\n\r\n\tboxes = new ArrayList<BouncingBox>();\r\n\tboxes.add(new BouncingBox(35,40, Color.BLUE));\r\n\tboxes.get(0).setMovementVector(2,-1);\r\n\tboxes.add(new BouncingBox(120,80, Color.GREEN));\r\n\tboxes.get(1).setMovementVector(-1,2);\r\n\tboxes.add(new BouncingBox(500,80, Color.PINK));\r\n\tboxes.get(2).setMovementVector(-2,-2);\r\n }", "@Override\n\t\t\tpublic void paintControl(PaintEvent arg0) {\n\t\t\t\tgc.drawImage(background,0,0);\n\t\t\t}", "void effacer() {\r\n Graphics g = this.zoneDessin.getGraphics();\r\n g.setColor(Color.gray);\r\n g.fillRect(0, 0, this.getWidth(), this.getHeight());\r\n }", "private void decorate() {\n setBorderPainted(false);\n setOpaque(true);\n \n setContentAreaFilled(false);\n setMargin(new Insets(1, 1, 1, 1));\n }", "public void paintImmediately() {\n apparatusPanel2.paintDirtyRectanglesImmediately();\n }", "public void display ( GameObject obj ) {\n Screen tempScreen = Screen.getScreen();\n\n // I could script this! Quickly change the colors\n\n tempScreen.fill(color); //set color\n\n\n tempScreen.noStroke(); //no stroke\n tempScreen.rect(obj.x, obj.y, obj.width, obj.height); //make a rectangle\n }", "@Override\n public void drawScreen(int n, int n2) {\n void mouseY;\n void mouseX;\n super.drawScreen((int)mouseX, (int)mouseY);\n float[] hsb = Color.RGBtoHSB(this.setting.getValue().getRed(), this.setting.getValue().getGreen(), this.setting.getValue().getBlue(), null);\n Color color = Color.getHSBColor(hsb[0], Float.intBitsToFloat(Float.floatToIntBits(6.4887953f) ^ 0x7F4FA436), Float.intBitsToFloat(Float.floatToIntBits(4.629535f) ^ 0x7F142527));\n Gui.drawRect((int)this.getX(), (int)this.getY(), (int)(this.getX() + this.getWidth()), (int)(this.getY() + 14), (int)new Color(40, 40, 40).getRGB());\n Gui.drawRect((int)(this.getX() + this.getWidth() - 12), (int)(this.getY() + 2), (int)(this.getX() + this.getWidth() - 2), (int)(this.getY() + 12), (int)this.setting.getValue().getRGB());\n RenderUtils.drawOutline(this.getX() + this.getWidth() - 12, this.getY() + 2, this.getX() + this.getWidth() - 2, this.getY() + 12, Float.intBitsToFloat(Float.floatToIntBits(2.7144578f) ^ 0x7F2DB9AD), new Color(20, 20, 20).getRGB());\n if (this.open) {\n Gui.drawRect((int)this.getX(), (int)(this.getY() + 14), (int)(this.getX() + this.getWidth()), (int)(this.getY() + 28), (int)new Color(40, 40, 40).getRGB());\n float i = Float.intBitsToFloat(Float.floatToIntBits(1.3378998E38f) ^ 0x7EC94E07);\n while (i + Float.intBitsToFloat(Float.floatToIntBits(13.8331995f) ^ 0x7EDD54C9) < Float.intBitsToFloat(Float.floatToIntBits(0.07128618f) ^ 0x7F51FE7D)) {\n RenderUtils.drawRecta((float)(this.getX() + 2) + i, this.getY() + 16, Float.intBitsToFloat(Float.floatToIntBits(7.249331f) ^ 0x7F67FA85), Float.intBitsToFloat(Float.floatToIntBits(1.7045807f) ^ 0x7EEA2FB3), Color.getHSBColor(i / Float.intBitsToFloat(Float.floatToIntBits(0.115068644f) ^ 0x7F2BA91C), Float.intBitsToFloat(Float.floatToIntBits(4.3161592f) ^ 0x7F0A1DFA), Float.intBitsToFloat(Float.floatToIntBits(21.075346f) ^ 0x7E289A4F)).getRGB());\n i += Float.intBitsToFloat(Float.floatToIntBits(3.807338f) ^ 0x7E95CD0B);\n }\n RenderUtils.drawOutline(this.getX() + 2, this.getY() + 16, this.getX() + 2 + this.getWidth() - 4, this.getY() + 27, Float.intBitsToFloat(Float.floatToIntBits(2.7503529f) ^ 0x7F3005C8), new Color(0, 0, 0).getRGB());\n RenderUtils.drawRecta((float)(this.getX() + 2) + this.hueWidth, this.getY() + 16, Float.intBitsToFloat(Float.floatToIntBits(5.200255f) ^ 0x7F26687D), Float.intBitsToFloat(Float.floatToIntBits(1.2665411f) ^ 0x7E921E05), new Color(255, 255, 255).getRGB());\n Gui.drawRect((int)this.getX(), (int)(this.getY() + 28), (int)(this.getX() + this.getWidth()), (int)(this.getY() + 42), (int)new Color(40, 40, 40).getRGB());\n RenderUtils.drawSidewaysGradient(this.getX() + 2, this.getY() + 29, this.getWidth() - 4, Float.intBitsToFloat(Float.floatToIntBits(0.19645536f) ^ 0x7F792B98), new Color(255, 255, 255), color, 255, 255);\n RenderUtils.drawOutline(this.getX() + 2, this.getY() + 29, this.getX() + 2 + this.getWidth() - 4, this.getY() + 40, Float.intBitsToFloat(Float.floatToIntBits(103.69628f) ^ 0x7DCF647F), new Color(0, 0, 0).getRGB());\n RenderUtils.drawRecta((float)(this.getX() + 2) + this.satWidth, this.getY() + 29, Float.intBitsToFloat(Float.floatToIntBits(7.3489017f) ^ 0x7F6B2A34), Float.intBitsToFloat(Float.floatToIntBits(0.1948352f) ^ 0x7F7782E1), new Color(255, 255, 255).getRGB());\n Gui.drawRect((int)this.getX(), (int)(this.getY() + 42), (int)(this.getX() + this.getWidth()), (int)(this.getY() + 56), (int)new Color(40, 40, 40).getRGB());\n RenderUtils.drawSidewaysGradient(this.getX() + 2, this.getY() + 42, this.getWidth() - 4, Float.intBitsToFloat(Float.floatToIntBits(1.5246161f) ^ 0x7EF3269F), new Color(0, 0, 0), color, 255, 255);\n RenderUtils.drawOutline(this.getX() + 2, this.getY() + 42, this.getX() + 2 + this.getWidth() - 4, this.getY() + 53, Float.intBitsToFloat(Float.floatToIntBits(3.7803736f) ^ 0x7F71F1A4), new Color(0, 0, 0).getRGB());\n RenderUtils.drawRecta((float)(this.getX() + 2) + this.briWidth, this.getY() + 42, Float.intBitsToFloat(Float.floatToIntBits(8.346171f) ^ 0x7E8589EB), Float.intBitsToFloat(Float.floatToIntBits(0.08925866f) ^ 0x7C86CD3F), new Color(255, 255, 255).getRGB());\n Gui.drawRect((int)this.getX(), (int)(this.getY() + 56), (int)(this.getX() + this.getWidth()), (int)(this.getY() + 70), (int)new Color(40, 40, 40).getRGB());\n this.renderAlphaBG(this.getX() + 2, this.getY() + 55, this.alphaBG);\n RenderUtils.drawSidewaysGradient(this.getX() + 2, this.getY() + 55, this.getWidth() - 4, Float.intBitsToFloat(Float.floatToIntBits(0.13166903f) ^ 0x7F36D43F), new Color(0, 0, 0), color, 0, 255);\n RenderUtils.drawOutline(this.getX() + 2, this.getY() + 55, this.getX() + 2 + this.getWidth() - 4, this.getY() + 66, Float.intBitsToFloat(Float.floatToIntBits(19.69502f) ^ 0x7E9D8F67), new Color(0, 0, 0).getRGB());\n RenderUtils.drawRecta((float)(this.getX() + 2) + this.alphaWidth, this.getY() + 55, Float.intBitsToFloat(Float.floatToIntBits(6.702013f) ^ 0x7F5676E4), Float.intBitsToFloat(Float.floatToIntBits(0.13652846f) ^ 0x7F3BCE1E), new Color(255, 255, 255).getRGB());\n Gui.drawRect((int)this.getX(), (int)(this.getY() + 70), (int)(this.getX() + this.getWidth()), (int)(this.getY() + 84), (int)new Color(40, 40, 40).getRGB());\n Europa.FONT_MANAGER.drawString(\"Rainbow\", this.getX() + 3, (float)(this.getY() + 78) - Europa.FONT_MANAGER.getHeight() / Float.intBitsToFloat(Float.floatToIntBits(0.8730777f) ^ 0x7F5F8205), Color.WHITE);\n Gui.drawRect((int)(this.getX() + this.getWidth() - 12), (int)(this.getY() + 72), (int)(this.getX() + this.getWidth() - 2), (int)(this.getY() + 82), (int)new Color(30, 30, 30).getRGB());\n if (this.setting.getRainbow().booleanValue()) {\n RenderUtils.prepareGL();\n GL11.glShadeModel((int)7425);\n GL11.glEnable((int)2848);\n GL11.glLineWidth((float)Float.intBitsToFloat(Float.floatToIntBits(0.2713932f) ^ 0x7EAAF40D));\n GL11.glBegin((int)1);\n GL11.glColor3f((float)((float)ModuleColor.getActualColor().getRed() / Float.intBitsToFloat(Float.floatToIntBits(0.015137452f) ^ 0x7F070313)), (float)((float)ModuleColor.getActualColor().getGreen() / Float.intBitsToFloat(Float.floatToIntBits(1.1948546f) ^ 0x7CE7F0FF)), (float)((float)ModuleColor.getActualColor().getBlue() / Float.intBitsToFloat(Float.floatToIntBits(0.36357376f) ^ 0x7DC52657)));\n GL11.glVertex2d((double)(this.getX() + this.getWidth() - 8), (double)(this.getY() + 80));\n GL11.glColor3f((float)((float)ModuleColor.getActualColor().getRed() / Float.intBitsToFloat(Float.floatToIntBits(0.015521388f) ^ 0x7F014D6B)), (float)((float)ModuleColor.getActualColor().getGreen() / Float.intBitsToFloat(Float.floatToIntBits(0.01025841f) ^ 0x7F5712E4)), (float)((float)ModuleColor.getActualColor().getBlue() / Float.intBitsToFloat(Float.floatToIntBits(0.10675689f) ^ 0x7EA5A35B)));\n GL11.glVertex2d((double)(this.getX() + this.getWidth() - 8 + 4), (double)(this.getY() + 74));\n GL11.glEnd();\n GL11.glBegin((int)1);\n GL11.glColor3f((float)((float)ModuleColor.getActualColor().getRed() / Float.intBitsToFloat(Float.floatToIntBits(0.009417259f) ^ 0x7F654AD9)), (float)((float)ModuleColor.getActualColor().getGreen() / Float.intBitsToFloat(Float.floatToIntBits(0.07014828f) ^ 0x7EF0A9E7)), (float)((float)ModuleColor.getActualColor().getBlue() / Float.intBitsToFloat(Float.floatToIntBits(0.013465701f) ^ 0x7F239F3E)));\n GL11.glVertex2d((double)(this.getX() + this.getWidth() - 8), (double)(this.getY() + 80));\n GL11.glColor3f((float)((float)ModuleColor.getActualColor().getRed() / Float.intBitsToFloat(Float.floatToIntBits(0.0155056f) ^ 0x7F010B33)), (float)((float)ModuleColor.getActualColor().getGreen() / Float.intBitsToFloat(Float.floatToIntBits(0.011914493f) ^ 0x7F3C3501)), (float)((float)ModuleColor.getActualColor().getBlue() / Float.intBitsToFloat(Float.floatToIntBits(0.012230922f) ^ 0x7F376434)));\n GL11.glVertex2d((double)(this.getX() + this.getWidth() - 10), (double)(this.getY() + 77));\n GL11.glEnd();\n RenderUtils.releaseGL();\n }\n }\n Gui.drawRect((int)(this.getX() - 1), (int)this.getY(), (int)this.getX(), (int)(this.getY() + 84), (int)new Color(30, 30, 30).getRGB());\n Gui.drawRect((int)(this.getX() + this.getWidth()), (int)this.getY(), (int)(this.getX() + this.getWidth() + 1), (int)(this.getY() + 84), (int)new Color(30, 30, 30).getRGB());\n Europa.FONT_MANAGER.drawString(this.setting.getName(), this.getX() + 3, this.getY() + 3, Color.WHITE);\n }", "public void repaint() {\n setBackground(Color.white);\n super.repaint();\n setVisible(true);\n\n }", "@Override\n public void paint(Graphics g) {\n g2 = (Graphics2D) g;\n drawBackground();\n drawSquares();\n drawLines();\n gui.hint = new TreeSet<>();\n }", "public void setForegroundColor(Color foreground)\n {\n foregroundColor = foreground;\n paintAllObjects();\n }", "protected void paintComponent(Graphics g) {\n\t\t\tif (getModel().isArmed()) {\r\n\t\t\t\tg.setColor(Color.lightGray);\r\n\t\t\t} else {\r\n\t\t\t\tg.setColor(getBackground());\r\n\t\t\t}\r\n\r\n\t\t\tg.fillOval(0, 0, getSize().width - 1, getSize().height - 1);\r\n\r\n\t\t\tsuper.paintComponent(g);\r\n\t\t}", "@Override\n protected void paintForeground(Graphics2D g) {\n g.setColor(Color.MAGENTA);\n g.setFont(new Font(\"Calibri\", Font.BOLD,20));\n g.drawString(\"Villain Carnage\",5,30);\n g.setFont(new Font(\"Calibri\", Font.BOLD, 15));\n g.drawString((\"Level 1\"),20,60);\n \n \n \n //g.drawImage(ballIcon, 2,2, this);\n \n g.drawString(\"Ball Count :\" + villain.getBallCount(), 20,120 );\n \n //g.drawImage(heartIcon, 20,40, this);\n g.drawString(\"Lives left : \" + villain.getLives(),20,150);\n \n // Sets all the appropriate GUI components for this level, including ball count and \n // lives count which will be incremented/decremented as the player collides with it's\n // respective object\n \n }", "public void setBlackAndWhite()\n {\n if (wall != null) // only if it's painted already...\n {\n wall.changeColor(\"black\");\n window.changeColor(\"white\");\n roof.changeColor(\"black\");\n sun.changeColor(\"black\");\n }\n }", "@Override\n\tpublic void drawForeground(Canvas canvas, int width, int height) {\n\t\t\n\t}", "@Override\r\n\tprotected void draw() {\n\t\tgoodCabbage = new Oval(center.x - CABBAGE_RADIUS, center.y\r\n\t\t\t\t- CABBAGE_RADIUS, 2 * CABBAGE_RADIUS, 2 * CABBAGE_RADIUS,\r\n\t\t\t\tColor.red, true);\r\n\t\twindow.add(goodCabbage);\r\n\t}", "public void setBlackAndWhite()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"black\");\n window.changeColor(\"white\");\n roof.changeColor(\"black\");\n sun.changeColor(\"black\");\n }\n }", "public void setBlackAndWhite()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"black\");\n window.changeColor(\"white\");\n roof.changeColor(\"black\");\n sun.changeColor(\"black\");\n }\n }", "public void paintComponenet(){\r\n\t\tfor(DShape ds : shapes){\r\n\t\t\tds.draw();\r\n\t\t}\r\n\t}", "@Override\n protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {\n }", "public void paintComponent (Graphics g){\r\n\t\tsuper.paintComponent(g);\r\n\t\t//MAIN MENU SCREEN (RULES)\r\n\t\tif (screen == 0) {\r\n\t\t\tg.clearRect (0, 0, this.getWidth (), this.getHeight ());\r\n\t\t\tg.setColor((Color.BLACK));\r\n\t\t\tg.fillRect(0, 0, this.getWidth(), this.getHeight());\r\n\t\t\tg.drawImage(rulesImage, 185, 10, this);\r\n\t\t\tg.setFont (ARIAL_BOLD);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"A game of memory skill!\",150,245);\r\n\t\t\tg.setFont (ARIAL_TEXT);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"The game will show you a colour pattern.\", 160, 270);\r\n\t\t\tg.drawString(\"Remember which colours were lit up. Once the \", 140, 300); \r\n\t\t\tg.drawString(\"pattern is finished, repeat it to pass to the next level.\", 130, 330);\r\n\t\t\tg.setFont (ARIAL_BOLD);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"PLAY\", 250, 390);\t\r\n\t\t}\r\n\t\t//ORIGINAL COLOURS\r\n\t\telse if (screen == 1){\r\n\t\t\t//Draws Game Titles (Text)\r\n\t\t\tg.drawImage (logoImage, 5, 30, this);\r\n\t\t\tg.setFont (ARIAL_BOLD);\r\n//\t\t\tg.setColor(Color.WHITE);\r\n//\t\t\tString scoreTitle = \"Score: \" + score;\r\n//\t\t\tString highestTitle = \"Highest: \" + highest;\r\n//\t\t\tg.drawString(scoreTitle, 420, 50);\r\n//\t\t\tg.drawString(highestTitle, 420, 80);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"Press to Start\", 12, 100);\r\n\t\t\t\r\n\t\t\t//Draws Colours \r\n\t\t\tg.setColor(REDFADE);\r\n\t\t\tg.fillArc(160, 100, 300, 300, 0, 90);\r\n\t\t\tg.setColor(GREENFADE);\r\n\t\t\tg.fillArc(150, 100, 300, 300, 90, 90);\r\n\t\t\tg.setColor(YELLOWFADE);\r\n\t\t\tg.fillArc(150, 110, 300, 300, 180, 90);\r\n\t\t\tg.setColor(BLUEFADE);\r\n\t\t\tg.fillArc(160, 110, 300, 300, 270, 90);\r\n\t\t}\r\n\t\t//MONOCHROMATIC COLOURS\r\n\t\telse if (screen == 2){\r\n\t\t\t//Draws Game Titles (Text)\r\n\t\t\tg.drawImage (logoImage, 5, 30, this);\r\n\t\t\tg.setFont (ARIAL_BOLD);\r\n//\t\t\tg.setColor(Color.WHITE);\r\n//\t\t\tString scoreTitle = \"Score: \" + score;\r\n//\t\t\tString highestTitle = \"Highest: \" + highest;\r\n//\t\t\tg.drawString(scoreTitle, 420, 50);\r\n//\t\t\tg.drawString(highestTitle, 420, 80);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"Press to Start\", 12, 100);\r\n\t\t\t\r\n\t\t\t//Draws Colours\r\n\t\t\tg.setColor(PURPLE_1);\r\n\t\t\tg.fillArc(160, 100, 300, 300, 0, 90);\r\n\t\t\tg.setColor(PURPLE_2);\r\n\t\t\tg.fillArc(150, 100, 300, 300, 90, 90);\r\n\t\t\tg.setColor(PURPLE_3);\r\n\t\t\tg.fillArc(150, 110, 300, 300, 180, 90);\r\n\t\t\tg.setColor(PURPLE_4);\r\n\t\t\tg.fillArc(160, 110, 300, 300, 270, 90);\r\n\t\t}\r\n\t\t//TROPICAL COLOURS\r\n\t\telse if (screen == 3){\r\n\t\t\t//Draws Game Titles (Text)\r\n\t\t\tg.drawImage (logoImage, 5, 30, this);\r\n\t\t\tg.setFont (ARIAL_BOLD);\r\n//\t\t\tg.setColor(Color.WHITE);\r\n//\t\t\tString scoreTitle = \"Score: \" + score;\r\n//\t\t\tString highestTitle = \"Highest: \" + highest;\r\n//\t\t\tg.drawString(scoreTitle, 420, 50);\r\n//\t\t\tg.drawString(highestTitle, 420, 80);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"Press to Start\", 12, 100);\r\n\t\t\t\r\n\t\t\t//Draws Colours\r\n\t\t\tg.setColor(PINK_TROP);\r\n\t\t\tg.fillArc(160, 100, 300, 300, 0, 90);\r\n\t\t\tg.setColor(GREEN_TROP);\r\n\t\t\tg.fillArc(150, 100, 300, 300, 90, 90);\r\n\t\t\tg.setColor(ORANGE_TROP);\r\n\t\t\tg.fillArc(150, 110, 300, 300, 180, 90);\r\n\t\t\tg.setColor(BLUE_TROP);\r\n\t\t\tg.fillArc(160, 110, 300, 300, 270, 90);\r\n\t\t}\r\n\t\t//GAME OVER\r\n\t\telse if (screen == 4){\r\n\t\t\tg.drawImage (gameoverImage, 40, 50, this);\r\n\t\t\tg.setFont(ARIAL_BOLD);\r\n\t\t\tg.setColor(Color.YELLOW);\r\n\t\t\tg.drawString(\"BETTER LUCK NEXT TIME\", 135, 270);\r\n\t\t\tString scoreTitle = \"Your Score: \" + score;\r\n\t\t\tString highestTitle = \"Highest Score: \" + highest;\r\n\t\t\tg.drawString(scoreTitle, 200, 300);\r\n\t\t\tg.drawString(highestTitle, 180, 330);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tg.drawString(\"PLAY\", 250, 390);\r\n\t\t}\r\n\t\t//YOU WIN\r\n\t\telse if (screen == 5){\r\n\t\t\tg.drawImage (winnerImage, 0, 0, this);\r\n\t\t\tg.setFont(ARIAL_BOLD);\r\n\t\t\tg.setColor(Color.WHITE);\r\n\t\t\tString scoreTitle = \"Your Score: \" + score;\r\n\t\t\tString highestTitle = \"Highest Score: \" + highest;\r\n\t\t\tg.drawString(scoreTitle, 205, 330);\r\n\t\t\tg.drawString(highestTitle, 185, 360);\r\n\t\t\tg.drawString(\"PLAY\", 250, 390);\r\n\t\t}\r\n\r\n\t}", "protected void doBright() {\r\n\t\talpha = 1.0f;\r\n\t\tsetAlphaOnTiles();\r\n\t\trepaint();\r\n\t}", "@Override\n\tpublic void render(int x, int y, float f) {\n\t\tPair<Integer, Integer> adjustedValueCoords = this.getAdjustedXYValue();\n\t\tint grayBoxX = adjustedValueCoords.getKey();\n\t\tint grayBoxY = adjustedValueCoords.getValue();\n\n\t\tthis.Tabs.x = adjustedValueCoords.getKey();\n\t\tthis.Tabs.y = adjustedValueCoords.getValue() - 21;\n\n\t\tthis.renderBackground();\n\n\t\t// Draw the control background.\n\t\tassert this.minecraft != null;\n\t\tthis.minecraft.getTextureManager().bindTexture(backgroundTextures);\n\t\tthis.blit(grayBoxX, grayBoxY, 0, 0, 256, 256);\n\n\t\tfor (Widget button : this.buttons) {\n\t\t\t// Make all buttons invisible.\n\t\t\tif (button != this.btnCancel && button != this.btnBuild) {\n\t\t\t\tbutton.visible = false;\n\t\t\t}\n\t\t}\n\n\t\tthis.btnAddTorches.visible = false;\n\t\tthis.btnAddBed.visible = false;\n\t\tthis.btnAddChest.visible = false;\n\t\tthis.btnAddChestContents.visible = false;\n\t\tthis.btnAddCraftingTable.visible = false;\n\t\tthis.btnAddFurnace.visible = false;\n\t\tthis.btnAddMineShaft.visible = false;\n\n\t\t// Update visibility on controls based on the selected tab.\n\t\tif (this.getSelectedTab() == this.tabGeneral) {\n\t\t\tthis.btnHouseStyle.visible = true;\n\t\t\tthis.btnVisualize.visible = true;\n\t\t} else if (this.getSelectedTab() == this.tabConfig) {\n\t\t\tthis.btnAddTorches.visible = this.serverConfiguration.addTorches;\n\t\t\tthis.btnAddBed.visible = this.serverConfiguration.addBed;\n\t\t\tthis.btnAddChest.visible = this.serverConfiguration.addChests;\n\t\t\tthis.btnAddChestContents.visible = this.allowItemsInChestAndFurnace && this.serverConfiguration.addChestContents;\n\t\t\tthis.btnAddCraftingTable.visible = this.serverConfiguration.addCraftingTable;\n\t\t\tthis.btnAddFurnace.visible = this.serverConfiguration.addFurnace;\n\t\t\tthis.btnAddMineShaft.visible = this.serverConfiguration.addMineshaft;\n\n\t\t} else if (this.getSelectedTab() == this.tabBlockTypes) {\n\t\t\tthis.btnGlassColor.visible = this.houseConfiguration.houseStyle != HouseStyle.SNOWY\n\t\t\t\t\t&& this.houseConfiguration.houseStyle != HouseStyle.DESERT;\n\t\t}\n\n\t\t// Draw the buttons, labels and tabs.\n\t\tsuper.render(x, y, f);\n\n\t\t// Draw the text here.\n\t\tint color = Color.DARK_GRAY.getRGB();\n\n\t\t// Draw the appropriate text based on the selected tab.\n\t\tif (this.getSelectedTab() == this.tabGeneral) {\n\t\t\tthis.minecraft.fontRenderer.drawString(GuiLangKeys.translateString(GuiLangKeys.STARTER_HOUSE_STYLE), grayBoxX + 10, grayBoxY + 10, color);\n\t\t\tthis.minecraft.fontRenderer.drawSplitString(this.houseConfiguration.houseStyle.getHouseNotes(), grayBoxX + 147, grayBoxY + 10, 95, color);\n\n\t\t\tthis.minecraft.getTextureManager().bindTexture(this.houseConfiguration.houseStyle.getHousePicture());\n\t\t\tGuiTabScreen.drawModalRectWithCustomSizedTexture(grayBoxX + 250, grayBoxY, 1,\n\t\t\t\t\tthis.houseConfiguration.houseStyle.getImageWidth(), this.houseConfiguration.houseStyle.getImageHeight(),\n\t\t\t\t\tthis.houseConfiguration.houseStyle.getImageWidth(), this.houseConfiguration.houseStyle.getImageHeight());\n\t\t} else if (this.getSelectedTab() == this.tabBlockTypes) {\n\t\t\tif (this.houseConfiguration.houseStyle == HouseConfiguration.HouseStyle.SNOWY\n\t\t\t\t\t|| this.houseConfiguration.houseStyle == HouseConfiguration.HouseStyle.DESERT) {\n\n\t\t\t} else {\n\t\t\t\t// Column 1:\n\t\t\t\tthis.minecraft.fontRenderer.drawString(GuiLangKeys.translateString(GuiLangKeys.GUI_STRUCTURE_GLASS), grayBoxX + 10, grayBoxY + 10, color);\n\t\t\t}\n\t\t}\n\n\t\tif (!CommonProxy.proxyConfiguration.serverConfiguration.enableStructurePreview) {\n\t\t\tthis.btnVisualize.visible = false;\n\t\t}\n\t}", "public void paint() {\r\n\t\tBufferStrategy bf = base.frame.getBufferStrategy();\r\n\t\ttry {\r\n\t\t\tg = bf.getDrawGraphics();\r\n\t\t\tg.clearRect(0, 0, 1024, 768);\r\n\t\t\tg.setFont(normal);\r\n\t\t\tif (gameState == 1) {\r\n\t\t\t\tg.drawImage(playButton, playButtonXM, playButtonYM, playButtonWidthM, playButtonHeightM, this);\t\t\t\t\r\n\t\t\t}else if (gameState == 3){\r\n\t\t\t\tint weaponPosX = ((arrow2X-arrowX) /2) + arrowX - 20;\r\n\t\t\t\tint weaponPosY = arrowY - 15;\r\n\t\t\t\tg.drawImage(Arrow, arrowX, arrowY, arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrow2X, arrowY, -arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrowX, arrowY2ndRow, arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrow2X, arrowY2ndRow, -arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrowX, arrowY3rdRow, arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrow2X, arrowY3rdRow, -arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrowX, arrowY4thRow, arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(Arrow, arrow2X, arrowY4thRow, -arrowWidth, arrowHeight, this);\r\n\t\t\t\tg.drawImage(playButton, playButtonX, playButtonY, playButtonWidth, playButtonHeight, this);\r\n\r\n\t\t\t\t//text boxes above choices\r\n\t\t\t\tg.setColor(Color.black);\r\n\t\t\t\tg.drawString(\"Weapon\", weaponPosX, weaponPosY);\r\n\t\t\t\tg.drawString(\"Difficulty\", weaponPosX, (arrowY2ndRow - 15));\r\n\t\t\t\tg.drawString(\"Number of AI\", weaponPosX - 12, (arrowY3rdRow - 15));\r\n\t\t\t\tg.drawString(\"Number of players\", weaponPosX - 20, (arrowY4thRow - 15));\r\n\r\n\t\t\t\tif (getDifficulty() == 1){\r\n\t\t\t\t\tg.drawImage(Easy, difficultyXPos, arrowY2ndRow, difficultyWidth , arrowHeight, this);\r\n\t\t\t\t}else if (getDifficulty() == 2) {\r\n\t\t\t\t\tg.drawImage(Normal, difficultyXPos, arrowY2ndRow, difficultyWidth, arrowHeight, this);\r\n\t\t\t\t}else {\r\n\t\t\t\t\tg.drawImage(Hard, difficultyXPos, arrowY2ndRow, difficultyWidth, arrowHeight, this);\r\n\t\t\t\t}\r\n\t\t\t\tif (getAttackStyle() == 2) {\r\n\t\t\t\t\tg.drawImage(Arrowr, weaponPosX -85, weaponPosY + 15, (arrow2X - arrowX) - 280, arrowHeight, this);\r\n\t\t\t\t}else {\r\n\t\t\t\t\t//due to the sword using all of the x positions the width is slightly different\r\n\t\t\t\t\tg.drawImage(SwordL, weaponPosX -85, weaponPosY + 15, (arrow2X - arrowX) - 300, arrowHeight, this);\r\n\t\t\t\t}\r\n\t\t\t\tint AIXPos = weaponPosX;\r\n\t\t\t\tif (AINum >= 10 && AINum<100) {\r\n\t\t\t\t\tAIXPos -=25;\r\n\t\t\t\t} else if (AINum >= 100 && AINum < 1000) {\r\n\t\t\t\t\t//the reason why this grows by 40 instead of an additional 20 is because we are not storing the variable\r\n\t\t\t\t\t//of current position anywhere so we just add another 20 onto the decrease\r\n\t\t\t\t\tAIXPos-=50;\r\n\t\t\t\t} else if (AINum >= 1000) {\r\n\t\t\t\t\tAIXPos-=75;\r\n\t\t\t\t}\r\n\t\t\t\tg.setFont(numbers);\r\n\t\t\t\tString currentNum = Integer.toString(AINum);\r\n\t\t\t\tString currentPlayerString = Integer.toString(currentPlayer);\r\n\t\t\t\tg.drawString(currentNum, AIXPos, arrowY3rdRow + 72);\r\n\t\t\t\tg.drawString(currentPlayerString, weaponPosX, arrowY4thRow + 72);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif ((!escape) && (!dead) &&(!allAIDead)) {\r\n\t\t\t\t\tg.drawImage(picture, 0, 0, base.frame.getWidth(), base.frame.getHeight(), this);\r\n\t\t\t\t\tfor (int i = 0; i < playerObject.length; i++) {\r\n\t\t\t\t\t\tint playerX = (int) playerObject[i].getX();\r\n\t\t\t\t\t\tint playerY = (int) playerObject[i].getY();\r\n\t\t\t\t\t\tg.setColor(Color.darkGray);\r\n\t\t\t\t\t\t// health bar\r\n\t\t\t\t\t\tg.fillRect(playerX, playerY - 30, 100, healthY);\r\n\t\t\t\t\t\tg.setColor(Color.red);\r\n\t\t\t\t\t\tg.fillOval(playerX, playerY, 20, 20);\r\n\t\t\t\t\t\tg.fillRect(playerX, playerY - 30, (int) (playerObject[i].getHealth()/2) , healthY);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//AI\r\n\t\t\t\t\tfor (int i = 0; i < AIObject.length; i++) {\r\n\t\t\t\t\t\tif (!AIObject[i].isDead()) {\r\n\t\t\t\t\t\t\tint AIRoundedX = (int) AIObject[i].getAIX();\r\n\t\t\t\t\t\t\tint AIRoundedY = (int) AIObject[i].getAIY();\r\n\t\t\t\t\t\t\tif (AIObject[i].getColor() == null) {\r\n\t\t\t\t\t\t\t\tint red = generator.nextInt(256);\r\n\t\t\t\t\t\t\t\tint green = generator.nextInt(256);\r\n\t\t\t\t\t\t\t\tint blue = generator.nextInt(256);\r\n\t\t\t\t\t\t\t\tColor newColor = new Color(red,green,blue);\r\n\t\t\t\t\t\t\t\tg.setColor(newColor);\r\n\t\t\t\t\t\t\t\tAIObject[i].setColor(newColor);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tg.setColor(AIObject[i].getColor());\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tg.fillOval(AIRoundedX, AIRoundedY, 20, 20);\r\n\t\t\t\t\t\t\tAIDeadCount = 0;\r\n\t\t\t\t\t\t\tg.setColor(Color.darkGray);\r\n\t\t\t\t\t\t\tg.fillRect(AIRoundedX, AIRoundedY - 40, AI_ORIG_HEALTH/AI_HEALTH_WIDTH_SCALE, healthY);\r\n\t\t\t\t\t\t\tg.setColor(AIObject[i].getColor());\r\n\t\t\t\t\t\t\tg.fillRect(AIRoundedX, AIRoundedY - 40, (int) AIObject[i].getAIHealth()/AI_HEALTH_WIDTH_SCALE, healthY);\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tAIDeadCount++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// early access banner\r\n\t\t\t\t\tg.drawImage(earlyAccess, 0, 24, this);\r\n\r\n\t\t\t\t\tif (attackStyle == 2) {\r\n\t\t\t\t\t\tif (drawArrow == true) {\r\n\t\t\t\t\t\t\tinFlight = true;\r\n\t\t\t\t\t\t\tshouldPlaySound = true;\r\n\t\t\t\t\t\t\tif ((fireLeft) && (currentlyDrawingArrow != 2)) {\r\n\t\t\t\t\t\t\t\tgoingLeft = true;\r\n\t\t\t\t\t\t\t\tgoingRight = false;\r\n\t\t\t\t\t\t\t\tcurrentlyDrawingArrow = 1;\r\n\t\t\t\t\t\t\t\tg.drawImage(Arrowl, Math.round(aX), Math.round(aY), this);\r\n\r\n\t\t\t\t\t\t\t} else if ((fireRight) && (currentlyDrawingArrow != 1)) {\r\n\t\t\t\t\t\t\t\tgoingRight = true;\r\n\t\t\t\t\t\t\t\tgoingLeft = false;\r\n\t\t\t\t\t\t\t\tcurrentlyDrawingArrow = 2;\r\n\t\t\t\t\t\t\t\tg.drawImage(Arrowr, Math.round(aX), Math.round(aY), this);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ((aX >= 1024) || (!drawArrow) || (aX <= 0)) {\r\n\t\t\t\t\t\t\tinFlight = false;\r\n\t\t\t\t\t\t\taX = playerObject[0].getX();\r\n\t\t\t\t\t\t\taY = playerObject[0].getY();\r\n\t\t\t\t\t\t\tcurrentlyDrawingArrow = 0;\r\n\t\t\t\t\t\t\tdrawArrow = false;\r\n\t\t\t\t\t\t\tshouldPlaySound = false;\r\n\t\t\t\t\t\t\tnotPlayingSound = false;\r\n\t\t\t\t\t\t\talreadyShot = false;\r\n\t\t\t\t\t\t\tif (wasReleased) {\r\n\t\t\t\t\t\t\t\tlClick = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tint roundedX = Math.round(playerObject[0].getX());\r\n\t\t\t\t\t\tint roundedY = Math.round(playerObject[0].getY());\r\n\t\t\t\t\t\tif (drawSword) {\r\n\t\t\t\t\t\t\tswordCount++;\r\n\t\t\t\t\t\t\tif (mouseLeft) {\r\n\t\t\t\t\t\t\t\tif (swordCount < 5) {\r\n\t\t\t\t\t\t\t\t\tg.drawImage(SwordHorizontalL, roundedX - 2, roundedY - 45, this);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if (swordCount > 5 && swordCount <=15) {\r\n\t\t\t\t\t\t\t\t\tg.drawImage(Sword45L, roundedX - 45, roundedY - 30, this);\r\n\t\t\t\t\t\t\t\t}else if (swordCount >15 && swordCount<30) {\r\n\t\t\t\t\t\t\t\t\tg.drawImage(SwordL, roundedX - 63, roundedY, this);\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if (swordCount >30 || !drawSword){\r\n\t\t\t\t\t\t\t\t\tg.drawImage(SwordHorizontalL, roundedX - 2, roundedY - 45, this);\r\n\t\t\t\t\t\t\t\t\tswordCount = 0;\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}else {\r\n\t\t\t\t\t\t\t\tif (swordCount < 5) {\r\n\t\t\t\t\t\t\t\t\t//image flip g.drawImage(SwordHorizontalL, Math.round(x) - 2, Math.round(y) - 45, -SwordHorizontalL.getWidth(this),SwordHorizontalL.getHeight(this),this);\r\n\t\t\t\t\t\t\t\t\tg.drawImage(SwordHorizontalL, roundedX + 20, roundedY - 45,\r\n\t\t\t\t\t\t\t\t\t\t\t-swordHorizontalLWidth,swordHorizontalLWidth,this);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if (swordCount > 5 && swordCount <=15) {\r\n\t\t\t\t\t\t\t\t\tg.drawImage(Sword45L, roundedX + 80, roundedY - 30,\r\n\t\t\t\t\t\t\t\t\t\t\t-sword45LWidth, sword45LHeight, this);\r\n\t\t\t\t\t\t\t\t}else if (swordCount >15 && swordCount<30) {\r\n\t\t\t\t\t\t\t\t\tg.drawImage(SwordL, roundedX +90, roundedY, -swordLWidth, swordLHeight, this);\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if (swordCount >30 || !drawSword){\r\n\t\t\t\t\t\t\t\t\tg.drawImage(SwordHorizontalL, roundedX + 20, roundedY - 45,\r\n\t\t\t\t\t\t\t\t\t\t\t-swordHorizontalLWidth, swordHorizontalLHeight, this);\r\n\t\t\t\t\t\t\t\t\tswordCount = 0;\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (shield) {\r\n\t\t\t\t\t\t\tif (mouseLeft) {\r\n\t\t\t\t\t\t\t\tg.drawImage(shieldImage, roundedX - 5, roundedY - 5, shieldWidth, scaledShieldHeight, this);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tg.drawImage(shieldImage, roundedX + 5, roundedY - 5, shieldWidth, scaledShieldHeight, this);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tif(mouseLeft) {\r\n\t\t\t\t\t\t\t\tg.drawImage(SwordHorizontalL, roundedX - 2, roundedY - 45, this);\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tg.drawImage(SwordHorizontalL, roundedX + 20, roundedY - 45,\r\n\t\t\t\t\t\t\t\t\t\t-SwordHorizontalL.getWidth(this), SwordHorizontalL.getHeight(this), this);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tswordCount = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (wasReleased) {\r\n\t\t\t\t\t\t\tlClick = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}else if (escape) {\r\n\t\t\t\t\tg.setColor(Color.white);\r\n\t\t\t\t\tg.drawRect(0, 0, 1024, 768);\r\n\t\t\t\t\tg.setColor(Color.black);\r\n\t\t\t\t\tg.drawString(\"PAUSED\", 512, 389);\r\n\t\t\t\t}\r\n\t\t\t\telse if (dead) {\r\n\t\t\t\t\tg.setColor(Color.black);\r\n\t\t\t\t\tg.drawRect(0, 0, 1024, 768);\r\n\t\t\t\t\tg.drawString(\"Dead\", 512, 389);\r\n\t\t\t\t} else if(allAIDead) {\r\n\t\t\t\t\tg.setColor(Color.black);\r\n\t\t\t\t\tg.drawRect(0, 0, 1024, 768);\r\n\t\t\t\t\tg.drawString(\"You win\", 512, 389);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tg.dispose();\r\n\t\t}\r\n\t\t// Shows the contents of the backbuffer on the screen.\r\n\t\tbf.show();\r\n\t}", "public void clouleurFondEcran() {\n this.setBackground(Color.WHITE);\n jPanel3.setBackground(Color.WHITE);\n jPanel2.setBackground(Color.WHITE);\n jPanel5.setBackground(Color.WHITE);\n jTable2.setBackground(Color.WHITE);\n jTextField3.setBackground(Color.WHITE);\n }", "private static void updateColors() {\n try {\n text.setBackground(colorScheme[0]); outputText.setBackground(colorScheme[0]); \n //frame.setBackground(colorScheme[0]);\n\n //Determines the color to set the splitter\n if(colorScheme[0].equals(Color.BLACK)) splitter.setBackground(Color.DARK_GRAY.darker());\n else if(colorScheme[0].equals(new Color(35,37,50))) splitter.setBackground(new Color(35,37,50).brighter());\n else if(colorScheme[0].equals(Color.GRAY) || colorScheme[0].equals(Color.LIGHT_GRAY) || colorScheme[0].equals(Color.WHITE)) splitter.setBackground(null);\n else splitter.setBackground(colorScheme[0].darker());\n\n text.getStyledDocument().getForeground(attributeScheme[11]); //Will work, but needs to be refreshed somehow.\n outputText.setForeground(colorScheme[11]); \n } catch (Exception e) {\n System.out.println(\"The error was here!\");\n e.printStackTrace();\n }\n }", "public GUI() {\n initComponents();\n this.jComboBox1.setEnabled(false);\n this.jButton2.setEnabled(false);\n this.jButton3.setEnabled(false);\n this.jTextArea1.setEnabled(false);\n getContentPane().setBackground(java.awt.Color.getHSBColor((float) 0.62, (float) 0.55, (float) 0.55));\n }", "@Override\n public void paintComponent(Graphics g) {\n super.paintComponent(g);\n\n paintBackground(g);\n }", "@Override\n\tpublic void paintComponent(Graphics g){\n\t\tsuper.paintComponent(g);\n\t\tg.setColor(indicateColor);\n\t\tg.fillOval(0, 0, checkerSize, checkerSize);\t\n\t\t\n\t}", "public void paintComponent(Graphics g) {\r\n\t\tGraphics2D g2 = (Graphics2D) g;\r\n\t\tg2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r\n\t\t\t\tRenderingHints.VALUE_ANTIALIAS_ON);\r\n\r\n\t\tRectangle text_field_rect = new Rectangle(0, 0, DEFAULT_WIDTH\r\n\t\t\t\t- DEFAULT_HEIGHT - 1, DEFAULT_HEIGHT);\r\n\t\tRectangle button_rect = new Rectangle(DEFAULT_WIDTH - DEFAULT_HEIGHT,\r\n\t\t\t\t0, DEFAULT_HEIGHT, DEFAULT_HEIGHT);\r\n\r\n\t\tif (this.enabled)\r\n\t\t g2.setColor(Color.white);\r\n\t\telse\r\n\t\t g2.setColor(this.colorDisabled);\t\r\n\t\t\r\n\t\tg2.fillRect(text_field_rect.x, text_field_rect.y,\r\n\t\t\t\ttext_field_rect.width, text_field_rect.height);\r\n\r\n\t\tFont font = new Font(\"Dialog\", Font.PLAIN, 10);\r\n\t\tg2.setFont(font);\r\n\r\n\t\tFontMetrics metrics = getFontMetrics(font);\r\n\t\tint str_height = metrics.getHeight();\r\n\t\tint str_descent = metrics.getDescent();\r\n\r\n\t\tg2.setColor(Color.black);\r\n\t\tg2.drawString(this.label, 4, text_field_rect.height / 2 + str_height\r\n\t\t\t\t/ 2 - str_descent);\r\n\r\n\t\tg2.setColor(Color.gray);\r\n\t\tg2.draw3DRect(text_field_rect.x, text_field_rect.y,\r\n\t\t\t\ttext_field_rect.width, text_field_rect.height, false);\r\n\r\n\t\tg2.translate(button_rect.x, button_rect.y);\r\n\t\tint w = button_rect.width;\r\n\t\tint h = button_rect.height;\r\n\r\n\t\tg2.setColor(Color.black);\r\n\t\tg2.drawRect(0, 0, w - 1, h - 1);\r\n\t\tg2.setColor(Color.lightGray);\r\n\t\tg2.fill3DRect(0, 0, w - 1, h - 1, !selected);\r\n\r\n\t\tint w_3 = (int) ((float) w / (float) 3);\r\n\t\tint w_3_times_2 = 2 * w_3;\r\n\t\tint w_2 = (int) ((float) w / (float) 2);\r\n\t\tint h_3 = (int) ((float) h / (float) 3);\r\n\t\tint h_3_times_2 = 2 * (int) h / 3;\r\n\r\n\t\tPolygon p = new Polygon();\r\n\t\tp.addPoint(w_3, h_3);\r\n\t\tp.addPoint(w_3_times_2, h_3);\r\n\t\tp.addPoint(w_2, h_3_times_2);\r\n\r\n\t\tg2.setColor(Color.black);\r\n\t\tg2.fillPolygon(p);\r\n\r\n\t\tg2.translate(-button_rect.x, -button_rect.y);\r\n\t}", "public void display() {\t\t\n\t\tparent.pushStyle();\n\t\t\n\t\t//parent.noStroke();\n\t\t//parent.fill(255);\n\t\tparent.noFill();\n\t\tparent.ellipse(pos.x, pos.y, diam, diam);\n\t\tnodeSpin.drawNode(pos.x, pos.y, diam);\n\t\t\n\t\t//This should match what happens in the hover animation\n\t\tif (focused && userId >= 0) {\n\t\t\tparent.fill(Sequencer.colors[userId]);\n\t\t\tparent.ellipse(pos.x, pos.y, diam, diam);\n\t\t}\n\t\t\n\t\trunAnimations();\n\t\t\n\t\tparent.popStyle();\n\t}", "@Override\r\n public void paintComponent(Graphics g) {\r\n\r\n //Paint background\r\n g.drawImage (background, 0, 0, null);\r\n }", "@SuppressWarnings(\"unchecked\")\n private void create() {\n components.clear();\n\n if (content != null) {\n content.clearChildren();\n }\n else {\n content = new Container();\n content.setInsets(INSETS);\n }\n\n GuiComponent guiComponent = (GuiComponent) getReflectedItem().getValue();\n\n // let the user choose which type of backgroundComponent they want.\n Label label = content.addChild(new Label(\"Type\"), 0, 0);\n label.setTextHAlignment(HAlignment.Right);\n label.setInsets(INSETS);\n Container backgroundTypeContainer = content.addChild(new Container(), 0, 1);\n\n ColorRGBA oldColor = BackgroundUtils.getBackgroundColor(guiComponent);\n\n Button colorOnlyBgButton = backgroundTypeContainer.addChild(new Button(\"Color Only\"), 0, 0);\n colorOnlyBgButton.addClickCommands(source -> {\n if (!(guiComponent instanceof QuadBackgroundComponent)) {\n setValue(new QuadBackgroundComponent(oldColor));\n create();\n }\n });\n\n Button colorAndImageBgButton = backgroundTypeContainer.addChild(new Button(\"Color and Image\"), 0, 1);\n colorAndImageBgButton.addClickCommands(source -> {\n if (!(guiComponent instanceof TbtQuadBackgroundComponent)) {\n setValue(BackgroundComponents.gradient(oldColor));\n create();\n }\n });\n\n if (guiComponent instanceof QuadBackgroundComponent) {\n\n try {\n\n Method getter = QuadBackgroundComponent.class.getDeclaredMethod(\"getColor\");\n Method setter = QuadBackgroundComponent.class.getDeclaredMethod(\"setColor\", ColorRGBA.class);\n\n label = content.addChild(new Label(\"Color\"), 1, 0);\n label.setTextHAlignment(HAlignment.Right);\n label.setInsets(INSETS);\n\n ColorRGBAComponent bgColorComponent = new ColorRGBAComponent(guiComponent, getter, setter);\n content.addChild(bgColorComponent.getPanel(), 1, 1);\n components.add(bgColorComponent);\n\n // margin\n getter = QuadBackgroundComponent.class.getDeclaredMethod(\"getMargin\");\n setter = QuadBackgroundComponent.class.getDeclaredMethod(\"setMargin\", Vector2f.class);\n\n label = content.addChild(new Label(\"Margin\"), 2, 0);\n Vector2fComponent marginComponent = new Vector2fComponent(guiComponent, getter, setter);\n content.addChild(marginComponent.getPanel(), 2, 1);\n components.add(marginComponent);\n\n } catch (NoSuchMethodException e) {\n e.printStackTrace();\n }\n\n }\n else if (guiComponent instanceof TbtQuadBackgroundComponent) {\n\n TbtQuadBackgroundComponent backgroundComponent = (TbtQuadBackgroundComponent) guiComponent;\n\n try {\n Method getter = TbtQuadBackgroundComponent.class.getDeclaredMethod(\"getColor\");\n Method setter = TbtQuadBackgroundComponent.class.getDeclaredMethod(\"setColor\", ColorRGBA.class);\n\n label = content.addChild(new Label(\"Color\"), 1, 0);\n label.setTextHAlignment(HAlignment.Right);\n label.setInsets(INSETS);\n\n ColorRGBAComponent bgColorComponent = new ColorRGBAComponent(guiComponent, getter, setter);\n content.addChild(bgColorComponent.getPanel(), 1, 1);\n components.add(bgColorComponent);\n\n label = content.addChild(new Label(\"Image\"), 2, 0);\n label.setTextHAlignment(HAlignment.Right);\n label.setInsets(INSETS);\n\n Button browseImageButton = content.addChild(new Button(\"Select Background Image...\"), 2, 1);\n browseImageButton.setTextVAlignment(VAlignment.Center);\n browseImageButton.addClickCommands(source -> {\n\n JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());\n jfc.setDialogTitle(\"Select a Background Image...\");\n jfc.setMultiSelectionEnabled(false);\n jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);\n jfc.setAcceptAllFileFilterUsed(false);\n FileNameExtensionFilter filter = new FileNameExtensionFilter(\"PNG Images\", \"png\");\n jfc.addChoosableFileFilter(filter);\n int returnValue = jfc.showOpenDialog(null);\n\n if (returnValue == JFileChooser.APPROVE_OPTION) {\n\n File file = jfc.getSelectedFile();\n\n\n try {\n\n byte[] imageData = Files.readAllBytes(file.toPath());\n byte[] stringData = Base64.getEncoder().encode(imageData);\n\n String imageString = new String(stringData);\n\n // PanelBackground panelBackground = (PanelBackground) getReflectedProperty().getValue();\n // panelBackground.setBase64Image(imageString);\n\n Texture texture = new TextureUtils().fromBase64(imageString);\n\n backgroundComponent.setTexture(texture);\n\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n });\n\n // margin\n getter = TbtQuadBackgroundComponent.class.getDeclaredMethod(\"getMargin\");\n setter = TbtQuadBackgroundComponent.class.getDeclaredMethod(\"setMargin\", Vector2f.class);\n\n label = content.addChild(new Label(\"Margin\"), 3, 0);\n Vector2fComponent marginComponent = new Vector2fComponent(guiComponent, getter, setter);\n content.addChild(marginComponent.getPanel(), 3, 1);\n components.add(marginComponent);\n\n\n } catch (NoSuchMethodException e) {\n e.printStackTrace();\n }\n\n }\n\n//\n// this.content = new RollupPanel(\"\", contentContainer, null);\n// this.content.setOpen(false);\n//\n// // background Image\n// Container bgImageContainer = contentContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X, FillMode.Last, FillMode.Last)), 0, 0);\n// Label bgImageLabel = bgImageContainer.addChild(new Label(\"Background Image\"), 0, 0);\n// bgImageLabel.setTextVAlignment(VAlignment.Center);\n// bgImageLabel.setInsets(new Insets3f(0.0F, 2.0F, 0.0F, 5.0F));\n// Button browseImageButton = bgImageContainer.addChild(new Button(\"Browse...\"), 0, 1);\n// Button removeImageButton = bgImageContainer.addChild(new Button(\"Remove\"), 0, 2);\n// bgImageContainer.addChild(new Container(), 0, 3);\n//\n// browseImageButton.addClickCommands(source -> {\n//\n// JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());\n// jfc.setDialogTitle(\"Select a Background Image...\");\n// jfc.setMultiSelectionEnabled(false);\n// jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);\n// jfc.setAcceptAllFileFilterUsed(false);\n// FileNameExtensionFilter filter = new FileNameExtensionFilter(\"PNG Images\", \"png\");\n// jfc.addChoosableFileFilter(filter);\n// int returnValue = jfc.showOpenDialog(null);\n//\n// if (returnValue == JFileChooser.APPROVE_OPTION) {\n//\n// File file = jfc.getSelectedFile();\n//\n// try {\n// byte[] imageData = Files.readAllBytes(file.toPath());\n// byte[] stringData = Base64.getEncoder().encode(imageData);\n//\n// String imageString = new String(stringData);\n//\n// PanelBackground panelBackground = (PanelBackground) getReflectedProperty().getValue();\n// panelBackground.setBase64Image(imageString);\n//\n// } catch (IOException e) {\n// e.printStackTrace();\n// }\n// }\n//\n// });\n//\n// removeImageButton.addClickCommands(source -> {\n// PanelBackground panelBackground = (PanelBackground) getReflectedProperty().getValue();\n// panelBackground.setBase64Image(\"\");\n// });\n//\n//\n// try {\n//\n// // color\n// Method get = PanelBackground.class.getMethod(\"getColor\");\n// Method set = PanelBackground.class.getMethod(\"setColor\", ColorRGBA.class);\n//\n// ColorRGBAComponent bgColorComponent = new ColorRGBAComponent(getReflectedProperty().getValue(), get, set);\n// bgColorComponent.setPropertyName(\"Color\");\n// contentContainer.addChild(bgColorComponent.getPanel());\n// components.add(bgColorComponent);\n//\n// // insetTop\n// get = PanelBackground.class.getMethod(\"getInsetTop\");\n// set = PanelBackground.class.getMethod(\"setInsetTop\", int.class);\n//\n// IntComponent insetTopComponent = new IntComponent(getReflectedProperty().getValue(), get, set);\n// insetTopComponent.setPropertyName(\"Inset Top\");\n// contentContainer.addChild(insetTopComponent.getPanel());\n// components.add(insetTopComponent);\n//\n// // insetLeft\n// get = PanelBackground.class.getMethod(\"getInsetLeft\");\n// set = PanelBackground.class.getMethod(\"setInsetLeft\", int.class);\n//\n// IntComponent insetLeftComponent = new IntComponent(getReflectedProperty().getValue(), get, set);\n// insetLeftComponent.setPropertyName(\"Inset Left\");\n// contentContainer.addChild(insetLeftComponent.getPanel());\n// components.add(insetLeftComponent);\n//\n// // insetBottom\n// get = PanelBackground.class.getMethod(\"getInsetBottom\");\n// set = PanelBackground.class.getMethod(\"setInsetBottom\", int.class);\n//\n// IntComponent insetBottomComponent = new IntComponent(getReflectedProperty().getValue(), get, set);\n// insetBottomComponent.setPropertyName(\"Inset Bottom\");\n// contentContainer.addChild(insetBottomComponent.getPanel());\n// components.add(insetBottomComponent);\n//\n// // insetRight\n// get = PanelBackground.class.getMethod(\"getInsetRight\");\n// set = PanelBackground.class.getMethod(\"setInsetRight\", int.class);\n//\n// IntComponent insetRightComponent = new IntComponent(getReflectedProperty().getValue(), get, set);\n// insetRightComponent.setPropertyName(\"Inset Right\");\n// contentContainer.addChild(insetRightComponent.getPanel());\n// components.add(insetRightComponent);\n//\n// // zOffset\n// get = PanelBackground.class.getMethod(\"getzOffset\");\n// set = PanelBackground.class.getMethod(\"setzOffset\", float.class);\n//\n// FloatComponent zOffsetComponent = new FloatComponent(getReflectedProperty().getValue(), get, set);\n// zOffsetComponent.setPropertyName(\"Z-Offset\");\n// contentContainer.addChild(zOffsetComponent.getPanel());\n// components.add(zOffsetComponent);\n//\n// } catch (NoSuchMethodException e) {\n// e.printStackTrace();\n// }\n\n\n }", "@Override\n\t\t\tprotected void paintComponent(Graphics g) {\n\t\t\t\tGraphics2D g2d = (Graphics2D) g;\n\t\t g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\n\t\t RenderingHints.VALUE_ANTIALIAS_ON);\n\t\t \n\t\t GradientPaint gp = new GradientPaint(0, 0,\n\t\t Const.BACKGROUND_COLOR.brighter(), 0, getHeight(),\n\t\t Color.BLUE);\n\t\t \n\t\t g2d.setPaint(gp);\n\t\t g2d.fillRect(0, 0, getWidth(), getHeight());\n\n\t\t\t\tsuper.paintComponent(g);\n\t\t\t}", "public void draw() {\n\t\tif (fill) {\n\t\t\tapplet.noStroke();\n\t\t\tapplet.fill(color);\n\t\t} else {\n\t\t\tapplet.noFill();\n\t\t\tapplet.stroke(color);\n\t\t}\n\t\tapplet.rect(position.x, position.y, size.x, size.y);\n\t\tsliderButton.draw(new PVector(-10,0));\n\t}", "@Override\n protected void renderBg(GuiGraphics guiGraphics, float f, int mouseX, int mouseY) {\n RenderHelpers.bindTexture(texture);\n this.renderBgTab(guiGraphics, f, mouseX, mouseY);\n this.renderBgPlayerInventory(guiGraphics, f, mouseX, mouseY);\n\n fieldChannel.render(guiGraphics, mouseX, mouseY, f);\n fieldSearch.render(guiGraphics, mouseX, mouseY, f);\n drawTabsBackground(guiGraphics);\n drawTabContents(guiGraphics, getMenu().getSelectedTab(), getMenu().getSelectedChannel(), DrawLayer.BACKGROUND,\n f, getGuiLeftTotal() + getSlotsOffsetX(), getGuiTopTotal() + getSlotsOffsetY(), mouseX, mouseY);\n scrollBar.render(guiGraphics, mouseX, mouseY, f);\n\n Optional<ITerminalStorageTabClient<?>> tabOptional = getSelectedClientTab();\n tabOptional.ifPresent(tab -> {\n int offset = 0;\n int gridXSize = getGridXSize();\n int gridYSize = getGridYSize();\n int playerInventoryOffsetX = getPlayerInventoryOffsetX();\n int playerInventoryOffsetY = getPlayerInventoryOffsetY();\n ITerminalStorageTabCommon.SlotPositionFactors factors = new ITerminalStorageTabCommon.SlotPositionFactors(offsetX, offsetY, gridXSize, gridYSize, playerInventoryOffsetX, playerInventoryOffsetY);\n for (ITerminalButton button : tab.getButtons()) {\n Button guiButton = button.createButton(button.getX(leftPos, BUTTONS_OFFSET_X, gridXSize, gridYSize, playerInventoryOffsetX, playerInventoryOffsetY), button.getY(topPos, BUTTONS_OFFSET_Y + offset, gridXSize, gridYSize, playerInventoryOffsetX, playerInventoryOffsetY));\n guiButton.render(guiGraphics, mouseX, mouseY, f);\n if (button.isInLeftColumn()) {\n offset += BUTTONS_OFFSET + guiButton.getHeight();\n }\n }\n\n String tabName = getMenu().getSelectedTab();\n Optional<ITerminalStorageTabCommon> tabCommonOptional = getCommonTab(tabName);\n tabCommonOptional.ifPresent(tabCommon -> {\n for (Pair<Slot, ITerminalStorageTabCommon.ISlotPositionCallback> slot : getMenu().getTabSlots(tabName)) {\n Pair<Integer, Integer> slotPos = slot.getRight().getSlotPosition(factors);\n tab.onCommonSlotRender(this, guiGraphics, DrawLayer.BACKGROUND,\n 0, leftPos + slotPos.getLeft(), topPos + slotPos.getRight(), mouseX, mouseY, slot.getLeft().index, tabCommon);\n }\n });\n });\n }", "public void paintComponent(Graphics g) {\r\n super.paintComponent(g);\r\n if (isDrawBackground()) {\r\n paintComponentBackground(g, getBackgroundInsets(), getUiPrefs().getBackgroundColor());\r\n } else if (!isBackgroundTransparent()) {\r\n paintComponentBackground(g, null, Color.WHITE);\r\n }\r\n if (isDrawBorder()) {\r\n paintComponentBorder(g);\r\n }\r\n }", "@Override\n protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)\n {\n GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);\n this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);\n int i = (this.width - this.xSize) / 2;\n int j = (this.height - this.ySize) / 2;\n this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);\n this.drawTexturedModalRect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);\n }", "@Focus\n\tpublic void setFocus() \n\t{\n\t\t\tfor(int r = Board.LENGTH - 1; r >= 0; r--)\n\t\t\t{\t\n\t\t\t\t\tfor(int c=0;c<Board.LENGTH;c++)\n\t\t\t\t\t{\t\n\t\t\t\t\t\tsquares[r][c+1].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(((Square) squares[r][c+1].getData()).isLegal())//It returns the legal attribute wrong\n\t\t\t\t\t\t{squares[r][c+1].setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));}\n\t\t\t\t\t\t\n\t\t\t\t\t\tPiece piece = ((Square) squares[r][c+1].getData()).getPiece();\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(piece == null)\t\n\t\t\t\t\t\t\tsquares[r][c+1].setImage(IconHandler.getBlankIcon());\t\t\t\t\t\t\t\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsquares[r][c+1].setImage(piece.getIcon());\t\t\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t}\t\t\n\t}", "public LafPaintFrame() {\n initComponents();\n add(canvas);\n \n /*\n try {\n img = ImageIO.read(new File(\"D:\\\\kishida\\\\java\\\\trial\\\\nb6m10\\\\Laftan\\\\laf.png\"));\n } catch (IOException e) {\n }*/\n \n undoMan.setLimit(30);\n saveAction.putValue(Action.ACCELERATOR_KEY, \n KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));\n btnSave.setAction(saveAction);\n miSave.setAction(saveAction);\n \n undoAction.putValue(Action.ACCELERATOR_KEY, \n KeyStroke.getKeyStroke(KeyEvent.VK_Z, ActionEvent.CTRL_MASK));\n btnUndo.setAction(undoAction);\n miUndo.setAction(undoAction);\n\n redoAction.putValue(Action.ACCELERATOR_KEY, \n KeyStroke.getKeyStroke(KeyEvent.VK_Y, ActionEvent.CTRL_MASK));\n btnRedo.setAction(redoAction);\n miRedo.setAction(redoAction);\n \n undoUpdate();\n \n //色設定ボタン\n Color[] colors = {\n Color.BLACK, Color.GRAY, Color.LIGHT_GRAY, Color.WHITE,\n Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW,Color.ORANGE\n };\n boolean first = true;\n for(Color col : colors){\n JToggleButton tb = new JToggleButton();\n tb.setBackground(col);\n tb.setText(\" \");\n tb.setMinimumSize(new Dimension(32, 32));\n tb.setPreferredSize(new Dimension(32, 32));\n bgColor.add(tb);\n tbColor.add(tb);\n if(first){\n tb.setSelected(true);\n selectedColor = tb.getBackground();\n first = false;\n }\n tb.addActionListener(ae -> {\n selectColor(((JToggleButton)ae.getSource()).getBackground());\n });\n }\n \n actions.put(\"LINE\", new DrawLine());\n actions.put(\"FILL\", new DrawFillLine());\n actions.put(\"ERASE\", new Erase());\n canvas.addMouseListener(new MouseListener(){\n\n public void mouseClicked(MouseEvent e) {\n }\n\n public void mousePressed(MouseEvent e) {\n Draw d = actions.get(getMode());\n if(d == null) return;\n d.canvasMousePressed(e);\n }\n\n @Override\n public void mouseReleased(MouseEvent e) {\n Draw d = actions.get(getMode());\n if(d == null) return;\n d.canvasMouseReleased(e);\n }\n\n @Override\n public void mouseEntered(MouseEvent e) {\n Draw d = actions.get(getMode());\n if(d == null) return;\n d.canvasMouseEntered(e);\n }\n\n @Override\n public void mouseExited(MouseEvent e) {\n Draw d = actions.get(getMode());\n if(d == null) return;\n d.canvasMouseExited(e);\n }\n\n });\n canvas.addMouseMotionListener(new MouseMotionListener(){\n @Override\n public void mouseDragged(MouseEvent e) {\n Draw d = actions.get(getMode());\n if(d == null) return;\n d.canvasMouseDragged(e);\n }\n\n @Override\n public void mouseMoved(MouseEvent e) {\n }\n });\n \n }", "@Override\n\tpublic void setPaint() {\n\t\tisPaint = true;\n\t}", "private void update() {\n\t\tColor fColor = fgColorProvider.getCurrentColor();\n\t\tColor bColor = bgColorProvider.getCurrentColor();\n\t\tsetText(String.format(\"Foreground color: (%d, %d, %d), background color: (%d, %d, %d).\", \n\t\t\t\tfColor.getRed(), fColor.getGreen(), fColor.getBlue(),\n\t\t\t\tbColor.getRed(), bColor.getGreen(), bColor.getBlue()));\n\t}", "private void repaint() {\n\t\tclear();\n\t\tfor (PR1Model.Shape c : m.drawDataProperty()) {\n\t\t\tif(!c.getText().equals(defaultshape))\n\t\t\t\tdrawShape(c, false);\n\t\t}\n\t\tif (getSelection() != null) {\n\t\t\tdrawShape(getSelection(), true);\n\t\t}\n\t}", "private void swhFieldConditions() {\n\n gameScreenBackground.setImageResource(com.ryansplayllc.ryansplay.R.drawable.baseball_field);\n\n swhImageView.setSelected(false);\n baseHitImageView.setSelected(false);\n\n lfTextView.setSelected(false);\n rfTextView.setSelected(false);\n cfTextView.setSelected(false);\n cTextView.setSelected(false);\n pTextView.setSelected(false);\n oneBTextView.setSelected(false);\n twoBTextView.setSelected(false);\n threeBTextView.setSelected(false);\n ssTextView.setSelected(false);\n\n leftFieldPoints.setVisibility(View.GONE);\n rightFieldpoints.setVisibility(View.GONE);\n centerFieldPoints.setVisibility(View.GONE);\n\n hideAllFieldPosBadges();\n swhLabel.setVisibility(View.GONE);\n\n homeRunImageView.setEnabled(true);\n runScore.setEnabled(true);\n possiblePoints.setText(\"0 / 0\");\n baseHitImageView.setBackgroundResource(com.ryansplayllc.ryansplay.R.drawable.base_hit);\n\n positionsEnable();\n\n //disable basehit\n baseHitImageView.setEnabled(false);\n baseHitImageView.setAlpha((float) 0.6);\n\n //enable swh\n swhImageView.setEnabled(true);\n swhImageView.setAlpha((float) 1.0);\n\n\n }", "@Override\r\n public void mousePressed(MouseEvent e) {\n setBackground(Color.BLUE);\r\n \r\n \r\n }", "private void settingsScreenRender() {\n overlay.draw(batch, 0.5f);\n uiFont.draw(batch, scoreTxt, 0, HEIGHT - (scoreLayout.height));\n uiFont.draw(batch, healthTxt, WIDTH / 2, HEIGHT - (healthLayout.height));\n musicOn.draw(batch, 1);\n musicOff.draw(batch, 1);\n resume.draw(batch, 1);\n settingStage.draw();\n }", "public void changeToStandard(){\n drawAttributeManager.toggleStandardView();\n getContentPane().setBackground(DrawAttribute.whiteblue);\n canvas.repaint();\n }", "@Override\n protected final void setGraphics() {\n super.setGraphics();\n Graphics g = toDraw.getGraphics();\n g.setColor(Color.BLACK); \n \n for (int i = 0; i < choices.size(); i++) { \n g.drawString(choices.get(i).getValue(), wGap, (i + 1) * hItemBox);\n }\n }", "private void colorScheme (Composite parent) {\r\n\t\tbgLabel = ControlFactory.createLabel(parent, CDTFoldingConstants.SELECT_BG);\r\n\t\tbgColorSelector = new ColorSelector(parent);\r\n\r\n\t\tfgLabel = ControlFactory.createLabel(parent, CDTFoldingConstants.SELECT_FG);\r\n\t\tfgColorSelector = new ColorSelector(parent);\r\n\r\n\t\tbgColorSelector.setColorValue(CDTUtilities.restoreRGB(store\r\n\t\t\t\t.getString(CDTFoldingConstants.COLOR_PICKED_BG)));\r\n\t\tfgColorSelector.setColorValue(CDTUtilities.restoreRGB(store\r\n\t\t\t\t.getString(CDTFoldingConstants.COLOR_PICKED_FG)));\r\n\r\n\t\tbgColorSelector.addListener(event -> {\r\n\t\t\tRGB currentRGB = bgColorSelector.getColorValue();\r\n\r\n\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\tsb.append(Integer.toString(currentRGB.red) + \" \");\r\n\t\t\tsb.append(Integer.toString(currentRGB.green) + \" \");\r\n\t\t\tsb.append(Integer.toString(currentRGB.blue));\r\n\r\n\t\t\tstore.setValue(CDTFoldingConstants.COLOR_PICKED_BG, sb.toString());\r\n\t\t});\r\n\r\n\t\tfgColorSelector.addListener(event -> {\r\n\t\t\tRGB currentRGB = fgColorSelector.getColorValue();\r\n\r\n\t\t\tStringBuilder sb = new StringBuilder();\r\n\t\t\tsb.append(Integer.toString(currentRGB.red) + \" \");\r\n\t\t\tsb.append(Integer.toString(currentRGB.green) + \" \");\r\n\t\t\tsb.append(Integer.toString(currentRGB.blue));\r\n\r\n\t\t\tstore.setValue(CDTFoldingConstants.COLOR_PICKED_FG, sb.toString());\r\n\t\t});\r\n\r\n\t\tturnOnOffColors();\r\n\t}", "@Override\n public void paintComponent(Graphics g) {\n g.setColor(Color.WHITE);\n g.fillRect(0,0,super.getWidth(),super.getHeight());\n\n for (DrawableVector instruction : instructions){\n instruction.draw(g, getWidth(), getHeight());\n }\n if (currentInstruction != null){\n currentInstruction.draw(g, getWidth(), getHeight());\n }\n }", "@Override\n\tpublic void paint(Graphics g) {\n\t\tsuper.paint(g);\n\t\t\n\t\tsetBackground(Color.white); // Imposto il colore di sfondo\n\t\tsetForeground(Color.black); // Imposto il colore dell'etichetta\n\t}", "protected void addopqueueonBackground() {\n\t\tlv.setClickable(false);\n\t\tlvx.setClickable(false);\n\t\trefresh.setClickable(false);\n\t\tsearch.setClickable(false);\n\t\tsearch.setEnabled(false);\n\t\tlv.setEnabled(false);\n\t\tlvx.setEnabled(false);\n\t\trefresh.setEnabled(false);\n\t\tcancelButton.setClickable(false);\n\t\tcancelButton.setEnabled(false);\n\t\tlistbackground.setAlpha(0.5f);\n\t\tbackground.setAlpha(0.5f);\n\t}", "@Override\n\tpublic void draw() {\n\t\tbg.draw();\n\t\tfor(Test2 t : test)\n\t\t\tt.draw();\n\t\tfor(Test2 t : test2)\n\t\t\tt.draw();\n\t\t\n\t\tfor(Test2 t : test3)\n\t\t\tt.draw();\n\t\tobj.draw();\n\t\tEffect().drawEffect(1);\n\t}", "public void setColor()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"yellow\");\n window.changeColor(\"black\");\n roof.changeColor(\"red\");\n sun.changeColor(\"yellow\");\n }\n }", "private void redraw() {\r\n for (int row = 0; row < maxRows; row++) {\r\n for (int column = 0; column < maxColumns; column++) {\r\n grid[row][column].setBackground(SQUARE_COLOR);\r\n }\r\n }\r\n grid[snake[HEAD].row][snake[HEAD].column].setBackground(\r\n SNAKE_HEAD_COLOR);\r\n for (int i = 1; i < length; i++) {\r\n grid[snake[i].row][snake[i].column].setBackground(SNAKE_BODY_COLOR);\r\n }\r\n grid[powerUp.row][powerUp.column].setBackground(POWER_UP_COLOR);\r\n }", "public DrawFrame() \n {\n //Initiate title and layout of frame\n super( \"SuperPaint Application!\" );\n setLayout( new BorderLayout() );\n setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );\n setSize( 600, 600 );\n \n //Initiate draw panel and add it to the center\n panel = new DrawPanel( new JLabel(\"Use mouse to draw.\") );\n add( panel, BorderLayout.CENTER );\n \n //Initiate a panel to store buttons\n buttonJPanel = new JPanel();\n buttonJPanel.setLayout( new GridLayout( 1, AMOUNTOFBUTTONS, 20, 0 ));\n \n //Initiate JButtons and add to panel\n undoButton = new JButton(\"Undo\");\n buttonJPanel.add(undoButton);\n redoButton = new JButton(\"Redo\");\n buttonJPanel.add(redoButton);\n clearButton = new JButton(\"Clear\");\n buttonJPanel.add(clearButton);\n \n //Iniiate ComboBoxes and add to panel\n colorsJComboBox = new JComboBox( colorNames );\n colorsJComboBox.setMaximumRowCount(13);\n buttonJPanel.add(colorsJComboBox);\n shapesJComboBox = new JComboBox( shapeNames );\n shapesJComboBox.setMaximumRowCount(3);\n buttonJPanel.add(shapesJComboBox);\n \n //Initiate CheckBoxes and add to panel\n filledJCheckBox = new JCheckBox( \"Filled\" );\n buttonJPanel.add(filledJCheckBox);\n\n //Add button panel into draw panel\n add(buttonJPanel, BorderLayout.NORTH);\n \n //BUTTON HANDLING\n //Assign JButtons to handler\n ButtonHandler buttonHandler = new ButtonHandler();\n undoButton.addActionListener( buttonHandler );\n redoButton.addActionListener( buttonHandler );\n clearButton.addActionListener( buttonHandler );\n \n //Assign CheckBoxes to handler\n CheckBoxHandler checkBoxHandler = new CheckBoxHandler();\n filledJCheckBox.addItemListener( checkBoxHandler );\n \n //Assign Comboxes to handler \n ComboBoxHandler comboBoxHandler = new ComboBoxHandler();\n colorsJComboBox.addItemListener( comboBoxHandler );\n shapesJComboBox.addItemListener( comboBoxHandler );\n \n //Make frame visible\n setVisible( true );\n }", "public void drawNonEssentialComponents(){\n\t\t\n\t}", "public void PRCRender() {\n if(rollOver) {\n object.getStyle().setFillColorFloat(20);\n } else if(dragging) {\n object.getStyle().setFillColorFloat(5);\n } else {\n object.style.setFillColorFloat(100);\n }\n object.render();\n }", "public void setColor()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"red\");\n window.changeColor(\"black\");\n roof.changeColor(\"green\");\n sun.changeColor(\"yellow\");\n }\n }", "private void appearance()\r\n\t\t{\n\t\tgridLayout.setHgap(5);\r\n\t\tgridLayout.setVgap(5);\r\n\r\n\t\t//set the padding + external border with title inside the box\r\n\t\tBorder lineBorder = BorderFactory.createLineBorder(Color.BLACK);\r\n\t\tBorder outsideBorder = BorderFactory.createTitledBorder(lineBorder, title, TitledBorder.CENTER, TitledBorder.TOP);\r\n\t\tBorder marginBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);\r\n\t\tthis.setBorder(BorderFactory.createCompoundBorder(outsideBorder, marginBorder));\r\n\r\n\t\t//set initial value to builder\r\n\t\tdiceBuilder.setInterval(min, max);\r\n\t\t}", "private void applyBackgroundColor() {\r\n\t\tthis.control.setBackground(PromptSupport.getBackground(this.control));\r\n\t}", "public void setColor()\n {\n if (wall != null) // only if it's painted already...\n {\n wall.changeColor(\"red\");\n window.changeColor(\"black\");\n roof.changeColor(\"green\");\n sun.changeColor(\"yellow\");\n }\n }", "private void drawBorder(Graphics2D g2, boolean enabled, int x, int y, int width, int height)\r\n/* 89: */ {\r\n/* 90:133 */ g2.setColor(enabled ? PlasticLookAndFeel.getControlDarkShadow() : MetalLookAndFeel.getControlDisabled());\r\n/* 91: */ \r\n/* 92: */ \r\n/* 93:136 */ g2.drawRect(x, y, width, height);\r\n/* 94: */ }", "protected void paintBackground(Graphics g){\n Dimension size = getSize();\n\n g.setColor(properties.backgroundColor);\n g.fillRect(0,0,size.width,size.height);\n\n }", "@Override\r\npublic void mousePressed(MouseEvent arg0) {\n\t\r\n\tb1.setBackground(Color.pink);\r\n\t\r\n}", "@Override\n public void paintComponent (Graphics g)\n {\n ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\n g.setColor(BACKGROUND_COLOR);\n g.fillRect(0, 0, getHeight(), getHeight());\n g.setColor(color);\n g.fillOval(0, 0, 30, 30);\n }", "public void paintComponent(Graphics g) {\n\n\t\t\tif (death==false) {//if we arent dead, the game must be drawn\n\t\t\t\tif (background!=null) {//draw background\n\t\t\t\t\tg.drawImage(background.getImage(), background.getX(), background.getY(), this);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (blocks!=null) {//draw the blocks. from the list\n\t\t\t\t\t//System.out.println(\"Yes\");\n\t\t\t\t\tfor (int x = blocks.size()-1; x>= 0; x--) {\n\t\t\t\t\t\tif (blocks.get(x).getDisable()) {//if the blocks are disabled, destroy\n\t\t\t\t\t\t\tblocks.remove(x);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (int t = 0; t<blocks.size(); t++) {//now draw the blocks.\n\t\t\t\t\t\t//System.out.printf(\"%d %d %d %d\\n\",blocks.get(t).getX(), blocks.get(t).getY(), blocks.get(t).getWidth(), blocks.get(t).getHeight());\n\t\t\t\t\t\tg.setColor(blocks.get(t).getColor());\n\t\t\t\t\t\tg.fillRect(blocks.get(t).getX(), blocks.get(t).getY(), blocks.get(t).getWidth(), blocks.get(t).getHeight());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (slider!=null) {//if the slider isnt null, draw it\n\t\t\t\t\t//System.out.printf(\"%d %d\\n\",slider.getX(), slider.getY());\n\t\t\t\t\tg.drawImage(slider.getImage(), slider.getX(), slider.getY(), this);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (ball!=null) {//draw ball.\n\t\t\t\t\tg.drawImage(ball.getImage(), ball.getX(), ball.getY(), this);\n\t\t\t\t}\n\t\t\t\tfor (PowerUp power: powerUps) {//draw all of the powerups\n\t\t\t\t\tg.drawImage(power.getImage(), power.getX(), power.getY(), this);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//draw bottom frame\n\t\t\t\t\n\t\t\t\tg.setColor(new Color(0,0,0));\n\t\t\t\tg.fillRect(0, GamePlay.getScreenHeight()-h, GamePlay.getScreenWidth(), h);//this is the menu bar\n\t\t\t\t\n\t\t\t\t//draw score\n\t\t\t\tg.setColor(new Color(255,255,255));\n\t\t\t\tg.setFont(new Font(\"Helvetica\", Font.PLAIN, 32));\n\t\t\t\tg.drawString(String.format(\"Score: %d\", score), GamePlay.getScreenWidth() - 5 - g.getFontMetrics().stringWidth(String.format(\"Score: %d\", score)), GamePlay.getScreenHeight() - 5 - 32);\n\t\t\t\t\n\t\t\t\t//paused\n\t\t\t\tif (stopped) {\n\t\t\t\t\tg.drawString(\"Paused\", 10, 42);//upper left corner of the screen. just say paused so user knows\n\t\t\t\t}\n\t\t\t\t//lives\n\t\t\t\tint livesFontSize=15;\n\t\t\t\tg.setFont(new Font(\"Helvetica\", Font.PLAIN, livesFontSize));\n\t\t\t\tg.drawString(String.format(\"Lives: %d\", lives), 20+5+pauseButton.getWidth(), GamePlay.getScreenHeight()-h+(2+livesFontSize));\n\t\t\t\t\n\t\t\t\tfor (int x=0; x<lives; x++) {//draw one ball for every life they have. \n\t\t\t\t\t//System.out.println(\"hey\");\n\t\t\t\t\tg.drawImage(ball.getImage(), 5+pauseButton.getWidth()+20+(5+ball.getWidth())*x, GamePlay.getScreenHeight()-(h/2)-(ball.getHeight())+(livesFontSize/2), this);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//logo\n\t\t\t\tg.drawImage(logo.getImage(), GamePlay.getScreenWidth()/2-logo.getWidth()/2, GamePlay.getScreenHeight() - (h/2) - (logo.getHeight()/2)-10, this);\n\t\t\t\t\n\t\t\t\t//pause button\n\t\t\t\tg.drawImage(pauseButton.getImage(), 5, GamePlay.getScreenHeight() - (h/2) - pauseButton.getHeight()/2 -10 , this);\n\t\t\t\t\n\t\t\t} else {//this means the player died.\n\t\t\t\t\n\t\t\t\t//draw black background \n\t\t\t\t\n\t\t\t\t//draw logo\n\t\t\t\tlogo.resize(400,100);\n\t\t\t\tg.setColor(new Color(0,0,0));\n\t\t\t\tg.fillRect(0, 0, GamePlay.getScreenWidth(), GamePlay.getScreenHeight());\n\t\t\t\tg.drawImage(logo.getImage(), GamePlay.getScreenWidth()/2 - logo.getWidth()/2, 100, this);\n\t\t\t\t\n\t\t\t\tg.setColor(new Color(255,255,255));//draw game over text\n\t\t\t\tg.setFont(new Font(\"Helvetica\", Font.PLAIN, 60));\n\t\t\t\tg.drawString(\"Game Over!\", GamePlay.getScreenWidth()/2 - g.getFontMetrics().stringWidth(\"Game Over!\")/2, GamePlay.getScreenHeight()/2 - 30);\n\t\t\t\t\n\t\t\t\t//draw score. \n\t\t\t\tg.drawString(String.format(\"Your Score: %d\", score), GamePlay.getScreenWidth()/2 - g.getFontMetrics().stringWidth(String.format(\"Your Score: %d\", score))/2, GamePlay.getScreenHeight()/2 + 100);\n\t\t\t}\n\t\t\t\n\t\t}", "public static void GameOverEffect(ArrayList<JButton> myGameButton){\n enableButtons(myGameButton);\n for(int i=0; i<myGameButton.size(); ++i){\n myGameButton.get(i).setBackground(Color.red); // set buttons back-ground color\n myGameButton.get(i).setForeground(Color.white); // set buttons fore-ground color\n } \n }", "public void drawAllGraphics(){\r\n\t\t \r\n\t}", "public void validateTextField ()\r\n\t{\r\n\t\tif (isEditValid ())\r\n\t\t{\r\n\t\t\tsuper.setBackground (UIConstants.GEOPOD_GREEN);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tsuper.setBackground (UIConstants.GEOPOD_RED);\r\n\t\t}\r\n\t}" ]
[ "0.6564224", "0.61892176", "0.61164623", "0.60337925", "0.6026489", "0.6005236", "0.59997135", "0.59763825", "0.59369695", "0.5935913", "0.59238046", "0.5874557", "0.58682585", "0.5833417", "0.58230764", "0.582113", "0.5801276", "0.57990533", "0.5793327", "0.5789479", "0.5789207", "0.57751495", "0.5771065", "0.57697076", "0.57506466", "0.5740998", "0.5732373", "0.5702375", "0.5695731", "0.5695586", "0.5678897", "0.5678062", "0.566607", "0.5664142", "0.5657135", "0.56562454", "0.56527144", "0.565153", "0.56409097", "0.5636252", "0.56350327", "0.56316584", "0.56289256", "0.56288", "0.5627741", "0.56270933", "0.56255335", "0.56255335", "0.5596907", "0.5596715", "0.55888504", "0.5588251", "0.5588113", "0.55860376", "0.5583772", "0.557925", "0.5576975", "0.55725324", "0.55707526", "0.5565331", "0.5563887", "0.5563363", "0.55604", "0.55598325", "0.5558287", "0.5557846", "0.5544068", "0.5543591", "0.5538477", "0.55381787", "0.5536876", "0.5534609", "0.55330485", "0.55321604", "0.5529559", "0.5527752", "0.5523321", "0.55202854", "0.5516618", "0.5504175", "0.5495729", "0.54923356", "0.54922885", "0.5491833", "0.5489646", "0.54818267", "0.547957", "0.54791635", "0.54634184", "0.5462794", "0.54627794", "0.5462174", "0.54601336", "0.5457669", "0.54413676", "0.5432085", "0.5429941", "0.5427502", "0.5418568", "0.5418107" ]
0.68369
0
Prompts the user to select a file to use to read passwords from this is primarily intended for very large lists of passwords or when memory is an issue
private void selectPassFile() { final JFileChooser fc = new JFileChooser(); if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { final File file = fc.getSelectedFile(); passFile = file; mnuPassFileName.setText("Selected: " + passFile.getName()); try { BufferedReader in = new BufferedReader(new FileReader(passFile)); for (double i = 0.0; ; i++) { String s = in.readLine(); if (s == null) { break; } mnuPasswords.setText("Passwords [" + i + "]"); } } catch (Exception e) { } } else { JOptionPane.showMessageDialog(null, "Reverting to using list.", "No File Selected", JOptionPane.ERROR_MESSAGE); mnuLoadPasswordList.setEnabled(true); mnuSavePasswordList.setEnabled(true); mnuAddPassword.setEnabled(true); mnuRemovePassword.setEnabled(true); mnuClearPasswords.setEnabled(true); mnuPassFileName.setVisible(false); radPassFile.setSelected(false); radPassList.setSelected(true); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static void usernameChoose(){\n\t\tString[] testList = Fixer.fixingList(userList);\r\n\t\tuserList = testList;\r\n\t\tScanner input = new Scanner(System.in);\r\n\t\t\r\n\t\t//boolean to keep the while loop open when attempting to create a username\r\n\t\tboolean validName = false;\r\n\t\twhile (!validName) {\r\n\t\tSystem.out.println(\"Please choose a Username\");\r\n\t\tString appAttempt = input.nextLine();\r\n\t\t\r\n\t\t//searching the Users and Applicants file for the username to avoid duplicates\r\n\t\tfor (int i = 0; i < userNum; i++) {\r\n\t\t\tString[] userSplit = userList[i].split(\":\");\r\n\t\t\tfor (int j = 0; j < appNum; j++) {\r\n\t\t\tString[] appSplit = appList[j].split(\":\");\r\n\t\t\t//if the username appears in the Users file\r\n\t\t\tif (appAttempt.equals(userSplit[1])) {\r\n\t\t\t\tSystem.out.println(\"Username already taken.\\nPlease choose a different Username\");\r\n\t\t\t\tappAttempt = input.nextLine();\r\n\t\t\t}\r\n\t\t\t//if the username appears in the Applicants file\r\n\t\t\telse if (appAttempt.equals(appSplit[1])) {\r\n\t\t\t\tSystem.out.println(\"Username already taken.\\nPlease choose a different Username\");\r\n\t\t\t\tappAttempt = input.nextLine();\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//setting validname to true to end the loop if the above two if statements don't happen\r\n\t\tvalidName = true;\r\n\t\t}\r\n\t\t//same while loop being controlled by a boolean\r\n\t\tboolean passLengthOkay = false;\r\n\t\twhile (!passLengthOkay) {\r\n\t\t//choosing a password. Only requirement is 6-10 characters, but there could be more to improve security\r\n\t\tSystem.out.println(\"Please choose a Password with 6 to 10 characters:\");\r\n\t\tString password = input.nextLine();\r\n\t\t//again, seeing if the password is too long or short\r\n\t\t\tif (password.length()>10) {\r\n\t\t\t\tSystem.out.println(\"This password is too long; try again.\");\r\n\t\t\t}\r\n\t\t\telse if (password.length()<6) {\r\n\t\t\t\tSystem.out.println(\"This password is too short; try again\");\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t//for just a touch of security, the hashcode of the password is multiplied by a VERY big prime number, then the product\r\n\t\t\t\t//is divided by another large prime number, with the remainder being stored in the database.\r\n\t\t\t\tint passint = password.hashCode();\r\n\t\t\t\tint encryption = (passint*500003477)%1009747;\r\n\t\t\t\t//standard things banks ask when opening an account\r\n\t\t\t\tSystem.out.println(\"UCF requires an initial deposit of $25; how much would you like to deposit?\");\r\n\t\t\t\tString initDepo = input.nextLine();\r\n\t\t\t\tint initDeposit = Integer.parseInt(initDepo);\r\n\t\t\t\tSystem.out.println(\"UCF requires you to provide your full first and last name:\");\r\n\t\t\t\tString fullname = input.nextLine();\r\n\t\t\t\t//initialize the jointApply method, for applying for joint accounts\r\n\t\t\t\tboolean joint = jointApply();\r\n\t\t\t\t//all applicants are not approve AND not denied, shocking I know\r\n\t\t\t\tboolean approved = false;\r\n\t\t\t\tboolean denied = false;\r\n\t\t\t\t//to ensure each user has a unique ID, the lengths of both files are added together and used as the user ID\r\n\t\t\t\tint appID = appNum + userNum;\r\n//\t\t\t\tApplicants a = new Applicants(appID,appAttempt,joint, encryption,approved);\r\n\t\t\t\t//logging the creation of the new account\r\n\t\t\t\tlogger.info(\"Application for account made by \" + fullname);\r\n\t\t\t\t//adding the new applicant to the end of the applicants text file\r\n\t\t\t\tio.writeOutputStreamContents(System.getProperty(\"line.separator\") + \r\n\t\t\t\t\t\tappID + \":\" + appAttempt + \":\" + joint + \":\" + encryption+ \":\" + \r\n\t\t\t\t\t\tapproved + \":\" + denied + \":\" + initDeposit + \":\" + fullname, \"Applicants.txt\");\r\n\t\t\t\t//getting out of the while loop\r\n\t\t\t\tpassLengthOkay=true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t}\r\n\t\t\r\n\t}", "private static String readPassword() {\n\t\treturn consoleInput.nextLine();\r\n\t}", "String readFile(File file, String password);", "public static void main(String[] args) {\n\t\tSystem.out.println(\r\n\t\t\t\t\"Please provide a path to password protected PDF file in an appriopriate format i.e. C:\\\\Users\\\\User\\\\Documents\\\\File.pdf\");\r\n\t\tSystem.out.println(\"or press 'q' to quit to main menu\");\r\n\t\tString filePath = input.next();\r\n\t\t// if statement allowing to go back to main menu instead of typing in\r\n\t\t// file directory\r\n\t\tif (filePath.equals(\"q\") || (filePath.equals(\"Q\"))) {\r\n\t\t} else {\r\n\t\t\tstartAttack(filePath);\r\n\t\t}\r\n\t}", "static Map<String, String> readPasswdFile (File pwdFile) throws IOException {\n\t\tBufferedReader r = new BufferedReader(new FileReader(pwdFile));\n\t\tHashtable users = new Hashtable();\n\t\tString l = r.readLine();\n\t\twhile (l != null) {\n\t\t\tint hash = l.indexOf('#');\n\t\t\tif (hash != -1)\n\t\t\t\tl = l.substring(0, hash);\n\t\t\tl = l.trim();\n\t\t\tif (l.length() != 0) {\n\t\t\t\tStringTokenizer t = new StringTokenizer(l, \":\");\n\t\t\t\tString user = t.nextToken();\n\t\t\t\tString password = t.nextToken();\n\t\t\t\tusers.put(user, password);\n\t\t\t}\n\t\t\tl = r.readLine();\n\t\t}\n\t\tr.close();\n\t\treturn users;\n\t}", "public void login(){\n boolean found = false;\n //variables to iterate the file\n String email= \"\";\n String passkey= \"\";\n String admin = \"\";\n\n try{\n //read file\n input = new Scanner(new File(\"credential.txt\"));\n //email and password input from user\n usernamePass();\n //defining how to saperate one user from another in the file\n input.useDelimiter(\"[,\\n]\");\n //looping through all credentials until find the match\n while (input.hasNext() && !found){\n email = input.next();\n passkey = input.next();\n admin = input.next();\n //condition for matching the credential of user\n if(email.trim().equals(this.email.trim()) && passkey.trim().equals(pass.trim())) {\n found = true;\n //checking if the user is admin or not\n if(admin.trim().equals(\"true\")){\n System.out.printf(\"This is admin\\n\");\n adminPanel();\n }\n else {\n System.out.printf(\"This is not admin!\");\n userChoice();\n }\n System.out.printf(\"Hurrah\");\n }\n }\n System.out.printf(\"There is no such user. Try again.\");\n input.close();\n SignupOrLogin();\n// String c;\n// while(numOfUser != 0){\n// System.out.printf(numOfUser+\"\\n\");\n// numOfUser-=1;\n// }\n//\n// //reading credentials file to login\n// while ((c=bufferedReader.readLine())!=null){\n// System.out.printf(c+\"\\n\");\n// if(c.contains(username)){\n// System.out.printf(\"match fount\");\n// }\n// else {\n// System.out.printf(\"match not found.\");\n// }\n// }\n }catch (Exception e){\n System.out.printf(\"No such user. Try again with current credentials.\\n\");\n SignupOrLogin();\n }\n }", "public static boolean getUserChoice() throws IOException{\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\n\t\twhile (true){\n\t\t\t//print the message\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"Make a choice:\");\n\t\t\tSystem.out.println(\"1. Encrypt a file.\");\n\t\t\tSystem.out.println(\"2. Decrypt a file.\");\n\t\t\tSystem.out.println(\"3. Quit.\");\n\t\t\tSystem.out.print(\"[1/2/3]: \");\n\n\t\t\t//perform the action the user requests\n\t\t\ttry {\n\t\t\t\tint userChoice = Integer.parseInt(in.readLine());\n\t\t\t\tif (userChoice == 1) //user chooses \"Encrypt a file.\"\n\t\t\t\t\treturn true;\n\t\t\t\telse if (userChoice == 2) //user chooses \"Decrypt a file.\"\n\t\t\t\t\treturn false;\n\t\t\t\telse if (userChoice == 3) //user chooses \"Quit.\"\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\telse\n\t\t\t\t\tSystem.out.println(\"Invalid choice.\"); //catch invalid input\n\t\t\t} catch (NumberFormatException e){\n\t\t\t\tSystem.out.println(\"Invalid choice.\"); //invalid input here too\n\t\t\t}\n\t\t}\n\t}", "public void readAdmin(String fileName)\n {\n try\n {\n FileReader inputFile = new FileReader(fileName);\n Scanner parser = new Scanner(inputFile);\n String[] array = parser.nextLine().split(\";\");\n for(int index = 0; index < array.length; index++)\n {\n String[] elements = array[index].split(\",\");\n String account = elements[0];\n String password = elements[1];\n setAdmin(index, account, password);\n }\n }\n catch(FileNotFoundException exception)\n {\n System.out.println(fileName + \" not found\");\n }\n catch(IOException exception)\n {\n System.out.println(\"Unexpected I/O error occured\");\n }\n\n }", "public void showPasswordPrompt();", "@Test\n public void notPromptForPasswordIfuserNameIsGivenInFile() throws Exception {\n properties.setProperty(\"security-username\", \"user\");\n Mockito.doReturn(properties).when(connectCommand).loadProperties(ArgumentMatchers.any(File.class));\n result = ConnectCommandTest.gfshParserRule.executeCommandWithInstance(connectCommand, \"connect\");\n Mockito.verify(gfsh, Mockito.times(0)).readPassword(((CliStrings.CONNECT__PASSWORD) + \": \"));\n assertThat(properties).doesNotContainKey(\"security-password\");\n }", "public void readInPasswords(){\n String fileName = \"all_passwords.txt\";\n String nextLine = null;\n String [] temp;\n\n try{\n FileReader reader = new FileReader(fileName);\n BufferedReader bufferedReader = new BufferedReader(reader);\n \n while((nextLine = bufferedReader.readLine()) != null){\n temp = nextLine.split(\",\");\n if(temp[0].length() == 5)\n passwords.insertKey(temp[0], Double.parseDouble(temp[1]));\n }\n }catch(FileNotFoundException e){\n System.out.println(\"Unable to open file \" + fileName);\n }catch(IOException ex){\n System.out.println(\"Error reading file: \" + fileName);\n }\n \n }", "public static void main(String[] args) {\n\t\tStopWatch time = new StopWatch();\n\t\ttime.start();\n\n\t\t//read in the files\n\t\tFile linuxFile = new File(inFile);\n\t\tFile wordFile = new File(dictionary);\n\t\ttry {\n\t\t\tScanner fileScan = new Scanner(linuxFile);\n\t\t\tScanner dictScan = new Scanner(wordFile);\n\t\t\tpopulateWordList(dictScan);\n\n\n\t\t\tString lineText;\n\t\t\tString firstName;\n\t\t\tString lastName;\n\t\t\t//\t\t\tint lastnamePosition;\n\t\t\tString salt;\n\t\t\tString pw;\n\t\t\tString found;\n\t\t\tint countFound =0;\n\t\t\tint countTotal =0;\n\t\t\twhile(fileScan.hasNextLine()) {\n\t\t\t\tcountTotal++;\n\t\t\t\t//SCAN THROUGH EACH LINE, TRY TO CRACK THE PASSWORD FOR EACH PERSON\n\t\t\t\t//PARSE LINE\n\t\t\t\tint startIndex = 0;\n\t\t\t\tlineText = fileScan.nextLine();\n\t\t\t\tString[] arr = lineText.split(\":\");\n\n\t\t\t\tString name = arr[4];\n\t\t\t\tfirstName = name.split(\" \")[0];\n\t\t\t\tlastName = name.split(\" \")[1];\n\n\n\t\t\t\tstartIndex = lineText.indexOf(':') +1;\n\t\t\t\tsalt = lineText.substring(startIndex, startIndex+2);\n\t\t\t\tpw = lineText.substring(startIndex+2, lineText.indexOf(':', lineText.indexOf(':') + 1));\n\n\t\t\t\tSystem.out.println(\"first name: \" + firstName + \"\\tlast name: \" + lastName + \"\\tsalt: \" + salt + \"\\tpw: \" + pw);\n\n\t\t\t\tSystemUser user = new SystemUser(firstName, lastName, salt, pw);\n\n\t\t\t\tfound = crackPW(user);\n\t\t\t\tif(found != null) {\n\t\t\t\t\t//PRINT SOME STUFF\n\t\t\t\t\tcountFound++;\n\t\t\t\t\tSystem.out.println(\"password found!!!!\");\n\t\t\t\t\tSystem.out.println(\"Password: \" + found);\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(\"NOT FOUND\");\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t}\n\n\n\t\t\t}\n\t\t\tSystem.out.println(\"# of PW found: \" + countFound + \"\\tOut of: \" + countTotal);\n\n\t\t\tfileScan.close();\n\t\t\tdictScan.close();\n\t\t} \n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\ttime.stop();\n\t\tSystem.out.println(\"seconds: \" +time.time());\n\t}", "public static void main(String[] args){\n\t\tFile file = new File(\"C:\\\\Users\\\\Ezra Newman\\\\IdeaProjects\\\\Chordette\\\\src\\\\Extracted\");\n\t\t//List of all files and directories\n\t\tlistOfFiles(file);\n\t\tSystem.out.println(counter);\n\t\tSystem.out.println(filter);\n\t\tScanner scanner = new Scanner(System.in); // Create a Scanner object\n\t\twhile (true) {\n\t\t\tSystem.out.println(\"Password\");\n\n\t\t\tString pass = scanner.nextLine(); // Read user input\n\t\t\tSystem.out.println(filter.contains(pass) ? \"You have been hacked.\" : \"You haven't been hacked\"); // Output user input\n\t\t}\n\t}", "public static String askUserOutputMode()\n {\n\tString mode;\n\tSystem.out.println(\"This spell checker outputs misspelled words in \" +\n\t\t\t \"your file.\"); \n\tSystem.out.println(\"Shall the results be printed out (enter \\\"\" +\n\t\t\t PRINT + \"\\\") or written to a file (enter \\\"\" +\n\t\t\t WRITE_TO_FILE + \"\\\")?\");\n\tmode = userInput.next();\n\n\twhile(!mode.equalsIgnoreCase(PRINT) &&\n\t !mode.equalsIgnoreCase(WRITE_TO_FILE))\n\t {\n\t\tSystem.out.println(\"Hey! You have to enter one of these \" +\n\t\t\t\t \"options: \" + PRINT + \" or \" +\n\t\t\t\t WRITE_TO_FILE + \". Try again:\");\n\t\tmode = userInput.next();\n\t }\n\n\treturn mode;\n }", "public static void main(String[] args) throws FileNotFoundException {\n Scanner kb = new Scanner(System.in);\n System.out.println(\"Type something, please!\");\n String userString = kb.nextLine();\n System.out.print(\"Reverse order: \");\n char[] letters = userString.toCharArray();\n for (int i = letters.length-1; i >= 0; i--) {\n System.out.print(letters[i]);\n }\n System.out.println(\"\\n\");\n \n System.out.println(\"Enter a filename:\");\n userString = kb.nextLine();\n \n //use a scanner to read a file\n File f = new File(userString);\n Scanner fileScanner = new Scanner(f);\n while (fileScanner.hasNextLine()) {\n System.out.println(fileScanner.nextLine());\n }\n \n //user a scanner to scan individual string!\n System.out.println(\"Enter some string\");\n userString = kb.nextLine();\n Scanner lineScanner = new Scanner(userString);\n lineScanner.useDelimiter(\"-\");\n \n \n while (lineScanner.hasNext()) {\n System.out.println(lineScanner.next());\n }\n }", "public void userSettings(String userName, String password, File nameFile,File passFile, String fileadd) {\n try\n {\n \n if(!nameFile.exists())\n {\n nameFile.createNewFile();\n }\n if(!passFile.exists())\n {\n passFile.createNewFile();\n }\n \n FileReader ufr = new FileReader(nameFile);\n FileReader pfr = new FileReader(passFile);\n \n BufferedReader ubr = new BufferedReader(ufr);\n BufferedReader pbr = new BufferedReader(pfr);\n \n ArrayList<String> uName = new ArrayList<>();\n ArrayList<String> uPass = new ArrayList<>();\n for (int i = 0; i < lineNum(fileadd); i++) {\n uName.add(ubr.readLine());\n uPass.add(pbr.readLine());\n }\n for (int i = 0; i < lineNum(fileadd); i++) \n {\n if (userName.equals(uName.get(i)))\n {\n uPass.set(i, password);\n } \n }\n \n ufr.close();\n pfr.close();\n FileWriter fw = new FileWriter(passFile);\n PrintWriter pw = new PrintWriter(fw);\n pw.print(\"\");\n \n FileWriter fw2 = new FileWriter(passFile, true);\n PrintWriter pw2 = new PrintWriter(fw2, true);\n \n for (int j = 0; j < uPass.size() -1; j++)\n {\n \n pw.print(uPass.get(j));\n pw.println();\n \n }\n pw.close();\n }catch(Exception e)\n {\n e.printStackTrace();\n }\n \n }", "public static void login(){\n\t\ttry{\n\t\t\tFile Information = new File(\"information.txt\");\n\t\t\tFile Account = new File(\"account.txt\");\n\t\t\tArrayList<String> account = new ArrayList<String>();\n\t\t\tArrayList<String> info = new ArrayList<String>();\n\t\t\tScanner inputFromAccount = new Scanner(Account);\n\t\t\tScanner inputFromInformation = new Scanner(Information);\n\t\t\twhile (inputFromInformation.hasNextLine()){\n\t\t\t\tinfo.add(inputFromInformation.nextLine());\n\t\t\t}\n\t\t\twhile (inputFromAccount.hasNext()){\n\t\t\t\taccount.add(inputFromAccount.next());\n\t\t\t}\n\t\t\tboolean check=false;\n\t\t\tString PassWord=\"\";\n\t\t\tString UserName=\"\";\n\t\t\tString username=\"\";\n\t\t\tScanner input = new Scanner(System.in);\n\t\t\tdo{\n\t\t\t\tSystem.out.println(\"Enter your username\");\n\t\t\t\tusername = input.next();\n\t\t\t\tfor(int i=0; i<account.size()-1;i++){\n\t\t\t\t\tUserName=account.get(i);\n\t\t\t\t\tPassWord=account.get(i+1);\n\t\t\t\t\tif(UserName.equals(username)){\n\t\t\t\t\t\tSystem.out.println(\"Enter your password\");\n\t\t\t\t\t\tString password = input.next();\n\t\t\t\t\t\tif (PassWord.equals(password))check=true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!check)System.out.println(\"User not found! Please try again\");\n\t\t\t}while(!check);\n\t\t\tboolean checker=false;\n\t\t\tSystem.out.println(\"Login Successful!\");\n\t\t\tdo{\n\t\t\t\tSystem.out.println(\"Please enter \\n(1)to view your saved information\"\n\t\t\t\t\t\t+ \"\\n(2)to edit your saved information\"\n\t\t\t\t\t\t+ \"\\n(3)to logout\");\n\t\t\t\tint command = input.nextInt();\n\t\t\t\tboolean temp = false;\n\t\t\t\tif(command==1||command==2||command==3)checker=true;\n\t\t\t\telse System.out.println(\"Invalid Input! Please try again\");\n\t\t\t\tswitch(command){\n\t\t\t\tcase 1: viewInfo(username);break;\t\n\t\t\t\tcase 2: editInfo(username,temp);break;\n\t\t\t\tcase 3: starter();\n\t\t\t\t}\n\t\t\t}while(!checker);\n\t\t}\n\n\t\tcatch (java.io.IOException ex){\n\t\t\tSystem.out.println(\"I/O Errors: File is not found\");\n\t\t}\t\n\t}", "public static void main(String[] args) {\n\t// 1. Ask for an initial password, and store it in a variable\n String answer1 = JOptionPane.showInputDialog(null, \"What is the secret message?\"); \n\t// 2. Ask for a message and store it in a variable\n String answer2 = JOptionPane.showInputDialog(null, \"What is your password?\");\n\t// 3. Ask your friend for the password and store it in a variable\n String answer3 = JOptionPane.showInputDialog(\"Do you know the password?\");\n\t// 4. If the password matches,\n if (answer1.equals(answer3))\n {\n\tJOptionPane.showMessageDialog(null, \"\" + answer2);\t\n\t}\n else\n {\n \tJOptionPane.showMessageDialog(null, \"Your wrong.\");\n }\n\t\t// show the secret message\n\t// *5. OPTIONAL: let your friend keep guessing even if they are wrong\n\n}", "public void displayMenu() throws FileNotFoundException {\n\t\tfinal String BOOK_KEY = \"1234\";\n\t\tString option;\n\t\tString isbnSelection;\n\t\tString bookTitle;\n\t\tString displayBookOfType;\n\t\tint typeOfBook;\n\t\tint numOfRandomBooks;\n\t\tchar freqSelected;\n\n\t\tScanner in = new Scanner(System.in);\n\n\t\tSystem.out.printf(\"Welcome to the ABC Book Company: How may we assist you?%n\" + \"1. Checkout Book%n\"\n\t\t\t\t+ \"2. Find Books by Title%n\" + \"3. Display Books by Type%n\" + \"4. Produce Random Book List%n\"\n\t\t\t\t+ \"5. Save & Exit%n%n\");\n\n\t\tSystem.out.printf(\"Enter option: \");\n\t\toption = in.nextLine();\n\n\t\twhile (!option.equals(\"5\")) {\n\t\t\tswitch (option) {\n\t\t\tcase \"1\":\n\t\t\t\tSystem.out.printf(\"Enter the ISBN of book: \");\n\t\t\t\tisbnSelection = in.nextLine();\n\t\t\t\tcheckOutBook(isbnSelection);\n\t\t\t\tbreak;\n\t\t\tcase \"2\":\n\t\t\t\tSystem.out.printf(\"Enter the title to search for: \");\n\t\t\t\tbookTitle = in.nextLine();\n\t\t\t\tfindBookTitle(bookTitle);\n\t\t\t\tbreak;\n\t\t\tcase \"3\":\n\t\t\t\tSystem.out.printf(\"# Type%n\" + \"1. Children's Books%n\" + \"2. CookBooks%n\" + \"3. Paperbacks%n\"\n\t\t\t\t\t\t+ \"4. Periodicals%n%n\");\n\t\t\t\tSystem.out.printf(\"Enter type of book: \");\n\n\t\t\t\tdisplayBookOfType = in.nextLine();\n\t\t\t\t\n\t\t\t\tif (BOOK_KEY.contains(displayBookOfType)&&displayBookOfType.length()==1) {\n\t\t\t\t\ttypeOfBook = Integer.parseInt(displayBookOfType);\n\t\t\t\t\tif (typeOfBook == 4) {\n\t\t\t\t\t\tSystem.out.printf(\"%nEnter a frequency (D for Daily, W for Weekly, \"\n\t\t\t\t\t\t\t\t+ \"M for Monthly, B for Biweekly, or Q for Quarterly): \");\n\t\t\t\t\t\tfreqSelected = in.nextLine().charAt(0);\n\t\t\t\t\t\tshowBookType(typeOfBook, freqSelected); // displayFrequency method needed!\n\t\t\t\t\t} else {\n\t\t\t\t\t\tshowBookType(typeOfBook);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tSystem.out.println(\"Enter a valid book type (1-4):\\n\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\tcase \"4\":\n\t\t\t\tSystem.out.printf(\"Enter number of books: \");\n\t\t\t\ttry {\n\t\t\t\t\tnumOfRandomBooks = Integer.parseInt(in.nextLine());\n\t\t\t\t\tif (numOfRandomBooks <= 50 && numOfRandomBooks >= 0) {\n\t\t\t\t\t\tproduceRandomBookList(numOfRandomBooks);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tSystem.out.println(\"Wrong user Input. Please use an appropriate number from 1-50.\");\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t}\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tSystem.out.println(\"Wrong user Input. Please use an appropriate number from 1-50.\");\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Please enter an appropriate choice (1-4):\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.printf(\"Welcome to the ABC Book Company: How may we assist you?%n\" + \"1. Checkout Book%n\"\n\t\t\t\t\t+ \"2. Find Books by Title%n\" + \"3. Display Books by Type%n\" + \"4. Produce Random Book List%n\"\n\t\t\t\t\t+ \"5. Save & Exit%n%n\");\n\n\t\t\tSystem.out.printf(\"Enter option: \");\n\n\t\t\toption = in.nextLine();\n\t\t}\n\t\tsaveBook();\n\t\tin.close();\n\t}", "private static String loginMenu(){\n\t\tSystem.out.println(\"==================================\");\n\t\tSystem.out.println(\"Welcome to the Registration System\");\n\t\tSystem.out.println(\"Please select from the following:\");\n\t\tSystem.out.println(\"1. Login\");\n\t\tSystem.out.println(\"2. Request Access\");\n\t\tSystem.out.println(\"3. Exit\");\n\t\tSystem.out.print(\"Enter the number of you request: \"); \n\t\tString selection = input.nextLine();\n\t\tSystem.out.println(\"\");\n\t\treturn selection;\n\t}", "private int showMenu() {\n System.out.println(\"\\nWelcome to PasswordManager!\");\n System.out.println(\"Choose from the following options:\");\n System.out.println(\"1. Get a username and password for a website.\");\n System.out.println(\"2. Add a website's username and password to the database.\");\n System.out.println(\"3. Delete a website's username and password from the database.\");\n System.out.println(\"4. Change a username for a website.\");\n System.out.println(\"5. Change a password for a website\");\n System.out.println(\"6. Delete your user. WARNING: This will delete all of your saved usernames and passwords.\");\n System.out.println(\"7. Print all websites and usernames in the database.\");\n System.out.println(\"8. Quit.\");\n\n return input.nextInt();\n }", "public void openFile(){\n\t\ttry{\n\t\t\t//input = new Scanner (new File(\"input.txt\")); // creates file \"input.txt\" or will rewrite existing file\n\t\t\tFile inFile = new File(\"input.txt\");\n\t\t\tinput = new Scanner(inFile);\n\t\t\t//for (int i = 0; i < 25; i ++){\n\t\t\t\t//s = input.nextLine();\n\t\t\t\t//System.out.println(s);\n\t\t\t//}\n\t\t}catch (SecurityException securityException){ // catch errors\n\t\t\tSystem.err.println (\"You do not have the write access to this file.\");\n\t\t\tSystem.exit(1);\n\t\t}catch (FileNotFoundException fnf){// catch errors\n\t\t\tSystem.err.println (\"Trouble opening file\");\n\t\t\tSystem.exit(1);\n\t\t}\n\t}", "private String getPassword(){\n System.out.println(\"Enter the Password Minimum Of 8 Charters\");\n return sc.next();\n }", "protected static <T> T promptUserForSelection(BufferedReader console, Map<Integer, T> options, Function<T, String> optionToString) {\n T userSelectedOption = null;\n\n System.out.print(\"Please select one from the list above.\\n> \");\n while (userSelectedOption == null) {\n try {\n userSelectedOption = options.get(Integer.parseInt(console.readLine().trim()));\n } catch (Exception ignored) {\n }\n\n if (userSelectedOption == null) {\n System.out.print(\"\\nInvalid selection, please try again.\\n> \");\n }\n }\n System.out.println(\"\\nYou selected: \" + optionToString.apply(userSelectedOption) + \"\\n\");\n\n return userSelectedOption;\n }", "private static File InputFileName(String UserPrompt) {\n\t\t\n\t\tJFileChooser\tchooser = new JFileChooser();\t//file chooser object for dialog box interface to file structure\n\t\tboolean \t\tgoodInput = false;\t\t\t\t//flag for whether the input provided by the user is acceptable\n\t\tFile \t\t\tselectedFile = null;\t\t\t//the file selected by the user\n\t\tString \t\t\tinLine;\t\t\t\t\t\t\t//input from user: used to wait for user to press \"Enter\" on the keyboard\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\tScanner scan = new Scanner(System.in);\n\t\t\twhile (!goodInput) {\n\t\t\t\t\n\t\t\t\t//prompt user for input\n\t\t\t\tSystem.out.printf(UserPrompt);\n\t\t\t\tinLine = scan.nextLine();\n\n\n\t\t\t\t\n\t\t\t\t//user selected a valid file\n\t\t\t\tif (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {\n\t\t\t\t\tselectedFile = chooser.getSelectedFile();\n\t\t\t\t\tgoodInput = true;\n\t\t\t\t}//if\n\t\t\t\t\n\t\t\t\t//user failed to select a valid file\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.printf(\"File for input must be selected.\\n\\n\");\n\t\t\t\t\tSystem.out.printf(UserPrompt);\n\t\t\t\t\tinLine = scan.nextLine();\n\t\t\t\t}//else\n\t\t\t}//while\n\t\t}//try\n\t\tcatch (Exception e) {\n\t\t\tSystem.err.println(e);\n\t\t}//catch\n\t\t\n\t\treturn selectedFile;\n\t\t\n\t}", "public static void menu()\r\n {\n\t\t Scanner scan = new Scanner(System.in);\r\n\t\t System.out.println(\"Please enter your choice : \");\r\n\t\t int choice = scan.nextInt();\r\n\t\t switch(choice)\r\n\t\t {\r\n\t\t case 1:\r\n\t\t\t viewFiles();\r\n\t\t\t goback();\r\n\t\t\t break;\r\n\t\t case 2: \r\n\t\t\t createNew();\r\n\t\t\t goback();\r\n\t\t\t break;\r\n\t\t case 3: \r\n\t\t\t searchFile();\r\n\t\t\t goback();\r\n\t\t\t break;\r\n\t\t case 4: \r\n\t\t deleteFile();\r\n\t\t goback();\r\n\t\t break;\r\n\t\t case 5: \r\n\t\t\t exit();\r\n\t\t\t goback();\r\n\t\t\t break;\r\n\t\t \r\n\t\t default :\r\n\t\t\t System.out.println(\"please enter a only 1,2,3 or 4\");\r\n\t\t\t goback();\r\n\t }\r\n\t }", "private static void task42() {\n char[] pass = null;\n Console con = System.console();\n if(con != null){\n try {\n pass = con.readPassword(\"Enter your password:\");\n System.out.println(\"Your password is \" + new String(pass));\n }\n finally {\n if(pass!=null){\n System.out.println(\"Yur pass -\"+pass);\n }\n }\n }else {\n throw new RuntimeException(\"Can't get password...No console\");\n }\n\n }", "public static void userChoice(ATMAccount account) throws FileNotFoundException, IOException, InterruptedException{\r\n\t\tint selection = 0;\r\n\t\tdo {\r\n\t\t\tSystem.out.println(\"Please select one of the following: \" + \"\\n1 = Request ID \\n2 = Balance Inquiry\"\r\n\t\t\t\t\t+ \"\\n3 = Deposit Money\\n4 = Withdraw Money \" + \" \\n5 = Go Back to Start Screen\"+\r\n\t\t\t\t\t\"\\n6 = Exit\");\r\n\t\t\tselection = userInput.nextInt();\r\n\t\t\tswitch (selection) {\r\n\t\t\tcase 1:\r\n\t\t\t\tSystem.out.println(\"Requesting ID number...\");\r\n\t\t\t\tSystem.out.println(\"Account ID: \"+ account.getID());\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tSystem.out.println(\"Your balance is: \" + moneyFormatter.format(account.getBalance()));\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tdepositMoney(account);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\twithdrawMoney(account);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 5:\r\n\t\t\t\tATMStartScreen();\r\n\t\t\t\tbreak;\r\n\t\t\tcase 6:\r\n\t\t\t\tSystem.exit(0);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tSystem.out.println(\"What are you doing mate?\");\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t} while (selection != 5);\r\n\r\n\t}", "static void searchForFile() {\n\t\ttry {\n\t\t\t// Get the path for the user's current shared and not-shared directories\n\t\t\tFile sharedPath = new File(\"users/\" + username + \"/shared\");\n\t\t\tFile notSharedPath = new File(\"users/\" + username + \"/not-shared\");\n\n\t\t\t// Allow the user to enter the name of the file they want to search for\n\t\t\tSystem.out.println(\"Enter the name of the file you wish to search for followed by Enter\");\n\t\t\tSystem.out.print(\"Your Entry: \");\n\n\t\t\tString fileToSearchFor = input.readLine();\n\n\t\t\t// Create an array of filenames for the shared and not-shared files\n\t\t\tFile[] sharedFiles = sharedPath.listFiles();\n\t\t\tFile[] notSharedFiles = notSharedPath.listFiles();\n\n\t\t\t// Check through the shared files array to see if the user already owns the file and is sharing it\n\t\t\tfor (File file : sharedFiles) {\n\t\t\t\tif (fileToSearchFor.equals(file.getName())) {\n\t\t\t\t\t// If it exists, tell the user and prompt to exit\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\tSystem.out.println(\"You already own the file: \" + fileToSearchFor);\n\t\t\t\t\tSystem.out.println(\"It is in your shared files.\");\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t// This has been added in order to allow the user to review the results before going back to the main menu\n\t\t\t\t\t// Upon pressing Enter, the main menu will come back up again and ready for a new menu option to be selected\n\t\t\t\t\ttry {\n\t\t\t\t\t\tSystem.out.println(\"Press any key to return\");\n\t\t\t\t\t\tinput.readLine();\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tSystem.out.println(\"Error! \" + e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check through the not-shared files array to see if the user already owns the file and is not sharing it\n\t\t\tfor (File file : notSharedFiles) {\n\t\t\t\tif (fileToSearchFor.equals(file.getName())) {\n\t\t\t\t\t// If it exists, tell the user and prompt to exit\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\tSystem.out.println(\"You already own the file: \" + fileToSearchFor);\n\t\t\t\t\tSystem.out.println(\"It is in your non-shared files.\");\n\t\t\t\t\tSystem.out.println();\n\t\t\t\t\t// This has been added in order to allow the user to review the results before going back to the main menu\n\t\t\t\t\t// Upon pressing Enter, the main menu will come back up again and ready for a new menu option to be selected\n\t\t\t\t\ttry {\n\t\t\t\t\t\tSystem.out.println(\"Press any key to return\");\n\t\t\t\t\t\tinput.readLine();\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tSystem.out.println(\"Error! \" + e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Otherwise, this means the user does not have the file\n\t\t\t// In this case, send a request to the server via CORBA to see who owns the file\n\t\t\tString[] usersWithFile = server.findFile(fileToSearchFor);\n\t\t\t// If no one owns a file by this name that is available for sharing, let the user know\n\t\t\tif(usersWithFile.length == 0){\n\t\t\t\tSystem.out.println(\"No match was found for: '\"+ fileToSearchFor + \"'\");\n\t\t\t\tSystem.out.println(\"It does not exist, or is not currently being shared.\");\n\t\t\t}\n\t\t\t// Otherwise a match was found\n\t\t\t// Give the user an option to download the file and share it, download the file and keep it in their not-shared directory, or return to the main menu\n\t\t\t// Keep the owner of the file's information hidden from the user\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"A match for : \"+ fileToSearchFor + \" was found.\");\n\t\t\t\tSystem.out.println(\"Would you like to download the file?\");\n\t\t\t\tSystem.out.println(\"\\t[1] | Download And Share The File\");\n\t\t\t\tSystem.out.println(\"\\t[2] | Download And Do Not Share The File\");\n\t\t\t\tSystem.out.println(\"\\t[3] | Return To The Main Menu\");\n\t\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\t\tSystem.out.print(\"Your Entry: \");\n\t\t\t\tString userEntry = input.readLine();\n\n\t\t\t\t// If the user enters 1, start the download file method with the flag of 1\n\t\t\t\tif(userEntry.equals(\"1\")){\n\t\t\t\t\tdownloadFile(usersWithFile, fileToSearchFor, 1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If the user enters 2, start the download file method with the flag of 2\n\t\t\t\telse if (userEntry.equals(\"2\")) {\n\t\t\t\t\tdownloadFile(usersWithFile, fileToSearchFor, 2);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// If the user enters 3, bring them back to the main menu\n\t\t\t\telse if (userEntry.equals(\"3\")){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Otherwise, they entered something invalid, return to the main menu\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.println(\"Invalid entry! Returning to the main menu.\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"Error! : \" + e.getMessage());\n\t\t\treturn;\n\t\t}\n System.out.println();\n\t\t// This has been added in order to allow the user to review the results before going back to the main menu\n\t\t// Upon pressing Enter, the main menu will come back up again and ready for a new menu option to be selected\n try {\n System.out.println(\"Press any key to return\");\n input.readLine();\n } catch (Exception e) {\n System.out.println(\"Error! \" + e.getMessage());\n }\n\t}", "public static void main(String[] args) {\n\t\tint accountInput = -1;\r\n\t\twhile(accountInput != 5){\r\n\t\t\tSystem.out.println(\"\\nWelcome to the bank.\\n 1) Existing Account Holder\\n 2) Open a New Account\\nWhat would you like to do? \");\r\n\t\t\tScanner s = new Scanner(System.in);\r\n\t\t\tint mainInput = s.nextInt();\r\n\t\t\tif(mainInput == 1){\r\n\t\t\t\tFileWriter fw = null;\r\n\t\t\t\tPrintWriter pw = null;\r\n\t\t\t\tFileReader fr = null;\r\n\t\t\t\tBufferedReader br = null;\r\n\t\t\t\tboolean incorrectLogin = true;\r\n\t\t\t\tString username = null;\r\n\t\t\t\tString password = null;\r\n\t\t\t\tString line = null;\r\n\t\t\t\tCheckingAccount C;\r\n\t\t\t\tCheckingAccount C1;\r\n\t\t\t\tSavingsAccount S;\r\n\t\t\t\tSavingsAccount S1;\r\n\t\t\t\tboolean quit = true;\r\n\t\t\t\tboolean filenotfound = false;\r\n\t\t\t\tboolean quitstate = false;\r\n\t\t\t\twhile(incorrectLogin){\r\n\t\t\t\t\tSystem.out.println(\"Username: \");\r\n\t\t\t\t\tusername = s.next();\r\n\t\t\t\t\tif(quitstate){\r\n\t\t\t\t\t\tif(username.equals(\"q\")) break;\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tquitstate = false;\r\n\t\t\t\t\t\t\tquit = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tfr = new FileReader(\"./Users.txt\");\r\n\t\t\t\t\t\tbr = new BufferedReader(fr);\r\n\t\t\t\t\t\tline = br.readLine();\r\n\t\t\t\t\t\twhile(line != null){\r\n\t\t\t\t\t\t\tString[] arr = line.split(\" \");\r\n\t\t\t\t\t\t\tif(username.equals(arr[0])){\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Password: \");\r\n\t\t\t\t\t\t\t\tpassword = s.next();\r\n\t\t\t\t\t\t\t\tif(password.equals(arr[1])){\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"Welcome to your accounts, \" + username + \".\");\r\n\t\t\t\t\t\t\t\t\tquit = false;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tline = br.readLine();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(quit){\r\n\t\t\t\t\t\t\tincorrectLogin = true;\r\n\t\t\t\t\t\t\tSystem.out.println(\"Iím sorry, but that username and password does not match any at our bank. Please try again (or enter \\'q\\' to return to the main menu).\");\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tquitstate = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse incorrectLogin = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcatch(FileNotFoundException e){\r\n\t\t\t\t\t\tSystem.out.println(\"Iím sorry, but that username and password does not match any at our bank. Please try again (or enter \\'q\\' to return to the main menu).\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfilenotfound = true;\r\n\t\t\t\t\t\tincorrectLogin = false;\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tfw = new FileWriter(\"./Users.txt\");\r\n\t\t\t\t\t\t} catch (IOException e1) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpw = new PrintWriter(fw);\r\n\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!quit){\r\n\t\t\t\t\tString [] arr = line.split(\" \");\r\n\t\t\t\t\tC = new CheckingAccount(Double.parseDouble(arr[2]));\r\n\t\t\t\t\tC1 = C;\r\n\t\t\t\t\tif(C.getBalance() + Double.parseDouble(arr[3]) < 1000 ){\r\n\t\t\t\t\t\tS = new Basic(Double.parseDouble(arr[3]));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(C.getBalance() + Double.parseDouble(arr[3]) < 10000 ){\r\n\t\t\t\t\t\tS = new Premium(Double.parseDouble(arr[3]));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tS = new Deluxe(Double.parseDouble(arr[3]));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tS1 = S;\r\n\t\t\t\t\twhile(accountInput!=5){\r\n\t\t\t\t\t\tSystem.out.println(\"\\n 1) View Account Information\\n 2) Make a Deposit\\n 3) Make a Withdrawal\\n 4) Determine Balance in x Years\\n 5) Logout \\nWhat would you like to do? \");\r\n\t\t\t\t\t\taccountInput = s.nextInt();\r\n\t\t\t\t\t\tif(accountInput == 1){\r\n\t\t\t\t\t\t\tSystem.out.println(\"You have a Checking account with a balance of $ \" + C.getBalance());\r\n\t\t\t\t\t\t\tSystem.out.println(\"You have a \" + S.getAccountType() + \" account with a balance of $ \" + S.getBalance());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(accountInput == 2){\r\n\t\t\t\t\t\t\tSystem.out.println(\"Here are the accounts you have: \\n 1) Checking\\n 2) \" + S.getAccountType() + \"\\nInto which account would you like to make a deposit?\");\r\n\t\t\t\t\t\t\tint depIn = s.nextInt();\r\n\t\t\t\t\t\t\tif(depIn == 1){\r\n\t\t\t\t\t\t\t\tboolean Negative = true;\r\n\t\t\t\t\t\t\t\tdouble checkingsDeposit = 0;\r\n\t\t\t\t\t\t\t\tboolean tryagain = false;\r\n\t\t\t\t\t\t\t\twhile(Negative){\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"How much to deposit into your checking account? \");\r\n\t\t\t\t\t\t\t\t\tif(s.hasNextDouble()){\r\n\t\t\t\t\t\t\t\t\t\tcheckingsDeposit = s.nextDouble();\t\r\n\t\t\t\t\t\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\\"\" + s.next() + \"\\\" is not a valid amount.\");\r\n\t\t\t\t\t\t\t\t\t\ttryagain = true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(!tryagain){\r\n\t\t\t\t\t\t\t\t\t\tif(checkingsDeposit > 0) Negative = false;\r\n\t\t\t\t\t\t\t\t\t\telse System.out.println(\"You are not allowed to deposit a negative amount.\");\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"$\" + checkingsDeposit + \" has been deposited into your checking account\");\r\n\t\t\t\t\t\t\t\tC1 = new CheckingAccount(C.getBalance() + checkingsDeposit);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(depIn == 2){\r\n\t\t\t\t\t\t\t\tboolean Negative = true;\r\n\t\t\t\t\t\t\t\tdouble savingsDeposit = 0;\r\n\t\t\t\t\t\t\t\tboolean tryagain = false;\r\n\t\t\t\t\t\t\t\twhile(Negative){\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"How much to deposit into your \" + S.getAccountType() + \" account? \");\r\n\t\t\t\t\t\t\t\t\tif(s.hasNextDouble()){\r\n\t\t\t\t\t\t\t\t\t\tsavingsDeposit = s.nextDouble();\t\r\n\t\t\t\t\t\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\\"\" + s.next() + \"\\\" is not a valid amount.\");\r\n\t\t\t\t\t\t\t\t\t\ttryagain = true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(!tryagain){\r\n\t\t\t\t\t\t\t\t\t\tif(savingsDeposit > 0) Negative = false;\r\n\t\t\t\t\t\t\t\t\t\telse System.out.println(\"You are not allowed to deposit a negative amount.\");\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"$\" + savingsDeposit + \" has been deposited into your \" + S.getAccountType() + \" account\");\r\n\t\t\t\t\t\t\t\tS1 = new SavingsAccount(S.getBalance() + savingsDeposit);\r\n\t\t\t\t\t\t\t\tif(S1.getBalance() + C1.getBalance() < 1000){\r\n\t\t\t\t\t\t\t\t\tS1 = new Basic(S1.getBalance());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if(S1.getBalance() + C1.getBalance() < 10000){\r\n\t\t\t\t\t\t\t\t\tS1 = new Premium(S1.getBalance());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\tS1 = new Deluxe(S1.getBalance());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(accountInput == 3){\r\n\t\t\t\t\t\t\tSystem.out.println(\"Here are the accounts you have: \\n 1) Checking\\n 2) \" + S.getAccountType() + \"\\nFrom which account would you like to withdraw?\");\r\n\t\t\t\t\t\t\tint withOut = s.nextInt();\r\n\t\t\t\t\t\t\tif(withOut == 1){\r\n\t\t\t\t\t\t\t\tboolean Negative = true;\r\n\t\t\t\t\t\t\t\tboolean TooMuch = true;\r\n\t\t\t\t\t\t\t\tdouble checkingsWithdrawal = 0;\r\n\t\t\t\t\t\t\t\tboolean tryagain = false;\r\n\t\t\t\t\t\t\t\twhile(Negative||TooMuch){\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"How much to withdraw? \");\r\n\t\t\t\t\t\t\t\t\tif(s.hasNextDouble()){\r\n\t\t\t\t\t\t\t\t\t\tcheckingsWithdrawal= s.nextDouble();\t\r\n\t\t\t\t\t\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\\"\" + s.next() + \"\\\" is not a valid amount.\");\r\n\t\t\t\t\t\t\t\t\t\ttryagain = true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(!tryagain){\r\n\t\t\t\t\t\t\t\t\t\tif(checkingsWithdrawal > C.getBalance()){\r\n\t\t\t\t\t\t\t\t\t\t\tNegative = false;\r\n\t\t\t\t\t\t\t\t\t\t\tTooMuch = true;\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You do not have $\" + checkingsWithdrawal + \" in your checking account.\");\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse if(checkingsWithdrawal > 0){\r\n\t\t\t\t\t\t\t\t\t\t\tNegative = false;\r\n\t\t\t\t\t\t\t\t\t\t\tTooMuch = false;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You are not allowed to withdrawal a negative amount.\");\r\n\t\t\t\t\t\t\t\t\t\t\tNegative = true;\r\n\t\t\t\t\t\t\t\t\t\t\tTooMuch = false;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"$\" + checkingsWithdrawal + \" withdrawn from your checking account\");\r\n\t\t\t\t\t\t\t\tC1 = new CheckingAccount(C.getBalance() - checkingsWithdrawal);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(withOut == 2){\r\n\t\t\t\t\t\t\t\tboolean Negative = true;\r\n\t\t\t\t\t\t\t\tboolean TooMuch = true;\r\n\t\t\t\t\t\t\t\tdouble savingsWithdrawal = 0;\r\n\t\t\t\t\t\t\t\tboolean tryagain = false;\r\n\t\t\t\t\t\t\t\twhile(Negative||TooMuch){\r\n\t\t\t\t\t\t\t\t\tSystem.out.println(\"How much to withdraw? \");\r\n\t\t\t\t\t\t\t\t\tif(s.hasNextDouble()){\r\n\t\t\t\t\t\t\t\t\t\tsavingsWithdrawal= s.nextDouble();\t\r\n\t\t\t\t\t\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"\\\"\" + s.next() + \"\\\" is not a valid amount.\");\r\n\t\t\t\t\t\t\t\t\t\ttryagain = true;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(!tryagain){\r\n\t\t\t\t\t\t\t\t\t\tif(savingsWithdrawal > C.getBalance()){\r\n\t\t\t\t\t\t\t\t\t\t\tNegative = false;\r\n\t\t\t\t\t\t\t\t\t\t\tTooMuch = true;\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You do not have $\" + savingsWithdrawal + \" in your \" + S.getAccountType() + \" account.\");\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse if(savingsWithdrawal > 0){\r\n\t\t\t\t\t\t\t\t\t\t\tNegative = false;\r\n\t\t\t\t\t\t\t\t\t\t\tTooMuch = false;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t\t\tSystem.out.println(\"You are not allowed to withdrawal a negative amount.\");\r\n\t\t\t\t\t\t\t\t\t\t\tNegative = true;\r\n\t\t\t\t\t\t\t\t\t\t\tTooMuch = false;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"$\" + savingsWithdrawal + \" withdrawn from your \" + S.getAccountType() + \" account.\");\r\n\t\t\t\t\t\t\t\tS1 = new SavingsAccount(S.getBalance() - savingsWithdrawal);\r\n\t\t\t\t\t\t\t\tif(S1.getBalance() + C1.getBalance() < 1000){\r\n\t\t\t\t\t\t\t\t\tS1 = new Basic(S1.getBalance());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse if(S1.getBalance() + C1.getBalance() < 10000){\r\n\t\t\t\t\t\t\t\t\tS1 = new Premium(S1.getBalance());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\tS1 = new Deluxe(S1.getBalance());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(accountInput == 4){\r\n\t\t\t\t\t\t\tSystem.out.println(\"In how many years? \");\r\n\t\t\t\t\t\t\tint years = s.nextInt();\r\n\t\t\t\t\t\t\tSystem.out.println(\"Your \" + S.getAccountType() + \" account will have the following: \");\r\n\t\t\t\t\t\t\tSystem.out.println(\"Year Amount Interest \");\r\n\t\t\t\t\t\t\tSystem.out.println(\"---- ------ --------\");\r\n\t\t\t\t\t\t\tfor(int i = 0; i < years; i ++){\r\n\t\t\t\t\t\t\t\tSystem.out.print(i + \" $\");\r\n\t\t\t\t\t\t\t\tSystem.out.printf(\"%.2f\", S1.getBalanceAfterNumYears(i));\r\n\t\t\t\t\t\t\t\tSystem.out.print(\" $\");\r\n\t\t\t\t\t\t\t\tSystem.out.printf(\"%.2f\", S1.getBalanceAfterNumYears(i+1)-S1.getBalanceAfterNumYears(i));\r\n\t\t\t\t\t\t\t\tSystem.out.println();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tSystem.out.print(years + \" $\");\r\n\t\t\t\t\t\t\tSystem.out.printf(\"%.2f\", S1.getBalanceAfterNumYears(years));\r\n\t\t\t\t\t\t\tSystem.out.println();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse if(accountInput == 5){\r\n\t\t\t\t\t\t\tSystem.out.println(\"Thank you for coming to the bank!\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(accountInput == 2 || accountInput == 3){\r\n\t\t\t\t\t\t\tline = null;\r\n\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\tfr = new FileReader(\"./Users.txt\");\r\n\t\t\t\t\t\t\t\tbr = new BufferedReader(fr);\r\n\t\t\t\t\t\t\t\tString totalText = \"\";\r\n\t\t\t\t\t\t\t\twhile((line = br.readLine()) != null){\r\n\t\t\t\t\t\t\t\t\ttotalText += line + '\\n';\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tString text = username + \" \" + password + \" \" + C.getBalance() + \" \" + S.getBalance();\r\n\t\t\t\t\t\t\t\tString text1 = username + \" \" + password + \" \" + C1.getBalance() + \" \" + S1.getBalance();\r\n\t\t\t\t\t\t\t\ttotalText = totalText.replaceAll(text,text1);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tfw = new FileWriter(\"./Users.txt\");\r\n\t\t\t\t\t\t\t\tpw = new PrintWriter(fw);\r\n\t\t\t\t\t\t\t\tpw.write(totalText);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcatch(FileNotFoundException e){\r\n\t\t\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\tfw.close();\r\n\t\t\t\t\t\t\t\tbr.close();\r\n\t\t\t\t\t\t\t\tfr.close();\r\n\t\t\t\t\t\t\t\tpw.flush();\r\n\t\t\t\t\t\t\t\tpw.close();\r\n\t\t\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(mainInput == 2){\r\n\t\t\t\tFileWriter fw = null;\r\n\t\t\t\tPrintWriter pw = null;\r\n\t\t\t\tFileReader fr = null;\r\n\t\t\t\tBufferedReader br = null;\r\n\t\t\t\tboolean nameTaken = true;\r\n\t\t\t\tString username = null;\r\n\t\t\t\tboolean quit = false;\r\n\t\t\t\tboolean filenotfound = false;\r\n\t\t\t\tboolean quitstate = false;\r\n\t\t\t\twhile(nameTaken){\r\n\t\t\t\t\tSystem.out.println(\"Username: \");\r\n\t\t\t\t\tusername = s.next();\r\n\t\t\t\t\tif(quitstate){\r\n\t\t\t\t\t\tif(username.equals(\"q\")) break;\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tquitstate = false;\r\n\t\t\t\t\t\t\tquit = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tfr = new FileReader(\"./Users.txt\");\r\n\t\t\t\t\t\tbr = new BufferedReader(fr);\r\n\t\t\t\t\t\tString line = br.readLine();\r\n\t\t\t\t\t\twhile(line != null){\r\n\t\t\t\t\t\t\tString[] arr = line.split(\" \");\r\n\t\t\t\t\t\t\tif(username.equals(arr[0])){\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Iím sorry, but the username \\\" \" + username + \"\\\" is already associated with an account. Please try again (or enter \\'q\\' to return to the main menu).\");\r\n\t\t\t\t\t\t\t\tquit = true;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tline = br.readLine();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(quit){\r\n\t\t\t\t\t\t\tnameTaken = true;\r\n\t\t\t\t\t\t\tquitstate = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse nameTaken = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcatch(FileNotFoundException e){\r\n\t\t\t\t\t\tfilenotfound = true;\r\n\t\t\t\t\t\tnameTaken = false;\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tfw = new FileWriter(\"./Users.txt\");\r\n\t\t\t\t\t\t} catch (IOException e1) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpw = new PrintWriter(fw);\r\n\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(!quit){\r\n\t\t\t\t\tif(!filenotfound){\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tfw = new FileWriter(\"./Users.txt\", true);\r\n\t\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpw = new PrintWriter(fw);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tSystem.out.println(\"Great, that username is not in use!\");\r\n\t\t\t\t\tSystem.out.println(\"Password: \");\r\n\t\t\t\t\tString password = s.next();\r\n\t\t\t\t\tpw.print(username + \" \" + password + \" \");\r\n\t\t\t\t\t\r\n\t\t\t\t\tboolean Negative = true;\r\n\t\t\t\t\tdouble checkingsDeposit = 0;\r\n\t\t\t\t\tboolean tryagain = false;\r\n\t\t\t\t\twhile(Negative){\r\n\t\t\t\t\t\tSystem.out.println(\"How much would you like to deposit in checking? \");\r\n\t\t\t\t\t\tif(s.hasNextDouble()){\r\n\t\t\t\t\t\t\tcheckingsDeposit = s.nextDouble();\t\r\n\t\t\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tSystem.out.println(\"\\\"\" + s.next() + \"\\\" is not a valid amount.\");\r\n\t\t\t\t\t\t\ttryagain = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(!tryagain){\r\n\t\t\t\t\t\t\tif(checkingsDeposit > 0) Negative = false;\r\n\t\t\t\t\t\t\telse System.out.println(\"You are not allowed to deposit a negative amount.\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tCheckingAccount C = new CheckingAccount(checkingsDeposit);\r\n\t\t\t\t\t\r\n\t\t\t\t\tNegative = true;\r\n\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\tdouble savingsDeposit = 0;\r\n\t\t\t\t\twhile(Negative){\r\n\t\t\t\t\t\tSystem.out.println(\"How much would you like to deposit in savings? \");\r\n\t\t\t\t\t\tif(s.hasNextDouble()){\r\n\t\t\t\t\t\t\tsavingsDeposit = s.nextDouble();\r\n\t\t\t\t\t\t\ttryagain = false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\tSystem.out.println(\"\\\"\" + s.next() + \"\\\" is not a valid amount.\");\r\n\t\t\t\t\t\t\ttryagain = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(!tryagain){\r\n\t\t\t\t\t\t\tif(savingsDeposit > 0) Negative = false;\r\n\t\t\t\t\t\t\telse System.out.println(\"You are not allowed to deposit a negative amount.\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tpw.println(checkingsDeposit + \" \" + savingsDeposit + \" \");\r\n\t\t\t\t\tif(savingsDeposit + C.getBalance() < 1000.00){\r\n\t\t\t\t\t\tBasic S = new Basic(savingsDeposit);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(savingsDeposit + C.getBalance() < 10000.00){\r\n\t\t\t\t\t\tPremium S = new Premium(savingsDeposit);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tDeluxe S = new Deluxe(savingsDeposit);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tfw.close();\r\n\t\t\t\t\t\tbr.close();\r\n\t\t\t\t\t\tfr.close();\r\n\t\t\t\t\t\tpw.flush();\r\n\t\t\t\t\t\tpw.close();\r\n\t\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void main(String[]args){\r\n \r\n \r\n String clave=\"Jeanpool\";\r\n String pass=\"\";\r\n while(clave.equals(pass) == false){\r\n pass=JOptionPane.showInputDialog(\"Introduce la contraseña , porfavor\");\r\n if(clave.equals(pass)==false){\r\n System.out.println(\"Contraseña incorrecta\");\r\n }\r\n }\r\n System.out.println(\"Contraseña correcta. Acceso permitido\");\r\n \r\n \r\n }", "public static void main(String[] args) {\n\r\n\t\tString pass = (\"asdasd\");\r\n\t\tScanner input = new Scanner(System.in);\r\n\t\tint attempts = 3;\r\n\t\tBoolean passInput = true;\r\n\t\t\r\n\t\tSystem.out.println(\"Enter your password: \");\r\n\t\t\r\n\t\twhile (passInput && attempts-- > 0) {\r\n\t\t\tString passAttempt = input.nextLine();\r\n\t\t\t\r\n\t\t\tif (passAttempt.equals(pass)) {\r\n\t\t\t\tSystem.out.println(\"You're logged in!\");\r\n\t\t\t}\r\n\t\t\telse if (!passAttempt.equals(pass)) {\r\n\t\t\t\tSystem.out.println(\"Wrong password! Attempts remaining: \" + attempts);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tinput.close();\r\n\t}", "private void chooseRemaindersFile() {\n JFileChooser setEF = new JFileChooser(System.getProperty(\"user.home\"));\n setEF.setDialogType(JFileChooser.OPEN_DIALOG);\n setEF.showDialog(this, \"Выбрать файл\");\n remainderFile = setEF.getSelectedFile();\n putLog(\"Файл остатков: \" + remainderFile.getPath());\n jbParse.setEnabled(workingDirectory != null && remainderFile != null);\n }", "private static Scanner openFile(){\n\n System.out.println(\"Enter the input file name: \");\n Scanner kb = new Scanner(System.in);\n String fileName = kb.nextLine();\n try{\n return new Scanner(new File(fileName));\n }\n catch (Exception e){\n System.out.printf(\"Open Failed: \\n%s\\n\", e.toString());\n System.out.println(\"Please re-enter the filename.\");\n return openFile();\n }\n }", "public void readRememberMe() {\n\t\tFile f = new File(REMEMBER_ME_FILE);\n\t\tif (f.exists() && !f.isDirectory()) {\n\t\t\trememberMeCheckbox.setSelected(true);\n\t\t\tScanner scan;\n\t\t\ttry {\n\t\t\t\tscan = new Scanner(f);\n\t\t\t\tString username = scan.nextLine();\n\t\t\t\tString password = scan.nextLine();\n\t\t\t\tusernameInput.setText(username);\n\t\t\t\tpasswordInput.setText(password);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "@Test\n public void login_AcceptsUserPassword_IfUserEmailsPasswordMatches() throws IOException {\n when(ioUtils.fileExist(\"krislinjurgen@gmail.com.txt\")).thenReturn(true);\n // user inputs the email and then incorrect password\n when(ioUtils.readNextLine()).thenReturn(\"krislinjurgen@gmail.com\").thenReturn(\"correctpassword\");\n // the app returns correct password\n when(ioUtils.readPasswordFromFile(\"krislinjurgen@gmail.com\")).thenReturn(\"correctpassword\");\n\n // when\n fileUserService.login();\n verify(ioUtils).writeMessage(eq(\"Enter your login email: \"));\n verify(ioUtils).writeMessage(eq(\"Enter your password: \"));\n\n // then\n verify(ioUtils).writeMessage(eq(\"You have successfully logged in. \\nChoose another option.\\n\"));\n }", "private String userSelection(String[] decknames) {\n Scanner scanner = new Scanner(System.in);\n int deckoption = Integer.parseInt(scanner.nextLine());\n while(deckoption <= 0 || deckoption > decknames.length + 1) {\n System.out.print(\"try again\\ninput: \");\n deckoption = Integer.parseInt(scanner.nextLine());\n }\n // user wants to create a new deck\n if (deckoption > decknames.length) {\n System.out.print(\"type new deck name: \");\n return scanner.nextLine();\n }\n return decknames[deckoption - 1];\n }", "public void newSession(){\r\n\r\n //---------------- FUN COLORED COMMAND PROMPT -----------------\r\n if(APP_INSTANCE.isWindows) {\r\n try {\r\n ProcessBuilder builder = new ProcessBuilder(\"cmd.exe\", \"/c\", \"@echo off & cls & color 2\");\r\n Process process = builder.inheritIO().start();\r\n } catch (IOException e) {\r\n //> If this fails, its no biggie...\r\n }\r\n }\r\n\r\n //---------------------------------\r\n clearCommandPromptScreen();\r\n\r\n //---------------------------------\r\n System.out.println(\"///////////////////////////////////// Company Lockers Pvt. Ltd ////////////////////////////////////\");\r\n System.out.println(\"///\");\r\n System.out.println(\"/// SEARCH FOR FILE SCREEN \");\r\n System.out.println(\"///\");\r\n //---------------------------\r\n DIRECTORYLISTING_INSTANCE.displayDirectoryList();\r\n //---------------------------\r\n System.out.println(\"///\");\r\n System.out.println(\"/// SEARCH FILE INSTRUCTIONS: \");\r\n System.out.println(\"/// --------------------------------------------------------------------------------\");\r\n System.out.println(\"/// TO SEARCH FOR A FILE TO THIS DIRECTORY --> ENTER THE FILENAME BELOW\");\r\n System.out.println(\"/// \");\r\n System.out.println(\"/// \");\r\n System.out.println(\"/// USER COMMAND OPTIONS: \");\r\n System.out.println(\"/// --------------------------------------------------------------------------------\");\r\n System.out.println(\"/// TYPE [RETURN] --> To RETURN TO THE MAIN SCREEN\");\r\n System.out.println(\"/// TYPE [EXIT] --> To EXIT and CLOSE THIS APPLICATION\");\r\n System.out.println(\"///\");\r\n System.out.println(\"//////////////////////////////////////////////////////////////////////////////////////////////////\");\r\n System.out.println(\"\");\r\n System.out.println(\"EITHER, ENTER the FILENAME to SEARCH FOR, or ENTER a COMMAND OPTION HERE: \");\r\n //---------------------------------\r\n BufferedReader reader = new BufferedReader( new InputStreamReader(System.in));\r\n String command;\r\n try {\r\n command = reader.readLine();\r\n handleUserEntry(command);\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n newSession();\r\n }\r\n }", "private static String getFileNameInput() {\n Scanner fileNameScanner = new Scanner(System.in);\n System.out.println(\"Please enter name of file: \");\n return fileNameScanner.nextLine();\n }", "static String readUserChoice(List<String> allowedAnswers, boolean generalOptionsEnabled){\n\n boolean exit = false;\n String inputFromUser;\n do {\n inputScanner.read();\n inputFromUser = inputScanner.getInputValue();\n if(!inputScanner.isTimeExpired()) {\n if (allowedAnswers.contains(inputFromUser)) {\n exit = true;\n } else {\n if (generalOptionsEnabled && isDescriptionCommand(inputFromUser)) {\n printDescription(inputFromUser);\n System.out.println(\"Answer the previous question or read another description.\");\n System.out.print(GeneralInfo.ASK_INPUT);\n } else {\n System.out.print(\"Illegal input. Insert correct input: \");\n }\n }\n }\n }while(!exit && !inputScanner.isTimeExpired());\n\n inputScanner.close();\n\n if(inputScanner.isTimeExpired()){\n return null;\n }\n else {\n return inputFromUser;\n }\n }", "private static String getUserText()\n {\n\t// Reads the users input.\n\tBufferedReader optionReader = new BufferedReader(new InputStreamReader(System.in));\n\n\ttry\n\t {\n\t\treturn(optionReader.readLine());\n\t }\n\tcatch(Exception ex)\n\t {\n\t\treturn(null);\n\t }\n }", "public void actionPerformed(ActionEvent e){\n if(stateComboBox.getSelectedIndex() >= 0){ \r\n String userIDFound = null; \r\n boolean isStateExists = false; \r\n try { \r\n //Read file using buffered reader. \r\n BufferedReader br = new BufferedReader(new FileReader(FILE_PATH_LOCATION)); \r\n String sCurrentLine =br.readLine(); \r\n while (sCurrentLine != null) { \r\n String state = null; \r\n String zipCode = null; \r\n \r\n //Parse each line in the text file using \"|\" \r\n StringTokenizer st = new StringTokenizer(sCurrentLine,\"|\"); \r\n \r\n //Set User Name - Second string is user name \r\n if(st.hasMoreTokens()) { \r\n state = st.nextToken(); \r\n System.out.println(state); \r\n } \r\n \r\n //Set password - Third String is password \r\n if(st.hasMoreTokens()) { \r\n zipCode = st.nextToken(); \r\n System.out.println(zipCode); \r\n } \r\n String comboBoxState = (String) stateComboBox.getSelectedItem(); \r\n //If user name and password match in each line, then return true \r\n if(state != null && comboBoxState.equalsIgnoreCase(state)) { \r\n isStateExists = true; \r\n break; \r\n } \r\n sCurrentLine = br.readLine(); \r\n } \r\n } \r\n catch (Exception FILENOTFOUND) { \r\n System.out.println(\"File not found!\"); \r\n } \r\n try { \r\n BufferedReader br2 = new BufferedReader(new FileReader(FILE_PATH_STADIUMS)); \r\n String sCurrentLine2 = br2.readLine(); \r\n while(sCurrentLine2 != null) { \r\n String stateString = null; \r\n String stadium = null; \r\n \r\n //Parse each line in the text file using \"|\" \r\n StringTokenizer st2 = new StringTokenizer(sCurrentLine2,\"|\"); \r\n \r\n //Set User Name - Second string is user name \r\n if(st2.hasMoreTokens()) { \r\n stateString = st2.nextToken(); \r\n System.out.println(stateString); \r\n } \r\n \r\n //Set password - Third String is password \r\n if(st2.hasMoreTokens()) { \r\n stadium = st2.nextToken(); \r\n System.out.println(stadium); \r\n } \r\n String comboBoxState = (String) stateComboBox.getSelectedItem(); \r\n if(stateString != null && comboBoxState.equalsIgnoreCase(stateString)){ \r\n System.out.println(\"Test1\"); \r\n allStadiums[countStadium] = stadium; \r\n countStadium++; \r\n \r\n System.out.println(\"Test2\"); \r\n } \r\n \r\n //Read next line \r\n sCurrentLine2 = br2.readLine(); \r\n } \r\n } \r\n catch (Exception FILENOTFOUND) { \r\n System.out.println(\"File not found!\"); \r\n } \r\n } \r\n PublicUserFrame.this.setSize(250, 500); \r\n panel02 = new JPanel(); \r\n panel02.setLayout(new GridLayout(countStadium,1,5,5)); \r\n stadiumRadioButton = new JRadioButton[15]; \r\n for(int i=0; i<allStadiums.length; i++){ \r\n if(allStadiums[i] != null){ \r\n System.out.println(\"Test3:\" + allStadiums[i]); \r\n stadiumRadioButton[i] = new JRadioButton(allStadiums[i]); \r\n panel02.add(stadiumRadioButton[i]); \r\n stadiumButtonGroup.add(stadiumRadioButton[i]); \r\n System.out.println(i); \r\n } \r\n } \r\n add(panel02, bLayout.CENTER); \r\n RadioButtonListener rbListener = new RadioButtonListener(); \r\n for(int i=0; i<stadiumRadioButton.length; i++){ \r\n if(stadiumRadioButton[i] != null){ \r\n stadiumRadioButton[i].addItemListener(rbListener); \r\n } \r\n } \r\n }", "public void askLoadSettings() {\r\n Scanner scanner = new Scanner(System.in);\r\n System.out.println(\"Load previous settings? (Y/N)\");\r\n String bool = scanner.nextLine();\r\n if (isStringYN(bool)) {\r\n System.out.println(\"Selected \" + bool);\r\n if (Objects.equals(bool, \"Y\")) {\r\n skip = true;\r\n try {\r\n loadAll();\r\n } catch (IOException e) {\r\n System.out.println(\"File not found\");\r\n }\r\n }\r\n } else {\r\n System.out.println(\"Invalid Input\");\r\n askLoadSettings();\r\n }\r\n }", "public abstract String promptSelectionFromAnswers(final String question, final List<String> answers) throws JVMIOException;", "public static void main(String[] args) throws NoSuchAlgorithmException, FileNotFoundException, IOException {\n \r\n String hash = \"F5D080D4F4E185DECA8A8B24F72408D9\";\r\n String [] keys = {\"9A1BA7F38A3E8D8F9DDD55972868CB3F\",\"17185CEF199E1C89804EDEE9DCDD1B90\",\"F5D080D4F4E185DECA8A8B24F72408D9\"};\r\n String password = \"NoSuchPassword\";\r\n File file = null;\r\n JFileChooser ff = new JFileChooser();\r\n int a = ff.showOpenDialog(null);\r\n if(a == JFileChooser.APPROVE_OPTION){\r\n try {\r\n file = ff.getSelectedFile();\r\n JOptionPane.showMessageDialog(ff, a);\r\n \r\n } catch (Exception ex) {\r\n ex.printStackTrace();\r\n } finally {\r\n System.out.println(file.getPath());\r\n }\r\n } \r\n BufferedReader fr = null;\r\n fr = new BufferedReader(new FileReader(file.getPath()));\r\n String line = null;\r\n int i = 0; \r\n //This is the funtion that Java implement in java.security.MessageDigest\r\n MessageDigest md5 = MessageDigest.getInstance(\"MD5\");\r\n while((line = fr.readLine()) != null){\r\n System.out.println(line);\r\n md5.update(line.getBytes());\r\n byte [] digests = md5.digest();\r\n String hashs = DatatypeConverter.printHexBinary(digests).toUpperCase();\r\n if(keys[i].equals(hashs)){\r\n System.out.println(\"CORRECT!\\nThe hash created is the same as the hash saved \");\r\n }\r\n else{\r\n System.out.println(\"ERROR!\\nThere was a mistake, the hash create doesn't mach the hash saved\");\r\n }\r\n i++;\r\n } \r\n fr.close();\r\n /**In conclusion we can use the MD5 for digest a words and then same them\r\n * is a DataBase, this with the function that if the DB is committed the\r\n * passwords will not be there\r\n */\r\n }", "public void loginMenu()\n\t{\n\t\tboolean flag = true; //Boolean set for the while loop to keep looping until the user makes the correct choice\n\t\tSystem.out.printf(\"\\n%-1s %s\\n\", \"\", \"Company Login\");\n\t\tSystem.out.printf(\"%s\\n\",\"---------------------------\");\n\t\tSystem.out.printf(\"%-3s %-2s %s\\n\", \"\", \"1.\", \"Login\");\n\t\tSystem.out.printf(\"%-3s %-2s %s\\n\", \"\", \"2.\", \"Register\");\n\t\tSystem.out.printf(\"%-3s %-2s %s\\n\", \"\", \"3.\", \"Exit\");\n\t\tScanner userInput = new Scanner(System.in);\n\t\twhile(flag)\n\t\t{\t\n\t\t\tSystem.out.printf(\"%s\\n%s\", \"Please chose a option between 1 and 2\", \"user> \");\n\t\t\t/*\n\t\t\t * Try catch checks the user input, throws an error if the incorrect data type is entered\n\t\t\t */\n\t\t\ttry\n\t\t\t{\n\t\t\t\tint choice = Integer.parseInt(userInput.nextLine());\n\t\t\t\tswitch(choice)\n\t\t\t\t{\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tlogin();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\t//Todo\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tSystem.exit(0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tSystem.out.println(\"option not available, please choose again\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(NumberFormatException ex)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"Invlid input, please enter your choice again\");\n\t\t\t}\n\t\t}\n\t\tuserInput.close();\n\t}", "@Test\n public void login_RejectsUserPassword_IfUserEmailsPasswordDoesNotMatchCaseSensitivity() throws IOException {\n when(ioUtils.fileExist(\"krislinjurgen@gmail.com.txt\")).thenReturn(true);\n // user inputs the email and then incorrect password\n when(ioUtils.readNextLine()).thenReturn(\"krislinjurgen@gmail.com\").thenReturn(\"Correctpassword\");\n // the app returns correct password\n when(ioUtils.readPasswordFromFile(\"krislinjurgen@gmail.com\")).thenReturn(\"correctpassword\");\n\n // when\n fileUserService.login();\n verify(ioUtils).writeMessage(eq(\"Enter your login email: \"));\n verify(ioUtils).writeMessage(eq(\"Enter your password: \"));\n\n // then\n verify(ioUtils).writeMessage(eq(\"Your login details are incorrect.\\nPlease choose another option.\\n\"));\n }", "public void select() {\n \t\t\tString sinput = \"\";\r\n \t\t\tOption selected = null;\r\n \t\t\tErrorLog.debug(name + \" selected.\");\r\n \t\t\t\r\n \t\t\twhile (true) {\r\n \t\t\t\tSystem.out.println(toString()); //Print menu.\r\n \t\t\t\tsinput = read(); //Get user selection.\r\n \t\t\t\tif (!sinput.equalsIgnoreCase(\"exit\")) {\r\n \t\t\t\t\tselected = options.get(sinput); //Find corresponding option.\r\n \r\n \t\t\t\t\tif (selected != null) //Sinput corresponds to an extant option.\r\n \t\t\t\t\t\tselected.select(); //Select the selected.\r\n \t\t\t\t\telse\r\n \t\t\t\t\t\tprint(sinput + \" is not a valid option\");\r\n \t\t\t\t} else\r\n \t\t\t\t\t{print(\"Returning to previous menu.\"); break;}\r\n \t\t\t}\r\n \t\t\t\r\n \t\t\tErrorLog.debug (\"Quitting \" + name + \". Sinput:\"+sinput);\r\n \t\t\t\r\n \t\t\treturn;\r\n \t\t}", "private void selectTXTFile() {\n JFileChooser jfc = new JFileChooser();\n File curDir;\n if (readFile != null) curDir = new File(readFile.getParent()); else curDir = new File(System.getProperty(\"user.home\"));\n jfc.setCurrentDirectory(curDir);\n jfc.setFileFilter(new TXTFilter());\n jfc.setMultiSelectionEnabled(false);\n int ret = jfc.showDialog(this, \"Save\");\n if (ret == 0) {\n outputField.setText(jfc.getSelectedFile().getAbsolutePath() + \".txt\");\n }\n }", "public static void userSelection(){\n\t\tint selection;\n\t\tScanner input = new Scanner(System.in);\n\t\tSystem.out.println(\"Which program would you like to run?\");\n\t\tselection=input.nextInt();\n\n\t\tif(selection == 1)\n\t\t\tmazeUnion();\n\t\tif(selection == 2)\n\t\t\tunionPathCompression();\n\t\tif(selection == 3)\n\t\t\tmazeHeight();\n\t\tif(selection == 4)\n\t\t\tmazeSize();\n\t\tif(selection == 5)\n\t\t\tsizePathCompression();\n\t}", "@Test\n public void login_RejectsUserPassword_IfUserEmailsPasswordDoesNotMatch() throws IOException {\n when(ioUtils.fileExist(\"krislinjurgen@gmail.com.txt\")).thenReturn(true);\n // user inputs the email and then incorrect password\n when(ioUtils.readNextLine()).thenReturn(\"krislinjurgen@gmail.com\").thenReturn(\"notthepassword\");\n // the app returns correct password\n when(ioUtils.readPasswordFromFile(\"krislinjurgen@gmail.com\")).thenReturn(\"correctpassword\");\n\n // when\n fileUserService.login();\n verify(ioUtils).writeMessage(eq(\"Enter your login email: \"));\n verify(ioUtils).writeMessage(eq(\"Enter your password: \"));\n\n // then\n verify(ioUtils).writeMessage(eq(\"Your login details are incorrect.\\nPlease choose another option.\\n\"));\n }", "static <T> T promptUser(BufferedReader console, List<T> options, Function<T, String> optionToString) {\n Map<Integer, T> intToOptionMap = toMapForUserSelection(options);\n\n intToOptionMap.forEach((integer, option) ->\n System.out.println(\"\\t\" + integer + \") \" + optionToString.apply(option))\n );\n\n return promptUserForSelection(console, intToOptionMap, optionToString);\n }", "public static void main(String[] args)\r\n/* 51: */ {\r\n/* 52:55 */ SaveKeystoreFileChooser chooser = new SaveKeystoreFileChooser();\r\n/* 53:56 */ chooser.setSelectedFile(new File(\"test.pfx\"));\r\n/* 54:57 */ chooser.showSaveDialog(null);\r\n/* 55:58 */ System.out.println(\"sel:\" + chooser.getSelectedFile());\r\n/* 56: */ }", "public static void main(String[] args) {\n\t\tString[] user=new String[2];\n\t\tint[] password=new int[2];\n\t\twhile(true){\n\t\t\tselects(user,password);\n\t\t}\n\t}", "private void readFromFile(){\n\t\t\n\t\ttry {\n\t\t\tFile file=new File(\"controller.txt\");\n\t\t\tFileInputStream fin;\n\t\t\tfin = new FileInputStream(file);\n\t\t\tDataInputStream din=new DataInputStream(fin);\n\t\t\tBufferedReader br=new BufferedReader(new InputStreamReader(din));\n\t\t\t\n\t\t\tfor(int i=0; i<2; i++){\n\t\t\t\tif(i==0)\n\t\t\t\t\tcodedUserName=br.readLine();\n\t\t\t\telse \n\t\t\t\t\tcodedPassword=br.readLine();\n\t\t\t}\n\t\t\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t}", "private void selectPDFFile() {\n JFileChooser jfc = new JFileChooser();\n jfc.setFileFilter(new PDFFilter());\n jfc.setMultiSelectionEnabled(false);\n int ret = jfc.showDialog(this, \"Open\");\n if (ret == 0) {\n readFile = jfc.getSelectedFile();\n inputField.setText(readFile.getAbsolutePath());\n String outString = readFile.getAbsolutePath();\n outString = outString.substring(0, outString.length() - 3);\n outString = outString + \"txt\";\n outputField.setText(outString);\n progressLabel.setBackground(INFO);\n progressLabel.setText(PRESS_EXTRACT);\n } else {\n System.out.println(NO_FILE_SELECTED);\n progressLabel.setBackground(WARNING);\n progressLabel.setText(SELECT_FILE);\n }\n }", "public String singleSelect() throws IOException{\n\t\t int count = 0;\t\t\t\t\t\t// count variable is used for count lines in file\n\t\t Fin = new FileReader(\"Survey.txt\");// to read form text file\n\t\t \n\t\t bufferReader = new BufferedReader(Fin);\t// take contents of file in bufferReader\n\t\t\n\t\t String[] questionArray = new String[6];\n\t\t while( count != 6 ) \t\t // starting 6 lines of files contains data for single select question. so it reads only six line\n\t\t {\n\t\t\t\n\t\t\t String line = bufferReader.readLine();\n\t\t\t System.out.println(line);\n\t\t\t questionArray[count] = line;\t// questionArray holds sentence with its option of single select question\n\t\t\t \n\t\t\t count++;\n\t\t }\n\t\t int flag = 0;\n\t\t String answer = new String();\t// string ans which holds the resultant option given by the user\n while( flag == 0 )\n {\n \t answer = sc.nextLine();\n \n\t for( int i=1; i<6; i++ )\n\t {\n\t if( questionArray[i].equals(answer) )\t// check whether user select answer is available or not\n\t {\n\t \t flag = 1;\t\t\t\t\t// if yes than make flag=1\n\t \t break;\n\t }\n\t }\n\t if( flag == 0 )\n\t {\n\t System.out.println(\"Enter Valid ans\");\t // otherwise continue the loop until answer is valid\n\t \n\t }\n }\n return answer;\t\t\t// return output\n\t }", "static String promptForString(String prompt, String defaultOption) {\n String line;\n System.out.println(prompt + \" (default=\" + defaultOption + \")\");\n\n System.out.print(\">\");\n // if (Menus.reader.()) {\n line = Menus.reader.nextLine().strip();\n //}\n\n if (line.compareTo(\"\") == 0)\n return defaultOption;\n return line;\n }", "public String Password()// method for getting the password given by user\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tSystem.out.println(\"enter password: \");\n\t\tString password = sc.next();\n\n\t\treturn password;\n\t}", "@Override\r\n public void initValues() {\r\n try {\r\n crackedPasswords = Files.readAllLines(Paths.get(DefectivePasswordValidatorConstants.PASSWORD_FILE_PATH),\r\n StandardCharsets.UTF_8);\r\n } catch (IOException e) {\r\n log.error(\"Exception occured while reading and initializing values from \"\r\n + DefectivePasswordValidatorConstants.PASSWORD_FILE_NAME, e);\r\n }\r\n }", "public void chooseFile(String fileName) {\n getQueueTool().waitEmpty();\n output.printTrace(\"Choose file by JFileChooser\\n : \" + fileName\n + \"\\n : \" + toStringSource());\n JTextFieldOperator fieldOper = new JTextFieldOperator(getPathField());\n fieldOper.copyEnvironment(this);\n fieldOper.setOutput(output.createErrorOutput());\n //workaround\n fieldOper.setText(fileName);\n //fieldOper.clearText();\n //fieldOper.typeText(fileName);\n //approveSelection();\n approve();\n }", "private static int getUserOption()\n {\n\t// Reads the users input.\n\tBufferedReader optionReader = new BufferedReader(new InputStreamReader(System.in));\n\n\ttry\n\t {\n\t\treturn(Integer.parseInt(optionReader.readLine()));\n\t }\n\tcatch(Exception ex)\n\t {\n\t\treturn(-1);\n\t }\n }", "private void handlePasswordCallback(PasswordCallback pc)\n throws IOException {\n System.out.print(pc.getPrompt());\n System.out.flush();\n String passwd = (new BufferedReader(new InputStreamReader(System.in))).\n readLine();\n pc.setPassword(passwd.toCharArray());\n }", "public static File inputVerify(Scanner input) {\n boolean fileFound = false; // set fileFound boolean to false at first\n File inputName = new File(\"\"); // create new file object \n\n // asks user to enter an existing file name \n System.out.print(\"Input file name: \");\n inputName = new File(input.next());\n\n // while loop that runs until valid input file name is entered\n while(fileFound == false) { \n //if statement for when an invalid input file is entered\n if (!inputName.exists()) { \n System.out.print(\"File not found. Try again: \");\n inputName = new File(input.next());\n } else {\n fileFound = true; // fileFound becomes true if valid file name is entered \n }\n }\n return inputName; // returns the correct input file\n }", "private void secQuestionInput()\n {\n if(textBox1.getText().equals(user.getSecretQAns()))\n {\n secQuestion = false;\n password = true;\n\n textBox1.setText(\"\");\n textBox1.promptTextProperty().set(\"New Password\");\n labelHeader.setText(\"Input new password\");\n\n textBox2Label.setVisible(true);\n textBox2Label.setText(\"Confirm New Password\");\n textBox2.setVisible(true);\n textBox1Label.setText(\"New Password\");\n }\n else\n {\n Alert alert = new Alert(Alert.AlertType.ERROR);\n alert.setContentText(\"Security answer does not match!\");\n alert.show();\n }\n }", "private void handlePwd() {\n sendMsgToClient(\"257 \\\"\" + currDirectory + \"\\\"\");\n }", "public KeyStoreBuilder<E> readPasswordFromConsole() {\r\n this.readPasswordFromConsole = true;\r\n return this;\r\n }", "static void getRealUserPasswordUrl(String args[]) throws Exception {\n url = getOptionValue(args, \"-l\", DEFAULT_URL);\n\n // DB user can be modified in file, or taken from command-line\n user = getOptionValue(args, \"-u\", DEFAULT_USER);\n\n // DB user's password can be modified in file, or explicitly entered\n readPassword(\"Password for \" + user + \": \");\n }", "public static void main(String []args) {\n\t\t/*\n\t\t * The user will be shown two options:\n\t\t * Exit from the system by pressing 0.\n\t\t * OR\n\t\t * Enabling user to enter credential information(Email Id and Password) by pressing 1.\n\t\t * If user enters any other key Invalid choice will be displayed and again user will be given two choices.\n\t\t * */\n\t\tboolean run = true;\n\t\twhile(run) {\n\t\t\tviewOptions();\n\t\t\ttry {\n\t\t\t\tint option = sc.nextInt();\n\t\t\t\tswitch(option) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\t//If user enters 0 terminate the while loop by making run = false.\n\t\t\t\t\t\trun = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t//Try to login into the system\n\t\t\t\t\t\tattemptToLogin();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tlog.error(\"Invalid Choice!\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t//If user tries to enter non numeric characters exception will be thrown and will caught below.\n\t\t\tcatch(InputMismatchException e){\n\t\t\t\tlog.error(\"Invalid Choice!\");\n\t\t\t}\t\t\n\t\t}\n\t}", "private void viewPassword() {\n\t\t// Which username/password pair entry has been selected, if any?\n\t\tint iRow = passwordsTable.getSelectedRow();\n\t\tif (iRow == -1) // no row currently selected\n\t\t\treturn;\n\n\t\t// Get current values for service URI, username and password\n\t\tString serviceURI = (String) passwordsTable.getValueAt(iRow, 1); // current entry's service URI\n\n\t\tString username = (String) passwordsTable.getValueAt(iRow, 2); // current entry's username\n\n\t\t/*\n\t\t * Because the password column is not visible we call the getValueAt\n\t\t * method on the table model rather than at the JTable\n\t\t */\n\t\tString password = (String) passwordsTable.getModel()\n\t\t\t\t.getValueAt(iRow, 4); // current entry's password value\n\n\t\t// Let the user view service URI, username and password of the entry\n\t\tViewUsernamePasswordEntryDialog viewServicePassDialog = new ViewUsernamePasswordEntryDialog(\n\t\t\t\tthis, serviceURI, username, password);\n\n\t\tviewServicePassDialog.setLocationRelativeTo(this);\n\t\tviewServicePassDialog.setVisible(true);\n\t}", "@Override\n\tpublic PrivateKey readPrivateKey(String file, String alias, String password) {\n\t\tKeyStore ks;\n\t\ttry {\n\t\t\tks = KeyStore.getInstance(\"JKS\", \"SUN\");\n\t\t\tBufferedInputStream in = new BufferedInputStream(new FileInputStream(file));\n\t\t\tks.load(in, password.toCharArray());\n\n\t\t\tif (ks.isKeyEntry(alias)) {\n\t\t\t\tPrivateKey pk = (PrivateKey) ks.getKey(alias, password.toCharArray());\n\t\t\t\treturn pk;\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} catch (KeyStoreException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t} catch (NoSuchProviderException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t} catch (FileNotFoundException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t} catch (CertificateException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t} catch (UnrecoverableKeyException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\n\t}", "private static int getUserOption () {\n\t\tBufferedReader myReader = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint input;\n\t\t\n\t\tdo {\n\t\t\tlistMainMenuOptions();\n\n\t\t\ttry {\n\t\t\t\tinput = Integer.parseInt(myReader.readLine());\n\n\t\t\t\tif ((input < 1) || (input>9)) {\n\t\t\t\t\tSystem.out.println(\"Please type in a number between 1-9 according to your choice\");\n\t\t\t\t}\n\n\t\t\t}catch (Exception e) {\n\t\t\t\tSystem.out.println(\"Character invalid. Please enter a number from 1-9 according to your choice\");\n\t\t\t\tinput = 0;\n\t\t\t}\n\t\t\t\n\t\t}while ((input < 1) || (input>9));\n\n\t\treturn input;\n\t\t\n\t}", "private char[] getPassword(String _login)\n {\n try {\n File passwordFile = new File(\"passwords.txt\");\n FileReader fr = new FileReader(passwordFile);\n BufferedReader br = new BufferedReader(fr);\n\n while (br.ready()) {\n String line = br.readLine();\n String[] csvData = line.split(\",\");\n if (csvData[0].equals(_login)) {\n return csvData[1].toCharArray();\n }\n }\n\n } catch (FileNotFoundException ex) {\n JOptionPane.showMessageDialog(null, \"No user has been registered...\\n Please register a user first\");\n } catch (IOException ex)\n {\n System.out.println(ex.getMessage());\n ex.printStackTrace();\n }\n return null;\n }", "private void Menu_PasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Menu_PasswordActionPerformed\n // TODO add your handling code here:\n String password = JOptionPane.showInputDialog(\"ENTER A PASSWORD \");\n\n if(password.equals(\"Time is an illusion\"))\n display.setText(\"Lunchtime, doubly so.\");\n }", "public void execute_downloadSelectNotesCommand_invalidFileName() {\n DownloadSelectNotesCommand command = new DownloadSelectNotesCommand(INCORRECT_USERNAME,\n INCORRECT_PASSWORD, INCORRECT_MODULE_CODE, INCORRECT_FILE_INDEX);\n assertCommandFailure(command, model, commandHistory, Messages.MESSAGE_USERNAME_PASSWORD_ERROR\n + DownloadSelectNotesCommand.NEWLINE_SEPARATOR + DownloadSelectNotesCommand.MESSAGE_USAGE);\n }", "private static File getFile(Scanner console, String prompt) {\n\t\tString filepath;\n\t\tdo {\n\t\t\tSystem.out.print(prompt);\n\t\t\tfilepath = console.nextLine().trim();\n\t\t} while ( filepath.isEmpty() );\n\t\treturn new File(filepath);\n\t}", "public void selectChangePasswordOption() {\n\t\ttry {\n\t\t\t//Utility.wait(changePassword);\n\t\t\tchangePassword.click();\n\t\t\tLog.addMessage(\"Change Password option selected\");\n\t\t}catch(Exception e) {\n\t\t\tLog.addMessage(\"Failed to select Change Password option\");\n\t\t\tSystem.out.println(e.getMessage().toString());\n\t\t\tAssert.assertTrue(false, \"Failed to select Change Password option\");\n\t\t}\n\t}", "public static void main(String[] args) throws Exception {\n\t\tScanner input = new Scanner(System.in);\n\t\tString i_fn,o_fn,pwd;\n\t\tbyte[] i_data = new byte[100];\n\t\tbyte[] pwd_b;\n\t\t\n\t\tSystem.out.print(\"원본 파일 입력 : \");\n\t\ti_fn = input.nextLine();\n\t\tSystem.out.print(\"대상 파일 입력 : \");\n\t\to_fn = input.nextLine();// 원본과 대상파일의 크기가 같다\n\t\tSystem.out.print(\"패스워드 입력 : \");\n\t\tpwd = input.nextLine();\n\t\tpwd_b = new byte[pwd.length()];\n\t\tpwd_b= pwd.getBytes(); // String 을 byte배열에 넣는다\n\t\t\n\t\t\n\t\tFileInputStream in = new FileInputStream(i_fn); // 파일 읽기\n\t\tFileOutputStream out = new FileOutputStream(o_fn);\n\t\tfor (;;) {\n\t\t\tint len = in.read(i_data); // 파일을 읽는다\n\t\t\tif (len == -1) {\n\t\t\t\tbreak;\n\t\t\t}else {\n\t\t\t\tint i =0;\n\t\t\t\tfor (byte b : i_data) {\n\t\t\t\t\ti_data[i] = (byte)(b^pwd_b[i%(pwd_b.length)]);// pwd길이만큼 계속 반복한다\n\t\t\t\t\t//pwd =123이고 i_data 길이가 10이라면 , 123 123 123 1\n\t\t\t\t\t// 원본^b = 암호화된파일 -> 암호화된파일^b = 원본 의 원리로 파일 암호를 풀 수 있다\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t\tout.write(i_data); // 파일을 out을 통해 쓴다. -> 대상 파일이 생성된다 , 암호화된 파일\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tin.close();\n\t\tout.close();\n\t\tinput.close();\n\t}", "static void mainDirectory() throws Exception {\n\t\t// Since we're active while this is running, open a ClientHelper on the port to listen for and respond to requests\n\t\trequestListener = new ClientHelper(port);\n\t\trequestListener.run();\n\t\t// If alive true, we still want to run the program\n\t\tboolean alive = true;\n\t\twhile(alive) {\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"-----------------------------Main Menu:-----------------------------\");\n\t\t\tSystem.out.println(\"---Please enter the option you wish to execute followed by Enter ---\");\n\t\t\tSystem.out.println(\"File Viewing Options:\");\n\t\t\tSystem.out.println(\"\\t[1] | View All Of My Files (Shared And Not Shared)\");\n\t\t\tSystem.out.println(\"\\t[2] | View All Shared Files (Shared By You And Other Users)\");\n\t\t\tSystem.out.println(\"File Sharing Options:\");\n\t\t\tSystem.out.println(\"\\t[3] | Share A File\");\n\t\t\tSystem.out.println(\"\\t[4] | Stop Sharing A File\");\n\t\t\tSystem.out.println(\"File Discovery Options:\");\n\t\t\tSystem.out.println(\"\\t[5] | Search For A File\");\n\t\t\tSystem.out.println(\"System Options:\");\n System.out.println(\"\\t[r] | Refresh File System\");\n\t\t\tSystem.out.println(\"\\t[x] | Log Out\");\n\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\tSystem.out.print(\"Your Entry: \");\n\n\t\t\t// Get the user's choice\n\t\t\tString userEntry = input.readLine();\n\n\t\t\t// Call the View All Files function which will report the contents of the user's shared and not-shared directories\n\t\t\tif(userEntry.equals(\"1\")) {\n\t\t\t\tSystem.out.println();\n\t\t\t\tSystem.out.println(\"------------------------------My Files------------------------------\");\n\t\t\t\tviewMyFiles();\n\t\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\t\tSystem.out.println(\"---------------------Returning To The Main Menu---------------------\");\n\t\t\t}\n\n\t\t\t// Call the View Shared Files function which will report all files shared by any user currently on the system\n\t\t\telse if(userEntry.equals(\"2\")) {\n System.out.println();\n System.out.println(\"--------------------------All Shared Files--------------------------\");\n\t\t\t\tviewSharedFiles();\n System.out.println(\"--------------------------------------------------------------------\");\n System.out.println(\"---------------------Returning To The Main Menu---------------------\");\n\t\t\t}\n\n\t\t\t// Call the File Sharing function which will allow the user to add previously non-shared files to a shared status\n\t\t\telse if(userEntry.equals(\"3\")) {\n\t\t\t\tSystem.out.println();\n\t\t\t\tSystem.out.println(\"------------------------File Sharing Utility------------------------\");\n\t\t\t\taddFileToShared();\n\t\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\t\tSystem.out.println(\"---------------------Returning To The Main Menu---------------------\");\n\t\t\t}\n\n\t\t\t// Call the File Un-Sharing function which will allow the user to add previously shared files to a non-shared status\n\t\t\telse if(userEntry.equals(\"4\")) {\n\t\t\t\tSystem.out.println();\n\t\t\t\tSystem.out.println(\"-----------------------File Un-Sharing Utility----------------------\");\n\t\t\t\tremoveFileFromShared();\n\t\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\t\tSystem.out.println(\"---------------------Returning To The Main Menu---------------------\");\n\t\t\t}\n\n\t\t\t// Call the File Search function which will allow the user to search for shared files, and if they'd like - download them\n\t\t\telse if(userEntry.equals(\"5\")) {\n\t\t\t\tSystem.out.println(\"-------------------------File Search Utility------------------------\");\n\t\t\t\tsearchForFile();\n\t\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\t\tSystem.out.println(\"---------------------Returning To The Main Menu---------------------\");\n\t\t\t}\n\n\t\t\t// If the user enters x, this means they want to log out - so log out, and close the requestListener\n\t\t\telse if(userEntry.equals(\"x\") || userEntry.equals(\"X\")) {\n\t\t\t\t// Set alive to false in order to kill the main loop\n\t\t\t\talive = false;\n\t\t\t\tSystem.out.println(\"-----------------------------Logging Out----------------------------\");\n\t\t\t\tlogout();\n\t\t\t\tSystem.out.println(\"--------------------------------------------------------------------\");\n\t\t\t\tSystem.out.println(\"------------------------------Goodbye!------------------------------\");\n\t\t\t\trequestListener.terminate();\n\t\t\t}\n\n\t\t\t// If the user enters r, refresh the main file system\n else if(userEntry.equals(\"r\") || userEntry.equals(\"R\")) {\n System.out.println(\"-----------------------Refreshing File System-----------------------\");\n refreshFileSystem();\n System.out.println(\"--------------------------------------------------------------------\");\n System.out.println(\"---------------------Returning To The Main Menu---------------------\");\n }\n\n // Otherwise, the user has entered an invalid entry - inform them and loop again\n\t\t\telse {\n\t\t\t System.out.println(\"Invalid! Enter the key associated with the option and press Enter.\");\n System.out.println(\"--------------------------------------------------------------------\");\n System.out.println(\"---------------------Returning To The Main Menu---------------------\");\n }\n\t\t}\n\t}", "private String getPassword() {\n String Password = \"\";\n while (true) {\n System.out.println(\"Please, Enter Password : \");\n Password = scanner.nextLine();\n System.out.println(\"Please, Enter confirm Password : \");\n if (!Password.equals(scanner.nextLine())) {\n System.out.println(\"Error: Password doesn't match.\");\n } else {\n break;\n }\n }\n return Password;\n }", "public void actionPerformed(ActionEvent arg0) \r\n\t\t\t{\r\n\t\t\t\t// Opens new box when 'Forgot Password?' is selected\r\n\t\t\t\tString username = uNameInput.getText(); //gets the username enterd\r\n\t\t\t\tlinkList people = new linkList();\r\n\t\t\t\tLink temp;\r\n\t\t\t\tFileReader fr;\r\n\t\t\t\t\r\n\t\t\t\t//searches for mathed username from logincred file\r\n\t\t\t\ttry {\r\n\t\t\t\tfr = new FileReader(\"LoginCred.txt\");\t\r\n\t\t\t\tBufferedReader br = new BufferedReader(fr);\r\n\t\t\t\tString a, b, c, d, e2, f;\r\n\t\t\t\twhile((a = br.readLine()) != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tb = br.readLine();\r\n\t\t\t\t\tc = br.readLine();\r\n\t\t\t\t\td = br.readLine();\r\n\t\t\t\t\te2 = br.readLine();\r\n\t\t\t\t\tf = br.readLine();\r\n\t\t\t\t\t\r\n\t\t\t\t\tSystem.out.println(\"a = \" + a);\r\n\t\t\t\t\tSystem.out.println(\"b = \" + b);\r\n\t\t\t\t\tSystem.out.println(\"c = \" + c);\r\n\t\t\t\t\tSystem.out.println(\"d = \" + d);\r\n\t\t\t\t\tSystem.out.println(\"e2 = \" + e2);\r\n\t\t\t\t\tSystem.out.println(\"f = \" + f);\r\n\t\t\t\t\t\r\n\t\t\t\t\tpeople.insert(a, b, c, d , e2, f);\r\n\t\t\t\t}\r\n\t\t\t\tfr.close();\r\n\t\t\t\t}catch (Throwable e1) {\r\n\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\ttemp = people.head;\r\n\t\t\t\twhile (temp != null && !(username.equalsIgnoreCase(temp.username)))\r\n\t\t\t\t{\r\n\t\t\t\t\t\ttemp = temp.next; //if it doestn equal goes to next line\r\n\t\t\t\t}\r\n\t\t\t\tif (temp == null)\r\n\t\t\t\t{\r\n\t\t\t\t\t//prompts user to enter username\r\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Please enter a real user.\", \"Error Message\", JOptionPane.ERROR_MESSAGE);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t//loadsthe password resetpage\r\n\t\t\t\t\tpasswordReset pr = new passwordReset(username);\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}", "public static void librarianLogin()\r\n\t {\r\n\t\t String username;\r\n\t\t String password;\r\n\t\t boolean login = false;\r\n\t\t do {\r\n\t\t System.out.println(\"Enter your username\");\r\n\t\t Scanner src = new Scanner(System.in);\r\n\t\t username = src.next();\r\n\t\t System.out.println(\"Enter your password\");\r\n\t\t src = new Scanner(System.in);\r\n\t\t password = src.next();\r\n\t\t for(Librarian Account : FileReader.viewlibrarian()) {\r\n\t\t\t if(Account.getUsername().equals(username)) {\r\n\t\t\t\t if(Account.getPassword().equals(password)) {\r\n\t\t\t\t\t login = true;\r\n\t\t\t\t\t librarianAccount = Account;\r\n\t\t\t\t\t Display.librarianDisplay(librarianAccount);\r\n\t\t\t\t }\r\n\t\t\t }}\r\n\t\t if(login == false) {\r\n\t\t\t System.out.println(\"You have entered either the wrong username or password\");\r\n\t\t }\r\n\t\t }while(login == false);\r\n\t }", "private static void printOption(){\r\n System.out.println(\"Select option what you want to do\");\r\n System.out.println(\"Input plain(default) / stylish / slide\");\r\n option = scan.nextLine();\r\n try{\r\n if(option.toLowerCase().equals(\"plain\")){\r\n }\r\n else if(option.toLowerCase().equals(\"stylish\")){\r\n }\r\n else if(option.toLowerCase().equals(\"slide\")){\r\n }\r\n else if(option.toLowerCase().equals(\"\")){\r\n option = \"plain\";\r\n }\r\n else{\r\n throw new Exception(\"Check option\\n\");\r\n }\r\n } catch(Exception e){\r\n e.printStackTrace();\r\n } finally {\r\n System.out.println(\"Option : \" + option);\r\n }\r\n }", "private void getFileOrDirectory() {\r\n // display file dialog, so user can choose file or directory to open\r\n JFileChooser fileChooser = new JFileChooser();\r\n\t fileChooser.setCurrentDirectory(new File(System.getProperty(\"user.dir\")));\r\n fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );\r\n\r\n int result = fileChooser.showOpenDialog(this);\r\n\r\n // if user clicked Cancel button on dialog, return\r\n if (result == JFileChooser.CANCEL_OPTION )\r\n System.exit( 1 );\r\n\r\n File name = fileChooser.getSelectedFile(); // get File\r\n\r\n // display error if invalid\r\n if ((name == null) || (name.getName().equals( \"\" ))){\r\n JOptionPane.showMessageDialog(this, \"Invalid Name\",\r\n \"Invalid Name\", JOptionPane.ERROR_MESSAGE );\r\n System.exit( 1 );\r\n } // end if\r\n\t \r\n\t filename = name.getPath();\r\n }", "public void readAndWrite() {\n Scanner scanner = new Scanner(System.in);\n String s = scanner.nextLine();\n List<String> passedFiles = new ArrayList<>();\n copy(new File(s), true, passedFiles);\n\n }", "public void getCredentials(){\n System.out.println(\"Enter Your Credit Card Number\");\n setCreditCardNumber(Integer.parseInt(Menu.getScanner().nextLine()));\n System.out.println(\"Enter your billing address\");\n setBillingAddress(Menu.getScanner().nextLine());\n System.out.println(\"Enter your CVC\");\n setCvc(Integer.parseInt(Menu.getScanner().nextLine()));\n }", "public Optional<String> showPasswordDialog() {\n Dialog<String> passwordDialog = new Dialog<>();\n try {\n FXMLLoader loader = new FXMLLoader(getClass().getResource(\"/dialog/password_dialog.fxml\"));\n passwordDialog.setTitle(\"Password\");\n passwordDialog.getDialogPane().setContent(loader.load());\n passwordDialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);\n PasswordDialogController controller = loader.getController();\n passwordDialog.setResultConverter(buttonType -> {\n ButtonBar.ButtonData data = buttonType == null ? null : buttonType.getButtonData();\n return data == ButtonBar.ButtonData.OK_DONE ? controller.getPassword() : null;\n });\n return passwordDialog.showAndWait();\n } catch (IOException e) {\n throw new CryptoEditorException(\"Unable to load view-resource\", e);\n }\n }", "public void twoStageAuthentication() throws IOException, ClassNotFoundException {\r\n int confirmationCode = 1234;\r\n Scanner input = new Scanner(System.in);\r\n System.out.print(\"Enter Your Confirmation code: \");\r\n\r\n for(int confirmCode = input.nextInt(); confirmationCode != confirmCode; confirmCode = input.nextInt()) {\r\n System.out.println(\"The code entered is Incorrect,Please try again!\");\r\n System.out.print(\"Enter confirmation code: \");\r\n }\r\n\r\n this.showMenu(); // Calling the Mentioned Function\r\n }", "public void readInput()\n\t{\n\t\tString userInput;\n\t\tChoices choice;\n\t\t\n\t\tdo {\n\t\t\tlog.log(Level.INFO, \"Please give the inputs as:\\n\"\n\t\t\t\t\t+ \"ADDACCOUNT to add the account\\n\" \n\t\t\t\t\t+ \"DISPLAYALL to display all accounts\\n\"\n\t\t\t\t\t+ \"SEARCHBYACCOUNT to search by account\\n\"\n\t\t\t\t\t+ \"DEPOSIT to deposit into account\\n\"\n\t\t\t\t\t+ \"WITHDRAW to withdraw from the account\\n\"\n\t\t\t\t\t+ \"EXIT to end the application\"\n\t\t\t\t\t);\n userInput = scan.next();\n choice = Choices.valueOf(userInput);\n\n switch (choice) {\n case ADDACCOUNT : \taddAccount();\n \t\t\t\t\t\tbreak;\n \n case DISPLAYALL :\t\tdisplayAll();\n \t\t\t\t\t\tbreak;\n\n case SEARCHBYACCOUNT :\tsearchByAccount();\n \t\t\t\t\t\tbreak;\n \n case DEPOSIT :\t\t\tdepositAmount();\n \t\t\t\t\t\tbreak;\n \n case WITHDRAW :\t\t\twithDrawAmount();\n \t\t\t\t\t\tbreak;\n \n case EXIT:\t\t\t\tlog.log(Level.INFO, \"Application has ended successfully\");\n \t\t\t\t\t\tbreak;\n \n default: break;\n }\n } while(choice != Choices.EXIT);\n\t\t\n\t\tscan.close();\n\t}", "public static void main(String[] args) {\n\t\tEmployee emp = new Employee(\"Manoj\", \"Kumar\");\r\n\t\tCredentialService cs = new CredentialService();\r\n\t\tString generatedEmail;\r\n\t\tchar[] generatedPassword;\r\n\t\t\r\n\t\tString s1=\"1.Technical\";\r\n\t\tString s2=\"2.Admin\";\r\n\t\tString s3=\"3.Human Resource\";\r\n\t\tString s4=\"4.Legal\";\r\n\t\t\r\n\t\tSystem.out.println(\"Please enter the departmetfrom the following \\n\" + s1 +\"\\n\"+\r\n\t\ts2+ \"\\n\" + s3+\"\\n\" + s4);\r\n\t\t\t\t\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint option = sc.nextInt();\r\n\t\t\r\n\t\tif (option==1) {\r\n\t\t\tgeneratedEmail=cs.generateEmailAddress(emp.getFirstName().toLowerCase(), \r\n\t\t\t\t\temp.getLastName().toLowerCase(), \"Tech\");\r\n\t\t\t\t\tgeneratedPassword=cs.generatePassword();\r\n\t\t\t\t\tcs.showCredentials(emp, generatedEmail, generatedPassword);\r\n\t\t}\r\n\t\t//===\r\n\t\telse if (option==2) {\r\n\t\t\tgeneratedEmail=cs.generateEmailAddress(emp.getFirstName().toLowerCase(), \r\n\t\t\t\t\temp.getLastName().toLowerCase(), \"Admin\");\r\n\t\t\t\t\tgeneratedPassword=cs.generatePassword();\r\n\t\t\t\t\tcs.showCredentials(emp, generatedEmail, generatedPassword);\r\n\t\t}\r\n\t\t//===\r\n\t\telse if (option==3) {\r\n\t\t\tgeneratedEmail=cs.generateEmailAddress(emp.getFirstName().toLowerCase(), \r\n\t\t\t\t\temp.getLastName().toLowerCase(), \"HR\");\r\n\t\t\t\t\tgeneratedPassword=cs.generatePassword();\r\n\t\t\t\t\tcs.showCredentials(emp, generatedEmail, generatedPassword);\r\n\t\t}\r\n\t\t//===\r\n\t\telse if (option==4) {\r\n\t\t\tgeneratedEmail=cs.generateEmailAddress(emp.getFirstName().toLowerCase(), \r\n\t\t\t\t\temp.getLastName().toLowerCase(), \"Legal\");\r\n\t\t\t\t\tgeneratedPassword=cs.generatePassword();\r\n\t\t\t\t\tcs.showCredentials(emp, generatedEmail, generatedPassword);\r\n\t\t}\r\n\t\telse \r\n\t\t\tSystem.out.println(\"Please enter a valid option betwee 1 to 4 only!\");\r\n\t\tsc.close();\r\n\t}", "public static void main(String[] args) throws FileNotFoundException {\n\t\tFile file = new File(\"input.txt\");\n\t\t@SuppressWarnings(\"resource\")\n Scanner scan = new Scanner(file);\n\t\t\n\t\tint caseNumber = scan.nextInt();\n for (int i = 1; i <= caseNumber; i++){\n Long N = scan.nextLong();\n Long L = scan.nextLong();\n List<Long> list = new ArrayList<Long>();\n for(int j = 0; j < L; j++) {\n \tlist.add(scan.nextLong());\n }\n String result = cryptopangrams(N,L,list);\n System.out.println(\"Case #\" + i + \":\" + \" \" + result);\n }\n\t}", "private void setUserAccount() throws FileNotFoundException\r\n\t{\r\n\t\tint index = 0;\r\n\t\tFile inputFile = new File(\"UserAccount.txt\");\r\n\t\tScanner input = new Scanner(inputFile);\r\n\t\tif (!inputFile.exists())\r\n\t\t{\r\n\t\t\tSystem.out.println(\"The text file \\\"UserAccount.txt\\\" is missing\");\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t\twhile(input.hasNextLine())\r\n\t\t{\r\n\t\t\tuserAccounts[0][index] = input.nextLine();\t\t\t//stores the username\r\n\t\t\tuserAccounts[1][index] = input.nextLine();\t\t\t//stores the password\r\n\t\t\tnumOfUsers++;\r\n\t\t\tindex++;\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws IOException {\n Scanner inputFile = new Scanner(System.in); \r\n System.out.println(\"Enter filename and extension: \");\r\n fileInput = inputFile.nextLine();\r\n \r\n int[] theArray = buildArray(); //Initialize buildArray method\r\n userChoice(theArray); //Initialize userChoice method\r\n\r\n }", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t//ask user for file names \n\t\tcustFileName = JOptionPane.showInputDialog(null, \"Choose A Text File To Open For Customer Records\",\"CustomerRecords.txt\");\n\t\taccFileName = JOptionPane.showInputDialog(null, \"Choose A Text File To Open For Account Records\",\"AccountRecords.txt\");\n\t\t//create UserInterface object\n\t\tUserInterface ui = new UserInterface(custFileName,accFileName);\n\t\t//Create the login menu to start the whole application\n\t\tloginMenu loginMenu = new loginMenu();\n\t}", "static String promptForString() {\n String line = \"\";\n\n while (line.compareTo(\"\") == 0) {\n System.out.print(\">\");\n if (Menus.reader.hasNext()) {\n line = Menus.reader.nextLine().strip();\n }\n }\n return line;\n }", "public static void readPassFile(String filepath) throws FileNotFoundException {\r\n Scanner sc = new Scanner(new FileInputStream(filepath));\r\n String [] passData;\r\n while (sc.hasNextLine()) {\r\n passData = sc.nextLine().split(\",\");\r\n // csv file: Email,Password.\r\n addPass(passData[0], passData[1]);\r\n }\r\n sc.close();\r\n }", "public String setPassword(){\n String passWord = \"\";\n while(passWord.isBlank()) {\n System.out.print(\"Please Enter PassWord: \");\n passWord = supplyString.get();\n }\n return passWord.trim();\n }", "public static void main(String[] args) {\n\n\t\tint num = 0;\n\t\t\n\t\tnum = Integer.parseInt(getUserInput());\n\t\tString pw = null;\n\t\tswitch(num) {\n\t\tcase 1 :\n\n\t\t\t pw = getUserInput();\n\t\t\t\n\t\t\t switch (num) {\n\t\t\t case 1 :\n\t\t\t\t System.out.println(pw);\n\t\t\t }\n\t\t\t\n\t\t\t break;\n\t\tcase 2 :\t\n\t\t\tSystem.out.println(pw);\n\t\t\tbreak;\n\t\t}\n\t}", "public void chooseRole()\n {\n Scanner answer = new Scanner(System.in);\n boolean valid = false;\n String role = \"\";\n \n while(!valid)\n {\n menu.displayRoles();\n role = answer.nextLine().trim();\n valid = validation.integerValidation(role, 1, 3);\n }\n \n if(role.equals(\"3\"))\n home();\n else\n createUser(role);\n }", "public void loadGame(){\r\n Scanner in = new Scanner(System.in);\r\n System.out.println(\"Choose a saved game. ( -1 : none )\");\r\n try {\r\n File[] listOfFiles = this.showFiles(this.savePath); //Show the files that have been saved earlier\r\n int i = in.nextInt();\r\n if(i==-1){\r\n return;\r\n }\r\n String filePath = listOfFiles[i].getPath(); //Get the path of the chosen file\r\n this.load(filePath);\r\n } catch (FileNotFoundException ex) {\r\n System.out.println(\"There are no saved games.\");\r\n }\r\n }" ]
[ "0.6092776", "0.5946444", "0.5773229", "0.5747737", "0.56000876", "0.55437547", "0.54633224", "0.5447441", "0.53721386", "0.5290058", "0.52765036", "0.5251198", "0.52473116", "0.5217164", "0.51996446", "0.5186014", "0.51814276", "0.51807976", "0.5161696", "0.515943", "0.5159268", "0.51513326", "0.51396674", "0.5115661", "0.511404", "0.5112916", "0.51071846", "0.5094629", "0.5087235", "0.50708467", "0.5057726", "0.50456965", "0.50385576", "0.50294906", "0.5017964", "0.5012138", "0.5010829", "0.5005774", "0.4998641", "0.4983634", "0.49792066", "0.49782684", "0.4968207", "0.495976", "0.4958435", "0.49560285", "0.49494606", "0.49460262", "0.4940343", "0.4938267", "0.49218997", "0.49180412", "0.49132216", "0.48972484", "0.48953682", "0.48883945", "0.48869768", "0.48854125", "0.48826057", "0.48534375", "0.48476756", "0.48470986", "0.4846671", "0.48460346", "0.48391753", "0.48292565", "0.48285353", "0.48281246", "0.4826505", "0.48252565", "0.48174325", "0.481419", "0.48135525", "0.48122188", "0.48093346", "0.48044038", "0.480404", "0.4797512", "0.47962078", "0.47935846", "0.47913426", "0.47902215", "0.4786127", "0.47835642", "0.4781308", "0.478057", "0.47752503", "0.47725198", "0.47719055", "0.4768617", "0.47631878", "0.47515768", "0.47498587", "0.47493932", "0.47485033", "0.474775", "0.4747397", "0.47450912", "0.4724938", "0.47215772" ]
0.7479584
0
Updates the statistics display of the current run of the program
public void updateStats(Account recent, boolean success) { lblRecentAttempt.setText(recent.getUsername() + ":" + recent.getPassword()); recoveryAttempts++; lblStats.setText("Attempts: " + recoveryAttempts + " - Successful: " + recoverySuccesses); if (success) { recoverySuccesses++; recoveryListModel.addElement(recent.getUsername() + ":" + recent.getPassword()); queueGen.setNewestRecovery(recent.getUsername()); success = true; // Alerts the user of a successful recovery if (userAlert) { JOptionPane.showMessageDialog( null, recent.getUsername() + " : " + recent.getPassword(), "New Recovery", JOptionPane.INFORMATION_MESSAGE); } // Saves the successful recovery to a file try { File f = null; if (fileNum == -1) { for (int i = 0; ; i++) { f = new File("Recoveries" + i + ".txt"); if (!f.exists()) { fileNum = i; break; } } } f = new File("Recoveries" + fileNum + ".txt"); BufferedWriter outFile = new BufferedWriter(new FileWriter(f)); for (int x = 0; x < recoveryListModel.size(); x++) { outFile.write("" + recoveryListModel.get(x)); outFile.newLine(); } outFile.close(); } catch (Exception ex) { ex.printStackTrace(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void updateStats()\n\t{\n\n\t\tint[] temp = simulation.getStatValue();\n\t\tfor(int i = 0; i < temp.length; i++)\n\t\t{\n\t\t\tthis.statsValues[i].setText(Integer.toString(temp[i]));\n\t\t}\n\t\t\n\t\tint[] temp2 = simulation.getNumberInEachLine();\n\t\tfor(int i = 0; i < temp2.length; i++)\n\t\t{\n\t\t\tthis.eatValues[i].setText(Integer.toString(temp2[i]));\n\t\t}\n\t}", "@Override\n public void refreshGui() {\n int count = call(\"getCountAndReset\", int.class);\n long nextTime = System.currentTimeMillis();\n long elapsed = nextTime - lastTime; // ms\n double frequency = 1000 * count / elapsed;\n lastTime = nextTime;\n stats.addValue(frequency);\n\n outputLbl.setText(String.format(\"%3.1f Hz\", stats.getGeometricMean()));\n }", "public void update() {\n\n\t\tdisplay();\n\t}", "public void stats() {\n\t\tSystem.out.println(\"The score is: \" + score \n\t\t\t\t+ \"\\nNumber of Astronauts rescused: \" + rescuedAstronauts \n\t\t\t\t+ \"\\nNumber of Astronauts roaming: \" + roamingAstronauts\n\t\t\t\t+ \"\\nNumber of Aliens rescued: \" + rescuedAliens\n\t\t\t\t+ \"\\nNumber of Aliens roaming: \" + roamingAliens);\n\t}", "public void displayStats()\n {\n if(graph == null)\n {\n clearStats();\n }\n else\n { \n pathJTextArea.setText(graph.getPathString(pathList));\n costJTextField.setText(decimal.format(graph.getPathCost(pathList)));\n timeJTextField.setText(String.valueOf(timePassed));\n }\n }", "public static void showStatistics(){\n\n }", "void printStats();", "public void statistics(){\n System.out.println(this.scoreboard.toString());\n }", "public void updateStatisticsData() {\r\n\t\tif (this.statisticsTabItem != null && !this.statisticsTabItem.isDisposed()) {\r\n\t\t\tif (Thread.currentThread().getId() == DataExplorer.application.getThreadId()) {\r\n\t\t\t\tthis.statisticsTabItem.updateStatisticsData(true);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tGDE.display.asyncExec(new Runnable() {\r\n\t\t\t\t\tpublic void run() {\r\n\t\t\t\t\t\tDataExplorer.this.statisticsTabItem.updateStatisticsData(true);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void updateStatistics(List<Creature> mobs) {\n time++;\n statisticsPane.printStatistics(mobs, time);\n }", "public void printStatistics() {\n\t// Skriv statistiken samlad så här långt\n stats.print();\n }", "public void displayStats() {\n VisitorDAO visitorDAO = new VisitorDAO();\n Object countAllVisitors = visitorDAO.getCountAllVisitors();\n Object countNewSubscribers = visitorDAO.getCountNewSubscribersForMonth(this.simpleDateFormat.format(new Date()));\n\n this.totalSubscribersText.setText(this.totalSubscribersText.getText() + countAllVisitors.toString());\n this.newSubscribersText.setText(this.newSubscribersText.getText() + countNewSubscribers.toString());\n }", "public void printStats() {\n\t\tSystem.out.println(\"========== LCMFreq v0.96r18 - STATS ============\");\n\t\tSystem.out.println(\" Freq. itemsets count: \" + frequentCount);\n\t\tSystem.out.println(\" Total time ~: \" + (endTimestamp - startTimestamp)\n\t\t\t\t+ \" ms\");\n\t\tSystem.out.println(\" Max memory:\" + MemoryLogger.getInstance().getMaxMemory());\n\t\tSystem.out.println(\"=====================================\");\n\t}", "public void update(){\n\t\tsetChanged();\n\t\trender();\n\t\tprintTimer();\n\t}", "public static void displaySta() {\n System.out.println(\"\\n\\n\");\n System.out.println(\"average service time: \" + doAvgProcessingTime() /100 + \" milliseconds\");\n System.out.println(\"max service time: \" + maxProcessingTime /100 + \" milliseconds\");\n System.out.println(\"average turn around time \" + doAvgTurnAroundTime()/100 + \" milliseconds\");\n System.out.println(\"max turn around time \" + maxTurnAroundTime/100 + \" milliseconds\");\n System.out.println(\"average wait time \" + doAvgWaitTime()/10000 + \" milliseconds\");\n System.out.println(\"max wait time \" + maxWaitTime/10000 + \" milliseconds\");\n System.out.println(\"end time \" + endProgramTime);\n System.out.println(\"start time \" + startProgramTime);\n System.out.println(\"processor utilization: \" + doCPU_usage() + \" %\");\n System.out.println(\"Throughput: \" + doThroughPut());\n System.out.println(\"---------------------------\");\n\n\n }", "private final void updateStatistics(){\r\n\t\tstatisticsText_.setLength(0); \t//reset\r\n\t\t\r\n\t\tRegion[][] regions = Map.getInstance().getRegions();\r\n\t\tVehicle[] vehicles;\r\n\t\tVehicle vehicle;\r\n\t\tint i, j, k;\r\n\t\tint activeVehicles = 0;\r\n\t\tint travelledVehicles = 0;\r\n\t\tint wifiVehicles = 0;\r\n\t\tlong messagesCreated = 0;\r\n\t\tlong IDsChanged = 0;\r\n\t\tdouble messageForwardFailed = 0;\r\n\t\tdouble travelDistance = 0;\r\n\t\tdouble travelTime = 0;\r\n\t\tdouble speed = 0;\r\n\t\tdouble knownVehicles = 0;\r\n\t\tfor(i = 0; i < regions.length; ++i){\r\n\t\t\tfor(j = 0; j < regions[i].length; ++j){\r\n\t\t\t\tvehicles = regions[i][j].getVehicleArray();\r\n\t\t\t\tfor(k = 0; k < vehicles.length; ++k){\r\n\t\t\t\t\tvehicle = vehicles[k];\r\n\t\t\t\t\tif(vehicle.getTotalTravelTime() > 0){\r\n\t\t\t\t\t\t++travelledVehicles;\r\n\t\t\t\t\t\ttravelDistance += vehicle.getTotalTravelDistance();\r\n\t\t\t\t\t\ttravelTime += vehicle.getTotalTravelTime();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(vehicle.isActive()){\r\n\t\t\t\t\t\t++activeVehicles;\r\n\t\t\t\t\t\tspeed += vehicle.getCurSpeed();\r\n\t\t\t\t\t\tif(vehicle.isWiFiEnabled()){\r\n\t\t\t\t\t\t\t++wifiVehicles;\r\n\t\t\t\t\t\t\tmessageForwardFailed += vehicle.getKnownMessages().getFailedForwardCount();\r\n\t\t\t\t\t\t\tknownVehicles += vehicle.getKnownVehiclesList().getSize();\r\n\t\t\t\t\t\t\tIDsChanged += vehicle.getIDsChanged();\r\n\t\t\t\t\t\t\tmessagesCreated += vehicle.getMessagesCreated();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.currentTime\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(Renderer.getInstance().getTimePassed()));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.activeVehicles\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(activeVehicles));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageSpeed\")); //$NON-NLS-1$\r\n\t\tif(activeVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(speed/activeVehicles/100000*3600));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\" km/h\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageTravelDistance\")); //$NON-NLS-1$\r\n\t\tif(travelledVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(travelDistance/travelledVehicles/100));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\" m\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageTravelTime\")); //$NON-NLS-1$\r\n\t\tif(travelledVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(travelTime/travelledVehicles/1000));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\" s\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.wifiVehicles\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(wifiVehicles));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.averageKnownVehicles\")); //$NON-NLS-1$\r\n\t\tif(wifiVehicles > 0) statisticsText_.append(INTEGER_FORMAT_FRACTION.format(knownVehicles/wifiVehicles));\r\n\t\telse statisticsText_.append(\"0\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.uniqueMessages\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(messagesCreated));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.failedMessages\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(messageForwardFailed));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(Messages.getString(\"ReportingControlPanel.totalIDchanges\")); //$NON-NLS-1$\r\n\t\tstatisticsText_.append(INTEGER_FORMAT.format(IDsChanged));\r\n\t\tstatisticsText_.append(\"\\n\"); //$NON-NLS-1$\r\n\t\t\r\n\t\tstatisticsTextArea_.setText(statisticsText_.toString());\r\n\t}", "public void updateStats(BufferedImage toShow) {\n\t\tUpdateStats stats = new UpdateStats();\n\t\tstats.toShow = toShow;\n\t\ttry {\n\t\t\tSwingUtilities.invokeAndWait(stats);\n\t\t} catch (Exception e) {\n\t\t\tJOptionPane.showMessageDialog(this, \"Error: \" + e, \"Training\", JOptionPane.ERROR_MESSAGE);\n\t\t}\n\n\t\tif (Inpainter.completed) { // Inpainting completes\n\n\t\t\tJOptionPane.showMessageDialog(this, \" Inpainting is completed.\", \"Inpainting\", JOptionPane.PLAIN_MESSAGE);\n\t\t}\n\t\tif (Inpainter.completed || Inpainter.halt) {\n\t\t\tSystem.out.println(\"Inpainting completed or halted\");\n\t\t\tinpaintThread = null;\n\t\t\tImage tmg = createImage(((Image) toShow).getWidth(this), ((Image) toShow).getHeight(this));\n\t\t\tGraphics tg = tmg.getGraphics();\n\t\t\ttg.drawImage(toShow, 0, 0, null);\n\t\t\tentry.SavedImages.push(tmg);\n\t\t\tentry.setEnabled();\n\t\t\tentry.RedoImages.clear();\n\t\t\tfastInpaint = false;\n\t\t}\n\t}", "public void update(){\n\t\tif (!VisualizerMain.selectedRun.equals(\"\")){\n\t\t\tupdateEpochNum();\n\t\t\tupdateParticles();\n\t\t\tthis.repaint();\n\t\t}\n\t\t\n\t}", "@Override\n public void updateStats() {\n if (isEnglish) {\n String moves = NUM_MOVES + presenter.getNumMoves();\n String time = TIME_LEFT + presenter.getTimeLeft();\n String points = POINTS + presenter.getPoints();\n painterTextViewMoves.setText(moves);\n painterTextViewTime.setText(time);\n painterTextViewPoints.setText(points);\n } else {\n String moves = NUM_MOVES_CHINESE + presenter.getNumMoves();\n String time = TIME_LEFT_CHINESE + presenter.getTimeLeft();\n String points = POINTS_CHINESE + presenter.getPoints();\n painterTextViewTime.setText(time);\n painterTextViewMoves.setText(moves);\n painterTextViewPoints.setText(points);\n }\n }", "public void run() {\n updateSyncStats();\n\n double d = uploadCounter.calculateCurrentKBS();\n if (getController().getTransferManager().countActiveUploads() == 0)\n {\n // Hide KB/s when not active uploads\n d = 0;\n }\n if (Double.compare(d, 0) == 0) {\n uploadsLine.setNormalLabelText(Translation\n .getTranslation(\"status_tab.files_uploads\"));\n } else {\n String s = Format.formatDecimal(d);\n uploadsLine.setNormalLabelText(Translation.getTranslation(\n \"status_tab.files_uploads_active\", s));\n }\n d = downloadCounter.calculateCurrentKBS();\n if (getController().getTransferManager().countActiveDownloads() == 0)\n {\n // Hide KB/s when no active downloads\n d = 0;\n }\n if (Double.compare(d, 0) == 0) {\n downloadsLine.setNormalLabelText(Translation\n .getTranslation(\"status_tab.files_downloads\"));\n } else {\n String s = Format.formatDecimal(d);\n downloadsLine.setNormalLabelText(Translation.getTranslation(\n \"status_tab.files_downloads_active\", s));\n }\n }", "public void stats() {\n\t\tSystem.out.println(\"Hash Table Stats\");\n\t\tSystem.out.println(\"=================\");\n\t\tSystem.out.println(\"Number of Entries: \" + numEntries);\n\t\tSystem.out.println(\"Number of Buckets: \" + myBuckets.size());\n\t\tSystem.out.println(\"Histogram of Bucket Sizes: \" + histogram());\n\t\tSystem.out.printf(\"Fill Percentage: %.5f%%\\n\", fillPercent());\n\t\tSystem.out.printf(\"Average Non-Empty Bucket: %.7f\\n\\n\", avgNonEmpty());\t\t\n\t}", "private void calculateAndDisplayFps() {\n if (fpsTimer.secondHasPassed()) {\n fpsTimer.getElapsedTimeAndUpdate();\n if (window.optionIsTurnedOn(Window.Options.DISPLAY_FPS)) {\n window.setTitle(gameTitle + \" - \" + fps + \" FPS\");\n }\n fps = 0;\n }\n fps++;\n }", "void statistics();", "private void updateStats()\r\n\t{\r\n\t\t//Get prime and cross size\r\n\t\tint primesGenerated = m_Primes.getPrimeList().size();\r\n\t\tint crossesGenerated = m_Primes.getHexagonCrossList().size();\r\n\t\tlblPrimesGenerated.setText(\"Primes generated: \" + primesGenerated);\r\n\t\tlblCrossesGenerated.setText(\"Crosses generated: \" + crossesGenerated);\r\n\t\t\r\n\t\t//Get largest prime digit\r\n\t\tif (m_Primes.getPrimeList().size() != 0) {\r\n\t\t\tBigInteger largestPrime = m_Primes.getPrimeList().get(m_Primes.getPrimeList().size() - 1);\r\n\t\t\tint lengthLargestPrime = String.valueOf(largestPrime).length();\r\n\t\t\tlblLengthLargestPrime.setText(\"The largest prime has \" + lengthLargestPrime + \" digits\");\r\n\t\t}\r\n\t\t\r\n\t\t//Get largest hexagon cross digit\r\n\t\tif (m_Primes.getHexagonCrossList().size() != 0) {\r\n\t\t\tPair<BigInteger> largestCrossPair = m_Primes.getHexagonCrossList().get(m_Primes.getHexagonCrossList().size() - 1);\r\n\t\t\tBigInteger largestCross1 = largestCrossPair.getPairVal1();\r\n\t\t\tBigInteger largestCross2 = largestCrossPair.getPairVal2();\r\n\t\t\tint lengthLargestCross1 = String.valueOf(largestCross1).length();\r\n\t\t\tint lengthLargestCross2 = String.valueOf(largestCross2).length();\r\n\t\t\tlblLengthLargestCrosses.setText(\"The largest hexagon cross has \" + lengthLargestCross1 + \" digits and \" + lengthLargestCross2 + \" digits\");\r\n\t\t}\r\n\t\t\r\n\t\tframe.revalidate();\r\n\t\tframe.repaint();\r\n\t\t\r\n \t}", "public void computeStats() {\n\t\tstats = new Stats();\t\t\n\t}", "private void setStats()\r\n {\r\n solutionText.setText(\"Solution Length: \"\r\n + Integer.toString(problem.getSolutionLength())\r\n + \"\\n# Queue Ops: \" + Integer.toString(problem.getQueueOps())\r\n + \"\\nMaxQueueSize: \" + Integer.toString(problem.getMaxQueueSize())\r\n //+ \"\\nOpen Discoveries: \" + Integer.toString(problem.getOR())\r\n //+ \"\\nClosed Discoveries: \" + Integer.toString(problem.getCR())\r\n );\r\n\r\n // resize\r\n solutionText.setFont(new Font(Font.SANS_SERIF, Font.BOLD | Font.ITALIC, 12));\r\n solutionText.setPreferredSize(\r\n new Dimension(calculateTextWidth(solutionText.getText().split(\"\\\\n\"),\r\n solutionText.getFontMetrics(solutionText.getFont())) + 60,\r\n calculateTextHeight(solutionText.getText().split(\"\\\\n\"),\r\n solutionText.getFontMetrics(solutionText.getFont()))));\r\n solutionLabel.setPreferredSize(new Dimension(solutionText.getPreferredSize().width,\r\n solutionText.getPreferredSize().height + solutionLabel.getIconTextGap() * 2));\r\n }", "@Override\n\t\t\tpublic void run() \n\t\t\t{\n\t\t\t\tsummaryPanel.updatePanel();\n\t\t\t\tsummaryPanel.updatePlayerStatus(\"\");\n\t\t\t}", "public void statsAction() {\n StatsWin newWindow = getSelectedCell().mkStatsWin();\n WindowUtils.avoidParent(newWindow, parentFrame);\n watchers.add(newWindow);\n }", "public abstract void showStat();", "public void printStatistics() {\r\n\t\tLog.info(\"*** Statistics of Sequence Selector ***\");\r\n\r\n\t\t// chains\r\n\t\tLog.info(String.format(\"Chains: %d\", chains.size()));\r\n\t\tLog.info(String.format(\"Executable Chains: %d\", execChains.size()));\r\n\t\tLog.info(String.format(\"Causal Executable Chains: %d\",\r\n\t\t\t\tcausalExecChains.size()));\r\n\r\n\t\t// bushes\r\n\t\tLog.info(String.format(\"Bushes: %d\", bushes.size()));\r\n\t\tLog.info(String.format(\"Executable Bushes: %d\", execBushes.size()));\r\n\t\tLog.info(String.format(\"Required Bushes: %d\", requiredExecBushes.size()));\r\n\t\tLog.info(String.format(\"Redundant Bushes: %d\",\r\n\t\t\t\tredundantExecBushes.size()));\r\n\r\n\t\t// total\r\n\t\tLog.info(String.format(\"Bushes in Chains: %d\", bushesInChains.size()));\r\n\t\tLog.info(String.format(\"Total Sequences: %d\", totalSequences.size()));\r\n\r\n\t\t// time\r\n\t\tLog.info(String.format(\"Total Time: %d ms\", stopWatch.getTime()));\r\n\t\tLog.info(String.format(\"Time per Event: %d ms\", stopWatch.getTime()\r\n\t\t\t\t/ events.size()));\r\n\t}", "private static void printStats()\r\n\t{\r\n\t\tSystem.out.println(\"Keywords found: \" + keywordHits);\r\n\t\tSystem.out.println(\"Links found: \" + SharedLink.getLinksFound());\r\n\t\tSystem.out.println(\"Pages found: \" + SharedPage.getPagesDownloaded());\r\n\t\tSystem.out.println(\"Failed downloads: \" + SharedPage.getFailedDownloads());\r\n\t\tSystem.out.println(\"Producers: \" + fetchers);\r\n\t\tSystem.out.println(\"Consumers: \" + parsers);\r\n\t}", "private static void displayStats() {\n\t\tint numPlay = 0;\n\t\tint numWon = 0;\n\t\tint sumGuess = 0;\n\t\tint minGuess = Integer.MAX_VALUE;\n\t\tint maxGuess = Integer.MIN_VALUE;\n\t\tdouble average = 0;\n\t\tint lastNumGuess = 0;\n\t\ttry {\n\t\t\tBufferedReader reader = new BufferedReader(new FileReader(fileName));\n\t\t\tString line = \"\";\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tnumPlay++;\n\t\t\t\tlastNumGuess = Integer.parseInt(line);\n\t\t\t\tif (lastNumGuess > 0) { // a positive number of guesses indicates the user won the game\n\t\t\t\t\tnumWon++;\n\t\t\t\t\tminGuess = Math.min(minGuess, lastNumGuess);\n\t\t\t\t\tmaxGuess = Math.max(maxGuess, lastNumGuess);\n\t\t\t\t\tsumGuess += lastNumGuess;\n\t\t\t\t}\n\t\t\t}\n\t\t\treader.close();\n\t\t} catch (FileNotFoundException exception) {\n\t\t\tSystem.out.println(\"It seems that you haven't played this game before. Keep playing to gather statistics!\");\n\t\t\treturn;\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(\"Sorry the software encountered an IO Error. Please try again later.\");\n\t\t}\n\t\tSystem.out.println(\"Below are the summary statistics: \");\n\t\tSystem.out.println(\"Number of games played: \" + numPlay);\n\t\tSystem.out.println(\"Number of games won: \" + numWon);\n\t\tSystem.out.println(String.format(\"Total number of guesses: %d\", sumGuess + 12 * (numPlay - numWon)));\n\t\tif (lastNumGuess < 1) {\n\t\t\tSystem.out.println(\"Last time you lost\");\n\t\t} else {\n\t\t\tSystem.out.println(String.format(\"Last time you won and made %d guess%s\", lastNumGuess,\n\t\t\t\t\t(lastNumGuess > 1 ? \"es\" : \"\")));\n\t\t}\n\t\tif (numWon > 0) {\n\t\t\tSystem.out.println(\"Minimum number of guesses to win: \" + minGuess);\n\t\t\tSystem.out.println(\"Maximum number of guesses to win: \" + maxGuess);\n\t\t\taverage = (double) sumGuess / numWon;\n\t\t\tSystem.out.println(String.format(\"Average number of guesses to win: %.2f\", average));\n\t\t}\n\t}", "private static void printStats(Stats stats) {\n long elapsedTime = (System.nanoTime() - startTime) / 1000000;\n System.out.println(\"Analysis completed - \" + keyCount + \" keys processed in \" + elapsedTime + \" ms\");\n getConsole().println(\"Analysis completed - \" + keyCount + \" keys processed in \" + elapsedTime + \" ms\");\n stats.print();\n }", "public void printStats() {\n\t\tSystem.out.println(\"============= RULEGROWTH - STATS ========\");\n\t\tSystem.out.println(\"Sequential rules count: \" + ruleCount);\n\t\tSystem.out.println(\"Total time: \" + (timeEnd - timeStart) + \" ms\");\n\t\tSystem.out.println(\"Max memory: \" + MemoryLogger.getInstance().getMaxMemory());\n\t\tSystem.out.println(\"==========================================\");\n\t}", "private void updateMemInfo() {\n\t\tproNum = getRunningNum();\r\n\r\n\t\ttv_pronum.setText(\"进程总数:\" + proNum);\r\n\r\n\t\ttv_mem.setText(\"剩余内存:\" + getRomAvailaleSize());\r\n\t}", "private void updateInfoLabel() {\n\n int achievementTotal = 0;\n int achievementDone = 0;\n\n for (Game game : tableView.getItems()) {\n if (game.isPopulated() && game.getHasStats()) {\n achievementTotal += game.achievementsTotalProperty().get();\n achievementDone += game.achievementsDoneProperty().get();\n }\n }\n\n int percentage = 100;\n if (achievementTotal > 0) {\n percentage = achievementDone * 100 / achievementTotal;\n }\n\n lblInfo.setText(\"Games loaded: \" + tableView.getItems().size() + \", Achievements: \" + achievementTotal + \", Unlocked: \" + achievementDone + \" (\" + percentage + \"%)\");\n\n }", "public void outputStats (){\n System.out.println(\"Your sorcerer's stats:\");\n System.out.println(\"HP = \" + hp);\n System.out.println(\"Mana = \" + mana);\n System.out.println(\"Strength = \" + strength);\n System.out.println(\"Vitality = \" + vitality);\n System.out.println(\"Energy = \" + energy);\n }", "@Override\n public void updateBuzzerCount() {\n getProgramController().setSimpleOutputView(new SimpleOutputView(getProgramController()));\n getProgramController().getProgramView().repaint();\n getProgramPresentationView().updateBuzzerCount();\n }", "public void updateDisplay(FitnessProgram fitnessProg) {\n\n\t\tdisplay.setText(\"\");\n\t\tString sTime = \"\";\n\t\tString cName = \"\";\n\t\tString tName = \"\";\n\t\tint start = 0;\n\t\tStringBuilder startTimes = new StringBuilder(sTime);\n\t\tStringBuilder classNames = new StringBuilder(cName);\n\t\tStringBuilder tutorNames = new StringBuilder(tName);\n\n\t\tfitnessClass = fitnessProg.allFClasses();\n\t\tint i;\n\t\tfor (i = 0; i < fitnessClass.length; i++)\t{\n\n\t\t\tif (fitnessClass[i] == null) {\n\t\t\t\tstart = i+9;\n\t\t\t\tcName = \"Available\";\n\t\t\t\ttName = \"\";\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tstart = fitnessClass[i].getStartTime();\n\t\t\t\tcName = fitnessClass[i].getClassName();\n\t\t\t\ttName = fitnessClass[i].getTutorName();\n\n\t\t\t}\n\t\t\tsTime = String.format(\"%7d - %d\", start, start+1);\n\t\t\tcName = String.format(\"%12s\", cName);\n\t\t\ttName = String.format(\"%12s\", tName);\n\t\t\tstartTimes.append(sTime);\n\t\t\tclassNames.append(cName);\n\t\t\ttutorNames.append(tName);\n\t\t}\n\n\t\tdisplay.append(startTimes.toString() + \"\\n\");\n\t\tdisplay.append(classNames.toString() + \"\\n\");\n\t\tdisplay.append(tutorNames.toString() + \"\\n\");\n\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tmCpuinfo = ShellHelper.getProc(CPU_INFO_PROC);\n\t\t\t\tupdateCpuStats();\n\t\t\t\tfor (LogicalCpu c : mLogicalCpus) {\n\t\t\t\t\tc.updateFrequency();\n\t\t\t\t\tc.updateGovernor();\n\t\t\t\t\tc.updateTimeInFrequency();\n\t\t\t\t\tc.updateTotalTransitions();\n\t\t\t\t}\n\t\t\t}", "void updateScore () {\n scoreOutput.setText(Integer.toString(score));\n }", "public void reportStats() {\n System.out.println(\"Number of requests: \" + (requestCount - warmUpRequests));\n System.out.println(\"Number of hits: \" + hitCount);\n System.out.println(\"hit ratio: \" + (double) hitCount / (requestCount - warmUpRequests));\n System.out.println(\"Average hit cost: \" + (double) hitCost / hitCount);\n }", "public void dailyStats(){\n\t\tString outputString = \"\\nTotal Money Made Today: $\" + (float)Math.round(dailyMoneyMade * 100.0) / 100.0 + \" \\n\";\n\t\toutputString = outputString + \"Catering Sales: $\" + (float)Math.round(cateringDailyMade * 100.0) / 100.0 + \" Business Sales: $\" \n\t\t+ (float)Math.round(businessDailyMade * 100.0) / 100.0 +\" Casual Sales: $\" + (float)Math.round(casualDailyMade * 100.0) / 100.0 +\"\\n\";\n\t\t\n\n\t\toutputString = outputString + \"\\nTotal Outages Today: \" + dailyDisruptions + \" \\n\";\n\t\toutputString = outputString + \"Catering Outages: \" + cateringOuttages + \" Business Outages: \" + businessOuttages +\" Casual Outages: \" + casualOuttages +\"\\n\";\n\n\t\tSystem.out.println(outputString);\n\t\tthis.status = outputString;\n\t\tsetChanged();\n notifyObservers();\n\t}", "static void showStatistics() throws IOException {\n System.out.println(\"You entered \" + initialSlots + \" for the number of slots on your wheel.\");\n System.out.println(\"You entered \" + initialZeroes + \" for the number of 0's or 00's on your wheel.\");\n System.out.println(\"You entered \" + initialVisits + \" for the number of times you visited to the casino.\");\n System.out.println(\"You entered $\" + initialDollars + \" for the amount of money you started with at every visit to the casino.\");\n System.out.println(\"You had $\" + dollarsRisked + \" for the total amount of money you brought to the casino over your visits.\");\n System.out.println(\"You walked away with $\" + moneyCount + \" total over \" + winCount + \" wins of your \" + initialVisits + \" total visits. This is %\" + df.format(percentWon) +\n \" of the $\" + dollarsRisked + \" you brought to the casino.\");\n System.out.println(\"Your most money won on a spin was $\" + biggestGain + \" across all your visits.\");\n // Prints to console if the user never won once on all their visits to the casino, otherwise lets them know the largest amount they walked away with\n if (largestWalkedAway < 1) {\n System.out.println(\"Sorry, you never walked away a winner across all \" + initialVisits + \" visits to the casino.\");\n } else {\n System.out.println(\"The most you ever walked away with on a visit to the casino was $\" + largestWalkedAway + \".\");\n }\n System.out.println(\"You came out a loser \" + lossCount + \" times out of your \" + initialVisits + \" visits.\" );\n // Prints to console only if the user never won once on all their visits to the casino\n if (completeLoss >= 1) {\n System.out.println(\"You completely lost all of your money in \" + completeLoss + \" visits.\");\n }\n // Gives the user of their average winnings/losses per visit of the casino\n System.out.println(\"You won an average of $\" + df.format(((float)runningTotal / initialVisits))+ \" each time you visited the casino.\");\n System.out.println(\"Out of \" + initialVisits + \" visits you walked away a winner \" + winCount + \" times. You walked away a loser \" + lossCount + \" times. \" +\n \"You broke even \" + brokeEven + \" times.\\n\");\n // Prompts the user to press Enter to exit the program\n System.out.println(\"Press Enter to exit.\");\n System.in.read();\n }", "public void printStats() {\n\n System.out.println(\"Number of Users Arrived: \" + numIn);\n System.out.println(\"Number of Users Exited: \" + numOut);\n System.out.println(\"Average Time Spent Waiting for Cab: \" + (totTimeWait / numIn));\n if (numOut != 0) {\n System.out.println(\"Average Time Spent Waiting and Travelling: \" + (totTime / numOut));\n }\n }", "private void updateInformation(){\n view.getPrompt().setText(getPrompt());\n view.getScore().setText(getScore());\n }", "public static void showStats() {\n\n List<String> stats = statsList.subList(Math.max(statsList.size() - 3, 0), statsList.size());\n\n System.out.println(\"Stats:\");\n for(String stat : stats){\n System.out.println(stat);\n }\n }", "private static void updateCounters() {\n\t\tongoingProjectsLabel.setText(\"Ongoing Projects (\" + portfolio.getOngoingCount() + \")\");\n\t\tfinishedProjectsLabel.setText(\"Finished Projects (\" + portfolio.getFinishedCount() + \")\");\n\t}", "public void update(double executions) {\n\t\tframeRate.setText(formatter.format(executions) + \"FPS\");\n\t}", "@Scheduled(fixedRate = 3600_000, initialDelay = 3600_000)\n public static void showAllStatsJob() {\n showStats(allStats, \"All stats\");\n }", "public void initGui()\n {\n this.screenTitle = I18n.format(\"gui.stats\");\n this.doesGuiPauseGame = true;\n this.mc.getConnection().sendPacket(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS));\n }", "@Override\n public void run() {\n descriptionActivity.mReadingScore.setText(\"Reading: \"+ read);\n descriptionActivity.mMathScore.setText(\"Math: \" + math);\n descriptionActivity.mWritingScore.setText(\"Writing: \" + writing);\n }", "public void show() {\n\t\t\n\t\tSystem.out.println(\"time (tree setup) = \" + treeSetup + \" ms\");\n\t\tSystem.out.println(\"time (average search) = \" + (totalSearch/(float)countSearch) + \" ms\");\n\t\tSystem.out.println(\"time (average at) = \" + (totalAt/(float)countAt) + \" ms\");\n \t}", "public void update() {\n\t\tremoveAll();\n\t\tdrawGraph();\n\t\tplotEntries();\n\t}", "private void updateDisplayText(double change) { updateDisplayText(change, null); }", "public void updatePlayerHealthUI() {\n CharSequence text = String.format(\"Score: %d\", getscore());\n scoreLabel.setText(text);\n }", "public void updateStats() {\n ObservableList<Node> children = gpLocations.getChildren();\n for (int i = 0; i < gpLocations.getChildren().size() / 2; i++)\n for (Node n : children)\n if (gpLocations.getRowIndex(n) == i + 1 && gpLocations.getColumnIndex(n) == 1) {\n Text t = (Text) n;\n t.setText(String.format(\n \"\\t\\t%.1f\", activeCar.getCurrentLocation().getDistanceToLocation(locations.get(i))));\n }\n\n children = gpCars.getChildren();\n for (int j = 0; j < gpCars.getChildren().size() / 2; j++)\n for (Node m : children)\n if (gpCars.getRowIndex(m) == j + 1 && gpCars.getColumnIndex(m) == 1) {\n Text tmpM = (Text) m;\n tmpM.setText(String.format(\"\\t\\t%.1f\", cars.get(j).getTime()));\n }\n\n children = gridPane.getChildren();\n for (Node o : children)\n if (gridPane.getRowIndex(o) == 5 && gpCars.getColumnIndex(o) == 0) {\n Text tmpO = (Text) o;\n tmpO.setText(\"Active Car\\t\" + activeCar.getIdentifier() + \" \" + activeCar.getEnd().getName());\n }\n }", "public static void stdout(){\n\t\tSystem.out.println(\"Buildings Found: \" + buildingsFound);\n\t\tSystem.out.println(\"Pages searched: \"+ pagesSearched);\n\t\tSystem.out.println(\"Time Taken: \" + (endTime - startTime) +\"ms\");\t\n\t}", "@Override\n public void updateStats() {\n if (entering || isLogoutStarted()) {\n return;\n }\n\n refreshOverloaded();\n refreshExpertisePenalty();\n super.updateStats();\n }", "private void updateStatus() {\n String statusString = dataModel.getStatus().toString();\n if (dataModel.getStatus() == DefinitionStatus.MARKER_DEFINITION) {\n statusString += \" Number of markers: \" + dataModel.getNumberOfMarkers() + \". Current position: \"\n + dataModel.getTempMousePosition();\n }\n if (dataModel.getStatus() == DefinitionStatus.POINTS_DEFINITION) {\n statusString += \" Number of point fields: \" + dataModel.getNumberOfPoints() + \". Current position: \"\n + dataModel.getTempMousePosition();\n }\n statusLabel.setText(statusString);\n }", "public static void _generateStatistics() {\n\t\ttry {\n\t\t\t// Setup info\n\t\t\tPrintStream stats = new PrintStream(new File (_statLogFileName + \".txt\"));\n\n\t\t\tScanner scan = new Scanner(new File(_logFileName+\".txt\"));\n\t\t\twhile (scan.hasNext(SETUP.toString())) {\n\t\t\t\t// Append setup info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tstats.append(\"\\n\");\n\n\t\t\twhile (scan.hasNext(DETAILS.toString()) || scan.hasNext(RUN.toString())) {\n\t\t\t\t// Throw detailed info away\n\t\t\t\tscan.nextLine();\n\t\t\t}\n\n\t\t\twhile (scan.hasNext()) {\n\t\t\t\t// Append post-run info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tscan.close();\n\t\t\tstats.append(\"\\n\");\n\n\t\t\t// Perf4J info\n\t\t\tReader reader = new FileReader(_logFileName+\".txt\");\n\t\t\tLogParser parser = new LogParser(reader, stats, null, 10800000, true, new GroupedTimingStatisticsTextFormatter());\n\t\t\tparser.parseLog();\n\t\t\tstats.close();\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void showStatistic() {\n timeline.pause();\n startButton.setText(\"Start\");\n isRunning = false;\n\n //Creates a text input dialog window so that the user can choose the number of iterations.\n textInputDialogStatistics.setHeaderText(\"Show Statistics\");\n textInputDialogStatistics.setContentText(\"Enter statistic length\");\n Optional<String> result =textInputDialogStatistics.showAndWait();\n\n String out = \"\";\n\n //Checks if the input dialog is empty, and else sets the input as \"out\"\n if(result.isPresent() && !textInputDialogStatistics.getResult().isEmpty()){\n out = textInputDialogStatistics.getResult();\n }\n\n if(!out.equals(\"\")){\n try {\n //Tries to load the fxml and sets the statisticsController from that.\n int iterations = Integer.parseInt(out);\n\n progressStage = new Stage();\n FXMLLoader loader = new FXMLLoader(getClass().getResource(\"/view/Progress.fxml\"));\n Parent root = loader.load();\n progressController = loader.getController();\n\n //Sets iterations and the GameOfLife object to be considered.\n progressController.setIterations(iterations);\n progressController.setGameOfLife(gOL);\n\n //Opens and waits\n progressStage.setTitle(\"Loading statistics..\");\n progressStage.setScene(new Scene(root, 300, 150));\n progressStage.showAndWait();\n\n } catch (IOException ioe){\n //Shows a warning should the loading of the FXML fail.\n PopUpAlerts.ioAlertFXML();\n }\n }\n }", "public void printStatus() {\n\t\tSystem.out.println(\"Current : \"+current+\"\\n\"\n\t\t\t\t+ \"Tour restant : \"+nb_rounds+\"\\n\"\n\t\t\t\t\t\t+ \"Troupe restant : \"+nb_to_train);\n\t}", "private void showStat() {\n\t\tSystem.out.println(\"=============================\");\n\t\tSystem.out.println(\"Your won! Congrates!\");\n\t\tSystem.out.println(\"The word is:\");\n\t\tSystem.out.println(\"->\\t\" + this.word.toString().replaceAll(\" \", \"\"));\n\t\tSystem.out.println(\"Your found the word with \" \n\t\t\t\t+ this.numOfWrongGuess + \" wrong guesses.\");\n\t}", "public static String printStats() {\n return \"Your Statistics:\" + \"\\n\" +\n \"Total Time in Game (Seconds): \" + timeElapsedSeconds + \"\\n\" +\n \"Total Points: \" + totalScore + \"\\n\" +\n \"Total Number of Taps on Screen: \" + counterClicks + \"\\n\" +\n \"Thanks for Playing!\";\n }", "@Override\n\tpublic long updateDisplay() {\n\t\treturn AppStatus.NO_REFRESH;\n\t}", "public static void updateStatusBar(){\n\t\tstatus.setText(\"Sensors: \"+Sensor.idToSensor.size()+(TurnController.getInstance().getCurrentTurn()!=null?\", Turn: \"+TurnController.getInstance().getCurrentTurn().turn:\"\"));\n\t}", "private void updateResultOnScreen() {\n teamAScoreTv.setText(Integer.toString(teamAScoreInt));\n teamBScoreTv.setText(Integer.toString(teamBScoreInt));\n\n if (teamAFoulScoreInt > 1)\n teamAFoulScoreTv.setText(teamAFoulScoreInt + \" fouls\");\n else\n teamAFoulScoreTv.setText(teamAFoulScoreInt + \" foul\");\n\n if (teamBFoulScoreInt > 1)\n teamBFoulScoreTv.setText(teamBFoulScoreInt + \" fouls\");\n else\n teamBFoulScoreTv.setText(teamBFoulScoreInt + \" foul\");\n }", "public void update() \n {\n System.out.print( \" \" + Integer.toOctalString( subj.getState() ) );\n }", "public void printStats() {\n\t\tSystem.out.println(\"QuickSort terminates!\");\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"Duration: \" + getDuration() + \" seconds\");\n\t\tSystem.out.println(\"Comparisons: \" + this.comparisonCounter);\n\t\tSystem.out.println(\"Boundary: \" + this.b);\n\t}", "private void updateTaskActivityLabel()\r\n {\r\n setLabelValue(\"Tile Downloads \" + myActiveQueryCounter.intValue());\r\n setProgress(myDoneQueryCounter.doubleValue() / myTotalSinceLastAllDoneCounter.doubleValue());\r\n }", "@Override\n public void visualize() {\n if (this.count() > 0){\n for (int i = 0; i < this.count(); i++){\n System.out.println(i + \".- \" + this.bench.get(i).getName() + \" (ID: \" + this.bench.get(i).getId() + \")\");\n }\n } else {\n System.out.println(\"La banca está vacía.\");\n }\n\n }", "@FXML public void showStatistics() {\n\t\tPopupMessage.getInstance().showAlert(AlertType.INFORMATION,\n\t\t\t\t\t\t\t\t\t\t\tgsTitle, \n\t\t\t\t\t\t\t\t\t\t\tgsHeader,\n\t\t\t\t\t\t\t\t\t\t\tgsDetailsFiles + Connect.getNumberofFilesFromStatistics()\n\t\t\t\t\t\t\t\t\t\t\t+ System.lineSeparator()\n\t\t\t\t\t\t\t\t\t\t\t+ gsDetailsCases + Connect.getCases());\n\t}", "@Override\n\tpublic void execute() {\n\t\tSystem.out.println(\"==STATISTICS FOR THE RESTAURANT==\");\n\t\tSystem.out.println(\"Most used Ingredients:\");\n\t\tmanager.printIngredients();\n\t\tSystem.out.println(\"Most ordered items:\");\n\t\tmanager.printMenuItems();\n\t\tSystem.out.println(\"==END STATISTICS==\");\n\t}", "public void updateUI()\n\t{\n\t\tif( isRunning() == false) \n\t\t{\n\t\t\tupdateButton(\"Run\");\n\t\t\tbutton.setClickable(true);\n\t\t\tupdateTextView(Feedback.getMessage(Feedback.TYPE.NEW_TEST, null));\n\t\t}else\n\t\t{\n\t\t\tbutton.setClickable(true);\n\t\t\tupdateButton( \"Stop\" );\n\t\t\tupdateTextView(\"Tests are running.\");\n\n\t\t}\n\t}", "public void update(){\n infoBar = new GreenfootImage (960, 50);\n infoBar.setFont(textFont);\n infoBar.setColor(textColor);\n String output = (\"Trees: \" + numTrees + \" Bushes: \" + numBushes + \" Prey: \" + numPrey + \" Predators: \" + numPredators);\n\n //centres the output on the bar.\n int centre = (960/2) - ((output.length() * 14)/2);\n\n infoBar.drawString(output, centre, 22); //draw the bar.\n this.setImage(infoBar);\n }", "public void update(){\r\n\t\tupdateTurnLabel();\r\n\t\tupdateCanvas();\r\n\t}", "private void actionStatisticalData() {\n String message = getStatisticalMsg(true);\n\n JOptionPane.showMessageDialog(null, message, \"Statistical data\",\n JOptionPane.PLAIN_MESSAGE);\n }", "public void run()\r\n {\n long lastTime = System.nanoTime();\r\n long timer = System.currentTimeMillis();\r\n // create quotient\r\n final double ns = 1000000000.0 / 60.0;\r\n // difference between start time and current time\r\n double delta = 0;\r\n // counter for frames per second\r\n int frames = 0;\r\n // counter for updates per second\r\n int updates = 0;\r\n\r\n while (running)\r\n {\r\n long now = System.nanoTime();\r\n // add up the times of every loop run and get the value in seconds /\r\n // 60 (basically increase by 1/60th of a second every loop)\r\n delta += (now - lastTime) / ns;\r\n lastTime = now;\r\n // gets called 60 times per second because of delta calculation\r\n while (delta >= 1)\r\n {\r\n update();\r\n updates++;\r\n delta--;\r\n }\r\n\r\n view.render();\r\n frames++;\r\n\r\n // gets called every second\r\n if (System.currentTimeMillis() - timer > 1000)\r\n {\r\n // \"reset\" timer variable\r\n timer += 1000;\r\n System.out.println(updates + \" ups, \" + frames + \" fps\");\r\n view.setTitle(\"| \" + updates + \" ups, \" + frames + \" fps\" + \" |\");\r\n // reset frames and updates variables to start counting from 0\r\n // at the start of every second\r\n frames = 0;\r\n updates = 0;\r\n }\r\n }\r\n }", "public void status(){\n lblStats.setText(\"\"+level+\"L\");\n }", "@Override\n\tpublic void run() {\n\t\twhile (isActive)\n\t\t\tdisplay.syncExec(new Runnable() {\n\t\t\t\t@Override\n\t\t\t\tpublic void run() {\n\t\t\t\t\tuptimeLabel.setText(new StringBuilder(\"Uptime: \").append(\n\t\t\t\t\t\t\tgetPrettyDuration()).toString());\n\t\t\t\t\tuptimeLabel.setForeground(getUptimeColor());\n\t\t\t\t\tuptimeLabel.update();\n\t\t\t\t}\n\t\t\t});\n\t}", "public void refreshPacketStatistics() {\n\n\t\tint total = numIPSEC + numPPTP + numHTTPS + numSSH + numOthers;\n\t\tnumTotal = total;\n\t\tif (total == 0)\n\t\t\ttotal = 1;\n\t\tnumIPSECLabel.setText(\n\t\t\t\"IPSec Packets: \"\n\t\t\t\t+ numIPSEC\n\t\t\t\t+ \" ( \"\n\t\t\t\t+ (numIPSEC * 100 / total)\n\t\t\t\t+ \" % )\");\n\t\tnumPPTPLabel.setText(\n\t\t\t\"PPTP Packets: \"\n\t\t\t\t+ numPPTP\n\t\t\t\t+ \" ( \"\n\t\t\t\t+ (numPPTP * 100 / total)\n\t\t\t\t+ \" % )\");\n\t\tnumHTTPSLabel.setText(\n\t\t\t\"HTTPS Packets: \"\n\t\t\t\t+ numHTTPS\n\t\t\t\t+ \" ( \"\n\t\t\t\t+ (numHTTPS * 100 / total)\n\t\t\t\t+ \" % )\");\n\t\tnumSSHLabel.setText(\n\t\t\t\"SSH Packets: \"\n\t\t\t\t+ numSSH\n\t\t\t\t+ \" ( \"\n\t\t\t\t+ (numSSH * 100 / total)\n\t\t\t\t+ \" % )\");\n\t\tnumOthersLabel.setText(\n\t\t\t\"Other Packets: \"\n\t\t\t\t+ numOthers\n\t\t\t\t+ \" ( \"\n\t\t\t\t+ (numOthers * 100 / total)\n\t\t\t\t+ \" % )\");\n\t\tnumTotalLabel.setText(\n\t\t\t\"Total Packets: \"\n\t\t\t\t+ numTotal\n\t\t\t\t+ \" ( \"\n\t\t\t\t+ (numTotal * 100 / total)\n\t\t\t\t+ \" % )\");\n\t}", "@Override\n\t\t\tpublic void run() \n\t\t\t{\n\t\t\t\tsummaryPanel.updatePlayerStatus(player.getPlayerId());\n\t\t\t}", "public String currStats(){\n\t\treturn String.format(\"Damage: %f\\nRange (in tiles): %f\\nFire\"\n\t\t\t\t+ \" speed (shots per second): %d\\nUpgrade cost: %d\", damage,\n\t\t\t\trange / MainFrame.TILE_SIZE, initCooldown, getCostToUpgrade());\n\t}", "public void updateP1(String stats)\r\n\t{\r\n\t\tp1.setText(stats);\r\n\t}", "public void printMetrics() {\n System.out.println(\"\\nPROG_SIZE = \" + Metrics.getProgSize() + '\\n' + \"EXEC_TIME = \" + Metrics.getExecTime() + \" ms\" + '\\n' + \"EXEC_MOVE = \" + Metrics.getExecMove() + '\\n' + \"DATA_MOVE = \" + Metrics.getDataMove() + '\\n' + \"DATA_READ = \" + Metrics.getDataRead() + '\\n' + \"DATA_WRITE = \" + Metrics.getDataWrite() + '\\n');\n }", "public void updateScoreUI() {\n\t\tMap<Integer, Integer> scoreMap = gameLogic.getScoreboard().getTotalScore();\n\n\t\tlblScoreA.setText(String.valueOf(scoreMap.get(0)));\n lblScoreB.setText(String.valueOf(scoreMap.get(1)));\n lblScoreC.setText(String.valueOf(scoreMap.get(2)));\n lblScoreD.setText(String.valueOf(scoreMap.get(3)));\n\t}", "private void displayStats(CheckListView<String> checkview, TextArea stats) {\n\t\tStringBuilder start = new StringBuilder();\n\t\tfor(String critter_name:checkview.getCheckModel().getCheckedItems()){\n\t\t\ttry {\n\t\t\t\tClass classTemp = Class.forName(this.getClass().getPackage().getName() + \".\" + critter_name);\n\t\t\t\tMethod m = classTemp.getMethod(\"runStats\", List.class); //Get method\n\t\t\t\tList<Critter> instances = Critter.getInstances(critter_name);\n\t\t\t\tString output = (String)m.invoke(null, instances); //Invoke with instances\n\t\t\t\tstart.append(output).append(\"\\n\");\n\t\t\t} catch (Exception e) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tstats.clear();\n\t\tstats.appendText(start.toString());\n\t}", "public void showResults(){\n customerCount = simulation.getCustomerCount();\n phoneCount = simulation.getPhoneCount();\n doorCount = simulation.getDoorCount();\n unhelpedCount = simulation.getUnhelped();\n totalCus.setText(\"Total number of Customers: \"+customerCount+\"\\t\\t\");\n doorCus.setText(\"Number of Door Customers: \"+doorCount+\"\\t\\t\");\n phoneCus.setText(\"Number of Phone Customers: \"+phoneCount+\"\\t\\t\");\n unhelped.setText(\"Number of Customers left unhelped at the end: \"+unhelpedCount);\n }", "private void stats ( ) {\n\n nodes = 0;\n depth = 0;\n\n parse(((GPIndividual)program).trees[0].child);\n\n }", "public void showMetrics() {\n }", "private void printStats()\n\t{\n\t\t// X\n\t\tSystem.out.println(\"X:\");\n\t\tfor(int i = 0; i < xPosList.size(); i++)\n\t\t{\n\t\t\tSystem.out.println(xPosList.get(i));\n\t\t}\n\n\t\t// Y\n\t\tSystem.out.println(\"Y:\");\n\t\tfor(int i = 0; i < yPosList.size(); i++)\n\t\t{\n\t\t\tSystem.out.println(yPosList.get(i));\n\t\t}\n\n\t\t// Time\n\t\tSystem.out.println(\"Time:\");\n\t\tfor(int i = 0; i < timeList.size(); i++)\n\t\t{\n\t\t\tSystem.out.println(timeList.get(i));\n\t\t}\n\t}", "private void updateNumResults(int numResults)\n {\n String message = MessageFormat.format(\"Found {0} results\", numResults);\n resultInfo.setText(message);\n }", "public void refresh() {\n\t\t((EditText) getView().findViewById(R.id.fragment_console_parameters))\n\t\t\t\t.setText(\"\");\n\t\tthis.async = new AsyncGetConsoleOutputTask();\n\t\tthis.async.execute();\n\t}", "private static void statusCommand() {\n String lineFormat = \"%-8s | %-15s | %s\\n\";\n\n List<Job> neededJobs = fetchNeededJobs();\n\n // table header\n if (neededJobs.size() < 2) {\n System.out.printf(lineFormat, \"STATE\", \"START TIME\", \"JOB DIRECTORY\");\n for (int i = 0; i < 78; i++) {\n System.out.print(((9 == i || 27 == i) ? \"+\" : \"-\"));\n }\n System.out.println();\n }\n\n // table rows\n ObjectCounter<JobState> counter = new ObjectCounter<JobState>();\n for (Job job : neededJobs) {\n Date startDate = job.getStartDate();\n JobState state = job.getState();\n counter.add(state);\n String startDateStr = (null == startDate) ? \"N/A\" : new SimpleDateFormat(\"yyyyMMdd HHmmss\").format(startDate);\n System.out.printf(lineFormat, state.toString(), startDateStr, job.getDir());\n }\n\n // table footer\n System.out.println();\n String sumFormat = \"%6d %s\\n\";\n System.out.printf(sumFormat, heritrix.getJobs().size(), \"TOTAL JOBS\");\n for (JobState state : JobState.values()) {\n if (counter.getMap().keySet().contains(state)) {\n System.out.printf(sumFormat, counter.get(state), state.toString());\n }\n }\n }", "public static void updateFPS() {\n if (getTime() - lastFPS > 1000) {\n Display.setTitle(\"FPS: \" + fps + \" \");\n fps = 0;\n lastFPS += 1000;\n }\n fps++;\n\n }", "private void cmdInfoProg() {\n long total = Runtime.getRuntime().totalMemory();\n long free = Runtime.getRuntime().freeMemory();\n NumberFormat nf = NumberFormat.getInstance();\n Log.println(\"(mem: \"\n + NumberFormat.getPercentInstance().format(\n (double) free / (double) total) + \" = \"\n + nf.format(free) + \" bytes free, \" + nf.format(total)\n + \" bytes total)\");\n }", "public void update() {\n\t\t//Indicate that data is fetched\n\t\tactivity.showProgressBar();\n\t\n\t\tPlayer currentPlayer = dc.getCurrentPlayer();\n\t\tactivity.updatePlayerInformation(\n\t\t\t\tcurrentPlayer.getName(),\n\t\t\t\tgetGlobalRanking(),\n\t\t\t\tcurrentPlayer.getGlobalScore(),\n\t\t\t\tcurrentPlayer.getPlayedGames(),\n\t\t\t\tcurrentPlayer.getWonGames(),\n\t\t\t\tcurrentPlayer.getLostGames(),\n\t\t\t\tcurrentPlayer.getDrawGames());\n\n\t\tactivity.hideProgressBar();\n\t}", "public void updateScores() {\n\t\tscoreText.setText(\"Score: \" + ultraland.getScore());\n\t}", "public void updateStats( ) {\r\n\t\tperseverance = owner.perseverance;\r\n\t\tobservation = owner.observation;\r\n\t\tintellect = owner.intellect;\r\n\t\tnegotiation = owner.negotiation;\r\n\t\ttact = owner.tact;\r\n\t\tstrength = owner.strength;\r\n\r\n\t\txCoord = owner.xCoord;\r\n\t\tyCoord = owner.yCoord;\r\n\r\n\t\tmaxHealth = 2400 + ( perseverance * 200 );\r\n\r\n\t\thealth = maxHealth;\r\n\r\n\t\tsetDamages( );\r\n\t}", "public void display(){\n double avg;\n avg=getAvg();\n System.out.println(\"\\nThe Average of the times is : \"+avg+\" Milliseconds\");\n }" ]
[ "0.7266018", "0.7017373", "0.69424486", "0.68115866", "0.6751857", "0.67290634", "0.6691568", "0.66289747", "0.6506249", "0.6454742", "0.64488643", "0.6424985", "0.63911885", "0.6376959", "0.6374922", "0.6343546", "0.63408357", "0.6330056", "0.63290703", "0.6319056", "0.6313248", "0.63123035", "0.6311403", "0.63045704", "0.6298079", "0.6292035", "0.627927", "0.62625164", "0.6258813", "0.6245868", "0.6234111", "0.6230419", "0.62148726", "0.62126815", "0.6204764", "0.6204385", "0.6142771", "0.6139771", "0.61339724", "0.61252624", "0.6108007", "0.61057174", "0.6099669", "0.6073999", "0.6067135", "0.60667074", "0.60665554", "0.60642606", "0.60476166", "0.6025867", "0.6013362", "0.6011154", "0.60109115", "0.6002723", "0.6000272", "0.5999113", "0.5998399", "0.59894544", "0.59891593", "0.5981139", "0.5980138", "0.59625924", "0.595717", "0.5953537", "0.5949152", "0.59460825", "0.59413", "0.59370756", "0.5927032", "0.5921614", "0.59200126", "0.5902787", "0.59027314", "0.5899883", "0.58990794", "0.5895218", "0.58950794", "0.589464", "0.58938515", "0.58934695", "0.5889195", "0.5877606", "0.5875161", "0.5873224", "0.58650786", "0.58620363", "0.5854537", "0.58524406", "0.5847123", "0.58461905", "0.58458275", "0.5845382", "0.58377475", "0.58250475", "0.58164823", "0.5812197", "0.58089405", "0.580802", "0.5806319", "0.58003354", "0.57979876" ]
0.0
-1
Updates the total time ran
public void updateTime() { lblStatus.setText("Up: " + time); if (time.getTimeRan() >= 60) { lblRPM.setText("Avg RPM: " + (int) (recoveryAttempts / (time.getTimeRan() / 60))); ti.setToolTip("AR v4 - " + (int) (recoveryAttempts / (time.getTimeRan() / 60)) + " rpm"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void setTotalRunTime();", "public static void calTime() {\n time = new Date().getTime() - start;\n }", "public int getTotalTime();", "public int getTotalRunTime() {\n return totalRunTime;\n }", "private void updateTime() {\n timer.update();\n frametime = timer.getTimePerFrame();\n }", "public void updateTime() {\n\t\tthis.currentTime = System.currentTimeMillis();\n\t}", "private long CurrentTime(){\n return (TotalRunTime + System.nanoTime() - StartTime)/1000000;\n }", "public void update(int time);", "public synchronized static void incrementTime() {\n\t\ttime += 1;\n\t}", "public long getTimeElapsed() {\r\n\t long now = new Date().getTime();\r\n\t long timePassedSinceLastUpdate = now - this.updatedSimTimeAt;\r\n\t return this.pTrialTime + timePassedSinceLastUpdate;\r\n\t}", "public static void update() \r\n {\r\n lastTime = currentTime; \r\n currentTime = getTime(); \r\n }", "public void timeToRunDec()\n\t{\n\t\tthis.time_to_run -- ;\n\t}", "public void updateTime(){\r\n\t\tBlock selectedBlock = experiment.getBlocking().getSelectedBlockStructure();\r\n\t\testimatedTimeTotal.setText(secondsToString(estimateTime()));\r\n\t\testimatedTimeSubject.setText(secondsToString((long)(estimateTime()/selectedBlock.get(0).getReplications())));\r\n\t}", "public void incrementTimesPlayed() {\r\n\t\ttimesPlayed++;\r\n\t}", "public void setTotalRunTime(int totalRunTime) {\n this.totalRunTime = totalRunTime;\n }", "public long getTotalTime() {\n/* 73 */ return this.totalTime;\n/* */ }", "public abstract void updateTime(int currentTime);", "private void updateTime()\n {\n time++;\n this.timeTextField.setText(\"\" + time);\n }", "long getTsUpdate();", "protected double getElapsedTime() {\n\t\treturn Utilities.getTime() - startTime;\n\t}", "public void updateGameTime() {\n\t\tGameTime = Timer.getMatchTime();\n\t}", "public void IncTimeInProc() {\n this.TimeInProc++;\n }", "public void timePassed() {\r\n }", "public void timePassed() {\r\n }", "private int totalTime()\n\t{\n\t\t//i'm using this varaible enough that I should write a separate method for it\n\t\tint totalTime = 0;\n\t\tfor(int i = 0; i < saveData.size(); i++)//for each index of saveData\n\t\t{\n\t\t\t//get the start time\n\t\t\tString startTime = saveData.get(i).get(\"startTime\");\n\t\t\t//get the end time\n\t\t\tString endTime = saveData.get(i).get(\"endTime\");\n\t\t\t//****CONTINUE\n\t\t\t//total time in minutes\n\t\t}\n\t}", "public void timePassed() {\r\n\r\n }", "@Override\n public void run() {\n long startTime = System.nanoTime();\n\n int value = 0;\n int i = 0;\n MainActivity tester = new MainActivity();\n System.gc();\n\n for (; i < testCases; i++) {\n value += tester.intMethod(value);\n }\n\n long finishTime = System.nanoTime();\n\n Log.d(\"MAIN ACTIVITY\",\n \"************** math = \" + tester.intMethod(100));\n\n long totalTime = finishTime - startTime;\n\n long displayTime1 = (totalTime / 1000);\n long displayTime2 = (displayTime1 / 1000);\n long displayTime3 = (displayTime2 / 1000);\n Log.d(\"MAIN ACTIVITY\", \"value: \" + value + \" total time: \"\n + totalTime + \" display: \" + displayTime1 + \", \"\n + displayTime2 + \", \" + displayTime3);\n longToChange = displayTime1;\n Toast.makeText(\n getApplicationContext(),\n \"Total: \" + value + \" Total Time : \" + displayTime1\n + \" μs. \" + displayTime2 + \" ms. \" + displayTime3\n + \" ns.\", Toast.LENGTH_LONG).show();\n\n }", "long getElapsedTime();", "public void Update(double elapsedTime){\n }", "public void updateTime(int time)\n\t{\n\t\tshotsRemaining = rateOfFire;\n\t}", "public void timePassed() { }", "public int totalTime() {\n int time = 0;\n for (List l : lists.getList()) time += l.obtainTotalTime();\n return time;\n }", "@Override\n public void run() {\n long startTime = System.nanoTime();\n\n int value = 0;\n int i = 0;\n System.gc();\n\n for (; i < testCases; i++) {\n value += MainActivity.intMethod2(value);\n }\n\n long finishTime = System.nanoTime();\n\n long totalTime = finishTime - startTime;\n\n long displayTime1 = (totalTime / 1000);\n long displayTime2 = (displayTime1 / 1000);\n long displayTime3 = (displayTime2 / 1000);\n Log.d(\"MAIN ACTIVITY\", \"total time: \" + totalTime + \" display: \"\n + displayTime1 + \", \" + displayTime2 + \", \" + displayTime3);\n longToChange = displayTime1;\n Toast.makeText(\n getApplicationContext(),\n \"Value: \" + value + \"Total Time : \" + displayTime1\n + \" μs. \" + displayTime2 + \" ms. \" + displayTime3\n + \" ns.\", Toast.LENGTH_LONG).show();\n\n }", "public void setTotalSeconds() {\n //this.totalSeconds = (int)((endTime.compareTo(startTime)*1000)/60);\n //long diff = endTime.compareTo(startTime);\n long diffMillis = endTime.getTimeInMillis() - startTime.getTimeInMillis();\n // for testing only use no. secs\n this.totalSeconds += (int)((diffMillis/1000));\n // !!Reinstate this line: this.totalSeconds += (int)((diffMillis/1000)/60);\n\n }", "public float getRunTime() {\r\n return runTime;\r\n }", "public float getTime()\r\n\t{\r\n\t\treturn runningTime;\r\n\t}", "void update(String time);", "protected long time(LuaTable table) {\n\t\t//TODO allow table argument to work\n\t\treturn System.currentTimeMillis(); //TODO change this to be something minecraft related\n\t}", "public void countTimer() {\n\t\t\n\t\ttimerEnd = System.currentTimeMillis();\n\t}", "protected void updatePostTime() {\n mPostTime = calculatePostTime();\n }", "public void timePassed() {\n }", "public void timePassed() {\n }", "public void update() {\r\n\t\tlabel.setText(time / 60 + \":\" + ((time % 60 <= 9)? (\"0\" + time % 60) : (time % 60)));\r\n\t}", "@Override\r\n public void update(long timePassed) {\n\r\n }", "public static void startTimeMeasure() {\n \tstartTime = System.nanoTime();\n }", "public void Times() \n {\n if(status.getStatus_NUM() == 1 || status.getStatus_NUM() == 2 || status.getStatus_NUM() == 3)\n { //Waiting Time\n startWaitingTime = System.nanoTime();\n if(status.getStatus_NUM() != 1 || status.getStatus_NUM() != 2 || status.getStatus_NUM() != 3)\n {\n endWaitingTime = System.nanoTime();\n }\n \n totalWaitingTime += endWaitingTime - startWaitingTime;\n }\n //When it is running status \n else if(status.getStatus_NUM() == 0)\n {\n //Running Time\n startRunningTime = System.nanoTime();\n //Add a process\n if(status.getStatus_NUM() != 0)\n {\n endRunningTime = System.nanoTime();\n }\n \n totalRunningTime += endRunningTime - startRunningTime;\n }\n //When it is terminated\n else\n {\n System.out.println(\"Terminated\");\n System.out.println(\"Total Running Time : \" + totalRunningTime);\n System.out.println(\"Total Waiting Time : \" + totalWaitingTime);\n }\n }", "@Override\n\tpublic long getTime() {\n\t\treturn System.nanoTime() - startTime;\n\t}", "public void update()\r\n\t{\r\n\t\tcurrenttime = Calendar.getInstance();\r\n\t\trunningTime = (currenttime.getTimeInMillis() - starttime.getTimeInMillis()) - amountOfPause;\r\n\t\t\r\n\t\tif (tickPeriod != 0)\r\n\t\t{\r\n\t\t\tif (runningTime - lastRunningTime >= tickPeriod)\r\n\t\t\t{\r\n\t\t\t\tpassedTicks++;\r\n\t\t\t\tlastRunningTime = passedTicks * tickPeriod;\r\n\t\t\t\tif (tickListener != null) tickListener.onTick(this);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public long getTotalTime() {\n var timeStarted = getStartTime();\n var timeFinished = getEndTime();\n return timeStarted.until(timeFinished, SECONDS);\n }", "public void update(long ms) {\n\t\t\n\t}", "public void resetTime() {\n\t\ttime_passed = 0l;\n\t}", "public long totalTime() {\n\t\tlong ret = 0;\n\t\tfor (Task l : plan) {\n\t\t\tret += l.getTaskLength();\n\t\t}\n\n\t\treturn ret;\n\t}", "public void act() \n {\n updateTimerDisplay();\n if(timeCounter < 3600){\n timeCounter++;\n \n }else{\n timeElapsed++;\n timeCounter = 0;\n }\n checkHighScore();\n checkRegScore();\n\n }", "long getTotalDoExamTime();", "@Override\r\n public void timePassed() {\r\n }", "private void updateTime(){\n currentTime = System.currentTimeMillis();\n float tp = previousTime;\n previousTime = (float)(currentTime - startingTime);\n dt = previousTime - tp;\n fps = 1000f/dt;\n }", "@Override\r\n public void timePassed(double dt) {\r\n\r\n }", "@Override\r\n public void timePassed(double dt) {\r\n\r\n }", "@Override\n public void performUpdate() {\n this.getController().getDatabase().updateNumbersTest(\n this.getController().getPatID(), finalTime, 5);\n }", "@Override\r\n public void update() {\r\n this.total = calculateTotal();\r\n }", "public void timePassed(double dt) {\r\n // Currently- nothing\r\n }", "private boolean updateCPUTime(long[] data){\n\t\tif(data == null || data.length < 7)\n\t\t\treturn false;\n\n\t\tlong usr = data[0] + data[1];\n\t\tlong sys = data[2] + data[5] + data[6];\n\t\t\n\t\tmRelCPUTime = (usr - mBaseUserTime) + (sys - mBaseSysTime);\n\t\tmBaseUserTime = usr;\n\t\tmBaseSysTime = sys;\t\t\t\t\n\t\t\n\t\tdouble activeTime = 1.0 * mRelCPUTime / coreNumber;\n\t\tcpuUtilization = 100.0 * activeTime / Math.max(getSpeedStepTotalTime(), activeTime);\n\t\tlastData = java.util.Arrays.copyOf(data, data.length);\n\t\t\n\t\treturn true;\n\t}", "void updateActiveTime(int T);", "public void incrementTotalOfTime(TypeOfGames type, int totalOfTime) {\n statistics.get(type).incrementTotalOfTime(totalOfTime);\n }", "public void updateTimer() {\n this.machineCounter.setTimerValue(Config.MACHINE_TIMER);\n }", "long elapsedTime();", "@Override\n public void run() {\n\n secs++;\n if (secs == 10) {\n tens++;\n secs = 0;\n }\n if (tens == 6) {\n mins++;\n tens = 0;\n secs = 0;\n }\n time = mins + \":\" + tens + \"\" + secs;\n timePlayed.setText(\"Time: \" + time);\n }", "@Test\n public void updateIncreasesTimer() {\n BotMemoryRecord record = new BotMemoryRecord();\n record.store(Point.pt(5, 5));\n\n record.update(100);\n\n assertThat(record.getTimeSinceLastSeen(), is(100L));\n }", "@Command\n\t@NotifyChange(\"currentTime\")\n\tpublic void updateTime() {\n\t}", "public void startTiming() {\n elapsedTime = 0;\n startTime = System.currentTimeMillis();\n }", "long getExecutionTime();", "public long getTimeTaken();", "public long getElapsedTime() {\n long additionalRealTime = 0;\n\n if(mStartTime > 0) {\n additionalRealTime = System.currentTimeMillis() - mStartTime;\n }\n return mElapsedTime + additionalRealTime;\n }", "private void totalWaitingTime(){\n int totalWaitingTime =0;\r\n for (Ride ride : rides) {\r\n totalWaitingTime += ride.getWaitingTime();\r\n }\r\n System.out.println(\"\\nTotal waiting time of the entire park is \" + totalWaitingTime / 60 + \" hours\");\r\n }", "public void timePassed(double dt) {\n\n }", "public void timePassed(double dt) {\n\n }", "private long calculatePostTime() {\n return System.currentTimeMillis();\n }", "public void setCPUTime() {\r\n\t\t\tthis.CPUTime = 0;\r\n\t\t}", "@Override\n public void timePassed() {\n }", "public abstract void update(float time);", "int time()\n\t{\n\t\treturn totalTick;\n\t}", "private void updateRefreshTime(){\n\t\t\trefreshLabel.setText(\"Last Updated: \" + (new Date()).toString());\n\t\t}", "public void update()\n\t{\n\t\tmyTimer = new Timer(10, new ActionListener()\n\t\t{\n\t\t\tpublic void actionPerformed(ActionEvent e) \n\t\t\t{\n\t\t\t\tremove(countDown);\n\t\t\t\ttimeElapsed = timeElapsed + 0.01;\n\t\t\t\tif(completed == myTokens.size())\n\t\t\t\t{\n\t\t\t\t\tmyTimer.stop();\n\t\t\t\t\tcountDown.setText(\"Thank you for playing!\");\n\t\t\t\t\tadd(countDown);\n\t\t\t\t}\n\t\t\t\ttime.setText(\"time: \" + String.format(\"%.2f\", timeElapsed));\n\t\t\t\tscore.setText(\"score: \" + userScore);\n\t\t\t\trepaint();\n\t\t\t}\n\t\t});\n\t\tmyTimer.setInitialDelay(5000);\n\t\tmyTimer.start();\n\t}", "void update(int seconds);", "public boolean update() {\n\t\ttimeElapsed++;\n\t\treturn false;\n\t}", "private int calcTotalTime() {\n\t\tint time = 0;\n\t\tfor (Taxi taxi : taxis) {\n\t\t\ttime += taxi.calcTotalTime();\n\t\t}\n\t\treturn time;\n\t}", "void update_time_avg_stats() {\n double time_since_last_event;\n\n\t\t/* Compute time since last event, and update last-event-time marker. */\n\n time_since_last_event = sim_time - time_last_event;\n time_last_event = sim_time;\n\n\t\t/* Update area under number-in-queue function. */\n\n area_num_in_q += num_in_q * time_since_last_event;\n\n\t\t/* Update area under server-busy indicator function. */\n\n area_server_status += server_status.ordinal() * time_since_last_event;\n }", "public long timeElapsed()\n {\n return (System.currentTimeMillis() - this.startTime) / 1000;\n }", "public int getRunTime() { \n\t\t\treturn RunTime;\n\t\t}", "public abstract void setSecondsPerUpdate(float secs);", "@Override\n\tpublic void update() {\n\n\t\ttimer++;\n\t\tupdatePlayer();\n\t\tupdateScreen();\n\t\tupdateLives();\n\n\t}", "public String elapsedTime() {\n return totalWatch.toString();\n }", "public long getElapsedTime(){\n long timePassed = endTime - startTime;\n return timePassed;\n }", "public int totalTime()\n {\n return departureTime - arrivalTime;\n }", "public abstract float getSecondsPerUpdate();", "protected synchronized void updateTimestamp() {\n\t\ttimestamp = System.currentTimeMillis();\n\t}", "public static long GetElapsedTime() {\n\t\treturn System.currentTimeMillis() - _lTime;\n\t}", "@Override\n public void run() {\n long startTime = System.nanoTime();\n\n int value = 0;\n int i = 0;\n LibInterfaceOneTest app2class = new LibInterfaceOneTest(\n getApplicationContext());\n System.gc();\n\n for (; i < testCases; i++) {\n value += app2class.testMethodCall2(value);\n }\n\n long finishTime = System.nanoTime();\n\n long totalTime = finishTime - startTime;\n\n long displayTime1 = (totalTime / 1000);\n long displayTime2 = (displayTime1 / 1000);\n long displayTime3 = (displayTime2 / 1000);\n Log.d(\"MAIN ACTIVITY\", \"Total: \" + value + \" total time: \"\n + totalTime + \" display: \" + displayTime1 + \", \"\n + displayTime2 + \", \" + displayTime3);\n longToChange = displayTime1;\n Toast.makeText(\n getApplicationContext(),\n \"Total Time : \" + displayTime1 + \" μs. \" + displayTime2\n + \" ms. \" + displayTime3 + \" ns.\",\n Toast.LENGTH_LONG).show();\n\n }", "public void setTotalTimer(int totalSec){\r\n\t\tFlashBuddyTimerActivity.totalSec = totalSec;\r\n\t}", "public void updateTimer(int timeElapsed){\n mTimerText.setText(\n String.format(\"TIME LEFT: %ds\",10 - timeElapsed));\n mTimerProgressBar.setProgress((int)((timeElapsed/10.0)*100.0));\n }" ]
[ "0.702087", "0.6857506", "0.68484807", "0.68458813", "0.68296504", "0.67659706", "0.676122", "0.6741017", "0.6715746", "0.6701567", "0.6662424", "0.66257423", "0.66207916", "0.6540603", "0.6539265", "0.6480255", "0.64622736", "0.6420591", "0.64110327", "0.64063704", "0.6385108", "0.6380153", "0.6361489", "0.6361489", "0.6349646", "0.6330578", "0.6328531", "0.6301142", "0.6289674", "0.6288647", "0.62757534", "0.62727857", "0.62694716", "0.6256292", "0.6251242", "0.6245774", "0.62423974", "0.6230464", "0.6225549", "0.6214464", "0.62128246", "0.62128246", "0.62099946", "0.62005466", "0.6198919", "0.6192152", "0.6182975", "0.6179546", "0.616281", "0.61627686", "0.61617166", "0.61605793", "0.6159696", "0.6153082", "0.61455643", "0.61455", "0.6138566", "0.6138566", "0.6138227", "0.61379313", "0.6137016", "0.6130852", "0.61307603", "0.6129299", "0.6113117", "0.6100746", "0.6081084", "0.60759765", "0.6072878", "0.60686564", "0.60630375", "0.6056255", "0.6056112", "0.6055975", "0.6051519", "0.6051519", "0.60431814", "0.6037413", "0.60365695", "0.60344064", "0.6027621", "0.6023824", "0.6002657", "0.6000078", "0.59983784", "0.59944946", "0.5983655", "0.5979027", "0.59765494", "0.5971938", "0.59654325", "0.59652936", "0.59625316", "0.5947057", "0.59443676", "0.5937612", "0.59366", "0.5929827", "0.59226286", "0.59187907" ]
0.67800975
5
~ get methods Returns the background color
public Color getBackgroundColor() { return backgroundColor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Color getBackground();", "Color getBackgroundColor();", "public Color getBackground()\r\n\t{\r\n\t\treturn _g2.getBackground();\r\n\t}", "public int backgroundColor() {\n // create/return the background color\n return Color.rgb(180, 200, 255);\n }", "public static Color getColor() { return lblColor.getBackground(); }", "public Color getBackgroundColor() {\n\t\treturn backgroundColor;\n\t}", "public final String getBgColor() {\n\t\treturn bgColor;\n\t}", "public Color getBackground(){\r\n return back;\r\n }", "public Color getBackgroundColor() {\n return getValue(PROP_BACKGROUND_COLOR);\n }", "public Texture getBgColor () {\n\t\treturn this.bgColor;\n\t}", "public Color getBackgroundColor() {\n return backColor;\n }", "public Color getBackgroundColor(){\n\t\treturn Color.BLACK;\n\t}", "protected Background background () {\n return Background.bordered(0xFFCCCCCC, 0xFFCC99FF, 5).inset(5);\n }", "public Color getScreenBackgroundColor();", "@Override\r\n\tpublic Color backgroundColor() {\n\t\tProperty<IntegerPropertyType> colorDiff = this.getProperty(PROPERTY_NAME_COLOR_DIFFERENCE);\r\n\t\tColor c = labs[colorDiff.getValue().intValue() % labs.length].getColor();\r\n\t\t\r\n\t\treturn c;\r\n\t}", "public Colour getBackgroundColor() {\n return colour == null ? null : colour.getBackground();\n }", "public int getBackground() {\n return background;\n }", "public native final String backgroundColor() /*-{\n\t\treturn this.backgroundColor;\n\t}-*/;", "public Paint getBackground() {\r\n return background;\r\n }", "public Color getFillColor() {\n return (((Color) data[GENERAL_BACKGROUND][PROP_VAL_VALUE]));\n }", "public Color getBackgroundColor()\n {\n return sfondocolore;\n }", "public Color getGraphBackground() {\r\n \t\treturn graph.getBackground();\r\n \t}", "@DOMSupport(DomLevel.ONE)\r\n @Property String getBgColor();", "private Optional<String> getBackgroundColor() {\n return Optional.ofNullable(this.currentStyle)\n .filter(style -> style.get(PN_BACKGROUND_COLOR_ENABLED, Boolean.FALSE))\n .flatMap(style -> Optional.ofNullable(this.resource.getValueMap().get(PN_BACKGROUND_COLOR, String.class)))\n .filter(StringUtils::isNotEmpty);\n }", "public static int color(int bg) {\n\t\tint alpha =\t((bg>>24)&0xFF);\n\t\tint red = \t((bg>>16)&0xFF);\n\t\tint green = ((bg>>8)&0xFF);\n\t\tint blue = \t((bg)&0xFF);\n\t\tdouble lum = ((0.2126*(red)+0.7152*(green)+0.0722*(blue))*((alpha)/255.0))/255.0;\n\t\tif(lum>0.35)\n\t\t\treturn 0xFF000000;//black\n\t\telse return 0xFFFFFFFF;//white\n\t}", "public UiBackground getBackground() {\n if (getBackground == null)\n getBackground = new UiBackground(jsBase + \".background()\");\n\n return getBackground;\n }", "public int getGroundColor() {\n return this.groundColor;\n }", "public int getBackground() {\n updateBackgroundID();\n return background;\n }", "public Color[] getBackgroundColorsArray() {\n\t\treturn this.BackgroundColor;\n\t}", "public Color getManualBackgroundColor() {\n return (_manualBackgroundColor);\n }", "public Background getBackground() {\r\n return this.background;\r\n }", "public String getBackgroundColor() {\n\t\tif (null != this.backgroundColor) {\n\t\t\treturn this.backgroundColor;\n\t\t}\n\t\tValueExpression _ve = getValueExpression(\"backgroundColor\");\n\t\tif (_ve != null) {\n\t\t\treturn (String) _ve.getValue(getFacesContext().getELContext());\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "Sprite getBackground();", "public Color getColor();", "public Color getColor();", "public Color getColor();", "public int getColor() {\n \t\treturn color;\n \t}", "public int getColor();", "public int getColor();", "public Color getBackColor() {\r\n return backColor;\r\n }", "public native PixelPacket getBackgroundColor() throws MagickException;", "public Color getColor()\n {\n return color;\n }", "public int getDrawableBackground() {\n return this.drawable_background;\n }", "public BufferedImage getBackground() {\n BufferedImage background = new BufferedImage(getImageWidth(),\n getImageHeight(), BufferedImage.TYPE_INT_RGB);\n return background;\n }", "public int getColor(){\r\n\t\treturn color;\r\n\t}", "public Color getColor()\n { \n return color;\n }", "public int getColor() {\n return color;\n }", "Color getColor();", "Color getColor();", "Color getColor();", "Color getColor();", "Color getColor();", "public abstract View getBlackBackground();", "public void setBg(){\n this.setBackground(color);\n }", "public int getColor() {\r\n return Color;\r\n }", "public int getColor(){\n\t\treturn color;\n\t}", "public int getColor(){\n\t\treturn color;\n\t}", "public DoubleBackground getBackground() {\n\t\treturn background;\n\t}", "public Color getColor() {\n \t\treturn color;\n \t}", "public String getFillColor();", "public Color getColor() \n\t{\n\t\treturn color;\n\t}", "protected static native String getComputedBackgroundColor(Element e)/*-{\n var cs = $wnd.document.defaultView.getComputedStyle(e, null);\n return cs.getPropertyValue('background-color');\n }-*/;", "public Color getColor() {\n return color;\r\n }", "public Color getColor()\n {\n return color;\n }", "public Color getColor()\n {\n return color;\n }", "public Color getColor()\n {\n return color;\n }", "public Color getColor() { return color; }", "public Color getForegroundColor() {\n return foreColor;\n }", "public Integer getColor() {\n\t\treturn color;\n\t}", "public Color getColor() {\n\treturn color;\n }", "public Color getCurrentColor();", "public Color getColor()\r\n {\r\n return currentColor;\r\n }", "protected int getColor() {\n return Color.TRANSPARENT;\n }", "public Sprite getBackground() {\r\n return new BackGround4();\r\n }", "public Color getColor()\n {\n return color;\n }", "public int getColor() {\n return this.color;\n }", "@Override\n public Color getColor() {\n return color;\n }", "public Color getColor() {\r\n return color;\r\n }", "public Color getColor() {\r\n return color;\r\n }", "public Color getColor() {\r\n return color;\r\n }", "@Override\n\t\tpublic Color color() { return color; }", "private void createBackground()\n {\n GreenfootImage background = getBackground();\n background.setColor(Color.BLACK);\n background.fill();\n }", "public Color getForeground();", "public Color getColor(){\n return color;\n }", "public PDColor getInteriorColor() {\n/* 435 */ return getColor(COSName.IC);\n/* */ }", "public Color getColor() {\r\n return this.color;\r\n }", "@Override\n Color getColor() {\n return new Color(32, 83, 226, 255);\n }", "public String getColor() { \n return color; \n }", "public String getColor()\n {\n return color;\n }", "public String getColor()\n {\n return color;\n }", "private Background InitBackground()\r\n {\r\n \tBoundingSphere worldBounds = new BoundingSphere(\r\n \t\t new Point3d( 0.0, 0.0, 0.0 ), // Center\r\n \t\t 1000000000000000000000.0 ); // Extent\r\n \t\t\r\n \t// Set the background color and its application bounds\r\n \tbg = new Background( );\r\n \tbg.setColor( backgroundColor );\r\n \tbg.setCapability( Background.ALLOW_COLOR_WRITE );\r\n \tbg.setCapability( Background.ALLOW_COLOR_READ );\r\n \tbg.setCapability( Background.ALLOW_IMAGE_READ );\r\n \tbg.setCapability( Background.ALLOW_IMAGE_WRITE );\r\n \tbg.setApplicationBounds( worldBounds );\r\n \t\r\n \treturn bg;\r\n }", "public Color getColor() {\n return this.color;\n }", "public Color getColor() {\n return color;\n }", "public Color getColor() {\n return color;\n }", "public Color getColor() {\n return color;\n }", "public Color getColor() {\n return color;\n }", "public Color getColor() {\n return color;\n }", "public Color getColor() {\n return color;\n }", "public Color getColor() {\r\n\t\treturn color;\r\n\t}", "public Color getColor() {\r\n\t\treturn color;\r\n\t}" ]
[ "0.8813109", "0.8548009", "0.8352388", "0.83111393", "0.8085195", "0.79924965", "0.7982518", "0.7893872", "0.78571314", "0.78291357", "0.772351", "0.7714421", "0.77081835", "0.76854265", "0.76576596", "0.7652646", "0.76291573", "0.76150244", "0.75908625", "0.7541971", "0.75392175", "0.752497", "0.74135995", "0.73918515", "0.7264559", "0.7262091", "0.7261206", "0.72611105", "0.7239771", "0.7209556", "0.7194343", "0.71671563", "0.7161212", "0.7093796", "0.7093796", "0.7093796", "0.70856845", "0.70852196", "0.70852196", "0.7040447", "0.7024508", "0.7018523", "0.69941807", "0.69919264", "0.6980279", "0.69799834", "0.69770133", "0.6973305", "0.6973305", "0.6973305", "0.6973305", "0.6973305", "0.69669324", "0.6957208", "0.6953145", "0.6951382", "0.6951382", "0.69512373", "0.6951153", "0.69361925", "0.692173", "0.6911638", "0.6910359", "0.69014084", "0.69014084", "0.69014084", "0.68890417", "0.68768954", "0.68754", "0.68707776", "0.6869528", "0.685576", "0.68539476", "0.6847562", "0.6844589", "0.6835821", "0.6823643", "0.68193144", "0.68193144", "0.68193144", "0.6812809", "0.6812216", "0.68041134", "0.68013865", "0.67968416", "0.67936206", "0.6784193", "0.67794585", "0.677604", "0.677604", "0.6763757", "0.6758395", "0.67583096", "0.67583096", "0.67583096", "0.67583096", "0.67583096", "0.67583096", "0.67339766", "0.67339766" ]
0.8131323
4
Returns the foreground color
public Color getForegroundColor() { return foregroundColor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Color getForeground();", "public Colour getForegroundColor() {\n return colour == null ? null : colour.getForeground();\n }", "public Color getForegroundColor() {\n return foreColor;\n }", "public Color getSelectionForeground() {\n checkWidget();\n Color result = selectionForeground;\n if( result == null ) {\n CTabFolderThemeAdapter adapter = getCTabFolderThemeAdapter();\n result = adapter.getSelectedForeground( this );\n }\n if( result == null ) {\n // Should never happen as the theming must prevent transparency for\n // this color\n throw new IllegalStateException( \"Transparent selection foreground color\" );\n }\n return result;\n }", "@Override\r\n\t\tpublic Color getForeground(Object element) {\n\t\t\treturn null;\r\n\t\t}", "public ColorController createForeground(ControllerCore genCode) {\n\t\tforegroundTXT = new ColorController(\"foreground\", getParentController(controlItemSCSCLC), genCode) {\n\t\t\t@Override\n\t\t\tpublic void initialize() {\n\t\t\t\tsetLinkedController(foreground$1LBL);\n\t\t\t\tsetProperty(\"foreground\");\n\t\t\t\tsuper.initialize();\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic void createControl() {\n\t\t\t\tsuper.createControl();\n\t\t\t\tif (isValid()) {\n\t\t\t\t\tif (null != fieldBindManager)\n\t\t\t\t\t\tfieldBindManager = new XjcFieldBindingManager(this);\n\t\t\t\t\tgetControl().addFocusListener(new XjcFocusListener(this));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn foregroundTXT;\n\t}", "public Color getCurrentColor();", "public X foreground(Color fg) {\n component.setForeground(fg);\n return (X) this;\n }", "static Color getForegroundColor(String backgroundColor) {\n Color background = Color.decode(backgroundColor);\n // Counting the perceptive luminance - human eye favors green color...\n double a = 1 - (0.299 * background.getRed() + 0.587 * background.getGreen() + 0.114 * background.getBlue()) / 255;\n\n if (a < 0.5) {\n return Color.BLACK;\n } else {\n return Color.WHITE;\n }\n }", "Color getColor();", "Color getColor();", "Color getColor();", "Color getColor();", "Color getColor();", "Integer getTxtColor();", "public Color getBackFlankingGapColor() {\n\t\treturn backgap ? Color.red : Color.lightGray;\n\t}", "public int getGroundColor() {\n return this.groundColor;\n }", "java.awt.Color getColor();", "public int getTextLabelForegroundColor() {\n\t\treturn mTextLabelForegroundColor;\n\t}", "public static Color getColor() { return lblColor.getBackground(); }", "public Color getBlack() {\n return fBlack;\n }", "private int getCloseColor(int[] prgb) {\n \t\t\tfloat[] phsv = { 0, 0, 0 };\n \t\t\trgbToHsv(prgb[0], prgb[1], prgb[2], phsv);\n \t\t\treturn phsv[2] < 64 ? fg : bg;\n \t\t}", "int getHighLightColor();", "public Color getColor() {\r\n\t\treturn new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));\r\n\t}", "public short getColor()\n {\n return font.getColorPaletteIndex();\n }", "public Piece.COLOR getInactiveColor() {\n if (Piece.COLOR.RED == getActiveColor())\n return Piece.COLOR.WHITE;\n else\n return Piece.COLOR.RED;\n }", "public Color getColor() {\r\n\t\tColor retVal = theColor;\r\n\t\treturn retVal;\r\n\t}", "private int getCurrentMainColor () {\n int translatedHue = 255 - ( int ) ( mCurrentHue * 255 / 360 );\n int index = 0;\n for ( float i = 0; i < 256; i += 256 / 42 ) {\n if ( index == translatedHue )\n return Color.rgb( 255, 0, ( int ) i );\n index++;\n }\n for ( float i = 0; i < 256; i += 256 / 42 ) {\n if ( index == translatedHue )\n return Color.rgb( 255 - ( int ) i, 0, 255 );\n index++;\n }\n for ( float i = 0; i < 256; i += 256 / 42 ) {\n if ( index == translatedHue )\n return Color.rgb( 0, ( int ) i, 255 );\n index++;\n }\n for ( float i = 0; i < 256; i += 256 / 42 ) {\n if ( index == translatedHue )\n return Color.rgb( 0, 255, 255 - ( int ) i );\n index++;\n }\n for ( float i = 0; i < 256; i += 256 / 42 ) {\n if ( index == translatedHue )\n return Color.rgb( ( int ) i, 255, 0 );\n index++;\n }\n for ( float i = 0; i < 256; i += 256 / 42 ) {\n if ( index == translatedHue )\n return Color.rgb( 255, 255 - ( int ) i, 0 );\n index++;\n }\n return Color.RED;\n }", "public Color getFillColor() {\n return (((Color) data[GENERAL_BACKGROUND][PROP_VAL_VALUE]));\n }", "public Integer getHightlightedTextColor() {\n if (mHightlightedTextColor != null)\n return mHightlightedTextColor;\n return getTextColor();\n }", "public Color color() {\n\t\tswitch (this) {\n\t\tcase FATAL: {\n\t\t\tColor c = UIManager.getColor(\"nb.errorForeground\"); // NOI18N\n\t\t\tif (c == null) {\n\t\t\t\tc = Color.RED.darker();\n\t\t\t}\n\t\t\treturn c;\n\t\t}\n\t\tcase WARNING:\n\t\t\treturn Color.BLUE.darker();\n\t\tcase INFO:\n\t\t\treturn UIManager.getColor(\"textText\");\n\t\tdefault:\n\t\t\tthrow new AssertionError();\n\t\t}\n\t}", "public Color getDateCenterGridPairForegroundColor() {\n\t\treturn dateCenterGridPairForegroundColor;\n\t}", "public static int color(int bg) {\n\t\tint alpha =\t((bg>>24)&0xFF);\n\t\tint red = \t((bg>>16)&0xFF);\n\t\tint green = ((bg>>8)&0xFF);\n\t\tint blue = \t((bg)&0xFF);\n\t\tdouble lum = ((0.2126*(red)+0.7152*(green)+0.0722*(blue))*((alpha)/255.0))/255.0;\n\t\tif(lum>0.35)\n\t\t\treturn 0xFF000000;//black\n\t\telse return 0xFFFFFFFF;//white\n\t}", "public Color getDateHeaderForegroundPairColor() {\n\t\treturn dateHeaderForegroundPairColor;\n\t}", "String getColor();", "public Color darker()\n {\n return color.darker();\n }", "@DOMSupport(DomLevel.ONE)\r\n @Property String getFgColor();", "public Color getDefaultBackgroudColor() {\n return DEFAULT_BACKGROUND_COLOR;\n }", "public Color getColor();", "public Color getColor();", "public Color getColor();", "public static int getHoloBlue() {\n\t\treturn Color.rgb(51, 181, 229);\n\t}", "public final String getBgColor() {\n\t\treturn bgColor;\n\t}", "public Color getColor(){\n\t\t\n\t\treturn COL;\n\t}", "public abstract void setCurForeground(Color colr);", "public RMColor getColor() { return getFill()==null? RMColor.black : getFill().getColor(); }", "public Color getDateHeaderForegroundImpairColor() {\n\t\treturn dateHeaderForegroundImpairColor;\n\t}", "public GameColor getColor();", "public Color getBackgroundColor(){\n\t\treturn Color.BLACK;\n\t}", "public Color getBackgroundColor() {\n return backColor;\n }", "@Override\n Color getColor() {\n return new Color(32, 83, 226, 255);\n }", "public Color getDateCenterCycleBackgoundColor() {\n\t\treturn dateCenterCycleBackgoundColor;\n\t}", "public float[] getDefaultColor() {\n \treturn defaultColor;\n }", "public Color getLineColor();", "public String getTextColor();", "public Color getColor()\r\n\t{\r\n\t\treturn _g2.getColor();\r\n\t}", "String getTextStrokeColorAsString();", "public static Color getTextColorDark() {\n return TEXTCOLOR_DARK;\n }", "public Color getHotBorderColor()\n {\n\tif (_hotBorderColor == null)\n\t return _defaultHotBorderColor;\n\treturn _hotBorderColor;\n }", "public final Color getFontColour() {\n return fontColour;\n }", "public Color getColor() {\n\t\treturn (Color)p.getPaint();\n\t}", "public Color getColor() {\n return Color.YELLOW;\n }", "public String getBubbleColour(){\n return myBathtub.getBubbleColour();\n }", "public Color getActiveColor() {\n\t\treturn this.activeColor;\n\t}", "String getBackdropColorAsString();", "String getColour();", "public String getColor() {\n\t\treturn null;\n\t}", "Color getBackgroundColor();", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "public int getColor();", "public int getColor();", "public int textColor() {\n\t\treturn textColor;\n\t}", "public Color getDevColor() {\r\n\t\t// System.out.println(\"Getting \" + n);\r\n\t\treturn (value.getDevColor());\r\n\t}", "int getColour();", "public org.openxmlformats.schemas.drawingml.x2006.main.CTColor getPenClr()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.openxmlformats.schemas.drawingml.x2006.main.CTColor target = null;\n target = (org.openxmlformats.schemas.drawingml.x2006.main.CTColor)get_store().find_element_user(PENCLR$12, 0);\n if (target == null)\n {\n return null;\n }\n return target;\n }\n }", "public char getColor();", "public Color getColor() {\r\n return this.BoardColor;\r\n }", "public Color getColor() {\n\t\treturn Color.GRAY;\n\t}", "public int getColorValue() {\r\n\t\treturn color;\r\n\t}", "private void applyForegroundColor() {\r\n\t\tthis.control.setForeground(PromptSupport.getForeground(this.control));\r\n\t}", "public String getColourMax()\n {\n return colourMax;\n }", "public void setForegroundColor(Color foreground)\n {\n foregroundColor = foreground;\n paintAllObjects();\n }", "public Color getRedBlack() {\r\n\t\tif (isRed())\r\n\t\t\treturn Color.RED;\r\n\t\telse\r\n\t\t\treturn Color.BLACK;\r\n\r\n\t}", "public Color getColor() {\r\n return Color.GRAY;\r\n }", "public Color getBackground()\r\n\t{\r\n\t\treturn _g2.getBackground();\r\n\t}", "public final String getFontColor() {\n\t\treturn fontColor;\n\t}", "public Integer getColor() {\n\t\treturn color;\n\t}", "public String obtenColor() {\r\n return color;\r\n }", "public Color getDateCenterGridImpairForegroundColor() {\n\t\treturn dateCenterGridImpairForegroundColor;\n\t}", "public Color getColor() { return color.get(); }", "public int getColor() {\n \t\treturn color;\n \t}", "public Color getSupportEdgeFadeDestinationColor() {\n return (_supportEdgeFadeDestinationColor);\n }", "public Color getColor() {\n \t\treturn color;\n \t}", "public Color getTextColor();", "public String getColor()\n {\n return color;\n }", "public String getColor()\n {\n return color;\n }", "public RMColor getColor()\n {\n return getStyle().getColor();\n }" ]
[ "0.8484121", "0.825746", "0.77173597", "0.71383005", "0.6732278", "0.66089064", "0.6588259", "0.65288454", "0.648398", "0.64551854", "0.64551854", "0.64551854", "0.64551854", "0.64551854", "0.6436363", "0.64289165", "0.64227146", "0.6421669", "0.63971275", "0.63890296", "0.6380384", "0.6376032", "0.63606906", "0.63568413", "0.6341287", "0.6288763", "0.6260184", "0.62330616", "0.6226184", "0.6225625", "0.6211843", "0.6205817", "0.6203894", "0.61996806", "0.61974275", "0.61909556", "0.61772895", "0.61353546", "0.6111157", "0.6111157", "0.6111157", "0.60855705", "0.6077557", "0.6071679", "0.60598767", "0.6053608", "0.6052513", "0.60500294", "0.60499364", "0.60497886", "0.6042885", "0.6040479", "0.6034366", "0.6033935", "0.60332197", "0.6024343", "0.6023364", "0.6022086", "0.60201675", "0.60066", "0.6003687", "0.60023034", "0.5997787", "0.5995133", "0.5993875", "0.5991335", "0.59907216", "0.59885806", "0.59850216", "0.59850216", "0.59850216", "0.59850216", "0.5983755", "0.5983755", "0.5971826", "0.59704703", "0.59633464", "0.5943575", "0.59425", "0.5941065", "0.59370804", "0.5928719", "0.5926002", "0.592084", "0.5900068", "0.5897814", "0.5893743", "0.58934957", "0.5864741", "0.58622485", "0.5854133", "0.5852934", "0.58507437", "0.5847637", "0.58428055", "0.58332205", "0.5829991", "0.5829811", "0.5829811", "0.5825072" ]
0.8602539
0
~ set methods Sets the background color
public void setBackgroundColor(Color background) { backgroundColor = background; paintAllObjects(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setBg(){\n this.setBackground(color);\n }", "public void setBackground(Color color)\r\n\t{\r\n\t\t// System.out.println(\"setBackground\");\r\n\t}", "@Override\n public void setBackgroundColor(int backgroundColor) {\n }", "public abstract void setCurBackground(Color colr);", "public void setBackgroundColor(Color color) {\n //bar.setBackground(color);\n }", "public void setBackColor( Color bgColor ) {\r\n backColor = bgColor;\r\n }", "private void setBgColor(Color c)\n\t{\n\t\teToPower.setBackground (c);\n\t\ttwoPower.setBackground (c);\n\t\tln.setBackground (c);\n\t\txCube.setBackground (c);\n\t\txSquare.setBackground (c);\n\t\tdel.setBackground (c);\n\t\tcubeRoot.setBackground (c);\n\t\tC.setBackground (c);\n\t\tnegate.setBackground (c);\n\t\tsquareRoot.setBackground (c);\n\t\tnine.setBackground (c);\n\t\teight.setBackground (c);\n\t\tseven.setBackground (c);\n\t\tsix.setBackground (c);\n\t\tfive.setBackground (c);\n\t\tfour.setBackground (c);\n\t\tthree.setBackground (c);\n\t\ttwo.setBackground (c);\n\t\tone.setBackground (c);\n\t\tzero.setBackground (c);\n\t\tdivide.setBackground (c);\n\t\tpercent.setBackground (c);\n\t\tmultiply.setBackground (c);\n\t\treciprocal.setBackground (c);\n\t\tadd.setBackground (c);\n\t\tsubtract.setBackground (c);\n\t\tdecimalPoint.setBackground (c);\n\t\tequals.setBackground (c);\n\t\te.setBackground (c);\n\t\tPI.setBackground (c);\n\t\tentry.setBackground (c);\n\t\t\n\t\tmenuBar.setBackground (c);\n\t\tfileMenu.setBackground (c);\n\t\ttoolsMenu.setBackground (c);\n\t\thelpMenu.setBackground (c);\n\t\t\n\t\texit.setBackground (c);\n\t\tsettings.setBackground (c);\n\t\tabout.setBackground (c);\n\t\treadme.setBackground (c);\n\t}", "public void setBackgroundColor(Color c) {\n backColor = c;\n updateFigureForModel(nodeFigure);\n }", "public void setBackground(Color col) {\n\t\tthis.background = col;\n\t}", "private void setBackgroundColor(int red) {\n\t\tint bgColor = Color.argb(255, red, 0, 0);\n\t\tlayout.setBackgroundColor(bgColor);\n\t}", "private void setBackgroundColor(int backColor){\n backgroundColor = backColor;\n touchArea.setBackgroundColor(backgroundColor);\n }", "public void setBackgroundColor(int red, int green, int blue, int alpha){\n if(isTheColorInputCorrect(red, green, blue, alpha)){\n backgroundColor = new Color(red, green, blue, alpha); \n }\n }", "public void setBackground(int r, int g, int b)\r\n {\r\n \tbg.setColor(new Color3f(ptools.ColorInt2Float(r), ptools.ColorInt2Float(g), ptools.ColorInt2Float(b)));\r\n }", "public void updateBackground(Color color) {\r\n background = color;\r\n }", "@Override\n public GralColor setBackgroundColor(GralColor color)\n {\n return null;\n }", "@Override\r\n public void setBackground(Color c) {\r\n super.setBackground(c);\r\n colorWheel = null;\r\n repaint();\r\n }", "protected void setBackground (Color4f color)\n {\n final Color c = color.getColor();\n setBackground(c);\n getContentPane().setBackground(c);\n for (int ii = 0, nn = _tabs.getComponentCount(); ii < nn; ii++) {\n ((ManagerPanel)_tabs.getComponentAt(ii)).setBackground(c);\n }\n// SwingUtil.applyToHierarchy(this, new SwingUtil.ComponentOp() {\n// public void apply (Component comp) {\n// comp.setBackground(c);\n// }\n// });\n }", "public void setBackground(Paint background) {\r\n Paint old = getBackground();\r\n this.background = background;\r\n firePropertyChange(\"background\", old, getBackground());\r\n }", "public void setBackground(int x)\r\n { \t\r\n \tbg.setColor(ptools.color2Color3f(x));\r\n }", "public void setBackground(int index){\r\n\t\tsuper.setBackground(myBackgrounds.get(index));\r\n\t}", "public void setBackground(Color back) {\r\n this.back = back;\r\n }", "private void applyBackgroundColor() {\r\n\t\tthis.control.setBackground(PromptSupport.getBackground(this.control));\r\n\t}", "public Color getBackground();", "public void setFillColor(Color color);", "public void setBackgroundColor(int r, int g, int b)\n\t{\n\t\tbackgroundColor[0] = r;\n\t\tbackgroundColor[1] = g;\n\t\tbackgroundColor[2] = b;\t\t\n\t}", "public void setBackgroundColor(Color bkgColor) {\n setValue(PROP_BACKGROUND_COLOR, bkgColor);\n }", "@Override\n public void setBackgroundColor(@ColorInt int backgroundColor) {\n if (this != null) {\n this.setBackgroundColor(backgroundColor);\n }\n }", "public void setBackgroundColor(String backgroundColor) {\n\t\tthis.backgroundColor = backgroundColor;\n\t\tthis.handleConfig(\"backgroundColor\", backgroundColor);\n\t}", "public void setColor( int c ){//1 means black, 0 means white\r\n\t\tif(c==1)\r\n\t\t\tthis.setBackground(Color.BLACK);\r\n\t\telse\r\n\t\t\tthis.setBackground(Color.WHITE);\r\n\t}", "public abstract void setBackgroundPressed(final int rgba);", "@Override\r\n\tpublic void setBackgroundResource(int resid) {\n\t\tsuper.setBackgroundResource(resid);\r\n\t}", "public native final EditorBaseEvent backgroundColor(String val) /*-{\n\t\tthis.backgroundColor = val;\n\t\treturn this;\n\t}-*/;", "public void setBackgroundLayerColor(int color) {\n this.backgroundLayerColor = color;\n }", "public void setBackgroundColor(int color) {\n //this.backgroundColor = 0xFF000000 | color; // Remove the alpha channel\n this.backgroundColor = color;\n if (ad != null) {\n ad.setBackgroundColor(color);\n }\n\n invalidate();\n }", "public void setBackground(Color col){\n\t\tmodel.setChosenColor(index, col);\n\t}", "public final void setBackgroundColor(final Color color)\n\t{\n\t\tio.getFrame().setBackground(color);\n\t}", "protected void setBoxBackground() { Console.setBackground(Console.RED); }", "public void setColor(Color c);", "private void setColors(int background, int foreground) {\n rootView.setBackgroundColor(background);\n emptyCategoryTextView.setTextColor(foreground);\n }", "public void setColor(int fg, int bg) {\n // Layout\n // Bit 7 | 6 5 4 | 3 | 2 1 0\n // Fct * | bg | * | fg\n color = Color.mix(fg, bg);\n }", "private void colorSetup(){\n Color color2 = Color.GRAY;\n Color color = Color.LIGHT_GRAY;\n this.setBackground(color);\n this.mainPanel.setBackground(color);\n this.leftPanel.setBackground(color);\n this.rightPanel.setBackground(color);\n this.rightCenPanel.setBackground(color);\n this.rightLowPanel.setBackground(color);\n this.rightTopPanel.setBackground(color);\n this.inputPanel.setBackground(color);\n this.controlPanel.setBackground(color);\n this.setupPanel.setBackground(color);\n this.cameraPanel.setBackground(color);\n this.jPanel4.setBackground(color);\n this.sensSlider.setBackground(color); \n }", "public void setColor(Color color);", "void setColor(){\n this.objectColour = new Color(rValue,gValue,bValue,timeToLive).brighter();\n }", "public Color getBackgroundColor()\n {\n return backgroundColor;\n }", "void setColor(int r, int g, int b);", "public void setColor()\n {\n if (wall != null) // only if it's painted already...\n {\n wall.changeColor(\"red\");\n window.changeColor(\"black\");\n roof.changeColor(\"green\");\n sun.changeColor(\"yellow\");\n }\n }", "public void chooseBackgroundColor(){\n currentBackgroundColor = backgroundColorPicker.getValue();\n draw();\n }", "public S<T> bg(int color){\n\t\t\n\t\t\n\t\tif(t instanceof TextView){\n\t\t\t((TextView)t).setBackgroundColor(color);return this;\n\t\t}\n\t\tif(t instanceof Button){\n\t\t\t((Button)t).setBackgroundColor(color);return this;\n\t\t}\t\n\t\tif(t instanceof EditText){\n\t\t\t((EditText)t).setBackgroundColor(color);return this;\n\t\t}\n\t\tif(t instanceof CheckBox)\n\t\t{\n\t\t\t((CheckBox)t).setBackgroundColor(color);return this;\n\t\t}\n\t\tif(t instanceof RadioButton)\n\t\t{\n\t\t\t((RadioButton)t).setBackgroundColor(color);return this;\n\t\t}\n\t\tif(t instanceof View)\n\t\t{\n\t\t\t((View)t).setBackgroundColor(color);\n\t\t}\n\t\tif(t instanceof LinkedList){\n\t\t\tLinkedList<View> auxl = (LinkedList<View>)t;\n\t\t\tfor (View v : auxl) {\n\t\t\t\tt= (T) v;\n\t\t\t\tbg(color);\n\t\t\t}\n\t\t\t\n\t\t\tt= (T) auxl;\n\t\t}\n\t\treturn this;\n\t}", "public void setBackground(float[] rvba_01){\n\t\tswingComponent.setBackground(new Color(rvba_01[R_INDEX], rvba_01[G_INDEX], rvba_01[B_INDEX], rvba_01[A_INDEX]));\n\t}", "public void setColor(int r, int g, int b);", "public void setColor()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"red\");\n window.changeColor(\"black\");\n roof.changeColor(\"green\");\n sun.changeColor(\"yellow\");\n }\n }", "public CommandViewBuilder setBackgroundColor(Color backgroundColor)\n\t\t{\n\t\t\tthis.backgroundColor = backgroundColor;\n\t\t\treturn this;\n\t\t}", "private void setBackgroundColorDisplay(int colorR, int colorG, int colorB){\n\n int red = colorR;\n int green = colorG;\n int blue = colorB;\n\n if(colorR < 0){\n red = 0;\n }\n\n if (colorG < 0){\n green = 0;\n }\n\n if (colorB < 0){\n blue = 0;\n }\n\n int magnassoColor = (255 & 0xff) << 24 | (red & 0xff) << 16 | (green & 0xff) << 8 | (blue & 0xff);\n layout.setBackgroundColor(magnassoColor);\n }", "private void updateBackground() {\n \t\t\t\ttextRed.setText(\"\" + redBar.getProgress());\n \t\t\t\ttextGreen.setText(\"\" + greenBar.getProgress());\n \t\t\t\ttextBlue.setText(\"\" + blueBar.getProgress());\n \t\t\t\ttextAlpha.setText(\"\" + alphaBar.getProgress());\n \t\t\t\tcolorTest.setBackgroundColor(Color.argb(alphaBar.getProgress(), redBar.getProgress(), greenBar.getProgress(), blueBar.getProgress()));\n \t\t\t}", "public Color getBackground(){\r\n return back;\r\n }", "public void setBackgroundColor(String index){\n\t\tResourceBundle resources = ResourceBundle.getBundle(RESOURCE_BUNDLE);\n\t\tBackground b = new Background(new BackgroundFill((Paint)(Color.web(resources.getString(index))), null, null));\n\t\tmyGrid.setBackground(b);\n\t\tmyGrid.setOpacity(OPACITY);\n\t\n\t}", "public void setColor()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"yellow\");\n window.changeColor(\"black\");\n roof.changeColor(\"red\");\n sun.changeColor(\"yellow\");\n }\n }", "public void setBackgroundColor(Color nuovo_sfondocolore)\n {\n \tboolean bo = informaPreUpdate();\n sfondocolore = nuovo_sfondocolore;\n\t\tinformaPostUpdate(bo);\n }", "protected void setBackgroundColor(Color color) {\r\n\t\tif (primaryShape != null) {\r\n\t\t\tprimaryShape.setBackgroundColor(color);\r\n\t\t}\r\n\t}", "private void updateColor() {\n int redShift = red << 16; // red: 0xRR0000 <- 0xRR\n int greenShift = green << 8; // red: 0xGG00 <- 0xGG\n int blueShift = blue; // blue: 0xBB <- 0xBB\n int alphaShift = 0xff << 24; // alpha 0xff000000 <- 0xff // we don't want our color to be transparent.\n int color = alphaShift | redShift | greenShift | blueShift;\n viewColor.setBackgroundColor(color);\n }", "public int backgroundColor() {\n // create/return the background color\n return Color.rgb(180, 200, 255);\n }", "public void setRgbColorBg(int newval) throws YAPI_Exception\n {\n _rgbColor = newval;\n _ycolorled.set_rgbColor(newval);\n }", "public void setColor(int color);", "public void setColor(int color);", "public StockEvent setBackgroundColor(Color backgroundColor) {\n this.backgroundColor = backgroundColor;\n return this;\n }", "public void setColor(int value);", "public void setManualBackgroundColor(Color color) {\n _manualBackgroundColor = color;\n }", "public Color getBackgroundColor() {\n\t\treturn backgroundColor;\n\t}", "public void setSelectionBackground( final Color color ) {\n checkWidget();\n selectionBackground = color;\n }", "public final void setBgColor(String bgColor) {\n\t\tthis.bgColor = bgColor;\n\t}", "private void setBackground(JList list) {\n list.setForeground(new Color(140, 171, 226));\n list.setBackground(new Color(0, 0, 0));\n list.setSelectionBackground(new Color(87, 49, 134));\n list.setSelectionForeground(new Color(140, 171, 226));\n }", "public EnemyBackground(Color color) {\r\n this.color = color;\r\n }", "public void setBackground(){\r\n Image background = new Image(\"Cards/table.jpg\", 192, 80, false, true);\r\n BackgroundImage backgroundImg = new BackgroundImage(background, BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT,BackgroundPosition.DEFAULT, null);\r\n mainPane.setBackground(new Background(backgroundImg));\r\n }", "public abstract void setBackgroundHover(final int rgba);", "protected void paintBackground(Graphics g){\n Dimension size = getSize();\n\n g.setColor(properties.backgroundColor);\n g.fillRect(0,0,size.width,size.height);\n\n }", "public void setColor(float r, float g, float b, float a);", "protected Background background () {\n return Background.bordered(0xFFCCCCCC, 0xFFCC99FF, 5).inset(5);\n }", "private void setToBackground(Color color) {\n\t\tfor (Loc l : currentPiece.getLocation()) {\n\t\t\tif (l.isOnBoard()) {\n\t\t\t\tboardTiles[l.row][l.col] = color;\n\t\t\t}\n\t\t}\n\t}", "public void setBackground(Background bgFront, Background bgBack) {\n\t\tthis.bgFront = bgFront;\n\t\tthis.bgBack = bgBack;\n\t}", "public native void setBackgroundColor(PixelPacket color)\n\t\t\tthrows MagickException;", "public void setBackGroundColor(String color){\n\t\tif(color.equalsIgnoreCase(\"white\")){\n\t\t\tbutton.setBackground(Color.WHITE);\n\t\t}else{\n\t\t\tbutton.setBackground(Color.green);\n\t\t}\n\t\t\n\t}", "public native final String backgroundColor() /*-{\n\t\treturn this.backgroundColor;\n\t}-*/;", "public void setColor(int color) {\n/* 77 */ this.color = color;\n/* 78 */ this.paint.setColor(this.color);\n/* */ }", "Color getBackgroundColor();", "public void setColor(Color clr){\n color = clr;\n }", "public void setFrameBackgroundColor(int i2) {\n this.n.setColor(i2);\n }", "protected void setPlayerBackground() { Console.setBackground(Console.YELLOW); }", "public void setBgColor (final Color bgColor) {\n\t\tif (this.isDisposeBGImgWhenDone && this.bgImage != null) {\n\t\t\tthis.bgImage.getTexture().dispose();\n\t\t}\n\n\t\tif (this.bgColor != null) {\n\t\t\tthis.bgColor.dispose();\n\t\t}\n\n\t\tthis.bgColor = EasyGL.getPixelTexture(bgColor, 1, 1);\n\t\tthis.bgImage = null;\n\t}", "protected void setLightBoxBackground() { Console.setBackground(Console.BLUE); }", "public static void setViewBGcolor(Context context, int color){\n SharedPreferences.Editor edit = context.getSharedPreferences(\"DEFAULTS\", Context.MODE_PRIVATE).edit();\n edit.putInt(\"bgColor\", color);\n edit.apply();\n }", "public void init()\n {\n setBackground(Color.YELLOW);\n setForeground(Color.RED);\n }", "@Override\r\n public void mousePressed(MouseEvent e) {\n setBackground(Color.BLUE);\r\n \r\n \r\n }", "public void setColor(int red, int green, int blue){\r\n this.red = red;\r\n this.green = green;\r\n this.blue = blue;\r\n }", "public void setColor(Color c) { color.set(c); }", "private void createBackground()\n {\n GreenfootImage background = getBackground();\n background.setColor(Color.BLACK);\n background.fill();\n }", "public void setColor(Color color) {\n this.color = color;\n }", "public void initGui() {\n setOpaque(true);\n // Setter utgangsfargen til ruten\n if (this.farge.equals(\"hvit\")) setBackground(GUISettings.Hvit());\n if (this.farge.equals(\"sort\")) setBackground(GUISettings.Sort());\n if (this.farge.equals(\"roed\")) setBackground(GUISettings.Roed());\n if (this.farge.equals(\"blaa\")) setBackground(GUISettings.Blaa());\n }", "public void clouleurFondEcran() {\n this.setBackground(Color.WHITE);\n jPanel3.setBackground(Color.WHITE);\n jPanel2.setBackground(Color.WHITE);\n jPanel5.setBackground(Color.WHITE);\n jTable2.setBackground(Color.WHITE);\n jTextField3.setBackground(Color.WHITE);\n }", "public StockDateTime setBackground(Boolean background1) {\n if (jsBase == null) {\n this.background = null;\n this.background1 = null;\n this.background2 = null;\n \n this.background1 = background1;\n } else {\n this.background1 = background1;\n if (!isChain) {\n js.append(jsBase);\n isChain = true;\n }\n \n js.append(String.format(Locale.US, \".background(%b)\", background1));\n\n if (isRendered) {\n onChangeListener.onChange(String.format(Locale.US, jsBase + \".background(%b);\", background1));\n js.setLength(0);\n }\n }\n return this;\n }", "public void Color() {\n\t\t\r\n\t}" ]
[ "0.8484201", "0.77301276", "0.7698641", "0.764683", "0.7375417", "0.7332466", "0.72991306", "0.72676736", "0.7230257", "0.7200403", "0.7200207", "0.7164144", "0.71127677", "0.7094474", "0.70934933", "0.70452595", "0.7045146", "0.7024209", "0.7023659", "0.7020134", "0.69920987", "0.6985157", "0.69495314", "0.69266003", "0.69169146", "0.69077724", "0.6892482", "0.68781346", "0.68761444", "0.68542224", "0.68323815", "0.6823396", "0.68188775", "0.676465", "0.67512935", "0.6736685", "0.67352843", "0.67243177", "0.67178154", "0.6708976", "0.67074597", "0.6706973", "0.66994995", "0.6699356", "0.6682446", "0.66469467", "0.6642924", "0.6640366", "0.66367525", "0.6632034", "0.66307503", "0.66271234", "0.6626706", "0.66242415", "0.6622122", "0.66171557", "0.6606077", "0.6596307", "0.6590199", "0.65762967", "0.65629745", "0.65566105", "0.65529585", "0.65529585", "0.6542344", "0.65190244", "0.6502161", "0.65020066", "0.64909786", "0.6490555", "0.6476971", "0.6475962", "0.64487165", "0.6444335", "0.64265865", "0.64224637", "0.6417229", "0.6413113", "0.6395663", "0.6392114", "0.63871384", "0.6387", "0.6386739", "0.6376315", "0.63669086", "0.6365851", "0.63557374", "0.63502455", "0.6339503", "0.6336342", "0.6334922", "0.63271976", "0.63162786", "0.6307383", "0.63039404", "0.6299592", "0.62974036", "0.6283316", "0.62746376", "0.6272336" ]
0.7976321
1
Sets the foreground color
public void setForegroundColor(Color foreground) { foregroundColor = foreground; paintAllObjects(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void applyForegroundColor() {\r\n\t\tthis.control.setForeground(PromptSupport.getForeground(this.control));\r\n\t}", "public void setForegroundColor(int color) {\n this.foregroundColor = color;\n }", "public abstract void setCurForeground(Color colr);", "public Color getForegroundColor()\n {\n return foregroundColor;\n }", "public void setForegroundColor(Color c) {\n this.foreColor = c;\n updateFigureForModel(nodeFigure);\n }", "private void setColors(int background, int foreground) {\n rootView.setBackgroundColor(background);\n emptyCategoryTextView.setTextColor(foreground);\n }", "public void setForeground(Color c)\n {\n lname.setForeground(c);\n }", "@Override\r\n public void setForeground(Color color) {\r\n super.setForeground(Color.WHITE); //To change body of generated methods, choose Tools | Templates.\r\n }", "public Color getForeground();", "@Override\r\n public void setForeground(Color color) {\r\n super.setForeground(Color.WHITE);\r\n }", "public Color getForegroundColor() {\n return foreColor;\n }", "@Override\n public GralColor setForegroundColor(GralColor color)\n {\n return null;\n }", "protected void setForegroundColor(Color color) {\r\n\t\tif (primaryShape != null) {\r\n\t\t\tprimaryShape.setForegroundColor(color);\r\n\t\t}\r\n\t}", "public void setForeground(float[] rvba_01){\n\t\tswingComponent.setForeground(new Color(rvba_01[R_INDEX], rvba_01[G_INDEX], rvba_01[B_INDEX], rvba_01[A_INDEX]));\n\t}", "public abstract void setForegroundPressed(final int rgba);", "public abstract void setForegroundHover(final int rgba);", "private static void updateColors() {\n try {\n text.setBackground(colorScheme[0]); outputText.setBackground(colorScheme[0]); \n //frame.setBackground(colorScheme[0]);\n\n //Determines the color to set the splitter\n if(colorScheme[0].equals(Color.BLACK)) splitter.setBackground(Color.DARK_GRAY.darker());\n else if(colorScheme[0].equals(new Color(35,37,50))) splitter.setBackground(new Color(35,37,50).brighter());\n else if(colorScheme[0].equals(Color.GRAY) || colorScheme[0].equals(Color.LIGHT_GRAY) || colorScheme[0].equals(Color.WHITE)) splitter.setBackground(null);\n else splitter.setBackground(colorScheme[0].darker());\n\n text.getStyledDocument().getForeground(attributeScheme[11]); //Will work, but needs to be refreshed somehow.\n outputText.setForeground(colorScheme[11]); \n } catch (Exception e) {\n System.out.println(\"The error was here!\");\n e.printStackTrace();\n }\n }", "public void setColor(int fg, int bg) {\n // Layout\n // Bit 7 | 6 5 4 | 3 | 2 1 0\n // Fct * | bg | * | fg\n color = Color.mix(fg, bg);\n }", "public ColorController createForeground(ControllerCore genCode) {\n\t\tforegroundTXT = new ColorController(\"foreground\", getParentController(controlItemSCSCLC), genCode) {\n\t\t\t@Override\n\t\t\tpublic void initialize() {\n\t\t\t\tsetLinkedController(foreground$1LBL);\n\t\t\t\tsetProperty(\"foreground\");\n\t\t\t\tsuper.initialize();\n\t\t\t}\n\t\t\t@Override\n\t\t\tpublic void createControl() {\n\t\t\t\tsuper.createControl();\n\t\t\t\tif (isValid()) {\n\t\t\t\t\tif (null != fieldBindManager)\n\t\t\t\t\t\tfieldBindManager = new XjcFieldBindingManager(this);\n\t\t\t\t\tgetControl().addFocusListener(new XjcFocusListener(this));\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn foregroundTXT;\n\t}", "private void update() {\n\t\tColor fColor = fgColorProvider.getCurrentColor();\n\t\tColor bColor = bgColorProvider.getCurrentColor();\n\t\tsetText(String.format(\"Foreground color: (%d, %d, %d), background color: (%d, %d, %d).\", \n\t\t\t\tfColor.getRed(), fColor.getGreen(), fColor.getBlue(),\n\t\t\t\tbColor.getRed(), bColor.getGreen(), bColor.getBlue()));\n\t}", "public void setSelectionForeground( final Color color ) {\n checkWidget();\n selectionForeground = color;\n }", "public void setForegroundTranslucence(float alpha) {\n\t\tthis.fgAC = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha);\n\t}", "public void setHtmlForeground(Color color) {\n htmlFontColor = color;\n if (colorStyle != null) {\n mainStyle.removeStyleSheet(colorStyle);\n }\n colorStyle = new StyleSheet();\n colorStyle.addRule(createCSS(color));\n mainStyle.addStyleSheet(colorStyle);\n }", "private final void changeColor(boolean isForeground) {\n\t\t\tint[] columns = table.getSelectedColumns();\n\t\t\tint[] rows = table.getSelectedRows();\n\t\t\tif ((rows == null) || (columns == null))\n\t\t\t\treturn;\n\t\t\tif ((rows.length < 1) || (columns.length < 1))\n\t\t\t\treturn;\n\t\t\tColor target = cellAtt.getForeground(rows[0], columns[0]);\n\t\t\tColor reference = cellAtt.getBackground(rows[0], columns[0]);\n\t\t\tfor (int i = 0; i < rows.length; i++) {\n\t\t\t\tint row = rows[i];\n\t\t\t\tfor (int j = 0; j < columns.length; j++) {\n\t\t\t\t\tint column = columns[j];\n\t\t\t\t\ttarget = (target != cellAtt.getForeground(row, column)) ? null\n\t\t\t\t\t\t\t: target;\n\t\t\t\t\treference = (reference != cellAtt\n\t\t\t\t\t\t\t.getBackground(row, column)) ? null : reference;\n\t\t\t\t}\n\t\t\t}\n\t\t\tString title;\n\t\t\tif (isForeground) {\n\t\t\t\ttarget = (target != null) ? target : table.getForeground();\n\t\t\t\treference = (reference != null) ? reference : table\n\t\t\t\t\t\t.getBackground();\n\t\t\t\ttitle = \"Foreground Color\";\n\t\t\t} else {\n\t\t\t\ttarget = (reference != null) ? reference : table\n\t\t\t\t\t\t.getBackground();\n\t\t\t\treference = (target != null) ? target : table.getForeground();\n\t\t\t\ttitle = \"Foreground Color\";\n\t\t\t}\n\t\t\tTextColorChooser chooser = new TextColorChooser(target, reference,\n\t\t\t\t\tisForeground);\n\t\t\tColor color = chooser.showDialog(TestTableCellAttribute.this, title);\n\t\t\tif (color != null) {\n\t\t\t\tif (isForeground) {\n\t\t\t\t\tcellAtt.setForeground(color, rows, columns);\n\t\t\t\t} else {\n\t\t\t\t\tcellAtt.setBackground(color, rows, columns);\n\t\t\t\t}\n\t\t\t\ttable.clearSelection();\n\t\t\t\ttable.revalidate();\n\t\t\t\ttable.repaint();\n\t\t\t}\n\t\t}", "public X foreground(Color fg) {\n component.setForeground(fg);\n return (X) this;\n }", "public void applyColor() {\n\t\tSystem.out.println(\"Yellow\");\n\n\t}", "public Colour getForegroundColor() {\n return colour == null ? null : colour.getForeground();\n }", "public void modeColor(Graphics2D g2d) { g2d.setColor(RTColorManager.getColor(\"label\", \"default\")); }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "@Override\n protected Color getSelectionForeground() {\n return Color.BLACK;\n }", "public static void setBlue() {\r\n playerTeam.setColor(blue);\r\n updateMessage(\"Seu time agora é azul\");\r\n }", "public static void setNodeBackFixedColor( Color color ) { BACK_FIXED_COLOR = color; }", "public void setRgbColorBg(int newval) throws YAPI_Exception\n {\n _rgbColor = newval;\n _ycolorled.set_rgbColor(newval);\n }", "private void setForeground(Element config) {\r\n\t\tString StringCouleur;\r\n\r\n\t\t// Verifier le parametre\r\n\t\t//\r\n\t\tif (config == null) {\r\n\t\t\tsetForeground(Color.YELLOW);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Verifier la presence de la cle\r\n\t\t//\r\n\t\tif (config.getChild(\"AvantPlan\") == null) {\r\n\t\t\tsetForeground(Color.YELLOW);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Recuperer la valeur associee\r\n\t\t//\r\n\t\tStringCouleur = config.getChild(\"AvantPlan\").getTextTrim();\r\n\r\n\t\t// Affecter la nouvelle couleur\r\n\t\t//\r\n\t\tif (zoneAffichage != null)\r\n\t\t\tzoneAffichage.setForeground(XML.obtenirColorFont(StringCouleur));\r\n\t\telse if (list != null)\r\n\t\t\tlist.setForeground(XML.obtenirColorFont(StringCouleur));\r\n\t}", "public void setBackground(Color back) {\r\n this.back = back;\r\n }", "@Override\n\t\t\tpublic void update(Observable o, Object arg) {\n\t\t\t\tupdateCurrentLineForeground(Properties.getDefaultProperties().getOptinalColorProperty(currentLineFontForegroundKey, \n\t\t\t\t\t\t\t\t\t\t\tColor.black));\n\t\t\t}", "protected void setLightBoxBackground() { Console.setBackground(Console.BLUE); }", "protected void drawForegroundToBackground() {\n if (backgroundColor == null) { return; }\n\n final BufferedImage backgroundBufferedImage = new BufferedImage(dimension.width, dimension.height, this.bufferedImage.getType());\n final Graphics graphics = backgroundBufferedImage.getGraphics();\n\n // draw current color\n graphics.setColor(backgroundColor);\n graphics.fillRect(0, 0, dimension.width, dimension.height);\n graphics.drawImage(bufferedImage, 0, 0, null);\n\n // draw back to original\n final Graphics graphics2 = bufferedImage.getGraphics();\n graphics2.drawImage(backgroundBufferedImage, 0, 0, null);\n }", "private void setColor() {\n cell.setStroke(Color.GRAY);\n\n if (alive) {\n cell.setFill(aliveColor);\n } else {\n cell.setFill(deadColor);\n }\n }", "public void setFontColor(int red, int green, int blue, int alpha){\n if(isTheColorInputCorrect(red, green, blue, alpha)){\n fontColor = new Color(red, green, blue); \n }\n }", "synchronized private void changeColor()\n {\n if ( ++colorIndex == someColors.length )\n colorIndex = 0;\n setForeground( currentColor() );\n repaint();\n }", "public void setBg(){\n this.setBackground(color);\n }", "void setColor(){\n this.objectColour = new Color(rValue,gValue,bValue,timeToLive).brighter();\n }", "public void updateUI(final Color foreground) {\n\t\tsetUI(new BasicTabbedPaneUI() {\n\t\t\t@Override\n\t\t\tprotected boolean shouldRotateTabRuns(int i) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tprotected void installDefaults() {\n\t\t\t\tsuper.installDefaults();\n\t\t\t\thighlight = foreground;\n\t\t\t\tlightHighlight = foreground;\n\t\t\t\tshadow = foreground;\n\t\t\t\tdarkShadow = foreground;\n\t\t\t\tfocus = foreground;\n\n\t\t\t\t// Nice 3 pixel border, although it uses ugly blue ):\n\t\t\t\tthis.contentBorderInsets.top = 3;\n\t\t\t\tthis.contentBorderInsets.left = 3;\n\t\t\t\tthis.contentBorderInsets.right = 3;\n\t\t\t\tthis.contentBorderInsets.bottom = 3;\n\t\t\t\t\n\t\t\t\tthis.selectedTabPadInsets.bottom = 0;\n\t\t\t}\n\n\t\t\tBasicStroke underLineStroke = new BasicStroke(2);\n\n\t\t\t@Override\n\t\t\tprotected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h,\n\t\t\t\t\tboolean isSelected) {\n\t\t\t\tsuper.paintTabBorder(g, tabPlacement, tabIndex, x, y, w, h, isSelected);\n\t\t\t\t\n\t\t\t\tif (isSelected) {\n\t\t\t\t\tGraphics2D g2d = (Graphics2D) g.create();\n\t\t\t\t\tsuper.paintTabBorder(g2d, tabPlacement, tabIndex, x, y, w, h, isSelected);\n\t\t\t\t\tg2d.setStroke(underLineStroke);\n\t\t\t\t\tg2d.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);\n\t\t\t\t\tg2d.dispose();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t}", "public void setTextLabelForegroundColor(int mTextLabelForegroundColor) {\n\t\tthis.mTextLabelForegroundColor = mTextLabelForegroundColor;\n\t}", "public void setHslColorBg(int newval) throws YAPI_Exception\n {\n _hslColor = newval;\n _ycolorled.set_hslColor(newval);\n }", "public void fillColor() {\n\t\tSystem.out.println(\"Blue color\");\n\t}", "@Override\r\n\tprotected void init() {\r\n\r\n\t\t// enable:\r\n\t\tObject obj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[Enabled].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorEnabled = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorEnabled = this.color2;\r\n\t\t}\r\n\r\n\t\t// disable:\r\n\t\tobj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[Disabled].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorDisabled = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorDisabled = this.color1;\r\n\t\t}\r\n\r\n\t\t// pressed:\r\n\t\tobj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[Pressed].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorPressed = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorPressed = this.color3;\r\n\t\t}\r\n\r\n\t\t// mouseover:\r\n\t\tobj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + \"[MouseOver].foreground\");\r\n\t\tif (obj instanceof Paint) {\r\n\t\t\tthis.foregroundColorMouseOver = (Paint) obj;\r\n\t\t} else {\r\n\t\t\tthis.foregroundColorMouseOver = this.color4;\r\n\t\t}\r\n\r\n\t}", "protected void setPlayerBackground() { Console.setBackground(Console.YELLOW); }", "protected void setBoxBackground() { Console.setBackground(Console.RED); }", "public void setColors() {\n\t\tif (!this.block.isEditable()) {\n\t\t\tthis.dispNormal = Color.LIGHT_GRAY;\n\t\t\tthis.dispSelected = Color.GRAY;\n\t\t\tthis.displayNumberBlock.setBackground(dispNormal);\n\t\t} else {\n\t\t\tthis.dispNormal = Color.white;\n\t\t\tthis.dispSelected = Color.cyan;\n\t\t\tthis.displayNumberBlock.setBackground(dispNormal);\n\t\t}\n\t}", "public abstract void setCurBackground(Color colr);", "public void setBorderColor(int red, int green, int blue, int alpha){\n if(isTheColorInputCorrect(red, green, blue, alpha)){\n borderColor = new Color(red, green, blue, alpha); \n }\n }", "@Override\n\tpublic void drawForeground(Canvas canvas, int width, int height) {\n\t\t\n\t}", "public void setColor()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"yellow\");\n window.changeColor(\"black\");\n roof.changeColor(\"red\");\n sun.changeColor(\"yellow\");\n }\n }", "public void setCellForeground(int row, int col, RGB rgbColor){\n\t\tcheckRowIndex(row);\t\n\t\tcheckColumnIndex(col);\n\t\ttableViewer.getTable().getItem(row).setForeground(\n\t\t\t\tcol, CustomMediaFactory.getInstance().getColor(rgbColor));\n\t}", "public void setColor(Color c);", "public void setColor(Color c) { color.set(c); }", "public void setForegroundColor(String colorString)\r\n {\r\n/* if(colorString.equals(\"red\"))\r\n graphic.setColor(Color.red);\r\n else if(colorString.equals(\"black\"))\r\n graphic.setColor(Color.black);\r\n else if(colorString.equals(\"blue\"))\r\n graphic.setColor(Color.blue);\r\n else if(colorString.equals(\"yellow\"))\r\n graphic.setColor(Color.yellow);\r\n else if(colorString.equals(\"green\"))\r\n graphic.setColor(Color.green);\r\n else if(colorString.equals(\"magenta\"))\r\n graphic.setColor(Color.magenta);\r\n else if(colorString.equals(\"white\"))\r\n graphic.setColor(Color.white);\r\n else if(colorString.equals(\"cyan\"))\r\n graphic.setColor(Color.cyan);\r\n else\r\n graphic.setColor(Color.black); */\r\n }", "public void setCol(Color color) {\n this.setForeground(color);\n }", "public void setColor()\n {\n if (wall != null) // only if it's painted already...\n {\n wall.changeColor(\"red\");\n window.changeColor(\"black\");\n roof.changeColor(\"green\");\n sun.changeColor(\"yellow\");\n }\n }", "public void setColor(Color clr){\n color = clr;\n }", "public static void makeBackgroundGray(){\r\n\t\tStdDraw.clear(StdDraw.LIGHT_GRAY);\r\n\t}", "@Override\n\tpublic void setColour(float r, float g, float b) {\n\n\t}", "public void blue() {\n g2.setPaint(Color.blue);\r\n }", "public void colorText() {\r\n String theColor = textShape.getText();\r\n if (theColor.contains(\"blue\")) {\r\n textShape.setForegroundColor(Color.BLUE);\r\n }\r\n else if (theColor.contains(\"red\")) {\r\n textShape.setForegroundColor(Color.RED);\r\n }\r\n else {\r\n textShape.setForegroundColor(Color.BLACK);\r\n }\r\n }", "public void setColor()\n {\n if(wall != null) // only if it's painted already...\n {\n wall.changeColor(\"red\");\n window.changeColor(\"black\");\n roof.changeColor(\"green\");\n sun.changeColor(\"yellow\");\n }\n }", "private void applyBackgroundColor() {\r\n\t\tthis.control.setBackground(PromptSupport.getBackground(this.control));\r\n\t}", "public void setFillColor(Color color);", "public void setColor(Color color);", "public void setColor(double value) {\r\n\t\tif (value < 0) {\r\n\t\t\tpg.fill(140+(int)(100*(-value)), 0, 0);\r\n\t\t} else {\r\n\t\t\tpg.fill(0, 140+(int)(100*(value)), 0);\r\n\t\t}\r\n\t}", "public void setStrokeColor(Color color);", "public void setCursorPositionColor(Color color)\n {\n this.jStatusBarColor.setBackground(color);\n this.jStatusBarColor.setText(\"RGB:\"+color.getRed()+\",\"+color.getGreen()+\",\"+color.getBlue());\n }", "public void setColor(int r, int g, int b);", "public Color getSelectionForeground() {\n checkWidget();\n Color result = selectionForeground;\n if( result == null ) {\n CTabFolderThemeAdapter adapter = getCTabFolderThemeAdapter();\n result = adapter.getSelectedForeground( this );\n }\n if( result == null ) {\n // Should never happen as the theming must prevent transparency for\n // this color\n throw new IllegalStateException( \"Transparent selection foreground color\" );\n }\n return result;\n }", "@Override\r\n\t\tpublic Color getForeground(Object element) {\n\t\t\treturn null;\r\n\t\t}", "public void setBackgroundColor(Color c) {\n backColor = c;\n updateFigureForModel(nodeFigure);\n }", "public void setColor(Color newColor) ;", "public void setColor(float r, float g, float b, float a);", "public native final EditorBaseEvent fontColor(String val) /*-{\n\t\tthis.fontColor = val;\n\t\treturn this;\n\t}-*/;", "private void setPenColor() {\n\t}", "public void setLblColor(Color value) {\n lblColor = value;\n }", "public void setFrameBackgroundColor(int i2) {\n this.n.setColor(i2);\n }", "public void resetColor(){\n myRectangle.setFill(PADDLE_COLOR);\n }", "public void setColor(int value);", "void setColor(int r, int g, int b);", "public void revertColor()\r\n\t{\r\n\t\tif (savedColor != null)\r\n\t\t{\r\n\t\t\tg.setColor(savedColor);\r\n\t\t}\r\n\t}", "public void setColor( int c ){//1 means black, 0 means white\r\n\t\tif(c==1)\r\n\t\t\tthis.setBackground(Color.BLACK);\r\n\t\telse\r\n\t\t\tthis.setBackground(Color.WHITE);\r\n\t}", "void setColor(final java.awt.Color color);", "public void init()\n {\n setBackground(Color.YELLOW);\n setForeground(Color.RED);\n }", "public void setColor()\n {\n if(eyeL != null) // only if it's painted already...\n {\n eyeL.changeColor(\"yellow\");\n eyeR.changeColor(\"yellow\");\n nose.changeColor(\"green\");\n mouthM.changeColor(\"red\");\n mouthL.changeColor(\"red\");\n mouthR.changeColor(\"red\");\n }\n }", "private void setBackgroundColor(int backColor){\n backgroundColor = backColor;\n touchArea.setBackgroundColor(backgroundColor);\n }", "public void setDateCenterGridPairForegroundColor(\n\t\t\tColor dateCenterGridPairForegroundColor) {\n\t\tthis.dateCenterGridPairForegroundColor = dateCenterGridPairForegroundColor;\n\t}", "public void setGroundColor(int groundColor) {\n if (groundColor != this.groundColor) {\n int oldGroundColor = this.groundColor;\n this.groundColor = groundColor;\n this.propertyChangeSupport.firePropertyChange(Property.GROUND_COLOR.name(), oldGroundColor, groundColor);\n \n setGroundPaint(EnvironmentPaint.COLORED);\n }\n }", "void setStatusColour(Color colour);", "private void setBgColor(Color c)\n\t{\n\t\teToPower.setBackground (c);\n\t\ttwoPower.setBackground (c);\n\t\tln.setBackground (c);\n\t\txCube.setBackground (c);\n\t\txSquare.setBackground (c);\n\t\tdel.setBackground (c);\n\t\tcubeRoot.setBackground (c);\n\t\tC.setBackground (c);\n\t\tnegate.setBackground (c);\n\t\tsquareRoot.setBackground (c);\n\t\tnine.setBackground (c);\n\t\teight.setBackground (c);\n\t\tseven.setBackground (c);\n\t\tsix.setBackground (c);\n\t\tfive.setBackground (c);\n\t\tfour.setBackground (c);\n\t\tthree.setBackground (c);\n\t\ttwo.setBackground (c);\n\t\tone.setBackground (c);\n\t\tzero.setBackground (c);\n\t\tdivide.setBackground (c);\n\t\tpercent.setBackground (c);\n\t\tmultiply.setBackground (c);\n\t\treciprocal.setBackground (c);\n\t\tadd.setBackground (c);\n\t\tsubtract.setBackground (c);\n\t\tdecimalPoint.setBackground (c);\n\t\tequals.setBackground (c);\n\t\te.setBackground (c);\n\t\tPI.setBackground (c);\n\t\tentry.setBackground (c);\n\t\t\n\t\tmenuBar.setBackground (c);\n\t\tfileMenu.setBackground (c);\n\t\ttoolsMenu.setBackground (c);\n\t\thelpMenu.setBackground (c);\n\t\t\n\t\texit.setBackground (c);\n\t\tsettings.setBackground (c);\n\t\tabout.setBackground (c);\n\t\treadme.setBackground (c);\n\t}", "public void enterForeground();", "public void setColor(int datapoints) {\n\t\tif (datapoints == 0) {\n\t\t\tmainSash.setBackground(new Color(Display.getCurrent(), new RGB(180, 0, 0)));\n\t\t} else {\n\t\t\tmainSash.setBackground(new Color(Display.getCurrent(), new RGB(0, 180, 0)));\n\t\t}\n\t}" ]
[ "0.7579141", "0.7566504", "0.75619096", "0.73707426", "0.71591485", "0.7156423", "0.7138751", "0.708319", "0.6899786", "0.6819362", "0.6733117", "0.6714136", "0.6663587", "0.6658203", "0.6598971", "0.65636444", "0.63704735", "0.6369887", "0.6361033", "0.6349782", "0.6321522", "0.62951857", "0.6282232", "0.627684", "0.62622637", "0.6213401", "0.6189358", "0.6046502", "0.60092103", "0.60092103", "0.60092103", "0.60092103", "0.59949744", "0.59942514", "0.59855306", "0.59427035", "0.58823466", "0.58701146", "0.5860277", "0.5857794", "0.58497226", "0.5830498", "0.57766134", "0.57759106", "0.5763583", "0.5761501", "0.57236195", "0.5712282", "0.56998116", "0.5692799", "0.5682098", "0.5672671", "0.56709695", "0.5656667", "0.5654335", "0.56222063", "0.56183326", "0.56171596", "0.56131107", "0.5611831", "0.5590265", "0.55843765", "0.5581195", "0.5576055", "0.5553625", "0.55511796", "0.5549929", "0.5545254", "0.5544669", "0.55414295", "0.55255663", "0.5512408", "0.5498589", "0.5497794", "0.5495898", "0.54939765", "0.54923975", "0.54904044", "0.54801184", "0.54580593", "0.5445523", "0.5429298", "0.54277545", "0.54197747", "0.5417906", "0.5413777", "0.54026234", "0.5401181", "0.54006445", "0.53934944", "0.5391621", "0.5388662", "0.53859276", "0.5384006", "0.53753215", "0.5365061", "0.5360135", "0.5357182", "0.53509295", "0.5338112" ]
0.84291035
0
Prompts the user to select the number of sockets to use
private void setSockets() { String s = (String) JOptionPane.showInputDialog(null, "Select Number of Sockets:", "Sockets", JOptionPane.PLAIN_MESSAGE, null, socketSelect, "1"); if ((s != null) && (s.length() > 0)) { totalNumThreads = Integer.parseInt(s); } else { totalNumThreads = 1; } recoveryQueue.setMaxSize(totalNumThreads * 10); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void askForNumberOfRequests() {\n\t\tconnectToServer();\n\t\tout.println(\"How many requests have you handled ?\");\n\t\tout.flush();\n\t\tint count = 0;\n\t\ttry {\n\t\t\tcount = Integer.parseInt(in.readLine());\n\t\t}\n\t\tcatch(IOException e) {\n\t\t\tSystem.out.println(\"CLIENT: Cannot receive num requests from server\");\n\t\t}\n\t\tSystem.out.println(\"CLIENT: The number of requests are \" + count);\n\t\tdisconnectFromServer();\n\t}", "private static void pickNumOfPlayers()\n\t{\n\t\tprintBorder();\n\t\tSystem.out.print(\"Enter 1 for one player or 2 for two player: \");\n\t\tnumOfPlayers = input.nextInt(); // Throws error if input is not an int\n\t\tif (numOfPlayers == 2) isMultiplayer = true;\n\t\tSystem.out.println();\n\t}", "int getServerSocketCount();", "public static void main(String[] args ) \n\t{\tint i;\n\t\tint socketNumber = 4440;\t\n\t\tif (args.length > 0)\n\t\t{\tsize = Integer.parseInt(args[0]);\n\t\t}\n\t\tif (args.length > 1)\n\t\t{\tsocketNumber = Integer.parseInt(args[1]);\n\t\t}\n\t\ttry \n\t\t{\tServerSocket s = new ServerSocket(socketNumber);\n\t\t\tfor(i= 0; i < size; ++i)\n\t\t\t{\tsessions[i] = null;\n\t\t\t}\t\t\n\t\t\tnew Echoer().start();\n\t\t\twhile(true)\n\t\t\t{\tSocket incoming = s.accept( );\n\t\t\t\tboolean found = false;\n\t\t\t\tint numusers = 0;\n\t\t\t\tint usernum = -1;\n\t\t\t\tsynchronized(sessions)\n\t\t\t\t{\tfor(i = 0; i < size; ++i)\n\t\t\t\t\t{\tif(sessions[i] == null)\n\t\t\t\t\t\t{\tif(!found)\n\t\t\t\t\t\t\t{\tsessions[i] = new PrintStream(incoming.getOutputStream());\n\t\t\t\t\t\t\t\tnew ChatHandler(incoming, i).start();\n\t\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\t\tusernum = i;\n\t\t\t\t\t\t\t\t//System.out.println(\"assign \"+i);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse numusers++;\n\t\t\t\t\t}\n\t\t\t\t\tif(!found)\n\t\t\t\t\t{\tPrintStream temp = new PrintStream(incoming.getOutputStream());\n\t\t\t\t\t\ttemp.println(\"\\n No available entry. Disconnecting. Sorry. \\n\");\n\t\t\t\t\t\ttemp.println(\"\\n You must reload to try again. \\n\");\n\t\t\t\t\t\ttemp = null; // Permit garbage collection of the PrintStream.\n\t\t\t\t\t\ts.close();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\tsessions[usernum].println(\"\\nThere are \"+numusers+\" other users.\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tcatch (Exception e) \n\t\t{\tSystem.err.println(\"Error in main: \" + e);\n\t\t} \n\t}", "private void listenForConnection() throws IOException {\n\twhile(true) {\n System.out.println(\"Waiting for connection...\");\n // Wait for client to connect\n Socket cli = server.accept();\n if(connlist.size() < MAX_CONN) {\n\t\t// if numCli is less then 100\n initConnection(cli);\n }\n\t}\n }", "private void waitForClient( int num ) throws IOException{\r\n\t\tshowMessage(\"\\n Waiting for Client \" + num + \" to connect ...\");\r\n\t\tif ( num == 1 ){\r\n\t\t\tconnectionClient1 = server.accept();\r\n\t\t\tshowMessage(\"\\nNow Connected to \" + connectionClient1.getInetAddress().getHostName() + \"/\" +connectionClient1.getInetAddress().getHostAddress());\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconnectionClient2 = server.accept();\r\n\t\t\tshowMessage(\"\\nNow Connected to \" + connectionClient2.getInetAddress().getHostName() + \"/\" +connectionClient2.getInetAddress().getHostAddress());\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n try {\r\n ServerSocket server=new ServerSocket(port);\r\n System.out.println(\"Waiting for a client...\");\r\n\r\n connections=new ArrayList<>();\r\n ExecutorService es = Executors.newFixedThreadPool(max_clients);\r\n\r\n Connection tmp;\r\n while(true) {\r\n\r\n\r\n Socket socket = server.accept();\r\n if(max_clients<=clients){\r\n OutputStream out = socket.getOutputStream();\r\n BufferedWriter rout= new BufferedWriter(new OutputStreamWriter(out));\r\n rout.write(\"Chat is full(\"+max_clients+\" users). You can't join. Try again later.\");\r\n rout.write(\"\\n\");\r\n rout.flush();\r\n socket.close();\r\n out.close();\r\n continue;\r\n }\r\n\r\n tmp=new Connection(socket);\r\n es.submit(tmp);\r\n clients++;\r\n System.out.println(\"New user has joined. Number of users - \"+clients);\r\n connections.add(tmp);\r\n }\r\n\r\n } catch (IOException e) {\r\n e.printStackTrace();\r\n }\r\n }", "private void cmdNet() {\n int port = 1777;\n try {\n Log.verbose(\"waiting for connection on port \" + port + \"...\");\n ServerSocket socket = new ServerSocket(port);\n Socket client = socket.accept();\n InetAddress clientAddr = client.getInetAddress();\n Log.verbose(\"connected to \" + clientAddr.getHostName() + \"/\"\n + client.getPort());\n Readline readline = new SocketReadline(client, true, \"net>\");\n fReadlineStack.push(readline);\n } catch (IOException ex) {\n Log.error(\"Can't bind or listen on port \" + port + \".\");\n }\n }", "private void selectLoop() {\n \t\tlong timeout = 0; // wait indefinitely\n \t\n \t\tregisterPending();\n \t\n \t\twhile (!Thread.interrupted()) {\n \t\t\tif (contextMap.isEmpty() && currentlyOpenSockets.get() == 0 && currentlyConnectingSockets.get() == 0) {\n \t\t\t\tassert logger != null;\n \t\t\t\tlogger.debug(\"SocketEngineService clean\");\n \t\t\t\ttimeout = 0;\n \t\t\t} else {\n\t\t\t\t//XXX remove\n//\t\t\t\tlogger.debug(\"active contexts: \"+contextMap.size()+\" selection keys: \"+selector.keys().size());\n//\t\t\t\tlogger.debug(\"open sockets: \"+currentlyOpenSockets.get()+\" connecting sockets: \"+currentlyConnectingSockets.get());\n \t\t\t\ttimeout = Math.max(timeout, 500); // XXX\n \t\t\t}\n \n \t\t\ttry {\n \t\t\t\tselector.select(timeout);\n \t\t\t\tassert selector != null;\n \t\t\t\tif (selector.isOpen() == false) {\n \t\t\t\t\treturn;\n \t\t\t\t}\n \t\t\t} catch (IOException e) {\n \t\t\t\tassert logger != null;\n \t\t\t\tlogger.error(\"I/O error in Selector#select()\", e);\n \t\t\t\treturn;\n \t\t\t}\n \t\t\t\n \t\t\tregisterPending();\n \n \t\t\tfor (SelectionKey key : selector.selectedKeys()) {\n \t\t\t\tSelectionContext context = (SelectionContext)key.attachment();\n \t\t\t\ttry {\n \t\t\t\t\tcontext.testKey(key);\n \t\t\t\t} catch (CancelledKeyException e) {\n \t\t\t\t\t// a selected key is cancelled\n\t\t\t\t\t// XXX remove\n//\t\t\t\t\tlogger.warning(\"Cancelled selector key (on selected key)\", e);\n \t\t\t\t\t// do something about it\n \t\t\t\t\tcontext.close();\n \t\t\t\t}\n \t\t\t}\n \n \t\t\tlong now = System.currentTimeMillis();\n \t\t\ttimeout = Long.MAX_VALUE;\n \t\t\tfor (SelectionKey key : selector.keys()) {\n \t\t\t\tSelectionContext context = (SelectionContext)key.attachment();\n \t\t\t\ttry {\n \t\t\t\t\ttimeout = Math.min(timeout, context.testTimeOut(key, now));\n \t\t\t\t} catch (CancelledKeyException e) {\n\t\t\t\t\t//XXX remove\n//\t\t\t\t\tlogger.warning(\"Cancelled selector key (when testing timeout of unselected key)\", e);\n \t\t\t\t\t// do something about it. should close?\n \t\t\t\t}\n \t\t\t}\n \t\t\tif (timeout == Long.MAX_VALUE) timeout = 0; // 0 means wait indefinitely\n \t\t}\n \t}", "private void initSelectorLoops() {\n ServerConfiguration configuration = getContext().getServerConfiguration();\n String eventLoopName = \"nio-process(tcp-\" + configuration.getSERVER_PORT() + \")\";\n int core_size = configuration.getSERVER_CORE_SIZE();\n this.selectorEventLoopGroup = new SocketSelectorEventLoopGroup(getContext(), eventLoopName,\n core_size);\n LifeCycleUtil.start(selectorEventLoopGroup);\n }", "public static void main(String args[]) {\n\t\tint portNumber = 8000;\n\t\tif (args.length < 2) {\n\t\t\tSystem.out.println(\"Usage: java Server <portNumber>\\n\"\n\t\t\t\t\t+ \"Now using port number=\" + portNumber + \"\\n\" +\n\t\t\t\t\t\"Maximum user count=\" + maxUsersCount);\n\t\t} else {\n\t\t\tportNumber = Integer.valueOf(args[0]).intValue();\n\t\t\tmaxUsersCount = Integer.valueOf(args[1]).intValue();\n\t\t}\n\n\t\tSystem.out.println(\"Server now using port number=\" + portNumber + \"\\n\" + \"Maximum user count=\" + maxUsersCount);\n\t\t\n\t\tuserThread[] threads = new userThread[maxUsersCount];\n\n\t\t/*\n\t\t * Open a server socket on the portNumber (default 8000). \n\t\t */\n\t\ttry {\n\t\t\tserverSocket = new ServerSocket(portNumber);\n\t\t} catch (IOException e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\n\t\t/*\n\t\t * Create a user socket for each connection and pass it to a new user\n\t\t * thread.\n\t\t */\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tuserSocket = serverSocket.accept();\n\t\t\t\tint i = 0;\n\t\t\t\tfor (i = 0; i < maxUsersCount; i++) {\n\t\t\t\t\tif (threads[i] == null) {\n\t\t\t\t\t\tthreads[i] = new userThread(userSocket, threads);\n\t\t\t\t\t\tthreads[i].start();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (i == maxUsersCount) {\n\t\t\t\t\tPrintStream output_stream = new PrintStream(userSocket.getOutputStream());\n\t\t\t\t\toutput_stream.println(\"#busy\");\n\t\t\t\t\toutput_stream.close();\n\t\t\t\t\tuserSocket.close();\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(e);\n\t\t\t}\n\t\t}\n\t}", "public static int getUserInput(){\r\n String input;\r\n Integer selection;\r\n while(true){\r\n try {\r\n input = JOptionPane.showInputDialog(null, \"Please enter the desired side size or press cancel for default size,\\n\"\r\n + \"you should enter a valid integer between 3 and 100.\");\r\n if (input == null) {\r\n selection = DEFAULT_SIZE;\r\n }\r\n else {\r\n selection = Integer.parseInt(input);\r\n if (selection > UPPER_BOUND) selection = UPPER_BOUND;\r\n else if (selection < LOWER_BOUND) selection = LOWER_BOUND;\r\n }\r\n break;\r\n }\r\n catch (NumberFormatException e){\r\n continue;\r\n }\r\n }\r\n return selection;\r\n \r\n }", "public void communicate() {\n String line;\n String response;\n\n boolean run = true;\n\n while (run) {\n try {\n System.out.println(\"Please select an option (DATE/TIME)\");\n\n // Read line from console\n line = stdIn.readLine();\n\n if (line.equals(\"QUIT\")) {\n run = false;\n // Send QUIT to server\n socketOut.println(line);\n }\n else {\n // Send line to server\n socketOut.println(line);\n // Receive response from the server\n response = socketIn.readLine();\n // Print server response to client console\n System.out.println(response);\n }\n }\n catch(IOException e) {\n e.printStackTrace();\n }\n }\n\n closeConnection();\n }", "private synchronized static void incrementNumberOfOpenSockets() {\r\n\r\n\t\tnumberOfOpenSockets++;\r\n\t}", "public int get_max_accept() throws Exception;", "void provideService() throws SocketException, UnknownHostException {\n while (true) {\n Scanner sc = new Scanner(System.in);\n System.out.println(\"\\nPlease select from the following: \\n Enter 1 for Inserting a file\\n Enter 2 for file lookup \\n Enter 3 to Exit\");\n int choice = sc.nextInt();\n // insert a file\n if(choice == 1) {\n System.out.println(\"\\nEnter the file Name to insert: \");\n String fileName = sc.next();\n insertFile(fileName);\n receiveAcknowledgement();\n }\n //lookup a file\n else if(choice == 2) {\n System.out.println(\"\\nEnter the file name to look up: \");\n String fileName = sc.next();\n lookup(fileName);\n receiveAcknowledgement();\n }\n //exit the program\n else if(choice == 3) {\n System.out.println(\"\\nEXITING!!\");\n System.exit(1);\n }\n // wrong choice\n else\n System.out.println(\"\\nWrong choice, enter again!\");\n }\n }", "public static void main(String[] args) throws Exception {\n\t\tint port = Integer.parseInt(args[0]);\r\n\t\tint times = Integer.parseInt(args[1]);\r\n\t\tServerSocket ss = new ServerSocket(port);\r\n\t\tint i = 1;\r\n\t\twhile (i <= times) {\r\n\t\t\tSocket s = ss.accept();\r\n\t\t\tOutputStream os = s.getOutputStream();\r\n\t\t\tDataOutputStream dos = new DataOutputStream(os);\r\n\t\t\tfor (int j = 1; j <= 10; j++)\r\n\t\t\t\tdos.writeInt(j);\r\n\t\t\ts.close();\r\n\t\t\t++i;\r\n\t\t}\r\n\t\t\r\n\r\n\t}", "public void askForPeers() {\n\t\tif(peers.size() < maximumConnections) {\n\t\t\tpropagateToAllPeers(new PeerAskMessage());\n\t\t}\n\t}", "public static void menu() {\n\n\t\tSystem.out.println(\"\\n*** MENU ***: \");\n\t\tSystem.out.print(\"\\n1. Host current Date and Time\\n\" + \"2. Host uptime\\n\" + \"3. Host memory use\\n\"\n\t\t\t\t+ \"4. Host IPV4 socket connections\\n\" + \"5. Host current users\\n\" + \"6. Host running processes\\n\"\n\t\t\t\t+ \"7. Quit\\n\" + \"\\nSelect option: \");\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\ttry {\n\t\t\tmenuSelect = sc.nextInt();\n\t\t\tif (menuSelect < 1 || menuSelect > 7) {\n\t\t\t\tSystem.out.println(\"\\nUser invalid input, input number between 1 and 7\");\n\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"\\nUser invalid input, input number between 1 and 7\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\t\tswitch (menuSelect) {\n\t\tcase 1:\n\t\t\tSystem.out.println(\"Date Request from Client\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tSystem.out.println(\"Uptime Request from Client\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tSystem.out.println(\"Memory Use Request from Client\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tSystem.out.println(\"IPV4 Socket Connections Request from Client\");\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tSystem.out.println(\"Current Users Request from Client\");\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tSystem.out.println(\"Current OS Version Request from Client\");\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tSystem.out.println(\"Quit\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tsc.close(); // close the Scanner object\n\t}", "public static void main(String[] args) {\n\t\ttry {\r\n \t\tserverSocket = new ServerSocket(serverport);\r\n \t\twhile (!serverSocket.isClosed()) {\r\n \t\t\twaitNewUser();\r\n \t\t}\r\n \t} catch (IOException e) {\r\n \t\te.getStackTrace();\r\n \t}\r\n\t}", "int getPeakServerSocketCount();", "protected void choseInterface() {\n\t\tint temp=Integer.parseInt(textField.getText());\r\n\t\tif(temp>0 && temp<=counter)\r\n\t\t{\r\n\t\t\tindex=temp; // index is he index of network inerface object to see which object need to be opened\r\n\t\t\tenableButtons();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tJOptionPane.showMessageDialog(null, \"Outsde of Range. # interfaces = 1-\"+(counter)+\".\");\r\n\t\t}\r\n\t\ttextField.setText(\"\");\r\n\t}", "public static void main(String[] args) {\n\t\ttry {\r\n\t\t\tSocket socket = new Socket(\"localhost\", 8001);\r\n\t\t\t\r\n\t\t\tDataOutputStream dos = new DataOutputStream(socket.getOutputStream());\r\n\t\t\tDataInputStream dis = new DataInputStream(socket.getInputStream());\r\n\t\t\t\r\n\t\t\tint num1, num2, ch;\r\n\t\t\t\r\n\t\t\t// String string;\r\n\t\t\t\r\n\t\t\tint cont = 1;\r\n\t\t\t\r\n\t\t\twhile(cont == 1) {\r\n\t\t\t\tScanner scanner = new Scanner(System.in);\r\n\t\t\t\tSystem.out.println(\"Enter Number 1\");\r\n\t\t\t\tnum1 = scanner.nextInt();\r\n\t\t\t\tSystem.out.println(\"Enter Num ber 2\");\r\n\t\t\t\tnum2 = scanner.nextInt();\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"Enter 1 for Addition, 2 for Subtraction\");\r\n\t\t\t\tch = scanner.nextInt();\r\n\t\t\t\t\r\n\t\t\t\tdos.writeInt(num1);\r\n\t\t\t\tdos.writeInt(num2);\r\n\t\t\t\tdos.writeInt(ch);\r\n\t\t\t\t\r\n\t\t\t\t// dos.write(string);\r\n//\t\t\t\t\r\n//\t\t\t\tdos.flush();\r\n\t\t\t\t\r\n\t\t\t\tint answer = dis.readInt();\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"The Answer is \" + answer);\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.println(\"Do you want to repeat\");\r\n\t\t\t\tcont = scanner.nextInt();\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} catch (UnknownHostException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t} catch (IOException e) {\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public static void main(String[] args)throws IOException \r\n\t{\n\t\tInetAddress addr = InetAddress.getByName(null);\r\n\t\t\r\n\t\t// Alternatively, you can use the address or name:\r\n\t\t// InetAddress addr = InetAddress.getByName(\"127.0.0.1\");\r\n\t\t// InetAddress addr = InetAddress.getByName(\"localhost\");\r\n\t\tSystem.out.println(\"addr = \" + addr);\r\n\t\tSocket socket = new Socket(addr, 10000);\r\n\t\t\r\n\t\t// Guard everything in a try-finally to make\r\n\t\t// sure that the socket is closed:\r\n\t\ttry\r\n\t\t{\r\n\t\t\tSystem.out.println(\"socket = \" + socket);\r\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\t\tBufferedReader in = \r\n\t\t\t\tnew BufferedReader(new InputStreamReader(socket.getInputStream()));\r\n\t\t\t\r\n\t\t\t// Output is automatically flushed by PrintWriter:\r\n\t\t\tPrintWriter out =\r\n\t\t\t\tnew PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())),true);\r\n\r\n\t\t\twhile(true){\r\n\t\t\tSystem.out.print(\"Enter Some String: \");\r\n\t\t\t//int num=Integer.parseInt(br.readLine()); // Reading from KeyBoard\r\n\t\t\tString str=br.readLine();\r\n\t\t\tout.println(str);}\r\n\t\t\t//int addnum = Integer.parseInt(in.readLine()); // Reading from Server\r\n\t\t//\tSystem.out.println(\"Result from Server: \"+addnum);\r\n\t\t}catch(Exception e){e.printStackTrace();}\r\n\t\r\n\t\r\n\t}", "public static void userSelection(){\n\t\tint selection;\n\t\tScanner input = new Scanner(System.in);\n\t\tSystem.out.println(\"Which program would you like to run?\");\n\t\tselection=input.nextInt();\n\n\t\tif(selection == 1)\n\t\t\tmazeUnion();\n\t\tif(selection == 2)\n\t\t\tunionPathCompression();\n\t\tif(selection == 3)\n\t\t\tmazeHeight();\n\t\tif(selection == 4)\n\t\t\tmazeSize();\n\t\tif(selection == 5)\n\t\t\tsizePathCompression();\n\t}", "public void run() {\n\t\ttry { \n\t\t\tBufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tBufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));\n\t\t\tPrintWriter out = new PrintWriter(socket.getOutputStream(), true);\n\t\t\t \n\t\t\tString fromServer= null;\n\t\t\tString fromUser = null;\n\n\t\t\twhile(true){\n\t\t\t\t//If the user types \"BACKUP\" will make a file of the messages\n\t\t\t\tif ((fromUser = in.readLine()).equals(\"BACKUP\")){\n\t\t\t\t\tbuffer.add(\"BACKUP\");\n\t\t\t\t\tfor(int i = 0; i < buffer.size(); i++){\n\t\t\t\t\t\tout.println(buffer.get(i));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//put whatever the user input to the Server Buffer\n\t\t\t\tbuffer.add(fromUser);\n\n\t\t\t\t//Displaying the option menu\n\t\t\t\tSystem.out.print(\"\\n1. Send Message to all clients\\n\" +\n\t\t\t\t\t\"2. Print message from client\\n\" +\n\t\t\t\t\t\"3. Quit\\n\\n\" + \n\t\t\t\t\t\"Please choice 1, 2, or 3\\n\" +\n\t\t\t\t\t\"Choice: \");\n\t\t\t\tfromServer = stdIn.readLine();\n\t\t\t\tif(fromServer.equals(\"1\")){ \n\t\t\t\t\tout.println(buffer.lastElement());\n\t\t\t\t}\n\t\t\t\telse if(fromServer.equals(\"2\")){\n\t\t\t\t\tSystem.out.println(buffer.lastElement());\n\t\t\t\t}\n\t\t\t\telse if(fromServer.equals(\"3\")){\n\t\t\t\t\tSystem.out.println(\"\\nLeaving the program. Good Bye!\\n\");\n\t\t\t\t\tSystem.exit(0);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tSystem.out.println(\"Options 1~3 Please\");\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tLogger.dump(0, \"Client Exited by force quitting\");\n\t\t\tSystem.exit(1);\n\t\t} catch (NullPointerException e) {\n\t\t\tLogger.dump(0, \"Client Exited\");\n\t\t} \n\t}", "public static void main(String[] args) throws IOException {\n\t\t\n\t\tint number,temp;\n\t\tString sendStr;\n //Scanner sc = new Scanner(System.in);\n ServerSocket s1 = new ServerSocket(1342);\n Socket ss = s1.accept();\n\t\t\n\t\t//Socket s = new Socket(\"127.0.0.1\",1342);\n Scanner sc = new Scanner(ss.getInputStream());\n System.out.println(\"Enter any number\");\n \n sc.next();\n //number = sc.nextInt();\n \n //temp = number*2;\n sendStr = \"got it\";\n \n PrintStream p = new PrintStream(ss.getOutputStream());\n //p.println(temp);\n p.println(sendStr);\n \n\t}", "public void optionsForSubscriber() throws RemoteException {\r\n Scanner in = new Scanner(System.in);\r\n boolean breakLoop = false;\r\n\r\n do {\r\n System.out.println(\"What would you like to do as a Subscriber:\");\r\n System.out.println(\" 1: Subscribe to a Topic.\");\r\n System.out.println(\" 2: Unsubscribe from a Topic.\");\r\n System.out.println(\" 3: Unsubscribe from all Topics.\");\r\n System.out.println(\" 4: Display subscribed topics.\");\r\n System.out.println(\" 5: View all available topics.\");\r\n System.out.println(\" 6: View all received events.\");\r\n System.out.println(\" 7: Save & Quit.\");\r\n System.out.print(\"Enter an Option: \");\r\n\r\n int choice = in.nextInt();\r\n Topic topic = null;\r\n\r\n\r\n switch (choice) {\r\n case 1: {\r\n topic = findTopic();\r\n if (topic != null) {\r\n subscribe(topic);\r\n }\r\n break;\r\n }\r\n case 2: {\r\n topic = findTopic();\r\n if (topic != null) {\r\n unsubscribe(topic);\r\n }\r\n break;\r\n }\r\n case 3: {\r\n unsubscribe();\r\n break;\r\n }\r\n case 4: {\r\n listSubscribedTopics();\r\n break;\r\n }\r\n case 5: {\r\n try {\r\n ArrayList<Topic> allTopics = server.getTopics();\r\n for (Topic t : allTopics)\r\n System.out.print(t);\r\n } catch (RemoteException e) {\r\n System.out.println(\"Couldn't Connect to Server. Try again\");\r\n }\r\n break;\r\n }\r\n case 6: {\r\n listReceivedEvents();\r\n break;\r\n }\r\n case 7: {\r\n breakLoop = true;\r\n in.close();\r\n saveState();\r\n break;\r\n }\r\n default:\r\n System.out.println(\"Please enter a valid option.\");\r\n }\r\n } while (!breakLoop);\r\n }", "public void setNumOfConnections(int num) {\r\n\t\tnumOfConnections = num;\r\n\t}", "public static void echo_server_single( int portno ) \nthrows IOException\n {\n ServerSocket acc = new ServerSocket( portno );\n print_my_host_port( portno );\n while( true )\n {\n stdout.printf(\"accepting incoming connections (hash== %s) ...\\n\", \n acc.hashCode());\n Socket com = acc.accept();\n tcp_peeraddr_print( com );\n EchoServerWorker esw = new EchoServerWorker(com);\n esw.run();\n } // while\n}", "public static void main (String[] args){\n\n Scanner stdin = new Scanner(System.in);\n int[] userSelect = new int[3];\n int portStart, portEnd;\n boolean validChoice = false;\n char choice;\n CustomScan cs = new CustomScan();\n\n do {\n System.out.println(\"Enter the IP address you would like to scan: \");\n } while (!cs.setIP(stdin.nextLine()));\n\n\n while (!validChoice) {\n System.out.println(\"Select option:\");\n System.out.println(\" 1 - Enter a range of ports to scan (i.e. 23-35)\");\n System.out.println(\" 2 - Enter a list of ports to scan (i.e. 22, 23, 34, 16)\");\n userSelect[1] = stdin.nextInt();\n\n if (userSelect[1] == 1) {\n validChoice = true;\n do {\n System.out.println(\"Enter lowest port value: \");\n portStart = stdin.nextInt();\n System.out.println(\"Enter highest port value: \");\n portEnd = stdin.nextInt();\n\n if (portStart > portEnd) {\n System.out.println(\"Invalid port range given.\");\n System.out.println(\"Please enter lowest port first.\");\n validChoice = false;\n }\n else if (portStart < 0 || portEnd > 65535) {\n System.out.println(\"Invalid port range given.\");\n System.out.println(\"Valid ports are 0 to 65535.\");\n validChoice = false;\n }\n } while (!cs.setStartPort(portStart) || !cs.setEndPort(portEnd));\n\n// System.out.println(\"Start Port: \" + cs.getStartPort());\n// System.out.println(\"End Port: \" + cs.getEndPort());\n if(validChoice) {\n cs.buildStack(true);\n }\n\n } else if (userSelect[1] == 2) {\n validChoice = true;\n cs.buildStack(false);\n\n } else {\n System.out.println(\"Invalid option, please try again\");\n validChoice = false;\n }\n\n if(validChoice) {\n try {\n System.out.println(\" Done entering ports? (Y/N)\");\n choice = stdin.next().charAt(0);\n if (choice == 'y' || choice == 'Y') {\n validChoice = true;\n } else if (choice == 'n' || choice == 'N') {\n validChoice = false;\n }\n } catch (Exception ex) {\n System.out.println(\"Invalid choice\");\n validChoice = false;\n }\n }\n }\n cs.printPorts();\n cs.getOpenPorts();\n cs.printOpenPorts(false);\n\n }", "public void run() throws InterruptedException {\n int goAgain = 1;\n do {\n try {\n s.getConnection();\n System.out.println(\"WELCOME TO THE 0-MILE CLIENT DATABASE\");\n System.out.println(\"What would you like to do?\");\n System.out.println(\"1- View general client information.\");\n System.out.println(\"2- View retail prices information.\");\n System.out.println(\"3- View relevant employees information.\");\n System.out.println(\"4- Finding an agent to help you with dealing with clients.\");\n System.out.println(\"5- Update Profile Information\");\n System.out.println(\"6- Logout from your account.\");\n System.out.println(\"Please select between options 1-6 by entering the number corresponding to the option.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"Not a valid input\");\n System.out.println(\"1- View general client information.\");\n System.out.println(\"2- View retail prices information.\");\n System.out.println(\"3- View relevant employees information.\");\n System.out.println(\"4- Finding an agent to help you with dealing with clients.\");\n System.out.println(\"5- Update Profile Information\");\n System.out.println(\"6- Logout from your account.\");\n System.out.println(\"Please select between options 1-6 by entering the number corresponding to the option.\");\n scanInt.next();\n }\n int option = scanInt.nextInt();\n if (option == 1) {\n System.out.println(\"WELCOME TO THE CLIENT INFORMATION, HERE ARE ALL YOUR OPTIONS:\");\n //options to choose from\n System.out.println(\"1- View information on clients within the database.\");\n System.out.println(\"2- Add a client to the database.\");\n System.out.println(\"3- Remove a client from the database.\");\n System.out.println(\"4- Update a client within the database.\");\n System.out.println(\"5- Return to main menu.\");\n\n while (!scanInt.hasNextInt()) {\n System.out.println(\"Not a valid input\");\n System.out.println(\"1- View information on clients within the database.\");\n System.out.println(\"2- Add a client to the database.\");\n System.out.println(\"3- Remove a client from the database.\");\n System.out.println(\"4- Update a client within the database.\");\n System.out.println(\"5- Return to main menu.\");\n scanInt.next();\n }\n\n int clientInfoChoice = scanInt.nextInt();\n if (clientInfoChoice == 1) {\n s.SelectClient();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (clientInfoChoice == 2) {\n i.insertClientInfo();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (clientInfoChoice == 3) {\n d.deleteClientInfo();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (clientInfoChoice == 4) {\n\n u.updateClientInfo();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (clientInfoChoice == 5) {\n run();\n } else {\n System.out.println(\"Not a valid choice. You are being re directed to the main menu.\");\n run();\n }\n }else if(option ==2 ){\n System.out.println(\"WELCOME TO THE RETAIL PRICES INFORMATION, HERE ARE ALL YOUR OPTIONS:\");\n System.out.println(\"1- View the retail prices for all clients within the database.\");\n System.out.println(\"2- Add a client's retail prices to the database.\");\n System.out.println(\"3- Remove all retail prices for a specific client within the database.\");\n System.out.println(\"4- Update a client's retail prices within the database.\");\n System.out.println(\"5- View the total average retail price for every client in the database (useful tool to distinguish the more expensive clients from the rest).\");\n System.out.println(\"6- View clients that have between a minimum and maximum average retail price for their clothing (useful tool to filter clients).\");\n System.out.println(\"7- View all clients with retail prices in their stores that are above the average for all clients.\");\n System.out.println(\"8- View all clients with retail prices in their stores that are below the average for all clients.\");\n System.out.println(\"9- Return to main menu.\");\n\n while (!scanInt.hasNextInt()) {\n System.out.println(\"Not a valid input\");\n System.out.println(\"1- View the retail prices for any client within the database.\");\n System.out.println(\"2- Add a client's prices to the database.\");\n System.out.println(\"3- Remove all retail prices for a specific client within the database.\");\n System.out.println(\"4- Update a client's retail prices within the database.\");\n System.out.println(\"5- View the total average retail price for every client in the database (useful to distinguish the more/least expensive clients from the rest).\");\n System.out.println(\"6- View clients that have between a minimum and maximum average retail price for their clothing (useful tool to filter clients).\");\n System.out.println(\"7- View all clients with retail prices in their stores that are above the average for all clients.\");\n System.out.println(\"8- View all clients with retail prices in their stores that are below the average for all clients.\");\n System.out.println(\"9- Return to main menu.\");\n scanInt.next();\n }\n int retailChoice = scanInt.nextInt();\n if (retailChoice == 1){\n s.retailPricePerClient();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 2){\n i.insertRetailInfo();\n d.deleteAvgPriceInfo();\n i.addToAverageTable();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 3){\n d.deleteRetailInfo();\n d.deleteAvgPriceInfo();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 4){\n u.updateRetailInfo();\n d.deleteAvgPriceInfo();\n i.addToAverageTable();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 5) {\n s.averageRetailPriceByClient();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 6) {\n s.betweenAveragePrice();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 7) {\n s.aboveAvgRetailPrice();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 8) {\n s.belowAvgRetailPrice();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (retailChoice == 9) {\n run();\n } else {\n System.out.println(\"Not a valid choice. You are being re-directed to the main menu.\");\n run();\n }\n } else if (option == 3) {\n System.out.println(\"WELCOME TO THE RELEVANT EMPLOYEES INFORMATION, HERE ARE ALL YOUR OPTIONS:\");\n System.out.println(\"1- View all relevant employees available.\");\n System.out.println(\"2- Add a relevant employee to the database.\");\n System.out.println(\"3- Filter relevant employees by client name.\");\n System.out.println(\"4- Remove a relevant employee.\");\n System.out.println(\"5- Return to main menu.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"Not a valid input\");\n System.out.println(\"1- View all relevant employees available.\");\n System.out.println(\"2- Add a relevant employee to the database.\");\n System.out.println(\"3- Filter relevant employees by client name.\");\n System.out.println(\"4- Remove a relevant employee.\");\n System.out.println(\"5- Return to main menu.\");\n scanInt.next();\n }\n int employeeChoice = scanInt.nextInt();\n if (employeeChoice == 1) {\n s.viewRelevantEmployees();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n } else if (employeeChoice == 2) {\n i.addRelevantEmployee();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n } else if (employeeChoice == 3) {\n s.filterRelevantEmployeesByCompany();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }else if (employeeChoice == 4) {\n d.deleteRelevantEmployee();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n }\n else if (employeeChoice == 5) {\n run();}\n\n else {\n System.out.println(\"Not a valid choice. You are being re-directed to the main menu.\");\n run();\n }\n\n } else if (option == 4) {\n //agent table\n System.out.println(\"WELCOME TO THE AGENT INFORMATION, HERE ARE ALL YOUR OPTIONS:\");\n System.out.println(\"1- View all agents available.\");\n System.out.println(\"2- Add an agent to the database.\");\n System.out.println(\"3- Find the location of clients along with the corresponding agent to facilitate business. \");\n System.out.println(\"4- Delete an agent from the database.\");\n System.out.println(\"5- Find agents bases on a client's location.\");\n System.out.println(\"6- Return to main menu.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"Not a valid input\");\n System.out.println(\"1- View all agents available.\");\n System.out.println(\"2- Add an agent to the database.\");\n System.out.println(\"3- Find the location of clients along with the corresponding agent to facilitate business. \");\n System.out.println(\"4- Delete an agent from the database.\");\n System.out.println(\"5- Find agents bases on a client's location.\");\n System.out.println(\"6- Return to main menu.\");\n scanInt.next();\n }\n int agentChoice = scanInt.nextInt();\n if (agentChoice == 1) {\n s.viewAgents();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (agentChoice == 2) {\n i.addAgent();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (agentChoice == 3) {\n s.AgentsPerClient();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (agentChoice == 4) {\n d.deleteAgent();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n\n } else if (agentChoice == 5) {\n s.viewAgentsByJurisdiction();\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n while (!scanInt.hasNextInt()) {\n System.out.println(\"That's not a number!\");\n System.out.println(\"Back to the main menu?\");\n System.out.println(\"1-Yes, 2-No.\");\n scanInt.next();\n }\n goAgain = scanInt.nextInt();\n if (goAgain != 1) {\n start();\n }\n } else if (agentChoice == 6) {\n run();\n }\n }\n else if (option == 5){\n u.updateProfile();\n } else if (option == 6) {\n System.out.println(\"You have been successfully logged out.\");\n start();\n\n } else {\n System.out.println(\"Not a valid choice. You will now be re-directed to the main menu.\");\n run();\n\n }\n } catch (SQLException e) {\n e.printStackTrace();\n\n }\n }\n while (goAgain == 1);\n }", "private static void selectCordinator() throws NumberFormatException, UnknownHostException, IOException {\n\t\t// TODO Auto-generated method stub\n\t\tRandom randomGen = new Random();\n\t\tSystem.out.println(\"Size: \"+allReplicaAddrs.size());\n\t\tint index = randomGen.nextInt(allReplicaAddrs.size());\n\t\tString arrayItem = allReplicaAddrs.get(index);\n\t\tString[] ipPort = arrayItem.split(\" \");\n\t\tcoordIp = ipPort[0];\n\t\tcoordPort = Integer.parseInt(ipPort[1]);\n\t\t//socket = new Socket(coordIp,coordPort);\n\t}", "public void acceptedSocket(long socketId) {}", "public static void main(String[] args) {\n\t\tint choice = Integer.parseInt(JOptionPane.showInputDialog(\"Type 1 for server | Type 2 for client\"));\r\n\t\t\r\n\t\tif (choice == 1) {\t// assign to server\r\n\t\t\tnew GameServer() ;\r\n\t\t} else if (choice == 2) {\t// assign to client\r\n\t\t\tnew GameClient() ;\r\n\t\t} else {\r\n\t\t\t// show the message when user enter wrong number\r\n\t\t\tJOptionPane.showMessageDialog(null, \"You entered the wrong number, please try again!\") ;\r\n\t\t}\r\n\t\t\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\t\n\t\tint servInp, servOup;\n\t\tServerSocket ssk = new ServerSocket(8080);\n\t\tSocket sk = ssk.accept();\n\t\tScanner ser = new Scanner(sk.getInputStream());\n\t\tservInp = ser.nextInt();\n\t\tservInp *= servInp;\n\t\t\n\t\tPrintStream pss = new PrintStream(sk.getOutputStream());\n\t\tpss.println(servInp);\t\t\n\t\t\n\t}", "public boolean setupSocket() throws ExitProgram {\n\t\tboolean success = false;\n\t\t\n\t\tthis.showNamedMessage(\"Trying to open a new socket...\");\n\t\twhile (this.socket == null) { \n\t\t\ttry {\n\t\t\t\tthis.socket = TransportLayer.openNewDatagramSocket(this.ownPort);\n\t\t\t\tthis.showNamedMessage(\"Client now bound to port \" + ownPort);\n\t\t\t\tsuccess = true;\n\t\t\t} catch (SocketException e) {\n\t\t\t\tthis.showNamedError(\"Something went wrong when opening the socket: \"\n\t\t\t\t\t\t+ e.getLocalizedMessage());\n\t\t\t\tif (!textUI.getBoolean(\"Do you want to try again?\")) {\n\t\t\t\t\tthrow new exceptions.ExitProgram(\"User indicated to exit the \"\n\t\t\t\t\t\t\t+ \"program after socket opening failure.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn success;\n\t}", "public void launch(int port, String root, String address)\n throws IOException\n {\n this.root = root;\n ServerSocketChannel ssc = ServerSocketChannel.open();\n ssc.socket().bind(new InetSocketAddress(address, port));\n ssc.configureBlocking(false);\n ssc.register(selector, SelectionKey.OP_ACCEPT);\n\n final Thread mainThread = Thread.currentThread();\n new Thread(new Runnable() {\n\n @Override\n public void run()\n {\n Scanner scanner = new Scanner(System.in);\n\n try {\n while (scanner.hasNextLine()) {\n String cmd = scanner.nextLine();\n if (cmd.equals(\"stats\")) {\n Statistics.getInstance().save();\n System.out.println(Statistics.getInstance()\n .toString());\n }\n if (cmd.equals(\"exit\")) {\n break;\n }\n }\n } finally {\n scanner.close();\n mainThread.interrupt();\n }\n }\n }).start();\n\n try {\n while (!Thread.currentThread().isInterrupted()) {\n selector.select();\n Set<SelectionKey> readyKeys = selector.selectedKeys();\n\n for (SelectionKey key : readyKeys) {\n try {\n if (key.isValid() && key.isAcceptable()) {\n treatAccept(key);\n }\n if (key.isValid() && key.isWritable()) {\n treatWrite(key);\n }\n if (key.isValid() && key.isReadable()) {\n treatRead(key);\n }\n } catch (IOException e) {\n e.printStackTrace(System.err);\n terminateKey(key);\n }\n }\n\n readyKeys.clear();\n }\n } finally {\n ssc.close();\n selector.close();\n }\n }", "public static void main(String[] args) throws IOException { /* THIS IS THE MAIN FUNCTION TO START THE SERVER OR REPORTS IF THERE IS ANY ISSUE*/\n\ntry {\n serverSocket = new ServerSocket(4457);\n System.out.println(\"Server started.\");\n ServerDemo.display(\"server started\");\n} catch (Exception e) {\n System.err.println(\"Port already in use.\");\n System.exit(1);\n}\n\nwhile (true) { /* accepting the socket connection*/\n try {\n clientSocket = serverSocket.accept();\n System.out.println(\"Accepted connection : \" + clientSocket);\n ServerDemo.display(\"Accepted connection : \" + clientSocket);\n\n int i = 0;\n for (i = 0; i < maxClientsCount; i++) {\n if (threads[i] == null) {\n (threads[i] = new CLIENTConnection(clientSocket, threads)).start();\n break;\n }\n }\n if (i == maxClientsCount) {\n PrintStream os = new PrintStream(clientSocket.getOutputStream());\n os.println(\"Server too busy. Try later.\");\n os.close();\n clientSocket.close();\n }\n\n } catch (Exception e) {\n System.err.println(\"Error in connection attempt.\");\n }\n }\n }", "public static int inputOptions() {\n\t\tSystem.out.println(PROMPT);\n\t\tint responseNum = -1;\n\t\tin = new Scanner(System.in);\n\t\t// Ensure that response is 0 or 1\n\t\twhile (in.hasNext()) {\n\t\t\tString rawResponse = in.nextLine();\n\t\t\tString response = rawResponse.trim();\n\t\t\tresponseNum = Integer.parseInt(response);\n\t\t\tif (responseNum == 0 || responseNum == 1) {\n\t\t\t\treturn responseNum;\n\t\t\t} else {\n\t\t\t\tSystem.out.println(INVALID_ENTRY_MSG);\n\t\t\t}\n\t\t}\n\t\treturn responseNum;\n\t}", "public static void main(String[] args) throws IOException\n {\n Scanner sc=new Scanner(System.in);\n System.out.print(\"Enter Port No:\");\n int port=sc.nextInt();\n ServerSocket server_sokt=new ServerSocket(port); //Server Created \n System.out.println(\"Server Hosted at Port \"+port);\n\n while(true)\n {\n Socket socket_object=null; // Initialize Listening Socket\n try \n {\n socket_object=server_sokt.accept(); //Accept Connection Request from Client\n cnt+=1; \n DataInputStream inpt=new DataInputStream(socket_object.getInputStream());\n // String name=\"Client\"+cnt; // I can also put names like client1,client2 ......\n String name=inpt.readUTF(); // Read Name of Client \n System.out.println(\"Client \"+name+\" Connected\"); \n Thread new_client_thread=new ClientHandle(socket_object,inpt,name); // Creating a thread for a client\n new_client_thread.start(); //starting thread\n } \n catch (Exception e)\n {\n socket_object.close();\n e.printStackTrace();\n break;\n }\n }\n server_sokt.close();\n sc.close();\n }", "public static int choosePort() {\n try (ServerSocket s = new ServerSocket(0)) {\n return s.getLocalPort();\n } catch (IOException ex) {\n throw new DeltaException(\"Failed to find a port\");\n }\n }", "public void console() throws RemoteException {\r\n Scanner in = new Scanner(System.in);\r\n do {\r\n System.out.println(\"Select one of the following options:\");\r\n System.out.println(\" 1: Be a publisher\");\r\n System.out.println(\" 2: Be a subscriber\");\r\n System.out.println(\" 3: Save & quit\");\r\n System.out.print(\"Enter a number:\");\r\n int choice = 0;\r\n try {\r\n choice = in.nextInt();\r\n } catch (Exception e) {\r\n System.err.println(\"Provide a Valid Option... \");\r\n }\r\n switch (choice) {\r\n case 1: {\r\n optionsForPublisher();\r\n break;\r\n }\r\n case 2: {\r\n optionsForSubscriber();\r\n break;\r\n }\r\n case 3: {\r\n in.close();\r\n saveState();\r\n break;\r\n }\r\n default: System.out.println(\"Input not recognized, Please enter a valid option...\");\r\n }\r\n } while (true);\r\n }", "private void initialize() {\n\t\tframe = new JFrame();\n\t\tframe.setBounds(100, 100, 450, 300);\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n\t\tframe.getContentPane().setLayout(null);\n\t\t\n\t\tportTextField = new JTextField();\n\t\tportTextField.setBounds(10, 33, 86, 20);\n\t\tframe.getContentPane().add(portTextField);\n\t\tportTextField.setColumns(10);\n\t\t\n\t\tJLabel lblNumerPortu = new JLabel(\"Numer portu:\");\n\t\tlblNumerPortu.setBounds(10, 11, 86, 14);\n\t\tframe.getContentPane().add(lblNumerPortu);\n\t\t\n\t\tmaxClientsTextField = new JTextField();\n\t\tmaxClientsTextField.setBounds(10, 85, 86, 20);\n\t\tframe.getContentPane().add(maxClientsTextField);\n\t\tmaxClientsTextField.setColumns(10);\n\t\t\n\t\tJLabel lblMaksLiczbaClientow = new JLabel(\"Maks. liczba klientow:\");\n\t\tlblMaksLiczbaClientow.setBounds(10, 60, 127, 14);\n\t\tframe.getContentPane().add(lblMaksLiczbaClientow);\n\t\t\n\t\tconnectionsList = new JList<String> (new DefaultListModel<String>());\n\t\tconnectionsList.setBounds(213, 35, 157, 111);\n\t\tframe.getContentPane().add(connectionsList);\n\t\t\n\t\t\n\t\tJButton btnRozpocznijNasuchiwanie = new JButton(\"Rozpocznij nasluchiwanie\");\n\t\tbtnRozpocznijNasuchiwanie.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tint port_number = 1234;\n\t\t\t\tint max_clients = 108 ;\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\t// if correct args, sets port number, max clients.\n\t\t\t\t\tif(!maxClientsTextField.getText().equals(\"\")) max_clients = Integer.parseInt(maxClientsTextField.getText());\n\t\t\t\t\tif (!portTextField.getText().equals(\"\") ) port_number = Integer.parseInt(portTextField.getText());\n\t\t\t\t\t// New server socket\n\t\t\t\t\tsock = new ServerSocket(port_number);\n\t\t\t\t\tsock.setReceiveBufferSize(max_clients);\n\t\t\t\t\tmainThread = new WaitForClientsThread(sock, connectionsList);\n\t\t\t\t\tmainThread.start();\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch(IndexOutOfBoundsException exc)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"Enter correct port number!\");\n\t\t\t\t}\n\t\t\t\tcatch (IOException e1) {\n\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\tSystem.out.println(\"Connection error.\");\n\t\t\t\t}\n\t\t\t\tcatch(NumberFormatException err)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"Wrong port number\");\n\t\t\t\t} \n\t\t\t\t\n\t\t\t}\n\t\t});\n\t\tbtnRozpocznijNasuchiwanie.setBounds(10, 203, 170, 20);\n\t\tframe.getContentPane().add(btnRozpocznijNasuchiwanie);\n\t\t\n\t\t\n\t\t\n\t\tJLabel lblCurrentlyConnected = new JLabel(\"Obecne polaczenia:\");\n\t\tlblCurrentlyConnected.setBounds(213, 11, 157, 14);\n\t\tframe.getContentPane().add(lblCurrentlyConnected);\n\t\t\n\t\tbtnZakonczNasluchiwanie = new JButton(\"Zakoncz nasluchiwanie\");\n\t\tbtnZakonczNasluchiwanie.addActionListener(new ActionListener() {\n\t\t\t\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tif(sock != null)\n\t\t\t\t{\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsock.close();\n\t\t\t\t\t\tmainThread.interrupt();\n\t\t\t\t\t} catch (IOException e1) {\n\t\t\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\t\t\te1.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t\tbtnZakonczNasluchiwanie.setBounds(10, 234, 170, 17);\n\t\tframe.getContentPane().add(btnZakonczNasluchiwanie);\n\t\t\n\t}", "private void optionsSelect() {\n switch (currentQueNum) {\n case 1:\n ans1Option();\n break;\n case 2:\n ans2Option();\n break;\n case 3:\n ans3Option();\n break;\n case 4:\n ans4Option();\n break;\n case 5:\n ans5Option();\n break;\n case 6:\n ans6Option();\n break;\n case 7:\n ans7Option();\n break;\n case 8:\n ans8Option();\n break;\n case 9:\n ans9Option();\n break;\n case 10:\n ans10Option();\n break;\n }\n }", "public static void main(String[] args) throws IOException {\n\n if (args.length != 1) // Test for correct argument list\n throw new IllegalArgumentException(\"Parameter(s): <Port>\");\n\n int servPort = Integer.parseInt(args[0]);\n\n // Create a selector to multiplex client connections.\n Selector selector = Selector.open();\n\n DatagramChannel channel = DatagramChannel.open();\n channel.configureBlocking(false);\n channel.socket().bind(new InetSocketAddress(servPort));\n channel.register(selector, SelectionKey.OP_READ, new ClientRecord());\n\n while (true) { // Run forever, receiving and echoing datagrams\n // Wait for task or until timeout expires\n if (selector.select(TIMEOUT) == 0) {\n System.out.print(\".\");\n continue;\n }\n\n // Get iterator on set of keys with I/O to process\n Iterator<SelectionKey> keyIter = selector.selectedKeys().iterator();\n while (keyIter.hasNext()) {\n SelectionKey key = keyIter.next(); // Key is bit mask\n\n // Client socket channel has pending data?\n if (key.isReadable())\n handleRead(key);\n\n // Client socket channel is available for writing and\n // key is valid (i.e., channel not closed).\n if (key.isValid() && key.isWritable())\n handleWrite(key);\n\n keyIter.remove();\n }\n }\n }", "public static void main(String args[]) {\n int portNumber = 2228;\r\n if (args.length < 1) {\r\n System.out.println(\"Usage: java MultiThreadChatServerSync <portNumber>\\n\"\r\n + \"Now using port number=\" + portNumber);\r\n } else {\r\n portNumber = Integer.valueOf(args[0]);\r\n }\r\n\r\n try {\r\n serverSocket = new ServerSocket(portNumber);\r\n } catch (IOException e) {\r\n System.out.println(e);\r\n }\r\n\r\n /*\r\n * Create a client socket for each connection and pass it to a new client\r\n * thread.\r\n */\r\n while (true) {\r\n try {\r\n clientSocket = serverSocket.accept();\r\n int i = 0;\r\n for (i = 0; i < maxClientsCount; i++) {\r\n if (threads[i] == null) {\r\n (threads[i] = new clientThread(clientSocket, threads, history, userList)).start();\r\n break;\r\n }\r\n }\r\n if (i == maxClientsCount) {\r\n PrintStream os = new PrintStream(clientSocket.getOutputStream());\r\n os.println(\"Server too busy. Try later.\");\r\n os.close();\r\n clientSocket.close();\r\n }\r\n } catch (IOException e) {\r\n System.out.println(e);\r\n }\r\n }\r\n }", "private void gestionSocket(){\n Socket sock = null;\n try{\n sock = new Socket(adresse, 18000);\n }\n catch(IOException ioe){\n System.out.println(\"Erreur lors de la connexion : \" + ioe.getMessage());\n }\n \n envoieInt(sock, 3);\n }", "private Selector initSelector() throws IOException {\n Selector socketSelector = SelectorProvider.provider().openSelector();\n\n // Create a new non-blocking server socket channel\n this.serverChannel = ServerSocketChannel.open();\n serverChannel.configureBlocking(false);\n\n // Bind the server socket to the specified address and port\n InetSocketAddress isa = new InetSocketAddress(this.myAddress, this.myPort);\n serverChannel.socket().bind(isa);\n\n // Register the server socket channel, indicating an interest in\n // accepting new connections\n serverChannel.register(socketSelector, SelectionKey.OP_ACCEPT);\n\n return socketSelector;\n }", "void resetPeakServerSocketCount();", "public static void main(String[] args) throws IOException \n {\t \n\tScanner scannerIn = new Scanner(System.in);\n\tSystem.out.print(\"Please enter port number for the Chat Server to run on : \");\n\tint port = scannerIn.nextInt();\n\t//starts new ChatServer\n\tChatServer cs = new ChatServer(port);\n }", "private void runMenu() {\n\t\tint selection;\n\t\tdo {\n\t\t\tdisplayMenu();\n\t\t\tselection = Integer.parseInt(sc.nextLine());\n\t\t\tprocessSelection(selection);\n\t\t} while (selection != 5);\n\t}", "public void run()\r\n {\r\n Scanner sc = new Scanner(System.in);\r\n while(socket.isConnected())\r\n {\r\n String comm = sc.nextLine();\r\n\r\n }\r\n }", "public void startSystem() \r\n {\r\n Scanner sc = new Scanner(System.in);\r\n while(true)\r\n {\r\n displayMenu();\r\n if(sc.hasNextInt())\r\n {\r\n int choice = sc.nextInt();//choice stores the value of input entered by the user. \r\n switch(choice)\r\n {\r\n case 1: pSlot.addSlot();\r\n break;\r\n case 2: pSlot.deleteSlot();\r\n break;\r\n case 3: pSlot.listSlots();\r\n break;\r\n case 4: pSlot.parkCar();\r\n break;\r\n case 5: pSlot.findCar();\r\n break;\r\n case 6: pSlot.removeCar();\r\n break;\r\n case 7: exitApplication();\r\n break; \r\n default: System.out.println(\"\\n Please choose the input from 1-7\");\r\n }\r\n }\r\n else\r\n {\r\n System.out.println(\"\\n Please choose the input from 1-7\");\r\n sc.next();\r\n }\r\n }\r\n \r\n }", "public static void main(String[] args) throws Exception {\n JFrame frame = new JFrame (\"Chatting Server\");\r\n frame.setLayout(null);\r\n frame.setBounds(100, 100, 300, 300);\r\n frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\r\n\r\n JLabel connectionStatusLabel = new JLabel(\"No Clients Connected\");\r\n connectionStatusLabel.setBounds(80, 30, 200, 30);\r\n connectionStatusLabel.setForeground(Color.red);\r\n frame.getContentPane().add(connectionStatusLabel);\r\n\r\n // create the welcoming server's socket\r\n ServerSocket welcomeSocket = new ServerSocket(6789);\r\n\r\n // thread to always listen for new connections from clients\r\n new Thread (new Runnable(){ @Override\r\n public void run() {\r\n\r\n Socket connectionSocket;\r\n DataOutputStream outToClient;\r\n\r\n while (!welcomeSocket.isClosed()) {\r\n\r\n try {\r\n // when a new client connect, accept this connection and assign it to a new connection socket\r\n connectionSocket = welcomeSocket.accept();\r\n\r\n // create a new output stream and send the message \"You are connected\" to the client\r\n outToClient = new DataOutputStream(connectionSocket.getOutputStream());\r\n outToClient.writeBytes(\"-Connected\\n\");\r\n\r\n clientCount++;\r\n\r\n // add the new client to the client's array\r\n Clients.add(new ClientThread(clientCount, connectionSocket, Clients));\r\n // start the new client's thread\r\n Clients.get(Clients.size() - 1).start();\r\n\r\n }\r\n catch (Exception ex) {\r\n\r\n }\r\n\r\n }\r\n\r\n }}).start();\r\n\r\n\r\n\r\n // thread to always get the count of connected clients and update the label\r\n new Thread (new Runnable(){ @Override\r\n public void run() {\r\n\r\n try {\r\n\r\n while (true) {\r\n\r\n if (Clients.size() > 0)\r\n {\r\n if (Clients.size() == 1)\r\n connectionStatusLabel.setText(\"1 Client Connected\");\r\n else\r\n connectionStatusLabel.setText(Clients.size() + \" Clients Connected\");\r\n\r\n connectionStatusLabel.setForeground(Color.blue);\r\n }\r\n else { //if there are no clients connected, print \"No Clients Connected\"\r\n\r\n connectionStatusLabel.setText(\"No Clients Connected\");\r\n connectionStatusLabel.setForeground(Color.red);\r\n\r\n }\r\n\r\n\r\n Thread.sleep(1000);\r\n\r\n }\r\n\r\n } catch (Exception ex) {\r\n\r\n }\r\n\r\n }}).start();\r\n\r\n\r\n\r\n frame.setVisible(true);\r\n\r\n }", "public static void main(String[] args) throws IOException, UnknownHostException, RemoteException, MalformedURLException, NotBoundException {\n System.out.println(\"Enter Group Server IP :\");\n BufferedReader r;\n r = new BufferedReader(new InputStreamReader(System.in));\n String group_server_ip = r.readLine();\n int group_server_registry_port = 5555;\n String group_server_name = \"AmarRaj\";\n new ClientUDPListenThread();\n Registry registry = LocateRegistry.getRegistry(group_server_ip, group_server_registry_port);\n Communicate communicate = (Communicate) registry.lookup(group_server_name);\n String myip = Utility.getIP();\n // Menu for CLIENT\n while(true) {\n System.out.println(\"\\n\\nJoin Group Server - 1\\nSubscribe - 2 \\nUnsubscribe - 3\\nPing - 4\\nPublish - 5\\nLeave - 6\\nEnter Your Choice : \");\n Scanner reader = new Scanner(System.in);\n switch (reader.nextInt()){ \n case 1:\n System.out.println(\"Joining Group..\");\n try {\n boolean succ = communicate.Join(myip, Utility.client_listen_port);\n if(succ == true) {\n System.out.println(\"Successfully Joined Group Server\");\n } else {\n System.out.println(\"Sorry, Client Limit already reached..\");\n }\n } catch (Exception e) {\n System.out.println(\"Join Error !!\");\n }\n break;\n case 2:\n try {\n System.out.println(\"Enter Article : \");\n BufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n String ar = in.readLine();\n boolean b = communicate.Subscribe(myip, Utility.client_listen_port, ar);\n if (b == true) {\n System.out.println(\"Successfully Subscribed\");\n } else {\n System.out.println(\"Unsuccessfull .. \");\n }\n } catch (Exception e) {\n System.out.println(\"Subscribe Error !!\");\n }\n break;\n case 3:\n try {\n System.out.println(\"Enter Article to unsubscribe : \");\n BufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n String ar = in.readLine();\n boolean b = communicate.Unsubscribe(myip, Utility.client_listen_port, ar);\n if (b == true) {\n System.out.println(\"Successfully Unsubscribed\");\n } else {\n System.out.println(\"Unsuccessfull.. \");\n }\n } catch (Exception e) {\n System.out.println(\"Unsubscribe Error !!\");\n }\n break;\n case 4:\n try {\n boolean b = communicate.Ping();\n if (b == true) {\n System.out.println(\"Group Server Alive !!\");\n } else {\n System.out.println(\"Group Server not responding..\");\n }\n } catch (Exception e) {\n System.out.println(\"Ping not responded by group server !!\");\n }\n break;\n case 5:\n try {\n System.out.println(\"Enter Article to Publish : \");\n BufferedReader in=new BufferedReader(new InputStreamReader(System.in));\n String ar = in.readLine();\n boolean b = communicate.Publish(ar, myip, Utility.client_listen_port);\n if (b == true) {\n System.out.println(\"Successfully Published\");\n } else {\n System.out.println(\"Unsuccessfull..\");\n }\n } catch (Exception e) {\n }\n break;\n case 6:\n System.out.println(\"Leaving Group..\");\n try {\n boolean succ = communicate.Leave(myip, Utility.client_listen_port);\n if(succ == true) {\n System.out.println(\"Successfully Left Group Server\");\n } else {\n System.out.println(\"Unsuccessfull\");\n }\n } catch (Exception e) {\n System.out.println(\"Leave Error !!\");\n }\n break;\n case 7:\n boolean b = communicate.Check();\n break;\n }\n } \n}", "public static void main(String args[]) {\n if (args.length == 1) {\n System.out.println(\"Attempting to start server on port: \" + args[0]);\n try {\n portNumber = Integer.parseInt(args[0]);\n }\n catch (Exception e) {\n throw new IllegalArgumentException(\"Port number invalid\");\n }\n }\n else if (args.length == 0) {\n System.out.println(\"Attempting to start server on default port: \" + portNumber);\n }\n else {\n throw new IllegalArgumentException(\"Too many arguments. \"\n + \"Should be in form: java Server <port-no>\");\n }\n\n try {\n serverSocket = new ServerSocket(portNumber);\n\n System.out.println(\"Server started\");\n\n while (true) {\n clientSocket = serverSocket.accept(); // listen for clients\n\n System.out.println(\"Client accepted \" + clientSocket.getInetAddress()\n + \":\" + clientSocket.getPort());\n\n // run ServerThread for newly connected client in a new thread and start thread\n int i = 0;\n Login.loadUsers();\n for (i = 0; i < maxClients; i++) {\n if (clients[i] == null) {\n (clients[i] = new ServerThread(clientSocket, clients)).start();\n break;\n }\n }\n\n // if client pool is full, close socket\n if (i == maxClients) {\n PrintStream os = new PrintStream(clientSocket.getOutputStream());\n os.println(\"Server too busy. Please try later.\");\n os.close();\n clientSocket.close();\n }\n }\n }\n catch (IOException i) {\n System.err.println(i);\n }\n finally {\n close();\n }\n }", "private synchronized static void decrementNumberOfOpenSockets() {\r\n\r\n\t\tnumberOfOpenSockets--;\r\n\t}", "public static void main(String[] args) throws IOException {\n\t\tServerSocket ss= new ServerSocket(5000); \r\n\t\tSocket s = null; \r\n\t\twhile(true) {\r\n\t\t\ts = ss.accept();\r\n\t\t\t\r\n\t\t\tDataOutputStream out = new DataOutputStream(s.getOutputStream());\r\n\t\t\tDataInputStream in = new DataInputStream(s.getInputStream());\r\n\t\t\t\r\n\t\t\tserverHelper c = new serverHelper(s,\"client\"+clientCount,in,out);\r\n\t\t\t\r\n\t\t\tThread t = new Thread(c);\r\n\t\t\t//System.out.println(\"client\"+clientCount+\"is online\");\r\n\t\t\tclients.add(c);\r\n\t\t\tt.start();\r\n\t\t\tclientCount++;\r\n\t\t}\r\n\t}", "@Override\n public void init() {\n //add the JLabel into the applet\n add(labelShowNumberOfUsers);\n\n //try and catch IOException for creating sockets and streams\n try {\n //connect to host on port 8000\n socket = new Socket(host, 8000); //socket for creating a connection\n\n //initialise the DataInputStream\n fromServer = new DataInputStream(socket.getInputStream());\n\n //thread to get numberOfUsers\n Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n //try and catch IOException du to streams\n while (true) {\n try {\n numberOfUsers = fromServer.readInt(); //readInt will pause/block code underneath till read\n //write the number of users onto the JLabel\n labelShowNumberOfUsers.setText(\"\\tNumber of users who are currently on server: \" + numberOfUsers);\n } catch (IOException ex) {\n System.err.println(ex);\n }\n }\n }\n });\n //start the thread\n thread.start();\n \n } catch (IOException ex) {\n System.err.println(ex);\n }\n }", "private void countConnectingSocket() {\n \t\tcurrentlyConnectingSockets.incrementAndGet();\n \t}", "public void NumberOfPlayers()\r\n {\r\n Input=JOptionPane.showInputDialog(\"Type the number of players\", JOptionPane.YES_NO_OPTION);\r\n \r\n SecondInput = JOptionPane.showInputDialog(\"How many of those \"+ Input +\" players will be AI ?\", JOptionPane.YES_NO_OPTION);\r\n \r\n while(Converter(SecondInput) >= Converter(Input))\r\n {\r\n if(Converter(SecondInput) >= Converter(Input))\r\n {\r\n JOptionPane.showMessageDialog(this,\"AI players can't be equal or more than the original number of players!\",\r\n \"ERROR\",\r\n JOptionPane.ERROR_MESSAGE);\r\n\r\n SecondInput = JOptionPane.showInputDialog(\"How many of those \"+ Input +\" players will be AI ?\", JOptionPane.YES_NO_OPTION);\r\n }\r\n \r\n }\r\n \r\n if(Input!=null)\r\n {\r\n int j = Converter(Input); \r\n \r\n Start();\r\n }\r\n \r\n }", "private static void setupConnection() {\r\n\t\t\r\n\t\t// Variable used to keep track of if a connection is sucessful\r\n\t\tboolean connectionSuccess;\r\n\t\t\r\n\t\t// Loop until a sucessful connection is made\r\n\t\tdo {\r\n\t\t\tconnectionSuccess = true;\r\n\t\t\t\r\n\t\t\t// Get server info from user\r\n\t\t\tString serverInfo = JOptionPane.showInputDialog(null, \"Please input the server IP and port\"\r\n\t\t\t\t\t+ \" in the form \\\"IP:Port\\\"\", \"Server Connection Details\", JOptionPane.PLAIN_MESSAGE);\r\n\t\t\t\r\n\t\t\t// If the X button or cancel is clicked exit the program\r\n\t\t\tif(serverInfo == null) {\r\n\t\t\t\tSystem.exit(-1);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tString[] serverInfoArray = serverInfo.split(\":\", 2);\r\n\t\t\tint port = 0;\r\n\t\t\t\r\n\t\t\t// Check that both the port and IP have been inputted\r\n\t\t\tif(serverInfoArray.length > 1) {\r\n\t\t\t\t\r\n\t\t\t\t// Check that the port inputted is valid\r\n\t\t\t\ttry{\r\n\t\t\t\t\tport = Integer.parseInt(serverInfoArray[1]);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(port > 65536 || port < 0) {\r\n\t\t\t\t\t\tshowMSG(PORT_ERROR_MSG);\r\n\t\t\t\t\t\tconnectionSuccess = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t} catch(NumberFormatException e) {\r\n\t\t\t\t\tshowMSG(PORT_ERROR_MSG);\r\n\t\t\t\t\tconnectionSuccess = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telse {\r\n\t\t\t\tshowMSG(\"Please input a port number and IP address\");\r\n\t\t\t\tconnectionSuccess = false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// After port validation try to connect to the server\r\n\t\t\tif(connectionSuccess == true) {\r\n\t\t\t\t\r\n\t\t\t\ttry {\r\n\t\t\t\t\tsock = new Socket(serverInfoArray[0], port);\r\n\t\t\t\t\t\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tshowMSG(CONNECTION_ERROR_MSG);\r\n\t\t\t\t\tconnectionSuccess = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Loop until a successful connection to the server is made\r\n\t\t} while(connectionSuccess == false);\r\n\t\t\r\n\t\t\r\n\t\t// Setup buffered reader to read from the server\r\n\t\ttry {\r\n\t\t\tserverReader = new BufferedReader(new InputStreamReader(sock.getInputStream()));\r\n\t\t\t\r\n\t\t} catch (IOException e) {\r\n\t\t\tshowMSG(CONNECTION_ERROR_MSG);\r\n\t\t\tSystem.exit(-1);\r\n\t\t}\r\n\t}", "public int createSocket()\n\t{\n\t\t\n\t}", "private static MenuOption getRequest() \n\t{\n\t\tint request = 5;\n\t\tSystem.out.printf(\n\t\t\t\t\"%n--[ Manage My Contacts ]--%n%n%s%n%s%n%s%n%s%n%s%n\",\n\t\t\t\t\"1. Add new contact\", \"2. Delete a contact\",\n\t\t\t\t\"3. View a contact\", \"4. Display all contacts\",\n\t\t\t\t\"5. Exit program\");\n\t\ttry \n\t\t{\n\t\t\tScanner input = new Scanner(System.in);\n\t\t\tdo \n\t\t\t{\n\t\t\t\tSystem.out.printf(\"%nSelection: \");\n\t\t\t\trequest = input.nextInt();\n\t\t\t} while ((request < 1) || (request > 5));\n\t\t} catch (NoSuchElementException e) \n\t\t{\n\t\t\tSystem.err.println(\"Invalid input. Closing\");\n\t\t}\n\t\treturn choices[request - 1];\n\t}", "public static void main(String[] args) {\n\t\tint[][] ports = {{2001, 0, 2002, 2003, 0},\r\n\t\t\t\t\t\t {2002, 2001, 2004, 2005, 2010},\r\n\t\t\t\t\t\t {2003, 2001, 2006, 2017, 2018},\r\n\t\t\t\t\t\t {2004, 2002, 2011, 2012, 0},\r\n\t\t\t\t\t\t {2005, 2002, 2013, 2014, 0},\r\n\t\t\t\t\t\t {2006, 2003, 2015, 2016, 0},\r\n\t\t\t\t\t\t {2010, 2002, 0, 0, 0},\r\n\t\t\t\t\t\t {2011, 2004, 0, 0, 0},\r\n\t\t\t\t\t\t {2012, 2004, 0, 0, 0},\r\n\t\t\t\t\t\t {2013, 2005, 0, 0, 0},\r\n\t\t\t\t\t\t {2014, 2005, 0, 0, 0},\r\n\t\t\t\t\t\t {2015, 2006, 0, 0, 0},\r\n\t\t\t\t\t\t {2016, 2006, 0, 0, 0},\r\n\t\t\t\t\t\t {2017, 2003, 0, 0, 0},\r\n\t\t\t\t\t\t {2018, 2003, 0, 0, 0}};\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tint portForBrokers = 2001;\t//Keep track of current next available port number for Broker\r\n\t\tint portForClients = 2010;\t//Keep track of current next available port number for Client\r\n\t\tfinal int portOfSuperBroker = 2000; //The port number for the Super Broker\r\n\t\tint currentPortForBroker=portForBrokers;\r\n\t\tint currentPortForClient=portForClients;\r\n\t\tString inputLine;\r\n\t\t\r\n\t\ttry (ServerSocket serverSocket = new ServerSocket(portOfSuperBroker)){ //initialize the ServerSocket\r\n\t\t\twhile (true){\r\n\t\t\t\t//Create a new connection with either a Broker or a Client\r\n\t\t\t\tSocket clientSocket = serverSocket.accept();\r\n\t\t\t\t\r\n\t\t\t\tPrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);\r\n\t BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));\r\n\t\t\t\t\r\n\t inputLine = in.readLine();\r\n\t \r\n\t int childIndex = 2;\t// The childIndex starts from 2 according to the structure table\r\n\t while (!inputLine.equals(\"I'm done.\")){\r\n\t \tif (inputLine.equals(\"I'm a Broker. What is my port?\")){\r\n\t \t\t//Check if the port number for Broker beyond its range\r\n\t \t\tif (portForBrokers > 2006){\r\n\t\t\t\t\t\t\tSystem.err.println(\"SuperBroker: There's no more port availble for Broker!\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t \t\tout.println(portForBrokers);\r\n\t\t\t\t\t\tcurrentPortForBroker=portForBrokers;\r\n\t \t\tportForBrokers++;\r\n\t\t\t\t\t\tchildIndex=2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (inputLine.equals(\"I'm a Broker. What is my parent's port?\")){\r\n\t\t\t\t\t\t//To find the corresponding entry in the structure table\r\n\t\t\t\t\t\tfor (int i=0; i<15; i++){\r\n\t\t\t\t\t\t\tif (ports[i][0] == (currentPortForBroker)){\r\n\t\t\t\t\t\t\t\tout.println(ports[i][1]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (inputLine.equals(\"I'm a Broker. What is my child's port?\")){\r\n\t\t\t\t\t\t//To find the corresponding entry in the structure table\r\n\t\t\t\t\t\tfor (int i=0; i<15; i++){\r\n\t\t\t\t\t\t\tif (ports[i][0] == (currentPortForBroker)){\r\n\t\t\t\t\t\t\t\tif (ports[i][childIndex] != 0){\r\n\t\t\t\t\t\t\t\t\tif (childIndex > 4){\r\n\t\t\t\t\t\t\t\t\t\tSystem.err.println(\"SuperBroker: There's no more children for this broker!\");\r\n\t\t\t\t\t\t\t\t\t\tSystem.exit(1);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tout.println(ports[i][childIndex]);\r\n\t\t\t\t\t\t\t\t\tchildIndex++;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\tout.println(\"0\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (inputLine.equals(\"I'm a Client. What is my port?\")){\r\n\t\t\t\t\t\t//Check if the port number of Client beyond its range\r\n\t\t\t\t\t\tif (portForClients > 2018){\r\n\t\t\t\t\t\t\tSystem.err.println(\"SuperBroker: There's no more port availble for Client!\");\r\n\t\t\t\t\t\t\tSystem.exit(1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tout.println(portForClients);\r\n\t\t\t\t\t\tcurrentPortForClient=portForClients;\r\n\t\t\t\t\t\tportForClients++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (inputLine.equals(\"I'm a Client. What is my broker's port?\")){\r\n\t\t\t\t\t\t//To find the corresponding entry in the structure table\r\n\t\t\t\t\t\tfor (int i=0; i<15; i++){\r\n\t\t\t\t\t\t\tif (ports[i][0] == (currentPortForClient)){\r\n\t\t\t\t\t\t\t\tout.println(ports[i][1]);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else break;\r\n\t \tinputLine = in.readLine();\r\n\t }\r\n\t \r\n\t out.close();\r\n\t in.close();\r\n\t\t\t\tclientSocket.close();\r\n\t\t\t}\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\"I/O Exception caught at SuperBroker. System will shut down now.\");\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\tif (args.length < 2) {\n\t\t\tSystem.out.println(\"Please enter arguments in this format <server IP Address> <port number>\\n\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\thostname = args[0];\n\t\t\n\t\ttry {\n\t\t\tport = Integer.parseInt(args[1]);\n\t\t} catch (NumberFormatException e) { // Handle non-integer command line argument (socket's 2nd argument is int)\n\t\t\tSystem.out.println(\"User invalid input, please enter an Integer for port number.\");\n\t\t\tSystem.exit(-1);\n\t\t}\n\n\t\tmenu();\n\t\t\n\t\t// Run concurrent client threads specified times\n\t\trunThreads(1);\n\t\trunThreads(5);\n\t\trunThreads(10);\n\t\trunThreads(20);\n\t\trunThreads(30);\n\t\trunThreads(40);\n\t\trunThreads(50);\n\t\trunThreads(60);\n\t\trunThreads(70);\n\t\trunThreads(80);\n\t\trunThreads(90);\n\t\trunThreads(100);\n\t}", "@Override\n public void run() {\n while (true) {\n try {\n numberOfUsers = fromServer.readInt(); //readInt will pause/block code underneath till read\n //write the number of users onto the JLabel\n labelShowNumberOfUsers.setText(\"\\tNumber of users who are currently on server: \" + numberOfUsers);\n } catch (IOException ex) {\n System.err.println(ex);\n }\n }\n }", "public static void ChangeCustomerChoice(Boolean tConnection) {\r\n\t\tboolean connection = tConnection; \r\n\r\n \tScanner scnr = new Scanner(System.in);\r\n\t\tint changechoice, newservice, cycled;\r\n\t\tcycled = 0;\r\n\t\tchangechoice = 0;\r\n\t\tnewservice = 0;\r\n\t\t\r\n\t\tif(connection == true) {\r\n\t\t\tclientListUpdater();\r\n\t\t}\r\n\t\t\r\n\t\tDisplayInfo(connection);\r\n\t\t\r\n\t\tSystem.out.println(\"\\r\\nEnter the number of the client that you wish to change\");\r\n\t\t\r\n\t\tdo {\r\n \t\tif( (changechoice < 1 || changechoice > clientList.size()) && cycled != 0) {\r\n \t\t\tSystem.out.println(\"That client does not exist. Try again.\");\r\n \t\t}\r\n\t\t while(!scnr.hasNextInt()) {\r\n\t\t \tSystem.out.println(\"Client change options are integers only\");\r\n\t\t \tscnr.next();\t\r\n\t\t }\r\n \t\tcycled = 1;\r\n \t\tchangechoice = scnr.nextInt();\r\n\t\t} while(changechoice < 1 || changechoice > clientList.size());\r\n\t\t\r\n\t\tSystem.out.println(\"\\r\\nEnter the client's new service choice (1 = Brokerage, 2 = Retirement)\");\r\n\t\t\r\n\t\tcycled = 0;\r\n\t\t\r\n\t\tdo {\r\n\t\t\tif((newservice < 1 || newservice > 2) && cycled != 0) {\r\n\t\t\t\tSystem.out.println(\"Client choice can only be 1 or 2 (1 = Brokerage, 2 = Retirement)\\r\\nTry again.\");\r\n\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\twhile(!scnr.hasNextInt()) {\r\n\t\t\t\tSystem.out.println(\"Client choice are integer only, Try again.\");\r\n\t\t\t\tscnr.next();\r\n\t\t\t}\r\n\t\t\tcycled = 1;\r\n\t\t\tnewservice = scnr.nextInt();\r\n\t\t} while(newservice < 1 || newservice > 2);\r\n\t\t\r\n\t\tString servString = \"\";\r\n\t\tif(newservice == 1) {\r\n\t\t\tservString = \"Brokerage\";\r\n\t\t} else if(newservice == 2) {\r\n\t\t\tservString = \"Retirement\";\r\n\t\t} else {\r\n\t\t\tSystem.out.println(\"Error: Client could not be entered\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(connection == true) {\r\n\t\t\tserverConnector.updateClientChoice(changechoice, servString);\r\n\t\t\tclientListUpdater();\r\n\r\n\t\t} else {\r\n\t\t\tclientList.get(changechoice-1).setClientServ(servString);\r\n\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public void select ()\r\n \t\t{\r\n \t\t\tString sinput;\t\t\t\r\n \t\t\t\r\n \t\t\tdo {\r\n \t\t\t\tErrorLog.debug (\"Setting size: \" + getSize()); //Need to check if Short values\r\n \t\t\t\t//Can be passed in.\r\n \t\t\t\t\r\n \t\t\t\tprint (\"The current \" + name + \" is: \" + setting + type);\r\n \t\t\t\tprint (\"Would you like to change this? (\"+yes+\"/\"+no+\")\");\r\n \t\t\t\tsinput = read ();\r\n \t\t\t\t\r\n \t\t\t\tif (sinput.equalsIgnoreCase(yes)){\r\n \t\t\t\t\tprint (\"Please enter the \" + name + \" in \" + type);\r\n \t\t\t\t\tsinput = read ();\r\n \t\t\t\t\t\r\n \t\t\t\t\ttry {\r\n \t\t\t\t\t\tsetting = Short.parseShort(sinput);\r\n \t\t\t\t\t\tprint (name + \" changed.\");\r\n \t\t\t\t\t}\r\n \t\t\t\t\tcatch (NumberFormatException e){\t\t\t\t\t\r\n \t\t\t\t\t\tprint (\"That's not a valid number!\");\r\n \t\t\t\t\t}\t\t\t\t\t\r\n \t\t\t\t}\r\n \t\t\t\telse if (sinput.equalsIgnoreCase(no)){\r\n \t\t\t\t\tprint (\"Setting kept.\");\r\n \t\t\t\t\tbreak;\r\n \t\t\t\t}\r\n \t\t\t\telse {\r\n \t\t\t\t\tprint (\"That's not an option.\");\r\n \t\t\t\t}\r\n \t\t\t\t\r\n \t\t\t} while (true);\r\n \t\t}", "private Selector initSelector() throws IOException {\n\t\tfinal Selector socketSelector = SelectorProvider.provider()\n\t\t\t\t.openSelector();\n\n\t\t// Create a new non-blocking server socket channel\n\t\tServerSocketChannel serverChannel = ServerSocketChannel.open();\n\t\tserverChannel.configureBlocking(false);\n\n\t\t// Bind the server socket to the specified address and port\n\t\tfinal InetSocketAddress isa = new InetSocketAddress(this.hostAddress,\n\t\t\t\tthis.port);\n\t\tserverChannel.socket().bind(isa);\n\n\t\t// Register the server socket channel, indicating an interest in\n\t\t// accepting new connections\n\t\tserverChannel.register(socketSelector, SelectionKey.OP_ACCEPT);\n\n\t\treturn socketSelector;\n\t}", "public static void main(String[] args) {\n new ServerControl().start();\n new UserMonitor().start();\n boolean listening = true;\n //listen for connection attempt and handle it accordingly\n try (ServerSocket socket = new ServerSocket(4044)) {\n while (listening) {\n new AwaitCommand(Singleton.addToList(socket.accept())).start();\n System.out.println(\"Connection started...\");\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "void select();", "public void testMixer_getNumberOfInputPortMax() throws InterruptedException {\n Integer NbPortTested = 11;\n Mixer mixer = new Mixer(NbPortTested);\n \n assertEquals(\"Get the number of input port\", 10, mixer.getNumberOfInputPort(),0);\n }", "private static String loginMenu(){\n\t\tSystem.out.println(\"==================================\");\n\t\tSystem.out.println(\"Welcome to the Registration System\");\n\t\tSystem.out.println(\"Please select from the following:\");\n\t\tSystem.out.println(\"1. Login\");\n\t\tSystem.out.println(\"2. Request Access\");\n\t\tSystem.out.println(\"3. Exit\");\n\t\tSystem.out.print(\"Enter the number of you request: \"); \n\t\tString selection = input.nextLine();\n\t\tSystem.out.println(\"\");\n\t\treturn selection;\n\t}", "public void setNumConnections(int connections) {\n\t\tnumConnects = connections;\n\t}", "public void listen() {\n\t\t\n\t\twhile(true) {\n\t\t\t\n\t\t\tDatagramPacket packet = new DatagramPacket(recieveData, MAX_SIZE);\n\t\t\tint available = 0;\n\t\t\t\n\t\t\ttry {\n\t\t\t\t//The 'receive(...)' method fills up the buffer of the packet we passed into it with the data received\n\t\t\t\tmainSocket.receive(packet);\n\t\t\t\t//available = packet.getLength();\n\t\t\t\tbyte[] data = packet.getData();\n\t\t\t\t\n\t\t\t\tif(data[0] == HEADER && data[1] == CONNECTION)\n\t\t\t\t\tif(askUser(packet, available))\n\t\t\t\t\t\tmakeClientThread();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t}\n\t\t\tcatch(PortUnreachableException ex) {\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"PortUnreachableException caught in server side.\\n Unable to recieve packet\\n\");\n\t\t\t\tex.printStackTrace();\n\t\t\t}\n\t\t\tcatch (IOException ex) {\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"1. IOException Caught in server side.\\n Unable to vertify user\\n\");\n\t\t\t\tex.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public void numberOfChoices() {\n\t\tcommon.waitForElement(mcqChoices, 60);\n\t\tchoicesinMCQ = mcqChoices.getText();\n\t\tarr = choicesinMCQ.split(\"\\\\W+\");\n\t\tnumberOfChoicesinMCQ = arr[3];\n\t\tlastOption = numberOfChoicesinMCQ.charAt(0);\n\t\tint a = 1;\n\t\tfor (char x = firstOption; x < lastOption; x++) {\n\t\t\tfirstOption += 1;\n\t\t\ta += 1;\n\t\t}\n\t\tfor (choice = 0; choice < a; choice++) {\n\t\t\tcommon.waitForElement(mcqChoices, 60);\n\t\t\tanswerChoice.get(choice).click();\n\t\t}\n\t\tchoice = 0;\n\t\ta = 1;\n\t\tfirstOption = 'A';\n\t}", "public int initialAsk(){\n System.out.println(\"Hi, what would you like to do? \");\n System.out.println(\"Please type in the number: \");\n System.out.println(\"1. Add a client to the database \");\n System.out.println(\"2. Add an order to the database \");\n System.out.println(\"3. Display all clients from the database \");\n System.out.println(\"4. Display all orders from the database \");\n System.out.println(\"5. Update the client data \");\n System.out.println(\"6. Update the order data \");\n System.out.println(\"7. Delete the client from a database \");\n System.out.println(\"8. Delete the order from a database \");\n System.out.println(\"9. Find the client\");\n System.out.println(\"10. Find the order\");\n System.out.println(\"11. Finish work/ Close app\");\n return inN.nextInt();\n}", "public static void main2(String[] args) throws UnknownHostException, IOException, ClassNotFoundException, InterruptedException{\r\n //get the localhost IP address, if server is running on some other IP, you need to use that\r\n InetAddress host = InetAddress.getLocalHost();\r\n Socket socket = null;\r\n ObjectOutputStream oos = null;\r\n ObjectInputStream ois = null;\r\n for(int i=0; i<5;i++){\r\n //establish socket connection to server\r\n socket = new Socket(host.getHostName(), 9876);\r\n //write to socket using ObjectOutputStream\r\n oos = new ObjectOutputStream(socket.getOutputStream());\r\n System.out.println(\"Sending request to Socket Server\");\r\n if(i==4)oos.writeObject(\"exit\");\r\n else oos.writeObject(\"\"+i);\r\n //read the server response message\r\n ois = new ObjectInputStream(socket.getInputStream());\r\n String message = (String) ois.readObject();\r\n System.out.println(\"Message: \" + message);\r\n //close resources\r\n ois.close();\r\n oos.close();\r\n Thread.sleep(100);\r\n }\r\n }", "public static void main(String[] args) throws IOException {\n NetworksClient client = new NetworksClient();\n client.startConnection(\"127.0.0.1\", 18741);\n \n System.out.println(\"Enter a command:\");\n while(true){\n Scanner input = new Scanner(System.in);\n String message = input.nextLine();\n\n if(\".\".equals(message)){\n client.stopConnection();\n return;\n }\n\n String response = client.sendMessage(message);\n\n System.out.println(\"From server: \" + response);\n }\n }", "private void networkClient(java.awt.event.MouseEvent evt) {\n\t\tgameChoice = 'c';\n\t\twindowComplete = true;\n\t}", "public static void chooseNeighbour() {\n clique.handler(ConnectReq.class, (i, req) -> {\n int randomIndex = new Random().nextInt(connections.size());\n connections.get(randomIndex).send(req);\n });\n }", "LargestSubsequenceConcurrentServer(Socket clientSocket, int clientIdNumber) {\n this.clientSocket = clientSocket;\n this.clientIdNumber = clientIdNumber;\n }", "public static int getNextAvailableTCPPort() {\n // Here, we simply return an unused port found by the system\n try (ServerSocket serverSocket = new ServerSocket(0)) {\n return serverSocket.getLocalPort();\n } catch (IOException ioe) {\n throw new NoSuchElementException(ioe.getMessage());\n }\n }", "public synchronized void alertChosen( int r, int c ) {\n\t\ttry {\n\t\t\tvListen.select( r, c );\n\t\t} catch (IOException exc) {\n\t\t\terrorIOError();\n\t\t}\n\t}", "public void select() {\n \t\t\tString sinput = \"\";\r\n \t\t\tOption selected = null;\r\n \t\t\tErrorLog.debug(name + \" selected.\");\r\n \t\t\t\r\n \t\t\twhile (true) {\r\n \t\t\t\tSystem.out.println(toString()); //Print menu.\r\n \t\t\t\tsinput = read(); //Get user selection.\r\n \t\t\t\tif (!sinput.equalsIgnoreCase(\"exit\")) {\r\n \t\t\t\t\tselected = options.get(sinput); //Find corresponding option.\r\n \r\n \t\t\t\t\tif (selected != null) //Sinput corresponds to an extant option.\r\n \t\t\t\t\t\tselected.select(); //Select the selected.\r\n \t\t\t\t\telse\r\n \t\t\t\t\t\tprint(sinput + \" is not a valid option\");\r\n \t\t\t\t} else\r\n \t\t\t\t\t{print(\"Returning to previous menu.\"); break;}\r\n \t\t\t}\r\n \t\t\t\r\n \t\t\tErrorLog.debug (\"Quitting \" + name + \". Sinput:\"+sinput);\r\n \t\t\t\r\n \t\t\treturn;\r\n \t\t}", "private void watch() {\n ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);\n while (true) {\n try {\n int numSelected = selector.select();\n if (numSelected == 0) {\n continue;\n }\n Set<SelectionKey> selectedKeys = selector.selectedKeys();\n Iterator<SelectionKey> iterator = selectedKeys.iterator();\n while (iterator.hasNext()) {\n SelectionKey key = iterator.next();\n iterator.remove();\n SocketChannel channel = ((SocketChannel) key.channel());\n int numReadBytes = channel.read(buffer);\n boolean noMessage = numReadBytes == 0;\n if (noMessage) {\n continue;\n }\n\n String message = new String(buffer.array(), StandardCharsets.UTF_8).replace(\"\\u0000\", \"\");\n System.out.print(message);\n Arrays.fill(buffer.array(), (byte) 0);\n buffer.clear();\n }\n } catch (IOException e) {\n e.printStackTrace();\n return;\n }\n }\n }", "@FXML\n private void chooseConnType(ActionEvent event){\n\n int choice;\n choice = srmi.getToggles().indexOf(srmi.getSelectedToggle());\n switch(choice) {\n\n case 0:\n protocolType = SOCKET;\n break;\n\n case 1:\n protocolType = RMI;\n break;\n }\n\n }", "public static void main(String[] args) throws IOException\n {\n ServerSocket listener = new ServerSocket(PORT);\n\n while (true)\n {\n System.out.println(\"[SERVER] Waiting for connection . . . \");\n //takes in the user client sockets\n Socket client = listener.accept();\n //Announces that the user has connected\n System.out.println(\"[SERVER] Connected to client \" + client.getInetAddress());\n ClientHandler clientThread = new ClientHandler(client, clients);\n\n pool.execute(clientThread);\n }\n }", "private int promptNumPlayers() {\r\n Object[] options = {1, 2, 3, 4};\r\n int numPlr = (int) JOptionPane.showInputDialog(\r\n null,\r\n \"How many people are playing?\",\r\n \"Welcome!\",\r\n JOptionPane.PLAIN_MESSAGE,\r\n null,\r\n options,\r\n 1);\r\n\r\n players = new Player[numPlr];\r\n\r\n for (int i = 0; i < numPlr; i++) {\r\n players[i] = new Player();\r\n }\r\n\r\n return numPlr;\r\n }", "public static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in); // reads in which type of request to choose\n\t\tSystem.out.println(\"choose FCFS, Closest, or Urgency\");\n\t\tString pickRequest = sc.next();\n\t\t\n\t\t\n\t\tnew Server(Integer.parseInt(args[0]), pickRequest);\n\t}", "private static void menuSelector(){\r\n\t\tint answer= getNumberAnswer();\r\n\t\tswitch (answer) {\r\n\t\tcase 0:\r\n\t\t\tshowShapeInfo(shapes[0]);\r\n\t\t\tbreak;\r\n\t\tcase 1:\r\n\t\t\tcreateShape();\r\n\t\t\tbreak;\r\n\t\tcase 2:\r\n\t\t\tSystem.out.println(\"Its Perimeter is equal to: \" +calcShapePerimeter(shapes[0]));\r\n\t\t\tbreak;\r\n\t\tcase 3:\r\n\t\t\tSystem.out.println(\"Its Area is equal to: \" +calcShapeArea(shapes[0]));\r\n\t\t\tbreak;\r\n\t\tcase 4:\r\n\t\t\tSystem.out.println(\"Provide integer to use for scaling shape: \");\r\n\t\t\tscaleShape(shapes[0], getNumberAnswer());\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tSystem.out.println(\"That's not actually an option.\");\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "@Override\r\n\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\tif(e.getActionCommand().equals(b1))\r\n\t\t\t{\r\n\t\t\r\n\t\t\t\ttry{\r\n\t\t\t\t\tServerSocket server = new ServerSocket(7777);\r\n\t\t\t\t\tSystem.out.println(\"서버 준비\");\r\n\t\t\t\t\t\r\n\t\t\t\t\twhile(true)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tSocket client = server.accept();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tOutputStream os = client.getOutputStream();\r\n\t\t\t\t\t\tDataOutputStream fos = new DataOutputStream(os); \r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tfos.close();\r\n\t\t\t\t\t\tos.close();\r\n\t\t\t\t\t\tclient.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t//l1.setText(\"하하하\");\r\n\t\t\t}\t\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t////\r\n\t}", "private int readNumberOfSticks () {\n int number = -1;\n while (number <= 0) {\n number = readIntWithPrompt(\n \"Enter number of sticks \" +\n \"(a positive integer): \");\n }\n return number;\n }", "long getTotalServerSocketsCount();", "private void connect()\r\n\t{\r\n\t\tString remoteHostName = txtComputerName.getText();\r\n\t\tint remoteHostPort = Integer.parseInt(txtPort.getText());\r\n\t\tif (remoteHostName == null || remoteHostName.equals(\"\"))\r\n\t\t{\r\n\t\t\twriteLine(\"Enter a Computer Name\", 0);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif (remoteHostPort <= 0)\r\n\t\t\t{\r\n\t\t\t\twriteLine(\"Enter a Port\", 0);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// we can now connect\r\n\t\t\t\t// set our cursor to notify the user that they might need to\r\n\t\t\t\t// wait\r\n\t\t\t\twriteLine(\"Connecting to: \" + remoteHostName + \" : \"\r\n\t\t\t\t\t\t+ remoteHostPort, 0);\r\n\t\t\t\tthis.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));\r\n\t\t\t\t// lets try to connect to the remote server\r\n\r\n\t\t\t\ttheSocket = new CommSocket(remoteHostName, remoteHostPort);\r\n\r\n\t\t\t\tif (theSocket.connect())\r\n\t\t\t\t{\r\n\t\t\t\t\twriteLine(\r\n\t\t\t\t\t\t\t\"We are successfuly connected to: \"\r\n\t\t\t\t\t\t\t\t\t+ theSocket.getRemoteHostIP(), 0);\r\n\t\t\t\t\twriteLine(\"On Port: \" + theSocket.getRemoteHostPort(), 0);\r\n\t\t\t\t\trunning = true;\r\n\t\t\t\t\t// socketListener();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\twriteLine(\"We failed to connect!\", 0);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.setCursor(Cursor\r\n\t\t\t\t\t\t.getPredefinedCursor(Cursor.DEFAULT_CURSOR));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void main(String args[]) throws UnknownHostException, IOException {\n Scanner scanner = new Scanner(System.in); // Create scanner to allow keyboard input\n\n while(true) {\n System.out.print(\"INFO: Enter 1 to register\\n Enter 2 to login\\n Enter ´q´ to stop session\\n\");\n String state = scanner.nextLine();\n if (\"q\".equals(state)) {\n System.out.println(\"Exit!\"); // if keyboard input equal to ´q´ close client process\n break;\n }else if(\"1\".equals(state)){\n System.out.print(\"Enter username :\\n\");\n String username = scanner.nextLine(); // Waiting for keyboard input\n if(username.isEmpty()){System.out.println(\"please enter a username\"); username=scanner.nextLine();}\n System.out.println(\"Enter password :\\n\");\n String password = scanner.nextLine();\n if(password.isEmpty()){System.out.println(\"please enter a password\"); password=scanner.nextLine();}\n System.out.println(\"Enter name :\\n\");\n String name = scanner.nextLine();\n if(name.isEmpty()){System.out.println(\"please enter a name\"); name=scanner.nextLine();}\n\n System.out.println(\"Enter rate :\\n\");\n int rate = scanner.nextInt();\n if(rate == 0){System.out.println(\"please enter a rate = 1\"); username=scanner.nextLine();}\n\n System.out.println(\"choose a role from (main role, part role 1, part role 2)\");\n String role = scanner.nextLine();\n TeamMember member = new TeamMember(username,password,name,rate,role,state);\n thPoolClient.execute(new ClientSocketTask(member)); // create a new socket task\n\n }else if(\"2\".equals(state)){\n\n System.out.print(\"Enter username :\\n\");\n String username = scanner.nextLine(); // Waiting for keyboard input\n if(username.isEmpty()){System.out.println(\"please enter a username\"); username=scanner.nextLine();}\n System.out.println(\"Enter password :\\n\");\n String password = scanner.nextLine();\n if(password.isEmpty()){System.out.println(\"please enter a password\"); password=scanner.nextLine();}\n TeamMember member = new TeamMember(username, password, state);\n thPoolClient.execute(new ClientSocketTask(member)); // create a new socket task\n\n }else {\n System.out.println(\"Enter 1, 2 or q\");\n }\n thPoolClient.shutdown(); //shutdown the ThreadPool\n\n\n }\n }", "public static void main(String[] args) throws IOException {\n\n if (args.length != 1) // Test for correct # of args\n throw new IllegalArgumentException(\"Parameter(s): <Port>\");\n\n int serverPort = Integer.parseInt(args[0]);\n\n // Create a server socket to accept client connection requests\n ServerSocket serverSocket = new ServerSocket(serverPort);\n\n int receiveMessageSize; // Size of received message\n byte[] byteBuffer = new byte[BUFFER_SIZE]; // Receive buffer\n\n while (true) { // Run forever, accepting and servicing connections\n Socket clientSocket = serverSocket.accept(); // Get client connection\n\n System.out.println(\"Handling client at \" +\n clientSocket.getInetAddress().getHostAddress() + \" on port \" +\n clientSocket.getPort());\n\n InputStream in = clientSocket.getInputStream();\n OutputStream out = clientSocket.getOutputStream();\n\n // Receive until client closes connection, indicated b y - i return\n while ((receiveMessageSize = in.read(byteBuffer)) != -1)\n out.write(byteBuffer, 0, receiveMessageSize);\n\n clientSocket.close(); // Close the socket. We are done with this client!\n }\n /* NOT REACHED */\n }", "public void testMixer_getNumberOfInputPortMin() throws InterruptedException {\n Integer NbPortTested = 1;\n Mixer mixer = new Mixer(NbPortTested);\n \n assertEquals(\"Get the number of input port\", 2, mixer.getNumberOfInputPort(),0);\n }" ]
[ "0.6749282", "0.5927874", "0.5925187", "0.58915704", "0.5709342", "0.5503989", "0.5496707", "0.5482036", "0.5449276", "0.5427776", "0.54276603", "0.54186565", "0.5418383", "0.5408543", "0.5396975", "0.5394204", "0.53226715", "0.5291132", "0.52742815", "0.52697146", "0.5240139", "0.5236659", "0.5226656", "0.52259064", "0.5225671", "0.5224492", "0.52175117", "0.5208605", "0.5206193", "0.519141", "0.5190306", "0.518809", "0.5184936", "0.5181089", "0.51796734", "0.5178954", "0.5175634", "0.51669264", "0.51475763", "0.51337075", "0.5129391", "0.51238364", "0.51207995", "0.5113358", "0.51097447", "0.51021093", "0.5096946", "0.50940907", "0.5072869", "0.50665003", "0.50599897", "0.5059421", "0.50572723", "0.50567997", "0.5039536", "0.5034868", "0.5034401", "0.50255704", "0.5023739", "0.5022152", "0.5012151", "0.49988496", "0.49963635", "0.49913913", "0.49894962", "0.49873242", "0.49841756", "0.49812806", "0.49794227", "0.49764633", "0.49683243", "0.4967366", "0.49643698", "0.4962204", "0.49556947", "0.49543557", "0.49531648", "0.49447125", "0.49373513", "0.4934694", "0.49337292", "0.4922274", "0.49216604", "0.49212074", "0.4917689", "0.4917293", "0.49142313", "0.49140635", "0.4894133", "0.48940337", "0.48893216", "0.48860988", "0.48852402", "0.48833472", "0.4878587", "0.48784822", "0.48769787", "0.48742914", "0.48710516", "0.4869106" ]
0.74989116
0
TODO Autogenerated method stub
@Override public CoinSet makeChange(CoinSet coins, int amount) throws ChangeImpossibleException { CoinSet change = new CoinSet(); for (Map.Entry<Integer, Integer> e : coins.reversedCoinList()) { if (e.getKey() <= amount) { int take = Math.min(e.getValue(), amount / e.getKey()); change.addCoins(e.getKey(), take); amount -= take * e.getKey(); } } if (amount == 0) return change; else throw new ChangeImpossibleException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tprotected void initdata() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void stehReagieren() {\r\n\t\t//\r\n\t}", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n\tprotected void initData() {\n\t\t\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "@Override\r\n\tprotected void InitData() {\n\t\t\r\n\t}", "public void designBasement() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "public void gored() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\r\n\t}", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n protected void initialize() {\n\n \n }", "public void mo38117a() {\n }", "@Override\n\tprotected void getData() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \r\n\t }", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void dibujar() {\n\t\t\r\n\t}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initData() {\n\t\t\r\n\t}", "private stendhal() {\n\t}", "@Override\n\tprotected void update() {\n\t\t\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tprotected void initData() {\n\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\t\t\n\t}", "@Override\n public void init() {\n\n }", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void init() {\n\t\t\r\n\t}", "@Override\n\tpublic void debite() {\n\t\t\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "@Override\r\n\tpublic void init() {\n\r\n\t}", "public contrustor(){\r\n\t}", "@Override\n\tprotected void initialize() {\n\n\t}", "@Override\r\n\tpublic void dispase() {\n\r\n\t}", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "public void mo55254a() {\n }", "@Override\n\tpublic void dtd() {\n\t\t\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "@Override\n\tprotected void lazyLoad() {\n\t\t\n\t}", "public void mo4359a() {\n }", "@Override\r\n\tprotected void initialize() {\n\r\n\t}", "@Override\n public void memoria() {\n \n }", "@Override\n\t\tpublic void method() {\n\t\t\t\n\t\t}", "private RepositorioAtendimentoPublicoHBM() {\r\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\r\n\tpublic void getProposition() {\n\r\n\t}", "@Override\n\tpublic void particular1() {\n\t\t\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n\tpublic void init() {\n\n\t}", "@Override\n protected void prot() {\n }", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\n\tprotected void initValue()\n\t{\n\n\t}", "public void mo55254a() {\n }" ]
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.6080161", "0.6077022", "0.6041561", "0.6024072", "0.6020252", "0.59984857", "0.59672105", "0.59672105", "0.5965777", "0.59485507", "0.5940904", "0.59239364", "0.5910017", "0.5902906", "0.58946234", "0.5886006", "0.58839184", "0.58691067", "0.5857751", "0.58503544", "0.5847024", "0.58239377", "0.5810564", "0.5810089", "0.5806823", "0.5806823", "0.5800025", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5792378", "0.5790187", "0.5789414", "0.5787092", "0.57844025", "0.57844025", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5774479", "0.5761362", "0.57596046", "0.57596046", "0.575025", "0.575025", "0.575025", "0.5747959", "0.57337177", "0.57337177", "0.57337177", "0.5721452", "0.5715831", "0.57142824", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.57140535", "0.5711723", "0.57041645", "0.56991017", "0.5696783", "0.56881124", "0.56774884", "0.56734604", "0.56728", "0.56696945", "0.5661323", "0.5657007", "0.5655942", "0.5655942", "0.5655942", "0.56549734", "0.5654792", "0.5652974", "0.5650185" ]
0.0
-1
Set of Location which are harder to navigate
public SquareGrid(int width, int height) { this.width = width; this.height = height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public Set<Taglet.Location> getAllowedLocations() {\n final EnumSet<Location> locations = EnumSet.allOf(Taglet.Location.class);\n locations.remove(Taglet.Location.OVERVIEW);\n return locations;\n }", "public abstract java.util.Set getLocations();", "@Override\n public Iterable<Location> listLocations() {\n return ImmutableSet.<Location>of();\n }", "private Location pickLocation(List<Location> locations){\n\t\tList<Location> temp =new ArrayList<Location>(locations); \n\t\t\n\t\ttemp = filterOnAffordancesL(temp); //Easier to give a new list back and change ref.\n\t\tList<Location> aFiltered = new ArrayList<Location>(temp);\n\t\tif(isHomogenous(aFiltered)) return pickAccordingToPreference(temp);\n\t\t\n\t\tList<Location> hFiltered= new ArrayList<Location>(temp);; //hack\n\t\tif(CFG.isFilteredOnHabits()){\n\t\ttemp = filterOnHabitsL(temp);\n\t\thFiltered = new ArrayList<Location>(temp);\n\t\tif(hFiltered.isEmpty()) temp = new ArrayList<Location>(aFiltered); //Reroll if empty\n\t\telse if(isHomogenous(hFiltered)) return pickAccordingToPreference(temp);\n\t\t}\n\t\t\n\t\tif(CFG.isIntentional()){\n\t\ttemp = filterOnIntentionsL(temp);\n\t\tList<Location> iFiltered = new ArrayList<Location>(temp);\n\t\tif(iFiltered.isEmpty()){\n\t\t\ttemp = new ArrayList<Location>(hFiltered); //unique case where habits for non-prefered stuff'\n\t\t\tif(hFiltered.isEmpty()){\n\t\t\t\tSystem.out.println(\"This can't be\");\n\t\t\t\ttemp = new ArrayList<Location>(aFiltered);\n\t\t\t}\n\t\t}\n\t\t}\n\t\t\n\t\treturn pickAccordingToPreference(temp);\n\t}", "@Override\n\tpublic List<SourceLocation> getLocations() {\n\t\treturn null;\n\t}", "private void locate() {\n possibleLocations[0][0] = false;\n possibleLocations[0][1] = false;\n possibleLocations[1][0] = false;\n do {\n location.randomGenerate();\n } while (!possibleLocations[location.y][location.x]);\n }", "public abstract HashSet<Location> getPossibleMovements(GameBoard board);", "private void checkLocation(String mapName, Set<Point> seenLocations, List<Point> wildLocations) {\n Assert.assertFalse(mapName, wildLocations.isEmpty());\n for (Point location : wildLocations) {\n Assert.assertFalse(seenLocations.contains(location));\n seenLocations.add(location);\n }\n }", "protected abstract void getAllUniformLocations();", "Map<UUID, Optional<Location>> getAllCurrentLocations();", "SiteLocation getLocatedAt();", "private MapLocation canUnloadAnywhere() {\r\n\t\tfor (Direction dir : navigation.allDirections) {\r\n\t\t\tMapLocation unloadLoc = myRC.getLocation().add(dir);\r\n\t\t\tif (myRC.canUnloadBlockToLocation(unloadLoc))\r\n\t\t\t\treturn unloadLoc;\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public ArrayList<Location> getMoveLocations()\n {\n ArrayList<Location> locs = new ArrayList<Location>();\n ArrayList<Location> validLocations = getGrid().getValidAdjacentLocations(getLocation());\n for (Location neighborLoc : validLocations)\n {\n if (getGrid().get(neighborLoc) == null || getGrid().get(neighborLoc) instanceof AbstractPokemon || getGrid().get(neighborLoc) instanceof PokemonTrainer)\n locs.add(neighborLoc);\n }\n return locs;\n }", "static @Nullable ExplicitLocationSet getLocationsForLhs(\n PointerState pPointerInfo, CPointerExpression pPointer) throws UnrecognizedCodeException {\n LocationSet directLocation = PointerTransferRelation.asLocations(pPointer, pPointerInfo);\n if (!(directLocation instanceof ExplicitLocationSet)) {\n LocationSet indirectLocation =\n PointerTransferRelation.asLocations(pPointer.getOperand(), pPointerInfo);\n if ((indirectLocation instanceof ExplicitLocationSet explicitSet)\n && (explicitSet.getSize() == 1)) {\n directLocation = pPointerInfo.getPointsToSet(Iterables.getOnlyElement(explicitSet));\n }\n }\n if (directLocation instanceof ExplicitLocationSet) {\n return (ExplicitLocationSet) directLocation;\n }\n return null;\n }", "public List<Location> getPreviousLocations();", "void getDrivableLocations() {\n\t\t\tSystem.out.print(\"\\nPlaces you can drive to: \");\n\t\t\tfor (int i = 0; i < places.length; i++)\n\t\t\t\tif (places[i].drivable) //looks to see if you can drive there \n\t\t\t\t\tif ((places[i] != this)) //if it's not you're current location.\n\t\t\t\t\t\tSystem.out.print(places[i].locationName + \", \");\t//prints the name of the location\t\n\t\t\tSystem.out.println(\"\\n\");\n\t\t}", "public Set getSendAltLocsSet()\r\n {\r\n if ( sendAltLocSet == null )\r\n {// TODO2 use something like a LRUMap. But current LRUMap uses maxSize\r\n // as initial hash size. This would be much to big in most cases!\r\n // Currently this HashSet has no size boundry. We would need our own\r\n // LRUMap implementation with a low initial size and a different max size.\r\n sendAltLocSet = new HashSet();\r\n }\r\n return sendAltLocSet;\r\n }", "Collection<L> getLocations ();", "List<String> locations();", "LocationTracker getTracker();", "private InputLocation getOtherLocation( Object key )\n {\n return ( locations != null ) ? locations.get( key ) : null;\n }", "@Override\n public int locations() {\n return NUM_MECH_LOCATIONS;\n }", "Set<T> get(Location loc);", "void checkMyLocationVisibility() {\n if (settings.getReturnToMyLocation() || presenter.isTracking())\n showMyLocation();\n }", "boolean getRequireLocationPref();", "public void testLocation() {\n String hash = Window.Location.getHash();\n String host = Window.Location.getHost();\n String hostName = Window.Location.getHostName();\n String href = Window.Location.getHref();\n assertNull(Window.Location.getParameter(\"fuzzy bunny\"));\n String path = Window.Location.getPath();\n String port = Window.Location.getPort();\n String protocol = Window.Location.getProtocol();\n String query = Window.Location.getQueryString();\n \n // Check that the sum is equal to its parts.\n assertEquals(host, hostName + \":\" + port);\n assertEquals(href, protocol + \"//\" + host + path + query + hash);\n }", "@Test\n\t\tpublic void canGiveTheseusLocation() {\n\t\t\tPoint whereTheseus = new Pointer(3,3);\n\t\t\tgameLoader.addTheseus(whereTheseus);\n\t\t\tPoint expected = whereTheseus;\n\t\t\tPoint actual = gameSaver.wheresTheseus();\n\t\t\t\n\t\t\tassertEquals(expected.across(), actual.across());\n\t\t\tassertEquals(expected.down(), actual.down());\n\t\t}", "public abstract void setLocations(java.util.Set locations);", "boolean hasLocation();", "boolean hasLocation();", "private void exploreUnseenMap(Coordinate currPos) {\n\t\tif (control.currentPath == null) {\n\t\t\t//loop through unseen coords, finding best path there\n\t\t\tArrayList<Coordinate> path = null;\n\t\t\tArrayList<Coordinate> bestPath = null;\n\t\t\tfor (Coordinate coord: control.unseenCoords) {\n\t\t\t\tSet<Coordinate> tempHazards = new HashSet<>(control.hazardsMap.keySet());\n\t\t\t\tpath = control.findPath(currPos, coord, tempHazards);\n\t\t\t\tif (path.size() > 0) {\n\t\t\t\t\tif (bestPath == null || path.size() < bestPath.size()) {\n\t\t\t\t\t\tbestPath = path;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (bestPath == null || bestPath.size() == 0) {\n\t\t\t\tfor (Coordinate coord: control.unseenCoords) {\n\t\t\t\t\tSet<Coordinate> tempHazards = new HashSet<>(control.hazardsMap.keySet());\n\t\t\t\t\tpath = control.findPath(currPos, coord, tempHazards);\n\t\t\t\t\tfor (Coordinate hazard : control.hazardsMap.keySet()) {\n\t\t\t\t\t\ttempHazards.remove(hazard);\n\t\t\t\t\t\tpath = control.findPath(currPos, coord, tempHazards);\n\t\t\t\t\t\tif (path.size() > 0) {\n\t\t\t\t\t\t\tif (bestPath == null || path.size() < bestPath.size()) {\n\t\t\t\t\t\t\t\tbestPath = path;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tcontrol.setPath(bestPath);\n\t\t}\n\t}", "Location getLocation();", "Location getLocation();", "Location getLocation();", "Location getLocation();", "public Map<String, Map<String, Set<String>>> getLocationMap();", "@Override\n\tpublic ArrayList<BoardLocation> findLocation() {\n\t\treturn null;\n\t}", "public String getLocators() {\n return agentConfig.getLocators();\n }", "@Override\n public Map<String,Map<String,Object>> getLocatedLocations() {\n Map<String,Map<String,Object>> result = new LinkedHashMap<String,Map<String,Object>>();\n Map<Location, Integer> counts = new EntityLocationUtils(mgmt()).countLeafEntitiesByLocatedLocations();\n for (Map.Entry<Location,Integer> count: counts.entrySet()) {\n Location l = count.getKey();\n Map<String,Object> m = MutableMap.<String,Object>of(\n \"id\", l.getId(),\n \"name\", l.getDisplayName(),\n \"leafEntityCount\", count.getValue(),\n \"latitude\", l.getConfig(LocationConfigKeys.LATITUDE),\n \"longitude\", l.getConfig(LocationConfigKeys.LONGITUDE)\n );\n result.put(l.getId(), m);\n }\n return result;\n }", "Place resolveLocation( Place place );", "private void returnDriverLocationstoMaps() {\n }", "private ArrayList<Location> getCandidateLocations(Location origin)\n {\n ArrayList<Location> locs = new ArrayList<>();\n Piece p = getPiece(origin);\n if (p==null)\n return locs;\n switch (p.getType())\n {\n case QUEEN:case ROOK:case BISHOP:\n locs = getLocations();break;\n case KNIGHT:case PAWN:case KING:\n locs = getLocationsWithin(getLocation(p),2);\n }\n return locs;\n }", "private List<BaseLocation> getExpectedBaseLocations() {\r\n final List<BaseLocation> baseLocations = new ArrayList<>();\r\n\r\n final Position position1 = new Position(3104, 3856, PIXEL);\r\n final Position center1 = new Position(3040, 3808, PIXEL);\r\n baseLocations.add(new BaseLocation(position1, center1, 13500, 5000, true, false, true));\r\n\r\n final Position position2 = new Position(2208, 3632, PIXEL);\r\n final Position center2 = new Position(2144, 3584, PIXEL);\r\n baseLocations.add(new BaseLocation(position2, center2, 9000, 5000, true, false, false));\r\n\r\n final Position position3 = new Position(640, 3280, PIXEL);\r\n final Position center3 = new Position(576, 3232, PIXEL);\r\n baseLocations.add(new BaseLocation(position3, center3, 13500, 5000, true, false, true));\r\n\r\n final Position position4 = new Position(2688, 2992, PIXEL);\r\n final Position center4 = new Position(2624, 2944, PIXEL);\r\n baseLocations.add(new BaseLocation(position4, center4, 9000, 5000, true, false, false));\r\n\r\n final Position position5 = new Position(1792, 2480, PIXEL);\r\n final Position center5 = new Position(1728, 2432, PIXEL);\r\n baseLocations.add(new BaseLocation(position5, center5, 12000, 0, true, true, false));\r\n\r\n final Position position6 = new Position(3200, 1776, PIXEL);\r\n final Position center6 = new Position(3136, 1728, PIXEL);\r\n baseLocations.add(new BaseLocation(position6, center6, 13500, 5000, true, false, true));\r\n\r\n final Position position7 = new Position(640, 1968, PIXEL);\r\n final Position center7 = new Position(576, 1920, PIXEL);\r\n baseLocations.add(new BaseLocation(position7, center7, 9000, 5000, true, false, false));\r\n\r\n final Position position8 = new Position(1792, 1808, PIXEL);\r\n final Position center8 = new Position(1728, 1760, PIXEL);\r\n baseLocations.add(new BaseLocation(position8, center8, 12000, 0, true, true, false));\r\n\r\n final Position position9 = new Position(2336, 560, PIXEL);\r\n final Position center9 = new Position(2272, 512, PIXEL);\r\n baseLocations.add(new BaseLocation(position9, center9, 13500, 5000, true, false, true));\r\n\r\n final Position position10 = new Position(3584, 720, PIXEL);\r\n final Position center10 = new Position(3520, 672, PIXEL);\r\n baseLocations.add(new BaseLocation(position10, center10, 9000, 5000, true, false, false));\r\n\r\n final Position position11 = new Position(544, 432, PIXEL);\r\n final Position center11 = new Position(480, 384, PIXEL);\r\n baseLocations.add(new BaseLocation(position11, center11, 13500, 5000, true, false, true));\r\n\r\n return baseLocations;\r\n }", "private void swapLocations() {\n searchViewModel.setSwappingLocations(true);\n TripLocation origin = searchViewModel.getOrigin().getValue();\n TripLocation destination = searchViewModel.getDestination().getValue();\n LocationField tempField = searchViewModel.getFocusedLocationField();\n searchViewModel.setFocusedLocationField(DESTINATION);\n if (origin != null) searchViewModel.setLocation(origin.getLocation(), origin.getName());\n else {\n searchViewModel.setLocation(null, null);\n toTextField.setText(\"To\");\n }\n searchViewModel.setFocusedLocationField(ORIGIN);\n if (destination != null)\n searchViewModel.setLocation(destination.getLocation(), destination.getName());\n else {\n searchViewModel.setLocation(null, null);\n fromTextField.setText(\"From\");\n }\n searchViewModel.setFocusedLocationField(tempField);\n searchViewModel.setSwappingLocations(false);\n }", "public List<LocationInfo> getAllLocation() {\n return allLocation;\n }", "ArrayList<Location> getMoveLocations();", "private void getLocation() {\n\n }", "public boolean canGetLocation() {\r\n return canGetLocation;\r\n }", "void makeUseOfNewLocation(Location location) {\n if ( isBetterLocation(location, currentBestLocation) ) {\n currentBestLocation = location;\n }\n }", "static Set<Location> generateIrrelevantSet(UnitLocation unitLocation){\n Objects.requireNonNull(unitLocation);\n final SegmentationGraph bsg = generateSegmentationGraph(unitLocation);\n return bsg.irrelevantSet(unitLocation);\n }", "private static void setupLocations() {\n\t\tcatanWorld = Bukkit.createWorld(new WorldCreator(\"catan\"));\n\t\tspawnWorld = Bukkit.createWorld(new WorldCreator(\"world\"));\n\t\tgameLobby = new Location(catanWorld, -84, 239, -647);\n\t\tgameSpawn = new Location(catanWorld, -83, 192, -643);\n\t\thubSpawn = new Location(spawnWorld, 8, 20, 8);\n\t\twaitingRoom = new Location(catanWorld, -159, 160, -344);\n\t}", "public SortedSet<WLightpathUnregenerated> getInOutOrTraversingLigtpaths () { return n.getAssociatedRoutes(getNet().getWdmLayer().getNe()).stream().map(ee->new WLightpathUnregenerated(ee)).collect(Collectors.toCollection(TreeSet::new)); }", "public interface LocationProvider {\r\n\t\r\n\t/**\r\n\t * Returns the current location.\r\n\t * \r\n\t * @return the current location\r\n\t */\r\n\tpublic Location getCurrentLocation();\r\n\t\r\n\t/**\r\n\t * Returns the previous locations, not including the current location.\r\n\t * \r\n\t * @return the previous locations\r\n\t */\r\n\tpublic List<Location> getPreviousLocations();\r\n\t\r\n\t/**\r\n\t * Tells if this location manager is prepared for the first speed checks, i.e., if it has received at\r\n\t * least two location updates.\r\n\t * \r\n\t * @return true if sufficient locations are available\r\n\t */\r\n\tpublic boolean isReady();\r\n\r\n}", "public abstract Location[] retrieveLocation();", "private void scanForLocations(Element elem) {\n \n String location = getLocation(elem);\n if (location != null) {\n locationToElement.put(location, elem);\n DOM.setInnerHTML(elem, \"\");\n } else {\n int len = DOM.getChildCount(elem);\n for (int i = 0; i < len; i++) {\n scanForLocations(DOM.getChild(elem, i));\n }\n }\n }", "public Location inRange()\n\t{\n\t\tboolean equals = false;\n\t\tif(getGrid() == null)\n\t\t\treturn null;\n\t\tfor(int i = -5; i < 6; i++)\n\t\t{\n\t\t\tfor(int j = -5; j < 6; j++)\n\t\t\t{\t\t\t\t\n\t\t\t\tif(getGrid().isValid(new Location(getLocation().getRow() + i, getLocation().getCol() + j)))\n\t\t\t\t{\n\t\t\t\t\tif(getGrid().get(new Location(getLocation().getRow() + i, getLocation().getCol() + j)) instanceof User)\n\t\t\t\t\t{\n\t\t\t\t\t\tequals = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tif(!equals)\n\t\t{\n\t\t\tArrayList<Location> locs = getGrid().getEmptyAdjacentLocations(getLocation());\n\t\t\tif(locs.size() != 0)\n\t\t\t\t return locs.get( (int) (Math.random() * locs.size()));\n\t\t\telse\n\t\t\t\treturn getLocation();\n\t\t}\n\t\t\t\n\t\tLocation moveLocation;\n\t\t\n\t\t\n\t\tif(getGrid().getNeighbors(getLocation()).contains(getGrid().getUser()))\n\t\t{\n\t\t\tmoveLocation = getGrid().getUser().getLocation();\n\t\t}\n\t\telse\n {\n PathFinder a = new PathFinder(getGrid(),20);\n Path path = a.findPath(this, this.getGrid().getUser().getLocation().getRow(), this.getGrid().getUser().getLocation().getCol(),true);\n if(path.getLength() != 0)\n moveLocation = a.findPath(this, this.getGrid().getUser().getLocation().getRow(), this.getGrid().getUser().getLocation().getCol(),true).getStep(0);\n else\n moveLocation = null;\n\n }\n\n\t\tif(moveLocation == null)\n\t\t{\n\t\t\tArrayList<Location> locs = getGrid().getEmptyAdjacentLocations(getLocation());\n\t\t\tif(locs.size() != 0)\n\t\t\t\tmoveLocation = locs.get( (int) (Math.random() * locs.size()));\n\t\t\telse\n\t\t\t\tmoveLocation = getLocation();\n\t\t}\n\t\t\n\t\treturn moveLocation;\n\t}", "public Point getRobotLocation();", "private void navToPoint(Unit unit){\n\t\tMapLocation currentLocation = unit.location().mapLocation();\n\t\tMapLocation locationToTest;\n\t\tMapLocation targetLocation = orderStack.peek().getLocation();\n\t\tlong smallestDist=1000000000; //arbitrary large number\n\t\tlong temp;\n\t\tDirection closestDirection=null;\n\t\tint i=1;\n\t\t\n\t\tif(gc.isMoveReady(unitID)){\n\t\t\t//first find the direction that moves us closer to the target\n\t\t\tfor(Direction dir : Direction.values()){\n\t\t\t\tif (debug) System.out.println(\"this (\"+dir.name()+\") is the \"+i+\"th direction to check, should get to 9\");\n\t\t\t\tlocationToTest=currentLocation.add(dir);\n\t\t\t\t//make sure it is on the map and is passable\n\t\t\t\tif (debug){\n\t\t\t\t\tSystem.out.println(\"testing this location: \"+locationToTest);\n\t\t\t\t\tSystem.out.println(\"valid move? \"+gc.canMove(unitID, dir));\n\t\t\t\t}\n\t\t\t\tif(gc.canMove(unitID, dir)){\n\t\t\t\t\tif (debug)System.out.println(\"we can indeed move there...\");\n\t\t\t\t\t//make sure the location hasn't already been visited\n\t\t\t\t\tif(!pastLocations.contains(locationToTest)){\n\t\t\t\t\t\tif (debug)System.out.println(\"not been there recently...\");\n\t\t\t\t\t\t//at this point its a valid location to test, check its distance\n\t\t\t\t\t\ttemp = locationToTest.distanceSquaredTo(targetLocation);\n\t\t\t\t\t\tif (debug)System.out.println(\"distance :\"+temp);\n\t\t\t\t\t\tif (temp<smallestDist){\n\t\t\t\t\t\t\tif (debug)System.out.println(\"new closest!\");\n\t\t\t\t\t\t\t//new closest point, update accordingly\n\t\t\t\t\t\t\tsmallestDist=temp;\n\t\t\t\t\t\t\tclosestDirection=dir;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}//end of for-each loop\n\t\t}//end move ready if.\n\t\t\n\t\t//actual movement and maintenance of places recently visited\n\t\tif(closestDirection!=null){\n\t\t\tif (debug){\n\t\t\t\tSystem.out.println(\"found a closest direction, calling navInDirection()\");\n\t\t\t\tSystem.out.println(\"heading \"+closestDirection.name());\n\t\t\t}\n\t\t\tmoveInDirection(closestDirection, unit);\n\t\t\tcleanUpAfterMove(unit);\n\t\t}else{\n\t\t\t//can't get any closer\n\t\t\tif (debug) System.out.println(\"can't get closer, erasing past locations\");\n\t\t\tpastLocations.clear();\n\t\t}\n\t\t\n\t\t//have we arrived close enough?\n\t\tif(unit.location().mapLocation().distanceSquaredTo(targetLocation)<=howCloseToDestination){\n\t\t\t//atTargetLocation=true;\n\t\t\t\n\t\t\t//if order was a MOVE order, it is complete, go ahead and pop it off the stack\n\t\t\tif(orderStack.peek().getType().equals(OrderType.MOVE)){\n\t\t\t\torderStack.pop();\n\t\t\t}\n\t\t\tif (debug) System.out.println(\"Unit \"+unit.id()+\" arrived at destination.\");\n\t\t}\n\t\t\n\t\t;\n\t}", "private void fineLocationPermissionGranted() {\n UtilityService.addGeofences(this);\n UtilityService.requestLocation(this);\n }", "public ArrayList<Location> getEmptyAdjacentLocations(Location loc)\n {\n ArrayList<Location> locations = getAdjacentLocations(loc);\n for (Direction d: Direction.values())\n {\n Location temp = loc.farther(d);\n if (getPiece(temp)==null)\n locations.add(temp);\n }\n return locations;\n }", "public List<String> locations() {\n return this.locations;\n }", "public String[] provides() { return new String[] { Location.TYPE }; }", "@Override\n public Set<LocationHierarchy> findEnclosingLocationHierarchies(LocationHierarchyLevel entity) {\n Set<LocationHierarchy> onLevel = new HashSet<>();\n onLevel.addAll(locationHierarchyService.findByLevel(entity));\n return onLevel;\n }", "public static ArrayList<XYCoord> findVisibleLocations(GameMap map, XYCoord origin, int range, boolean piercing)\n {\n ArrayList<XYCoord> locations = new ArrayList<XYCoord>();\n\n // Loop through all the valid x and y offsets, as dictated by the max range, and add valid spaces to our collection.\n for( int yOff = -range; yOff <= range; ++yOff )\n {\n for( int xOff = -range; xOff <= range; ++xOff )\n {\n int currentRange = Math.abs(xOff) + Math.abs(yOff);\n XYCoord coord = new XYCoord(origin.xCoord + xOff, origin.yCoord + yOff);\n if( currentRange <= range && map.isLocationValid(coord) )\n {\n // If we're adjacent, or we can see through cover, or it's *not* cover, we can see into it.\n if( piercing || !map.getEnvironment(coord).terrainType.isCover() )\n {\n // Add this location to the set.\n locations.add(coord);\n }\n }\n }\n }\n\n return locations;\n }", "public ArrayList getLocations()\r\n\t\t{\r\n\t\t\treturn locations;\r\n\t\t}", "private void determineStartingLocation(Car carOne, Car carTwo, Car carThree) {\n ArrayList<Integer> locationPlaces = new ArrayList<Integer>();\n locationPlaces.add(1);// 0\n locationPlaces.add(2);// 1\n locationPlaces.add(3);// 2\n locationPlaces.add(4);// 3\n\n Collections.shuffle(locationPlaces);\n\n carOne.setLocation(locationPlaces.get(0));\n carTwo.setLocation(locationPlaces.get(1));\n carThree.setLocation(locationPlaces.get(2));\n }", "@Override\n\tpublic void setLocation(String l) {\n\t\tlocation = l;\n\t\t\n\t}", "private void pickCurrentPlace() {\n if (mMap == null) {\n return;\n }\n\n if (mLocationPermissionGranted) {\n getDeviceLocation();\n } else {\n getLocationPermission();\n }\n }", "Location selectMoveLocation(ArrayList<Location> locs);", "@Override\n public List<String> getCmsLocations() {\n return Collections.emptyList();\n }", "public HashSet<Position> casesAutour()\n {\n HashSet<Position> s = new HashSet<Position>();\n\n for (Direction d : Direction.values())\n s.add(this.relativePos(d));\n\n return s;\n }", "public Set<Location> get_all_locations() {\n Set<Location> locations = new HashSet<Location>();\n try {\n Object obj = JsonUtil.getInstance().getParser().parse(this.text);\n JSONObject jsonObject = (JSONObject) obj;\n JSONArray array = (JSONArray) jsonObject.get(\"pictures\");\n Iterator<String> iterator = array.iterator();\n while (iterator.hasNext()) {\n locations.add(new Location(iterator.next()));\n }\n return locations;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return null;\n }", "private List<Restaurant> getNearRestaurants() {\n\t\tLog.v(LOG_TAG, \"Getting near restaurants offline by the last known position \");\n\t\tList<Restaurant> restaurantsList = new ArrayList<Restaurant>();\n\t\tif (lastPositionKnown == null) {\n\t\t\tLog.e(LOG_TAG, \"Error trying to get the list of near restaurants when the user's position is null\");\n\t\t\treturn restaurantsList;\n\t\t}\n\t\t\n\t\tLog.v(LOG_TAG, \"My position is \" + lastPositionKnown.latitude + \" ,\" + lastPositionKnown.longitude);\n\n\t\tLocation myLocation = new Location(\"\");\n\t\tmyLocation.setLatitude(lastPositionKnown.latitude);\n\t\tmyLocation.setLongitude(lastPositionKnown.longitude);\n\n\t\tSet<String> ids = restaurants.keySet();\n\t\tfor (String id: ids) {\n\t\t\tRestaurant restaurant = restaurants.get(id);\n\t\t\tLatLng restaurantPosition = restaurant.getPosition();\n\t\t\tLocation restaurantLocation = new Location(\"\");\n\t\t\t\n\t\t\trestaurantLocation.setLatitude(restaurantPosition.latitude);\n\t\t\trestaurantLocation.setLongitude(restaurantPosition.longitude);\n\t\t\t\n\t\t\tint distance = (int)restaurantLocation.distanceTo(myLocation);\n\t\t\tLog.v(LOG_TAG, \"The distance to my location is \" + distance + \" \" + restaurant.getName());\n\t\t\tif (distance <= DEFAULT_RANGE ) {\n\t\t\t\trestaurantsList.add(restaurant);\n\t\t\t}\n\t\t}\n\n\t\treturn restaurantsList;\n\t}", "List<Place> findUnboundLocationPlaceholders();", "@Override\r\n\tpublic List<Coordinate> getPossibleLocations(Coordinate currentLocation) {\r\n\r\n\t\tList<Coordinate> possibleCoordinates = new ArrayList<Coordinate>();\r\n\t\tint x = currentLocation.getX();\r\n\t\tint y = currentLocation.getY();\r\n\t\twhile (x > 0 && y > 0) {\r\n\t\t\tx--;\r\n\t\t\ty--;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\r\n\t\twhile (x < Board.SIZE - 1 && y < Board.SIZE - 1) {\r\n\t\t\tx++;\r\n\t\t\ty++;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\r\n\t\twhile (x > 0 && y < Board.SIZE - 1) {\r\n\t\t\tx--;\r\n\t\t\ty++;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\t\twhile (x < Board.SIZE - 1 && y > 0) {\r\n\t\t\tx++;\r\n\t\t\ty--;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\t\treturn possibleCoordinates;\r\n\t}", "String getLocation();", "String getLocation();", "String getLocation();", "public void setLocation(String location);", "private Stack<MapLocation> findPath(State.StateView state)\n {\n Unit.UnitView townhallUnit = state.getUnit(townhallID);\n Unit.UnitView footmanUnit = state.getUnit(footmanID);\n \n MapLocation startLoc = new MapLocation(footmanUnit.getXPosition(), footmanUnit.getYPosition(), null, 0);\n \n MapLocation goalLoc = new MapLocation(townhallUnit.getXPosition(), townhallUnit.getYPosition(), null, 0);\n \n MapLocation footmanLoc = null;\n if(enemyFootmanID != -1) {\n Unit.UnitView enemyFootmanUnit = state.getUnit(enemyFootmanID);\n footmanLoc = new MapLocation(enemyFootmanUnit.getXPosition(), enemyFootmanUnit.getYPosition(), null, 0);\n }\n \n // get resource locations\n List<Integer> resourceIDs = state.getAllResourceIds();\n Set<MapLocation> resourceLocations = new HashSet<MapLocation>();\n for(Integer resourceID : resourceIDs)\n {\n ResourceNode.ResourceView resource = state.getResourceNode(resourceID);\n \n resourceLocations.add(new MapLocation(resource.getXPosition(), resource.getYPosition(), null, 0));\n }\n \n return AstarSearch(startLoc, goalLoc, state.getXExtent(), state.getYExtent(), footmanLoc, resourceLocations);\n }", "@Override\n\tpublic BoardLocation findBestLocWhenStuck() {\n\t\treturn null;\n\t}", "@Override\n protected void checkLocation() {\n // nothing\n }", "public void expLocation() {\n\t\tif (!death) {\t// Geht nicht wenn Tod!\n\t\t\t\n\t\t\t// Beschreibungen anzeigen und boolean explored auf wahr setzen, außer der Raum wurde bereits untersucht\n\t\t\tif (location[this.currentLocation].isExplored()) { Tuna.setMessage(\"Dieser Raum wurde bereits untersucht!\");\n\t\t\t} else {\n\t\t\t\tTuna.addText(location[this.currentLocation].getDescriptions().getExploreDescription());\n\t\t\t\tlocation[this.currentLocation].setExplored(true);\n\t\t\t}\n\t\t\t\n\t\t\t// Items an Stelle null im Item-Array des Standortes sichtbar machen\n\t\t\tif ((currentLocation > 0 && currentLocation < 7 && currentLocation != 2) || currentLocation == 20) {\n\t\t\t\tlocation[this.currentLocation].getItem(0).setVisible(true);\n\t\t\t\t/* Im Korridor (1) der Kaffeelöscherkasten\n\t\t\t\t * Im Konferenzraum (3) der Ventilationsschacht\n\t\t\t\t * In der Kammer der Leere (4) die Notiz\n\t\t\t\t * Im Ventilationsraum (5) die Notiz\n\t\t\t\t * In der Damentoilette (6) das Skillboook\n\t\t\t\t * Im Fahrstuhlschacht (20) die Kaffeetasse\n\t\t\t\t */\n\t\t\t}\n\t\t\t\n\t\t\t// Items an Stelle eins im Item-Array des Standortes sichtbar machen\n\t\t\tif (currentLocation == 9) {\n\t\t\t\tlocation[this.currentLocation].getItem(1).setVisible(true);\n\t\t\t}\n\t\t} else if (death) {\n\t\t\tTuna.setMessage(\"Du bist tot!\");\n\t\t}\n\t}", "public ArrayList<Location> getAdjacentLocations(Location loc)\n {\n ArrayList<Location> locations = new ArrayList<>();\n for (Direction d: Direction.values())\n {\n if (loc.farther(d).isValid())\n locations.add(loc.farther(d));\n }\n return locations;\n }", "protected Location nextLocation()\n {\n // Get list of neighboring empty locations.\n ArrayList emptyNbrs = emptyNeighbors();\n\n // Remove the location behind, since fish do not move backwards.\n Direction oppositeDir = direction().reverse();\n Location locationBehind = environment().getNeighbor(location(),\n oppositeDir);\n emptyNbrs.remove(locationBehind);\n Debug.print(\"Possible new locations are: \" + emptyNbrs.toString());\n\n // If there are no valid empty neighboring locations, then we're done.\n if ( emptyNbrs.size() == 0 )\n return location();\n\n // Return a randomly chosen neighboring empty location.\n Random randNumGen = RandNumGenerator.getInstance();\n int randNum = randNumGen.nextInt(emptyNbrs.size());\n\t return (Location) emptyNbrs.get(randNum);\n }", "public boolean canGetLocation() {\r\n return this.canGetLocation;\r\n }", "private void getLocations() {\n TripSave tripSave = TripHelper.tripOngoing();\n if (tripSave != null) {\n for (LocationSave locationSave : tripSave.getLocations()) {\n if (locationSave != null) {\n tripTabFragment.drawPolyLine(new LatLng(locationSave.getLatitude(), locationSave.getLongitude()));\n }\n }\n }\n }", "public static ArrayList<XYCoord> findVisibleLocations(GameMap map, Unit viewer, boolean piercing)\n {\n return findVisibleLocations(map, viewer, viewer.x, viewer.y, piercing);\n }", "public Map<String, Point> getLocationsAsStatic() {\n\t\treturn Collections.unmodifiableMap(new HashMap<String, Point>(locations));\n\t}", "URI getLocation();", "private void setLocation() {\n switch (getKey()) {\n case UP:\n this.y_location = -136.8 - 6;\n this.y_tile = -1;\n this.positive = false;\n break;\n case DOWN:\n this.y_location = 136.8 + 6;\n this.y_tile = 1;\n break;\n case LEFT:\n this.x_location = -140.6 - 6;\n this.x_tile = -1;\n this.positive = false;\n break;\n case RIGHT:\n this.x_location = 140.6 + 6;\n this.x_tile = 1;\n break;\n default:\n break;\n }\n }", "public boolean hasLocation() {\n return fieldSetFlags()[3];\n }", "public void testSetGoalLocation() {\n test = new Location(9, 9);\n assertEquals(test, maze1.getGoalLocation());\n \n test = new Location(1, 1);\n maze1.setGoalLocation(test);\n assertEquals(test, maze1.getGoalLocation());\n \n test = new Location(2, 2);\n maze1.setCell(test, MazeCell.WALL);\n maze1.setGoalLocation(test);\n assertEquals(test, maze1.getGoalLocation());\n \n \n }", "public List<Location> getLocations() {\n\t\treturn locations;\n\t}", "public void resetLocation()\r\n {\r\n locations.clear();\r\n }", "public static Locations getLocations(WebElement root) {\n Preconditions.checkNotNull(root, \"The element cannot be null.\");\n Point topLeft = root.getLocation();\n Dimension dimension = root.getSize();\n Point topRight = topLeft.moveBy(dimension.getWidth(), 0);\n Point bottomRight = topRight.moveBy(0, dimension.getHeight());\n Point bottomLeft = topLeft.moveBy(0, dimension.getHeight());\n return new Locations(topLeft, topRight, bottomLeft, bottomRight);\n }", "private void setLocationRequest() {\n locationRequest = new LocationRequest();\n locationRequest.setInterval(10000); // how often we ask provider for location\n locationRequest.setFastestInterval(5000); // 'steal' location from other app\n locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); // can pick balanced power accuracy\n }", "@Override \n public void onLocationChanged(Location location) { \n mostRecentLocation = location; \n }", "public ArrayList<LocationDetail> getLocations() throws LocationException;", "public ArrayList<Location> getValid(Location loc) {\r\n Grid<Actor> gr = getGrid();\r\n if (gr == null) {\r\n return null;\r\n }\r\n ArrayList<Location> valid = new ArrayList<Location>();\r\n // 向上右下左四个方向找\r\n int dirs[] = {\r\n Location.AHEAD, Location.RIGHT, Location.HALF_CIRCLE,\r\n Location.LEFT };\r\n for (int i = 0; i < dirs.length; i++) {\r\n Location tarLoc = loc.getAdjacentLocation(dirs[i]);\r\n if (gr.isValid(tarLoc)) {\r\n if (gr.get(tarLoc) == null) {\r\n valid.add(tarLoc);\r\n }\r\n }\r\n }\r\n return valid;\r\n }", "public void setWhereToGo() {\n\t\tfloat diffZ=mApplications.get(CurIndex).getZ() - Constants.displayedPlace;\r\n\t\tif( Math.abs(diffZ) < Constants.threshold)\r\n\t\t{\r\n\t\t\tif(diffZ >=0)\r\n\t\t\t\tgoTo(Constants.TO_BACKWARD_CENTER);\r\n\t\t\telse\r\n\t\t\t\tgoTo(Constants.TO_FORWARD_CENTER);\r\n\t\t}\r\n\t\telse if( diffZ >= 0) // go to disappeared place\r\n\t\t{\r\n\t\t\tgoTo(Constants.TO_FRONT);\r\n\t\t}\r\n\t\telse if( diffZ < 0) // go to origin place\r\n\t\t{\r\n\t\t\tgoTo(Constants.TO_BACK);\r\n\t\t}\r\n\t}" ]
[ "0.63852274", "0.623569", "0.6104757", "0.6044475", "0.596092", "0.58711123", "0.58448076", "0.582725", "0.58204913", "0.5813029", "0.5722497", "0.5718929", "0.56915194", "0.5638729", "0.5634353", "0.5621587", "0.5600962", "0.55861145", "0.55813813", "0.5580848", "0.5576756", "0.5559319", "0.55572945", "0.5540675", "0.55386025", "0.5518027", "0.5517507", "0.55133927", "0.5512113", "0.5512113", "0.550637", "0.54983723", "0.54983723", "0.54983723", "0.54983723", "0.5495102", "0.5484724", "0.54694927", "0.54625565", "0.54539955", "0.54525995", "0.5435885", "0.54328346", "0.54145813", "0.54027545", "0.5386854", "0.5348798", "0.53291136", "0.5318986", "0.531771", "0.5313707", "0.5312442", "0.53080463", "0.52797824", "0.5271939", "0.5268816", "0.52608806", "0.5256478", "0.5253672", "0.52524316", "0.5247833", "0.52426195", "0.52367395", "0.5226658", "0.5219466", "0.5218186", "0.5218125", "0.5209134", "0.5205193", "0.5196309", "0.5183738", "0.51827466", "0.51818496", "0.518025", "0.51541686", "0.514324", "0.514324", "0.514324", "0.5142295", "0.51393795", "0.5132427", "0.51312304", "0.51311105", "0.5131059", "0.51280165", "0.5126175", "0.5123657", "0.512131", "0.51141554", "0.5110431", "0.5109529", "0.5102475", "0.5096051", "0.50938344", "0.5092", "0.5082386", "0.5079864", "0.5079048", "0.507343", "0.5068907", "0.5067797" ]
0.0
-1
Returns an ArrayList containing all valid neighbors (passable and in bounds) for a given Location id.
@Override public ArrayList<Location> neighbors(final Location id) { ArrayList<Location> neighbours = new ArrayList<>(); for (Location direction : directions){ Location position = new Location(direction.x + id.x, direction.y + id.y); if (inBounds(position) && isPassable(position)) neighbours.add(position); } return neighbours; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<Location> neighbors (Location pos);", "public ArrayList<Collidable> getNeighbors();", "protected ArrayList emptyNeighbors()\n {\n // Get all the neighbors of this fish, empty or not.\n ArrayList nbrs = environment().neighborsOf(location());\n\n // Figure out which neighbors are empty and add those to a new list.\n ArrayList emptyNbrs = new ArrayList();\n for ( int index = 0; index < nbrs.size(); index++ )\n {\n Location loc = (Location) nbrs.get(index);\n if ( environment().isEmpty(loc) )\n emptyNbrs.add(loc);\n }\n\n return emptyNbrs;\n }", "public ArrayList<Integer> getNeighbors() {\n\t\treturn neighbors;\n\t}", "public List<String> getNeighbors(String stationId) {\r\n\t\tList<String> res = new ArrayList<>();\r\n\t\tres.add(stationId);\r\n\t\t\r\n\t\tfor (int j = 1; j < edges.size(); j++) {\r\n\t\t\tString source = mapBuilder.getSubwayGraph().getEdgeSource(edges.get(j));\r\n\t\t\tString target = mapBuilder.getSubwayGraph().getEdgeTarget(edges.get(j));\r\n\t\t\t\r\n\t\t\tif(source.equals(stationId)) {\r\n\t\t\t\tres.add(target);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res;\t\r\n\t}", "public ArrayList<Location> getValid(Location loc) {\n\t\tGrid<Actor> gr = getGrid();\n\t\tif (gr == null) {\n\t\t\treturn null;\n\t\t}\n\t\tArrayList<Location> valid = new ArrayList<Location>();\n\t\tfor (int d : DIRS) {\n\t\t\tLocation neighbor = loc.getAdjacentLocation(getDirection() + d);\n\n\t\t\tif (gr.isValid(neighbor)) {\n\t\t\t\tActor a = gr.get(neighbor);\n\t\t\t\tif (!isVisited[neighbor.getRow()][neighbor.getCol()] &&\n\t\t\t\t\t(a == null || a instanceof Flower)) {\n\t\t\t\t\tvalid.add(neighbor);\n\t\t\t\t} else if (a instanceof Rock && a.getColor().equals(Color.RED)) {\n\t\t\t\t\tisEnd = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn valid;\n\t}", "public List<Tile> getNeighbors() {\n List<Tile> list = new ArrayList<Tile>();\n\n if (this.tileNorth != null) {\n list.add(this.tileNorth);\n }\n\n if (this.tileEast != null) {\n list.add(this.tileEast);\n }\n\n if (this.tileSouth != null) {\n list.add(this.tileSouth);\n }\n\n if (this.tileWest != null) {\n list.add(this.tileWest);\n }\n\n return list;\n }", "private LinkedList<int[]> neighborFinder(){\n LinkedList<int[]> neighborhood= new LinkedList<>();\n int[] curr_loc = blankFinder();\n int x = curr_loc[0];\n int y = curr_loc[1];\n if(x >0){\n neighborhood.add(new int[]{x-1, y});\n }\n if(x < n-1){\n neighborhood.add(new int[]{x+1, y});\n }\n if(y > 0){\n neighborhood.add(new int[]{x, y-1});\n }\n if(y < n-1) {\n neighborhood.add(new int[]{x, y+1});\n }\n\n\n return neighborhood;\n }", "List<Integer> getNeighbors(int x);", "private ArrayList<int[]> getAllNeighbours(int[] solution){\n ArrayList<int[]> neighbours = new ArrayList<int[]>();\n\n for(int i = 0; i <= solution.length - 1; i++){\n for(int j = solution.length - 1; j > i; j--){\n neighbours.add(getNeighbourSolution(solution, i, j));\n }\n }\n\n this.numberOfNeighbours = neighbours.size();\n return neighbours;\n }", "public Collection<N> neighbors();", "public MapCell[] getNeighbors(){\n\t\tMapCell[] neighbors = new MapCell[4];\n\t\tneighbors[0] = getNeighbor(\"east\");\n\t\tneighbors[1] = getNeighbor(\"north\");;\n\t\tneighbors[2] = getNeighbor(\"west\");\n\t\tneighbors[3] = getNeighbor(\"south\");\n\t\treturn neighbors;\n\t}", "public Collection<MyNode> getNeighbors(){\r\n return new ArrayList<>(this.neighbors);\r\n }", "public ArrayList<Integer> getNeighbours() {\n\t\tArrayList<Integer> result = new ArrayList<Integer>();\n\n\t\tfor (Border curBorder: allBorder) {\n\t\t\tresult.add(curBorder.countryID);\n\t\t}\n\n\t\treturn result;\n\t}", "private void addAllNeighbours(@NonNull final Location searchLoc) {\n for (int x = -1; x < 2; x++) {\n for (int y = -1; y < 2; y++) {\n if ((x == 0) && (y == 0)) {\n continue;\n }\n final long foundKey = Location.getKey(searchLoc.getScX() + x, searchLoc.getScY() + y,\n searchLoc.getScZ());\n synchronized (unchecked) {\n if (!unchecked.contains(foundKey)) {\n unchecked.add(foundKey);\n }\n }\n }\n }\n \n final long foundKey = Location.getKey(searchLoc.getScX(), searchLoc.getScY(), searchLoc.getScZ() + 1);\n synchronized (unchecked) {\n if (!unchecked.contains(foundKey)) {\n unchecked.add(foundKey);\n }\n }\n }", "public ArrayList<? extends Puzzle> getNeighbors();", "public List<Point> getPossibleNeighbours() {\n List<Point> points = new ArrayList<>();\n int x = point.getX();\n int y = point.getY();\n Arrays.asList(x - 1, x, x + 1).forEach(i -> {\n Arrays.asList(y - 1, y, y + 1).forEach(j -> {\n points.add(new Point(i, j));\n });\n });\n // remove self\n points.remove(new Point(x, y));\n return points;\n }", "public Collection<IntPair> findEmptyNeighbors(int x, int y);", "List<ConnectingFlights> getPossibleRoutes(int loc_start_id, int loc_end_id);", "public ArrayList<PuzzleState> getNeighbors() {\n\t\tArrayList<PuzzleState> neighbors = new ArrayList<PuzzleState>();\n\t\tPuzzleState neighbor;\n\t\t//System.out.println(\"getting neighbors.\");\n\t\tfor (String act: ACTIONS) {\n\t\t\tif (current.validAction(act)){\n\t\t\t\t//System.out.println(\"Action: \" + act + \" on \" + current.getString());\n\t\t\t\tneighbor = new PuzzleState(current.getString(current.getState()),\n\t\t\t\t\t\t\t\t\t\t\tcurrent.getString(current.getGoalState()));\n\t\t\t\tsearchCost++;\n\t\t\t\tneighbor.act(act);\n\t\t\t\tneighbors.add(neighbor);\n\t\t\t}\t\n\t\t}\n\t\treturn neighbors;\n\t}", "public ArrayList<CoordinateTile> getListOfNeighbours(int i, int j)\n\t{\n\t\tArrayList<CoordinateTile> allNeighbours = new ArrayList<CoordinateTile>();\n\t\tif(this.checkValidCoordinate(i, j+1))\n\t\t{\n\t\t\tallNeighbours.add(this.board[i][j+1]);\n\t\t}\n\t\tif(this.checkValidCoordinate(i, j-1))\n\t\t{\n\t\t\tallNeighbours.add(this.board[i][j-1]);\n\t\t}\n\t\tif(this.checkValidCoordinate(i+1, j))\n\t\t{\n\t\t\tallNeighbours.add(this.board[i+1][j]);\n\t\t}\n\t\tif(this.checkValidCoordinate(i-1, j))\n\t\t{\n\t\t\tallNeighbours.add(this.board[i-1][j]);\n\t\t}\n\t\treturn allNeighbours;\n\t}", "public List<Cell> getNeighbors() {\n return this.neighbors;\n }", "public Collection<Integer> getNeighbours(int i) {\n\t\n\tLinkable lble=(Linkable)Network.node[i].getProtocol(protocolID);\n\tArrayList<Integer> al = new ArrayList<Integer>(lble.degree());\n\tif( Network.node[i].isUp() )\n\t{\t\n\t\tfor(int j=0; j<lble.degree(); ++j)\n\t\t{\n\t\t\tfinal Node n = lble.getNeighbor(j);\n\t\t\t// if accessible, we include it\n\t\t\tif(n.isUp()) al.add(Integer.valueOf(n.getIndex()));\n\t\t}\n\t}\n\treturn Collections.unmodifiableList(al);\n}", "public List<Tile> getNeighbours() {\n \r\n return neighbours;\r\n }", "java.util.List<rina.object.gpb.Neighbour_t.neighbor_t> \n getNeighborList();", "public Iterable<Board> neighbors() {\n LinkedList<Board> states = new LinkedList<>();\n LinkedList<int[]> neighbors = neighborFinder();\n int[] curr_loc = blankFinder();\n\n for(int[] temp : neighbors){\n tiles[curr_loc[0]][curr_loc[1]] = tiles[temp[0]][temp[1]];\n tiles[temp[0]][temp[1]] = 0;\n states.add(new Board(deepCopy(tiles)));\n tiles[temp[0]][temp[1]] = tiles[curr_loc[0]][curr_loc[1]];\n tiles[curr_loc[0]][curr_loc[1]] = 0;\n\n }\n return states;\n }", "private List<MapLocation> getNeighbors(MapLocation current, Set<MapLocation> resourceLocations,\n\t\t\tMapLocation enemyFootmanLoc, int xExtent, int yExtent) {\n\n\t\tArrayList<MapLocation> neighbors = new ArrayList<MapLocation>();\n\t\tboolean deleted = false;\n\t\tint x = current.x;\n\t\tint y = current.y;\n\n\t\tneighbors.add(new MapLocation(x, y - 1, current, 1));\n\t\tneighbors.add(new MapLocation(x - 1, y, current, 1));\n\t\tneighbors.add(new MapLocation(x + 1, y, current, 1));\n\t\tneighbors.add(new MapLocation(x, y + 1, current, 1));\n\n\t\tfor (MapLocation potentialNeighbor : new ArrayList<MapLocation>(neighbors)) {\n\t\t\tdeleted = false;\n\t\t\tif (potentialNeighbor.x > xExtent || potentialNeighbor.x < 0 || potentialNeighbor.y > yExtent\n\t\t\t\t\t|| potentialNeighbor.y < 0) {\n\t\t\t\tneighbors.remove(potentialNeighbor);\n\t\t\t\tdeleted = true;\n\t\t\t}\n\t\t\tfor (MapLocation resource : resourceLocations) {\n\t\t\t\tif (!deleted && resource.x == potentialNeighbor.x && resource.y == potentialNeighbor.y) {\n\t\t\t\t\tneighbors.remove(potentialNeighbor);\n\t\t\t\t\tdeleted = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (enemyFootmanLoc != null && !deleted && enemyFootmanLoc.x == potentialNeighbor.x\n\t\t\t\t\t&& enemyFootmanLoc.y == potentialNeighbor.y) {\n\t\t\t\tneighbors.remove(potentialNeighbor);\n\t\t\t}\n\t\t}\n\t\treturn neighbors;\n\t}", "public java.util.List<Integer> getNeighbors(int index);", "private ArrayList<Location> getLocationsWithin(Location loc, int n)\n {\n ArrayList<Location> locs = new ArrayList<>();\n if (loc==null||!loc.isValid()||n<=0)\n return locs;\n int thisRow = loc.getRow();\n int thisCol = loc.getCol();\n for (int row=thisRow-n;row<=thisRow+n;row++)\n {\n for (int col=thisCol-n;col<=thisCol+n;col++)\n {\n Location temp = new Location(row,col);\n if (temp.isValid())\n locs.add(temp);\n }\n }\n return locs;\n }", "@Override\n public Iterable<WorldState> neighbors() {\n Queue<WorldState> neighbor = new ArrayDeque<>();\n int xDim = 0, yDim = 0;\n int[][] tiles = new int[_N][_N];\n\n for (int i = 0; i < _N; i++) {\n for (int j = 0; j < _N; j++) {\n tiles[i][j] = _tiles[i][j];\n if (_tiles[i][j] == 0) {\n xDim = i;\n yDim = j;\n }\n }\n }\n\n for (int i = 0; i < _N; i++) {\n for (int j = 0; j < _N; j++) {\n if (Math.abs(i - xDim) + Math.abs(j - yDim) == 1) {\n tiles[i][j] = _tiles[xDim][yDim];\n tiles[xDim][yDim] = _tiles[i][j];\n neighbor.add(new Board(tiles));\n // System.out.println(new Board(tiles));\n tiles[xDim][yDim] = _tiles[xDim][yDim];\n tiles[i][j] = _tiles[i][j];\n }\n }\n }\n return neighbor;\n }", "public List<Float> getBoundingsOfCell() {\n\n\t\tfloat minXPoint = Float.POSITIVE_INFINITY;\n\t\tfloat maxXPoint = Float.NEGATIVE_INFINITY;\n\t\tfloat minYPoint = Float.POSITIVE_INFINITY;\n\t\tfloat maxYPoint = Float.NEGATIVE_INFINITY;\n\n\t\tfor (int i = 0; i < face.edges().size(); i++) {\n\n\t\t\tDCEL_Edge e = (DCEL_Edge) face.edges().get(i);\n\n\t\t\tArc2_Sweep arc = (Arc2_Sweep) e.reference;\n\n\t\t\t// Looking for most left located point of cell\n\t\t\tif (minXPoint > arc.minX().x) {\n\t\t\t\tminXPoint = arc.minX().x;\n\t\t\t}\n\t\t\t// Looking for most right located point of cell\n\t\t\tif (maxXPoint < arc.maxX().x) {\n\t\t\t\tmaxXPoint = arc.maxX().x;\n\t\t\t}\n\t\t\t// Looking for highest located point of cell\n\t\t\tif (minYPoint > arc.minY().y) {\n\t\t\t\tminYPoint = arc.minY().y;\n\t\t\t}\n\t\t\t// Looking for lowest located point of cell\n\t\t\tif (maxYPoint < arc.maxY().y) {\n\t\t\t\tmaxYPoint = arc.maxY().y;\n\t\t\t}\n\n\t\t}\n\n\t\tList<Float> boundings = new ArrayList<Float>();\n\t\tboundings.add(minXPoint);\n\t\tboundings.add(maxXPoint);\n\t\tboundings.add(minYPoint);\n\t\tboundings.add(maxYPoint);\n\t\treturn boundings;\n\n\t}", "public ArrayList<Cell> getNeighbours(int radius) {\r\n return locateCell.getAdjacentCells(radius);\r\n }", "public ArrayList<Integer> neighNumbers() {\n ArrayList<Integer> neighNumbers = new ArrayList<Integer>();\n if(isValid(this.frame-10)) { neighNumbers.add(this.frame-10); }\n if(isValid(this.frame+10)) { neighNumbers.add(this.frame+10); }\n\n //Right edge\n if(this.frame % 10 == 0) {\n if(isValid(this.frame+9)) { neighNumbers.add(this.frame+9); }\n if(isValid(this.frame-1)) { neighNumbers.add(this.frame-1); }\n if(isValid(this.frame-11)) { neighNumbers.add(this.frame-11); }\n\n }\n\n //Left edge\n else if((this.frame -1) % 10 == 0) {\n if(isValid(this.frame-9)) { neighNumbers.add(this.frame-9); }\n if(isValid(this.frame+1)) { neighNumbers.add(this.frame+1); }\n if(isValid(this.frame+11)) { neighNumbers.add(this.frame+11); }\n }\n\n else {\n if(isValid(this.frame-11)) { neighNumbers.add(this.frame-11); }\n if(isValid(this.frame+11)) { neighNumbers.add(this.frame+11); }\n if(isValid(this.frame-1)) { neighNumbers.add(this.frame-1); }\n if(isValid(this.frame+1)) { neighNumbers.add(this.frame+1); }\n if(isValid(this.frame-9)) { neighNumbers.add(this.frame-9); }\n if(isValid(this.frame+9)) { neighNumbers.add(this.frame+9); }\n }\n\n return neighNumbers;\n }", "public ArrayList<Location> getValid(Location loc) {\n\n\tGrid<Actor> grid = getGrid();\n\tif (grid == null)\n\t return null;\n\n\tArrayList<Location> valid = new ArrayList<Location>();\n\tArrayList<Location> lastNode = crossLocation.peek();\n\tint[] dirs =\n { Location.SOUTH, Location.NORTH, Location.EAST, Location.WEST };\n\n\t// get the empty and valid location in the desire directions\n for (int d : dirs) {\n\n\t Location neighborLoc = loc.getAdjacentLocation(getDirection() + d);\n\t\t if (!lastNode.contains(neighborLoc) && grid.isValid(neighborLoc)) {\n\t\t\t\n\t\t\tActor actor = (Actor) grid.get(neighborLoc);\n\t\t\tif (grid.get(neighborLoc) == null || actor instanceof Flower) {\n\t\t\t \n\t\t\t valid.add(neighborLoc);\n\t\t\t} \n\t\t\n\t\t\tif (actor instanceof Rock && actor.getColor() == Color.RED) {\n\t\t\t\n\t\t\t isEnd = true;\n\t\t\t}\n\t\t }\n\t }\n\t \n\t\treturn valid;\n }", "@Override\n\tpublic List<Location> getNeighbors(Location vertex) {\n\n\t\tArrayList<Location> neighbors = new ArrayList<Location>();\n\n\t\tfor (Path p : getOutEdges(vertex))\n\t\t\tneighbors.add(p.getDestination());\n\n\t\treturn neighbors;\n\n\n\t}", "public ArrayList<ArrayList<Pokemon>> getlistOfNeighborhoods()\n\t{\n\t\treturn ((ArrayList<ArrayList<Pokemon>>)(listOfNeighborhoods.clone()));\n\t}", "private ArrayList<Integer> setUnvisitedNeighbors(int currentIndex) {\n\t\t\n\t\tint row = currentIndex / width;\t\t\t\t\t\t\t\t\t\t\t\t//number of row\n\t\tint column = currentIndex % width;\t\t\t\t\t\t\t\t\t\t\t//number of column\n\t\t\n\t\tArrayList<Integer> neighbors = new ArrayList<Integer>();\n\t\t\n\t\tif(row != 0 && !cells[currentIndex - width].visited ) {\t\t\t\t\t\t// cell has upper neighbor\n\t\t\tint upperIndex = ((row - 1) * width) + column;\n\t\t\tneighbors.add(upperIndex);\n\t\t}\n\t\tif(row != height - 1 && !cells[currentIndex + width].visited ) {\t\t\t//cell has lower neighbor\n\t\t\tint lowerIndex = ((row + 1) * width) + column;\n\t\t\tneighbors.add(lowerIndex);\n\t\t}\n\t\tif(column != 0 && !cells[currentIndex - 1].visited) {\t\t\t\t\t\t//cell has left neighbor\n\t\t\tint leftIndex = currentIndex - 1;\n\t\t\tneighbors.add(leftIndex);\n\t\t}\n\t\tif(column != width - 1 && !cells[currentIndex + 1].visited) {\t\t\t\t//cell has right neighbor\n\t\t\tint rightIndex = currentIndex + 1;\n\t\t\tneighbors.add(rightIndex);\n\t\t}\n\t\treturn neighbors;\n\t}", "public List<Integer> getNeighbourIds() {\n List<Integer> neighbours = new ArrayList<>();\n // get references from the neighbouring cells.\n for (VoronoiHalfEdge halfEdge : halfEdges) {\n VoronoiEdge edge = halfEdge.getEdge();\n if (edge.getLeftSite() != null && edge.getLeftSite().getIdentifier() != site.getIdentifier()) {\n neighbours.add(edge.getLeftSite().getIdentifier());\n } else if (edge.getRightSite() != null && edge.getRightSite().getIdentifier() != site.getIdentifier()) {\n neighbours.add(edge.getRightSite().getIdentifier());\n }\n }\n return neighbours;\n }", "@Override\n\tpublic List<Integer> getNeighbours(int v) {\n\t\treturn null;\n\t}", "public List<Board> neighbors(int player)\n\t{\n\t\tList<Board> ret = new ArrayList<Board>();\n\t\t\n\t\tList<Integer> moves = getLegalMoves();\n\t\tfor (int i : moves)\n\t\t{\n\t\t\tret.add(makeMove(i,player));\n\t\t}\n\t\t\n\t\treturn ret;\n\t}", "private List<CellIndex> getNeighbours( CellIndex index )\r\n {\n List<CellIndex> neighbours = new ArrayList<World.CellIndex>();\r\n if( index.x % EnvSettings.getMAX_X() != 0 )\r\n {\r\n neighbours.add( new CellIndex( index.x - 1, index.y, index.z ) );\r\n }\r\n if( index.x % EnvSettings.getMAX_X() != EnvSettings.getMAX_X() - 1 )\r\n {\r\n neighbours.add( new CellIndex( index.x + 1, index.y, index.z ) );\r\n }\r\n if( index.y % EnvSettings.getMAX_Y() != 0 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y - 1, index.z ) );\r\n }\r\n if( index.y % EnvSettings.getMAX_Y() != EnvSettings.getMAX_Y() - 1 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y + 1, index.z ) );\r\n }\r\n if( index.z % EnvSettings.getMAX_Z() != 0 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y, index.z - 1 ) );\r\n }\r\n if( index.z % EnvSettings.getMAX_Z() != EnvSettings.getMAX_Z() - 1 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y, index.z + 1 ) );\r\n }\r\n return neighbours;\r\n }", "public ArrayList<Location> getLocations()\n {\n ArrayList<Location> locs = new ArrayList<>();\n for (int row = 0; row < squares.length; row++)\n {\n for (int col = 0; col < squares[0].length; col++)\n {\n locs.add(new Location(row,col));\n }\n }\n return locs;\n }", "Set<MacAddress> neighbors();", "private ArrayList<Point> getNeighbors(Point p) {\n\t\tArrayList<Point> arr = new ArrayList<Point>();\n\t\tfor (int y = -1; y <= 1; y++) {\n\t\t\tfor (int x = -1; x <= 1; x++) {\n\t\t\t\tPoint npoint = new Point( p.x + x, p.y + y);\n\t\t\t\tint sind = spacesContains(npoint);\n\t\t\t\tif ( p.compareTo(npoint) != 0 && sind >= 0 ) { \n\t\t\t\t\tarr.add( spaces.get(sind) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn arr;\n\t}", "@Override\n public List<V> getNeighbors(V v, TimeFrame pTimeFrame) {\n List<V> lstNeighbors = new ArrayList<>();\n// System.out.println(\"DynamicGraph.getNeighbor() : \" + darrGlobalAdjList.get(v.getId()).get(pTimeFrame));\n if (darrGlobalAdjList.get(v.getId()).containsKey(pTimeFrame)) {\n for (E e : darrGlobalAdjList.get(v.getId()).get(pTimeFrame)){\n if (e.getOtherEndPoint(v) != null) {\n lstNeighbors.add(e.getOtherEndPoint(v));\n }\n }\n }\n return lstNeighbors;\n }", "int[] neighbor(int sourceId) {\n\t\tint opposite = ((sourceId + 2) > amount - 1) ? (sourceId + 2) - amount : sourceId + 2; // needed\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// for\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 2\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// ir\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 3\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// array\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// points\n\t\tint neighborLeft = ((sourceId + 1) > amount - 1) ? (sourceId + 1) - amount : sourceId + 1; // neede\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// only\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// for\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 3\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// array\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// point\n\t\tint neighborRight = ((sourceId - 1) < 0) ? amount + (sourceId - 1) : sourceId - 1; // neede\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// only\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// for\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// array\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// pointer\n\t\tint[] neighbors = { neighborLeft, neighborRight, opposite // 0, 1, 2\n\t\t};\n\t\treturn neighbors;\n\t}", "public ArrayList<Direction> allowedDirections(Location location) {\r\n\t\tint proposedStrength = location.getSite().production;\r\n\t\tArrayList<Direction> allowedDirection = new ArrayList<Direction>();\r\n\t\tArrayList<Location> allowedNeighbors = new ArrayList<Location>(4);\r\n\t\tallowedNeighbors = location.getNeighbors(location, map, 1);\r\n\t\t// Iterating the allowedNeighbors array\r\n\t\tfor (int i = 0; i < allowedNeighbors.size(); i++) {\r\n\t\t\t// for each neighbor, we check if the square can move in its\r\n\t\t\t// direction\r\n\t\t\tLocation currentNeighbor = allowedNeighbors.get(i);\r\n\t\t\tif (currentNeighbor.getNeighborDirection(location, currentNeighbor, map) != Direction.STILL)\r\n\t\t\t\tif (currentNeighbor.getSite().isAllowed(proposedStrength)) {\r\n\t\t\t\t\tallowedDirection.add(currentNeighbor.getNeighborDirection(location, currentNeighbor, map));\r\n\t\t\t\t}\r\n\r\n\t\t}\r\n\t\treturn allowedDirection;\r\n\t}", "protected abstract List<Integer> getNeighbors(int vertex);", "public Vector getNeighbors()\n\t{\n\t\tVector neighbors = new Vector(8);\n\t\t\n\t\tneighbors.addElement(getNeighbor(NORTH));\n\t\tneighbors.addElement(getNeighbor(NORTHEAST));\n\t\tneighbors.addElement(getNeighbor(EAST));\n\t\tneighbors.addElement(getNeighbor(SOUTHEAST));\n\t\tneighbors.addElement(getNeighbor(SOUTH));\n\t\tneighbors.addElement(getNeighbor(SOUTHWEST));\n\t\tneighbors.addElement(getNeighbor(WEST));\n\t\tneighbors.addElement(getNeighbor(NORTHWEST));\n\n\t\treturn neighbors;\n\t}", "public static List<HantoCoordinate> getAllNeighbors(HantoCoordinate c){\n\n\t\tList<HantoCoordinate> neighbors = new ArrayList<HantoCoordinate>();\n\n\t\tneighbors.add(new HantoCoord(c.getX(), c.getY() - 1));\n\t\tneighbors.add(new HantoCoord(c.getX(), c.getY() + 1));\n\t\tneighbors.add(new HantoCoord(c.getX() - 1, c.getY()));\n\t\tneighbors.add(new HantoCoord(c.getX() - 1, c.getY() + 1));\n\t\tneighbors.add(new HantoCoord(c.getX() + 1, c.getY()));\n\t\tneighbors.add(new HantoCoord(c.getX() + 1, c.getY() - 1));\n\n\t\treturn neighbors;\n\t}", "private ArrayList<Position3D> findNeighbors(Position3D current, Maze3D myMaze,boolean [][][]VisitedCells) throws Exception {\n ArrayList<Position3D> neighbors = new ArrayList<>();\n //for each neighbor, add him into the neighbors array, if it's on the grid (maze), if it's not a corner, not the current position itself, and it's unvisited\n //iterate over all neighbors in the same depth\n for (int x = current.getRowIndex()-2; x < current.getRowIndex()+3; x=x+2) {\n for (int y = current.getColumnIndex()-2; y < current.getColumnIndex()+3 ; y=y+2) {\n if (pointOnGrid(current.getDepthIndex(),x, y, myMaze) && pointNotCorner(current ,current.getDepthIndex(), x, y)\n && pointNotMyCell(current,current.getDepthIndex(), x, y) && !(Visited(current.getDepthIndex(),x,y,VisitedCells))) {\n neighbors.add(new Position3D(current.getDepthIndex(),x, y));\n }\n }\n }\n //check the options from the other depths\n\n if (pointOnGrid(current.getDepthIndex()+2,current.getRowIndex(), current.getColumnIndex(), myMaze) && !(Visited(current.getDepthIndex()+2,current.getRowIndex(),current.getColumnIndex(),VisitedCells))){\n neighbors.add(new Position3D(current.getDepthIndex()+2,current.getRowIndex(), current.getColumnIndex()));\n }\n if (pointOnGrid(current.getDepthIndex()-2,current.getRowIndex(), current.getColumnIndex(), myMaze) && !(Visited(current.getDepthIndex()-2,current.getRowIndex(),current.getColumnIndex(),VisitedCells))){\n neighbors.add(new Position3D(current.getDepthIndex()-2,current.getRowIndex(), current.getColumnIndex()));\n }\n return neighbors;\n }", "public List<StudyLocation> getStudyLocationsByLocId(Integer id) {\n\t\tSqlSession session = connectionFactory.sqlSessionFactory.openSession();\r\n\t\tStudyLocationMapper studyLocationMapper = session.getMapper(StudyLocationMapper.class);\r\n\t\ttry {\r\n\t\t\tStudyLocationExample example = new StudyLocationExample();\r\n\t\t\texample.createCriteria().andLocationidEqualTo(id);\r\n\t\t\tList<StudyLocation> studyLocations = studyLocationMapper.selectByExample(example);\r\n\t\t\treturn studyLocations;\r\n\t\t} finally {\r\n\t\t\tsession.close();\r\n\t\t}\r\n\t}", "private ArrayList<GridPiece> getDirectNeighbors(GridPiece piece) {\n neighbors.clear();\n\n //Top\n if (game.gridMap.size() > piece.row + 1) {\n neighbors.add(game.gridMap.get(piece.row + 1).get(piece.column));\n }\n //Bottom\n if (piece.row > 0) {\n neighbors.add(game.gridMap.get(piece.row - 1).get(piece.column));\n }\n\n //Right\n if (game.gridMap.get(0).size() > piece.column + 1) {\n neighbors.add(game.gridMap.get(piece.row).get(piece.column + 1));\n }\n\n //Left\n if (piece.column > 0) {\n neighbors.add(game.gridMap.get(piece.row).get(piece.column - 1));\n }\n\n return neighbors;\n }", "protected Cell[] getNeighbours() {\r\n\t\treturn this.neighbours;\r\n\t}", "public List<Edge> getNeighbors() {\n\t\treturn neighbors;\n\t}", "public abstract List<AStarNode> getNeighbours();", "public ArrayList<Location> getValid(Location loc) {\r\n Grid<Actor> gr = getGrid();\r\n if (gr == null) {\r\n return null;\r\n }\r\n ArrayList<Location> valid = new ArrayList<Location>();\r\n // 向上右下左四个方向找\r\n int dirs[] = {\r\n Location.AHEAD, Location.RIGHT, Location.HALF_CIRCLE,\r\n Location.LEFT };\r\n for (int i = 0; i < dirs.length; i++) {\r\n Location tarLoc = loc.getAdjacentLocation(dirs[i]);\r\n if (gr.isValid(tarLoc)) {\r\n if (gr.get(tarLoc) == null) {\r\n valid.add(tarLoc);\r\n }\r\n }\r\n }\r\n return valid;\r\n }", "Neighbors() {\n HashMap<Integer, Double> neighbors = new HashMap<>();\n }", "public ArrayList<Location> getMoveLocations()\n {\n ArrayList<Location> locs = new ArrayList<Location>();\n ArrayList<Location> validLocations = getGrid().getValidAdjacentLocations(getLocation());\n for (Location neighborLoc : validLocations)\n {\n if (getGrid().get(neighborLoc) == null || getGrid().get(neighborLoc) instanceof AbstractPokemon || getGrid().get(neighborLoc) instanceof PokemonTrainer)\n locs.add(neighborLoc);\n }\n return locs;\n }", "public ArrayList<Integer[]> getMineLocations()\n {\n return mineLocations;\n }", "private List<Node> getNeighbors(Node node) {\n List<Node> neighbors = new LinkedList<>();\n\n for(Node adjacent : node.getAdjacentNodesSet()) {\n if(!isSettled(adjacent)) {\n neighbors.add(adjacent);\n }\n }\n\n return neighbors;\n }", "public int[] getNeighbours(int node) {\n ArrayList ns = new ArrayList(10);// should be plenty\n for (int i = 0; i < nodeCount; i++)\n if (roads[node][i] > 0)\n ns.add(Integer.valueOf(i));\n int[] nbs = new int[ns.size()];\n for (int i = 0; i < ns.size(); i++)\n nbs[i] = ((Integer) ns.get(i)).intValue();\n return nbs;\n }", "@Override\r\n\tpublic List<Coordinate> getPossibleLocations(Coordinate currentLocation) {\r\n\r\n\t\tList<Coordinate> possibleCoordinates = new ArrayList<Coordinate>();\r\n\t\tint x = currentLocation.getX();\r\n\t\tint y = currentLocation.getY();\r\n\t\twhile (x > 0 && y > 0) {\r\n\t\t\tx--;\r\n\t\t\ty--;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\r\n\t\twhile (x < Board.SIZE - 1 && y < Board.SIZE - 1) {\r\n\t\t\tx++;\r\n\t\t\ty++;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\r\n\t\twhile (x > 0 && y < Board.SIZE - 1) {\r\n\t\t\tx--;\r\n\t\t\ty++;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\t\twhile (x < Board.SIZE - 1 && y > 0) {\r\n\t\t\tx++;\r\n\t\t\ty--;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\t\treturn possibleCoordinates;\r\n\t}", "public interface INeighbor {\n public Set<Cell> getNeighbours();\n}", "public ArrayList<Node> getNeighbors(){\n ArrayList<Node> result = new ArrayList<Node>();\n for(Edge edge: edges){\n result.add(edge.end());\n }\n return result;\n }", "public Set<Integer> getNeighbors() {\n HashSet<Integer> retSet = new HashSet<Integer>();\n retSet.addAll(this.getActiveNeighbors());\n retSet.addAll(this.purgedNeighbors);\n\n return retSet;\n }", "public ArrayList<Location> getAdjacentLocations(Location loc)\n {\n ArrayList<Location> locations = new ArrayList<>();\n for (Direction d: Direction.values())\n {\n if (loc.farther(d).isValid())\n locations.add(loc.farther(d));\n }\n return locations;\n }", "ArrayList<PathFindingNode> neighbours(PathFindingNode node);", "public void findNeighbours(ArrayList<int[]> visited , Grid curMap) {\r\n\t\tArrayList<int[]> visitd = visited;\r\n\r\n\t\t//System.out.println(\"FROM FIND NEIGHBOURS cur pos:\" +Arrays.toString(nodePos));\r\n\t\t//for(int j=0; j<visitd.size();j++) {\r\n\t\t\t//System.out.println(\"FROM FIND NEIGHBOURS\" +Arrays.toString(visited.get(j)));\r\n\t\t\t//System.out.println(\"FROM FIND NEIGHBOURS getvstd\" +Arrays.toString(visited.get(j)));\r\n\t\t//}\r\n\t\t//System.out.println(\"FROM FIND NEIGHBOURS\" +visited);\r\n\t\tCell left=curMap.getCell(0, 0);\r\n\t\tCell right=curMap.getCell(0, 0);\r\n\t\tCell upper=curMap.getCell(0, 0);\r\n\t\tCell down=curMap.getCell(0, 0);\r\n\t\t//the getStart() method returns x,y coordinates representing the point in x,y axes\r\n\t\t//so if either of [0] or [1] coordinate is zero then we have one less neighbor\r\n\t\tif (nodePos[1]> 0) {\r\n\t\t\tupper=curMap.getCell(nodePos[0], nodePos[1]-1) ; \r\n\t\t}\r\n\t\tif (nodePos[1] < M-1) {\r\n\t\t\tdown=curMap.getCell(nodePos[0], nodePos[1]+1);\r\n\t\t}\r\n\t\tif (nodePos[0] > 0) {\r\n\t\t\tleft=curMap.getCell(nodePos[0] - 1, nodePos[1]);\r\n\t\t}\r\n\t\tif (nodePos[0] < N-1) {\r\n\t\t\tright=curMap.getCell(nodePos[0]+1, nodePos[1]);\r\n\t\t}\r\n\t\t//for(int i=0;i<visitd.size();i++) {\r\n\t\t\t//System.out.println(Arrays.toString(visitd.get(i)));\t\r\n\t\t//}\r\n\t\t\r\n\t\t//check if the neighbor is wall,if its not add to the list\r\n\t\tif(nodePos[1]>0 && !upper.isWall() && (!exists(visitd,new int[] {nodePos[0], nodePos[1] - 1}))) {\r\n\t\t\t//Node e=new Node(this , this.N , this.M , new int[] {nodePos[0], nodePos[1] - 1},curMap);\r\n\t\t\t//if(e.getVisited()!=true) {\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0], nodePos[1] - 1}, curMap)); // father of the new nodes is this node\r\n\t\t\t//}\r\n\t\t}\r\n\t\tif(nodePos[1]<M-1 &&!down.isWall() && (!exists(visitd,new int[] {nodePos[0], nodePos[1] + 1}))){\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0], nodePos[1] + 1}, curMap));\r\n\t\t}\r\n\t\tif(nodePos[0]>0 && !left.isWall() && (!exists(visitd,new int[] {nodePos[0] - 1, nodePos[1]}))) {\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0] - 1, nodePos[1]}, curMap));\r\n\t\t}\r\n\t\tif(nodePos[0]<N-1 && !right.isWall() && (!exists(visitd,new int[] {nodePos[0] + 1, nodePos[1]}))) {\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0] + 1, nodePos[1]}, curMap));\r\n\t\t}\r\n\t\t//for(int i=0; i<NodeChildren.size();i++) {\r\n\t\t\t//System.out.println(\"Paidia sth find:\" + Arrays.toString(NodeChildren.get(i).getNodePos()));\r\n\t\t//}\r\n\t\t\t\t\t\t\r\n\t}", "public ArrayList<Location> getEmptyAdjacentLocations(Location loc)\n {\n ArrayList<Location> locations = getAdjacentLocations(loc);\n for (Direction d: Direction.values())\n {\n Location temp = loc.farther(d);\n if (getPiece(temp)==null)\n locations.add(temp);\n }\n return locations;\n }", "@Override\n\tpublic List<Cell> getImmediateNeighbors(Cell cell) {\n\t\tList<Cell> neighbors = new ArrayList<Cell>();\n\t\tint north, east, south, west;\n\t\t\n\t\tnorth = getNorthCell(cell);\n\t\teast = getEastCell(cell);\n\t\tsouth = getSouthCell(cell);\n\t\twest = getWestCell(cell);\n\t\t\n\t\tif (north != -1) { neighbors.add(getCellList().get(north)); }\n\t\tif (east != -1) { neighbors.add(getCellList().get(east)); }\n\t\tif (south != -1) { neighbors.add(getCellList().get(south)); }\n\t\tif (west != -1) { neighbors.add(getCellList().get(west)); }\n\t\t\n\t\treturn neighbors;\n\t}", "public ArrayList<ArrayList<Integer>> getValidMoves(Board b, int playerID) {\n\t\t// Array met mogelijke zetten\n\t\tArrayList<ArrayList<Integer>> validMoves = new ArrayList<ArrayList<Integer>>();\n\n\t\t// alle mogelijke zetten opslaan in arraylist\n\t\tint boardsize = b.getBoardSize();\n\t\tfor (int x = 0; x < boardsize; x++) {\n\t\t\tfor (int y = 0; y < boardsize; y++) {\n\n\t\t\t\t// check of het veld leeg is (volle vakken zijn nooit geldig)\n\t\t\t\tif (b.getPiece(y, x) == 0) {\n\t\t\t\t\tArrayList<Integer> tempList = new ArrayList<Integer>();\n\t\t\t\t\tArrayList<Integer> tempAdd = new ArrayList<Integer>();\n\t\t\t\t\t// check in elke richting of de zet geldig is:\n\t\t\t\t\t// noordwest\n\t\t\t\t\ttempAdd = checkDirection(x, y, -1, -1, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// noord\n\t\t\t\t\ttempAdd = checkDirection(x, y, 0, -1, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// noordoost\n\t\t\t\t\ttempAdd = checkDirection(x, y, 1, -1, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// oost\n\t\t\t\t\ttempAdd = checkDirection(x, y, 1, 0, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// zuidoost\n\t\t\t\t\ttempAdd = checkDirection(x, y, 1, 1, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// zuid\n\t\t\t\t\ttempAdd = checkDirection(x, y, 0, 1, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// zuidwest\n\t\t\t\t\ttempAdd = checkDirection(x, y, -1, 1, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// west\n\t\t\t\t\ttempAdd = checkDirection(x, y, -1, 0, playerID, b);\n\t\t\t\t\tif (tempAdd.isEmpty() == false) {\n\t\t\t\t\t\ttempList.addAll(tempAdd);\n\t\t\t\t\t}\n\t\t\t\t\t// Zo lang er 1 bracket beschikbaar is, wordt de zet toegevoegd aan validMoves\n\t\t\t\t\tif (tempList.isEmpty() == false) {\n\t\t\t\t\t\tvalidMoves.add(tempList);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn validMoves;\n\t}", "public static ArrayList<XYCoord> findVisibleLocations(GameMap map, XYCoord origin, int range, boolean piercing)\n {\n ArrayList<XYCoord> locations = new ArrayList<XYCoord>();\n\n // Loop through all the valid x and y offsets, as dictated by the max range, and add valid spaces to our collection.\n for( int yOff = -range; yOff <= range; ++yOff )\n {\n for( int xOff = -range; xOff <= range; ++xOff )\n {\n int currentRange = Math.abs(xOff) + Math.abs(yOff);\n XYCoord coord = new XYCoord(origin.xCoord + xOff, origin.yCoord + yOff);\n if( currentRange <= range && map.isLocationValid(coord) )\n {\n // If we're adjacent, or we can see through cover, or it's *not* cover, we can see into it.\n if( piercing || !map.getEnvironment(coord).terrainType.isCover() )\n {\n // Add this location to the set.\n locations.add(coord);\n }\n }\n }\n }\n\n return locations;\n }", "public void solver(int id) {\n String boardLetters = boggleModel.getBoardLetters().toLowerCase();\n Character letter = boardLetters.charAt(id);\n\n\n HashSet<String> words = boggleModel.possibleWords;\n\n // for each word check if character[x] is a neighbour if the startLetter - id -\n for (String word : words) {\n int x = 1;\n // When word(0) == \"a\" and letter is \"a\".. check\n if (word.charAt(0) == letter) {\n List<Integer> usedIDs = new ArrayList<>();\n\n\n usedIDs.add(id);\n checkNeighbours(word, id, x, usedIDs);\n }\n }\n }", "public ArrayList<Integer> getInNeighbors (int nodeId) {\r\n\t\tArrayList<Integer> inNeighbors = new ArrayList<Integer>();\r\n\t\t// the set of incoming edge ids\r\n\t\tSet<Integer> edgeSet = mInEdges.get(nodeId);\r\n\t\tfor(Integer edgeId: edgeSet) {\r\n\t\t\tinNeighbors.add( getEdge(edgeId).getFromId() );\r\n\t\t}\r\n\t\treturn inNeighbors;\r\n\t}", "private ArrayList<Location> getValid(Location loc) {\n Grid<Actor> gr = getGrid();\n if (gr == null) {\n return null;\n }\n ArrayList<Map.Entry<Location, Integer>> validPair = new ArrayList<>();\n for (int i = 0; i < Location.FULL_CIRCLE; i += Location.RIGHT) {\n Location locNext = loc.getAdjacentLocation(i);\n if (!gr.isValid(locNext)) {\n continue;\n }\n Actor actor = gr.get(locNext);\n if (actor == null || actor instanceof Flower || (actor instanceof Rock && actor.getColor().equals(Color.RED))) {\n validPair.add(new AbstractMap.SimpleEntry<>(locNext, probability[i / Location.RIGHT]));\n }\n }\n return sortArrayListRandomly(getValidWithProbability(validPair));\n }", "public ArrayList<Territory> getNeighbours() {\n\t\treturn neighbours;\n\t}", "public static List<FeedbackLocation> searchFeedbackLocation(int id){\r\n\t\t\r\n\t\ttry {\r\n\t\t\tList<FeedbackLocation> feedbacks = FeedbackManager.searchFeedbackLocation(id);\r\n\t\t\treturn feedbacks;\r\n\t\t} catch (SQLException | DBException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "public ArrayList<ArrayList<Integer>> getNeighbors(\n ArrayList<Integer> config){\n\n //Set up the return value;\n ArrayList<ArrayList<Integer>> toReturn = \n new ArrayList<ArrayList<Integer>>();\n\n ArrayList<Integer> nextNeighbor;\n\n //Go through all characters and build moves\n for (int i = 0; i < config.size(); i++) {\n if(config.get(i) == '.'){ continue; }\n //Get legal moves\n ArrayList<Integer> myMoves = getMoves(i, config);\n\n //Generate all moves\n for(int t = 0; t < myMoves.size(); t++) {\n nextNeighbor = moveUnit(i, myMoves.get(t), config);\n //Check if done before.\n if (!tried.contains(nextNeighbor)) {\n tried.add(nextNeighbor);\n toReturn.add(nextNeighbor);\n }\n }\n }\n\n return toReturn;\n }", "ArrayList<Location> getMoveLocations();", "public List<Location> getValidSurroundingLocations(ArenaWorld world, ArenaAnimal animal,\n List<Location> surroundingLocations) {\n\n Iterator<Location> locationIterator = surroundingLocations.iterator();\n while (locationIterator.hasNext()) {\n Location location = locationIterator.next();\n if (!checkValidity(world, animal, location))\n locationIterator.remove();\n\n }\n\n List<Location> validSurroundingLocations = new LinkedList<Location>(surroundingLocations);\n return validSurroundingLocations;\n }", "public int[] getNeighborhoodArray()\n\t{\n\t\treturn neighborhoodArray;\n\t}", "@SuppressWarnings(\"unchecked\")\n\tpublic ArrayList<Node<A>> neighbours(){\n\t\t\n\t\tArrayList<Node<A>> output = new ArrayList<Node<A>>();\n\t\t\n\t\tif (g == null) return output;\n\t\t\n\t\tfor (Object o: g.getEdges()){\n\n\t\t\t\n\t\t\tif (((Edge<?>)o).getTo().equals(this)) {\n\t\t\t\t\n\t\t\t\tif (!output.contains(((Edge<?>)o).getFrom()))\n\t\t\t\t\t\toutput.add((Node<A>) ((Edge<?>)o).getFrom());\n\t\t\t\t\n\t\t\t}\n\n\t\t} \n\t\treturn output;\n\t\t\n\t}", "private ArrayList<BooleanProperty> checkSurroundings(int layoutX, int layoutY) {\n\n ArrayList<BooleanProperty> neighbors = new ArrayList<>();\n BooleanProperty[][] gameCells = controller.getGameCells();\n\n for (int i = layoutX - 1; i <= layoutX + 1; i++) {\n for (int j = layoutY - 1; j <= layoutY + 1; j++) {\n\n if (!(i == layoutX && j == layoutY)) {\n if (i < gameCells.length && i > -1 && j < gameCells[i].length && j > -1 && gameCells[i][j].get()) {\n neighbors.add(gameCells[i][j]);\n }\n }\n }\n }\n return neighbors;\n }", "public int[] getUnderlyingNeighbours(int node) {\n ArrayList ns = new ArrayList(10);// should be plenty\n for (int i = 0; i < nodeCount; i++)\n if (roads[node][i] > 0 || roads[i][node] > 0)\n ns.add(Integer.valueOf(i));\n int[] nbs = new int[ns.size()];\n for (int i = 0; i < ns.size(); i++)\n nbs[i] = ((Integer) ns.get(i)).intValue();\n return nbs;\n }", "public SmartList<Square> getNeighbors(Square square) {\n return this.squares.select(x -> x.isNeighborOf(square)).freeze();\n }", "Map<Coord, ICell> getAllCells();", "public static ArrayList<XYCoord> findVisibleLocations(GameMap map, XYCoord origin, int range)\n {\n return findVisibleLocations(map, origin, range, false);\n }", "public Iterable<Board> neighbors() {\n int emptyRow = -1; // Row of the empty tile\n int emptyCol = -1; // Column of the empty tile\n\n // Iterate through each tile in the board, searching for empty tile\n search:\n for (int row = 0; row < N; row++) // For each row in the board\n for (int col = 0; col < N; col++) // For each column in the row\n if (tiles[row][col] == 0) { // If the current tile is empty (value of 0)\n emptyRow = row; // Store the row of the empty tile\n emptyCol = col; // Store the column of the empty tile\n break search; // Break from search\n }\n\n Stack<Board> neighbors = new Stack<Board>(); // Initialize a stack of neighboring board states\n\n if (emptyRow - 1 >= 0) // If there is a row of tiles above the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow - 1, emptyCol)); // Swap empty tile with the above adjacent tile and add to neighbors stack\n\n if (emptyRow + 1 < N) // If there is a row of tiles below the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow + 1, emptyCol)); // Swap empty tile with the below adjacent tile and add to neighbors stack\n\n if (emptyCol - 1 >= 0) // If there is a column of tiles to the left of the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow, emptyCol - 1)); // Swap empty tile with the left adjacent tile and add to neighbors stack\n\n if (emptyCol + 1 < N) // If there is a column of tiles to the right of the empty tile\n neighbors.push(swap(emptyRow, emptyCol, emptyRow, emptyCol + 1)); // Swap empty tile with the right adjacent tile and add to neighbors stack\n\n return neighbors; // Return iterable stack of neighboring board states\n }", "@NotNull\n\tjava.util.List<@NotNull Location> getSpawnLocations();", "private void getNeighbors() {\n\t\tRowIterator iterator = currentGen.iterateRows();\n\t\twhile (iterator.hasNext()) {\n\t\t\tElemIterator elem = iterator.next();\n\t\t\twhile (elem.hasNext()) {\n\t\t\t\tMatrixElem mElem = elem.next();\n\t\t\t\tint row = mElem.rowIndex();\n\t\t\t\tint col = mElem.columnIndex();\n\t\t\t\tint numNeighbors = 0;\n\t\t\t\tfor (int i = -1; i < 2; i++) { // loops through row above,\n\t\t\t\t\t\t\t\t\t\t\t\t// actual row, and row below\n\t\t\t\t\tfor (int j = -1; j < 2; j++) { // loops through column left,\n\t\t\t\t\t\t\t\t\t\t\t\t\t// actual column, coloumn\n\t\t\t\t\t\t\t\t\t\t\t\t\t// right\n\t\t\t\t\t\tif (!currentGen.elementAt(row + i, col + j).equals(\n\t\t\t\t\t\t\t\tfalse)) // element is alive, add 1 to neighbor\n\t\t\t\t\t\t\t\t\t\t// total\n\t\t\t\t\t\t\tnumNeighbors += 1;\n\t\t\t\t\t\telse { // element is not alive, add 1 to its total\n\t\t\t\t\t\t\t\t// number of neighbors\n\t\t\t\t\t\t\tInteger currentNeighbors = (Integer) neighbors\n\t\t\t\t\t\t\t\t\t.elementAt(row + i, col + j);\n\t\t\t\t\t\t\tneighbors.setValue(row + i, col + j,\n\t\t\t\t\t\t\t\t\tcurrentNeighbors + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tneighbors.setValue(row, col, numNeighbors - 1); // -1 to account\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// for counting\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// itself as a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// neighbor\n\t\t\t}\n\t\t}\n\t}", "public static List<Location> generateLocations() {\n\t\tList<Location> locations = new ArrayList<Location>();\n\t\t\n\t\tfor(AREA area : AREA.values()) {\n\t\t\tLocation l = new Location(area);\n\t\t\t\n\t\t\tswitch (area) {\n\t\t\tcase Study:\n\t\t\t\tl.neighbors.add(AREA.HW_SH);\n\t\t\t\tl.neighbors.add(AREA.HW_SL);\n\t\t\t\tl.neighbors.add(AREA.Kitchen);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase Hall:\n\t\t\t\tl.neighbors.add(AREA.HW_SH);\n\t\t\t\tl.neighbors.add(AREA.HW_HL);\n\t\t\t\tl.neighbors.add(AREA.HW_HB);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase Lounge:\n\t\t\t\tl.neighbors.add(AREA.HW_HL);\n\t\t\t\tl.neighbors.add(AREA.HW_LD);\n\t\t\t\tl.neighbors.add(AREA.Conservatory);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase Library:\n\t\t\t\tl.neighbors.add(AREA.HW_SL);\n\t\t\t\tl.neighbors.add(AREA.HW_LB);\n\t\t\t\tl.neighbors.add(AREA.HW_LC);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase BilliardRoom:\n\t\t\t\tl.neighbors.add(AREA.HW_HB);\n\t\t\t\tl.neighbors.add(AREA.HW_LB);\n\t\t\t\tl.neighbors.add(AREA.HW_BD);\n\t\t\t\tl.neighbors.add(AREA.HW_BB);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase DiningRoom:\n\t\t\t\tl.neighbors.add(AREA.HW_LD);\n\t\t\t\tl.neighbors.add(AREA.HW_BD);\n\t\t\t\tl.neighbors.add(AREA.HW_DK);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase Conservatory:\n\t\t\t\tl.neighbors.add(AREA.HW_LC);\n\t\t\t\tl.neighbors.add(AREA.HW_CB);\n\t\t\t\tl.neighbors.add(AREA.Lounge);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase Ballroom:\n\t\t\t\tl.neighbors.add(AREA.HW_BB);\n\t\t\t\tl.neighbors.add(AREA.HW_CB);\n\t\t\t\tl.neighbors.add(AREA.HW_BK);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase Kitchen:\n\t\t\t\tl.neighbors.add(AREA.HW_DK);\n\t\t\t\tl.neighbors.add(AREA.HW_BK);\n\t\t\t\tl.neighbors.add(AREA.Study);\n\t\t\t\tl.isRoom = true;\n\t\t\t\tbreak;\n\t\t\tcase HW_SH:\n\t\t\t\tl.neighbors.add(AREA.Study);\n\t\t\t\tl.neighbors.add(AREA.Hall);\n\t\t\t\tbreak;\n\t\t\tcase HW_HL:\n\t\t\t\tl.neighbors.add(AREA.Hall);\n\t\t\t\tl.neighbors.add(AREA.Lounge);\n\t\t\t\tbreak;\n\t\t\tcase HW_SL:\n\t\t\t\tl.neighbors.add(AREA.Study);\n\t\t\t\tl.neighbors.add(AREA.Library);\n\t\t\t\tbreak;\n\t\t\tcase HW_HB:\n\t\t\t\tl.neighbors.add(AREA.Hall);\n\t\t\t\tl.neighbors.add(AREA.BilliardRoom);\n\t\t\t\tbreak;\n\t\t\tcase HW_LD:\n\t\t\t\tl.neighbors.add(AREA.Lounge);\n\t\t\t\tl.neighbors.add(AREA.DiningRoom);\n\t\t\t\tbreak;\n\t\t\tcase HW_LB:\n\t\t\t\tl.neighbors.add(AREA.Library);\n\t\t\t\tl.neighbors.add(AREA.BilliardRoom);\n\t\t\t\tbreak;\n\t\t\tcase HW_BD:\n\t\t\t\tl.neighbors.add(AREA.BilliardRoom);\n\t\t\t\tl.neighbors.add(AREA.DiningRoom);\n\t\t\t\tbreak;\n\t\t\tcase HW_LC:\n\t\t\t\tl.neighbors.add(AREA.Library);\n\t\t\t\tl.neighbors.add(AREA.Conservatory);\n\t\t\t\tbreak;\n\t\t\tcase HW_BB:\n\t\t\t\tl.neighbors.add(AREA.BilliardRoom);\n\t\t\t\tl.neighbors.add(AREA.Ballroom);\n\t\t\t\tbreak;\n\t\t\tcase HW_DK:\n\t\t\t\tl.neighbors.add(AREA.DiningRoom);\n\t\t\t\tl.neighbors.add(AREA.Kitchen);\n\t\t\t\tbreak;\n\t\t\tcase HW_CB:\n\t\t\t\tl.neighbors.add(AREA.Conservatory);\n\t\t\t\tl.neighbors.add(AREA.Ballroom);\n\t\t\t\tbreak;\n\t\t\tcase HW_BK:\n\t\t\t\tl.neighbors.add(AREA.Ballroom);\n\t\t\t\tl.neighbors.add(AREA.Kitchen);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlocations.add(l);\n\t\t}\n\t\t\n\t\treturn locations;\n\t}", "public Iterator<Integer> neighbors(int i)\n {\n return adjList[i].iterator();\n }", "public List<Integer> neighbors(int vertex) {\r\n \tArrayList<Integer> vertices = new ArrayList<Integer>();\r\n \tLinkedList<Edge> testList = myAdjLists[vertex];\r\n int counter = 0;\r\n while (counter < testList.size()) {\r\n \tvertices.add(testList.get(counter).myTo);\r\n \tcounter++;\r\n }\r\n return vertices;\r\n }", "public List<String> getAllBoundaries() {\n\t\treturn getFieldsOfType(PropertyLocation.class, Boundary.class);\n\t}", "private Set<Coordinate> addNeighbours(boolean locked, int x, int y) {\n\t\treturn Arrays.asList(\n\t\t\taddNeighbour(locked,x-2,y), //vecino arriba\n\t\t\taddNeighbour(locked,x+2,y), //vecino abajo\n\t\t\taddNeighbour(locked,x,y-2), //vecino izquierda\n\t\t\taddNeighbour(locked,x,y+2)\t//vecino derecha\n\t\t).stream().filter(predicate->predicate!=null).collect(Collectors.toSet());\n\t}", "List<Integer> getNeighboursOf(int node) {\n\t\treturn adjList.get(node);\n\t}", "private List<Cell> getNeighbours(int row,int col){\n List<Cell> neighbours = new ArrayList<Cell>();\n for(int i = row -1 ; i <= row+1 ; i++ )\n for(int j = col -1 ; j <= col+1 ; j++)\n if(i>=0 && i<cells.length && j>=0 && j<cells[0].length)\n neighbours.add(cells[i][j]);\n return neighbours;\n }", "Collection<L> getLocations ();", "@NotNull\r\n public Collection<Index> getNeighbors(@NotNull final Index index){\r\n Collection<Index> list = new ArrayList<>();\r\n int extracted = -1;\r\n try{\r\n extracted = primitiveMatrix[index.row+1][index.column]; //down\r\n list.add(new Index(index.row+1,index.column));\r\n }catch (ArrayIndexOutOfBoundsException ignored){}\r\n try{\r\n extracted = primitiveMatrix[index.row][index.column+1];//right\r\n list.add(new Index(index.row,index.column+1));\r\n }catch (ArrayIndexOutOfBoundsException ignored){}\r\n try{\r\n extracted = primitiveMatrix[index.row-1][index.column];//up\r\n list.add(new Index(index.row-1,index.column));\r\n }catch (ArrayIndexOutOfBoundsException ignored){}\r\n try{\r\n extracted = primitiveMatrix[index.row][index.column-1];//left\r\n list.add(new Index(index.row,index.column-1));\r\n }catch (ArrayIndexOutOfBoundsException ignored){}\r\n return list;\r\n }" ]
[ "0.6451077", "0.62488246", "0.60850114", "0.60393876", "0.58867973", "0.5877714", "0.58702165", "0.58581465", "0.58378625", "0.58273077", "0.58111167", "0.5801763", "0.58016235", "0.5790403", "0.5758653", "0.5753798", "0.57359505", "0.5706054", "0.57008624", "0.5690337", "0.5670249", "0.5665725", "0.5648669", "0.5545688", "0.5534556", "0.55228156", "0.55208665", "0.54886526", "0.5472973", "0.5459134", "0.5457979", "0.5450325", "0.544797", "0.5442344", "0.5423354", "0.5423187", "0.54035217", "0.5395776", "0.5388597", "0.5384866", "0.5360831", "0.53424066", "0.53419966", "0.5329184", "0.5318593", "0.53117454", "0.53056246", "0.5300141", "0.52976656", "0.52875495", "0.5278889", "0.52788424", "0.5271861", "0.5259373", "0.52589655", "0.52581817", "0.5252081", "0.5235936", "0.5232213", "0.52319276", "0.5222213", "0.52202576", "0.52199966", "0.5206526", "0.52031416", "0.5200922", "0.5199322", "0.51517177", "0.5151097", "0.51164114", "0.5109607", "0.51087844", "0.5105667", "0.5104498", "0.50904936", "0.50897396", "0.50867504", "0.5082381", "0.5074076", "0.5059976", "0.5058705", "0.50581044", "0.5058078", "0.5056048", "0.5049889", "0.50482225", "0.504538", "0.5045312", "0.50449723", "0.5039833", "0.5037883", "0.50153446", "0.50141454", "0.50084114", "0.5001733", "0.49996027", "0.4993104", "0.49887213", "0.49868435", "0.49659407" ]
0.83942276
0
Called just before this Command runs the first time
protected void initialize() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void preRun() {\n super.preRun();\n }", "protected void preRun() {\r\n\t\tthis.preparePairs();\r\n\t}", "@Override\n public void beforeFirstLogic() {\n }", "public void prePerform() {\n // nothing to do by default\n }", "protected void onFirstUse() {}", "@Override\n\t\t\tprotected void onPreExecute()\n\t\t\t{\n\n\t\t\t}", "@Override\n public void beforeStart() {\n \n }", "protected void initialize() {\n\t\tRobot.firstAutonomousCommandDone = true;\n\t}", "@Override\n\t\t\t\tprotected void onPreExecute()\n\t\t\t\t{\n\t\t\t\t\tsuper.onPreExecute();\n\t\t\t\t}", "public void preExecution() throws CommandListenerException;", "public void initDefaultCommand() {\n\t\t// Don't do anything\n }", "@Override\n\t\tprotected void onPreExecute() {\n\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t\t\r\n\t\t\t}", "protected void onFirstTimeLaunched() {\n }", "@Override\n\t\t\tprotected void onPreExecute() {\n\t\t\t\tsuper.onPreExecute();\n\t\t\t}", "@Override\n\t\t\tprotected void onPreExecute() {\n\t\t\t\tsuper.onPreExecute();\n\t\t\t}", "@Override\r\n\t\t\t\tpublic void autInitProcess() {\n\t\t\t\t\t\r\n\t\t\t\t}", "@Override\r\n\t\t\t\tpublic void autInitProcess() {\n\t\t\t\t\t\r\n\t\t\t\t}", "protected void runBeforeStep() {}", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n protected void onPreExecute() {\n\n }", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\n\t\t}", "@Override\r\n\t\tprotected void onPreExecute() {\n\t\t}", "@Override\r\n\t\tprotected void onPreExecute() {\n\t\t\tsuper.onPreExecute();\r\n\r\n\t\t}", "@Override\n protected void onStart() {\n checkUserStatus();\n\n super.onStart();\n }", "void PrepareRun() {\n }", "@Override\n\t\t\t\tpublic void onStart() {\n\t\t\t\t}", "@Override\r\n\t\t\tpublic void autInitProcess() {\n\t\t\t}", "@Override\n\t\tprotected void onPreExecute() \n\t\t{\n\t\t}", "@Override\r\n\t\t\tprotected void onPreExecute() {\n\t\t\t\tsuper.onPreExecute();\r\n\t\t\t}", "public void autonomousInit() {\n if (autonomousCommand != null) autonomousCommand.start();\n }", "protected void onPreExecute() {\n\t\t}", "@Override\n protected void onStart() {\n checkUserStatus();\n super.onStart();\n }", "protected void initDefaultCommand() {\n \t\t\n \t}", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n protected void onPreExecute() {\n }", "@Override\n\t protected void onPreExecute() {\n\t }", "public void initDefaultCommand() {\n \n }", "@Override\n\t\t\t\t\tprotected void onPreExecute() {\n\t\t\t\t\t\tsuper.onPreExecute();\n\t\t\t\t\t}", "public void autonomousInit() {\n\t\tautonomousCommand.start();\r\n\t}", "@Override\n\t\t\t\t\tpublic void onStart() {\n\n\t\t\t\t\t}", "@Override\r\n\tprotected void doPre() {\n\t\t\r\n\t}", "@Override\n\t\t\tpublic void onPreExecute() {\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tprotected void initDefaultCommand() {\n\t\t\r\n\t}", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "protected abstract void preRun();", "@Override\n public void initDefaultCommand() {\n\n }", "private Command() {\n initFields();\n }", "public void initDefaultCommand() {\n \n }", "@RequiresApi(api = Build.VERSION_CODES.N)\n public void StartInitial() {\n model.StartInitial();\n\n // Add any code required\n\n }", "public void onStart() {\n /* do nothing - stub */\n }", "@Override\n protected void startUp() {\n }", "@Override\r\n\tprotected void onPreExecute() {\n\t}", "@Override\n public void initDefaultCommand() \n {\n }", "@Override\n protected void onPreExecute()\n {\n super.onPreExecute();\n }", "@Override\n protected void onPreExecute() {\n\n super.onPreExecute();\n\n }", "@Override\r\n protected void onPreExecute() {\n super.onPreExecute();\r\n }", "@Override\r\n\tpublic void preCheck(CheckCommand checkCommand) throws Exception {\n\r\n\t}", "public void preInstallHook() {\n }", "public void startup() {\n neutral();\n }", "public void initDefaultCommand() {\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\n\t}", "@Override\n\tprotected void onPreExecute() {\n\t\tsuper.onPreExecute();\n\n\t}", "public void onStart() {\n super.onStart();\n getStockVerification();\n }", "@Override\n\t\t\t\tpublic void onStart() {\n\t\t\t\t\tsuper.onStart();\n\t\t\t\t}", "@Override\n\t\t\t\tpublic void onStart() {\n\t\t\t\t\tsuper.onStart();\n\t\t\t\t}", "@Override\n public void onStart() {\n \n }", "@Override\n public void onStart() {\n \n }", "@Override\n public void preStart() {\n Reaper.watchWithDefaultReaper(this);\n }" ]
[ "0.7113986", "0.6542487", "0.64347786", "0.6433418", "0.64082474", "0.6353506", "0.6309701", "0.62537354", "0.62473047", "0.62407833", "0.6167777", "0.6163407", "0.6129232", "0.6129232", "0.6129232", "0.6129232", "0.6129232", "0.61080366", "0.608483", "0.608483", "0.60805327", "0.60805327", "0.6068528", "0.60680324", "0.60680324", "0.60680324", "0.60680324", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.6061779", "0.60580724", "0.6044969", "0.6041834", "0.603989", "0.6035691", "0.60305667", "0.60298306", "0.6012218", "0.60053056", "0.6002687", "0.59965384", "0.59901303", "0.5988611", "0.5988611", "0.5988611", "0.5988611", "0.5988611", "0.5977599", "0.59622574", "0.5961238", "0.59496737", "0.59461665", "0.59449667", "0.5909627", "0.5907129", "0.59067136", "0.59067136", "0.59067136", "0.59067136", "0.59067136", "0.59067136", "0.59067136", "0.59065974", "0.5906112", "0.5902859", "0.5901146", "0.5892453", "0.58864474", "0.5884274", "0.58823276", "0.58756584", "0.5870505", "0.5860054", "0.5857494", "0.58513945", "0.5844433", "0.58421814", "0.5840623", "0.5837147", "0.5837147", "0.5837147", "0.58352405", "0.58352405", "0.5834613", "0.58340293", "0.58340293", "0.58284307", "0.58284307", "0.58276254" ]
0.0
-1
Called repeatedly when this Command is scheduled to run
protected void execute() { oi.updateToggleLift(); if(oi.toggleOnLift){ // The commands here will occur if the TorqueLift toggle switch // is activated. All code here will only run after the button // has been toggled. if (limitswitch.getReadyState()) { torquelift.swap(); torquelift.moveAllMotors(oi.getLiftSpeed()); } else { // activates when the limit switch is pressed torquelift.moveAllMotors(oi.getLiftYUpSpeed()); } } else { // The commands here will occur normally, when the TorqueLift is // not activated. return; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\tvoid runCommand() {\n\t\t\ttrigger.execute();\n\t\t}", "@Override\n public void run() {\n schedule();\n }", "@Override\n public void autonomousPeriodic() {\n \n Scheduler.getInstance().run();\n \n }", "public void run() {\n\t\texecuteCommand( client, false );\n\t}", "@Override\n public void periodic() {\n // This method will be called once per scheduler run\n }", "@Override\n\tpublic void execute() {\n\t\tsuper.execute();\n\n\t\t// TBD Needs rewrite for multi tenant\n\t\ttry {\t\n\t\t\tif (async == null || !async)\n\t\t\t\tupdated = Crosstalk.getInstance().refresh(customer);\n\t\t\telse {\n\t\t\t\tfinal Long id = random.nextLong();\n\t\t\t\tfinal ApiCommand theCommand = this;\n\t\t\t\tThread thread = new Thread(new Runnable() {\n\t\t\t\t @Override\n\t\t\t\t public void run(){\n\t\t\t\t \ttry {\n\t\t\t\t\t\t\tupdated = Crosstalk.getInstance().refresh(customer);\n\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\terror = true;\n\t\t\t\t\t\t\tmessage = e.toString();\n\t\t\t\t\t\t}\n\t\t\t\t }\n\t\t\t\t});\n\t\t\t\tthread.start();\n\t\t\t\tasyncid = \"\" + id;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "protected void runEachMinute() {\n \n }", "@Override\n public void execute() {\n Time.sleep(3000);\n Starting.execute();\n }", "@Override\r\n public void robotPeriodic() {\r\n // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled\r\n // commands, running already-scheduled commands, removing finished or interrupted commands,\r\n // and running subsystem periodic() methods. This must be called from the robot's periodic\r\n // block in order for anything in the Command-based framework to work.\r\n CommandScheduler.getInstance().run();\r\n }", "@Override\n public void robotPeriodic() {\n // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled\n // commands, running already-scheduled commands, removing finished or interrupted commands,\n // and running subsystem periodic() methods. This must be called from the robot's periodic\n // block in order for anything in the Command-based framework to work.\n CommandScheduler.getInstance().run();\n }", "@Override\n public void autonomousPeriodic()\n {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\r\n Scheduler.getInstance().run();\r\n }", "private void scheduleJob() {\n\n }", "@Override\n\tpublic void execute() {\n\t\tcmdReceiver.send();\n\t}", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "public void autonomousPeriodic() {\n Scheduler.getInstance().run();\n }", "protected void run() throws IOException {\n\t\tif (lastTime + interval > Time.now())\n\t\t\treturn;\n\t\texitCode = 0; // reset for next run\n\t\trunCommand();\n\t}", "protected void execute() {\n \tclimber.setCLimberSpeed(0);\n }", "@Override\n public void teleopPeriodic()\n {\n Scheduler.getInstance().run();\n }", "private void doCommand() {\n try {\n TimeUnit.SECONDS.sleep(2L);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "protected void waitUntilCommandFinished() {\n }", "public void autonomousPeriodic() \n {\n Scheduler.getInstance().run();\n }", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n \n }", "private void schedule() {\n service.scheduleDelayed(task, schedulingInterval);\n isScheduled = true;\n }", "public void autonomousPeriodic() {\r\n\t\tScheduler.getInstance().run();\r\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n\tprotected void run() {\n\t\tUtils.executeAndWaitForCommand(this.getHMetisExec());\n\t}", "@Override\n\tpublic void autonomousPeriodic() {\n\t\tScheduler.getInstance().run();\t\n\t}", "@Override\n public void autonomousPeriodic() {\n \n }", "public void intialRun() {\n }", "@Override\n public void periodic() {\n UpdateDashboard();\n }", "public void teleopPeriodic() {\r\n\t\tScheduler.getInstance().run();\r\n\t}", "@Override\n\tprotected void postRun() {\n\n\t}", "protected void execute() {\n \t\n \tcurrent_time = System.currentTimeMillis();\n \t\n \tlift.liftDown(LIFT_SPEED);\n }", "@Override\n\tpublic void teleopPeriodic() //runs the teleOp part of the code, repeats every 20 ms\n\t{\n\t\tScheduler.getInstance().run(); //has to be here, I think that this is looping the method\n\t\tSmartDashboard.putNumber(\"Encoder Left: \", RobotMap.encoderLeft.getRaw()); //putting the value of the left encoder to the SmartDashboard\n\t\tSmartDashboard.putNumber(\"Encoder Right: \", RobotMap.encoderRight.getRaw()); //putting the value of the right encoder to the smartDashboard\n\t\tSmartDashboard.putNumber(\"Ultrasonic sensor\", ultrasonic.getDistanceIn()); //putting the value of the ultrasonic sensor to the smartDashboard\n//\t\tSmartDashboard.putBoolean(\"allOK\", Robot.driveFar.ultrasonicOK);\n\t\tdriveExecutor.execute(); //running the execute method in driveExecutor\n\t\tgrab.execute(); //running the execute() method in GearGrab_Command (should run without this but this is ensuring us that it is on)\n\t}", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void teleopPeriodic() {\n Scheduler.getInstance().run();\n }", "public void run() {\n\t\t\t\tIMSScheduleManager.super.startCron();\r\n\t\t\t\t\r\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\n\t\t\t}", "@Override\n public void autonomousPeriodic() {\n\n }", "@Override\n public void autonomousPeriodic() \n {\n Scheduler.getInstance().run();\n log();\n }", "@Override\n\tpublic void postRun() {\n\t}", "public void autonomousPeriodic() {\n // RobotMap.helmsman.trackPosition();\n Scheduler.getInstance().run();\n }", "private void beginSchedule(){\n\t\tDivaApp.getInstance().submitScheduledTask(new RandomUpdater(this), RandomUpdater.DELAY, RandomUpdater.PERIOD);\n\t}", "protected void runEachSecond() {\n \n }", "@Override\n protected void execute() {\n Robot.toteLifterSubsystem.setEjectorState(EjectorState.EXTENDING, ramper.process(1.0));\n }", "protected void execute() {\n\t\t_xboxControllerToRumble.setRumble(_rumbleType, _rumbleValue);\n\t\t_timesRumbled++;\n\t\tSystem.out.println(\"Rumbling \" + _timesRumbled);\n\t}", "private void runPeriodic() {\n boolean ok = ScheduledFutureTask.super.runAndReset();\n boolean down = isShutdown();\n // Reschedule if not cancelled and not shutdown or policy allows\n if (ok && !down) {\n updateNextExecutionTime();\n MeasurableScheduler.super.getQueue().add(this);\n }\n // This might have been the final executed delayed\n // task. Wake up threads to check.\n else if (down)\n interruptIdleWorkers();\n }", "public void execute() {\n\t\tlaunch();\n\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\r\n\t\t\tpublic void run() {\n\t\t\t\t\r\n\t\t\t}", "@Override\n\tpublic void run() {\n\t\tif (this.isRunning == true) {\n\t\t\treturn;\n\t\t}\n\t\tthis.isRunning = true;\n\t\t// 写入一条日志\n\t\t\n\t\t// 详细运行参数\n\t\ttry {\n\t\t\tthis.taskRun();\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tthis.isRunning = false;\n\t\tthis.addHistory(new Date());\n\t\tif(this.once) {\n\t\t\tthis.cancel();\n\t\t}\n\t}", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void run() {\n systemTurn();\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void taskStarting() {\n\n }", "@Override\n public void teleopPeriodic() {\n Scheduler.getInstance().run();\n log();\n }", "@PostConstruct\n public void postConstruct() {\n execService = Executors.newScheduledThreadPool(1);\n scheduledFuture = execService.scheduleAtFixedRate(this, 0, PUSH_REPEAT_DELAY, TimeUnit.MILLISECONDS);\n }", "protected void run() {\r\n\t\t//\r\n\t}", "@Override\n\tpublic void run() {\n\t\tautomatischDurchAlleRouten();\n\n\t\t\n\t}", "public void autonomousPeriodic()\n\t{\n\t\tScheduler.getInstance().run();\n\t}", "@Override\n public void execute() {\n if (System.currentTimeMillis() - currentMs >= timeMs) {\n // Delay has passed so initialize object11\n super.initialize();\n }\n }", "@Override\n\tprotected void execute() {\n\t\tRobot.collector.setMawOpen(Robot.oi.getCollectorOpen());\n\t\tRobot.collector.setIntakeSpeed(Robot.oi.getCollectorSpeed());\n\t\tRobot.collector.setWristStageOneRetracted(Robot.oi.getWristStageOneRetracted());\n\t\tRobot.collector.setWristStageTwoRetracted(Robot.oi.getWristStageTwoRetracted());\n\t}", "protected void execute() {\n \tRobot.chassisSubsystem.shootHighM.set(0.75);\n \tif(timeSinceInitialized() >= 1.25){\n \t\tRobot.chassisSubsystem.liftM.set(1.0);\n \t}\n }", "protected void execute() {\n command.start();\n }", "@Override\n public void autonomousPeriodic() {\n }", "@Override\n public void autonomousPeriodic() {\n\t// updateDiagnostics();9\n\tScheduler.getInstance().run();\n }", "@Override\n public void run()\n {\n //Log.d(TAG ,\"==========>Task Run In!\");\n updateDroneLocation();\n }", "public void teleopPeriodic()\n\t{\n\t\tScheduler.getInstance().run();\n\t}", "public void execute() {\n setExecuted(true);\n }", "@Override\n public void teleopPeriodic() {\n\tupdateDiagnostics();\n\tScheduler.getInstance().run();\n }", "public void execute() {\n\t\t\n\t\tdrivetrain.updateAnglePID();\n\t\t\n//\t\tif (drivetrain.currentControl()) {\n//\t\t\tdrivetrain.shiftGears();\n//\t\t}\n\t}", "protected void execute() {\n\t\tshooter.runShooter(power);\n\t}", "@Override\r\n public void run() {}", "@SuppressLint(\"InlinedApi\")\n @Override\n public void run() {\n }", "protected void execute() {\n \tshooterWheel.shooterWheelSpeedControllerAft.Pause();\n \tshooterWheel.shooterWheelSpeedControllerFwd.Pause();\n \t\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "public void run() {\n ui.printStartingMessage();\n boolean isExit = false;\n\n while (!isExit) {\n isExit = parser.determineCommand();\n }\n\n storage.saveToFile(taskList);\n }" ]
[ "0.6689458", "0.6631115", "0.6566414", "0.65512514", "0.6530515", "0.6488629", "0.64019585", "0.6380878", "0.637645", "0.6363615", "0.63557744", "0.6330997", "0.6295938", "0.6275704", "0.6268897", "0.62656784", "0.62656784", "0.62656784", "0.62656784", "0.62656784", "0.62656784", "0.6255461", "0.624429", "0.6241397", "0.62090397", "0.6183934", "0.6178626", "0.61670285", "0.614122", "0.6137012", "0.6132416", "0.6132416", "0.6132416", "0.6132416", "0.61313075", "0.61313075", "0.61313075", "0.6120398", "0.61091226", "0.61073244", "0.610631", "0.610404", "0.6101818", "0.61014", "0.6099132", "0.6093559", "0.6092883", "0.6092883", "0.6092883", "0.6092883", "0.60926527", "0.60926485", "0.6077805", "0.6074907", "0.606528", "0.6062541", "0.60580474", "0.6056443", "0.60554063", "0.6054432", "0.60539037", "0.60538137", "0.60505164", "0.60505164", "0.604125", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6029588", "0.6027496", "0.6027496", "0.6027496", "0.60272455", "0.6009362", "0.6006723", "0.59990466", "0.59985226", "0.59967", "0.5994757", "0.5985855", "0.59771705", "0.5973198", "0.5970597", "0.59701514", "0.5965313", "0.5964212", "0.596267", "0.59585357", "0.5954102", "0.595137", "0.5949223", "0.5946874", "0.5942587", "0.59406763", "0.59406763", "0.59366745" ]
0.0
-1
Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() { return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean execute() {\n return false;\n }", "@Override\n public boolean execute() {\n return false;\n }", "public boolean execute(){\n return false;\n }", "@Override\n\tpublic boolean Unexecute() \n\t{\n\t\treturn false;\n\t}", "protected boolean onExecute(String command)\n {\n return false;\n }", "@Override\n\tpublic boolean execute() {\n\t\treturn false;\n\t}", "@Override\n\t\tpublic boolean shouldContinueExecuting() {\n\t\t\treturn false;\n\t\t}", "public boolean shouldExecute() {\n\t\treturn true;\n\t}", "protected void execute() {\n \t// literally still do nothing\n }", "@Override\n public boolean canExecute() {\n return true;\n }", "protected void execute() {\n finished = true;\n }", "@Override\r\n\tpublic void unexecute() {\n\t\t\r\n\t}", "public Command() {\n this.executed = false;\n }", "@Override\n public void stopExecute() {\n\n }", "public boolean shouldExecute()\n {\n if (this.runDelay <= 0)\n {\n if (!this.theRaider.world.getGameRules().getBoolean(\"mobGriefing\"))\n {\n return false;\n }\n\n this.currentTask = -1;\n this.wantsToReapStuff = true;\n }\n\n return super.shouldExecute();\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n public void execute() {\n if(!manipulatorController.getRawButton(button)){\n shooter.shooterMotorsOff();\n hopper.hopperMotorOff();\n isDone = true;\n end(false);\n }\n\n }", "public void unExecute()\n\t{\n\t}", "@Override\r\n protected boolean isFinished() {\n return false;\r\n }", "@Override\r\n public void executeCommand() {\r\n shell.stopRunning();\r\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished()\n {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\t\t\n\t}", "@Override\n protected boolean isFinished() \n {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n boolean isFinished() {\n return false;\n }", "public boolean shouldContinueExecuting() {\n return (this.shouldExecute() || !this.entity.getNavigator().noPath()) && this.isBowInMainhand();\n }", "protected boolean isFinished() {\r\n return false;\r\n }", "protected boolean isFinished() {\r\n return false;\r\n }", "public boolean shouldExecute() {\n return this.goalOwner.getTeam() == null ? false : super.shouldExecute();\n }", "public void prepareExecuteNoSelect() {\n setCallFromStatement();\n // The statement is no longer require so can be released.\n clearStatement();\n\n super.prepareExecuteNoSelect();\n }", "protected void waitUntilCommandFinished() {\n }", "@Override\n\tprotected boolean isFinished()\n\t{\n\t\treturn false;\n\t}", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "protected void executionSuccess() {\n this.isUndoable = true;\n }", "protected boolean isFinished() {\n return false;\n \n }", "boolean redoLastCommand() throws Exception;", "@Override\n public boolean isFinished() {\n return false;\n }", "public boolean shouldContinueExecuting() {\n return this.currentTask >= 0 && super.shouldContinueExecuting();\n }", "@Override\r\n public void execute()\r\n {\r\n printInvalidCommandMessage();\r\n }" ]
[ "0.77345294", "0.77345294", "0.7678753", "0.76457655", "0.75966", "0.7554271", "0.6877811", "0.6748956", "0.6728847", "0.66855806", "0.65891784", "0.65624696", "0.64980483", "0.63857424", "0.63736373", "0.6356819", "0.6356819", "0.63498974", "0.63401324", "0.63290936", "0.63238996", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.6319047", "0.63158405", "0.63097465", "0.63097465", "0.62977403", "0.62754494", "0.62744504", "0.62744504", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.62499565", "0.6211897", "0.62113553", "0.62087166", "0.62087166", "0.62084436", "0.6203807", "0.619581", "0.61709535", "0.61614436", "0.61614436", "0.61614436", "0.61614436", "0.61614436", "0.6158993", "0.61529076", "0.61481965", "0.6146213", "0.6145282", "0.6143307" ]
0.6184869
85
Called once after isFinished returns true
protected void end() { lift.stop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected boolean isFinished() {\n return true;\n }", "@Override\n protected boolean isFinished() {\n return true;\n }", "@Override\n public boolean isFinished() {\n return true;\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn true;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn true;\r\n\t}", "@Override\n protected boolean isFinished()\n {\n return false;\n }", "@Override\n protected boolean isFinished() \n {\n return false;\n }", "@Override\n public boolean isFinished() {\n return true;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n boolean isFinished() {\n return false;\n }", "@Override\r\n protected boolean isFinished() {\n return false;\r\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished(){\r\n return true;\r\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "protected boolean isFinished() {\n return true;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\r\n\t\treturn false;\r\n\t}", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n protected boolean isFinished() {\n return isFinished;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\n public boolean isFinished() {\n return false;\n }", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\r\n\tprotected boolean isFinished() {\n\t\treturn false;\r\n\t}", "@Override\n\tprotected boolean isFinished()\n\t{\n\t\treturn false;\n\t}", "@Override\r\n protected boolean isFinished() {\n if (super.isFinished()) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }", "@Override\n protected boolean isFinished() {\n return finished;\n }", "protected boolean isFinished()\n\t{\n\t\treturn true;\n\t}", "protected boolean isFinished() {\n\t\treturn true;\n\t}", "protected boolean isFinished() {\n\t\treturn true;\n\t}", "protected boolean isFinished() {\n\t\treturn true;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean isFinished() {\n\t\treturn false;\n\t}", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }", "protected boolean isFinished() {\n return false;\n }" ]
[ "0.8585863", "0.853999", "0.83345187", "0.8332006", "0.8332006", "0.8306991", "0.83052015", "0.8299314", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.82778525", "0.8276812", "0.8269175", "0.8237897", "0.8237897", "0.82297003", "0.8206604", "0.8206604", "0.8206604", "0.8206604", "0.8206604", "0.8206604", "0.81632674", "0.8159512", "0.8159512", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.815225", "0.81463015", "0.8138321", "0.8138321", "0.8138321", "0.8138321", "0.8138321", "0.812565", "0.812565", "0.8113514", "0.8112187", "0.8089372", "0.8083752", "0.80410165", "0.80410165", "0.80410165", "0.80333304", "0.80333304", "0.80333304", "0.80333304", "0.80333304", "0.80333304", "0.80333304", "0.80333304", "0.80333304", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055", "0.80272055" ]
0.0
-1
Called when another command which requires one or more of the same subsystems is scheduled to run
protected void interrupted() { end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public AutonomousCommand(LiftSubsystem m_lift, ArmSubsystem m_arm, Shooter m_shooter, DriveSubsystem m_drive,\n HopperSubsystem m_hopper, Intake m_intake) {\n // Add your commands in the super() call, e.g.\n // super(new FooCommand(), new BarCommand());\n // alongwith- birlikte çalıştırmak için // withtimeout-- girdigin sure kadar\n // yapar\n // (new RunShooter(m_shooter, 1).withTimeout(0.75),new RunLift(m_lift,\n // 0.5).raceWith(new RunHopper(m_hopper, 0.8)),\n // new AutonomousDrive(m_drive, 0.8, 300).withTimeout(3));\n\n super(new RunShooter(m_shooter, 0.8).withTimeout(0.75),\n new RunShooter(m_shooter, 0.8).raceWith(new RunHopper(m_hopper, 0.8)).withTimeout(2.5),\n new AutonomousDrive(m_drive, -0.8, -300).raceWith(new RunIntake(m_intake, 0.8)\n .raceWith(new RunHopper(m_hopper, 0.8).raceWith(new RunShooter(m_shooter, 0.3),\n new AutonomousDrive(m_drive, 0.8, 300), new RunShooter(m_shooter, 0.8).withTimeout(0.75),\n new RunShooter(m_shooter, 0.8).raceWith(new RunHopper(m_hopper, 0.8).withTimeout(2.5))))));\n\n }", "@Override\n /**\n * Set the default command for a subsystem here\n */\n public void initDefaultCommand() \n {\n // Set the default command for a subsystem here.\n // setDefaultCommand(new MySpecialCommand());\n }", "private void registerCommands() {\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecurtick\")\n\t\t\t\t\t\t.then(argument(\"Number of Ticks Between Sends\", integer())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.timeBetween = getInteger(c, \"Number of Ticks Between Sends\");\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message will be sent every \" + getInteger(c, \"Number of Ticks Between Sends\") + \" ticks.\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//arrecurphrase [Recurring Phrase]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecurphrase\")\n\t\t\t\t\t\t.then(argument(\"Recurring Phrase\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.persistentPhrase = getString(c, \"Recurring Phrase\");\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message set to \\\"\" + getString(c, \"Recurring Phrase\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//arrecurtoggle\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecurtoggle\")\n\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\tconfig.persistentChat = !config.persistentChat;\n\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message has been turned \" + (config.persistentChat ? \"on\" : \"off\") + \".\"), false);\n\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t})\n\t\t));\n\t\t//arrecur [Enabled?]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecur\")\n\t\t\t\t\t\t.then(argument(\"Enabled?\", bool())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.persistentChat = getBool(c, \"Enabled?\");\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message set to \\\"\" + (config.persistentChat ? \"on\" : \"off\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//aradditem [Item Name] [Trigger Term]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddterm\")\n\t\t\t\t\t\t.then(argument(\"Item Name\", string())\n\t\t\t\t\t\t\t\t.then(argument(\"Trigger Term\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.terms.add(getString(c, \"Trigger Term\") + \"|\" + getString(c, \"Item Name\"));\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tHelper.setupChatMessages();\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added term \\\"\" + getString(c, \"Trigger Term\") + \"\\\" to item \\\"\" + getString(c, \"Item Name\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t})))\n\t\t));\n\t\t//araddin [In Phrase]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddin\")\n\t\t\t\t\t\t.then(argument(\"In Phrase\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.ins.add(getString(c, \"In Phrase\"));\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added in-phrase \\\"\" + getString(c, \"In Phrase\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//araddout [Out Phrase]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddout\")\n\t\t\t\t\t\t.then(argument(\"Out Phrase\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.outs.add(getString(c, \"Out Phrase\"));\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added out-phrase \\\"\" + getString(c, \"Out Phrase\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//arreload\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arreload\")\n\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\tarreload();\n\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"AutoReply config reloaded.\"), false);\n\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t})\n\t\t));\n\t\t//araddshopitem [Item Name] [Quantity] [Price]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddshopitem\")\n\t\t\t\t\t\t.then(argument(\"Item Name\", string()).then(argument(\"Quantity\", string()).then(argument(\"Price\", string())\n\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\tconfig.shopItems.add(getString(c, \"Item Name\") + \"|\" + getString(c, \"Quantity\") + \"|$\" + getString(c, \"Price\"));\n\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added \" + getString(c, \"Item Name\") + \" to shop stock.\"), false);\n\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t}))))\n\t\t));\n\t}", "@Override\n\t\tpublic void subTask(String arg0) {\n\n\t\t}", "public InstantCommand(Runnable toRun, Subsystem... requirements) {\n\t\trequireNonNull(toRun);\n\t\tm_toRun = toRun;\n\t\taddRequirements(requirements);\n\t}", "private void registerCommands() {\n }", "protected void runSubCommand(int num) {\n subCommands[num].execute();\n }", "public static void twoClientSetupProcesses() {\n\n\tList<String> aClientTags=TagsFactory.getAssignmentTags().getTwoClientClientTags();\n\tList<String> aServerTags=TagsFactory.getAssignmentTags().getTwoClientServerTags();\n\n\ttwoClientSetupProcesses(aClientTags, aServerTags);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setProcessTeams(Arrays.asList(\"RegistryBasedDistributedProgram\"));\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setTerminatingProcesses(\"RegistryBasedDistributedProgram\", Arrays.asList(\"Client_0\", \"Client_1\"));\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setProcesses(\"RegistryBasedDistributedProgram\", Arrays.asList(\"Registry\", \"Server\", \"Client_0\", \"Client_1\"));\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Registry\", Arrays.asList(\"Registry\"));\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Server\", aServerTags);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Client_0\", aClientTags);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Client_1\", aClientTags);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Registry\", FlexibleStaticArgumentsTestCase.TEST_REGISTRY_ARGS);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Server\", FlexibleStaticArgumentsTestCase.TEST_SERVER_ARGS);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Client_0\", FlexibleStaticArgumentsTestCase.TEST_CLIENT_0_ARGS);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Client_1\", FlexibleStaticArgumentsTestCase.TEST_CLIENT_1_ARGS);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setSleepTime(\"Registry\", 500);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setSleepTime(\"Server\", 2000);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setSleepTime(\"Client_0\", 5000);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setSleepTime(\"Client_1\", 5000);\n//\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().getProcessTeams().forEach(team -> System.out.println(\"### \" + team));\n}", "@Override\r\n\tpublic void subTask(String name) {\n\t}", "@Override\n\t\t\tpublic void subTask(String name) {\n\t\t\t\t\n\t\t\t}", "void beginPeriodic() {\n\t\t// if some subsystems need to get called in all modes at the beginning\n\t\t// of periodic, do it here\n\n\t\t// don't need to do anything\n\t}", "@Override\n public void configureTasks( ScheduledTaskRegistrar registrar ) {\n registrar.setScheduler( rhizomeScheduler() );\n }", "private void isCommandInstance() throws SystemException {\r\n\t\tif (commandInstance != null) return;\r\n\t\tif (commandResponder != null) SystemException.softwareProblem(\"This was not a command instance. There is a bug. Either the super for the command is not well formed or it called a method it shouldn't.\");\r\n\t\tinstantiateCommand();\r\n\t}", "public PnuematicSubsystem() {\n\n }", "public void TurnCommand() {\n\n requires(Robot.driveSubsystem);\n\n }", "public void performOtherTasks() {\n\t\t\tSystem.out.println(\"performing tasks other than servicing\");\n\t\t\t// do whatever you want to do in the servicing package\n\t\t}", "public void act() {\n\t\tfor (Manager manager : managers.values())\n\t\t\tmanager.act();\n\t\t\n\t\tif (hasPriority == Priority.ARMY && armyQueue.size() > 0) {\n\t\t\t//Tell ArmyManager to build top unit in queue\n\t\t}\n\t\telse if (hasPriority == Priority.BUILDINGS && buildingQueue.size() > 0) {\n\t\t\t//Tell BuildManager to build top building in queue\n\t\t}\n\t\telse if (hasPriority == Priority.WORKERS) {\n\t\t\t//ResourceManager has requested more workers\n\t\t}\n\t}", "@SystemAPI\npublic interface ScheduleEvent extends IOperation {\n\t/**\n\t * \n\t * @return\tDe duur van de planbare actie (in Millis)\n\t */\n\tpublic TimeDuration getDuration();\n\t\n\t/**\n\t * \n\t * @return\tDe periode waarop de actie gescheduled is\n\t * \t\t\tDit wordt ingesteld door de Scheduler\n\t */\n\t@SystemAPI\n\tpublic TimePeriod getScheduledPeriod(); \n\t\n\t/**\n\t * Als de schedulable specifieke resources nodig heeft, bv. een bepaalde \n\t * dokter of verpleegster, dan komen deze in de onderstaande List.\n\t * @return\t\tDe lijst met specifieke resources die nodig zijn.\n\t */\n\tpublic List<ScheduleResource> neededSpecificResources();\n\t\n\t/**\n\t * \n\t * @return\tEen lijst met de nodige resources.\n\t */\n\tpublic List<ResourceType> neededResources();\n\t\n\t/**\n\t * Zet de periode wanneer de actie gescheduled is.\n\t * @param scheduledPeriod\tDe nieuwe geplande periode\n\t * @param usesResources\tDe resources die gebruikt worden bij het plannen\n\t * @param campus De campus die gebruikt wordt bij het plannen\n\t * @throws SchedulingException Als er niet gepland kan worden\n\t */\n\tpublic void schedule(TimePeriod scheduledPeriod, List<ScheduleResource> usesResources, Campus campus) throws SchedulingException;\n\t\t\n\t/**\n\t * Een methode om te controleren of de events behorende bij een warenhuis gepland kunnen worden.\n\t * @param warehouse\n\t * \t\t Het warenhuis waar gepland moet worden\n\t * @return true\n\t * \t\t Als er gepland kan worden\n\t * @return false\n\t * \t\t Als er niet gepland kan worden\n\t */\n\tpublic boolean canBeScheduled(Warehouse warehouse) ;\n\t\n\t/**\n\t * Een methode om een warehuis te updaten. Met de booleanse waarde\n\t * kan de actie ongedaan gemaakt worden.\n\t * \n\t * @param warehouse\n\t * \t\t Het warenhuis geupdate moet worden\n\t * @param inverse\n\t * \t\t De soort update\n\t */\n\tpublic void updateWarehouse(Warehouse warehouse, boolean inverse) ;\n\t\n\t/**\n\t * Een methode om de prioriteit op te vragen.\n\t * @return\n\t */\n\tpublic Priority getPriority() ;\t\n\t\n\t/**\n\t * Methode die de campus waarop deze actie wordt uitgevoerd opslaat, zodat\n\t * ze later kan gereproduceerd worden wanneer er geannuleerd werd.\n\t * @param \tcampus\n\t * \t\t\tDe CampusId van de campus die moet opgeslagen worden\n\t */\n\tpublic void setHandlingCampus(CampusId campus) ;\n\t\n\t/**\n\t * Methode die de opgeslagen campus terug opvraagt.\n\t * @return\tDe opgeslagen campus\n\t */\n\tpublic CampusId getHandlingCampus();\n\t\n\t/**\n\t * \n\t * @return event type\n\t */\n\t@SystemAPI\n\tpublic EventType getEventType();\n\t\n\t/**\n\t * @return start event\n\t */\n\tpublic Event getStart();\n\t\n\t/**\n\t * \n\t * @return stop event\n\t */\n\tpublic Event getStop();\n}", "@Override\n protected int run() throws Exception {\n if (User.current() == null) {\n stderr.println(\"Must be logged in before executing...\");\n return 1;\n }\n\n // First check to see if they exist\n Jenkins instance = Jenkins.getInstance();\n AbstractProject project1 = instance.getItemByFullName(first, AbstractProject.class);\n if (project1 == null) {\n throw new CmdLineException(null, \"Project: \" + first + \" does not exist\");\n }\n AbstractProject project2 = instance.getItemByFullName(second, AbstractProject.class);\n if (project2 == null) {\n throw new CmdLineException(null, \"Project: \" + second + \" does not exist\");\n }\n\n // Make sure user has permission to build.\n if (!project1.hasPermission(Item.BUILD) &&\n !project2.hasPermission(Item.BUILD)) {\n throw new CmdLineException(null, \"You do not have permission to execute these jobs.\");\n }\n\n // Let's build both projects.\n project1.scheduleBuild2(0);\n project2.scheduleBuild2(0);\n return 0;\n }", "@Override\n public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n // setDefaultCommand(new MySpecialCommand());\n setDefaultCommand(new tankDrive());\n }", "@Scheduled(cron = \"${toil1.schedule2}\")\n\tpublic void toiL1Schedule2() {\n\t\tlog.info(\"Running toiL1Schedule2\");\n\t\trunToiL1Schedule();\n\t\trunToiBlogsL1Schedule();\n\t}", "private void commandCheck() {\n\t\t//add user command\n\t\tif(cmd.getText().toLowerCase().equals(\"adduser\")) {\n\t\t\t/*\n\t\t\t * permissions check: if user is an admin, proceed. If not, error with a permission error.\n\t\t\t * There will be more user level commands added in version 2, like changing rename to allow a\n\t\t\t * user to rename themselves, but not any other user. Admins can still rename all users.\n\t\t\t */\n\t\t\tif(type.equals(\"admin\")) {\n\t\t\t\taddUser();\n\t\t\t}\n\t\t\telse {\n\t\t\t\terror(PERMISSIONS);\n\t\t\t}\n\t\t}\n\t\t//delete user command\n\t\telse if(cmd.getText().toLowerCase().equals(\"deluser\")) {\n\t\t\t//permissions check: if user is an admin, proceed. If not, error with a permission error.\n\t\t\tif(type.equals(\"admin\")) {\n\t\t\t\tdelUser();\n\t\t\t}\n\t\t\telse {\n\t\t\t\terror(PERMISSIONS);\n\t\t\t};\n\t\t}\n\t\t//rename user command\n\t\telse if(cmd.getText().toLowerCase().equals(\"rename\")) {\n\t\t\t//permissions check: if user is an admin, allow the user o chose a user to rename.\n\t\t\t//If not, allow the user to rename themselves only.\n\t\t\tif(type.equals(\"admin\")) {\n\t\t\t\trename(ALL);\n\t\t\t}\n\t\t\telse {\n\t\t\t\trename(SELF);\n\t\t\t}\n\t\t}\n\t\t//promote user command\n\t\telse if(cmd.getText().toLowerCase().equals(\"promote\")) {\n\t\t\t//permissions check: if user is an admin, proceed. If not, error with a permission error.\n\t\t\tif(type.equals(\"admin\")) {\n\t\t\t\tpromote();\n\t\t\t}\n\t\t\telse {\n\t\t\t\terror(PERMISSIONS);\n\t\t\t}\n\t\t}\n\t\t//demote user command\n\t\telse if(cmd.getText().toLowerCase().equals(\"demote\")) {\n\t\t\t//permissions check: if user is an admin, proceed. If not, error with a permission error.\n\t\t\tif(type.equals(\"admin\")) {\n\t\t\t\tdemote();\n\t\t\t}\n\t\t\telse {\n\t\t\t\terror(PERMISSIONS);\n\t\t\t}\n\t\t}\n\t\t//the rest of the commands are user level, no permission checking\n\t\telse if(cmd.getText().toLowerCase().equals(\"ccprocess\")) {\n\t\t\tccprocess();\n\t\t}\n\t\telse if(cmd.getText().toLowerCase().equals(\"cprocess\")) {\n\t\t\tcprocess();\n\t\t}\n\t\telse if(cmd.getText().toLowerCase().equals(\"opentill\")) {\n\t\t\topenTill();\n\t\t}\n\t\telse if(cmd.getText().toLowerCase().equals(\"closetill\")) {\n\t\t\tcloseTill();\n\t\t}\n\t\telse if(cmd.getText().toLowerCase().equals(\"opendrawer\")) {\n\t\t\topenDrawer();\n\t\t}\n\t\telse if(cmd.getText().toLowerCase().equals(\"sale\")) {\n\t\t\tsale();\n\t\t}\n\t\t//if the command that was entered does not match any command, return an error.\n\t\telse {\n\t\t\terror(CMD_NOT_FOUND);\n\t\t}\n\t}", "public void verifyAndRegister() {\n // All top level commands are supposed to be registered in the command manager\n this.internalTree.children.stream().map(Node::getValue).forEach(commandArgument -> {\n if (!(commandArgument instanceof StaticArgument)) {\n throw new IllegalStateException(\"Top level command argument cannot be a variable\");\n }\n });\n\n this.checkAmbiguity(this.internalTree);\n\n // Verify that all leaf nodes have command registered\n this.getLeaves(this.internalTree).forEach(leaf -> {\n if (leaf.getOwningCommand() == null) {\n throw new NoCommandInLeafException(leaf);\n } else {\n final Command<C> owningCommand = leaf.getOwningCommand();\n this.commandManager.getCommandRegistrationHandler().registerCommand(owningCommand);\n }\n });\n\n // Register command permissions\n this.getLeavesRaw(this.internalTree).forEach(node -> {\n // noinspection all\n final CommandPermission commandPermission = node.getValue().getOwningCommand().getCommandPermission();\n /* All leaves must necessarily have an owning command */\n node.nodeMeta.put(\"permission\", commandPermission);\n // Get chain and order it tail->head then skip the tail (leaf node)\n List<Node<CommandArgument<C, ?>>> chain = this.getChain(node);\n Collections.reverse(chain);\n chain = chain.subList(1, chain.size());\n // Go through all nodes from the tail upwards until a collision occurs\n for (final Node<CommandArgument<C, ?>> commandArgumentNode : chain) {\n final CommandPermission existingPermission = (CommandPermission) commandArgumentNode.nodeMeta\n .get(\"permission\");\n\n CommandPermission permission;\n if (existingPermission != null) {\n permission = OrPermission.of(Arrays.asList(commandPermission, existingPermission));\n } else {\n permission = commandPermission;\n }\n\n /* Now also check if there's a command handler attached to an upper level node */\n if (commandArgumentNode.getValue() != null && commandArgumentNode\n .getValue()\n .getOwningCommand() != null) {\n final Command<C> command = commandArgumentNode.getValue().getOwningCommand();\n if (this\n .getCommandManager()\n .getSetting(CommandManager.ManagerSettings.ENFORCE_INTERMEDIARY_PERMISSIONS)) {\n permission = command.getCommandPermission();\n } else {\n permission = OrPermission.of(Arrays.asList(permission, command.getCommandPermission()));\n }\n }\n\n commandArgumentNode.nodeMeta.put(\"permission\", permission);\n }\n });\n }", "void legalCommand();", "@Override\n\tpublic void teleopInit() {\n\n\t\tSystem.out.println(\"Teleop init\");\n\t\tif (autonomousCommand != null)\n\t\t\tautonomousCommand.cancel();\n\t\tScheduler.getInstance().add(new DriveCommand());\n\n\t\t\n\t}", "public void registerCommand(BaseCommand baseCommand) throws Exception {\n baseCommand.setShard(shard);\n Command botCommand = baseCommand.botCommand;\n for (BaseCommand cmd : baseCommands) {\n if (StringUtils.stripAccents(cmd.getCommandIdentifier()).equalsIgnoreCase(StringUtils.stripAccents\n (botCommand.getCommandIdentifier())))\n {\n System.out.println(\"Multiple baseCommands cannot be registered under the same name. Ignoring new \" +\n \"instance\" +\n \".\\n\" +\n \"Name: \" + baseCommand.toString());\n return;\n }\n }\n botCommand.setupSubcommands();\n baseCommands.add(baseCommand);\n commandUsages.put(baseCommand.commandIdentifier, (long) 0);\n System.out.println(\"Successfully registered \" + baseCommand.toString());\n }", "public abstract void checkingCommand(String nameOfCommand, ArrayList<Unit> units);", "@Test\n public void testSubsystem1_1() throws Exception {\n KernelServices servicesA = super.createKernelServicesBuilder(createAdditionalInitialization())\n .setSubsystemXml(readResource(\"keycloak-1.1.xml\")).build();\n Assert.assertTrue(\"Subsystem boot failed!\", servicesA.isSuccessfulBoot());\n ModelNode modelA = servicesA.readWholeModel();\n super.validateModel(modelA);\n }", "@Override\n public void adjustStartEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity oldLatestProcessDefinition) {\n super.adjustStartEventSubscriptions(newLatestProcessDefinition, oldLatestProcessDefinition);\n\n LOG.debug(\"Adding start event simulation timers.\");\n removeObsoleteStartEventSimulationJobs(newLatestProcessDefinition);\n addStartEventSimulationJobs(newLatestProcessDefinition);\n }", "private static void performRoomManagement() {\n\t\t\r\n\t\t\r\n\r\n\t}", "public void testRunnableWithOtherRule() {\n \t\tISchedulingRule rule = new ISchedulingRule() {\n \t\t\tpublic boolean contains(ISchedulingRule rule) {\n \t\t\t\treturn rule == this;\n \t\t\t}\n \t\t\tpublic boolean isConflicting(ISchedulingRule rule) {\n \t\t\t\treturn rule == this;\n \t\t\t}\n \t\t};\n \t\ttry {\n \t\t\tgetWorkspace().run(new IWorkspaceRunnable() {\n \t\t\t\tpublic void run(IProgressMonitor monitor) {\n \t\t\t\t\t//noop\n \t\t\t\t}\n \t\t\t}, rule, IResource.NONE, getMonitor());\n \t\t} catch (CoreException e) {\n \t\t\tfail(\"1.99\", e);\n \t\t}\n \t}", "private void loadRegistredCommands() {\n ServiceLoader<Command> loader = ServiceLoader.load(Command.class);\n for (Command command : loader) {\n addCommand(command);\n }\n }", "public void autonomousInit(){\n\t \t//resetAndDisableSystems();\n\t\t \n\t \tautonomousCommand = (Command) autoChooser.getSelected();\n\t \tautonomousCommand.start();\n\t \t\n\t \t\n\t }", "private void scheduleOrExecuteJob() {\n try {\n for (TaskScheduler entry : this.schedulers.values()) {\n StandardTaskScheduler scheduler = (StandardTaskScheduler) entry;\n // Maybe other thread close&remove scheduler at the same time\n synchronized (scheduler) {\n this.scheduleOrExecuteJobForGraph(scheduler);\n }\n }\n } catch (Throwable e) {\n LOG.error(\"Exception occurred when schedule job\", e);\n }\n }", "private void registerCommands() {\n CommandSpec showBanpoints = CommandSpec.builder().permission(\"dtpunishment.banpoints.show\")\r\n .description(Text.of(\"Show how many Banpoints the specified player has \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))))\r\n .executor(childInjector.getInstance(CommandBanpointsShow.class)).build();\r\n\r\n CommandSpec addBanpoints = CommandSpec.builder().permission(\"dtpunishment.banpoints.add\")\r\n .description(Text.of(\"Add a specified amount of Banpoints to a player \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))),\r\n GenericArguments.onlyOne(GenericArguments.integer(Text.of(\"amount\"))))\r\n .executor(childInjector.getInstance(CommandBanpointsAdd.class)).build();\r\n\r\n CommandSpec removeBanpoints = CommandSpec.builder().permission(\"dtpunishment.banpoints.remove\")\r\n .description(Text.of(\"Remove a specified amount of Banpoints to a player \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))),\r\n GenericArguments.onlyOne(GenericArguments.integer(Text.of(\"amount\"))))\r\n .executor(childInjector.getInstance(CommandBanpointsRemove.class)).build();\r\n\r\n CommandSpec banpoints = CommandSpec.builder().permission(\"dtpunishment.banpoints\")\r\n .description(Text.of(\"Show the Banpoints help menu\")).arguments(GenericArguments.none())\r\n .child(showBanpoints, \"show\").child(addBanpoints, \"add\").child(removeBanpoints, \"remove\").build();\r\n\r\n Sponge.getCommandManager().register(this, banpoints, \"banpoints\", \"bp\");\r\n\r\n CommandSpec showMutepoints = CommandSpec.builder().permission(\"dtpunishment.mutepoints.show\")\r\n .description(Text.of(\"Show how many Mutepoints the specified player has \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))))\r\n .executor(childInjector.getInstance(CommandMutepointsShow.class)).build();\r\n\r\n CommandSpec addMutepoints = CommandSpec.builder().permission(\"dtpunishment.mutepoints.add\")\r\n .description(Text.of(\"Add a specified amount of Mutepoints to a player \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))),\r\n GenericArguments.onlyOne(GenericArguments.integer(Text.of(\"amount\"))))\r\n .executor(childInjector.getInstance(CommandMutepointsAdd.class)).build();\r\n\r\n CommandSpec removeMutepoints = CommandSpec.builder().permission(\"dtpunishment.mutepoints.add\")\r\n .description(Text.of(\"Add a specified amount of Mutepoints to a player \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))),\r\n GenericArguments.onlyOne(GenericArguments.integer(Text.of(\"amount\"))))\r\n .executor(childInjector.getInstance(CommandMutepointsRemove.class)).build();\r\n\r\n CommandSpec mutepoints = CommandSpec.builder().permission(\"dtpunishment.mutepoints\")\r\n .description(Text.of(\"Show the Mutepoints help menu\")).arguments(GenericArguments.none())\r\n .child(showMutepoints, \"show\").child(addMutepoints, \"add\").child(removeMutepoints, \"remove\").build();\r\n\r\n Sponge.getCommandManager().register(this, mutepoints, \"mutepoints\", \"mp\");\r\n\r\n CommandSpec playerInfo = CommandSpec.builder().permission(\"dtpunishment.playerinfo\")\r\n .description(Text.of(\"Show your info \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.optionalWeak(GenericArguments.requiringPermission(\r\n GenericArguments.user(Text.of(\"player\")), \"dtpunishment.playerinfo.others\"))))\r\n .executor(childInjector.getInstance(CommandPlayerInfo.class)).build();\r\n\r\n Sponge.getCommandManager().register(this, playerInfo, \"pinfo\", \"playerinfo\");\r\n\r\n CommandSpec addWord = CommandSpec.builder().permission(\"dtpunishment.word.add\")\r\n .description(Text.of(\"Add a word to the list of banned ones \"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.string(Text.of(\"word\"))))\r\n .executor(childInjector.getInstance(CommandWordAdd.class)).build();\r\n\r\n Sponge.getCommandManager().register(this, addWord, \"addword\");\r\n\r\n CommandSpec unmute = CommandSpec.builder().permission(\"dtpunishment.mutepoints.add\")\r\n .description(Text.of(\"Unmute a player immediately (removing all mutepoints)\"))\r\n .arguments(GenericArguments.onlyOne(GenericArguments.user(Text.of(\"player\"))))\r\n .executor(childInjector.getInstance(CommandUnmute.class)).build();\r\n\r\n CommandSpec reloadConfig = CommandSpec.builder().permission(\"dtpunishment.admin.reload\")\r\n .description(Text.of(\"Reload configuration from disk\"))\r\n .executor(childInjector.getInstance(CommandReloadConfig.class)).build();\r\n\r\n CommandSpec adminCmd = CommandSpec.builder().permission(\"dtpunishment.admin\")\r\n .description(Text.of(\"Admin commands for DTPunishment\")).child(reloadConfig, \"reload\")\r\n .child(unmute, \"unmute\").build();\r\n\r\n Sponge.getCommandManager().register(this, adminCmd, \"dtp\", \"dtpunish\");\r\n }", "@Command\n\tpublic void buscar() {\n\t}", "private void doCommand() {\n try {\n TimeUnit.SECONDS.sleep(2L);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "@Override\n public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n // setDefaultCommand(new MySpecialCommand());\n }", "@Override\n public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n // setDefaultCommand(new MySpecialCommand());\n }", "private void registerCommands(){\n getCommand(\"mineregion\").setExecutor(new MineRegionCommand());\n getCommand(\"cellblock\").setExecutor(new CellBlockCommand());\n getCommand(\"cell\").setExecutor(new CellCommand());\n getCommand(\"prisonblock\").setExecutor(new PrisonBlockCommand());\n getCommand(\"rankup\").setExecutor(new RankUpCommand());\n getCommand(\"portal\").setExecutor(new PortalCommand());\n }", "private static void executeTask02() {\n }", "public void teleopPeriodic() \r\n {\r\n Watchdog.getInstance().feed();\r\n Scheduler.getInstance().run();\r\n \r\n //Polls the buttons to see if they are active, if they are, it adds the\r\n //command to the Scheduler.\r\n if (mecanumDriveTrigger.get()) \r\n Scheduler.getInstance().add(new MechanumDrive());\r\n \r\n else if (tankDriveTrigger.get())\r\n Scheduler.getInstance().add(new TankDrive());\r\n \r\n else if (OI.rightJoystick.getRawButton(2))\r\n Scheduler.getInstance().add(new PolarMechanumDrive());\r\n \r\n resetGyro.get();\r\n \r\n //Puts the current command being run by DriveTrain into the SmartDashboard\r\n SmartDashboard.putData(DriveTrain.getInstance().getCurrentCommand());\r\n \r\n SmartDashboard.putString(ERRORS_TO_DRIVERSTATION_PROP, \"Test String\");\r\n \r\n \r\n }", "public void subTask(String name) {\n\r\n\t}", "void cronScheduledProcesses();", "public DefaultAutonomous(DriveSubsystem ds,\n ShooterSubSystem ss,\n LEDSubSystem ls,\n XboxController manipulator,\n double distanceInFeet) {\n // Add your commands in the super() call, e.g.\n // super(new FooCommand(), new BarCommand());\n super(new ShooterCommand(ss, ls, manipulator, true, Constants.kShooterSpeedSlow).withTimeout(5),\n new DriveADistanceInFeet(ds, distanceInFeet, true).withTimeout(5));\n }", "private static void setSubsystems()\n {\n //Components\n //Talons\n frontLeftTalon.setName(\"DrivetrainSubsystem\", \"FrontLeftDriveTalon\");\n frontRightTalon.setName(\"DrivetrainSubsystem\", \"FrontRightDriveTalon\");\n rearLeftTalon.setName(\"DrivetrainSubsystem\", \"RearLeftDriveTalon\");\n rearRightTalon.setName(\"DrivetrainSubsystem\", \"RearRightDriveTalon\");\n //Sensors\n //navX.setName(\"SensorSubsystem\", \"NavX\");\n System.out.print(pigeon.getAbsoluteCompassHeading());\n \n //Subsystems\n drivetrainSubsystem.setName(\"DrivetrainSubsystem\", \"DrivetrainSubsystem\");\n sensorSubsystem.setName(\"SensorSubsystem\", \"SensorSubsystem\");\n }", "@Override\n public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n setDefaultCommand(new HatchExtend());\n setDefaultCommand(new HatchRetract());\n }", "private void scheduleJob() {\n\n }", "@Override\r\n public void robotPeriodic() {\r\n // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled\r\n // commands, running already-scheduled commands, removing finished or interrupted commands,\r\n // and running subsystem periodic() methods. This must be called from the robot's periodic\r\n // block in order for anything in the Command-based framework to work.\r\n CommandScheduler.getInstance().run();\r\n }", "@Test\n\tpublic void testAddCommand1() {\n\t\tString task1 = \"normal task\";\n\t\tString task2 = \"priority task\";\n\t\tString label = testData.getCurrLabel();\n\t\t\n\t\tAddCommand comd = new AddCommand(task1, new TDTDateAndTime(), false);\n\t\tassertEquals(String.format(AddCommand.MESSAGE_ADD_FEEDBACK, label), comd.execute(testData));\n\t\t\n\t\tcomd = new AddCommand(task2, new TDTDateAndTime(), true);\n\t\tassertEquals(String.format(AddCommand.MESSAGE_ADD_FEEDBACK, label), comd.execute(testData));\n\t\t\n\t\tArrayList<Task> taskList = testData.getTaskListFromLabel(label);\n\t\tassertEquals(2, taskList.size());\n\t\tassertTrue(task2.equals(taskList.get(0).getDetails()));\n\t\tassertTrue(taskList.get(0).isHighPriority());\n\t\tassertTrue(task1.equals(taskList.get(1).getDetails()));\n\t\tassertFalse(taskList.get(1).isHighPriority());\n\t}", "protected void execute() {\n\t\tif(RobotMap.gearDoorExtended)\n\t\t\tgearSubsystem.retractPiston();\n\t\telse\n\t\t\tif(Robot.oi.getRightStick().getTrigger() || auton)\n\t\t\t\tgearSubsystem.extendPiston();\n\t\t\n\t}", "@Override\n\tpublic void autonomousInit() {\n\t\tif (autonomousCommand != null)\n\t\t\tlowGearCommand.start();\n\t\tautonomousCommand.start();\n\t}", "public void subTask(String tr) {\n\t\t\n\t}", "public void initDefaultCommand() {\r\n // Set the default command for a subsystem here.\r\n //setDefaultCommand\r\n }", "private void processWTBy(WasTriggeredBy dep) {\n\n\t}", "@Override\n public void autonomousInit() {\n\tgameData.readGameData();\n\tautonomousCommand = (Command) chooserMode.getSelected();\n\tdriveSubsystem.resetEncoders();\n\televatorSubsystem.resetEncoder();\n\t// schedule the autonomous command\n\tif (autonomousCommand != null) {\n\t // SmartDashboard.putString(\"i\", \"nit\");\n\t autonomousCommand.start();\n\t}\n }", "@Override\n public void run() {\n CuratorLocker locker = new CuratorLocker(schedulerBuilder.getServiceSpec());\n\n Runtime.getRuntime().addShutdownHook(new Thread(() -> {\n LOGGER.info(\"Shutdown initiated, releasing curator lock\");\n locker.unlock();\n }));\n locker.lock();\n\n SchedulerConfig schedulerConfig = SchedulerConfig.fromEnv();\n Metrics.configureStatsd(schedulerConfig);\n AbstractScheduler scheduler = schedulerBuilder.build();\n scheduler.start();\n Optional<Scheduler> mesosScheduler = scheduler.getMesosScheduler();\n if (mesosScheduler.isPresent()) {\n SchedulerApiServer apiServer = new SchedulerApiServer(schedulerConfig, scheduler.getResources());\n apiServer.start(new AbstractLifeCycle.AbstractLifeCycleListener() {\n @Override\n public void lifeCycleStarted(LifeCycle event) {\n scheduler.markApiServerStarted();\n }\n });\n\n runScheduler(\n scheduler.frameworkInfo,\n mesosScheduler.get(),\n schedulerBuilder.getServiceSpec(),\n schedulerBuilder.getSchedulerConfig(),\n schedulerBuilder.getStateStore());\n } else {\n /**\n * If no MesosScheduler is provided this scheduler has been deregistered and should report itself healthy\n * and provide an empty COMPLETE deploy plan so it may complete its UNINSTALL.\n *\n * See {@link UninstallScheduler#getMesosScheduler()}.\n */\n Plan emptyDeployPlan = new Plan() {\n @Override\n public List<Phase> getChildren() {\n return Collections.emptyList();\n }\n\n @Override\n public Strategy<Phase> getStrategy() {\n return new SerialStrategy<>();\n }\n\n @Override\n public UUID getId() {\n return UUID.randomUUID();\n }\n\n @Override\n public String getName() {\n return Constants.DEPLOY_PLAN_NAME;\n }\n\n @Override\n public List<String> getErrors() {\n return Collections.emptyList();\n }\n };\n\n PlanManager emptyPlanManager = DefaultPlanManager.createProceeding(emptyDeployPlan);\n PlansResource emptyPlanResource = new PlansResource();\n emptyPlanResource.setPlanManagers(Arrays.asList(emptyPlanManager));\n\n schedulerBuilder.getStateStore().clearAllData();\n\n SchedulerApiServer apiServer = new SchedulerApiServer(\n schedulerConfig,\n Arrays.asList(\n emptyPlanResource,\n new HealthResource()));\n apiServer.start(new AbstractLifeCycle.AbstractLifeCycleListener() {\n @Override\n public void lifeCycleStarted(LifeCycle event) {\n LOGGER.info(\"Started trivially healthy API server.\");\n }\n });\n }\n }", "protected abstract void scheduler_init();", "private void processCommand(String command) {\n if (command.equals(\"a\")) {\n doAddTask();\n } else if (command.equals(\"r\")) {\n doRemoveTask();\n } else if (command.equals(\"c\")) {\n doMarkTaskAsCompleted();\n } else if (command.equals(\"m\")) {\n doModifyTask();\n } else if (command.equals(\"v\")) {\n doViewAllTasks();\n } else if (command.equals(\"ct\")) {\n doViewAllCompletedTasks();\n } else if (command.equals(\"s\")) {\n saveTasks();\n } else {\n System.out.println(\"Invalid selection, kindly select from the options available.\");\n }\n }", "@Override\n public void robotPeriodic() {\n // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled\n // commands, running already-scheduled commands, removing finished or interrupted commands,\n // and running subsystem periodic() methods. This must be called from the robot's periodic\n // block in order for anything in the Command-based framework to work.\n CommandScheduler.getInstance().run();\n }", "@Override\n\tprotected ArrayList<String> getCommandsToExecute() {\n\t\treturn null;\n\t}", "public void noSuchCommand() {\n }", "public void registerCommands() {\n\t CommandSpec cmdCreate = CommandSpec.builder()\n\t .arguments(\n\t onlyOne(GenericArguments.string(Text.of(\"type\"))),\n\t onlyOne(GenericArguments.string(Text.of(\"id\"))))\n\t .executor(CmdCreate.getInstance())\n\t .permission(\"blockyarena.create\")\n\t .build();\n\n\t CommandSpec cmdRemove = CommandSpec.builder()\n\t .arguments(\n\t onlyOne(GenericArguments.string(Text.of(\"type\"))),\n\t onlyOne(GenericArguments.string(Text.of(\"id\"))))\n\t .executor(CmdRemove.getInstance())\n\t .permission(\"blockyarena.remove\")\n\t .build();\n\n\t CommandSpec cmdJoin = CommandSpec.builder()\n\t .arguments(\n\t onlyOne(GenericArguments.string(Text.of(\"mode\")))\n\t )\n\t .executor(CmdJoin.getInstance())\n\t .build();\n\n\t CommandSpec cmdQuit = CommandSpec.builder()\n\t .executor(CmdQuit.getInstance())\n\t .build();\n\n\t CommandSpec cmdEdit = CommandSpec.builder()\n\t .arguments(\n\t onlyOne(GenericArguments.string(Text.of(\"id\"))),\n\t onlyOne(GenericArguments.string(Text.of(\"type\"))),\n\t GenericArguments.optional(onlyOne(GenericArguments.string(Text.of(\"param\"))))\n\t )\n\t .executor(CmdEdit.getInstance())\n\t .permission(\"blockyarena.edit\")\n\t .build();\n\n\t CommandSpec cmdKit = CommandSpec.builder()\n\t .arguments(onlyOne(GenericArguments.string(Text.of(\"id\"))))\n\t .executor(CmdKit.getInstance())\n\t .build();\n\n\t CommandSpec arenaCommandSpec = CommandSpec.builder()\n\t .child(cmdEdit, \"edit\")\n\t .child(cmdCreate, \"create\")\n\t .child(cmdRemove, \"remove\")\n\t .child(cmdJoin, \"join\")\n\t .child(cmdQuit, \"quit\")\n\t .child(cmdKit, \"kit\")\n\t .build();\n\n\t Sponge.getCommandManager()\n\t .register(BlockyArena.getInstance(), arenaCommandSpec, \"blockyarena\", \"arena\", \"ba\");\n\t }", "@Override\n public void run() {\n\n\n\n System.out.println(\"run scheduled jobs.\");\n\n\n checkBlackOutPeriod();\n\n\n\n checkOfficeActionPeriod1();\n\n checkAcceptedFilings();\n\n checkNOAPeriod();\n checkFilingExtensions();\n\n\n\n }", "public void mainCommands() {\n\t\tint inputId = taskController.getInt(\"Please input the number of your option: \", \"You must input an integer!\");\n\t\tswitch (inputId) {\n\t\tcase 1:\n\t\t\tthis.taskController.showTaskByTime();\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tthis.taskController.filterAProject();\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tthis.taskController.addTask();\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tthis.taskController.EditTask();\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tthis.taskController.removeTask();\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tthis.taskController.saveTaskList();\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tSystem.out.println(\"Thank you for coming, Bye!\");\n\t\t\tthis.exit = true;\n\t\t\t// save the task list before exit all the time.\n\t\t\tthis.taskController.saveTaskList();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tSystem.out.println(\"This is not a valid option, please input 1 ~ 7.\");\n\t\t\tbreak;\n\t\t}\n\n\t}", "@Override\n\t\tvoid runCommand() {\n\t\t\ttrigger.execute();\n\t\t}", "@Override\n protected void execute() {\n Robot.toteLifterSubsystem.setEjectorState(EjectorState.EXTENDING, ramper.process(1.0));\n }", "@Override\r\n\tpublic void doInitialSchedules() {\n\t}", "@Override\n public void autonomousPeriodic() {\n\t// updateDiagnostics();9\n\tScheduler.getInstance().run();\n }", "private static void CLIapplication() {\n\n\t\tboolean done = false;\n\t\tdo {\n\t\t\tint choice = HQmenu();\n\t\t\tSite newSite;\n\n\t\t\tswitch(choice) {\n\t\t\tcase 1:\n\t\t\t\tSystem.out.println(\"Register exchange office\");\n\t\t\t\tnewSite = createNewSite();\n\t\t\t\tif(sites.containsKey(newSite.getSiteName())) {\n\t\t\t\t\tSystem.out.println(\"Site already registred!1\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsites.putIfAbsent(newSite.getSiteName(), newSite);\t\t\t\t\t\n\t\t\t\t\twriteNewSiteToConfigFile(newSite.getSiteName());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif(sites.isEmpty()) {\n\t\t\t\t\tSystem.out.println(\"You need to register site(s) first.\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tCLIHelper.menuInput();\n\t\t\t\tbreak;\n\t\t\tcase 0:\n\t\t\t\tdone = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Not a valid menu choice!\");\n\t\t\t}\n\t\t\tlogger.info(\"-------Task_Done-------\\n\");\n\t\t}while(!done);\n\t}", "@Override\n\tpublic void teleopPeriodic() {\n\t\tSmartDashboard.putString(\"DT Current Command\", \" \");\n\t\tSmartDashboard.putString(\"SHOOTER Current Command\", \" \");\n\t\tSmartDashboard.putString(\"SHOOTERPIVOT Current Command\", \" \");\n\t\tSmartDashboard.putString(\"INTAKE Current Command\", \" \");\n\t\t\n\t\tScheduler.getInstance().run();\n//\t\t\n//\t\tRobot.drivetrain.leftLED.set(true);\n//\t\tRobot.drivetrain.rightLED.set(false);\n\n\t\tif(!autoAiming) {\n\t\t\tnew DriveForwardRotate(correctForDeadZone(oi.driver.getForward()), correctForDeadZone(oi.driver.getRotation())).start();\n\t\t}\n\t\t//new DriveForwardRotate(oi.driver.getForward(), oi.driver.getRotation()).start();\n\t\t\n\t\tif(oi.autoAim() && !prevStateAutoAim){\n\t\t\t//new SetPivotPosition(PivotPID.AUTO_CAMERA_AIM_POSITION).start(\n//\t\t\tnew AutoAim().start();\n\t\t\tnew AutoAim(TurnConstants.AIM_VELOCITY).start(); //this is a press and hold button 3 on joystick\n\t\t\t\n\t\t}\n\t\t\n\t\tif (readyToShoot && oi.operator.shootBallFlywheels() && oi.operator.shoot()){\n//\t\t\tSystem.out.println(\"SHOOT THE SHOOTER -- ready to shoot\");\n\t\t\tnew ShootTheShooter().start();\n\t\t}\n\t\t\n\t\t\n\t\t//INTAKE ------2 button\n\t\tif (oi.operator.intakeUp() && !prevStateIntakeUp){\n\t\t\tnew SetIntakePosition(IntakeSubsystem.UP).start();\n\t\t}\n\t\tif (oi.operator.intakeDeploy() && !prevStateIntakeDeployed){\n\t\t\tnew SetIntakePosition(!IntakeSubsystem.UP).start();\n\t\t}\n\t\t\n\t\t//CAMERA PISTON\n\t\t\n\t\t//move up\n\t\tif (oi.driver.isCameraUpPressed()){\n\t\t\tnew SetCameraPiston(CameraSubsystem.CAM_UP).start();\n\t\t}\n\t\telse{\n\t\t\tnew SetCameraPiston(!CameraSubsystem.CAM_UP).start();\n\t\t}\n\t\t\n//\t\tif (oi.driver.isCameraUpPressed() && !prevStateCameraUp){\n//\t\t\tnew SetCameraPiston(cameraUp ? !CameraSubsystem.CAM_UP : CameraSubsystem.CAM_UP).start();\n//\t\t\tcameraUp = !cameraUp;\n//\t\t}\n//\t\telse{\n//\t\t\tnew SetCameraPiston(cameraUp ? CameraSubsystem.CAM_UP : !CameraSubsystem.CAM_UP).start();\n//\t\t}\n\t\t\n\t\t\n\t\tif (oi.operator.isSemiAutonomousIntakePressed() && !prevStateSemiAutoIntake){\n\t\t\tnew SemiAutoLoadBall().start();\n\t\t}\n//\t\t\n\t\t\n\t\t//pivot state\n//\t\tif (oi.operator.pivotShootState() && !prevStatePivotUp){\n//\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.FAR_SHOOT_STATE).start();\n//\t\t}\n//\t\telse if(oi.operator.resetPivot() && !prevStateResetButton) {\n//\t\t\t new ResetPivot().start();\n//\t\t}\n//\t\telse if (oi.operator.pivotStoreState() && !prevStatePivotMiddle){\n//\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.STORING_STATE).start();\n//\t\t}\n\t\t\n\t\t//PIVOT\n\t\t\n\t\t//if going up\n\t\tif (oi.operator.pivotCloseShot() && !prevStatePivotCloseShot){\n\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.CLOSE_SHOOT_STATE).start();\t\t\n\t\t}\n\t\t//if going down\n\t\telse if(oi.operator.pivotFarShot() && !prevStatePivotFarShot) {\n\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.FAR_SHOOT_STATE).start();\n\t\t}\n\t\telse if (oi.operator.pivotStoreState()&& !prevStateStore){\n\t\t\tnew SetPivotState(ShooterPivotSubsystem.PivotPID.STORING_STATE).start();\n\t\t}\n\t\telse if (oi.operator.pivotReset() && !prevStateResetSafety){\n\t\t\tnew ResetPivot().start();\n\t\t}\n\t\telse if (oi.driver.isDefenseShot() && prevStateDefenseShot){\n\t\t\tnew SetPivotPosition(ShooterPivotSubsystem.PivotPID.ANTI_DEFENSE_POSITION).start();\n\t\t}\n\t\n\t\t\n\t\tif (!semiAutoIsRunning){\n//\t\t\n\t\t\t//intake purging/running\n\t\t\tif(oi.operator.purgeIntake()) {\n\t\t\t\t//new SetIntakeSpeed(IntakeSubsystem.FORWARD_ROLLER_PURGE_SPEED, IntakeSubsystem.CENTERING_MODULE_PURGE_SPEED).start(); \n\t\t\t\tnew RunAllRollers(ShooterSubsystem.OUT, !ShooterSubsystem.UNTIL_IR).start();\n\t\t\t\tallIntakeRunning = true;\n\t\t\t} else if (oi.operator.runIntake()) {\n\t\t\t\t//new SetIntakeSpeed(IntakeSubsystem.FORWARD_ROLLER_INTAKE_SPEED, IntakeSubsystem.CENTERING_MODULE_INTAKE_SPEED).start();\n\t\t\t\tnew RunAllRollers(ShooterSubsystem.IN, ShooterSubsystem.UNTIL_IR).start();\n//\t\t\t\tnew SemiAutoLoadBall().start();\n\t\t\t\tallIntakeRunning = true;\n\t\t\t} else {\n\t\t\t\t//just the intakes off here to avoid conflicts\n\t\t\t\tnew SetIntakeSpeed(IntakeSubsystem.INTAKE_OFF_SPEED, IntakeSubsystem.INTAKE_OFF_SPEED).start();\n\t\t\t\t//new EndSemiAuto(true).start();\n\t\t\t\t//new RunAllRollers(ShooterSubsystem.OFF, !ShooterSubsystem.UNTIL_IR).start();\n\t\t\t\tallIntakeRunning = false;\n\t\t\t}\n\t\t\t\n\t\t\t//flywheel control\n\t\t\tif (!allIntakeRunning){\n//\t\t\t\tif(oi.operator.loadBallFlywheels()){\n//\t\t\t\t\tnew SetFlywheels(ShooterSubsystem.FLYWHEEL_INTAKE_POWER, -ShooterSubsystem.FLYWHEEL_INTAKE_POWER).start();;\n//\t\t\t\t\tflywheelShootRunning = true;\n//\t\t\t\t} else \n\t\t\t\tif(oi.operator.shootBallFlywheels()) {\n\t\t\t\t\t//new SetFlywheels(0.7, -0.7).start();\n\t\t\t\t\tnew BangBangFlywheels(true).start();\n\t\t\t\t\tflywheelShootRunning = true;\n\t\t\t\t} else {\n\t\t\t\t\t//new SetFlywheels(0, 0).start();//BangBangFlywheels(false).start();\n\t\t\t\t\tflywheelShootRunning = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n//\t\t\tif(oi.operator.shoot()){\n//\t\t\t\tnew ShooterSet(DoubleSolenoid.Value.kForward).start();\n//\t\t\t} else {\n//\t\t\t\tnew ShooterSet(DoubleSolenoid.Value.kReverse).start();\n//\t\t\t}\n//\t\t\t\n\t\t\tif (!allIntakeRunning && !flywheelShootRunning){\n\t\t\t\tnew SetFlywheels(0, 0).start();\n\t\t\t}\n\t\t\t\n\t\t\t//DEFENSE STATE\n\t\t\tif (oi.operator.isDefenseState() && !prevStateDefenseMode){\n\t\t\t\tnew SetDefenseMode().start();\n\t\t\t}\n\t\t}\n\t\t//tells us if bang bang works\n\t\treadyToShoot = ((Math.abs(shooter.getRightFlywheelRPM() - ShooterSubsystem.flywheelTargetRPM) < ShooterSubsystem.flywheelTolerance)\n\t\t\t\t&& (Math.abs(shooter.getLeftFlywheelRPM() - ShooterSubsystem.flywheelTargetRPM) < ShooterSubsystem.flywheelTolerance));\n\t\t\n\t\t\n\t\tif (oi.operator.isManualFirePiston() && !prevStateManualFirePiston){\n//\t\t\tSystem.out.println(\"SHOOT THE SHOOTER -- manual\");\n\t\t\tnew ShootTheShooter().start();\n\t\t}\n\t\t\n\t\t\n\t\tif(oi.driver.isDrivetrainHighGearButtonPressed()){\n\t\t\tdrivetrain.shift(DrivetrainSubsystem.HIGH_GEAR);\n\t\t\tcurrentGear = DrivetrainSubsystem.HIGH_GEAR;\n\t\t} else {\n\t\t\tdrivetrain.shift(!DrivetrainSubsystem.HIGH_GEAR);\n\t\t\tcurrentGear = !DrivetrainSubsystem.HIGH_GEAR;\n\t\t}\n\t\t\n\t\tisManualPressed = oi.operator.isManualOverrideOperator();\n\t\t\n\t\tif (!shooterPIDIsRunning){\n\t\t\tif(isManualPressed) {\n\t\t\t\tdouble pivotPower = oi.operator.getManualPower()/2.0;\n\t\t\t\t//shooterPivot.engageBrake(false);\n\t\t\t\tif (pivotPower > 0 && shooterPivot.pastMax() || pivotPower < 0 && shooterPivot.lowerLimitsTriggered()){\n\t\t\t\t\tpivotPower = 0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnew SetPivotPower(pivotPower).start();\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnew SetPivotPower(0).start();\n\t\t\t}\n\t\t}\n\t\t\n//\t\tSystem.out.println(\"Left: \" + Robot.drivetrain.motors[2].get() + \", Right: \" + (-Robot.drivetrain.motors[0].get()));\n//\t\tSystem.out.println(\"Left V: \" + Robot.drivetrain.leftEncoder.getRate() + \", Right V: \" + Robot.drivetrain.rightEncoder.getRate());\n//\t\tSystem.out.println(\"Accel z: \" + Robot.drivetrain.accel.getZ());\n\t\t\n\t\t\n\t\t//PREV STATES\n\t\tprevStateIntakeUp = oi.operator.intakeUp();\n\t\tprevStateIntakeDeployed = oi.operator.intakeDeploy();\n\t\tprevStateDriveShifter = oi.driver.isDrivetrainHighGearButtonPressed();\n\t\tprevStateShootButton = oi.operator.shoot();\n\t\t\n\t\tprevStatePivotCloseShot = oi.operator.pivotCloseShot();\n\t\tprevStatePivotFarShot = oi.operator.pivotFarShot();\n\t\tprevStateStore = oi.operator.pivotStoreState();\n\t\tprevStateResetSafety = oi.operator.pivotReset();\n\t\t\n\t\tprevStateSemiAutoIntake = oi.operator.isSemiAutonomousIntakePressed();\n\t\tprevStateDefenseMode = oi.operator.isDefenseState();\n\t\t\n\t\tprevStateManualFirePiston = oi.operator.isManualFirePiston();\n\t\tprevStateCameraUp = oi.driver.isCameraUpPressed();\n\t\tprevStateAutoAim = oi.autoAim();\n\t\tprevStateDefenseShot = oi.driver.isDefenseShot();\n\n\t\t\n\t\t//********updating subsystem*******//\n\t\t\n\t\t//shooter hal effect counter\n\t\t//shooterPivot.updateHalEffect();\n\t\t\n\t\t//update the flywheel speed constants\n\t\tshooter.updateShooterConstants();\n\t\t\n\t\t\n\t\t//brake\n\t\tif (!isManualPressed){ //if manual override isn't running\n\t\t\tif (!shooterPIDIsRunning && shooterPivot.motorLeft.get() < DEAD_ZONE_TOLERANCE && shooterPivot.motorRight.get() < DEAD_ZONE_TOLERANCE){\n\t\t\t\t\n\t\t\t\tif (pivotTimer.get() > MIN_STOPPED_TIME){\n\t\t\t\t\tnew EngageBrakes().start();\n\t\t\t\t}\n\t\t\t\t//if motor is 0 for the first time, start the timer\n\t\t\t\tif (!prevStateMotorPowerIs0){\n\t\t\t\t\tpivotTimer.reset();\n\t\t\t\t\tpivotTimer.start();\n\t\t\t\t}\n\t\t\t\t//keep this at the end\n\t\t\t\tprevStateMotorPowerIs0 = true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tshooterPivot.engageBrake(false);\n\t\t\t\t//keep this at the end\n\t\t\t\tpivotTimer.reset();\n\t\t\t\tprevStateMotorPowerIs0 = false;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tshooterPivot.engageBrake(false);\n\t\t\tpivotTimer.reset();\n\t\t}\n\t\t//System.out.println(shooterPivot.motorLeft.get());\n\t\t\n\t\t//LOGGING AND DASHBOARD\n\t\tlogAndDashboard();\n\t}", "private void updateDiagnostics() {\n\t// driveSubsystem.updateDiagnostics();\n\t// elevatorSubsystem.updateDiagnostics();\n\t// cubeSubsystem.updateDiagnostics();\n\t// cubeVision.updateDiagnostics();\n }", "public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n //setDefaultCommand(new MySpecialCommand());\n \tsetDefaultCommand(new DriveWithJoyStickCommand()); // TBD for Commandbased programming\n }", "abstract boolean shouldTaskActivate();", "public void doInitialSchedules() {\n ravenna.schedule();\n milan.schedule();\n venice.schedule();\n\n //Scheduling the public transportaton\n ravenna_milan.activate();\n milan_venice.activate();\n venice_ravenna.activate();\n }", "private void submitCollectSysTrafficTask() {\n\t\tL.i(this.getClass(), \"CollectSysTrafficTask()...\");\n\t\taddTask(new CollectSysTrafficTask());\n\t}", "@Override\n public void autonomousInit()\n {\n autonomousCommand = chooser.getSelected();\n \n /*\n * String autoSelected = SmartDashboard.getString(\"Auto Selector\",\n * \"Default\"); switch(autoSelected) { case \"My Auto\": autonomousCommand\n * = new MyAutoCommand(); break; case \"Default Auto\": default:\n * autonomousCommand = new ExampleCommand(); break; }\n */\n \n // schedule the autonomous command (example)\n if (autonomousCommand != null) \n {\n autonomousCommand.start();\n }\n }", "private synchronized void syncTypeChefAnalyzes() {\r\n\t\tif (threadInExecId.isEmpty()) {\r\n\t\t\tProjectConfigurationErrorLogger.getInstance().clearLogList();\r\n\t\t\trunTypeChefAnalyzes(featureProject.getSourceFolder());\r\n\t\t}\r\n\t\tthreadInExecId.add(Thread.currentThread().getId());\r\n\t}", "void execute() throws Exception {\n\n\t\tif (getSystemState(db) != SYSTEM_STATE_CREATED_COULD_BE_EXACTLY_ONE) {\n\t\t\tInteger ss = getSystemState(db);\n\t\t\tshutDown();\n\t\t\tthrow new Exception(\"System in wrong state for this task: \" + ss);\n\t\t}\n\n\t\tloadExecutionEngine(db);\n\t\tperformUpdate();\n\t\tshutDown();\n\t}", "@Override\n\tpublic boolean combine(EHICommand anotherCommand) {\n\t\treturn false;\n\t}", "public void execute() {\n if (valid()) {\n // behavior of the concrete command\n this.target_territory numArmies += to_deploy;\n }\n }", "@Override\n public void initDefaultCommand() {\n Robot.driveTrain.setDefaultCommand(new xboxDrive());\n // Set the default command for a subsystem here.\n // setDefaultCommand(new MySpecialCommand());\n }", "@Override\r\n\tprotected void beforeSendCommands(String cmds) {\n\r\n\t}", "@Override\r\n\tpublic void execute() \r\n\t\t{\n\t\tsourceArcs = parent.getSourceArcsFromID(child.getServerName());\r\n\t\ttargetArcs = parent.getTargetArcsFromID(child.getServerName());\r\n\t\tredo();\r\n\t\t}", "private void registToWX() {\n }", "public synchronized void initializeCommands() {\n/* 101 */ Set<String> ignoredPlugins = new HashSet<String>(this.yaml.getIgnoredPlugins());\n/* */ \n/* */ \n/* 104 */ if (ignoredPlugins.contains(\"All\")) {\n/* */ return;\n/* */ }\n/* */ \n/* */ \n/* 109 */ label61: for (Command command : this.server.getCommandMap().getCommands()) {\n/* 110 */ if (commandInIgnoredPlugin(command, ignoredPlugins)) {\n/* */ continue;\n/* */ }\n/* */ \n/* */ \n/* 115 */ for (Class c : this.topicFactoryMap.keySet()) {\n/* 116 */ if (c.isAssignableFrom(command.getClass())) {\n/* 117 */ HelpTopic t = ((HelpTopicFactory)this.topicFactoryMap.get(c)).createTopic(command);\n/* 118 */ if (t != null) { addTopic(t); continue label61; }\n/* */ continue label61;\n/* */ } \n/* 121 */ if (command instanceof PluginCommand && c.isAssignableFrom(((PluginCommand)command).getExecutor().getClass())) {\n/* 122 */ HelpTopic t = ((HelpTopicFactory)this.topicFactoryMap.get(c)).createTopic(command);\n/* 123 */ if (t != null) addTopic(t);\n/* */ \n/* */ } \n/* */ } \n/* 127 */ addTopic((HelpTopic)new GenericCommandHelpTopic(command));\n/* */ } \n/* */ \n/* */ \n/* 131 */ for (Command command : this.server.getCommandMap().getCommands()) {\n/* 132 */ if (commandInIgnoredPlugin(command, ignoredPlugins)) {\n/* */ continue;\n/* */ }\n/* 135 */ for (String alias : command.getAliases()) {\n/* */ \n/* 137 */ if (this.server.getCommandMap().getCommand(alias) == command) {\n/* 138 */ addTopic(new CommandAliasHelpTopic(\"/\" + alias, \"/\" + command.getLabel(), this));\n/* */ }\n/* */ } \n/* */ } \n/* */ \n/* */ \n/* 144 */ Collection<HelpTopic> filteredTopics = Collections2.filter(this.helpTopics.values(), Predicates.instanceOf(CommandAliasHelpTopic.class));\n/* 145 */ if (!filteredTopics.isEmpty()) {\n/* 146 */ addTopic((HelpTopic)new IndexHelpTopic(\"Aliases\", \"Lists command aliases\", null, filteredTopics));\n/* */ }\n/* */ \n/* */ \n/* 150 */ Map<String, Set<HelpTopic>> pluginIndexes = new HashMap<String, Set<HelpTopic>>();\n/* 151 */ fillPluginIndexes(pluginIndexes, this.server.getCommandMap().getCommands());\n/* */ \n/* 153 */ for (Map.Entry<String, Set<HelpTopic>> entry : pluginIndexes.entrySet()) {\n/* 154 */ addTopic((HelpTopic)new IndexHelpTopic(entry.getKey(), \"All commands for \" + (String)entry.getKey(), null, entry.getValue(), \"Below is a list of all \" + (String)entry.getKey() + \" commands:\"));\n/* */ }\n/* */ \n/* */ \n/* 158 */ for (HelpTopicAmendment amendment : this.yaml.getTopicAmendments()) {\n/* 159 */ if (this.helpTopics.containsKey(amendment.getTopicName())) {\n/* 160 */ ((HelpTopic)this.helpTopics.get(amendment.getTopicName())).amendTopic(amendment.getShortText(), amendment.getFullText());\n/* 161 */ if (amendment.getPermission() != null) {\n/* 162 */ ((HelpTopic)this.helpTopics.get(amendment.getTopicName())).amendCanSee(amendment.getPermission());\n/* */ }\n/* */ } \n/* */ } \n/* */ }", "public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n setDefaultCommand(new GearPickupClampIn());\n }", "private static void incrementLaunchOrder()\r\n\t{\r\n\t\tlaunchOrder++;\r\n\t}", "public void autonomousInit() {\n autonomousCommand = (Command) autoChooser.getSelected();\n autonomousCommand.start();\n// \n }", "@Override\n public void autonomousPeriodic()\n {\n commonPeriodic();\n }", "public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n \tsetDefaultCommand(new DriveWithJoystick());\n }", "void\t\tregisterCommandDependentWidget(MiPart widget, String command);", "@StartStep(localName=\"command-engineering\", after={\"config\"})\n public static void startCommandEngineering(LifecycleContext context) \n {\n // for each class that is a Catalog or Command, create an entry for those in the context.\n ClassScanner classScanner = new ClassScanner(context);\n classScanner.scan();\n }", "public void initDefaultCommand() {\n // Set the default command for a subsystem here.\n //setDefaultCommand(new MySpecialCommand());\n \tsetDefaultCommand(new VelocityDriveCommand());\n }", "public interface SuperCommand {\n\n /**\n * Setups anything that is needed for this command.\n * <br/><br/>\n * It is recommended you do the following in this method:\n * <ul>\n * <li>Register any of the sub-commands of this command;</li>\n * <li>Define the permission required to use this command using {@link CompositeCommand#setPermission(String)};</li>\n * <li>Define whether this command can only be run by players or not using {@link CompositeCommand#setOnlyPlayer(boolean)};</li>\n * </ul>\n */\n void setup();\n\n /**\n * Returns whether the command can be executed by this user or not.\n * It is recommended to send messages to let this user know why they could not execute the command.\n * Note that this is run previous to {@link #execute(User, String, List)}.\n * @param user the {@link User} who is executing this command.\n * @param label the label which has been used to execute this command.\n * It can be {@link CompositeCommand#getLabel()} or an alias.\n * @param args the command arguments.\n * @return {@code true} if this command can be executed, {@code false} otherwise.\n * @since 1.3.0\n */\n default boolean canExecute(User user, String label, List<String> args) {\n return true;\n }\n\n /**\n * Defines what will be executed when this command is run.\n * @param user the {@link User} who is executing this command.\n * @param label the label which has been used to execute this command.\n * It can be {@link CompositeCommand#getLabel()} or an alias.\n * @param args the command arguments.\n * @return {@code true} if the command executed successfully, {@code false} otherwise.\n */\n boolean execute(User user, String label, List<String> args);\n\n /**\n * Tab Completer for CompositeCommands.\n * Note that any registered sub-commands will be automatically added to the list.\n * Use this to add tab-complete for things like names.\n * @param user the {@link User} who is executing this command.\n * @param alias alias for command\n * @param args command arguments\n * @return List of strings that could be used to complete this command.\n */\n default Optional<List<String>> tabComplete(User user, String alias, List<String> args) {\n return Optional.empty();\n }\n\n}", "private void customCommands(MessageEvent message) {\r\n String command = message.getMessage();\r\n \r\n if (!reservedCommands.contains(command)) {\r\n String[]info;\r\n info = manager.getCommandFromDatabase(command, message.getChannel().getName());\r\n\r\n //checks if the command is in custom mod commands\r\n if (info[1].matches(\"-m\")) {\r\n if (message.getChannel().getOps().contains(message.getUser())) {\r\n message.getChannel().send().message(info[0]);\r\n } \r\n else {\r\n message.respond(\"You're not allowed to use this command.\");\r\n }\r\n }\r\n //checks if the command is in the custom commands available to everyone\r\n else if (info[1].matches(\"-e\")) {\r\n message.getChannel().send().message(info[0]);\r\n } \r\n else {\r\n message.respond(\"No such command exists\");\r\n }\r\n }\r\n }", "public static void twoClientSetupProcesses(List<String> aClientTags, List<String> aServerTags ) {\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setProcessTeams(Arrays.asList(\"RegistryBasedDistributedProgram\"));\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setTerminatingProcesses(\"RegistryBasedDistributedProgram\", Arrays.asList(\"Client_0\", \"Client_1\"));\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setProcesses(\"RegistryBasedDistributedProgram\", Arrays.asList(\"Registry\", \"Server\", \"Client_1\", \"Client_0\"));\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Registry\", Arrays.asList(\"Registry\"));\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Server\", aServerTags);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Client_0\", aClientTags);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setEntryTags(\"Client_1\", aClientTags);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Registry\", FlexibleStaticArgumentsTestCase.TEST_REGISTRY_ARGS);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Server\", FlexibleStaticArgumentsTestCase.TEST_SERVER_ARGS);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Client_0\", FlexibleStaticArgumentsTestCase.TEST_CLIENT_0_ARGS);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setArgs(\"Client_1\", FlexibleStaticArgumentsTestCase.TEST_CLIENT_1_ARGS);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setGraderResourceReleaseTime(\"Registry\", 500);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setGraderResourceReleaseTime(\"Server\", 2000);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setGraderResourceReleaseTime(\"Client_0\", 5000);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().setGraderResourceReleaseTime(\"Client_1\", 5000);\n\tBasicExecutionSpecificationSelector.getBasicExecutionSpecification().getProcessTeams().forEach(team -> System.out.println(\"### \" + team));\n}", "@Override\r\n\tpublic void processWorkload() {\n this.spawnUser(periods.get(0).getPeriodStartTimePoint());\t\r\n\t}", "public void registerCommands() {\n commands = new LinkedHashMap<String,Command>();\n \n /*\n * admin commands\n */\n //file util cmds\n register(ReloadCommand.class);\n register(SaveCommand.class);\n \n //shrine cmds\n register(KarmaGetCommand.class);\n register(KarmaSetCommand.class); \n }", "@Override\n\tpublic void launchTasks() throws Exception {\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).switchFridgeOn();\n\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t1000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).setOndulatorPolicy(\"default\");\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t1000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).getFridgeTemperature();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t2000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTask(\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).getBatteryEnergy();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t3000, TimeUnit.MILLISECONDS);\n\t\t\t\t\n\t\t\t\tthis.scheduleTaskWithFixedDelay(\t\t\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).controllFridge();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 4000, 1000 // délai entre la fin d'une exécution et la suivante, à modifier \n\t\t\t\t\t\t,TimeUnit.MILLISECONDS) ;\n\t\t\t\t\n\t\t\t\tthis.scheduleTaskWithFixedDelay(\t\t\n\t\t\t\t\t\tnew AbstractComponent.AbstractTask() {\n\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t((Controller)this.getTaskOwner()).getEPConsommation();\n\t\t\t\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\t\t\t\tthrow new RuntimeException(e) ;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000, 4000 // délai entre la fin d'une exécution et la suivante, à modifier \n\t\t\t\t\t\t,TimeUnit.MILLISECONDS) ;\n\t}", "private void fireEvents() {\n\n if (clockTickCount % clockTicksTillWorkloadChange == 0) {\n clockEventPublisher.fireTriggerWorkloadHandlerEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n // if (clockTickCount % clockTicksTillScalingDecision == 0) {\n // clockEventPublisher.fireTriggerAutoScalerEvent(clockTickCount,\n // intervalDurationInMilliSeconds);\n // }\n\n clockEventPublisher.fireClockEvent(clockTickCount, intervalDurationInMilliSeconds);\n\n // INfrastruktur\n if (clockTickCount % clockTicksTillPublishInfrastructureState == 0) {\n clockEventPublisher.fireTriggerPublishInfrastructureStateEvent(clockTickCount,\n intervalDurationInMilliSeconds);\n\n }\n\n // Queue\n if (clockTickCount % clockTicksTillPublishQueueState == 0) {\n\n clockEventPublisher.fireTriggerPublishQueueStateEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n }" ]
[ "0.5763735", "0.5597857", "0.5525979", "0.5434967", "0.53826046", "0.53644043", "0.5349786", "0.5344097", "0.5329482", "0.53283983", "0.5299414", "0.5261541", "0.5256005", "0.52316135", "0.52242804", "0.52031666", "0.5192441", "0.5177707", "0.5162963", "0.51539654", "0.51415515", "0.5134641", "0.51294583", "0.5100808", "0.5100189", "0.5066171", "0.5060598", "0.5054086", "0.5053729", "0.50498563", "0.50488585", "0.50405574", "0.50277865", "0.50123876", "0.5007968", "0.50026834", "0.4999771", "0.49965122", "0.49965122", "0.49936378", "0.49794224", "0.49731174", "0.497165", "0.4958715", "0.49568033", "0.495138", "0.4950068", "0.49463072", "0.4937073", "0.4935162", "0.49308908", "0.492395", "0.49194476", "0.49173912", "0.4914265", "0.49138835", "0.4913285", "0.4910033", "0.49015456", "0.4901451", "0.48996598", "0.48919716", "0.48854455", "0.4877579", "0.48753968", "0.4871602", "0.48663017", "0.48651332", "0.48641244", "0.48611182", "0.4854777", "0.48534814", "0.48482594", "0.48376623", "0.48345962", "0.48321", "0.48316473", "0.48159063", "0.4814259", "0.48067343", "0.48038673", "0.48009992", "0.47940546", "0.47928053", "0.47895217", "0.4787412", "0.47868937", "0.47856048", "0.47854483", "0.4783526", "0.4783435", "0.47813517", "0.4780666", "0.47805867", "0.47790498", "0.4775403", "0.47718057", "0.4767328", "0.47598335", "0.47582492", "0.47543114" ]
0.0
-1
Triggered only when new data needs to be appended to the list Add whatever code is needed to append new items to the bottom of the list
@Override public void onLoadMore(int page, int totalItemsCount, RecyclerView view) { loadMoreRecyclerViewData(hal[0]); hal[0]++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addNewData(List<PublicPollResponseModel.Data> data) {\n //remove footer view\n this.removeFooterView(footer);\n //Add all data into the adapter\n adapter.addAll(data);\n //Notifies the attached observers that the underlying\n // data has been changed and any View reflecting the data set should refresh itself.\n adapter.notifyDataSetChanged();\n isLoading = false;\n }", "public void addAsPerFilterFirstLoad(List<Job> newJob){\n int currentSize = mJobList.size();\n //remove the current items\n mJobList.clear();\n //add all the new items\n mJobList.addAll(newJob);\n //tell the recycler view that all the old items are gone\n notifyItemRangeRemoved(0, currentSize);\n //tell the recycler view how many new items we added\n notifyItemRangeInserted(0, mJobList.size());\n }", "private void createList(DataSnapshot dataSnapshot) {\n if (daList.isEmpty()) {\n Item item = dataSnapshot.getValue(LostItem.class);\n daList.add(item);\n adapter.notifyDataSetChanged();\n } else {\n Item item = dataSnapshot.getValue(LostItem.class);\n daList.add(item);\n adapter.notifyDataSetChanged();\n }\n }", "public void addItem(ArrayList<HashMap<String, String>> new_list) {\n list = new_list;\n notifyDataSetChanged();\n }", "@Override\n\tpublic void addDataItem(FinanceData newdata) {\n\t\tlist_fr.add(0, newdata);\n\t}", "public void updateData(List<AddingTopItem> mList){\n mData.clear();\n mData.addAll(mList);\n this.notifyDataSetChanged();\n }", "private void addDataForListView() {\n \t\n \tif(loadable)\n \t{\t\n \tloadable = false;\n \tdirection = BACKWARD;\n \tstrUrl = Url.composeHotPageUrl(type_id, class_id, last_id);\n \trequestData();\n \t}\n\t}", "@Override\n public void onAdded() {\n }", "public void add(Item nextItemToAdd) {\n items.add(nextItemToAdd);\n Collections.sort(items);\n fireIntervalAdded(nextItemToAdd, indexOf(nextItemToAdd), indexOf(nextItemToAdd));\n }", "@Override\n public void refreshList(ArrayList<String> newList){\n }", "void checkLastItem() {\n if (!mItems.isEmpty() && !mItems.get(mItems.size() - 1).equals(ADD_NEW_ENTRY)) {\n // add last item again if missing\n mItems.add(ADD_NEW_ENTRY);\n // need to manually call, since this item is not in Db and hence ignored by DiffUtil\n notifyItemInserted(mItems.size() - 1);\n }\n }", "private void addItem() {\n\t\tString message = edtMessage.getText().toString();\n\t\t// build the human\n\t\tHuman hum = new Human(message, humans.size());\n\t\t// 1° method\n\t\tarrayAdapter.add(hum);\n\t\t// 2° method\n\t\t// messages.add(message);\n\t\t// arrayAdapter.notifyDataSetChanged();\n\t\t// and flush\n\t\tedtMessage.setText(\"\");\n\t}", "private void insertLatestData() {\n String[] names = new String[feedbacks.size()];\n String[] ratings = new String[feedbacks.size()];\n String[] reviews = new String[feedbacks.size()];\n for (int i = 0; i < feedbacks.size(); i++) {\n names[i] = \"Name: \" + feedbacks.get(i).getName();\n ratings[i] = \"Rating: \" + feedbacks.get(i).getRatingBar();\n reviews[i] = \"Review: \" + feedbacks.get(i).getReview();\n }\n feedbackListAdapter = new FeedbackListAdapter(ViewPsmFeedbackActivity.this, names, ratings, reviews);\n listFeedback.setAdapter(feedbackListAdapter);\n }", "private void addNewFoodItemRefresh() {\n // create a foodItem instance with input information\n FoodItem foodItem = new FoodItem(id.getText(), name.getText());\n foodItem.addNutrient(\"calories\", Double.valueOf(calories.getText()));\n foodItem.addNutrient(\"fat\", Double.valueOf(fat.getText()));\n foodItem.addNutrient(\"carbohydrate\", Double.valueOf(carbohydrate.getText()));\n foodItem.addNutrient(\"fiber\", Double.valueOf(fiber.getText()));\n foodItem.addNutrient(\"protein\", Double.valueOf(protein.getText()));\n this.foodData.addFoodItem(foodItem);// add it to the food data to store\n this.close();// close the addfooditem stage\n this.foodList.refreshAfterAdd(foodItem);// refresh the foodList\n\n }", "@Override\n public void onItemAdded(Object toAdd) {\n if(toAdd instanceof SpotifyItem)\n return;\n\n //Reflect changes in the drink list\n DrinkInfo item = (DrinkInfo)toAdd;\n Log.d(TAG, \"Array size = \" + mDrinkInfos.size());\n mDrinkInfos.add(mDrinkInfos.size(), item);\n mDrinkQueueAdapter.notifyDataSetChanged();\n Log.d(TAG, \"Added song: \" + item.getDrinkName());\n }", "public void addLast(Object item) {\r\n\t\tdata.add(item);\r\n\r\n\t}", "public void addAsPerSearch(List<Job> searchedJob) {\n int currentSize = mJobList.size();\n //remove the current items\n mJobList.clear();\n //add all the new items\n mJobList.addAll(searchedJob);\n //tell the recycler view that all the old items are gone\n notifyItemRangeRemoved(0, currentSize);\n //tell the recycler view how many new items we added\n notifyItemRangeInserted(0, mJobList.size());\n }", "void notifyListItemInserted(int position);", "@Override\n public void onLoadMore() {\n if (searchbeanArrayList_new.size() != 0) {\n\n\n handler.postDelayed(new Runnable() {\n @Override\n public void run() {\n // remove progress item\n\n\n //add items one by one\n\n if (pageTokenAvailable) {\n smoothProgressBar.setVisibility(View.VISIBLE);\n\n current_start += 10;\n\n // searchbean_post_data.getStart_limit()+=10;\n\n searchbean_post_data.setStart_limit(current_start);\n\n\n findDataFromServer();\n\n\n //or you can add all at once but do not forget to call mAdapter.notifyDataSetChanged();\n }\n\n\n }\n }, 2000);\n\n }\n\n }", "void insertAfter(Object data)\n\t{\n\t\tNode temp = new Node(data);\n\t\tif (length==0) \n\t\t{\n\t\t\tthrow new RuntimeException(\"List Error: cannot call insertAfter() on empty List\");\n\t\t}\n\t\tif (cursor == null) \n\t\t{\n\t\t\tthrow new RuntimeException(\"List Error: cannot call insertAfter() on cursor that is off the list\");\n\t\t}\n\t\tif (cursor == back) \n\t\t{\n\t\t\tappend(data); //if the cursor is at the back of the list then you can just all append since you will be inserting the element into the back element\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\ttemp.next = cursor.next; //the new node temp's next will be the cursor's next\n\t\t\ttemp.prev = cursor; //the new node temp's previous will become the cursor\n\t\t\tcursor.next.prev = temp; //cursor's next previous element becomes temp\n\t\t\tcursor.next = temp; //cursor's next becomes temp\n\t\t\tlength++;\n\t\t}\n\t}", "@Override\n public void refreshList() {\n }", "public void addData(@NonNull Collection<? extends T> newData) {\n mData.addAll(newData);\n notifyItemRangeInserted(mData.size() - newData.size() + getHeaderLayoutCount(), newData.size());\n compatibilityDataSizeChanged(newData.size());\n }", "private void updateList() {\n Model.instace.getAllArticles(new ArticleFirebase.GetAllArticlesAndObserveCallback() {\n @Override\n public void onComplete(List<Article> list) {\n data.clear();\n data = list;\n adapter.notifyDataSetChanged();\n }\n\n @Override\n public void onCancel() {\n\n }\n });\n }", "@Override\n public void onMoreLoadding() {\n\n }", "@Subscribe(threadMode = ThreadMode.MAIN)\n public void onLoadMoreFinished(final LoadMoreFinishedEvent event) {\n if (!event.getSessionId().equals(MyApplication.getInstance().getSessionId())) {\n return;\n }\n EventBus.getDefault().removeStickyEvent(LoadMoreFinishedEvent.class);\n\n new AsyncTask<Void, Void, Void>() {\n @Override\n protected Void doInBackground(Void... params) {\n if (event.isSuccessful()) {\n //Add on bottom but before the loading item\n for (StockChange stock : event.getStockList()) {\n mListManipulator.addItemToPosition(mListManipulator.getCount() - 1, stock);\n }\n // Remove loading item if it exists\n mListManipulator.removeLoadingItem();\n }\n mLoadingMore = false;\n return null;\n }\n\n @Override\n protected void onPostExecute(Void aVoid) {\n if (mEventListener != null) {\n mEventListener.onLoadMoreFinished(event);\n }\n }\n }.execute();\n }", "void loadNewData(List<Todo> newTodo) {\n mTodoList = newTodo;\n notifyDataSetChanged();\n }", "private void append_request(DataSnapshot dataSnapshot) {\n Iterator i = dataSnapshot.getChildren().iterator();\n //Go over all the requests\n while (i.hasNext()){\n\n //Add a new request iten to the list\n String message = (String) ((DataSnapshot)i.next()).getValue();\n String email = (String) ((DataSnapshot)i.next()).getValue();\n String newMessage= message ;\n //\" asked to join the group\"\n requestList.add(new requestItem(newMessage,email,activity_name));\n }\n request_item_adapter adapter = new request_item_adapter(this, R.layout.activity_request_item, requestList);\n //attaching adapter to the listview\n listView.setAdapter(adapter);\n }", "void append(int new_data)\n {\n /* 1. allocate node\n * 2. put in the data */\n Node new_node = new Node(new_data);\n\n Node last = head;/* used in step 5*/\n\n /* 3. This new node is going to be the last node, so\n * make next of it as NULL*/\n new_node.setNext(null);\n\n /* 4. If the Linked List is empty, then make the new\n * node as head */\n if(head == null)\n {\n new_node.setPrev(null);\n head = new_node;\n return;\n }\n\n /* 5. Else traverse till the last node */\n while(last.getNext() != null)\n last = last.getNext();\n\n /* 6. Change the next of last node */\n last.setNext(new_node);\n\n /* 7. Make last node as previous of new node */\n new_node.setPrev(last);\n }", "@Override\n\t\tpublic void onLoadMore() {\n\t\t\tdaoIndex++;\n\t\t\tgetData();\n\t\t\tadapter.notifyDataSetChanged();\n\t\t\tonLoad();\n\t\t}", "void append(int new_data) {\n\t\tNode new_node = new Node(new_data);\n\t\tNode last = head;\n\t\tnew_node.next = null;\n\t\tif (head == null) {\n\t\t\tnew_node.prev = null;\n\t\t\thead = new_node;\n\t\t\treturn;\n\t\t}\n\t\twhile (last.next != null)\n\t\t\tlast = last.next;\n\t\tlast.next = new_node;\n\t\tnew_node.prev = last;\n\t}", "void addItem (Item toAdd){\n\t\t\tthis.items.add(toAdd);}", "void addAll(List<News> data) {\n\t\t// Traverse the data list to add news item to the adapter's data set\n\t\tfor (int i = 0; i < data.size(); i++) {\n\t\t\t// Get the book at current index\n\t\t\tNews newsStory = data.get(i);\n\t\t\t// Add the book to the data set\n\t\t\tmNewsList.add(newsStory);\n\n\t\t\t// Notify the adapter of the change in the data set\n\t\t\t// so that it repopulates the view with the updated data set\n\t\t\tnotifyDataSetChanged();\n\t\t}\n\t}", "public void refreshList() {\n mCursor.requery();\n mCount = mCursor.getCount() + mExtraOffset;\n notifyDataSetChanged();\n }", "public static void push(Object data) {\n list.add(data);\n }", "public static void addList() {\n\t}", "private void addToChatList(Chat[] newChats){\n if ( newChats == null || newChats.length == 0 ) {\n return;\n }\n if ( chatList.size() == 0 ) { // no chat history loaded yet\n for ( Chat chat : newChats ) {\n chatList.offer(chat);\n }\n headIndex = newChats[0].id; // update the tail index\n tailIndex = newChats[newChats.length-1].id; // update the tail index\n } else if ( newChats[newChats.length-1].id < chatList.get(0).id ) { // new.tail is prior to current.head\n // prepend the new chats to the head of the current chat\n int selection = lv_chat.getFirstVisiblePosition();\n selection += newChats.length;\n for ( int i = newChats.length-1; i >= 0; i-- ) {\n chatList.push(newChats[i]);\n }\n lv_chat.setSelection(selection);\n adapter.notifyDataSetChanged();\n Log.d(TAG,\"select:\"+selection);\n headIndex = newChats[0].id; // update the headIndex\n } else if ( newChats[0].id > chatList.get(chatList.size()-1).id ) { // new.head is after current.tail\n // append the new chats to the tail of the current chat\n for ( Chat chat : newChats ) {\n chatList.offer(chat);\n }\n tailIndex = newChats[newChats.length-1].id; // update the tail index\n } else {\n Log.e(TAG,\"Loaded duplicated chat!\");\n }\n }", "@Override\n\t\t\tpublic void onStart() {\n\t\t\t\tlistitem.clear();\n\t\t\t\tnew AsyncTask<Void, Void, Void>() {\n\t\t\t\t\tprotected Void doInBackground(Void... params) {\n\t\t\t\t\t\tgetmessage_list(1);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tprotected void onPostExecute(Void result) {\n\t\t\t\t\t\tif (count >= 19) {\n\t\t\t\t\t\t\txListView.startLoadMore();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\txListView.stopLoadMore();\n\t\t\t\t\t\t}\n\t\t\t\t\t\txListView.setRefreshSuccess();\n\t\t\t\t\t\tadapter.notifyDataSetChanged();\n\t\t\t\t\t\tLog.d(TAG, \"jieshu\");\n\t\t\t\t\t}\n\t\t\t\t}.execute(null, null, null);\n\t\t\t}", "private void Writehistory (List list, savekq savehistory){\n if (kiemtrasopt(list) < 10) {\n list.add(0, savehistory);\n } else {\n list.remove(9);\n list.add(0, savehistory);\n }\n }", "public void updateList() {\n\t\tthis.myList.clear();\n\t\tIterator<String> item = this.myHashMap.keySet().iterator();\n\n\t\twhile (item.hasNext())\n\t\t{\n\t\t\tString name = (String)item.next();\n\t\t\tthis.myList.add(name);\n\t\t}\n\t\tthis.nameId = -1;\n\t\t\n\t}", "public void onSetNewCurrentItem() {\n }", "private void addItemToList(String item) {\n itemList.add(item);\n\n // ListView aktualisieren\n adapter.notifyDataSetChanged();\n }", "@SuppressWarnings(\"unchecked\")\n\tprotected void grow(){\n\t\t// makes new arraylist\n\t\tT[] temp = (T[]) new Object[data.length *2];\n\t\tfor(int i = 0; i < data.length; i++ ){\n\t\t\ttemp[i] = data[i];\n\t\t}\n\t\tdata = temp;\n\t}", "public synchronized void addItem(ArrayList<Start.Ingredients> obj) {\r\n\t\t// Only add if the table is empty\r\n\t\twhile (!empty && count < 20) {\r\n\t\t\ttry {\r\n\t\t\t\twait();\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (count >= 20) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Set the contents and notifyAll()\r\n\t\tcontents = obj;\r\n\t\tempty = false;\r\n\t\tnotifyAll();\r\n\r\n\t}", "public void setNewData(@Nullable List<T> data) {\n this.mData = data == null ? new ArrayList<T>() : data;\n if (mRequestLoadMoreListener != null) {\n mNextLoadEnable = true;\n mLoadMoreEnable = true;\n mLoading = false;\n mLoadMoreView.setLoadMoreStatus(LoadMoreView.STATUS_DEFAULT);\n }\n mLastPosition = -1;\n notifyDataSetChanged();\n }", "private void addItems() {\n while (true) {\n ClothingItem item = readItem();\n if (item == null || item.getId() < 0) {\n break;\n }\n try {\n ctrl.addItem(item);\n } catch (ValidatorException e) {\n e.printStackTrace();\n }\n }\n }", "public void addmyPollCommentsData(List<CommentDisplayResponseModel.Results.Data> data) {\n //add data\n myPollCommentsAdapter.addAll(data);\n //Notifies the attached observers that the underlying\n // data has been changed and any View reflecting the data set should refresh itself.\n myPollCommentsAdapter.notifyDataSetChanged();\n isLoading = false;\n\n }", "public void populateList() {\n }", "public void doAdd() {\r\n\t\tif (_mode == MODE_LIST_ON_PAGE && _listForm != null) {\r\n\t\t\tDataStoreBuffer listDs = _listForm.getDataStore();\r\n\t\t\tDataStoreBuffer ds = getDataStore();\r\n\t\t\tif (listDs == ds && ds != null) {\r\n\t\t\t\t//same datastore on list and detail\r\n\t\t\t\tif (ds.getRowCount() > 0 && (ds.getRowStatus() == DataStoreBuffer.STATUS_NEW))\r\n\t\t\t\t\treturn;\r\n\r\n if (ds.getRowStatus() == DataStoreBuffer.STATUS_NEW_MODIFIED) ds.deleteRow();\r\n if (isDataModified()) undoChanges();\r\n\r\n\t\t\t\tds.insertRow();\r\n\t\t\t\tif (_listForm.getDataTable() != null) {\r\n\t\t\t\t\tJspDataTable tab = _listForm.getDataTable();\r\n\t\t\t\t\tif (!tab.isRowOnPage(ds.getRowCount() - 1))\r\n\t\t\t\t\t\ttab.setPage(tab.getPage(ds.getRowCount() - 1));\r\n\t\t\t\t}\r\n\t\t\t\tHtmlFormComponent comp = findFirstFormComponent(this);\r\n\t\t\t\tif (comp != null)\r\n\t\t\t\t\tcomp.setFocus();\r\n\t\t\t\tscrollToMe();\r\n\r\n\t\t\t} else if (_ds != null) {\r\n\t\t\t\t//different datastores on list and detail\r\n\t\t\t\tif (listDs != null)\r\n\t\t\t\t\tlistDs.clearSelectedRow();\r\n\t\t\t\t_listSelectedRow = null;\r\n\t\t\t\t_ds.reset();\r\n\t\t\t\t_ds.insertRow();\r\n\t\t\t\tHtmlFormComponent comp = findFirstFormComponent(this);\r\n\t\t\t\tif (comp != null)\r\n\t\t\t\t\tcomp.setFocus();\r\n\t\t\t\tscrollToMe();\r\n\t\t\t}\r\n\t\t\tsetVisible(true);\r\n\t\t} else {\r\n\t\t\t_listSelectedRow = null;\r\n\t\t\t_ds.reset();\r\n\t\t\t_ds.insertRow();\r\n\t\t\tHtmlFormComponent comp = findFirstFormComponent(this);\r\n\t\t\tif (comp != null)\r\n\t\t\t\tcomp.setFocus();\r\n\t\t\tscrollToMe();\r\n\t\t}\r\n\t}", "public void addMyPollData(List<UserPollResponseModel.Results.Data> dataResults) {\n //remove footer viewe\n this.removeFooterView(footer);\n //add data in array list\n myPolladapter.addAll(dataResults);\n //Notifies the attached observers that the underlying\n // data has been changed and any View reflecting the data set should refresh itself.\n myPolladapter.notifyDataSetChanged();\n isLoading = false;\n }", "public void addAll(List<Post> newList) {\n posts.addAll(newList);\n notifyDataSetChanged();\n }", "@Override\n public void run() {\n chatListAdapter.add(response);\n chatListAdapter.notifyDataSetChanged();\n getListView().setSelection(chatListAdapter.getCount() - 1);\n }", "public void addData(@IntRange(from = 0) int position, @NonNull Collection<? extends T> newData) {\n mData.addAll(position, newData);\n notifyItemRangeInserted(position + getHeaderLayoutCount(), newData.size());\n compatibilityDataSizeChanged(newData.size());\n }", "public void addData (Object obj)\n {\n\tif (front == null) {\n\t front = new ListItem (obj);\n\t rear = front;\n\t}\n\telse {\n\t rear.next = new ListItem (obj);\n\t rear = rear.next;\n\t}\n\tnumItems++;\n }", "public void append(Object item);", "void append(Object data)\n\t{\n\t\tNode temp = new Node(data);\n\t\tif (back == null) \n\t\t{\n\t\t\tfront = back = temp; //if the list is empty, then the new node temp becomes the front and back of the list as its the only node within the list\n\t\t\tlength++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tback.next = temp; //the next node after the back node becomes the new node temp since it was inserted into the back of the list\n\t\t\ttemp.prev = back; //the new node temp's previous node becomes the back since temp is now the new back of the list\n\t\t\tback = temp; //the new back of the list now becomes the new node temp\n\t\t\tlength++;\n\t\t}\n\t}", "private static final <T> List<T> append(List<T> list, T newElement) {\n List<T> newList = Lists.newArrayListWithCapacity(list.size() + 1);\n newList.addAll(list);\n newList.add(newElement);\n return newList;\n }", "public void update_list_view() {\n\n Collections.sort(mA.alarms);\n\n // make array adapter to bind arraylist to listview with new custom item layout\n AlarmsAdapter aa = new AlarmsAdapter(mA, R.layout.alarm_entry, mA.alarms);\n alarm_list_view.setAdapter(aa);\n registerForContextMenu(alarm_list_view);\n aa.notifyDataSetChanged(); // to refresh items in the list\n }", "@Override\n public void run() {\n chatListAdapter.add(sendToOthers);\n chatListAdapter.notifyDataSetChanged();\n getListView().setSelection(chatListAdapter.getCount() - 1);\n }", "@Override\n public void insert(E newItem) {\n if (list.size()==0)\n list.add(newItem);\n else\n {\n ListIterator<E> itList = list.listIterator();\n boolean isAdded=false;\n while (itList.hasNext())\n {\n int status=newItem.toString().compareTo(itList.next().toString());\n if(status==0)\n {\n itList.add(newItem);\n isAdded=true;\n }\n else if(status<0)\n {\n if (itList.hasPrevious())\n itList.previous();\n itList.add(newItem);\n isAdded=true;\n break;\n }\n }\n if (!isAdded)\n {\n list.add(newItem);\n }\n }\n\n }", "public void addItem(LayoutElementParcelable e) {\n if (mainFrag.IS_LIST && itemsDigested.size() > 0) {\n itemsDigested.add(itemsDigested.size() - 1, new ListItem(e));\n } else if (mainFrag.IS_LIST) {\n itemsDigested.add(new ListItem(e));\n itemsDigested.add(new ListItem(EMPTY_LAST_ITEM));\n } else {\n itemsDigested.add(new ListItem(e));\n }\n\n notifyItemInserted(getItemCount());\n }", "private void addToEmptyList(T data) {\n this.first = this.last = new Node(data);\n this.nrOfElements++;\n }", "public void addNewItem(DataHolder newRow) {\n this.add(newRow);\n\n // sends request to update ListAdapter\n notifyDataSetChanged();\n }", "public void updateList()\r\n\t{\r\n\t\tclientQueue.offer(name);\r\n\t}", "private void updateListViewLogWindow()\n {\n listViewMessageItems.clear();\n\n for(int i =0;i<= printResult.size() - 1;i++)\n {\n listViewMessageItems.add(printResult.get(i));\n }\n\n }", "public void addData(@NonNull T data) {\n mData.add(data);\n notifyItemInserted(mData.size() + getHeaderLayoutCount());\n compatibilityDataSizeChanged(1);\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic void add(T item){\n\t\t\n\n\t\tif(currentsize == data.length-1){\n\t\t\tgrow();\n\t\t}\n\n\t\t\n\t\tdata[currentsize] = item;\n\t\tcurrentsize++;\n\n\n\t}", "protected void populateContentListView(ArrayList<UnistorEntry> content){\n\n // If first entry is back button, the content array\n // is sorted without this item, which will be added in the first position\n if(content.get(0).getEntryType() == Constants.ENTRY_TYPE_BACK){\n UnistorEntry backEntry = content.remove(0);\n Collections.sort(content, new UnistorEntryComparator());\n content.add(0, backEntry);\n }else{\n Collections.sort(content, new UnistorEntryComparator());\n }\n\n // Setting the adapter with the new items.\n // If the adapter have been previously created, we use notifyDataSetChanged to refresh,\n // that uses fairly less resources than creating a new one.\n if(this.listView.getAdapter() == null){\n UnistorEntryListAdapter listViewAdapter = new UnistorEntryListAdapter(mContext, content);\n this.listView.setAdapter(listViewAdapter);\n // Set context menu for the listview\n registerForContextMenu(listView);\n\n }else{\n UnistorEntryListAdapter listViewAdapter = (UnistorEntryListAdapter)this.listView.getAdapter();\n listViewAdapter.clear();\n listViewAdapter.addAll(content);\n listViewAdapter.notifyDataSetChanged();\n }\n\n\n }", "public void cbListAddElement() {\n cbWorker.clear();\n cbWorker.add(cbJ);\n cbWorker.add(cbK);\n cbWorker.add(cbM);\n cbWorker.add(cbP);\n cbWorker.add(cbA);\n cbWorker.add(cbS);\n }", "void add(Iterable<S3TimeData> newData) {\n assert newData != null;\n\n synchronized (mux) {\n for (S3TimeData data : newData)\n map.put(data.getKey(), data);\n\n mux.notifyAll();\n }\n }", "private void refreshList () {\n List<DisplayedUserCommand> list = new ArrayList<DisplayedUserCommand>();\n for (DisplayedUserCommand command : myUserDefinedCommandsList) {\n list.add(command);\n }\n myUserDefinedCommandsList.clear();\n myUserDefinedCommandsList.addAll(list);\n }", "public void refresh(List<DataFeed> newData) {\n clear();\n addAll(newData);\n notifyDataSetChanged();\n }", "private void additems() {\n MaVolleyRequest.getInstance(getApplicationContext()).GetMethodRequest(getLink(), null, new VolleyRequestOnResultListener() {\n @Override\n public void onSucces(String result) {\n Log.d(\"qwerty\", getLink());\n ResearchResultBeanz item = (new Gson()).fromJson((new Gson()).fromJson(result, JsonObject.class).getAsJsonObject(\"data\"), ResearchResultBeanz.class);\n if (adapter == null) {\n adapter = new GridViewAdapter2(ImageGridViewActivity.this, Utils.fromArrayToList(item.items));\n gridView.setAdapter(adapter);\n } else {\n adapter.appendData (Utils.fromArrayToList(item.items));\n }\n flag_loading = false;\n }\n @Override\n public void onFailure(String error) {\n makeToast(\"Loading failure\");\n flag_loading = false;\n }\n });\n }", "private void updataUserfouce() {\n\t\tcDynamicAdapter.notifyDataSetChanged();\n\t}", "private void addFinanceItem(FinanceUnitData unitData, boolean update) {\n Calendar today = Calendar.getInstance();\n\n FinanceDailyData lastDateData = this.financeDataList.size() > 0 ? this.financeDataList.get(0) : null;\n if (lastDateData != null\n && today.get(Calendar.YEAR) == lastDateData.getDate().get(Calendar.YEAR)\n && today.get(Calendar.MONTH) == lastDateData.getDate().get(Calendar.MONTH)\n && today.get(Calendar.DAY_OF_MONTH) == lastDateData.getDate().get(Calendar.DAY_OF_MONTH)) {\n\n //Last day is today.\n lastDateData.getDataList().add(unitData);\n } else {\n FinanceDailyData todayData = new FinanceDailyData();\n todayData.setDate(today);\n todayData.getDataList().add(unitData);\n financeDataList.add(todayData);\n }\n\n // Refresh UI.\n if(update){\n updateFinanceList();\n }\n }", "public void append(int new_data) \r\n\t\t{ \r\n\t\t Node new_node = new Node(new_data); \r\n\t\t \r\n\t\t if (head == null) \r\n\t\t { \r\n\t\t head = new Node(new_data); \r\n\t\t return; \r\n\t\t } \r\n\t\t \r\n\t\t new_node.next = null; \r\n\t\t \r\n\t\t Node last = head; \r\n\t\t while (last.next != null) \r\n\t\t last = last.next; \r\n\t\t \r\n\t\t last.next = new_node; \r\n\t\t return; \r\n\t\t}", "@Override\r\n\t\t\t\t\tpublic void addItemEventOccurred(AddItemEvent event) {\n\r\n\t\t\t\t\t}", "public void updateCardList(List<Entry> activityFeed) {\n\n List<Entry> newEntrytoAddList = new ArrayList<>();\n List<Entry> entriesToRemove = new ArrayList<>();\n\n //check if it is first run or refreshing list\n\n\n if (messagesHistory != null) {\n //remove deleted projects\n for (Entry entry : messagesHistory) {\n boolean stillExist = false;\n for (Entry entryFeed : activityFeed) {\n\n if (Objects.equals(entryFeed.getUpdated(), entry.getUpdated())) {\n stillExist = true;\n }\n }\n if (!stillExist) {\n entriesToRemove.add(entry);\n }\n }\n\n //add only new project\n for (Entry newEntry : activityFeed) {\n boolean duplicate = false;\n for (Entry currentEntry : messagesHistory) {\n if (Objects.equals(currentEntry.getUpdated(), newEntry.getUpdated())) {\n duplicate = true;\n }\n }\n if (!duplicate) {\n newEntrytoAddList.add(newEntry);\n }\n }\n\n\n //delete entries\n for (Entry toDelete : entriesToRemove) {\n cardView.remove(toDelete);\n }\n //add new entries\n for (Entry item : newEntrytoAddList) {\n cardView.add(0, item);\n new Handler().postDelayed(() -> {\n cardView.notifyInserted(0);\n rv.scrollToPosition(0);\n }, 500);\n\n }\n\n\n }\n boolean toNotify = false;\n if (cardView.getItemCount() == 0) {\n\n toNotify = true;\n messages.addAll(activityFeed);\n }\n\n //save cards history for later comparing if old entry were deleted or new were added\n messagesHistory = new ArrayList<>(messages);\n Handler handler = new Handler();\n boolean finalToNotify = toNotify;\n handler.postDelayed(() -> {\n if (finalToNotify) {\n cardView.notifyDataSetChanged();\n }\n AnimationUtil.stopRefreshAnimation(swipeRefreshLayout);\n }, 1000);\n }", "private void prepareData() {\n eventList = databaseHandler.getLatestDistinctEvents(prefs.getString(KEY_SORT_FIELD, \"name\"),\n prefs.getBoolean(KEY_SORT_ORDER_ASCENDING, true));\n\n // Send list to adapter\n eventLogAdapter.updateData(eventList);\n }", "public void updateList() \n { \n model.clear();\n for(int i = ScholarshipTask.repository.data.size() - 1; i >= 0; i--) \n {\n model.addElement(ScholarshipTask.repository.data.get(i));\n }\n }", "@Override\n public void onListDataLoaded() {\n if (this.progressBar != null && !this.isListLoaded) {\n this.progressBar.setVisibility(View.GONE);\n }\n if (!this.isListLoaded) {\n addListHeader();\n this.isListLoaded = true;\n }\n }", "private void updateUi (){\n //get the first list item postion\n int currentPosition =listView.getFirstVisiblePosition();\n //append the new recipes to listview\n RecipeAdapter adapter = new RecipeAdapter(this , recipesList);\n listView.setAdapter(adapter);\n // Setting new scroll position to continue\n listView.setSelectionFromTop(currentPosition + 1, 0);\n }", "public void appendData(T data){\n Node<T> newEnd = new Node<>(data); // new Node referenced by newEnd\n Node<T> thisNode = this; // grab this Node\n\n // traverse list and append to the tail\n while (thisNode.next != null){\n thisNode = thisNode.next;\n }\n thisNode.next = newEnd;\n }", "public void add_to_my_list_process(View v) {\n\n addToCart_flag = false;\n // get current login value saved in sharedpreferences object\n SharedPreferences loginSharedPref = getSharedPreferences(\"LoginData\", MODE_PRIVATE);\n // get current agent id\n final String AgentID = loginSharedPref.getString(\"ID\", \"\");\n // create string\n create_final_string_product();\n /* get all list names into arraylist object */\n ArrayList<String> listNames = get_list_data_from_local_DB(AgentID);\n // display alert box to choose list name by user\n display_list_names(listNames, AgentID);\n // clear all data after adding product into cart\n clear_data();\n }", "private void updateUserList() {\n\t\tUser u = jdbc.get_user(lastClickedUser);\n\t\tString s = String.format(\"%s, %s [%s]\", u.get_lastname(), u.get_firstname(), u.get_username());\n\t\tuserList.setElementAt(s, lastClickedIndex);\n\t}", "public void add(){\n list.add(smart);\n list.add(mega);\n list.add(smartMini);\n list.add(absolute);\n\n clientsList.add(client1);\n clientsList.add(client2);\n clientsList.add(client3);\n clientsList.add(client4);\n clientsList.add(client5);\n }", "void addData();", "private void grow() {\r\n\t\t\r\n\t\t Student [] newList = new Student[sizeOfList(list) + 4];\r\n\t int size = sizeOfList(list);\r\n\t \r\n\t for(int i = 0; i < size; i++) {\r\n\t \t newList[i] = list[i];\r\n\t }\r\n\t list = newList;\r\n\t}", "@Override\n public void onDataChange(DataSnapshot dataSnapshot) {\n GenericTypeIndicator<ArrayList<String>> t = new GenericTypeIndicator<ArrayList<String>>() {};\n values = dataSnapshot.getValue(t);\n if (values != null) {\n for (int i = 0; i < values.size() ;i++){\n listAdapter.add(values.get(i));\n mainListView.setSelection(listAdapter.getCount() - 1);\n }\n } Log.d(\"guyTag\", values.toString());\n }", "private void updateList() {\r\n\t\tlistaStaff.setItems(FXCollections.observableArrayList(service\r\n\t\t\t\t.getStaff()));\r\n\t}", "public void addNewList(GroceryList list) {\n String key = listsRef.push().getKey();\n Map<String, Object> postValues = list.toMap();\n\n // TODO: lastUpdated\n\n // Set the values\n listsRef.child(key).setValue(postValues);\n }", "@Override\n public void onSuccess(List<BlocksByHeightQuery.Datum> list) {\n List<com.arcblock.btcblockviewer.BlocksByHeightQuery.Datum> oldList = new ArrayList<>();\n oldList.addAll(mBlocks);\n\n // set mBlocks with new data\n mBlocks = list;\n DiffUtil.DiffResult result = DiffUtil.calculateDiff(new CoreKitDiffUtil<>(oldList, mBlocks), true);\n // need this line , otherwise the update will have no effect\n mListBlocksAdapter.setNewListData(mBlocks);\n result.dispatchUpdatesTo(mListBlocksAdapter);\n\n refreshNextAndPre();\n\n //2. view status change and loadMore component need\n if (mPagedQueryHelper.isHasMore()) {\n mListBlocksAdapter.setEnableLoadMore(true);\n mListBlocksAdapter.loadMoreComplete();\n } else {\n mListBlocksAdapter.loadMoreEnd();\n }\n }", "private synchronized void addNewWatchList()\r\n {\r\n\r\n // Create a NEW header Vector\r\n Vector headers = new Vector();\r\n headers.removeAllElements();\r\n for (int i = 0; i < StockData.columns.length; i++)\r\n {\r\n headers.addElement(StockData.columns[i]);\r\n }\r\n\r\n // Now get the Count of the Lists already available\r\n int watchListCount = tabPane.getTabCount();\r\n // Create a new DATA Vector and add at least one item to it\r\n Vector data = new Vector();\r\n data.removeAllElements();\r\n\r\n data.addElement(new StockData());\r\n\r\n // Create our table Model with the headers and data\r\n StockDataTableModel tableModel = new StockDataTableModel(headers, data);\r\n\r\n // Create a new Table with the tablemodel\r\n JTable table = new HGTable(tableModel);\r\n\r\n // This method will add a timer ( via the index ) the table and tableModel\r\n // the appropriate vector containers.\r\n addDataToVectorContainers(table, tableModel, watchListCount);\r\n // This Method will add the Popup menu to the this table\r\n addPopupMenuToTable(table);\r\n // Create a new JSCrollPane with the the Table\r\n JScrollPane scrollPane = new JScrollPane();\r\n scrollPane.getViewport().add(table);\r\n JPanel panel = new JPanel(new BorderLayout());\r\n\r\n // Create a new Vertical Panel to place our menu and JScrollPane Table\r\n JPanel lblPanel = createVerticalPanel(true);\r\n\r\n lblPanel.add(createDropDownMenu());\r\n panel.add(lblPanel, BorderLayout.NORTH);\r\n panel.add(scrollPane, BorderLayout.CENTER);\r\n\r\n // Build a defailt label for the TabPane\r\n String watchListName = getString(\"WatchListTableModule.edit.watch_list_basic_name\") + watchListCount;\r\n\r\n tabPane.addTab(watchListName, null, panel, new String(\"Click here to view \" + watchListName));\r\n\r\n watchListCount = tabPane.getTabCount();\r\n // Set the WatchList title via Properties\r\n // Set the WatchList count Property\r\n appProps.setProperty(watchListName, watchListName);\r\n appProps.setProperty(getString(\"WatchListTableModule.application_watchlist_count_key_title\"), \"\" + watchListCount);\r\n\r\n //// Request Focus on our tab pane\r\n //tabPane.requestFocus();\r\n // Set our selected index to the new Tab\r\n int index = tabPane.getTabCount() - 1;\r\n setNewTitle(index);\r\n\r\n tabPane.setSelectedIndex(0);\r\n tabPane.repaint();\r\n\r\n }", "private List<itemInfo> getNewEntries() {\n\n final List<itemInfo> entries = new ArrayList<itemInfo>();\n return entries;\n }", "public void addLast(T listItem) {\n add(listItem);\n }", "@Override\n \tpublic void intervalAdded(ListDataEvent e) {\n \t\t\n \t}", "public void onAddItem(View view) {\n EditText editText = (EditText) findViewById(R.id.editText);\n // get the contents and cast from an Object to a String\n String text = editText.getText().toString();\n mNameMatch = false;\n\n // add the text to our adapter if text isn't blank\n if (text.trim().length() > 0) {\n for (int i = 0; i < mCurrentList.size(); i++) {\n if (text.equals(mCurrentList.get(i).text)) {\n Toast toast = Toast.makeText(NewListActivity.this, \"That option was already inserted previously\", Toast.LENGTH_SHORT);\n toast.setGravity(Gravity.CENTER, 0, 0);\n toast.show();\n mNameMatch = true;\n }\n }\n if (mNameMatch == false) {\n ListItem item = new ListItem(text, mListID, false);\n mAdapter.add(item, mAdapter.getItemCount());\n mCurrentList = mAdapter.getCurrentListItems(mListID, \"\");\n }\n\n } else {\n editText.setError(\"Nothing added because no text was inserted\");\n }\n\n // clear EditText so user won’t add it twice\n editText.setText(\"\");\n }", "@Override\n // once adding an entry\n public void onDataChange(DataSnapshot dataSnapshot) {\n Set<String> chatRoomsSet = new HashSet<String>();\n Iterator i = dataSnapshot.getChildren().iterator();\n\n // go through the whole database and add the new\n while (i.hasNext()){\n chatRoomsSet.add(((DataSnapshot)i.next()).getKey());\n }\n // clear the old list and add the new ones\n chatRoomsList.clear();\n chatRoomsList.addAll(chatRoomsSet);\n arrayAdapter.notifyDataSetChanged();\n }", "@Override\n public void add(Fish object) {\n list.add(object);//adds the Fish to the list\n Log.d(\"Adapter\",\"added\");\n }", "public void offer(int num){\n if(tail == fixedSize - 1) {\n List<Object> newList = new ArrayList<>();\n newList.add(num);\n //save next new list at tail\n tailList.add(newList);\n tailList = (List<Object>) tailList.get(tail);\n tail = 0;\n }else{ //not in last index,then directly add it;\n tailList.add(num);\n }\n count++;\n tail++;\n }", "@Override\n\t\t\tpublic void onStart() {\n\t\t\t\tif (listitem != null || listitem.size() > 0) {\n\t\t\t\t\tlistitem.clear();\n\t\t\t\t}\n\t\t\t\tnew AsyncTask<Void, Void, Void>() {\n\t\t\t\t\tprotected Void doInBackground(Void... params) {\n\t\t\t\t\t\tgetdata(1);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tprotected void onPostExecute(Void result) {\n\t\t\t\t\t\tif (count >= 19) {\n\t\t\t\t\t\t\txlistview.startLoadMore();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\txlistview.stopLoadMore();\n\t\t\t\t\t\t}\n\t\t\t\t\t\txlistview.setRefreshSuccess();\n\t\t\t\t\t\tadapter.notifyDataSetChanged();\n\t\t\t\t\t\tLog.d(TAG, \"jieshu\");\n\t\t\t\t\t}\n\t\t\t\t}.execute(null, null, null);\n\t\t\t}", "static void addItems(int needed) {\r\n List<ConnectionReqs> reqsList = new ArrayList<>();\r\n reqsList.add(AuctionServer.reqs);\r\n Socket dBSocket = null;\r\n while(needed > 0) {\r\n Item item = null;\r\n Random random = new Random();\r\n int randInt = random.nextInt(200);\r\n DBMessage dBMessage = null;\r\n try {\r\n dBSocket = new Socket(\"localHost\", 6002);\r\n dBOut = new ObjectOutputStream(dBSocket.getOutputStream());\r\n dBOut.flush();\r\n dBIn = new ObjectInputStream(dBSocket.getInputStream());\r\n dBMessage = new DBMessage.Builder()\r\n .command(DBMessage.Command.GET)\r\n .table(DBMessage.Table.ITEM)\r\n .accountId(randInt)\r\n .build();\r\n dBOut.writeObject(dBMessage);\r\n System.out.println(\"listening...\");\r\n DBMessage response = (DBMessage) dBIn.readObject();\r\n item = (Item) response.getPayload();\r\n System.out.println(item.toString());\r\n } catch (IOException | ClassNotFoundException e) {\r\n e.printStackTrace();\r\n }\r\n if(!auctionHistory.contains(item)) {\r\n System.out.println(dBMessage.toString());\r\n auctionList.add(item);\r\n auctionHistory.add(item);\r\n needed--;\r\n }\r\n }\r\n }" ]
[ "0.68500185", "0.6738051", "0.65767974", "0.6431209", "0.64050496", "0.63984257", "0.6385571", "0.63449794", "0.633911", "0.6316308", "0.6285105", "0.6284151", "0.62324756", "0.62319833", "0.6194529", "0.6179398", "0.6171665", "0.6133215", "0.6077376", "0.60724545", "0.6072061", "0.60631305", "0.6056637", "0.60478204", "0.60238737", "0.5995836", "0.5989647", "0.5986912", "0.5983897", "0.5970954", "0.5962308", "0.596002", "0.59594977", "0.59390604", "0.59295803", "0.59248865", "0.5914197", "0.5902956", "0.5891748", "0.5889669", "0.5880908", "0.5879061", "0.58776814", "0.58757955", "0.58748204", "0.58739275", "0.5871845", "0.58562607", "0.58542836", "0.5853321", "0.58449715", "0.5832008", "0.5830394", "0.5822757", "0.58171207", "0.58165616", "0.5808265", "0.5806052", "0.58040774", "0.57993776", "0.5789572", "0.5789453", "0.578254", "0.57794404", "0.57794", "0.5772349", "0.57674277", "0.5761306", "0.57551575", "0.57536346", "0.5751452", "0.57501394", "0.57469285", "0.5743902", "0.57379574", "0.5723547", "0.57221466", "0.5711512", "0.57086", "0.57080007", "0.5703207", "0.5701702", "0.56887716", "0.5686819", "0.5684287", "0.56804353", "0.56794107", "0.5677904", "0.5672126", "0.56689084", "0.56681854", "0.5662818", "0.5662579", "0.5661773", "0.56605613", "0.5658318", "0.5644764", "0.56421435", "0.5641758", "0.5640427", "0.5638684" ]
0.0
-1
XCoordinate = Parameters: none. Returns the turtle's X coordinate from the center of the screen.
@Override public double execute() throws IllegalStateException { checkError(); return getValue(X); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getxCoordinate() {\n\t\treturn xCoordinate;\n\t}", "public double getxCoordinate() {\n return xCoordinate;\n }", "public void setXPosition( int xCoordinate ) {\n xPosition = xCoordinate;\n }", "public double getXCoordinate() {\n return xCoordinate;\n }", "public void setxCoordinate(int xCoordinate) {\n this.xCoordinate = xCoordinate;\n }", "public int getxCoordinate() {\n return xCoordinate;\n }", "public int getxCoordinate() {\n return xCoordinate;\n }", "public void setX(int xcoord) {\n\t\tx = xcoord;\n\t}", "public void setXCoordinate(double xCoordinate) {\n this.xCoordinate = xCoordinate;\n }", "@Basic\n\tpublic double getXCoordinate() {\n\t\treturn this.x;\n\t}", "public void setxCoordinate(double xCoordinate) {\n this.xCoordinate = xCoordinate;\n }", "public double getxCoord() {\n\t\treturn xCoord;\n\t}", "public float getX() { return xCoordinate;}", "public double getLocationX() {\r\n\t\treturn location.getX();\r\n\t}", "public static int getStartXCoordinate(){\n\t\tint x = getThymioStartField_X(); \n\t\t\n\t\tif(x == 0){\n\t\t\n \t}else{\n \t x *= FIELD_HEIGHT;\n \t}\n \t\n\t\treturn x ;\n\t}", "public int getxCoord() {\n\t\treturn xCoord;\n\t}", "public int getxCoord() {\r\n\t\treturn xCoord;\r\n\t}", "public int getxCoord() {\r\n\t\treturn xCoord;\r\n\t}", "protected void setX(final Number x) {\n this.xCoordinate = x;\n }", "public void setXCoordinate(int xCoordinate)\n {\n if (xCoordinate >= 0)\n {\n this.xCoordinate = xCoordinate;\n }\n else \n {\n this.xCoordinate = 0;\n }// end of if (xCoordinate >= 0)\n }", "public int getX() {\r\n\t\treturn xcoord;\r\n\t}", "public int x() {\r\n\t\treturn xCoord;\r\n\t}", "public void setX(int xCoord) {\n this.xCoord = xCoord;\n }", "public void setStartX(double x)\n {\n startxcoord=x; \n }", "public int getXCoordinate ()\n {\n return xCoordinate;\n }", "public int getCoordX() \r\n {\r\n \treturn this.coordX;\r\n }", "protected Number getX() {\n return this.xCoordinate;\n }", "public final float getPositionX() {\r\n\t\treturn getState(false).getPositionX();\r\n\t}", "public int getX() {\n return xCoord;\n }", "protected int getxCoord() {\n\t\treturn xCoord;\n\t}", "public int calculateScreenX(float x) {\n return Math.round(center.x + x - position.x);\n }", "public void setX(int x) {\n\tbaseXCoord = x;\n}", "public double getMouseX() {\n\t\treturn getMousePosition().getX();\n\t}", "public double getPositionX() {\n\t\treturn this.tilePositionX;\n\t}", "public final int getPositionX() {\r\n return (int) position.x();\r\n }", "public int getX() {\n return this.coordinate.x;\n }", "public void setX( int x ) {\n\t\t//not checking if x is valid because that depends on the coordinate system\n\t\tthis.x = x;\n\t}", "public double getX() {\r\n\t\t return this.xCoord;\r\n\t }", "public double getXPosition()\n\t{\n\t\treturn xPosition;\n\t}", "public int getX()\r\n {\r\n return xCoord;\r\n }", "public void setXPosition(double x)\n\t{\n\t\tthis.xPosition = x;\n\t}", "public final double getScreenX() {\n return screenX;\n }", "public void setXCoordinate(int newValue)\n {\n x = newValue;\n }", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public int get_X_Coordinate()\n {\n return currentBallX;\n }", "public int getX() {\n\t\t\n\t\treturn xPosition;\t\t// Gets the x integer\n\t}", "public void setX(double val) {\r\n\t\t this.xCoord = val;\r\n\t }", "double getXPosition();", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public double getPositionX() {\n return positionX_;\n }", "public int setObjXCoord() {\n\t\tint objX = ThreadLocalRandom.current().nextInt(1, getRoomWidth() - 1);\r\n\t\treturn objX;\r\n\t}", "public double getXCoordinates() { return xCoordinates; }", "private int get_x() {\n return center_x;\n }", "public int getX() {\n return (int) center.getX();\n }", "public void setXLoc(int xLoc){\n myRectangle.setX(xLoc);\n }", "public double getStartX()\n {\n return startxcoord; \n }", "public float getxPosition() {\n return xPosition;\n }", "public int getXPosition() {\n\t\treturn this.position.x;\n\t}", "public int getX(){\n\t\tif(!resetCoordinates()) return 10000;\n\t\treturn Math.round(robot.translation.get(0)/ AvesAblazeHardware.mmPerInch);\n\t}", "public float getPositionX() {return this.position.getX();}", "public int getScreenX()\r\n\t{\r\n\t\treturn mScreen.getX();\r\n\t}", "public int getxPosition() {\n\t\treturn xPosition;\n\t}", "public int getXPosition() {\n return xPosition;\n }", "public int getX() {\r\n return (int) center.getX();\r\n }", "double getPositionX();", "double getPositionX();", "double getPositionX();", "public int getLocationX() {\r\n\t\treturn x;\r\n\t}", "public void setCenterX(double x) { centerX.set(clamp(x, X_MIN, X_MAX)); }", "@Override\n\tpublic void setX(int x) {\n\t\txPos = x;\n\t}", "public int getX() {\n if (this.coordinates == null)\n return -1;\n return this.coordinates.x();\n }", "Coordinate getMinX();", "public final int getX()\n\t{\n\t\treturn pos.x;\n\t}", "public int getX() {\n synchronized (this.xLock) {\n return (int) this.movementComposer.getXPosition();\n }\n }", "public Builder setPositionX(double value) {\n bitField0_ |= 0x00000040;\n positionX_ = value;\n onChanged();\n return this;\n }", "public int getXPosition(){\n\t\treturn xPosition;\n\t}", "public double getCenterX() {\n\t\treturn centerX;\n\t}", "public int getXPos() {\n\t\treturn xPos;\n\t}", "public int getxPos() {\n\t\treturn xPos;\n\t}", "public float getX() {\n return pos.x;\n }", "public Builder setPositionX(double value) {\n bitField0_ |= 0x00000004;\n positionX_ = value;\n onChanged();\n return this;\n }", "public int getXPos() {\r\n\t\treturn this.cameraX;\r\n\t}", "public void setxCoord(int xCoord) {\n\t\tthis.xCoord = xCoord;\n\t}", "public void setTileX(int x) {\n\t\ttileX = x;\n\t}", "public int getX() {\n return (int) xPos;\n }", "public int getXPosition()\n {\n return xPosition;\n }", "public int getXPosition()\n {\n return xPosition;\n }", "public Builder setPositionX(double value) {\n bitField0_ |= 0x00000008;\n positionX_ = value;\n onChanged();\n return this;\n }", "public int getX() {\r\n return xpos;\r\n }", "public int getPositionX() {\r\n\t\treturn positionX;\r\n\t}", "public double getX() {\n return position.getX();\n }", "public int getxPos() \n\t{\n\t\treturn xPos;\n\t}", "public final double getX() { return location.getX(); }", "public PlotPosition setX( double x )\n {\n return setX( x, 1 );\n }", "public void setX(int xpos) {\r\n this.xpos = xpos;\r\n }", "public float MouseX() {\n\t\treturn container.getInput().getMouseX(); \n\t}", "public int getxOnScreen(){\n this.xOnScreen = xMaze * moverStepSizeOnScreen;\n return this.xOnScreen;\n }", "public int getLocationX( )\n\t{\n\t\treturn locationX;\n\t}" ]
[ "0.71075004", "0.7044496", "0.7041231", "0.70188993", "0.69354725", "0.6876299", "0.6876299", "0.6839738", "0.67733145", "0.6763172", "0.67355096", "0.67139775", "0.67097485", "0.6682599", "0.6656242", "0.6643665", "0.6618716", "0.6618716", "0.66078675", "0.66069525", "0.66016924", "0.65800685", "0.6569114", "0.6555286", "0.6508002", "0.6499843", "0.6479573", "0.64136463", "0.6399339", "0.63912845", "0.63638294", "0.6359573", "0.63417774", "0.6328554", "0.6307308", "0.62798005", "0.62559444", "0.62546307", "0.6253441", "0.62522155", "0.6246173", "0.624181", "0.6241598", "0.62399995", "0.62399995", "0.62382174", "0.62133545", "0.620887", "0.6205087", "0.62000364", "0.61975557", "0.6197346", "0.6197346", "0.6174967", "0.61580265", "0.61399126", "0.61266637", "0.61252433", "0.6124221", "0.6116328", "0.6104098", "0.6102904", "0.6095695", "0.6092212", "0.60710627", "0.6070478", "0.6057964", "0.6048674", "0.6048674", "0.6048674", "0.6047652", "0.60284317", "0.60259026", "0.60217327", "0.6018719", "0.6005903", "0.5998297", "0.5990022", "0.5989871", "0.5984546", "0.5983954", "0.59688807", "0.5967835", "0.5962877", "0.59596944", "0.5958555", "0.59574586", "0.59441966", "0.5943627", "0.5943627", "0.59398884", "0.59384084", "0.5930437", "0.59224683", "0.59118754", "0.5903148", "0.59007907", "0.5899731", "0.5898812", "0.5897691", "0.58952874" ]
0.0
-1
returns the grid position of the entrance 2 in the data
public Grid getEntrance(){ return getpos((byte)2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Point getGridCoordinates(){\n try {\n return (new Point(x / MapManager.getMapTileWidth(), y / MapManager.getMapTileHeight()));\n } catch (Exception e){\n System.out.print(\"Error while getting grid coordinates.\");\n throw e;\n }\n }", "public Grid getExit(){\n\t\treturn getpos((byte)3);\n\t}", "public static int getGridPosition(int x, int y, int width){\n\t\treturn (y*width)+x;\n\t}", "public int getLocation(int x, int y) {\n\t\treturn grid[x][y];\n\t}", "public int[] getPositionInGrid( int tile )\n\t{\n\t\tint[] position = new int[2];\n\t\t\n\t\tfor ( int y = 0; y < height; y++ )\n\t\t{\n\t\t\tfor ( int x = 0; x < width; x++ )\n\t\t\t{\n\t\t\t\tif ( grid[x][y] == tile ) \n\t\t\t\t{\n\t\t\t\t\tposition[0] = x;\n\t\t\t\t\tposition[1] = y;\n\t\t\t\t\t\n\t\t\t\t\t// Should break but meh\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn position;\n\t}", "private void findGrid(int x, int y) {\n\tgx = (int) Math.floor(x / gs);\n\tgy = (int) Math.floor(y / gs);\n\n\tif (debug){\n\tSystem.out.print(\"Actual: (\" + x + \",\" + y + \")\");\n\tSystem.out.println(\" Grid square: (\" + gx + \",\" + gy + \")\");\n\t}\n }", "private Point2D getBoardPosition() {\n double size = getCellSize();\n double x = canvas.getWidth() / 2 - board.getWidth() * size / 2;\n double y = canvas.getHeight() / 2 - board.getHeight() * size / 2;\n\n return new Point2D(x, y);\n }", "public char getGrid(int x ,int y){\n\t\treturn Grid[x][y] ;\n\t}", "public Position findWeedPosition() {\n int x = 0;\n int y = 0;\n int sum = 0;\n for (int i = 0; i < this.WORLD.getMapSize().getX(); i++) {\n for (int j = 0; j < this.WORLD.getMapSize().getY(); j++) {\n\n //hogweed\n Organism organism = this.WORLD.getOrganism(i, j);\n if(organism!=null){\n Class c = organism.getClass();\n if (c.getSimpleName().equals(\"Parnsip\")) {\n int tmpX = Math.abs(this.position.getX() - i);\n int tmpY = Math.abs(this.position.getY() - j);\n if (!(sum==0)) {\n int tmpSum = tmpX + tmpY;\n if (sum > tmpSum) {\n x = i;\n y = j;\n sum = tmpSum;\n }\n }\n else {\n x = i;\n y = j;\n sum = tmpX + tmpY;\n\n }\n }\n }\n\n }\n }\n return new Position(x,y);\n }", "public Cell getCellAt (int x, int y) {\n return grid[x-1][y-1];\n }", "public int getGridY() {\r\n\t\treturn gridY;\r\n\t}", "public int[] getCurrentPieceGridPosition() {\n\t\treturn currentPieceGridPosition; \n\t}", "default int gridToSlot(int x, int y) {\n return y * 9 + x;\n }", "int getCell(int x, int y) {\n try {\n return hiddenGrid[x][y];\n } catch (IndexOutOfBoundsException hiddenIndex) {}\n return hiddenGrid[x][y];\n }", "private int xyToOneD(int row, int col) {\n return ((row - 1) * grid.length) + (col - 1);\n }", "public int calculateGridCellRow(int y)\n {\n float topEdge = miniGame.getBoundaryTop();\n y = (int)(y - topEdge);\n return y / TILE_IMAGE_HEIGHT;\n }", "Tile getPosition();", "public GridLocation getLocation();", "Coordinate[] getTilePosition(int x, int y) {\n\t\treturn guiTiles.get(y).get(x).getBoundary();\n\t}", "public boolean getGrid(int x, int y){\n\t\treturn grid[x][y];\n\t}", "@Test\n\tpublic void testGetGridOffsetValues() {\n\t\tAssert.assertEquals(13.68, Geoid.getGridOffset(90.0, 0.0), EPSILON);\n\t\tAssert.assertEquals(-29.79, Geoid.getGridOffset(-90.0, 0.0), EPSILON);\n\n\t\t// random grid params from EGM.complete.txt.gz\n\t\t// 89.74 5.75 13.89\n\t\t// 86.5 217.25 11.76\n\t\t// 71.25 8.0 43.56\n\t\t// 54.0 182.25 2.35\n\t\t// 35.5 186.0 -12.91\n\t\t// 14.75 213.5 -8.07\n\t\t// -22.25 221.5 -10.18\n\t\t// -37.5 13.0 25.61\n\t\t// -51.75 157.25 -17.88\n\t\t// -70.5 346.0 5.18\n\t\t// -74.5 22.0 17.5\n\t\t// -84.5 306.25 -25.71\n\t\t// -86.75 328.75 -21.81\n\n\t\tAssert.assertEquals(13.89, Geoid.getGridOffset(89.74, 5.75), EPSILON); \n\t\tAssert.assertEquals(11.76, Geoid.getGridOffset(86.5, 217.25), EPSILON);\n\t\tAssert.assertEquals(43.56, Geoid.getGridOffset(71.25, 8.0), EPSILON);\n\t\tAssert.assertEquals(2.35, Geoid.getGridOffset(54.0, 182.25), EPSILON);\n\t\tAssert.assertEquals(-12.91, Geoid.getGridOffset(35.5, 186.0), EPSILON);\n\t\tAssert.assertEquals(-8.07, Geoid.getGridOffset(14.75, 213.5), EPSILON);\n\t\tAssert.assertEquals(-10.18, Geoid.getGridOffset(-22.25, 221.5), EPSILON);\n\t\tAssert.assertEquals(25.61, Geoid.getGridOffset(-37.5, 13.0), EPSILON);\n\t\tAssert.assertEquals(-17.88, Geoid.getGridOffset(-51.75, 157.25), EPSILON);\n\t\tAssert.assertEquals(5.18, Geoid.getGridOffset(-70.5, 346.0), EPSILON);\n\t\tAssert.assertEquals(17.5, Geoid.getGridOffset(-74.5, 22.0), EPSILON);\n\t\tAssert.assertEquals(-25.71, Geoid.getGridOffset(-84.5, 306.25), EPSILON);\n\t\tAssert.assertEquals(-21.81, Geoid.getGridOffset(-86.75, 328.75), EPSILON);\n\t\tAssert.assertEquals(-29.79, Geoid.getGridOffset(-90.0, 0.0), EPSILON);\n\t}", "public int getGridX() {\r\n\t\treturn gridX;\r\n\t}", "public static int[] ScreenToLevelCoordinates(Vector2 position) {\n\t\tint[] levelPos = new int[2];\n\t\tposition.sub(X_OFFSET*TILE_SIZE, Y_OFFSET*TILE_SIZE);\n\t\tint gridX = (int)position.x/TILE_SIZE;\n\t\tint gridY = (int)position.y/TILE_SIZE;\n\t\tlevelPos[0] = gridX;\n\t\tlevelPos[1] = gridY;\n\t\treturn levelPos;\n\t}", "public GridCoord getCoord() {\n return coord;\n }", "List<GridCoordinate> getCoordinates(int cellWidth, int cellHeight);", "public boolean onGrid(int xValue, int yValue);", "public int getXD2 ()\n\t{\n\t\treturn xDimension2;\n\t}", "public int getY(){\n return this.position[1];\n }", "public Point getCoordinates(int val) {\r\n\t\tfor(int i = 0; i < rows_size; i++) {\r\n\t\t\tfor(int j = 0; j < columns_size; j++) {\r\n\t\t\t\tif(game[i][j].getValue() == val)\r\n\t\t\t\t\treturn new Point(i,j);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn new Point(-1,-1);\r\n\t}", "private short computeLocationValue(short row, short column) {\n\t\treturn (short) (gridSize * row + column);\n\t}", "Coordinates getCoordinates(int rowIndex);", "@Override\n protected void drawGrid(Graphics2D g2, int startPos, int rightEdgePos, int bottomEdgePos, int start,\n int nrows1, int ncols1, int gridOffset) {}", "private int getEastCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif (cellNumber % getGridWidth() != (getGridWidth()-1)) {\n\t\t\treturn (cellNumber + 1);\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\treturn (cellNumber - getGridWidth() + 1);\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "private int getNorthEastCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif ((cellNumber >= getGridWidth()) && (cellNumber % getGridWidth() != (getGridWidth()-1))) {\n\t\t\treturn (cellNumber - getGridWidth() + 1);\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\tif (cellNumber >= getGridWidth()) { //move east, then north\n\t\t\t\t\treturn (cellNumber - 2*getGridWidth() + 1);\n\t\t\t\t}\n\t\t\t\tif (cellNumber % getGridWidth() != (getGridWidth()-1)) { //move north, then east\n\t\t\t\t\treturn (getGridSize() - getGridWidth() + cellNumber + 1);\n\t\t\t\t}\n\t\t\t\treturn (getGridSize() - getGridWidth()); //upper right corner\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int getLocation(int x, int y) {\n\t\treturn board[x][y];\n\t}", "@Override\n public int[] getStartPosition() {\n if(maze != null){\n int[] position = new int[2];\n position[0] = maze.getStartPosition().getRowIndex();\n position[1] = maze.getStartPosition().getColumnIndex();\n return position;\n }\n return null;\n }", "public int y (int index) { return coords[index][1]; }", "@Override\n public int getTileGridXOffset() {\n return this.tileGridXOffset;\n }", "int getTileGridXOffset(Long id) throws RemoteException;", "@Override\n public int[] getGoalPosition() {\n\n if(maze != null){\n int[] position = new int[2];\n position[0] = maze.getGoalPosition().getRowIndex();\n position[1] = maze.getGoalPosition().getColumnIndex();\n return position;\n }\n return null;\n }", "public GridPoint digitise() {\n\n Location myLocation = myLocation();\n GridPoint myGP = myGridPoint();\n //myLocationClick();\n points.add(myGridPoint());\n if (points.size() > 2) {\n\n\n mFinishButton.setVisibility(View.VISIBLE);\n\n }\n double latitude = myGridPoint().x;\n double longitude = myGridPoint().y;\n String stringLat = Double.toString(latitude);\n String stringLong = Double.toString(longitude);\n String coordPair = \" \" + stringLat + \",\" + stringLong;\n collectedPoints.add(coordPair);\n locations.add(myLocation);\n\n return myGP;\n\n }", "public Coordonnees getCoordonnees(int x, int y) {\r\n\t\tif(y >= 0 && y < hauteur && x >= 0 && x < largeur)\r\n\t\t\treturn this.plateau[y][x].getCoordonnees();\r\n\t\treturn null;\r\n\t}", "int getTileGridYOffset(Long id) throws RemoteException;", "public Position findWeed() {\n int xVec =0;\n int yVec=0;\n int sum = 0;\n Position move = new Position(0, 0);\n for (int i = 0; i < this.WORLD.getMapSize().getX(); i++) {\n for (int j = 0; j < this.WORLD.getMapSize().getY(); j++) {\n\n //hogweed\n Organism organism = this.WORLD.getOrganism(i, j);\n if(organism!=null){\n Class c = organism.getClass();\n if (c.getSimpleName().equals(\"Parnsip\")) {\n int tmpX = Math.abs(this.position.getX() - i);\n int tmpY = Math.abs(this.position.getY() - j);\n if (!(xVec == 0 && yVec == 0)) {\n int tmpSum = tmpX + tmpY;\n if (sum > tmpSum) {\n xVec=tmpX;\n yVec=tmpY;\n sum = tmpSum;\n this.setMove(move, j, i);\n }\n }\n else {\n xVec=tmpX;\n yVec=tmpY;\n sum = tmpX + tmpY;\n this.setMove(move, j, i);\n }\n }\n }\n\n }\n }\n return move;\n }", "public Point findSpace(){\r\n Point toReturn = new Point(-1, -1);\r\n for (int i = 0; i<puzzleSize; i++){\r\n for (int j = 0; j<puzzleSize; j++){\r\n if (this.state[i][j] == 0)\r\n toReturn.setLocation(i,j);\r\n }\r\n }\r\n return toReturn;\r\n }", "public Location getLocation(int row, int column) {\n\t\treturn this.grid[row][column];\n\t}", "public boolean getGrid(int x, int y) {\n\t\tif ((x < 0) || (x > width)) {\n\t\t\treturn true;\n\t\t} else if ((y < 0) || (y > height)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn grid[x][y]; // YOUR CODE HERE\n\t\t}\n\t}", "private int getArrayPos(int x, int y) {\n int position = (y - 1) * this.yDimension + x - 1;\n return position;\n }", "private Cell[][] updateCellLocation(Cell[][] grid) {\n\n //Iterate through the grid\n for (int x = 0; x < this.width; x++) {\n for (int y = 0; y < this.height; y++) {\n grid[x][y].setXCord(x); //Set the new X co-ordinate\n grid[x][y].setYCord(y); //Set the new Y co-ordinate\n }\n }\n\n return grid;\n }", "public Point2D getCellCoordinates(JmtCell cell) {\r\n \t\tRectangle2D bounds = GraphConstants.getBounds(cell.getAttributes());\r\n \t\treturn new Point2D.Double(bounds.getMinX(), bounds.getMinY());\r\n \t}", "private int ufindex(int row, int col) {\n return grid.length * (row - 1) + col - 1;\n }", "public void getNeighbors(){\n // North \n if(this.row - this.value>=0){\n this.north = adjacentcyList[((this.row - this.value)*col_size)+col];\n }\n // South\n if(this.row + value<row_size){\n this.south = adjacentcyList[((this.row+this.value)*row_size)+col];\n }\n // East\n if(this.col + this.value<col_size){\n this.east = adjacentcyList[((this.col+this.value)+(this.row)*(col_size))];\n }\n // West\n if(this.col - this.value>=0){\n this.west = adjacentcyList[((this.row*col_size)+(this.col - this.value))];\n }\n }", "public int[][] place(){\r\n\t\treturn coords(pos);\r\n\t}", "public Vector2f getCoordinates() {\r\n return new Vector2f(tileColumn, tileRow);\r\n }", "public double getUserFriendlyYPos(){\n return myGrid.getHeight()/ HALF-yPos;\n }", "public int getYcoord(){\n\t\treturn this.coordinates[1];\n\t}", "Square getCurrentPosition();", "public Move getGridElement (int row, int column)\n {\n return mGrid[row][column];\n }", "private int getPosition(int row, int col) {\n\t\treturn (side * (row - 1)) + (col - 1);\n\t}", "public double smilePos(){\r\n\r\n\t\treturn smile.getY();\r\n\r\n\t}", "public float[] findXY(){\n //Initialize the xy coordinates and the array\n int x = -1;\n int y = -1;\n float[] location = new float[2];\n\n //Find the blank card\n for(int i = 0; i < cardArray.length; i++){\n for(int j = 0; j < cardArray.length; j++){\n if(cardArray[i][j].getCardNum() == 16){\n x = i;\n y = j;\n }\n }\n }\n\n /* For each of the following cases, find the neighbors of the\n blank card. Select only neighbors that are in the incorrect spot so that\n the computer player does not mess up the game. If both are in the correct spot\n choose one to move\n */\n //Case 1: it is in the top left corner, find a neighbor\n if((x == 0) && (y == 0)){\n if(cardArray[x+1][y].getColor() == 255){\n location[0] = cardArray[x + 1][y].getXVal();\n location[1] = cardArray[x + 1][y].getYVal();\n }\n else{\n location[0] = cardArray[x][y + 1].getXVal();\n location[1] = cardArray[x][y + 1].getYVal();\n }\n }\n\n //Case 2: it is in the top right corner, find a neighbor\n if((x == 0) && (y == cardArray.length - 1)){\n if(cardArray[x + 1][y].getColor() == 255){\n location[0] = cardArray[x + 1][y].getXVal();\n location[1] = cardArray[x + 1][y].getYVal();\n }\n else{\n location[0] = cardArray[x][y - 1].getXVal();\n location[1] = cardArray[x][y - 1].getYVal();\n }\n }\n\n //Case 3: It is in the bottom left corner, find a neighbor\n if((x == cardArray.length - 1) && (y == 0)){\n if(cardArray[x - 1][y].getColor() == 255){\n location[0] = cardArray[x - 1][y].getXVal();\n location[1] = cardArray[x - 1][y].getYVal();\n }\n else{\n location[0] = cardArray[x][y + 1].getXVal();\n location[1] = cardArray[x][y + 1].getYVal();\n }\n }\n\n //Case 4: It is in the bottom right corner, find a neighbor\n if((x == cardArray.length - 1) && (y == cardArray.length - 1)){\n if(cardArray[x - 1][y].getColor() == 255){\n location[0] = cardArray[x - 1][y].getXVal();\n location[1] = cardArray[x - 1][y].getYVal();\n }\n else{\n location[0] = cardArray[x][y - 1].getXVal();\n location[1] = cardArray[x][y - 1].getYVal();\n }\n }\n\n //Case 5: It is in the top row, find a neighbor\n if((x == 0) && (y > 0) && ( y < cardArray.length - 1)){\n if(cardArray[x][y + 1].getColor() == 255){\n location[0] = cardArray[x][y + 1].getXVal();\n location[1] = cardArray[x][y + 1].getYVal();\n }\n else if(cardArray[x][y - 1].getColor() == 255){\n location[0] = cardArray[x][y - 1].getXVal();\n location[1] = cardArray[x][y - 1].getYVal();\n }\n else{\n location[0] = cardArray[x + 1][y].getXVal();\n location[1] = cardArray[x + 1][y].getYVal();\n }\n }\n\n //Case 6: It is on the bottom row, find a neighbor\n if((x == cardArray.length - 1) && (y > 0) && (y < cardArray.length- 1)){\n if (cardArray[x][y + 1].getColor() == 255){\n location[0] = cardArray[x][y + 1].getXVal();\n location[1] = cardArray[x][y + 1].getYVal();\n }\n else if (cardArray[x][y - 1].getColor() == 255){\n location[0] = cardArray[x][y - 1].getXVal();\n location[1] = cardArray[x][y - 1].getYVal();\n }\n else{\n location[0] = cardArray[x - 1][y].getXVal();\n location[1] = cardArray[x - 1][y].getYVal();\n }\n }\n\n //Case 7: It is on the left column, find a neighbor\n if((x > 0) && (x < cardArray.length - 1) && (y == 0)){\n if(cardArray[x + 1][y].getColor() == 255){\n location[0] = cardArray[x + 1][y].getXVal();\n location[1] = cardArray[x + 1][y].getYVal();\n }\n else if(cardArray[x - 1][y].getColor() == 255){\n location[0] = cardArray[x - 1][y].getXVal();\n location[1] = cardArray[x - 1][y].getYVal();\n }\n else{\n location[0] = cardArray[x][y + 1].getXVal();\n location[1] = cardArray[x][y + 1].getYVal();\n }\n }\n\n //Case 8: It is on the right column, find a neighbor\n if((x > 0) && (x < cardArray.length - 1) && (y == cardArray.length - 1)){\n if(cardArray[x + 1][y].getColor() == 255){\n location[0] = cardArray[x + 1][y].getXVal();\n location[1] = cardArray[x + 1][y].getYVal();\n }\n else if(cardArray[x - 1][y].getColor() == 255){\n location[0] = cardArray[x - 1][y].getXVal();\n location[1] = cardArray[x - 1][y].getYVal();\n }\n else{\n location[0] = cardArray[x][y - 1].getXVal();\n location[1] = cardArray[x][y - 1].getYVal();\n }\n }\n\n //Case 9: It is not an edge or corner, find a neighbor\n if((x > 0) && (x < cardArray.length - 1) && (y > 0) && (y < cardArray.length -1)){\n if(cardArray[x + 1][y].getColor() == 255){\n location[0] = cardArray[x + 1][y].getXVal();\n location[1] = cardArray[x + 1][y].getYVal();\n }\n else if(cardArray[x - 1][y].getColor() == 255){\n location[0] = cardArray[x - 1][y].getXVal();\n location[1] = cardArray[x - 1][y].getYVal();\n }\n else if(cardArray[x][y + 1].getColor() == 255){\n location[0] = cardArray[x][y + 1].getXVal();\n location[1] = cardArray[x][y + 1].getYVal();\n }\n else{\n location[0] = cardArray[x][y - 1].getXVal();\n location[1] = cardArray[x][y - 1].getYVal();\n }\n }\n\n //Return the array containing the xy coordinates of the blank square's neighbor\n return location;\n }", "public GridLocation(){ //of the grid at the moment\n charactersOccupiedTheLocation=new Object[4];\n }", "public int get(int xcord, int ycord) {\n\t\treturn grid[xcord][ycord];\n\t}", "public GridCoord getCoord() {\n\t\treturn this.coord;\n\t}", "private int getNorthCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif (cellNumber >= getGridWidth()) {\n\t\t\treturn (cellNumber - getGridWidth());\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\treturn (getGridSize() - getGridWidth() + cellNumber);\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public Spatial boardCentre() {\r\n return tiles[2][2].tile;\r\n }", "public int getXY(int x, int y);", "public static Dimension getPos()\n {\n Dimension pos = new Dimension( cX, cY );\n next();\n return pos;\n }", "public double getUserFriendlyXPos(){\n return xPos - myGrid.getWidth()/ HALF;\n }", "public int getPosition(){\n\t\treturn this.cell;\n\t}", "public int getY() { return loc.y; }", "@Override\r\n\tpublic Integer getCell(Integer x, Integer y) {\n\t\treturn game[x][y];\r\n\t}", "public int getX() { return loc.x; }", "public int I(int x, int y, int z){\n //gets typeGrid index from location\n return x*yDim*zDim+y*zDim+z;\n }", "public static int randomPos(int grid) {\n Random rand = new Random();\n return rand.nextInt((grid));\n }", "private int terminalLocation(){\n int answer = 0;\n for(int ii = 0; ii < (currentIm.getRows() * currentIm.getCols()); ii = ii + 1){\n if(126 == getHidden(ii)){\n return answer = ii;\n }\n }\n \n return answer;\n }", "public static int getBukkitPosition(int x,int y){\n return ((y-1)*9)+x-1;\n }", "public int[] getNeighborColIndex() {\n if (myRow % 2 == 0) {\n return neighborEvenColIndex;\n } else {\n return neighborOddColIndex;\n }\n }", "public Point2D getNodePositionXY () { return n.getXYPositionMap(); }", "private int colPos(int pos) {\r\n return pos % squareDimension;\r\n }", "public int getLocX() {\n return locX;\n }", "private int findG(int currentIndex){\r\n int mapCol = _map.get_mapCol();\r\n int currentRow = currentIndex / mapCol;\r\n int currentCol = currentIndex % mapCol;\r\n\r\n int startRow = _startIndex / mapCol;\r\n int startCol = _startIndex % mapCol;\r\n\r\n return Math.abs(currentRow - startRow) + Math.abs(currentCol - startCol);\r\n }", "public int getLocY() {\n return locY;\n }", "public int[] getCellPosition(int i, int j)\n {\n int[] position = {firstCellPosition[0]+i*cellSize,firstCellPosition[1]+j*cellSize};\n return position;\n }", "public int getFirstPos ()\r\n {\r\n return glyph.getBounds().y;\r\n }", "public int getLocY ()\n {\n return locY;\n }", "private long opponent_winning_position() {\r\n return compute_winning_position(bitboard ^ mask, mask);\r\n }", "protected int checkWhere(float x, float y)\n\t{\n\t\t//check if it's in the first column\n\t\tif((x>0)&&(x<180))\n\t\t{\n\t\t\t//if it's in the first column, check which row it's in\n\t\t\tif(y<180)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif(y<360)\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif(y<540)\n\t\t\t{\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t}\n\n\t\t//check if it's in the second column\n\t\tif((x>180)&&(x<360))\n\t\t{\n\t\t\t//if it is, check which row it's in\n\t\t\tif(y<180)\n\t\t\t{\n\t\t\t\treturn 3;\n\t\t\t}\n\t\t\tif(y<360)\n\t\t\t{\n\t\t\t\treturn 4;\n\t\t\t}\n\t\t\tif(y<540)\n\t\t\t{\n\t\t\t\treturn 5;\n\t\t\t}\n\t\t}\n\n\t\t//if it's not in the first or second column, it's in the third column\n\t\tif(x>360)\n\t\t{\n\t\t\t//check which row it's in\n\t\t\tif(y<180)\n\t\t\t{\n\t\t\t\treturn 6;\n\t\t\t}\n\t\t\tif(y<360)\n\t\t\t{\n\t\t\t\treturn 7;\n\t\t\t}\n\t\t\tif(y<540)\n\t\t\t{\n\t\t\t\treturn 8;\n\t\t\t}\n\t\t}\n\t\t//just in case it's not in anything, then return 9.\n\t\t//this will cause the thingy to not change\n\t\treturn 9;\n\t}", "public InventoryRange getGrid() {\n \t\treturn this.grid;\n \t}", "double getY() { return pos[1]; }", "public int I(double x, double y, double z){\n //gets typeGrid index from location\n return (int)Math.floor(x)*yDim*zDim+(int)Math.floor(y)*zDim+(int)Math.floor(z);\n }", "public int gameStatus() {\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tif((Grid[x][0] == Grid[x][1]) && (Grid[x][1] == Grid[x][2]))\n \t\t\t\tif(Grid[x][0] != 0 && Grid[x][1] != 0 && Grid[x][2] != 0)\n \t\t\t\t\treturn Grid[x][0];\n \t\t}\n \t\tfor(int y=0;y<3;y++) {\n \t\t\tif((Grid[0][y] == Grid[1][y]) && (Grid[1][y] == Grid[2][y])) \n \t\t\t\tif(Grid[0][y] != 0 && Grid[1][y] != 0 && Grid[2][y] != 0)\n \t\t\t\t\treturn Grid[0][y];\n \t\t}\n \t\tif(Grid[0][0] == Grid[1][1] && Grid[1][1] == Grid[2][2]) \n \t\t\tif(Grid[0][0] != 0 && Grid[1][1] != 0 && Grid[2][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tif(Grid[2][0] == Grid[1][1] && Grid[1][1] == Grid[0][2])\n \t\t\tif(Grid[2][0] != 0 && Grid[1][1] != 0 && Grid[0][2] != 0)\n \t\t\t\treturn Grid[0][0];\n \t\tfor(int x = 0;x<3;x++) {\n \t\t\tfor(int y = 0;y<3;y++) {\n \t\t\t\tif(Grid[x][y] == 0)\n \t\t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t\treturn 3;\t\t\n \t}", "public int[][] getGrid()\n {\n return grid;\n }", "public abstract int findRowForWindow(int y);", "public int calculateTileXInGrid(int column, int z)\n {\n int cellWidth = TILE_IMAGE_WIDTH;\n float leftEdge = miniGame.getBoundaryLeft();\n return (int)(leftEdge + (cellWidth * column) - (Z_TILE_OFFSET * z));\n }", "private int getIdx(MouseEvent e) {\n Point p = e.getPoint();\n p.translate(-BORDER_SIZE, -BORDER_SIZE);\n int x = p.x / CELL_SIZE;\n int y = p.y / CELL_SIZE;\n if (0 <= x && x < GUI.SIZE[1] && 0 <= y && y < GUI.SIZE[1]) {\n return GUI.SIZE[1] * x + y;\n } else {\n return -1;\n }\n }", "private int getSouthCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif (cellNumber < getGridSize() - getGridWidth()) {\n\t\t\treturn (cellNumber + getGridWidth());\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\treturn (cellNumber % getGridWidth());\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int getX(){\n return this.position[0];\n }", "public Ndimensional getStartPoint();", "private Point2D.Float toGridPoint(int x, int y) {\n return new Point2D.Float((float)((x - centreX)*scale), (float)((centreY - y)*scale));\n }" ]
[ "0.69032586", "0.67324233", "0.67312473", "0.6676428", "0.6624019", "0.6482292", "0.6453441", "0.6344518", "0.633647", "0.63168913", "0.61934686", "0.6188164", "0.61233", "0.6105612", "0.6030974", "0.60079783", "0.5994916", "0.59934413", "0.59372383", "0.592895", "0.59284633", "0.59252924", "0.59076834", "0.58868974", "0.5886839", "0.5876147", "0.58583915", "0.5851605", "0.58401823", "0.58399105", "0.58384615", "0.5829768", "0.58255374", "0.58106244", "0.5810337", "0.5807888", "0.57842374", "0.57804507", "0.5777107", "0.5758884", "0.5748985", "0.5744878", "0.5742031", "0.5736228", "0.5731807", "0.57303476", "0.5729651", "0.57295793", "0.5729131", "0.57263154", "0.5725405", "0.5710885", "0.5707692", "0.5707551", "0.56985295", "0.56932545", "0.56865907", "0.5684724", "0.5678195", "0.5669819", "0.5667304", "0.56672406", "0.5665765", "0.56621534", "0.56618774", "0.5659546", "0.5644259", "0.56437606", "0.5642926", "0.5642719", "0.5633205", "0.5630467", "0.5619157", "0.5614797", "0.56130064", "0.5607106", "0.56014794", "0.5599061", "0.5586478", "0.5585292", "0.5584986", "0.5579882", "0.55676526", "0.55670345", "0.5566959", "0.5566496", "0.5556601", "0.5555639", "0.55453604", "0.5544113", "0.5539176", "0.5532647", "0.5532277", "0.55264604", "0.5525175", "0.55215", "0.55189216", "0.5513987", "0.5509831", "0.5508863" ]
0.75697446
0
returns the grid position of the entrance 3 in the data
public Grid getExit(){ return getpos((byte)3); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Grid getEntrance(){\n\t\treturn getpos((byte)2);\n\t}", "public Point getGridCoordinates(){\n try {\n return (new Point(x / MapManager.getMapTileWidth(), y / MapManager.getMapTileHeight()));\n } catch (Exception e){\n System.out.print(\"Error while getting grid coordinates.\");\n throw e;\n }\n }", "public static int getGridPosition(int x, int y, int width){\n\t\treturn (y*width)+x;\n\t}", "public int I(int x, int y, int z){\n //gets typeGrid index from location\n return x*yDim*zDim+y*zDim+z;\n }", "public int[] getCurrentPieceGridPosition() {\n\t\treturn currentPieceGridPosition; \n\t}", "public int[] getPositionInGrid( int tile )\n\t{\n\t\tint[] position = new int[2];\n\t\t\n\t\tfor ( int y = 0; y < height; y++ )\n\t\t{\n\t\t\tfor ( int x = 0; x < width; x++ )\n\t\t\t{\n\t\t\t\tif ( grid[x][y] == tile ) \n\t\t\t\t{\n\t\t\t\t\tposition[0] = x;\n\t\t\t\t\tposition[1] = y;\n\t\t\t\t\t\n\t\t\t\t\t// Should break but meh\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn position;\n\t}", "public int getGridX() {\r\n\t\treturn gridX;\r\n\t}", "public int I(double x, double y, double z){\n //gets typeGrid index from location\n return (int)Math.floor(x)*yDim*zDim+(int)Math.floor(y)*zDim+(int)Math.floor(z);\n }", "public int getXD3 ()\n\t{\n\t\treturn xDimension3;\n\t}", "public Position findWeedPosition() {\n int x = 0;\n int y = 0;\n int sum = 0;\n for (int i = 0; i < this.WORLD.getMapSize().getX(); i++) {\n for (int j = 0; j < this.WORLD.getMapSize().getY(); j++) {\n\n //hogweed\n Organism organism = this.WORLD.getOrganism(i, j);\n if(organism!=null){\n Class c = organism.getClass();\n if (c.getSimpleName().equals(\"Parnsip\")) {\n int tmpX = Math.abs(this.position.getX() - i);\n int tmpY = Math.abs(this.position.getY() - j);\n if (!(sum==0)) {\n int tmpSum = tmpX + tmpY;\n if (sum > tmpSum) {\n x = i;\n y = j;\n sum = tmpSum;\n }\n }\n else {\n x = i;\n y = j;\n sum = tmpX + tmpY;\n\n }\n }\n }\n\n }\n }\n return new Position(x,y);\n }", "public Point get3DCoordinate(int row, int col, int width, int height) {\n\t\tdouble x, y;\r\n\t\tx = scene_width * (col / ((double) (width - 1))) - scene_width / 2.0;\r\n\t\ty = scene_height / 2.0 - scene_height * row\t/ ((double) (height - 1));\r\n\t\treturn new Point(x, y, 0);\r\n\t}", "private int threeInPos(final GameStateModule game, int player) {\n int count = 0;\n if(game.getHeight() == 4){ //if height is 4, no iterations needed\n //counting bottom up\n for(int i = 0; i < 2; i++) {\n for(int j = 0; j < 1; j++) {\n if((game.getAt(i,j) == player) && (game.getAt(i+1,j+1) == player) && (game.getAt(i+2,j+2) == player) && (game.getAt(i+3,j+3) == 0))\n count++;\n }\n }\n //counting top bottom\n for(int i = 4; i > 2; i--) {\n for(int j = 3; j > 2; j--) {\n if ((game.getAt(i, j) == player) && (game.getAt(i - 1, j-1) == player) && (game.getAt(i - 2, j-2) == player) && (game.getAt(i - 3, j-3) == 0))\n count++;\n }\n }\n }\n else { //if height is 5, iterations needed\n for(int i = 0; i < 3; i++) {\n for (int j = 0; j < 2; j++) {\n if ((game.getAt(i, j) == player) && (game.getAt(i + 1, j + 1) == player) && (game.getAt(i + 2, j + 2) == player) && (game.getAt(i+3, j+3) == 0))\n count++;\n }\n }\n for(int i = 5; i > 2; i--) {\n for (int j = 4; j > 2; j--) {\n if ((game.getAt(i, j) == player) && (game.getAt(i - 1, j - 1) == player) && (game.getAt(i - 2, j - 2) == player) && (game.getAt(i-3,j-3) == 0))\n count++;\n }\n }\n }\n return count;\n }", "public int getLocation(int x, int y) {\n\t\treturn grid[x][y];\n\t}", "Coordinates getCoordinates(int rowIndex);", "public double getPositionToP3()\r\n\t{\r\n\t\tdouble max = 0;\r\n\t\tfor(Unit u : units)\r\n\t\t{\r\n\t\t\tif(u instanceof Gate)\r\n\t\t\t\tcontinue;\r\n\t\t\tdouble d = u.getPositionAlongCurve() + u.getRadius()/owner.getLength();\r\n\t\t\tif(d > max)\r\n\t\t\t\tmax = d;\r\n\t\t}\r\n\t\tif(max < 0)\r\n\t\t\tmax = 0;\r\n\t\tif(max > 1)\r\n\t\t\tmax = 1;\r\n\t\treturn 1 - max;\r\n\t}", "Tile getPosition();", "@Override\n public int getTileGridXOffset() {\n return this.tileGridXOffset;\n }", "private void findGrid(int x, int y) {\n\tgx = (int) Math.floor(x / gs);\n\tgy = (int) Math.floor(y / gs);\n\n\tif (debug){\n\tSystem.out.print(\"Actual: (\" + x + \",\" + y + \")\");\n\tSystem.out.println(\" Grid square: (\" + gx + \",\" + gy + \")\");\n\t}\n }", "private Point2D getBoardPosition() {\n double size = getCellSize();\n double x = canvas.getWidth() / 2 - board.getWidth() * size / 2;\n double y = canvas.getHeight() / 2 - board.getHeight() * size / 2;\n\n return new Point2D(x, y);\n }", "List<GridCoordinate> getCoordinates(int cellWidth, int cellHeight);", "@Test\n\tpublic void testGetGridOffsetValues() {\n\t\tAssert.assertEquals(13.68, Geoid.getGridOffset(90.0, 0.0), EPSILON);\n\t\tAssert.assertEquals(-29.79, Geoid.getGridOffset(-90.0, 0.0), EPSILON);\n\n\t\t// random grid params from EGM.complete.txt.gz\n\t\t// 89.74 5.75 13.89\n\t\t// 86.5 217.25 11.76\n\t\t// 71.25 8.0 43.56\n\t\t// 54.0 182.25 2.35\n\t\t// 35.5 186.0 -12.91\n\t\t// 14.75 213.5 -8.07\n\t\t// -22.25 221.5 -10.18\n\t\t// -37.5 13.0 25.61\n\t\t// -51.75 157.25 -17.88\n\t\t// -70.5 346.0 5.18\n\t\t// -74.5 22.0 17.5\n\t\t// -84.5 306.25 -25.71\n\t\t// -86.75 328.75 -21.81\n\n\t\tAssert.assertEquals(13.89, Geoid.getGridOffset(89.74, 5.75), EPSILON); \n\t\tAssert.assertEquals(11.76, Geoid.getGridOffset(86.5, 217.25), EPSILON);\n\t\tAssert.assertEquals(43.56, Geoid.getGridOffset(71.25, 8.0), EPSILON);\n\t\tAssert.assertEquals(2.35, Geoid.getGridOffset(54.0, 182.25), EPSILON);\n\t\tAssert.assertEquals(-12.91, Geoid.getGridOffset(35.5, 186.0), EPSILON);\n\t\tAssert.assertEquals(-8.07, Geoid.getGridOffset(14.75, 213.5), EPSILON);\n\t\tAssert.assertEquals(-10.18, Geoid.getGridOffset(-22.25, 221.5), EPSILON);\n\t\tAssert.assertEquals(25.61, Geoid.getGridOffset(-37.5, 13.0), EPSILON);\n\t\tAssert.assertEquals(-17.88, Geoid.getGridOffset(-51.75, 157.25), EPSILON);\n\t\tAssert.assertEquals(5.18, Geoid.getGridOffset(-70.5, 346.0), EPSILON);\n\t\tAssert.assertEquals(17.5, Geoid.getGridOffset(-74.5, 22.0), EPSILON);\n\t\tAssert.assertEquals(-25.71, Geoid.getGridOffset(-84.5, 306.25), EPSILON);\n\t\tAssert.assertEquals(-21.81, Geoid.getGridOffset(-86.75, 328.75), EPSILON);\n\t\tAssert.assertEquals(-29.79, Geoid.getGridOffset(-90.0, 0.0), EPSILON);\n\t}", "public GridCoord getCoord() {\n return coord;\n }", "private short computeLocationValue(short row, short column) {\n\t\treturn (short) (gridSize * row + column);\n\t}", "public int calculateTileXInGrid(int column, int z)\n {\n int cellWidth = TILE_IMAGE_WIDTH;\n float leftEdge = miniGame.getBoundaryLeft();\n return (int)(leftEdge + (cellWidth * column) - (Z_TILE_OFFSET * z));\n }", "public E3DVector3F getVertexPosC(){\r\n return vertices[2].getVertexPos();\r\n }", "public int[][] place(){\r\n\t\treturn coords(pos);\r\n\t}", "public char getGrid(int x ,int y){\n\t\treturn Grid[x][y] ;\n\t}", "void position(double x, double y, double z);", "private int xyToOneD(int row, int col) {\n return ((row - 1) * grid.length) + (col - 1);\n }", "public int getLast3SSPos() {\n\t\treturn getStartOfBEDentry(getBEDentry().getBlockAtRelativePosition(-1)); \n\t}", "public static int randomPos(int grid) {\n Random rand = new Random();\n return rand.nextInt((grid));\n }", "private int threeInRow(final GameStateModule game, int player) {\n int count = 0;\n int maxHeight = 0;\n for(int i = 0; i < game.getWidth(); i++){\n if(game.getHeightAt(i) > maxHeight)\n maxHeight = game.getHeightAt(i);\n }\n for(int i = 0; i < Math.floor(game.getWidth()/2); i++) { //left to right\n for(int j = 0; j < maxHeight; j++) {\n if((game.getAt(i,j) == player) && (game.getAt(i+1,j) == player) && (game.getAt(i+2,j) == player) &&(game.getAt(i+3,j) == 0))\n count++;\n }\n }\n for(int i = game.getWidth()-1; i > Math.ceil(game.getWidth()/2); i--) { //right to left\n for(int j = 0; j < maxHeight; j++) {\n if((game.getAt(i,j) == player) && (game.getAt(i-1,j) == player) && (game.getAt(i-2,j) == player) &&(game.getAt(i-3,j) == 0))\n count++;\n }\n }\n return count;\n }", "public Pair<Integer> get_pos(int n)\n {\n \t int row=(n-1)/3;\n \t int col=(n-1)%3;\n \t return new Pair<Integer>(row,col);\n }", "public Point findSpace(){\r\n Point toReturn = new Point(-1, -1);\r\n for (int i = 0; i<puzzleSize; i++){\r\n for (int j = 0; j<puzzleSize; j++){\r\n if (this.state[i][j] == 0)\r\n toReturn.setLocation(i,j);\r\n }\r\n }\r\n return toReturn;\r\n }", "@Override\n public int[] getStartPosition() {\n if(maze != null){\n int[] position = new int[2];\n position[0] = maze.getStartPosition().getRowIndex();\n position[1] = maze.getStartPosition().getColumnIndex();\n return position;\n }\n return null;\n }", "private int threeInCol(final GameStateModule game, int player) {\n int count = 0;\n for(int i = 0; i < game.getWidth(); i++) {\n if(game.getHeight() == 4) { //for 5x4\n int j = 0;\n if((game.getAt(i, j) == player) && (game.getAt(i, j+1) == player) && (game.getAt(i, j+2) == player) && game.getAt(i, j+3) == 0)\n count++;\n }\n else { //for 6x5\n for(int j = 0; j < 2; j++) {\n if((game.getAt(i, j) == player) && (game.getAt(i, j+1) == player) && (game.getAt(i, j+2) == player) && game.getAt(i, j+3) == 0)\n count++;\n }\n }\n }\n return count;\n }", "public GridLocation(){ //of the grid at the moment\n charactersOccupiedTheLocation=new Object[4];\n }", "public Point3d get3DCenter() {\n double xOfCenter = 0;\n double yOfCenter = 0;\n double zOfCenter = 0;\n for (IAtom atom : atoms) {\n xOfCenter += atom.getPoint3d().x;\n yOfCenter += atom.getPoint3d().y;\n zOfCenter += atom.getPoint3d().z;\n }\n\n return new Point3d(xOfCenter / getAtomCount(),\n yOfCenter / getAtomCount(),\n zOfCenter / getAtomCount());\n }", "DVector3C getPosition();", "int getTileGridXOffset(Long id) throws RemoteException;", "public int x (int index) { return coords[index][0]; }", "public Point getCoordinates(int val) {\r\n\t\tfor(int i = 0; i < rows_size; i++) {\r\n\t\t\tfor(int j = 0; j < columns_size; j++) {\r\n\t\t\t\tif(game[i][j].getValue() == val)\r\n\t\t\t\t\treturn new Point(i,j);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn new Point(-1,-1);\r\n\t}", "private int ufindex(int row, int col) {\n return grid.length * (row - 1) + col - 1;\n }", "public GridLocation getLocation();", "public int getX() { return loc.x; }", "public static int getCell() {\n int cell;\n\n cell = input.nextInt();\n // While enter other numbers out of the range of [1,3], the players will be asked to enter 1, 2, or 3\n while (cell < MARG_FIRST || cell > MARG_LAST) { // Set boundaries\n System.out.print(\"Please enter 1, 2, or 3: \");\n cell = input.nextInt();\n }\n return cell;\n }", "private int getPosition(int row, int col) {\n\t\treturn (side * (row - 1)) + (col - 1);\n\t}", "default int gridToSlot(int x, int y) {\n return y * 9 + x;\n }", "@Override\n public int[] getGoalPosition() {\n\n if(maze != null){\n int[] position = new int[2];\n position[0] = maze.getGoalPosition().getRowIndex();\n position[1] = maze.getGoalPosition().getColumnIndex();\n return position;\n }\n return null;\n }", "private Point getCentreCoordinate(Point t)\n {\n \treturn new Point (t.x + Constants.cell_length /2f, t.y, t.z+Constants.cell_length/2f );\n }", "public GridCoord getCoord() {\n\t\treturn this.coord;\n\t}", "private int getNorthEastCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif ((cellNumber >= getGridWidth()) && (cellNumber % getGridWidth() != (getGridWidth()-1))) {\n\t\t\treturn (cellNumber - getGridWidth() + 1);\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\tif (cellNumber >= getGridWidth()) { //move east, then north\n\t\t\t\t\treturn (cellNumber - 2*getGridWidth() + 1);\n\t\t\t\t}\n\t\t\t\tif (cellNumber % getGridWidth() != (getGridWidth()-1)) { //move north, then east\n\t\t\t\t\treturn (getGridSize() - getGridWidth() + cellNumber + 1);\n\t\t\t\t}\n\t\t\t\treturn (getGridSize() - getGridWidth()); //upper right corner\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int getLocX() {\n return locX;\n }", "private int getIndex(int row, int column) {\n \n int pos;\n \n pos = (row*getVariables().size()*4)+(column*4);\n return pos;\n}", "public double getUserFriendlyXPos(){\n return xPos - myGrid.getWidth()/ HALF;\n }", "Point3D getLeftUpperBackCorner();", "int cubeCol() {\n return c; \n }", "public static Dimension getPos()\n {\n Dimension pos = new Dimension( cX, cY );\n next();\n return pos;\n }", "public Cell getCellAt (int x, int y) {\n return grid[x-1][y-1];\n }", "double getXPosition();", "private int getNorthCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif (cellNumber >= getGridWidth()) {\n\t\t\treturn (cellNumber - getGridWidth());\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\treturn (getGridSize() - getGridWidth() + cellNumber);\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "private int getEastCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif (cellNumber % getGridWidth() != (getGridWidth()-1)) {\n\t\t\treturn (cellNumber + 1);\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\treturn (cellNumber - getGridWidth() + 1);\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "@Override\n public Cell getCellAtPosition(CellPosition position) {\n return cellGrid[position.getCircle()][position.getBlock()][position.getClockwise()];\n }", "public double[] getCoordinates(){\n\t\tdouble[] coord = new double[2];\n\t\tdouble xcoord = (double)position[0]/9;\n\t\tdouble zcoord = (double)position[1]/9;\n\t\tcoord[0] = xcoord;\n\t\tcoord[1] = zcoord;\t\t\n\t\treturn coord;\n\t}", "private int matrixRowToGridVal(int i) \n {\n return i % gDim + 1;\n }", "protected int getLocationRowCount()\n {\n\t return 3;\n }", "DVector3C getOffsetPosition();", "private int get_x() {\n return center_x;\n }", "public Point3 getPoint(int pointNr);", "public int getLocX() {\n return locX;\n }", "private int rowPos(int pos) {\r\n return pos / squareDimension;\r\n }", "public void getNeighbors(){\n // North \n if(this.row - this.value>=0){\n this.north = adjacentcyList[((this.row - this.value)*col_size)+col];\n }\n // South\n if(this.row + value<row_size){\n this.south = adjacentcyList[((this.row+this.value)*row_size)+col];\n }\n // East\n if(this.col + this.value<col_size){\n this.east = adjacentcyList[((this.col+this.value)+(this.row)*(col_size))];\n }\n // West\n if(this.col - this.value>=0){\n this.west = adjacentcyList[((this.row*col_size)+(this.col - this.value))];\n }\n }", "public int getX(){\n return this.position[0];\n }", "public int getX() { return position.x; }", "public Spatial boardCentre() {\r\n return tiles[2][2].tile;\r\n }", "public int getGridY() {\r\n\t\treturn gridY;\r\n\t}", "private int getNIdx() {\n return this.colStartOffset + 7;\n }", "public int getGridRows() \n { \n return gridRows; \n }", "public Move getGridElement (int row, int column)\n {\n return mGrid[row][column];\n }", "public ChunkCoordinates getPlayerCoordinates()\n {\n return new ChunkCoordinates(0, 0, 0);\n }", "public Location getLocation(int row, int column) {\n\t\treturn this.grid[row][column];\n\t}", "public Point3D getC() {\r\n return c;\r\n }", "public int getPosition(){\n\t\treturn this.cell;\n\t}", "Coordinate[] getTilePosition(int x, int y) {\n\t\treturn guiTiles.get(y).get(x).getBoundary();\n\t}", "@Override\n\tpublic double getZLoc() {\n\t\tdouble side = Math.sqrt(getMySize())/2;\n\t\treturn z-side;\n\t}", "public Point3D getLocation() {\n\t\treturn p;\n\t}", "private int getNorthWestCell(Cell cell) {\n\t\tint cellNumber = cell.getNumber();\n\t\tif ((cellNumber >= getGridWidth()) && (cellNumber % getGridWidth() != 0)) {\n\t\t\treturn (cellNumber - getGridWidth() - 1);\n\t\t} else {\n\t\t\tif (isToroidal()) {\n\t\t\t\tif (cellNumber >= getGridWidth()) { //move west, then north\n\t\t\t\t\treturn (cellNumber - 1);\n\t\t\t\t}\n\t\t\t\tif (cellNumber % getGridWidth() != 0) { //move north, then west\n\t\t\t\t\treturn (getGridSize() - getGridWidth() + cellNumber - 1);\n\t\t\t\t}\n\t\t\t\treturn (getGridSize() - 1); //upper left corner\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}", "public int getGridColumns() \n { \n return gridColumns; \n }", "public GameObject[][] getGrid(){\n\t\t\r\n\t\treturn this.grid;\r\n\t}", "public float[] GetStartPosition(int playerId)\r\n/* 515: */ {\r\n/* 516:621 */ for (int x = 0; x < getWidthInTiles(); x++) {\r\n/* 517:623 */ for (int y = 0; y < getHeightInTiles(); y++) {\r\n/* 518:625 */ if (tilePlayerPlacable(x, y, playerId)) {\r\n/* 519:627 */ return new float[] { x, y };\r\n/* 520: */ }\r\n/* 521: */ }\r\n/* 522: */ }\r\n/* 523:631 */ return new float[] { 0.0F, 0.0F };\r\n/* 524: */ }", "private int findG(int currentIndex){\r\n int mapCol = _map.get_mapCol();\r\n int currentRow = currentIndex / mapCol;\r\n int currentCol = currentIndex % mapCol;\r\n\r\n int startRow = _startIndex / mapCol;\r\n int startCol = _startIndex % mapCol;\r\n\r\n return Math.abs(currentRow - startRow) + Math.abs(currentCol - startCol);\r\n }", "public LatLng getCentrePos() {\n double lat = 0;\n double lon = 0;\n for (int i=0; i<newHazards.size(); i++) {\n lat += frags.get(i).getHazard().getLatitude();\n lon += frags.get(i).getHazard().getLongitude();\n }\n return new LatLng(lat / newHazards.size(), lon / newHazards.size());\n }", "public double getPosition(double value) {\n return getRelPosition(value) * (size - nanW - negW - posW) + (min < max ? negW : posW);\n }", "public IPoint getThirdPoint()\n {\n\n Set<IPoint> vertices = this.getVertices();\n Object[] verticesArray = vertices.toArray();\n IPoint thirdPoint = (IPoint)verticesArray[2];\n\n return thirdPoint;\n }", "public boolean onGrid(int xValue, int yValue);", "public ChunkCoordinates getEntrancePortalLocation() {\n\t\treturn new ChunkCoordinates(100, 50, 0);\n\t}", "public int getCartogramGridSizeInX ()\n\t{\n\t\treturn mCartogramGridSizeX;\n\t}", "private Point getEntityPosition(int position, int team) {\n\t\tint xOffset = position * (200);\n\t\tint xPos;\n\t\tif (team == 0) {\n\t\t\txPos = 800 - 100 - xOffset;\n\t\t} else {\n\t\t\txPos = 800 + 100 + xOffset;\n\t\t}\n\n\t\treturn new Point(xPos, 100);\n\t}", "public int calculateGridCellColumn(int x)\n {\n float leftEdge = miniGame.getBoundaryLeft();\n x = (int)(x - leftEdge);\n return x / TILE_IMAGE_WIDTH;\n }", "public Position findWeed() {\n int xVec =0;\n int yVec=0;\n int sum = 0;\n Position move = new Position(0, 0);\n for (int i = 0; i < this.WORLD.getMapSize().getX(); i++) {\n for (int j = 0; j < this.WORLD.getMapSize().getY(); j++) {\n\n //hogweed\n Organism organism = this.WORLD.getOrganism(i, j);\n if(organism!=null){\n Class c = organism.getClass();\n if (c.getSimpleName().equals(\"Parnsip\")) {\n int tmpX = Math.abs(this.position.getX() - i);\n int tmpY = Math.abs(this.position.getY() - j);\n if (!(xVec == 0 && yVec == 0)) {\n int tmpSum = tmpX + tmpY;\n if (sum > tmpSum) {\n xVec=tmpX;\n yVec=tmpY;\n sum = tmpSum;\n this.setMove(move, j, i);\n }\n }\n else {\n xVec=tmpX;\n yVec=tmpY;\n sum = tmpX + tmpY;\n this.setMove(move, j, i);\n }\n }\n }\n\n }\n }\n return move;\n }" ]
[ "0.7256107", "0.67429715", "0.66572416", "0.6277414", "0.6254814", "0.6218396", "0.6166457", "0.6094216", "0.60800546", "0.6070423", "0.5989396", "0.5962549", "0.5935494", "0.58815414", "0.5879656", "0.5864073", "0.5861125", "0.5820732", "0.581964", "0.5819083", "0.58138156", "0.58078474", "0.5804167", "0.5797234", "0.5796375", "0.57566273", "0.5709418", "0.5707252", "0.57050157", "0.57020533", "0.5702042", "0.5701008", "0.56919664", "0.5685722", "0.5678432", "0.56735045", "0.56621456", "0.5645239", "0.5643109", "0.56425184", "0.5641901", "0.5627957", "0.56231916", "0.56229615", "0.5619242", "0.56187433", "0.5603434", "0.56032985", "0.55876386", "0.5587566", "0.55772203", "0.5576383", "0.5573434", "0.55651855", "0.55625516", "0.55616164", "0.55432045", "0.55411834", "0.55392057", "0.553528", "0.5533796", "0.55258954", "0.55236936", "0.5519836", "0.5517931", "0.55083793", "0.55079156", "0.5507288", "0.5503883", "0.54953957", "0.5494438", "0.5491514", "0.54898226", "0.5489151", "0.54824686", "0.54725736", "0.54631466", "0.54562235", "0.54539657", "0.5451416", "0.54501826", "0.5449374", "0.54476136", "0.5439787", "0.5434795", "0.5434443", "0.543291", "0.5427895", "0.54257596", "0.54239476", "0.54220057", "0.54218453", "0.5421159", "0.54202276", "0.5416788", "0.5416417", "0.5411734", "0.5411469", "0.54028547", "0.5402288" ]
0.6769677
1
returns a list of possible grid positions given a grid position in the maze
public List<Grid> getPossibleMoves(Grid g){ int i=g.row, j=g.col; if(i>=0 && i<data.length && j>=0 && j<data[i].length){ List<Grid> list=new ArrayList<>(); if(isFree(i, j-1)) list.add(new Grid(i,j-1)); if(isFree(i-1, j-1)) list.add(new Grid(i-1,j-1)); if(isFree(i-1, j)) list.add(new Grid(i-1,j)); if(isFree(i-1, j+1)) list.add(new Grid(i-1,j+1)); if(isFree(i, j+1)) list.add(new Grid(i,j+1)); if(isFree(i+1, j+1)) list.add(new Grid(i+1,j+1)); if(isFree(i+1, j)) list.add(new Grid(i+1,j)); if(isFree(i+1, j-1)) list.add(new Grid(i+1,j-1)); return list; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected abstract int[][] getPossiblePositions();", "List<GridCoordinate> getCoordinates(int cellWidth, int cellHeight);", "public int[] getPositionInGrid( int tile )\n\t{\n\t\tint[] position = new int[2];\n\t\t\n\t\tfor ( int y = 0; y < height; y++ )\n\t\t{\n\t\t\tfor ( int x = 0; x < width; x++ )\n\t\t\t{\n\t\t\t\tif ( grid[x][y] == tile ) \n\t\t\t\t{\n\t\t\t\t\tposition[0] = x;\n\t\t\t\t\tposition[1] = y;\n\t\t\t\t\t\n\t\t\t\t\t// Should break but meh\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn position;\n\t}", "List<Point> getPath(int grid[][], Point src, Point dest);", "public List<Grid> getGrids() {\n\tList<Grid> grids = new ArrayList<Grid>();\n\tList<Line> currentLines = _path;\n\twhile(currentLines.size()>1) {\n\t Grid grid = new Grid();\n\t grids.add(grid);\n\t List<Line> nonOverlappingLines = grid.overlapping(currentLines);\n\t \t \n\t Double[] xs = grid.xs();\n\t Double[] ys = grid.ys();\n\t \n\t if (xs.length>3 && ys.length>3) {\n\t\tDouble minx = xs[0];\n\t\tDouble maxx = xs[xs.length-1];\n\t\t\n\t\tDouble miny = ys[0];\n\t\tDouble maxy = ys[ys.length-1];\n\t\t\n\t\tfor(int i=0; i<xs.length; i++) {\n\t\t System.out.println(\"Line: \" + xs[i].toString() + \",\" + miny.toString() + \",\" + xs[i].toString() + \",\" + maxy.toString());\n\t\t}\n\t\tfor(int i=0; i<ys.length; i++) {\n\t\t System.out.println(\"Line: \" + minx.toString() + \",\" + ys[i].toString() + \",\" + maxx.toString() + \",\" + ys[i].toString());\n\t\t}\n\t }\n\n\t currentLines = nonOverlappingLines;\n\t}\n\treturn grids;\n }", "public void getPossibleMoves() { \n\t\t\tsuper.getPossibleMoves();\n\t\t\tfor (int i = 0; i < Math.abs(xrange); i++) {\n\t\t\t\tif (currentx + xrange - ((int) Math.pow(-1,color)*i) >= 0) { \n\t\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + xrange - ((int) Math.pow(-1,color)*i) ][currenty]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( currentx - 1 >= 0 && currenty - 1 >= 0 &&\n\t\t\t\t\tGameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty - 1].isOccupiedByOpponent()) {\t// Diagonol left space occupied\n\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty - 1]);\n\t\t\t}\n\t\t\tif (currentx - 1 >= 0 && currenty + 1 <= 7 &&\n\t\t\t\t\tGameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty + 1].isOccupiedByOpponent()) { \t//Diagonol right space occupied\n\t\t\t\tGameWindow.potentialMoves.add(GameWindow.GridCells[currentx + ((int) Math.pow(-1,color)) ][currenty + 1]);\n\t\t\t}\n\t\t\t\n\t}", "private void findGrid(int x, int y) {\n\tgx = (int) Math.floor(x / gs);\n\tgy = (int) Math.floor(y / gs);\n\n\tif (debug){\n\tSystem.out.print(\"Actual: (\" + x + \",\" + y + \")\");\n\tSystem.out.println(\" Grid square: (\" + gx + \",\" + gy + \")\");\n\t}\n }", "private ArrayList<GameSquare> getAdjacentSquares()\n {\n ArrayList<GameSquare> list = new ArrayList<GameSquare>();\n for (int r = row - 1; r <= row + 1; r++)\n {\n if (r >= 0 && r < grid.length)\n {\n for (int c = col - 1; c <= col + 1; c++)\n {\n if (c >= 0 && c < grid[0].length)\n {\n list.add(grid[r][c]);\n }\n }\n }\n }\n return list;\n }", "public static List<Vec2i> solve(int[][] grid, Vec2i start, Vec2i goal, Heuristic h){\n if(h == null){ //if null replace with default heuristic\n h = new Heuristic() {\n @Override\n\n public double eval(Vec2i loc) {\n double dx = (loc.x - goal.x);\n double dy = (loc.y - goal.y);\n return Math.sqrt(dx*dx + dy*dy);\n }\n };\n }\n\n PriorityQueue<GridLocation> edge = new PriorityQueue<GridLocation>(10, AStarGrid::compareGridLocations);\n edge.add(new GridLocation(start,0));\n\n Map<Vec2i, Vec2i> cameFrom = new HashMap<Vec2i, Vec2i>();\n Map<Vec2i, Double> g = new HashMap<Vec2i, Double>(); //distance to node\n g.put(start,0.0);\n Map<Vec2i, Double> f = new HashMap<Vec2i, Double>(); //distance from start to goal through this node\n f.put(start,h.eval(start));\n //f = g + h\n\n while(!edge.isEmpty()){\n\n Vec2i current = edge.poll().loc;\n if(current.x == goal.x && current.y == goal.y){\n return reconstructPath(cameFrom, current);\n }\n\n LinkedList<Vec2i> neighbors = new LinkedList<Vec2i>();\n if(current.x != 0 && grid[current.x - 1][current.y] == 0)\n neighbors.add(new Vec2i(current.x - 1,current.y));\n if(current.x != grid.length-1 && grid[current.x + 1][current.y] == 0)\n neighbors.add(new Vec2i(current.x + 1,current.y));\n if(current.y != 0 && grid[current.x][current.y - 1] == 0)\n neighbors.add(new Vec2i(current.x,current.y - 1));\n if(current.y != grid[0].length-1 && grid[current.x][current.y + 1] == 0)\n neighbors.add(new Vec2i(current.x,current.y + 1));\n\n\n for(Vec2i neighbor: neighbors){\n double score = g.get(current) + 1;\n if(!g.containsKey(neighbor) || score < g.get(neighbor)){\n cameFrom.put(neighbor,current);\n g.put(neighbor, score);\n f.put(neighbor, score + h.eval(neighbor));\n if(!edge.contains(neighbor)){\n edge.add(new GridLocation(neighbor,score + h.eval(neighbor)));\n }\n }\n }\n }\n //No path was found\n return null;\n }", "private ArrayList<Position3D> findNeighbors(Position3D current, Maze3D myMaze,boolean [][][]VisitedCells) throws Exception {\n ArrayList<Position3D> neighbors = new ArrayList<>();\n //for each neighbor, add him into the neighbors array, if it's on the grid (maze), if it's not a corner, not the current position itself, and it's unvisited\n //iterate over all neighbors in the same depth\n for (int x = current.getRowIndex()-2; x < current.getRowIndex()+3; x=x+2) {\n for (int y = current.getColumnIndex()-2; y < current.getColumnIndex()+3 ; y=y+2) {\n if (pointOnGrid(current.getDepthIndex(),x, y, myMaze) && pointNotCorner(current ,current.getDepthIndex(), x, y)\n && pointNotMyCell(current,current.getDepthIndex(), x, y) && !(Visited(current.getDepthIndex(),x,y,VisitedCells))) {\n neighbors.add(new Position3D(current.getDepthIndex(),x, y));\n }\n }\n }\n //check the options from the other depths\n\n if (pointOnGrid(current.getDepthIndex()+2,current.getRowIndex(), current.getColumnIndex(), myMaze) && !(Visited(current.getDepthIndex()+2,current.getRowIndex(),current.getColumnIndex(),VisitedCells))){\n neighbors.add(new Position3D(current.getDepthIndex()+2,current.getRowIndex(), current.getColumnIndex()));\n }\n if (pointOnGrid(current.getDepthIndex()-2,current.getRowIndex(), current.getColumnIndex(), myMaze) && !(Visited(current.getDepthIndex()-2,current.getRowIndex(),current.getColumnIndex(),VisitedCells))){\n neighbors.add(new Position3D(current.getDepthIndex()-2,current.getRowIndex(), current.getColumnIndex()));\n }\n return neighbors;\n }", "private static Iterable<Cell> getNeighbors(Grid<Cell> grid, Cell cell) {\n\t\tMooreQuery<Cell> query = new MooreQuery<Cell>(grid, cell);\n\t\tIterable<Cell> neighbors = query.query();\n\t\treturn neighbors;\n\t}", "public List<List<String>> findPaths(char[] grid){\n this.grid = grid;\n List<Integer> noDeadBoxes = new ArrayList<>();\n this.boxes = initBoxes(noDeadBoxes);\n paths.clear();\n for(int i=0;i<16;i++) {\n List<Pair> currentPath = new ArrayList<>();\n Box box = boxes.get(i);\n List<Integer> indexDead = new ArrayList<>();\n indexDead.add(i+1);\n List<Box> newboxes = initBoxes(indexDead);\n customDFS(box, newboxes, paths, currentPath);\n }\n return displaySorted(deleteDuplicates(paths));\n }", "public static ArrayList<int[]> getEmptyCellCoords(int[][] grid) {\n\n ArrayList<int[]> emptyCells = new ArrayList<int[]>();\n for (int i = 0; i < grid.length; i++) {\n for (int j = 0; j < grid[0].length; j++) {\n if (grid[i][j] == 0) {\n int[] arr = {i, j};\n emptyCells.add(0, arr);\n }\n }\n }\n\n return emptyCells;\n }", "public void getNeighbors(){\n // North \n if(this.row - this.value>=0){\n this.north = adjacentcyList[((this.row - this.value)*col_size)+col];\n }\n // South\n if(this.row + value<row_size){\n this.south = adjacentcyList[((this.row+this.value)*row_size)+col];\n }\n // East\n if(this.col + this.value<col_size){\n this.east = adjacentcyList[((this.col+this.value)+(this.row)*(col_size))];\n }\n // West\n if(this.col - this.value>=0){\n this.west = adjacentcyList[((this.row*col_size)+(this.col - this.value))];\n }\n }", "private List<List<Integer>> getPositions(List<List<Integer>> wall) {\r\n\t\tList<List<Integer>> positions = new ArrayList<>();\r\n\t\tfor (List<Integer> row : wall) {\r\n\t\t\tList<Integer> positionRow = new ArrayList<>();\r\n\t\t\tint position = 0;\r\n\t\t\tfor (int x : row) {\r\n\t\t\t\tposition += x;\r\n\t\t\t\tpositionRow.add(position);\r\n\t\t\t}\r\n\t\t\tpositions.add(positionRow);\r\n\t\t}\r\n\t\treturn positions;\r\n\t}", "public Point getGridCoordinates(){\n try {\n return (new Point(x / MapManager.getMapTileWidth(), y / MapManager.getMapTileHeight()));\n } catch (Exception e){\n System.out.print(\"Error while getting grid coordinates.\");\n throw e;\n }\n }", "public static void main(String[] args) {\n int[][] map = new int[N][N];\r\n // 1D to 2D index map\r\n CustomPair[] indToVal = new CustomPair[(N * N) + 1];\r\n // 2D to value map\r\n Map<CustomPair, Integer> gridToValue = new HashMap<>();\r\n // Direction to start\r\n Direction dir = Direction.RIGHT;\r\n int j = 1;\r\n int y = N / 2;\r\n // shift left for even n's\r\n int x = (N % 2 == 0) ? y - 1 : y;\r\n /**\r\n * We use y, x here because the grid is sort of turned around.\r\n * */\r\n while(j <= ((N * N))) {\r\n CustomPair currentIndex = new CustomPair(y, x);\r\n // if the number is not prime it is traversable\r\n if (!isPrime(j)) {\r\n map[y][x] = 1;\r\n gridToValue.put(currentIndex, j);\r\n } else {\r\n map[y][x] = -1;\r\n }\r\n // add the value to 1d to 2d index values\r\n indToVal[j] = currentIndex;\r\n switch(dir){\r\n case RIGHT:\r\n if(x <= (N - 1) && map[y - 1][x] == 0 && j > 1)\r\n dir = Direction.UP;\r\n break;\r\n case UP:\r\n if(map[y][x - 1] == 0)\r\n dir = Direction.LEFT;\r\n break;\r\n case LEFT:\r\n if(x == 0 || map[y + 1][x] == 0)\r\n dir = Direction.DOWN;\r\n break;\r\n case DOWN:\r\n if(map[y][x + 1] == 0)\r\n dir = Direction.RIGHT;\r\n break;\r\n }\r\n // update the grid index\r\n switch(dir){\r\n case RIGHT:\r\n x++;\r\n break;\r\n case UP:\r\n y--;\r\n break;\r\n case LEFT:\r\n x--;\r\n break;\r\n case DOWN:\r\n y++;\r\n break;\r\n }\r\n // update 1D index\r\n j++;\r\n }\r\n\r\n Scanner sc = new Scanner(System.in);\r\n int caseNum = 1;\r\n while (sc.hasNextInt()) {\r\n int start = sc.nextInt();\r\n int goal = sc.nextInt();\r\n // find the shortest path\r\n Queue<CustomPair> q = new LinkedList<>();\r\n // 2D grid to distance values\r\n Map<CustomPair, Integer> distMap = new HashMap<>();\r\n // start is 0\r\n distMap.put(indToVal[start], 0);\r\n q.add(indToVal[start]);\r\n while (!q.isEmpty()) {\r\n CustomPair cur = q.remove();\r\n // for each neighbour (4 potential moves)\r\n for (int i = 0; i < 4; i++) {\r\n int nx = cur.a + X_NEIG_INDEX[i];\r\n int ny = cur.b + Y_NEIG_INDEX[i];\r\n CustomPair neighP = new CustomPair(nx, ny);\r\n // if the value is not in the grid\r\n if (!gridToValue.containsKey(neighP))\r\n continue;\r\n // if the value is already visited\r\n if (distMap.containsKey(neighP))\r\n continue;\r\n distMap.put(neighP, distMap.get(cur) + 1);\r\n q.add(neighP);\r\n }\r\n }\r\n // print for Kattis reasons\r\n String msg = \"Case \" + caseNum + \": \";\r\n if (!distMap.containsKey(indToVal[goal]) ||\r\n distMap.getOrDefault(indToVal[goal], -1) == -1 && start != goal)\r\n System.out.println(msg + \" impossible\");\r\n else\r\n System.out.println(msg + \"\" + distMap.get(indToVal[goal]));\r\n caseNum++;\r\n }\r\n }", "private ArrayList<GridPiece> getDirectNeighbors(GridPiece piece) {\n neighbors.clear();\n\n //Top\n if (game.gridMap.size() > piece.row + 1) {\n neighbors.add(game.gridMap.get(piece.row + 1).get(piece.column));\n }\n //Bottom\n if (piece.row > 0) {\n neighbors.add(game.gridMap.get(piece.row - 1).get(piece.column));\n }\n\n //Right\n if (game.gridMap.get(0).size() > piece.column + 1) {\n neighbors.add(game.gridMap.get(piece.row).get(piece.column + 1));\n }\n\n //Left\n if (piece.column > 0) {\n neighbors.add(game.gridMap.get(piece.row).get(piece.column - 1));\n }\n\n return neighbors;\n }", "public List<Square> getSquareGrid();", "private List<Cell> getSurroundingCells(int x, int y) {\n ArrayList<Cell> cells = new ArrayList<>();\n for (int i = x - 1; i <= x + 1; i++) {\n for (int j = y - 1; j <= y + 1; j++) {\n // Don't include the current position i != x && j != y &&\n if ( isValidCoordinate(i, j)) {\n if (i == x && j == y) {\n continue;\n } else {\n cells.add(gameState.map[j][i]);\n }\n }\n }\n }\n return cells;\n }", "public static ImmutableMap<Character, Integer> coordinateAreas(char[][] grid) {\r\n int height = grid.length;\r\n int width = grid[0].length;\r\n\r\n Map<Character, Integer> areas = new HashMap<>();\r\n\r\n for (int y = 0; y < height; y ++) {\r\n for (int x = 0; x < width; x ++) {\r\n char name = grid[y][x];\r\n if (name == '.') {\r\n continue;\r\n }\r\n\r\n if (y == 0 || x == 0 || y == height - 1 || x == width - 1) {\r\n // Coordinates on the edge are infinite.\r\n areas.put(name, INFINITE_AREA);\r\n } else {\r\n areas.compute(name, (sameName, oldValue) -> {\r\n if (oldValue == null) {\r\n return 1;\r\n } else if (oldValue == INFINITE_AREA) {\r\n return INFINITE_AREA;\r\n } else {\r\n return oldValue + 1;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n return ImmutableMap.copyOf(areas);\r\n }", "public ArrayList<Location> getMoveLocations()\n {\n ArrayList<Location> locs = new ArrayList<Location>();\n ArrayList<Location> validLocations = getGrid().getValidAdjacentLocations(getLocation());\n for (Location neighborLoc : validLocations)\n {\n if (getGrid().get(neighborLoc) == null || getGrid().get(neighborLoc) instanceof AbstractPokemon || getGrid().get(neighborLoc) instanceof PokemonTrainer)\n locs.add(neighborLoc);\n }\n return locs;\n }", "private void updateGridWithPosition(Pair<Integer, Integer> position) {\n int x = position.getValue0();\n int y = position.getValue1();\n int ox = origin.getValue0();\n int oy = origin.getValue1();\n while (ox + Math.abs(x) >= grid[0].length || oy + Math.abs(y) >= grid.length) {\n reallocateGrid();\n }\n if (x >= 0 && y >= 0) {\n grid[oy + y][ox + x] = '#';\n } else if (x >= 0) {\n grid[oy - Math.abs(y)][ox + x] = '#';\n } else if (y >= 0) {\n grid[oy + y][ox - Math.abs(x)] = '#';\n } else {\n grid[oy - Math.abs(y)][ox - Math.abs(x)] = '#';\n }\n }", "public Square[] adjacentCells() {\n\t\tArrayList<Square> cells = new ArrayList <Square>();\n\t\tSquare aux;\n\t\tfor (int i = -1;i <= 1; i++) {\n\t\t\tfor (int j = -1; j <= 1 ; j++) {\n\t\t\t\taux = new Square(tractor.getRow()+i, tractor.getColumn()+j); \n\t\t\t\tif (isInside(aux) && abs(i+j) == 1) { \n\t\t\t\t\tcells.add(getSquare(aux));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cells.toArray(new Square[cells.size()]);\n\t}", "private List<Cell> getNeighbours(int row,int col){\n List<Cell> neighbours = new ArrayList<Cell>();\n for(int i = row -1 ; i <= row+1 ; i++ )\n for(int j = col -1 ; j <= col+1 ; j++)\n if(i>=0 && i<cells.length && j>=0 && j<cells[0].length)\n neighbours.add(cells[i][j]);\n return neighbours;\n }", "List<Coord> allActiveCells();", "@Override\n public Map<Direction, List<Coordinate>> getPossibleMoves() {\n\n Map<Direction, List<Coordinate>> moves = new HashMap<>();\n\n Coordinate coordinate = this.getCoordinate();\n int row = coordinate.getRow();\n int col = coordinate.getCol();\n\n //Jumps\n List<Coordinate> jumps = new ArrayList<>();\n\n //\n //\n ////\n int tempRow1 = row - 2;\n int tempCol1 = col - 1;\n Coordinate tempCoordinate1 = new Coordinate(tempRow1, tempCol1);\n if (Board.inBounds(tempCoordinate1)) {\n jumps.add(tempCoordinate1);\n }\n\n ////\n //\n //\n int tempRow2 = row + 2;\n int tempCol2 = col - 1;\n Coordinate tempCoordinate2 = new Coordinate(tempRow2, tempCol2);\n if (Board.inBounds(tempCoordinate2)) {\n jumps.add(tempCoordinate2);\n }\n\n //////\n //\n int tempRow3 = row - 1;\n int tempCol3 = col - 2;\n Coordinate tempCoordinate3 = new Coordinate(tempRow3, tempCol3);\n if (Board.inBounds(tempCoordinate3)) {\n jumps.add(tempCoordinate3);\n }\n\n ///////\n //\n int tempRow4 = row - 1;\n int tempCol4 = col + 2;\n Coordinate tempCoordinate4 = new Coordinate(tempRow4, tempCol4);\n if (Board.inBounds(tempCoordinate4)) {\n jumps.add(tempCoordinate4);\n }\n\n ////\n //\n //\n int tempRow5 = row + 2;\n int tempCol5 = col + 1;\n Coordinate tempCoordinate5 = new Coordinate(tempRow5, tempCol5);\n if (Board.inBounds(tempCoordinate5)) {\n jumps.add(tempCoordinate5);\n }\n\n //\n //\n ////\n int tempRow6 = row - 2;\n int tempCol6 = col + 1;\n Coordinate tempCoordinate6 = new Coordinate(tempRow6, tempCol6);\n if (Board.inBounds(tempCoordinate6)) {\n jumps.add(tempCoordinate6);\n }\n\n //\n //////\n int tempRow7 = row + 1;\n int tempCol7 = col - 2;\n Coordinate tempCoordinate7 = new Coordinate(tempRow7, tempCol7);\n if (Board.inBounds(tempCoordinate7)) {\n jumps.add(tempCoordinate7);\n }\n\n //\n //////\n int tempRow8 = row + 1;\n int tempCol8 = col + 2;\n Coordinate tempCoordinate8 = new Coordinate(tempRow8, tempCol8);\n if (Board.inBounds(tempCoordinate8)) {\n jumps.add(tempCoordinate8);\n }\n\n if (!jumps.isEmpty()) {\n moves.put(Direction.Jump, jumps);\n }\n return moves;\n }", "public int[] getCurrentPieceGridPosition() {\n\t\treturn currentPieceGridPosition; \n\t}", "private static int[][] distanceGrid(final int[][] board) {\n final int numRows = board.length;\n final int numCols = board[0].length;\n\n final int distance = 0;\n\n final int[][] distanceGrid = new int[numRows][numCols];\n for (final int[] row : distanceGrid) {\n Arrays.fill(row, INACCESSABLE_SPACE_DISTANCE);\n }\n // For each space on the board\n for (int r = 0; r < numRows; r++) {\n nextBoardSpace:\n for (int c = 0; c < numCols; c++) {\n ArrayList<int[]> explored = new ArrayList<>();\n Queue<int[]> toExplore = new LinkedList<>();\n Map<String,Integer> dists = new HashMap<>();\n\n // Add the space to the explore queue\n toExplore.add(new int[] {r, c, 0});\n \n // While there is more to explore\n while (!toExplore.isEmpty()) {\n int[] currExplor = toExplore.remove();\n explored.add(currExplor);\n int explRow = currExplor[0];\n int explCol = currExplor[1];\n int explDist = currExplor[2];\n\n String key = Arrays.toString(new int[] {explRow, explCol});\n dists.put(key, 1);\n \n // If the space contains a player's move, add the distance to the \n //distanceGrid, and continue on the next boardspace\n if (board[explRow][explCol] > 0) {\n distanceGrid[r][c] = explDist;\n continue nextBoardSpace;\n }\n \n // Otherwise, if the space is empty, add it's neighbours to the queue\n if (board[explRow][explCol] == 0) {\n ArrayList<int[]> neighbours = Utils.neighbours(explRow, explCol, numRows, numCols);\n for (int[] neighbour : neighbours) {\n int[] temp = new int[] {neighbour[0], neighbour[1], explDist+1};\n if (dists.containsKey(key)) continue;\n toExplore.add(temp);\n }\n }\n }\n\n // If a path to one of our spaces is not found, space is inaccessable\n if (board[r][c] != 0) {\n distanceGrid[r][c] = -1;\n }\n\n }\n }\n return distanceGrid;\n }", "public abstract HashSet<Location> getPossibleMovements(GameBoard board);", "public PossibleMove[] getPossibleMoves(Coordinate from);", "public static ArrayList<int[]> getDissatisfiedCellCoords(int[][] grid) {\n ArrayList<int[]> dissatisfiedCells = new ArrayList<int[]>();\n for (int i = 0; i < grid.length; i++) {\n for (int j = 0; j < grid[0].length; j++) {\n\n if (grid[i][j] != 0) {\n\n int totalCells = 0, totalSatisfactory = 0;\n\n for (int k = i - 1; k <= i + 1; k++) {\n for (int l = j - 1; l <= j + 1; l++) {\n if (k > -1 && l > -1 && k < grid.length && l < grid.length) {\n if (k != i || l != j) {\n totalCells++;\n if (grid[k][l] == grid[i][j]) {\n totalSatisfactory++;\n }\n }\n }\n }\n }\n\n double percentSatisfied = (double)totalSatisfactory / (double)totalCells;\n\n if (percentSatisfied < PERCENT_SATISFIED) {\n int[] arr = {i, j};\n dissatisfiedCells.add((int)(Math.random() * dissatisfiedCells.size()), arr);\n }\n }\n\n }\n \n }\n\n return dissatisfiedCells;\n }", "private ArrayList<Point> getNeighbors(Point p) {\n\t\tArrayList<Point> arr = new ArrayList<Point>();\n\t\tfor (int y = -1; y <= 1; y++) {\n\t\t\tfor (int x = -1; x <= 1; x++) {\n\t\t\t\tPoint npoint = new Point( p.x + x, p.y + y);\n\t\t\t\tint sind = spacesContains(npoint);\n\t\t\t\tif ( p.compareTo(npoint) != 0 && sind >= 0 ) { \n\t\t\t\t\tarr.add( spaces.get(sind) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn arr;\n\t}", "public List<Location> neighbors (Location pos);", "private List transformMPToGrid(List MappedPositions, MathTransform trans) {\n List gridmp = new ArrayList();\n\n for (Iterator i = MappedPositions.iterator(); i.hasNext();) {\n MappedPosition mp = (MappedPosition) i.next();\n\n try {\n DirectPosition2D gridSource = new DirectPosition2D();\n DirectPosition2D gridTarget = new DirectPosition2D();\n trans.transform(mp.getSource(), gridSource);\n trans.transform(mp.getTarget(), gridTarget);\n gridmp.add(new MappedPosition(gridSource, gridTarget));\n } catch (MismatchedDimensionException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n } catch (TransformException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n\n return gridmp;\n }", "public MazeRoom[][] generate() {\n\t\tgenerate(theGrid[0][0]);\n\t\treturn theGrid;\n\t}", "public static char[][] fillGrid(ImmutableList<Coordinate> coordinates) {\r\n Point extent = gridExtent(coordinates);\r\n int width = extent.x;\r\n int height = extent.y;\r\n\r\n // Flood fill the grid.\r\n // Untouched cells start at 0,\r\n // coordinate names indicate that another coordinate was closest,\r\n // '.' indicates that two coordinates have the same distance from a point.\r\n char[][] grid = new char[height][width];\r\n\r\n // pointsSet: # of values of the grid that are set.\r\n // distance: width of the circle around each coordinate in this pass.\r\n for (int pointsSet = 0, distance = 0; pointsSet < width * height; distance ++) {\r\n // Given the distance circle around each point, plan the coordinates that will be set\r\n List<Coordinate> passCoordinates = new ArrayList<>();\r\n for (Coordinate coordinate : coordinates) {\r\n for (Point point : distanceAway(coordinate, distance, width, height)) {\r\n if (grid[point.y][point.x] == 0) {\r\n passCoordinates.add(new Coordinate(coordinate.name, point.x, point.y));\r\n }\r\n }\r\n }\r\n\r\n // Resolve coordinate collisions\r\n Map<Point, List<Coordinate>> distinctPoints = passCoordinates.stream()\r\n .collect(Collectors.groupingBy(coordinate -> new Point(coordinate.x, coordinate.y)));\r\n\r\n // Write the coordinates to the grid\r\n for (Map.Entry<Point, List<Coordinate>> entry : distinctPoints.entrySet()) {\r\n Point point = entry.getKey();\r\n List<Coordinate> pointCoordinates = entry.getValue();\r\n\r\n if (pointCoordinates.size() == 1) {\r\n grid[point.y][point.x] = pointCoordinates.get(0).name;\r\n } else {\r\n grid[point.y][point.x] = '.';\r\n }\r\n\r\n pointsSet++;\r\n }\r\n\r\n }\r\n\r\n return grid;\r\n }", "public ArrayList<Coordinates> getHeroesPositions (){\n\t\tArrayList<Coordinates> path = new ArrayList<>();\n\t\tArrayList<Coordinates> coordinatePieces = chessboard.getTurnPieces();\n\t\tArrayList<Coordinates> threats = getThreats();\n\n\t\tfor ( Coordinates c : threats ){\n\t\t\tpath.add(c); //aggiungo la posizione dell'avversario\n\t\t\tif ( !(chessboard.at(c) instanceof Knight) )\n\t\t\t\tpath.addAll(chessboard.at(c).getPath(c, chessboard.getTurnKing())); //tutte le posizione in cui può andare\n\t\t}\n\t\t\n\t\tArrayList<Coordinates> result = new ArrayList<>();\n\t\t\tfor ( Coordinates c : coordinatePieces )\n\t\t\t\tfor ( Coordinates to : path)\n\t\t\t\t\tif ( !(chessboard.at(c) instanceof King) && checkMove(c, to) )\n\t\t\t\t\t\tresult.add(to);\n\t\treturn result;\n\t}", "public void populateGrid(int grid_size,int [][] mine_positions,int tot_mines){\n\t\tfor(int row=0;row<grid_size;row++){\n\t\t\tfor(int col=0;col<grid_size;col++){\n\t\t\t\n\t\t\t\tfor(int k=0;k<tot_mines;k++){\n\t\t\t\t\tif(row==mine_positions[k][0]&&col==mine_positions[k][1]){\n\t\t\t\t\t\tgrid[row][col].content='M';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tint mine_ctr=0;\n\t\t//Populating all cells\n\t\tfor(int row=0;row<grid_size;row++){\n\t\t\tfor(int col=0;col<grid_size;col++){\n\t\t\t\t\n\t\t\t\tmine_ctr=0;\n\t\t\t\t//Checking number of mines surrounding each cell\n\t\t\t\tif(grid[row][col].content=='M'){\n\t\t\t\t\tgrid[row][col].no_of_mines=0;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t\n\t\t\t\t\t//Top left\n\t\t\t\t\tif(grid[row][col].top_left==1&&grid[row-1][col-1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Top \n\t\t\t\t\tif(grid[row][col].top==1&&grid[row-1][col].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Top right\n\t\t\t\t\tif(grid[row][col].top_right==1&&grid[row-1][col+1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Left\n\t\t\t\t\tif(grid[row][col].left==1&&grid[row][col-1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Right\n\t\t\t\t\tif(grid[row][col].right==1&&grid[row][col+1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\n\t\t\t\t\t//Bottom left\n\t\t\t\t\tif(grid[row][col].bottom_left==1&&grid[row+1][col-1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\t\t\n\t\t\t\t\t//Bottom\n\t\t\t\t\tif(grid[row][col].bottom==1&&grid[row+1][col].content=='M')\n\t\t\t\t\t\tmine_ctr++;\t\n\t\t\t\t\t\n\t\t\t\t\t//Bottom right\n\t\t\t\t\tif(grid[row][col].bottom_right==1&&grid[row+1][col+1].content=='M')\n\t\t\t\t\t\tmine_ctr++;\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tgrid[row][col].no_of_mines=mine_ctr;\n\t\t\t}\n\t\t}\n\t}", "static int numberAmazonTreasureTrucks(int rows, int column,\n\t\t\t\t\t\t\t\t List<List<Integer> > grid)\n {\n // WRITE YOUR CODE HERE\n int count = 0;\n for(int i=0;i<rows;i++) {\n for(int j=0;j<column;j++) {\n if(grid.get(i).get(j) == 1) {\n count++;\n markNeighbours(grid, i, j, rows, column);\n }\n }\n }\n return count;\n }", "public List<Point> generatePointList(){\r\n\t\t//Can move up to 3 squares horizontally or vertically, but cannot move diagonally.\r\n List<Point> pointList = new ArrayList<>();\r\n int pointCount = 0;\r\n int px = (int)getCoordinate().getX();\r\n int py = (int)getCoordinate().getY();\r\n\r\n for (int i=px-3;i<=px+3;i++){\r\n for(int j=py-3;j<=py+3;j++){\r\n if((i>=0) && (i<9) && (j>=0) && (j<9) && ((i!=px)||(j!=py))){\r\n if ((i==px)||(j==py)){\r\n pointList.add(pointCount, new Point(i,j));\r\n pointCount+=1;\r\n } \r\n }\r\n }\r\n }\r\n return pointList;\r\n }", "public void findNeighbours(ArrayList<int[]> visited , Grid curMap) {\r\n\t\tArrayList<int[]> visitd = visited;\r\n\r\n\t\t//System.out.println(\"FROM FIND NEIGHBOURS cur pos:\" +Arrays.toString(nodePos));\r\n\t\t//for(int j=0; j<visitd.size();j++) {\r\n\t\t\t//System.out.println(\"FROM FIND NEIGHBOURS\" +Arrays.toString(visited.get(j)));\r\n\t\t\t//System.out.println(\"FROM FIND NEIGHBOURS getvstd\" +Arrays.toString(visited.get(j)));\r\n\t\t//}\r\n\t\t//System.out.println(\"FROM FIND NEIGHBOURS\" +visited);\r\n\t\tCell left=curMap.getCell(0, 0);\r\n\t\tCell right=curMap.getCell(0, 0);\r\n\t\tCell upper=curMap.getCell(0, 0);\r\n\t\tCell down=curMap.getCell(0, 0);\r\n\t\t//the getStart() method returns x,y coordinates representing the point in x,y axes\r\n\t\t//so if either of [0] or [1] coordinate is zero then we have one less neighbor\r\n\t\tif (nodePos[1]> 0) {\r\n\t\t\tupper=curMap.getCell(nodePos[0], nodePos[1]-1) ; \r\n\t\t}\r\n\t\tif (nodePos[1] < M-1) {\r\n\t\t\tdown=curMap.getCell(nodePos[0], nodePos[1]+1);\r\n\t\t}\r\n\t\tif (nodePos[0] > 0) {\r\n\t\t\tleft=curMap.getCell(nodePos[0] - 1, nodePos[1]);\r\n\t\t}\r\n\t\tif (nodePos[0] < N-1) {\r\n\t\t\tright=curMap.getCell(nodePos[0]+1, nodePos[1]);\r\n\t\t}\r\n\t\t//for(int i=0;i<visitd.size();i++) {\r\n\t\t\t//System.out.println(Arrays.toString(visitd.get(i)));\t\r\n\t\t//}\r\n\t\t\r\n\t\t//check if the neighbor is wall,if its not add to the list\r\n\t\tif(nodePos[1]>0 && !upper.isWall() && (!exists(visitd,new int[] {nodePos[0], nodePos[1] - 1}))) {\r\n\t\t\t//Node e=new Node(this , this.N , this.M , new int[] {nodePos[0], nodePos[1] - 1},curMap);\r\n\t\t\t//if(e.getVisited()!=true) {\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0], nodePos[1] - 1}, curMap)); // father of the new nodes is this node\r\n\t\t\t//}\r\n\t\t}\r\n\t\tif(nodePos[1]<M-1 &&!down.isWall() && (!exists(visitd,new int[] {nodePos[0], nodePos[1] + 1}))){\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0], nodePos[1] + 1}, curMap));\r\n\t\t}\r\n\t\tif(nodePos[0]>0 && !left.isWall() && (!exists(visitd,new int[] {nodePos[0] - 1, nodePos[1]}))) {\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0] - 1, nodePos[1]}, curMap));\r\n\t\t}\r\n\t\tif(nodePos[0]<N-1 && !right.isWall() && (!exists(visitd,new int[] {nodePos[0] + 1, nodePos[1]}))) {\r\n\t\t\tNodeChildren.add(new Node(this , this.N , this.M , new int[] {nodePos[0] + 1, nodePos[1]}, curMap));\r\n\t\t}\r\n\t\t//for(int i=0; i<NodeChildren.size();i++) {\r\n\t\t\t//System.out.println(\"Paidia sth find:\" + Arrays.toString(NodeChildren.get(i).getNodePos()));\r\n\t\t//}\r\n\t\t\t\t\t\t\r\n\t}", "public abstract List<Direction> searchForCheese(Maze maze);", "List<MineTile> getSurround(int position) {\n int dimension = getDimension();\n int row = position / dimension;\n int col = position % dimension;\n List<MineTile> surround = new ArrayList<>();\n\n if (row != 0 && col != 0) {\n surround.add(getTiles().get(position - dimension - 1));\n }\n if (row != 0 && col != dimension - 1) {\n surround.add(getTiles().get(position - dimension + 1));\n }\n if (row != 0) {\n surround.add(getTiles().get(position - dimension));\n }\n if (row != dimension - 1 && col != 0) {\n surround.add(getTiles().get(position + dimension - 1));\n }\n if (row != dimension - 1 && col != dimension - 1) {\n surround.add(getTiles().get(position + dimension + 1));\n }\n if (row != dimension - 1) {\n surround.add(getTiles().get(position + dimension));\n }\n if (col != 0) {\n surround.add(getTiles().get(position - 1));\n }\n if (col != dimension - 1) {\n surround.add(getTiles().get(position + 1));\n }\n return surround;\n }", "public static void robotInAGrid(){\n\t\tArrayList<Point> fails = new ArrayList<Point>(); //contains unreachable points\n\t\t//to start we'll put all \"off limits\" points in fails and then we'll add any points we determine to be unreachable as we go\n\t\tfor(int r = 0; r< grid.length; r++){\n\t\t\tfor(int c = 0; c <grid[0].length; c++){\n\t\t\t\tif(grid[r][c] == 1){\n\t\t\t\t\tfails.add(new Point(r, c));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tArrayList<Point> path = new ArrayList<Point>(); //contains the robot's path\n\t\t//call our recursive helper function\n\t\tif(getPath(grid.length-1, grid[0].length-1, path, fails)){\n\t\t\tfor(Point p: path){\n\t\t\t\tSystem.out.print(\"(\" + p.x + \", \" + p.y + \"), \");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"No path is possible\");\n\t\t}\n\t}", "public List<TicTacToeCoordinates> getAvailableSpots() {\n List<TicTacToeCoordinates> openSpots = new ArrayList<>();\n for (int x = 0; x < boardLength; x++) {\n for (int y = 0; y < boardWidth; y++) {\n if (board[x][y] == '\\u0000') {\n openSpots.add(new TicTacToeCoordinates(x, y));\n }\n }\n }\n return openSpots;\n }", "public static int randomPos(int grid) {\n Random rand = new Random();\n return rand.nextInt((grid));\n }", "public List<Point> getPossibleNeighbours() {\n List<Point> points = new ArrayList<>();\n int x = point.getX();\n int y = point.getY();\n Arrays.asList(x - 1, x, x + 1).forEach(i -> {\n Arrays.asList(y - 1, y, y + 1).forEach(j -> {\n points.add(new Point(i, j));\n });\n });\n // remove self\n points.remove(new Point(x, y));\n return points;\n }", "@Override\n\tpublic List<Cell> calcNeighbors(int row, int col) {\n\t\tList<Cell> neighborLocs = new ArrayList<>();\n\t\tint shift_constant = 1 - 2*((row+col) % 2);\n\t\tif(!includesDiagonals) {\n\t\t\tfor(int a = col - 1; a <= col + 1; a++) {\n\t\t\t\tif(a == col)\n\t\t\t\t\taddLocation(row + shift_constant,a,neighborLocs);\n\t\t\t\telse \n\t\t\t\t\taddLocation(row,a,neighborLocs);\n\t\t\t}\n\t\t\treturn neighborLocs;\n\t\t}\n\t\tfor(int b = col - 2; b <= col + 2; b++) {\n\t\t\tfor(int a = row; a != row + 2*shift_constant; a += shift_constant) {\n\t\t\t\tif(a == row && b == col)\n\t\t\t\t\tcontinue;\n\t\t\t\taddLocation(a,b,neighborLocs);\n\t\t\t}\n\t\t}\n\t\tfor(int b = col -1; b <= col + 1; b++) {\n\t\t\taddLocation(row - shift_constant,b,neighborLocs);\n\t\t}\n\t\treturn neighborLocs;\n\t}", "private LinkedList<int[]> neighborFinder(){\n LinkedList<int[]> neighborhood= new LinkedList<>();\n int[] curr_loc = blankFinder();\n int x = curr_loc[0];\n int y = curr_loc[1];\n if(x >0){\n neighborhood.add(new int[]{x-1, y});\n }\n if(x < n-1){\n neighborhood.add(new int[]{x+1, y});\n }\n if(y > 0){\n neighborhood.add(new int[]{x, y-1});\n }\n if(y < n-1) {\n neighborhood.add(new int[]{x, y+1});\n }\n\n\n return neighborhood;\n }", "public static void explore(char[][] grid, int i, int j, int x, int y) {\n grid[i][j] = 'x';\n for (int d = 0; d < dx.length; d++) {\n if (i + dy[d] < x && i + dy[d] >= 0 && j + dx[d] < y && j + dx[d] >= 0\n && grid[i + dy[d]][j + dx[d]] == '1') {\n explore(grid, i + dy[d], j + dx[d], x, y);\n }\n }\n }", "@Override\n public Iterable<WorldState> neighbors() {\n Queue<WorldState> neighbor = new ArrayDeque<>();\n int xDim = 0, yDim = 0;\n int[][] tiles = new int[_N][_N];\n\n for (int i = 0; i < _N; i++) {\n for (int j = 0; j < _N; j++) {\n tiles[i][j] = _tiles[i][j];\n if (_tiles[i][j] == 0) {\n xDim = i;\n yDim = j;\n }\n }\n }\n\n for (int i = 0; i < _N; i++) {\n for (int j = 0; j < _N; j++) {\n if (Math.abs(i - xDim) + Math.abs(j - yDim) == 1) {\n tiles[i][j] = _tiles[xDim][yDim];\n tiles[xDim][yDim] = _tiles[i][j];\n neighbor.add(new Board(tiles));\n // System.out.println(new Board(tiles));\n tiles[xDim][yDim] = _tiles[xDim][yDim];\n tiles[i][j] = _tiles[i][j];\n }\n }\n }\n return neighbor;\n }", "public MapCell[] getNeighbors(){\n\t\tMapCell[] neighbors = new MapCell[4];\n\t\tneighbors[0] = getNeighbor(\"east\");\n\t\tneighbors[1] = getNeighbor(\"north\");;\n\t\tneighbors[2] = getNeighbor(\"west\");\n\t\tneighbors[3] = getNeighbor(\"south\");\n\t\treturn neighbors;\n\t}", "public ArrayList<Coordinate> getPossibleMoveCoordinate() {\n ChessBoard board = this.getChessBoard(); // get chess board\n ArrayList<Coordinate> coords = new ArrayList<Coordinate>(); // create return ArrayList\n int x, y;\n /*\n several cases\n 2 3\n 1 4\n\n 5 8\n 6 7\n\n */\n // case1\n x = this.x_coordinate - 2;\n y = this.y_coordinate + 1;\n if(x >= 0 && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case2\n x = this.x_coordinate - 1;\n y = this.y_coordinate + 2;\n if(x >= 0 && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case3\n x = this.x_coordinate + 1;\n y = this.y_coordinate + 2;\n if(x < board.getWidth() && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case4\n x = this.x_coordinate + 2;\n y = this.y_coordinate + 1;\n if(x < board.getWidth() && y < board.getHeight()){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case5\n x = this.x_coordinate - 2;\n y = this.y_coordinate - 1;\n if(x >= 0 && y >= 0 ){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case6\n x = this.x_coordinate - 1;\n y = this.y_coordinate - 2;\n if(x >= 0 && y >= 0){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case7\n x = this.x_coordinate + 1;\n y = this.y_coordinate - 2;\n if(x < board.getWidth() && y >= 0){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n // case1\n x = this.x_coordinate + 2;\n y = this.y_coordinate - 1;\n if(x < board.getWidth() && y >= 0){\n addToCoordinatesIfValid(coords, x, y); // add to coords if the piece can move to that coordinate\n }\n\n\n return coords;\n }", "public int[] getMove(int[][] grid) {\n int tmp;\n int max = _MIN_EVAL;\n int maxi = -1;\n int maxj = -1;\n\n //Si la _profondeur est nulle ou la partie est finie,\n //on ne fait pas le calcul\n //On parcourt les cases du morpion\n for (int row = 0; row < 3; row++) {\n for (int column = 0; column < 3; column++) {\n //Si la case est vide\n if (RuleController.isMoveLegal(grid, row, column)) {\n grid = RuleController.playMoveAt(grid, player, row, column);\n tmp = calculateMin(grid, proof - 1);\n if (tmp > max) {\n //On le choisit\n max = tmp;\n maxi = row;\n maxj = column;\n }\n grid = RuleController.cancelMove(grid, row, column);\n }\n }\n }\n return new int[]{maxi, maxj};\n }", "public Iterable<Board> neighbors() {\n int[] pos = zeroPosition();\n int x = pos[0];\n int y = pos[1];\n\n Stack<Board> q = new Stack<>();\n if (x > 0) {\n q.push(twinBySwitching(x, y, x-1, y));\n }\n\n if (x < dimension() - 1) {\n q.push(twinBySwitching(x, y, x+1, y));\n }\n\n if (y > 0) {\n q.push(twinBySwitching(x, y, x, y-1));\n }\n\n if (y < dimension() - 1) {\n q.push(twinBySwitching(x, y, x, y+1));\n }\n\n return q;\n }", "Map<BoardCellCoordinates, Set<Integer>> getWinningCoordinates();", "List<Tile> getAdjacentTiles();", "private static boolean isPossibleGrid(int[][] board, int row, int col, int value) {\r\n\t\tint srow = row - row % 3;\r\n\t\tint scol = col - col % 3;\r\n\t\tfor (int i = srow; i < srow + 3; i++) {\r\n\t\t\tfor (int j = scol; j < scol + 3; j++) {\r\n\t\t\t\tif (board[i][j] == value)\r\n\t\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "public List<Position> getPositions(){\r\n List<Position> listPosition = new ArrayList();\r\n int row=currentPosition.getRow(),column=currentPosition.getColumn();\r\n listPosition=getPositionFor(row, column, listPosition);\r\n return listPosition;\r\n }", "@Override\n public ArrayList<AState> getAllPossibleStates(AState state){\n MazeState s = (MazeState)state;\n ArrayList<AState> moves = new ArrayList<AState> ();\n\n\n int row = s.getState().getRowIndex();\n int col = s.getState().getColumnIndex();\n int [][] matrix = mySearchableMaze.getMazeMatrix();\n\n\n if(row+1 < matrix.length){\n if( matrix[row+1][col]==0 ){\n moves.add(new MazeState(new Position(row+1,col),false,s.getCost()+1));\n\n }\n }\n if(row-1 >= 0 ){\n if( matrix[row-1][col]==0){\n moves.add(new MazeState(new Position(row-1,col),false,s.getCost()+1));\n\n }\n }\n if(col+1 < matrix[0].length ){\n if( matrix[row][col+1]==0 ){\n moves.add(new MazeState(new Position(row,col+1),false,s.getCost()+1));\n\n }\n }\n if(col-1 >= 0 ){\n if( matrix[row][col-1]==0 ){\n moves.add(new MazeState(new Position(row,col-1),false,s.getCost()+1));\n }\n }\n return moves;\n }", "@Override\r\n\tpublic List<Coordinate> getPossibleLocations(Coordinate currentLocation) {\r\n\r\n\t\tList<Coordinate> possibleCoordinates = new ArrayList<Coordinate>();\r\n\t\tint x = currentLocation.getX();\r\n\t\tint y = currentLocation.getY();\r\n\t\twhile (x > 0 && y > 0) {\r\n\t\t\tx--;\r\n\t\t\ty--;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\r\n\t\twhile (x < Board.SIZE - 1 && y < Board.SIZE - 1) {\r\n\t\t\tx++;\r\n\t\t\ty++;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\r\n\t\twhile (x > 0 && y < Board.SIZE - 1) {\r\n\t\t\tx--;\r\n\t\t\ty++;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\r\n\t\tx = currentLocation.getX();\r\n\t\ty = currentLocation.getY();\r\n\t\twhile (x < Board.SIZE - 1 && y > 0) {\r\n\t\t\tx++;\r\n\t\t\ty--;\r\n\t\t\tpossibleCoordinates.add(new Coordinate(x, y));\r\n\t\t}\r\n\t\treturn possibleCoordinates;\r\n\t}", "public static int numIslands(char[][] grid) {\n int row = grid.length;\n int col = grid[0].length;\n int ans = 0;\n boolean[][] visited = new boolean[row][col];\n for (int i = 0; i < row; i++) {\n for (int j = 0; j < col; j++) {\n if (!visited[i][j] && grid[i][j] == '1') {\n dfs(grid, visited, i, j);\n ans++;\n }\n visited[i][j] = true;\n }\n }\n return ans;\n }", "public static int getGridPosition(int x, int y, int width){\n\t\treturn (y*width)+x;\n\t}", "public ArrayList<Position> getAdjacents(Board board){\r\n\t\tArrayList<Position> adjacents = new ArrayList<Position>(0);\r\n\t\t/* First get tiles to left and right */\r\n\t\tif(this.x>0){\r\n\t\t\tadjacents.add(board.getNodes()[this.y][this.x-1]);\r\n\t\t}\r\n\t\t/* Length of a row is given by\r\n\t\t * Math.min(size+y, 2*size-1)\r\n\t\t */\r\n\t\tif(this.x<Math.min(board.getArraySize()+this.y, 2*board.getArraySize()-2)){\r\n\t\t\tadjacents.add(board.getNodes()[this.y][this.x+1]);\r\n\t\t}\r\n\t\t/* Next, find the adjacent positions in the rows above and below\r\n\t\t * For the tile at [y,x] these are located at\r\n\t\t * [y-1,x-1],[y-1,x],[y+1,x] and [y+1,x+1] \r\n\t\t */\r\n\t\tif(this.y>0){\r\n\t\t\t// Row above exists\r\n\t\t\tif(this.x < board.getArraySize()-1+this.y){\r\n\t\t\t\t// Check tile above and to the right exists\r\n\t\t\t\tadjacents.add(board.getNodes()[this.y-1][this.x]);\r\n\t\t\t}\r\n\t\t\tif(this.x > 0){\r\n\t\t\t\t// Check tile above and to the left exists\r\n\t\t\t\tadjacents.add(board.getNodes()[this.y-1][this.x-1]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(this.y<2*board.getArraySize()-2){\r\n\t\t\t// Row below exists\r\n\t\t\tif(this.x < 2*board.getArraySize()-2){\r\n\t\t\t\t// Check tile below and to the right exists\r\n\t\t\t\tadjacents.add(board.getNodes()[y+1][x+1]);\r\n\t\t\t}\r\n\t\t\tif(this.x > this.y-board.getArraySize()+1){\r\n\t\t\t\t// Check tile below and to the left exists\r\n\t\t\t\tadjacents.add(board.getNodes()[y+1][x]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn adjacents;\r\n\t}", "public ArrayList<int[]> surroundingCoordinates(int row, int col){\n\t\t\t\n\t\tArrayList<int[]> coordinates = new ArrayList<int[]>();\n\t\tfor(int x = -1; x <= 1; x++) {\n\t\t\tfor(int y = -1; y <= 1; y++) {\n\t\t\t\tif(\t\t\n\t\t\t\t\t\t(row+x >= 0) && \n\t\t\t\t\t\t(col+y >= 0) &&\n\t\t\t\t\t\t(row+x < bm.getBoardSize()) &&\n\t\t\t\t\t\t(col+y < bm.getBoardSize()) &&\n\t\t\t\t\t\t(x != 0 || y != 0)\n\t\t\t\t){\n\t\t\t\t\tcoordinates.add(new int[]{row+x, col+y});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn coordinates;\n\t}", "private List<CellIndex> getNeighbours( CellIndex index )\r\n {\n List<CellIndex> neighbours = new ArrayList<World.CellIndex>();\r\n if( index.x % EnvSettings.getMAX_X() != 0 )\r\n {\r\n neighbours.add( new CellIndex( index.x - 1, index.y, index.z ) );\r\n }\r\n if( index.x % EnvSettings.getMAX_X() != EnvSettings.getMAX_X() - 1 )\r\n {\r\n neighbours.add( new CellIndex( index.x + 1, index.y, index.z ) );\r\n }\r\n if( index.y % EnvSettings.getMAX_Y() != 0 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y - 1, index.z ) );\r\n }\r\n if( index.y % EnvSettings.getMAX_Y() != EnvSettings.getMAX_Y() - 1 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y + 1, index.z ) );\r\n }\r\n if( index.z % EnvSettings.getMAX_Z() != 0 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y, index.z - 1 ) );\r\n }\r\n if( index.z % EnvSettings.getMAX_Z() != EnvSettings.getMAX_Z() - 1 )\r\n {\r\n neighbours.add( new CellIndex( index.x, index.y, index.z + 1 ) );\r\n }\r\n return neighbours;\r\n }", "public Cell[] getNeighbors(Cell cell) {\n int index = 0;\n Cell neighbors[] = new Cell[4];\n //check top neighbour\n if (cell.getRow() > 0) {\n neighbors[index] = cells[cell.getRow() - 1][cell.getColumn()];\n index++;\n }\n //check left neighbor\n if (cell.getColumn() > 0) {\n neighbors[index] = cells[cell.getRow()][cell.getColumn()-1];\n index++;\n }\n //check bottom neighbor\n if (cell.getRow() < height - 1) {\n neighbors[index] = cells[cell.getRow() + 1][cell.getColumn()];\n index++;\n }\n //check right neighbor\n if (cell.getColumn() < width - 1) {\n neighbors[index] = cells[cell.getRow()][cell.getColumn()+1];\n index++;\n }\n\n //if there are only 3 neighbor cells, copy cells into smaller array\n if (index == 3) {\n Cell neighbors2[] = new Cell[3];\n for (int i = 0; i < neighbors2.length; i++) {\n neighbors2[i] = neighbors[i];\n }\n return neighbors2;\n //if there are only 2 neighbor cells, copy cells into smaller array\n } else if (index == 2) {\n Cell neighbors2[] = new Cell[2];\n for (int i = 0; i < neighbors2.length; i++) {\n neighbors2[i] = neighbors[i];\n }\n return neighbors2;\n }\n return neighbors;\n }", "public static List<int[]> findAdjacent(PuzzleState state, int row, int column) {\r\n\t\tArrayList<int[]> adjacentTiles = new ArrayList<int[]>();\r\n\t\tint[] whiteTile = Tiles.findTile(0, state);\r\n\t\tint row1, row2, column1, column2;\r\n\t\t\r\n\t\trow1 = whiteTile[1] - 1;\r\n\t\trow2 = whiteTile[1] + 1;\r\n\t\tcolumn1 = whiteTile[0] - 1;\r\n\t\tcolumn2 = whiteTile[1] + 1;\r\n\t\t\r\n\t\t// West\r\n\t\tif (column1 >= 0) {\r\n\t\t\tint[] tile = new int[2];\r\n\t\t\ttile[0] = column1;\r\n\t\t\ttile[1] = row;\r\n\t\t\tadjacentTiles.add(tile);\r\n\t\t}\r\n\t\t// South\r\n\t\tif (row1 >= 0) {\r\n\t\t\tint[] tile = new int[2];\r\n\t\t\ttile[0] = row1;\r\n\t\t\ttile[1] = column;\r\n\t\t\tadjacentTiles.add(tile);\r\n\t\t}\r\n\t\t// East\r\n\t\tif (column2 <= 3) {\r\n\t\t\tint[] tile = new int[2];\r\n\t\t\ttile[0] = column2;\r\n\t\t\ttile[1] = row;\r\n\t\t\tadjacentTiles.add(tile);\r\n\t\t}\r\n\t\t// North\r\n\t\tif (row2 <= 3) {\r\n\t\t\tint[] tile = new int[2];\r\n\t\t\ttile[0] = column;\r\n\t\t\ttile[1] = row2;\r\n\t\t\tadjacentTiles.add(tile);\r\n\t\t}\r\n\t\t\r\n\t\treturn adjacentTiles;\r\n\t}", "public List<Integer> getNeighborStates(Grid theGrid) {\n ArrayList<Integer> neighborStates = new ArrayList();\n int[] neighborColIndexForMyRow = getNeighborColIndex();\n\n for (int i = 0; i < neighborColIndexForMyRow.length; i++) {\n if (theGrid.isValidIndex(myRow + neighborRowIndex[i], myCol + neighborColIndexForMyRow[i])) {\n neighborStates.add(\n theGrid.getCell((myRow + neighborRowIndex[i]), (myCol + neighborColIndexForMyRow[i]))\n .getCurrentState());\n } else if (toroidal) {\n int[] newIndexes = getTorodialIndex(theGrid, i);\n if (theGrid.isValidIndex(newIndexes[0], newIndexes[1])) {\n neighborStates.add(\n theGrid.getCell(newIndexes[0], newIndexes[1]).getCurrentState());\n }\n }\n\n }\n return neighborStates;\n }", "Iterator<BoardPosition> possibleMovingPositions(BoardPosition from, Game game, Map<BoardPosition, Piece> pieceMap);", "public ArrayList<ArrayList<Integer>> getNeighbors(\n ArrayList<Integer> config){\n\n //Set up the return value;\n ArrayList<ArrayList<Integer>> toReturn = \n new ArrayList<ArrayList<Integer>>();\n\n ArrayList<Integer> nextNeighbor;\n\n //Go through all characters and build moves\n for (int i = 0; i < config.size(); i++) {\n if(config.get(i) == '.'){ continue; }\n //Get legal moves\n ArrayList<Integer> myMoves = getMoves(i, config);\n\n //Generate all moves\n for(int t = 0; t < myMoves.size(); t++) {\n nextNeighbor = moveUnit(i, myMoves.get(t), config);\n //Check if done before.\n if (!tried.contains(nextNeighbor)) {\n tried.add(nextNeighbor);\n toReturn.add(nextNeighbor);\n }\n }\n }\n\n return toReturn;\n }", "public int maxDistance(int[][] grid) {\n boolean[][] visited = new boolean[grid.length][grid[0].length]; // mark which cells have been already been visited\n Queue<int[]> queue = new LinkedList<>();\n\n //put 1 cells into queue to start with and mark then visited\n for (int i = 0; i < grid.length; i++) {\n for (int j = 0; j < grid[0].length; j++) {\n if (grid[i][j] == 1) {\n queue.add(new int[]{i,j});\n visited[i][j] = true; //mark cell as visited\n }\n }\n }\n\n int distance = -1;\n int[][] directions = {{-1,0}, {0,1}, {1,0}, {0,-1}}; //all possible 4 directions\n while (!queue.isEmpty()) {\n int size = queue.size(); //since this is BFS we need to traverse level by level\n\n while (size > 0) { //iterate only till nodes in current level\n int[] pair = queue.poll();\n\n for (int[] direction : directions) { // check in all possible directions\n int x = pair[0] + direction[0];\n int y = pair[1] + direction[1];\n\n //if target cell is with in bounds and is not visited, add it to queue\n if (x >= 0 && x < grid.length && y >= 0 && y < grid[0].length && !visited[x][y]) {\n queue.add(new int[]{x,y});\n visited[x][y] = true;\n }\n }\n size--;\n }\n distance++; //increment the size only after level traversal is complete\n }\n\n //this is required because distance can be zero. This is possible if grid contains all 1's and all 1's are\n //consider level 1 as we are starting with them. So, need to return -1\n return distance == 0 ? -1 : distance;\n }", "default int gridToSlot(int x, int y) {\n return y * 9 + x;\n }", "public ArrayList<ArrayList<Tile>> getAllMovePaths(Board board) {\n ArrayList<ArrayList<Tile>> result = new ArrayList<>();\n for (int row = 0; row < board.getRows(); row++) {\n for (int col = 0; col < board.getColumns(); col++) {\n if(isValidMove(row,col)){\n result.add(getMovePath(board, row, col));\n }\n }\n }\n return result;\n }", "public boolean getGrid(int x, int y) {\n\t\tif ((x < 0) || (x > width)) {\n\t\t\treturn true;\n\t\t} else if ((y < 0) || (y > height)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn grid[x][y]; // YOUR CODE HERE\n\t\t}\n\t}", "private void makeGrid(JLabel moves, JLabel remainingBombs) {\r\n this.grid = new Tile[gridSize][gridSize]; \r\n for (int r = 0; r < gridSize; r++) {\r\n for (int c = 0; c < gridSize; c++) {\r\n if (solution[r][c] == 1) {\r\n grid[r][c] = new Tile(r, c, true);\r\n } else {\r\n grid[r][c] = new Tile(r, c, false);\r\n }\r\n final Tile t = grid[r][c];\r\n t.repaint();\r\n handleClicksAndMoves(t, moves, remainingBombs); \r\n }\r\n }\r\n }", "List<Cell> getPossibleMoves(Board board,\n Color color) {\n List<Cell> possible_moves = new ArrayList<Cell>();\n boolean flip_dir = false;\n //loop through all cells in board\n for (int i = 0; i < board.getRows(); i++) {\n for (int j = 0; j < board.getCols(); j++) {\n //check in all directions if move will flip cells\n for (Direction d : Direction.values()) {\n flip_dir = flipInDirection(board, i, j, d, color);\n if (flip_dir) {\n possible_moves.add(board.getCell(i,j));\n break;\n }\n }\n }\n }\n return possible_moves;\n }", "public int[] getAllPossibleMoves(boolean ignore) {\n int[] validMoves;\n int[] validMovesResized;\n int validMovesIndex = 0;\n int startRow = this.getRow();\n int startCol = this.getCol();\n \n validMoves = new int[28]; // For a bishop, there are a maximum of 14 possible squares it could move to\n\n // First move from the bishops spot up diagonally to the right (ie col++, row++)\n for (int i = startCol+1, j = startRow+1; i<=8 && j<8; i++,j++) {\n validMoves[validMovesIndex] = i; // the col\n validMoves[validMovesIndex + 1] = j; // the row\n validMovesIndex = validMovesIndex + 2;\n }\n\n // Next move from the bishops start spot down diagonally to the right (ie col++, row--)\n for (int i = startCol+1, j = startRow-1; i<=8 && j>0; i++,j--) {\n validMoves[validMovesIndex] = i;\n validMoves[validMovesIndex + 1] = j;\n validMovesIndex = validMovesIndex + 2;\n }\n\n // Next move from the bishops start spot down diagonally to the left (ie col--, row--)\n for (int i = startCol-1, j = startRow-1; i>0 && j>0; i--,j--) {\n validMoves[validMovesIndex] = i;\n validMoves[validMovesIndex + 1] = j;\n validMovesIndex = validMovesIndex + 2;\n }\n // Next move from the bishops start spot up diagonally to the left (ie col--, row++)\n for (int i = startCol-1, j = startRow+1; i>0 && j<=8; i--,j++) {\n validMoves[validMovesIndex] = i;\n validMoves[validMovesIndex + 1] = j;\n validMovesIndex = validMovesIndex + 2;\n }\n \n // depending on the position of the bishop, the final array of possible moves may not have 14 squares\n // although that is the maximum. Create a new array of the actual size and copy into it.\n validMovesResized = Arrays.copyOf(validMoves, validMovesIndex);\n return validMovesResized;\n }", "public static int numsIslands (boolean[][] grid) {\n\t\t/**\n\t\t * Have to pay attention to check the grid\n\t\t * Don't put it after the n, m claim\n\t\t * Because if grid == 0, there is no grid[0], so we will get outOfBound error\n\t\t * */\n\t\tif (grid == null || grid.length == 0 || grid[0].length == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\tint n = grid.length;\n\t\tint m = grid[0].length;\n\t\t\n\t\tint islands = 0;\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < m; j++) {\n\t\t\t\tif (grid[i][j]) {\n\t\t\t\t\tmarkAsVisited(grid, i, j);\n\t\t\t\t\tislands++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn islands;\n\t}", "public int numIslands(char[][] grid) {\n\n int n = grid.length;\n if(n==0)\n return 0;\n int m = grid[0].length;\n if(m==0)\n return 0;\n \n int ans =0;\n for(int i=0;i<n;i++)\n {\n m = grid[i].length;\n for(int j=0;j<m;j++)\n {\n if(grid[i][j]=='1')\n {\n ans++;\n dfs(grid,i,j,n,m);\n }\n }\n }\n return ans;\n }", "public int numIslands(char[][] grid) {\n int noOfRows = grid.length;\n int noOfCols = grid[0].length;\n int islands = 0;\n for (int row = 0; row < noOfRows; row++) {\n for (int col = 0; col < noOfCols; col++) {\n if (grid[row][col] == '1') {\n islands++;\n dfs(grid,row,col);\n }\n }\n }\n return islands;\n }", "private void createMaze(Tile currentTile) {\n\n while (numberOfCellsVisited < CAST_WIDTH * CAST_HEIGHT) {\n\n // Get coordinates of current tile and set as visited\n int currentX = currentTile.getPosition().getX();\n int currentY = currentTile.getPosition().getY();\n tempMap[currentY][currentX].setVisited(true);\n\n // Begin neighbourhood scan\n ArrayList<Integer> neighbours = new ArrayList<>();\n\n // If a neighbour is not visited and its projected position is within bounds, add it to the list of valid neighbours\n // North neighbour\n if (currentY - 1 >= 0) {\n if (!tempMap[currentY - 1][currentX].isVisited()) //Northern neighbour unvisited\n neighbours.add(0);\n }\n //Southern neighbour\n if (currentY + 1 < CAST_HEIGHT) { //y index if increased is not greater than height of the chamber\n if (!tempMap[currentY + 1][currentX].isVisited()) //Northern neighbour unvisited\n neighbours.add(1);\n }\n //Eastern neighbour\n if (currentX + 1 < CAST_WIDTH) { //check edge case\n if (!tempMap[currentY][currentX + 1].isVisited()) { //check if visited\n neighbours.add(2);\n }\n }\n //Western neighbour\n if (currentX - 1 >= 0) {\n if (!tempMap[currentY][currentX - 1].isVisited()) {\n neighbours.add(3);\n }\n }\n if (!neighbours.isEmpty()) {\n\n //generate random number between 0 and 3 for direction\n Random rand = new Random();\n boolean randomizer;\n int myDirection;\n do {\n myDirection = rand.nextInt(4);\n randomizer = neighbours.contains(myDirection);\n } while (!randomizer);\n\n //knock down wall\n switch (myDirection) {\n case 0 -> { // North\n tempMap[currentY][currentX].getPathDirection()[0] = true;\n currentTile = tempMap[currentY - 1][currentX];\n }\n case 1 -> { // South\n tempMap[currentY][currentX].getPathDirection()[1] = true;\n currentTile = tempMap[currentY + 1][currentX];\n }\n case 2 -> { // East\n tempMap[currentY][currentX].getPathDirection()[2] = true;\n currentTile = tempMap[currentY][currentX + 1];\n }\n case 3 -> { // West\n tempMap[currentY][currentX].getPathDirection()[3] = true;\n currentTile = tempMap[currentY][currentX - 1];\n }\n }\n\n mapStack.push(currentTile);\n numberOfCellsVisited++;\n } else {\n currentTile = mapStack.pop(); //backtrack\n }\n }\n\n castMaze(tempMap[0][0], -1);\n }", "static String[] cavityMap(String[] grid) {\r\n \tString[] ret = new String[grid.length];\r\n \t\r\n \tfor (int i = 0; i < grid.length; i++) {\r\n \t\tif (i == 0 || i == grid.length-1) { //first or last row\r\n \t\t\tret[i] = grid[i];\r\n \t\t} else {\r\n \t\t\tchar[] beforeRow = grid[i-1].toCharArray();\r\n \t\t\tchar[] actualRow = grid[i].toCharArray();\r\n \t\t\tchar[] nextRow = grid[i+1].toCharArray();\r\n \t\t\tfor (int j = 0; j < actualRow.length; j++) {\r\n \t\t\t\tif (j > 0 && j < actualRow.length -1) {\r\n \t\t\t\t\tint upper = Character.getNumericValue(beforeRow[j]);\r\n \t\t\t\t\tint lower = Character.getNumericValue(nextRow[j]);\r\n \t\t\t\t\tint left = Character.getNumericValue(actualRow[j-1]);\r\n \t\t\t\t\tint right = Character.getNumericValue(actualRow[j+1]);\r\n \t\t\t\t\tint actual = Character.getNumericValue(actualRow[j]);\r\n \t\t\t\t\tif (actual > upper && actual > lower && actual > left && actual > right) {\r\n \t\t\t\t\t\tactualRow[j] = 'X';\r\n \t\t\t\t\t}\r\n \t\t\t\t\t\r\n \t\t\t\t}\r\n \t\t\t\tif (ret[i] == null)\r\n \t\t\t\t\tret[i] = actualRow[j]+\"\";\r\n \t\t\t\telse\r\n \t\t\t\t\tret[i] = ret[i]+actualRow[j];\r\n \t\t\t}\r\n \t\t} \t\t\r\n \t}\r\n \t\r\n \treturn ret;\r\n }", "public abstract Set<Tile> getNeighbors(Tile tile);", "@Override\n\tpublic List<Cell> getImmediateNeighbors(Cell cell) {\n\t\tList<Cell> neighbors = new ArrayList<Cell>();\n\t\tint north, east, south, west;\n\t\t\n\t\tnorth = getNorthCell(cell);\n\t\teast = getEastCell(cell);\n\t\tsouth = getSouthCell(cell);\n\t\twest = getWestCell(cell);\n\t\t\n\t\tif (north != -1) { neighbors.add(getCellList().get(north)); }\n\t\tif (east != -1) { neighbors.add(getCellList().get(east)); }\n\t\tif (south != -1) { neighbors.add(getCellList().get(south)); }\n\t\tif (west != -1) { neighbors.add(getCellList().get(west)); }\n\t\t\n\t\treturn neighbors;\n\t}", "public int[][] getGrid()\n {\n return grid;\n }", "@Override\n public List<List<Integer>> possibleMovesVisualInfo(List<Integer> playerStates) {\n List<List<Integer>> possibleMovesConfig = new ArrayList<>();\n List<Coordinate> possibleMoves = getPossibleMovesAsList(playerStates);\n for (int r = 0; r< numRows;r++) {\n List<Integer> possibleMovesRow = new ArrayList<>();\n for (int c = 0; c < numCols;c++) {\n if (possibleMoves.contains(new Coordinate(r,c))) {\n possibleMovesRow.add(1);\n } else {\n possibleMovesRow.add(0);\n }\n }\n possibleMovesConfig.add(possibleMovesRow);\n }\n return possibleMovesConfig; \n }", "public static void searchAlgortihm(int x, int y)\n\t{\n\t\tint dx = x;\n\t\tint dy = y;\n\t\tint numMovements = 1; // variable to indicate the distance from the user\n\t\t\n\t\t//check starting position\n\t\tcheckLocation(dx,dy, x, y);\n\n\t\tint minCoords = MAX_COORDS;\n\t\tminCoords *= -1; // max negative value of the grid\n\n\t\t// while - will search through all coordinates until it finds 5 events \n\t\twhile(numMovements < (MAX_COORDS*2)+2 && (closestEvents.size() < 5))\n\t\t{\n\t\t\t//first loop - \n\t\t\tfor(int i = 1; i <= 4; i++)\n\t\t\t{\n\t\t\t\tif(i == 1){ // // moving south-west\n\t\t\t\t\tfor(int j = 0; j < numMovements; j++){\n\t\t\t\t\t\tdx = j-x;\n\t\t\t\t\t\tdx *= -1; // reverse sign\n\t\t\t\t\t\tdy = (numMovements-j)+y;\n\t\t\t\t\t\tif((dx >= minCoords) && (dy <= MAX_COORDS)) // only check the coordinates if they are on the grid\n\t\t\t\t\t\t\tcheckLocation(dx, dy, x, y);\n\t\t\t\t\t\t/*else\n\t\t\t\t\t\t\tSystem.out.println(\"1 out of bounds - \" + dx + \",\" + dy);*/\n\t\t\t\t\t}\n\t\t\t\t}else if(i == 2){ // moving south-east\n\t\t\t\t\tfor(int j = 0; j < numMovements; j++){\n\t\t\t\t\t\tdx = (numMovements-j)-x;\n\t\t\t\t\t\tdx *= -1; // change sign\n\t\t\t\t\t\tdy = j-y; \n\t\t\t\t\t\tdy *= -1; // change sign\n\t\t\t\t\t\tif((dx >= minCoords) && (dy >= minCoords))\n\t\t\t\t\t\t\tcheckLocation(dx, dy, x, y);\n\t\t\t\t\t\t/*else\n\t\t\t\t\t\t\tSystem.out.println(\"2 out of bounds - \" + dx + \",\" + dy);*/\n\t\t\t\t\t}\n\t\t\t\t}else if(i == 3){ // moving north-east\n\t\t\t\t\tfor(int j = 0; j < numMovements; j++){\n\t\t\t\t\t\tdx = j+x;\n\t\t\t\t\t\tdy = (numMovements-j)-y;\n\t\t\t\t\t\tdy *= -1;\n\t\t\t\t\t\tif((dx <= MAX_COORDS) && (dy >= minCoords))\n\t\t\t\t\t\t\tcheckLocation(dx, dy, x, y);\n\t\t\t\t\t\t/*else\n\t\t\t\t\t\t\tSystem.out.println(\"3 out of bounds - \" + dx + \",\" + dy);*/\n\t\t\t\t\t}\n\t\t\t\t}else if(i == 4){ // moving north-west\n\t\t\t\t\tfor(int j = 0; j < numMovements; j++){\n\t\t\t\t\t\tdx = (numMovements-j)+x;\n\t\t\t\t\t\tdy = j+y;\n\t\t\t\t\t\tif((dx <= MAX_COORDS) && (dy <= MAX_COORDS))\n\t\t\t\t\t\t\tcheckLocation(dx, dy, x, y);\n\t\t\t\t\t\t/*else\n\t\t\t\t\t\t\tSystem.out.println(\"4 out of bounds - \" + dx + \",\" + dy);*/\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\n\t\t\t// increment the number of movements, from user coordinate\n\t\t\tnumMovements++;\n\n\t\t} // End of while\n\t}", "private Cell[] allPossibleMoves(Cell source) {\n\t\tCell[] moves = new Cell[2 * Board.BOARD_SIZE - 2]; // Вертикаль и горизонталь, которые бьет ладья\n\t\tint columnIndex = source.getColumn();\n\t\tint rowIndex = source.getRow();\n\t\tint k = 0;\n\t\tfor (int i = 0; i < Board.BOARD_SIZE; i++) {\n\t\t\tif (i != rowIndex) {\n\t\t\t\tmoves[k++] = new Cell(columnIndex, i);\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < Board.BOARD_SIZE; i++) {\n\t\t\tif (i != columnIndex) {\n\t\t\t\tmoves[k++] = new Cell(i, rowIndex);\n\t\t\t}\n\t\t}\n\t\treturn moves;\n\t}", "public void populateNeighbors(Cell[][] cells) {\n\t\tint limitHoriz = cells[0].length;\n\t\tint limitVert = cells.length;\n\t\t// above left\n\t\tif (myRow > 0 && myRow < limitVert - 1) {\n\t\t\tif (myCol > 0 && myCol < limitHoriz - 1) {\n\t\t\t\tneighbors.add(cells[myRow][myCol]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol +1]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol +1]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol]);\n\t\t\t\tneighbors.add(cells[myRow-1][myCol-1]);\n\t\t\t\tneighbors.add(cells[myRow-1][myCol-1]);\n\t\t\t\tneighbors.add(cells[myRow-1][myCol+1]);\n\t\t\t\t// ADD 8 cells to neighbors (see the diagram from the textbook)\n\t\t\t}\n\t\t\tif (myCol == 0) { // left edge not corner\n\t\t\t\t// ADD 5 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow+1][myCol+1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol+1]);\n\t\t\t\tneighbors.add(cells[myRow+1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow-1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow-1][myCol+1]);\n\t\t\t}\n\t\t\tif (myCol == limitHoriz - 1) { // right edge not corner\n\t\t\t\t// ADD 5 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow +1][myCol-1]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow-1][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow -1][myCol]);\n\t\t\t}\n\t\t}\n\t\tif (myRow == 0) {\n\t\t\tif (myCol > 0 && myCol < limitHoriz - 1) { // top edge not corner\n\t\t\t\t// ADD 5 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow][myCol + 1]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol+1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol-1]);\n\t\t\t\tneighbors.add(cells[myRow+1][myCol -1]);\n\t\t\t}\n\t\t\tif (myCol == 0) { // top left corner\n\t\t\t\t// ADD 3 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow][myCol + 1]);\n\t\t\t\tneighbors.add(cells[myRow + 1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow + 1][myCol+1]);\n\t\t\t}\n\t\t\tif (myCol == limitHoriz - 1) { // top right corner\n\t\t\t\t// ADD 3 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow +1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow +1][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol -1]);\n\t\t\t}\n\t\t}\n\t\tif (myRow == limitVert - 1) {\n\t\t\tif (myCol > 0 && myCol < limitHoriz - 1) { // bottom edge\n\t\t\t\t// ADD 5 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow-1][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow - 1][myCol+1]);\n\t\t\t\tneighbors.add(cells[myRow - 1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow][myCol +1]);\n\t\t\t}\n\t\t\tif (myCol == 0) { // bottom left corner\n\t\t\t\t// ADD 3 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow - 1][myCol+1]);\n\t\t\t\tneighbors.add(cells[myRow - 1][myCol]);\n\t\t\t\tneighbors.add(cells[myRow][myCol +1]);\n\t\t\t}\n\t\t\tif (myCol == limitHoriz - 1) { // bottom right corner\n\t\t\t\t// ADD 3 cells to neighbors (see the diagram from the textbook)\n\t\t\t\tneighbors.add(cells[myRow-1][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow][myCol -1]);\n\t\t\t\tneighbors.add(cells[myRow - 1][myCol]);\n\t\t\t}\n\t\t}\n\t}", "public List<int[]> getCoords(Board lev){\n \tint[][] coords;\n \tColumn c = lev.getColumns().get(col);\n \tint[] p1 = c.getFrontPoint1();\n \tint[] p2 = c.getFrontPoint2();\n\n \tif (isPod && z < Board.BOARD_DEPTH) {\n \t\tint cx = p1[0] + (p2[0]-p1[0])/2;\n \t\tint cy = p1[1] + (p2[1]-p1[1])/2;\n\n \t\t// define outer and inner diamonds\n \t\tint[][] outer = new int[4][3];\n \t\tint[][] inner = new int[4][3];\n \t\touter[0][0] = cx;\n \t\touter[0][1] = cy - PODSIZE;\n \t\touter[0][2] = (int)z;\n \t\touter[1][0] = cx + PODSIZE;\n \t\touter[1][1] = cy;\n \t\touter[1][2] = (int) z;\n \t\touter[2][0] = cx;\n \t\touter[2][1] = cy + PODSIZE;\n \t\touter[2][2] = (int) z;\n \t\touter[3][0] = cx - PODSIZE;\n \t\touter[3][1] = cy;\n \t\touter[3][2] = (int) z;\n \t\tinner[0][0] = cx;\n \t\tinner[0][1] = cy - PODSIZE/3;\n \t\tinner[0][2] = (int) z;\n \t\tinner[1][0] = cx + PODSIZE/3;\n \t\tinner[1][1] = cy;\n \t\tinner[1][2] = (int) z;\n \t\tinner[2][0] = cx;\n \t\tinner[2][1] = cy + PODSIZE/3;\n \t\tinner[2][2] = (int) z;\n \t\tinner[3][0] = cx - PODSIZE/3;\n \t\tinner[3][1] = cy;\n \t\tinner[3][2] = (int) z;\n\n \t\t// define line path through those diamonds:\n \t\tcoords = new int[17][3];\n \t\tcoords[0] = outer[0];\n \t\tcoords[1] = outer[1];\n \t\tcoords[2] = inner[1];\n \t\tcoords[3] = inner [0];\n \t\tcoords[4] = outer[1];\n \t\tcoords[5] = outer[2];\n \t\tcoords[6] = inner[2];\n \t\tcoords[7] = inner[1];\n \t\tcoords[8] = outer[2];\n \t\tcoords[9] = outer[3];\n \t\tcoords[10]= inner[3];\n \t\tcoords[11]= inner[2];\n \t\tcoords[12]= outer[3];\n \t\tcoords[13]= outer[0];\n \t\tcoords[14]= inner[0];\n \t\tcoords[15]= inner[3];\n \t\tcoords[16]= outer[0];\n \t}\n \telse { \n \t\tcoords = new int[7][3];\n \t\tswitch (s) {\n \t\tcase STRAIGHT:\n \t\t\tcoords[0][0] = p1[0];\n \t\t\tcoords[0][1] = p1[1];\n \t\t\tcoords[0][2] = (int) (z-EXHEIGHT_H);\n \t\t\tcoords[1][0] = p2[0];\n \t\t\tcoords[1][1] = p2[1];\n \t\t\tcoords[1][2] = (int) (z+EXHEIGHT_H);\n \t\t\tcoords[2][0] = p2[0] - (p2[0]-p1[0])/3;\n \t\t\tcoords[2][1] = p2[1] - (p2[1]-p1[1])/3;\n \t\t\tcoords[2][2] = (int) z;\n \t\t\tcoords[3][0] = p2[0];\n \t\t\tcoords[3][1] = p2[1];\n \t\t\tcoords[3][2] = (int) (z-EXHEIGHT_H);\n \t\t\tcoords[4][0] = p1[0];\n \t\t\tcoords[4][1] = p1[1];\n \t\t\tcoords[4][2] = (int) (z+EXHEIGHT_H);\n \t\t\tcoords[5][0] = p1[0] + (p2[0]-p1[0])/3;\n \t\t\tcoords[5][1] = p1[1] + (p2[1]-p1[1])/3;\n \t\t\tcoords[5][2] = (int) z;\n \t\t\tcoords[6][0] = p1[0];\n \t\t\tcoords[6][1] = p1[1];\n \t\t\tcoords[6][2] = (int) (z-EXHEIGHT_H);\n \t\t\tbreak;\n\n \t\tcase JUMPRIGHT1:\n \t\tcase LANDRIGHT2:\n \t\t\tcoords[0][0] = p1[0] + (p2[0]-p1[0])/4;\n \t\t\tcoords[0][1] = p1[1] + (p2[1]-p1[1])/4;\n \t\t\tcoords[0][2] = (int) (z+EXHEIGHT_H*2);\n \t\t\tcoords[1][0] = p2[0] + (p2[0]-p1[0])/4;\n \t\t\tcoords[1][1] = p2[1] + (p2[1]-p1[1])/4;\n \t\t\tcoords[1][2] = (int) (z+EXHEIGHT_H*2);\n \t\t\tcoords[2][0] = p2[0] - (p2[0]-p1[0])/11;\n \t\t\tcoords[2][1] = p2[1] - (p2[1]-p1[1])/11;\n \t\t\tcoords[2][2] = (int) (z+EXHEIGHT_H*1.8);\n \t\t\tcoords[3][0] = p2[0];\n \t\t\tcoords[3][1] = p2[1];\n \t\t\tcoords[3][2] = (int) z;\n \t\t\tcoords[4][0] = (int) (p1[0] + (p2[0]-p1[0])/2);\n \t\t\tcoords[4][1] = (int) (p1[1] + (p2[1]-p1[1])/2);\n \t\t\tcoords[4][2] = (int) (z+ EXHEIGHT_H*5);\n \t\t\tcoords[5][0] = (int) (p2[0] - (p2[0]-p1[0])/2.5);\n \t\t\tcoords[5][1] = (int) (p2[1] - (p2[1]-p1[1])/2.5);\n \t\t\tcoords[5][2] = (int) (z+EXHEIGHT_H *2.6);\n \t\t\tcoords[6] = coords[0];\n \t\t\tbreak;\n\n \t\tcase JUMPLEFT1:\n \t\tcase LANDLEFT2:\n \t\t\tcoords[0][0] = p1[0];\n \t\t\tcoords[0][1] = p1[1];\n \t\t\tcoords[0][2] = (int) z;\n \t\t\tcoords[1][0] = (int) (p1[0] + (p2[0]-p1[0])/2);\n \t\t\tcoords[1][1] = (int) (p1[1] + (p2[1]-p1[1])/2);\n \t\t\tcoords[1][2] = (int) (z+ EXHEIGHT_H*5);\n \t\t\tcoords[2][0] = (int) (p1[0] + (p2[0]-p1[0])/2.5);\n \t\t\tcoords[2][1] = (int) (p1[1] + (p2[1]-p1[1])/2.5);\n \t\t\tcoords[2][2] = (int) (z+EXHEIGHT_H *2.6);\n \t\t\tcoords[3][0] = p2[0] - (p2[0]-p1[0])/4;\n \t\t\tcoords[3][1] = p2[1] - (p2[1]-p1[1])/4;\n \t\t\tcoords[3][2] = (int) (z+EXHEIGHT_H*2);\n \t\t\tcoords[4][0] = p1[0] - (p2[0]-p1[0])/4;\n \t\t\tcoords[4][1] = p1[1] - (p2[1]-p1[1])/4;\n \t\t\tcoords[4][2] = (int) (z+EXHEIGHT_H*2);\n \t\t\tcoords[5][0] = p1[0] + (p2[0]-p1[0])/11;\n \t\t\tcoords[5][1] = p1[1] + (p2[1]-p1[1])/11;\n \t\t\tcoords[5][2] = (int) (z+EXHEIGHT_H*1.8);\n \t\t\tcoords[6] = coords[0];\n \t\t\tbreak;\n\n \t\tcase JUMPLEFT2:\n \t\tcase LANDLEFT1:\n \t\t\tcoords[0][0] = p1[0];\n \t\t\tcoords[0][1] = p1[1];\n \t\t\tcoords[0][2] = (int) z;\n \t\t\tcoords[1][0] = (int) (p1[0] + (p2[0]-p1[0])/4.5);\n \t\t\tcoords[1][1] = (int) (p1[1] + (p2[1]-p1[1])/4.5);\n \t\t\tcoords[1][2] = (int) (z+ EXHEIGHT_H*8);\n \t\t\tcoords[2][0] = (int) (p1[0] + (p2[0]-p1[0])/4.5);\n \t\t\tcoords[2][1] = (int) (p1[1] + (p2[1]-p1[1])/4.5);\n \t\t\tcoords[2][2] = (int) (z+EXHEIGHT_H *4);\n \t\t\tcoords[3][0] = p2[0] - (p2[0]-p1[0])/2;\n \t\t\tcoords[3][1] = p2[1] - (p2[1]-p1[1])/2;\n \t\t\tcoords[3][2] = (int) (z+EXHEIGHT_H*4);\n \t\t\tcoords[4][0] = (int) (p1[0] - (p2[0]-p1[0])/3.5);\n \t\t\tcoords[4][1] = (int) (p1[1] - (p2[1]-p1[1])/3.5);\n \t\t\tcoords[4][2] = (int) (z+EXHEIGHT_H*1.8);\n \t\t\tcoords[5][0] = p1[0];// - (p2[0]-p1[0])/15;\n \t\t\tcoords[5][1] = p1[1];// - (p2[1]-p1[1])/15;\n \t\t\tcoords[5][2] = (int) (z+EXHEIGHT_H*1.8);\n \t\t\tcoords[6] = coords[0];\n \t\t\tbreak;\n\n \t\tcase JUMPRIGHT2:\n \t\tcase LANDRIGHT1:\n \t\t\tcoords[0][0] = p2[0] - (p2[0]-p1[0])/2;\n \t\t\tcoords[0][1] = p2[1] - (p2[1]-p1[1])/2;\n \t\t\tcoords[0][2] = (int) (z+EXHEIGHT_H*4);\n \t\t\tcoords[1][0] = (int) (p2[0] + (p2[0]-p1[0])/3.5);\n \t\t\tcoords[1][1] = (int) (p2[1] + (p2[1]-p1[1])/3.5);\n \t\t\tcoords[1][2] = (int) (z+EXHEIGHT_H*1.8);\n \t\t\tcoords[2][0] = p2[0];// - (p2[0]-p1[0])/15;\n \t\t\tcoords[2][1] = p2[1];// - (p2[1]-p1[1])/15;\n \t\t\tcoords[2][2] = (int) (z+EXHEIGHT_H*1.8);\n \t\t\tcoords[3][0] = p2[0];\n \t\t\tcoords[3][1] = p2[1];\n \t\t\tcoords[3][2] = (int) z;\n \t\t\tcoords[4][0] = (int) (p2[0] - (p2[0]-p1[0])/4.5);\n \t\t\tcoords[4][1] = (int) (p2[1] - (p2[1]-p1[1])/4.5);\n \t\t\tcoords[4][2] = (int) (z+ EXHEIGHT_H*8);\n \t\t\tcoords[5][0] = (int) (p2[0] - (p2[0]-p1[0])/4.5);\n \t\t\tcoords[5][1] = (int) (p2[1] - (p2[1]-p1[1])/4.5);\n \t\t\tcoords[5][2] = (int) (z+EXHEIGHT_H *4);\n \t\t\tcoords[6] = coords[0];\n \t\t\tbreak;\n \t\t}\n \t}\n\n \treturn Arrays.asList(coords);\n }", "public ArrayList<Coordinate> possibleTiles(Coordinate start) {\n\t\t\tHashMap<Coordinate, MapTile> wallMap = World.getMap();\n\t\t\tLinkedList<Coordinate> queue = new LinkedList<Coordinate>();\n\t\t\tArrayList<Coordinate> visited = new ArrayList<Coordinate>();\n\t\t\tqueue.add(start);\n\t\t\twhile (!queue.isEmpty()) {\n\t\t\t\tCoordinate temp = queue.poll();\n\t\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\t\tCoordinate next = new Coordinate(temp.toString());\n\t\t\t\t\tswitch(i) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tnext.y--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tnext.x++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tnext.y++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tnext.x--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (!visited.contains(next) && !wallMap.get(next).isType(MapTile.Type.WALL)) {\n\t\t\t\t\t\tqueue.add(next);\n\t\t\t\t\t\tvisited.add(next);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn visited;\n\t\t}", "public List<Board> neighbors(int player)\n\t{\n\t\tList<Board> ret = new ArrayList<Board>();\n\t\t\n\t\tList<Integer> moves = getLegalMoves();\n\t\tfor (int i : moves)\n\t\t{\n\t\t\tret.add(makeMove(i,player));\n\t\t}\n\t\t\n\t\treturn ret;\n\t}", "public boolean getGrid(int x, int y){\n\t\treturn grid[x][y];\n\t}", "Iterable<Position<E>> positions();", "public ArrayList<Tile> getMovePath(Board board,int toRow, int toCol) {\n // implement\n ArrayList<Tile> validTiles = new ArrayList<>();\n int myRow = getRow();\n int myCol = getCol();\n\n //check if valid move first\n if(!isValidMove(toRow,toCol)){\n return null;\n }\n\n int rowInc = getIncrement(myRow, toRow);\n int colInc = getIncrement(myCol, toCol);\n // Because of the check in the loop the toRow/toCol need to be pushed out one further\n toRow += rowInc;\n toCol += colInc;\n\n for (int row = myRow, col = myCol; row != toRow || col != toCol; row += rowInc, col += colInc) {\n validTiles.add(board.getTile(row,col));\n }\n\n return validTiles;\n }", "public Position[] getWinningPositions();", "public int numDistinctIslands(int[][] grid){\n if(grid == null || grid.length == 0)\n return 0;\n Set<String> set = new HashSet<>();\n int row = grid.length, col = grid[0].length;\n for(int i = 0; i < row; i++){\n for(int j = 0; j < col; j++){\n if(grid[i][j] == 1){\n String path = dfs(grid, i, j, row, col, \"S\");\n set.add(path);\n }\n }\n }\n return set.size();\n }", "public HashSet<int[]> findTiles(int x, int y, Tile[][] board, HashSet<int[]> tilePositions){\n TileType tileType = board[x][y].getType();\n int tileOrientation = board[x][y].getOrientation();\n\n switch(tileType){\n case Crossway:\n switch(tileOrientation){\n case 0:\n //nach oben\n //sind wir in der obersten Zeile oder hat das Tile über diesem nach unten eine Wand oder wurde das Tile über diesem schon angeschaut?\n if(y!=0 && !neighbourHasWall(2, board[x][y-1]) && !tilePositionsContainsXY(x,y-1, tilePositions) ) {\n tilePositions.add(arrayOfXY(x,y-1));\n tilePositions.addAll(findTiles(x, y - 1, board, tilePositions));\n }\n //nach links\n if(x!=0 && !neighbourHasWall(1, board[x-1][y]) && !tilePositionsContainsXY(x-1,y, tilePositions)) {\n tilePositions.add(arrayOfXY(x - 1, y));\n tilePositions.addAll(findTiles(x - 1, y, board, tilePositions));\n }\n //nach rechts\n if(x!=6 && !neighbourHasWall(3, board[x+1][y]) && !tilePositionsContainsXY(x+1,y,tilePositions)) {\n tilePositions.add(arrayOfXY(x + 1, y));\n tilePositions.addAll(findTiles(x + 1, y, board, tilePositions));\n }\n break;\n case 1:\n //nach oben\n if(y!=0 && !neighbourHasWall(2, board[x][y-1]) && !tilePositionsContainsXY(x,y-1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y-1));\n tilePositions.addAll(findTiles(x, y - 1, board, tilePositions));\n }\n //nach unten\n if(y!=6 && !neighbourHasWall(0, board[x][y+1]) && !tilePositionsContainsXY(x,y+1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y+1));\n tilePositions.addAll(findTiles(x, y + 1, board, tilePositions));\n }\n //nach rechts\n if(x!=6 && !neighbourHasWall(3, board[x+1][y]) && !tilePositionsContainsXY(x+1,y,tilePositions)) {\n tilePositions.add(arrayOfXY(x+1, y));\n tilePositions.addAll(findTiles(x + 1, y, board, tilePositions));\n }\n break;\n case 2:\n //nach links\n if(x!=0 && !neighbourHasWall(1, board[x-1][y]) && !tilePositionsContainsXY(x-1, y, tilePositions)) {\n tilePositions.add(arrayOfXY(x-1, y));\n tilePositions.addAll(findTiles(x - 1, y, board, tilePositions));\n }\n //nach unten\n if(y!=6 && !neighbourHasWall(0, board[x][y+1]) && !tilePositionsContainsXY(x,y+1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y+1));\n tilePositions.addAll(findTiles(x, y + 1, board, tilePositions));\n }\n //nach rechts\n if(x!=6 && !neighbourHasWall(3, board[x+1][y]) && !tilePositionsContainsXY(x+1,y,tilePositions)) {\n tilePositions.add(arrayOfXY(x+1, y));\n tilePositions.addAll(findTiles(x + 1, y, board, tilePositions));\n }\n break;\n case 3:\n //nach links\n if(x!=0 && !neighbourHasWall(1, board[x-1][y]) && !tilePositionsContainsXY(x-1, y, tilePositions)) {\n tilePositions.add(arrayOfXY(x-1, y));\n tilePositions.addAll(findTiles(x - 1, y, board, tilePositions));\n }\n //nach unten\n if(y!=6 && !neighbourHasWall(0, board[x][y+1]) && !tilePositionsContainsXY(x,y+1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y+1));\n tilePositions.addAll(findTiles(x, y + 1, board, tilePositions));\n }\n //nach oben\n if(y!=0 && !neighbourHasWall(2, board[x][y-1]) && !tilePositionsContainsXY(x,y-1,tilePositions)) {\n tilePositions.add(arrayOfXY(x, y-1));\n tilePositions.addAll(findTiles(x, y - 1, board, tilePositions));\n }\n break;\n }\n break;\n case Way:\n if(tileOrientation == 0 || tileOrientation == 2){\n //nach links\n if(x!=0 && !neighbourHasWall(1, board[x-1][y]) && !tilePositionsContainsXY(x-1,y, tilePositions)) {\n tilePositions.add(arrayOfXY(x-1, y));\n tilePositions.addAll(findTiles(x - 1, y, board, tilePositions));\n }\n //nach rechts\n if(x!=6 && !neighbourHasWall(3, board[x+1][y]) && !tilePositionsContainsXY(x+1,y,tilePositions)) {\n tilePositions.add(arrayOfXY(x+1, y));\n tilePositions.addAll(findTiles(x + 1, y, board, tilePositions));\n }\n }\n else{\n //nach unten\n if(y!=6 && !neighbourHasWall(0, board[x][y+1]) && !tilePositionsContainsXY(x,y+1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y+1));\n tilePositions.addAll(findTiles(x, y + 1, board, tilePositions));\n }\n //nach oben\n if(y!=0 && !neighbourHasWall(2, board[x][y-1]) && !tilePositionsContainsXY(x,y-1,tilePositions)) {\n tilePositions.add(arrayOfXY(x, y-1));\n tilePositions.addAll(findTiles(x, y - 1, board, tilePositions));\n }\n }\n break;\n case Edge:\n switch(tileOrientation){\n case 0:\n //nach unten\n if(y!=6 && !neighbourHasWall(0, board[x][y+1]) && !tilePositionsContainsXY(x,y+1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y+1));\n tilePositions.addAll(findTiles(x, y + 1, board, tilePositions));\n }\n //nach rechts\n if(x!=6 && !neighbourHasWall(3, board[x+1][y]) && !tilePositionsContainsXY(x+1,y,tilePositions)) {\n tilePositions.add(arrayOfXY(x+1, y));\n tilePositions.addAll(findTiles(x + 1, y, board, tilePositions));\n }\n break;\n case 1:\n //nach links\n if(x!=0 && !neighbourHasWall(1, board[x-1][y]) && !tilePositionsContainsXY(x-1, y, tilePositions)) {\n tilePositions.add(arrayOfXY(x-1, y));\n tilePositions.addAll(findTiles(x - 1, y, board, tilePositions));\n }\n //nach unten\n if(y!=6 && !neighbourHasWall(0, board[x][y+1]) && !tilePositionsContainsXY(x,y+1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y+1));\n tilePositions.addAll(findTiles(x, y + 1, board, tilePositions));\n }\n break;\n case 2:\n //nach oben\n if(y!=0 && !neighbourHasWall(2, board[x][y-1]) && !tilePositionsContainsXY(x,y-1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y-1));\n tilePositions.addAll(findTiles(x, y - 1, board, tilePositions));\n }\n //nach links\n if(x!=0 && !neighbourHasWall(1, board[x-1][y]) && !tilePositionsContainsXY(x-1,y, tilePositions)) {\n tilePositions.add(arrayOfXY(x-1, y));\n tilePositions.addAll(findTiles(x - 1, y, board, tilePositions));\n }\n break;\n case 3:\n //nach oben\n if(y!=0 && !neighbourHasWall(2, board[x][y-1]) && !tilePositionsContainsXY(x,y-1, tilePositions)) {\n tilePositions.add(arrayOfXY(x, y-1));\n tilePositions.addAll(findTiles(x, y - 1, board, tilePositions));\n }\n //nach rechts\n if(x!=6 && !neighbourHasWall(3, board[x+1][y]) && !tilePositionsContainsXY(x+1, y, tilePositions)) {\n tilePositions.add(arrayOfXY(x+1, y));\n tilePositions.addAll(findTiles(x + 1, y, board, tilePositions));\n }\n }\n break;\n }\n return tilePositions;\n }" ]
[ "0.7048925", "0.686553", "0.6428512", "0.6414223", "0.6394672", "0.6277251", "0.6210902", "0.61440766", "0.6110254", "0.61070096", "0.61046433", "0.6093643", "0.6091685", "0.6041608", "0.6038258", "0.60379416", "0.60113454", "0.59955907", "0.5992899", "0.5988562", "0.5936388", "0.59188575", "0.5894976", "0.58920956", "0.5889433", "0.5885098", "0.5859727", "0.5851303", "0.58304524", "0.5820587", "0.58029616", "0.57782584", "0.5754552", "0.5752351", "0.5750059", "0.5743096", "0.57393837", "0.5735092", "0.5726635", "0.5723856", "0.57194847", "0.57020104", "0.5701877", "0.5693952", "0.56889105", "0.5680289", "0.5664814", "0.56580126", "0.5657108", "0.56541556", "0.5638591", "0.5635683", "0.56335634", "0.5626032", "0.56208163", "0.56191593", "0.5611113", "0.5609849", "0.5606218", "0.56036174", "0.5600576", "0.5600158", "0.55941755", "0.55939555", "0.55678725", "0.5565941", "0.556461", "0.5560138", "0.55455846", "0.5543976", "0.5538535", "0.55180955", "0.5510992", "0.5507355", "0.55042005", "0.5503847", "0.55027646", "0.550123", "0.55004007", "0.5499996", "0.5488506", "0.54771745", "0.5462164", "0.54499894", "0.5447028", "0.5446133", "0.5445291", "0.5442289", "0.5438711", "0.5435292", "0.5431413", "0.5430005", "0.54296255", "0.5428877", "0.5428632", "0.5423849", "0.54231966", "0.54226077", "0.5417139", "0.54129905" ]
0.6736101
2
/ ambiente.shadowLight.set(worldGame.dayLightCol, worldGame.dayLightDir); ambiente.directionalLight.set(worldGame.dayLightCol, worldGame.dayLightDir); shadowLight.begin(Vector3.Zero, cam.direction); shadowBatch.begin(shadowLight.getCamera()); for (GameInstance mi : gameInstances) if (mi.visible) if (isVisible(cam, mi)) shadowBatch.render(mi); shadowBatch.end(); shadowLight.end();
private void updateLight() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void renderShadowMap() {\n GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboId[0]);\n GLES20.glViewport(0, 0, mShadowMapWidth,\n mShadowMapHeight);\n // Clear color and buffers\n GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);\n GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);\n // Start using the shader\n GLES20.glUseProgram(mDepthMapProgram);\n float[] tempResultMatrix = new float[16];\n // Calculate matrices for standing objects\n // View matrix * Model matrix value is stored\n Matrix.multiplyMM(mLightMvpMatrix_staticShapes, 0, mLightViewMatrix, 0, mModelMatrix, 0);\n // Model * view * projection matrix stored and copied for use at rendering from camera point of view\n Matrix.multiplyMM(tempResultMatrix, 0, mLightProjectionMatrix, 0, mLightMvpMatrix_staticShapes, 0);\n System.arraycopy(tempResultMatrix, 0, mLightMvpMatrix_staticShapes, 0, 16);\n // Pass in the combined matrix.\n GLES20.glUniformMatrix4fv(mMVPMatrixHandleShadow, 1, false, mLightMvpMatrix_staticShapes, 0);\n // Render all stationary shapes on scene\n\n mDrawPlane.setDraw(mPositionHandleShadow, 0, 0, 0, true);\n mDrawPlane.draw();\n\n // Calculate matrices for moving objects\n // Rotate the model matrix with current rotation matrix\n Matrix.multiplyMM(tempResultMatrix, 0, mModelMatrix, 0, mCubeRotation, 0);\n // View matrix * Model matrix value is stored\n Matrix.multiplyMM(mLightMvpMatrix_dynamicShapes, 0, mLightViewMatrix, 0, tempResultMatrix, 0);\n // Model * view * projection matrix stored and copied for use at rendering from camera point of view\n Matrix.multiplyMM(tempResultMatrix, 0, mLightProjectionMatrix, 0, mLightMvpMatrix_dynamicShapes, 0);\n System.arraycopy(tempResultMatrix, 0, mLightMvpMatrix_dynamicShapes, 0, 16);\n // Pass in the combined matrix.\n GLES20.glUniformMatrix4fv(mMVPMatrixHandleShadow, 1, false, mLightMvpMatrix_dynamicShapes, 0);\n // Render all moving shapes on scene\n mDrawObj.setDraw(mPositionHandleShadow,0,0,0,true);\n }", "void setupLights() {\n\n lightGroup = new Group();\n\n // Set up the ambient light\n lightAmbient = new AmbientLight(darkGrey);\n lightAmbient.setInfluencingBounds(infiniteBounds);\n lightAmbient.setCapability(Light.ALLOW_STATE_WRITE);\n lightAmbient.setEnable(true);\n lightGroup.addChild(lightAmbient);\n\n // Set up the directional light\n Vector3f lightDirection = new Vector3f(0.65f, -0.65f, -0.40f);\n lightDirectional = new DirectionalLight(white, lightDirection);\n lightDirectional.setInfluencingBounds(infiniteBounds);\n lightDirectional.setEnable(true);\n lightDirectional.setCapability(Light.ALLOW_STATE_WRITE);\n lightGroup.addChild(lightDirectional);\n\n // Set up the point light\n Point3f lightPosition = new Point3f(-1.0f, 1.0f, 0.6f);\n lightPoint = new PointLight(white, lightPosition, attenuation);\n lightPoint.setInfluencingBounds(infiniteBounds);\n lightPoint.setEnable(false);\n lightPoint.setCapability(Light.ALLOW_STATE_WRITE);\n lightPoint.setCapability(PointLight.ALLOW_ATTENUATION_WRITE);\n lightGroup.addChild(lightPoint);\n\n // Set up the spot light\n // Point the light back at the origin\n lightSpot = new SpotLight(white, lightPosition, attenuation,\n lightDirection, (float) Math.toRadians(spotSpreadAngle),\n spotConcentration);\n lightSpot.setInfluencingBounds(infiniteBounds);\n lightSpot.setEnable(false);\n lightSpot.setCapability(Light.ALLOW_STATE_WRITE);\n lightSpot.setCapability(PointLight.ALLOW_ATTENUATION_WRITE);\n lightSpot.setCapability(SpotLight.ALLOW_CONCENTRATION_WRITE);\n lightSpot.setCapability(SpotLight.ALLOW_SPREAD_ANGLE_WRITE);\n lightGroup.addChild(lightSpot);\n }", "public void setLighting(GL3 gl) {\n\t\t // Set the lighting properties\n\t\t\n\t\t// get sunlight vector coords\n\t\tfloat xSun = terrain.getSunlight().getX();\n\t\tfloat ySun = terrain.getSunlight().getY();\n\t\tfloat zSun = terrain.getSunlight().getZ();\n\t\t\n/*\t\t// check fps\n\t\tPoint3D torchPos;\n\t\tif (camera.getPerson().isFps()) {\n\t\t\ttorchPos = new Point3D(camera.getGlobalPosition().getX(), camera.getGlobalPosition().getY(), camera.getGlobalPosition().getZ());\n*/\n\t\tPoint3D torchPos;\n\t\t// check fps\n\t\tif (person.isFps()) {\n\t\t\ttorchPos = new Point3D(person.getCamera().getGlobalPosition().getX(),\n\t\t\t\t\tperson.getCamera().getGlobalPosition().getY(),\n\t\t\t\t\tperson.getCamera().getGlobalPosition().getZ());\n\t\t} else { \n\t\t\ttorchPos = new Point3D(person.getGlobalPosition().getX(),\n\t\t\t\t\tperson.getGlobalPosition().getY() + 0.2f, \n\t\t\t\t\tperson.getGlobalPosition().getZ());\n\t\t}\n\t\t\n Shader.setPoint3D(gl, \"sunlight\", new Point3D(xSun,ySun,zSun)); // set sunlight vector to passed in vector \n Shader.setColor(gl, \"lightIntensity\", Color.WHITE);\n \n // Set the material properties\n Shader.setColor(gl, \"ambientCoeff\", Color.WHITE);\n Shader.setColor(gl, \"diffuseCoeff\", new Color(0.5f, 0.5f, 0.5f));\n Shader.setFloat(gl, \"phongExp\", 16f);\n \n // for torch light\n Shader.setFloat(gl, \"cutoff\", 90f); // in degrees\n Shader.setPoint3D(gl, \"posTorch\", torchPos);\n Shader.setFloat(gl, \"attenuationFactor\", 40f); \n Shader.setColor(gl, \"lightIntensityTorch\", Color.YELLOW); \n \n if (day) {\n \t// light properties for day\n Shader.setColor(gl, \"specularCoeff\", new Color(0.8f, 0.8f, 0.8f));\n \tShader.setColor(gl, \"ambientIntensity\", new Color(0.2f, 0.2f, 0.2f));\n Shader.setPoint3D(gl, \"dirTorch\", new Point3D(0,0,0)); // set torchDir vector \n } else { \n \t// light properties for night \n Shader.setColor(gl, \"specularCoeff\", new Color(0.5f, 0.5f, 0.5f));\n \tShader.setColor(gl, \"ambientIntensity\", new Color(0.01f, 0.01f, 0.01f));\n Shader.setPoint3D(gl, \"dirTorch\", new Point3D(0,0,1)); // set torchDir vector \n }\n\t}", "public void addShadow() {\n startShadow();\n }", "private void renderLights() {\n\t\t\n\t}", "private void addLights() {\n \t\tLight light = new DirectionalLight(\n \t\t\t\tnew Color3f(1f, 1f, 1f), new Vector3f(-1f, -1f, -1f));\n \t\t\n \t\tlight.setInfluencingBounds(\n \t\t\t\tnew BoundingSphere(new Point3d(0, 0, 0), 10));\n \t\t\n \t\tmyScene.addChild(light);\n \t\t\n \t\tlight = new DirectionalLight(\n \t\t\t\tnew Color3f(0.3f, 0.1f, 0.1f), new Vector3f(1f, 0f, 0f));\n \t\t\n \t\tlight.setInfluencingBounds(\n \t\t\t\tnew BoundingSphere(new Point3d(0, 0, 0), 10));\n \t\t\n \t\tmyScene.addChild(light);\n \t}", "public static DirectionalLightShadowFilter addShadow(DirectionalLight light)\n\t{\n\n DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(GVars_Soul_Model.app.getAssetManager(), SHADOWMAP_SIZE, 1);\n dlsf.setLight(light);\n dlsf.setLambda(0.55f);\n dlsf.setShadowIntensity(1.0f);\n dlsf.setEdgeFilteringMode(EdgeFilteringMode.Nearest);\n dlsf.setEnabled(true);\n\n volatileFPP.addFilter(dlsf);\n\n //GVars_Soul_Model.app.getViewPort().addProcessor(volatileFPP);\n \n return dlsf ;\n\t}", "public void renderWorld(boolean renderWithLight);", "@Override\r\n\tpublic void renderShadow(float[] vpMatrix) {\n\t\t\r\n\t}", "public void setHasLightSource(Creature creature, @Nullable Item lightSource) {\n/* 5438 */ if (lightSource != null && lightSource.getTemplateId() == 1243)\n/* */ return; \n/* 5440 */ for (VirtualZone vz : getWatchers()) {\n/* */ \n/* */ \n/* */ try {\n/* 5444 */ if (lightSource == null) {\n/* */ \n/* 5446 */ if (vz.getWatcher().getWurmId() == creature.getWurmId()) {\n/* 5447 */ vz.sendRemoveEffect(-1L, (byte)0);\n/* */ } else {\n/* 5449 */ vz.sendRemoveEffect(creature.getWurmId(), (byte)0);\n/* */ }\n/* */ \n/* */ }\n/* 5453 */ else if (vz.getWatcher().getWurmId() == creature.getWurmId()) {\n/* */ \n/* 5455 */ if (lightSource.getColor() != -1) {\n/* */ \n/* 5457 */ int lightStrength = Math.max(WurmColor.getColorRed(lightSource.color), \n/* 5458 */ WurmColor.getColorGreen(lightSource.color));\n/* 5459 */ lightStrength = Math.max(lightStrength, WurmColor.getColorBlue(lightSource.color));\n/* 5460 */ byte r = (byte)(WurmColor.getColorRed(lightSource.color) * 128 / lightStrength);\n/* 5461 */ byte g = (byte)(WurmColor.getColorGreen(lightSource.color) * 128 / lightStrength);\n/* 5462 */ byte b = (byte)(WurmColor.getColorBlue(lightSource.color) * 128 / lightStrength);\n/* */ \n/* 5464 */ vz.sendAttachCreatureEffect(null, (byte)0, r, g, b, lightSource\n/* 5465 */ .getRadius());\n/* */ \n/* */ \n/* */ }\n/* 5469 */ else if (lightSource.isLightBright()) {\n/* */ \n/* 5471 */ int lightStrength = (int)(80.0F + lightSource.getCurrentQualityLevel() / 100.0F * 40.0F);\n/* 5472 */ vz.sendAttachCreatureEffect(null, (byte)0, \n/* 5473 */ Item.getRLight(lightStrength), Item.getGLight(lightStrength), \n/* 5474 */ Item.getBLight(lightStrength), lightSource.getRadius());\n/* */ } else {\n/* */ \n/* 5477 */ vz.sendAttachCreatureEffect(null, (byte)0, \n/* 5478 */ Item.getRLight(80), Item.getGLight(80), Item.getBLight(80), lightSource.getRadius());\n/* */ \n/* */ }\n/* */ \n/* */ }\n/* 5483 */ else if (lightSource.getColor() != -1) {\n/* */ \n/* 5485 */ int lightStrength = Math.max(WurmColor.getColorRed(lightSource.color), \n/* 5486 */ WurmColor.getColorGreen(lightSource.color));\n/* 5487 */ lightStrength = Math.max(lightStrength, WurmColor.getColorBlue(lightSource.color));\n/* 5488 */ byte r = (byte)(WurmColor.getColorRed(lightSource.color) * 128 / lightStrength);\n/* 5489 */ byte g = (byte)(WurmColor.getColorGreen(lightSource.color) * 128 / lightStrength);\n/* 5490 */ byte b = (byte)(WurmColor.getColorBlue(lightSource.color) * 128 / lightStrength);\n/* */ \n/* 5492 */ vz.sendAttachCreatureEffect(creature, (byte)0, r, g, b, lightSource\n/* 5493 */ .getRadius());\n/* */ \n/* */ \n/* */ }\n/* 5497 */ else if (lightSource.isLightBright()) {\n/* */ \n/* 5499 */ int lightStrength = (int)(80.0F + lightSource.getCurrentQualityLevel() / 100.0F * 40.0F);\n/* 5500 */ vz.sendAttachCreatureEffect(creature, (byte)0, \n/* 5501 */ Item.getRLight(lightStrength), Item.getGLight(lightStrength), \n/* 5502 */ Item.getBLight(lightStrength), lightSource.getRadius());\n/* */ } else {\n/* */ \n/* 5505 */ vz.sendAttachCreatureEffect(creature, (byte)0, \n/* 5506 */ Item.getRLight(80), Item.getGLight(80), Item.getBLight(80), lightSource.getRadius());\n/* */ \n/* */ }\n/* */ \n/* */ }\n/* 5511 */ catch (Exception e) {\n/* */ \n/* 5513 */ logger.log(Level.WARNING, e.getMessage(), e);\n/* */ } \n/* */ } \n/* */ }", "public static void start(){\n new Light(new Vector3f(getSIZE()*Chunk.getCHUNKSIZE()/2,getSIZE()*Chunk.getCHUNKSIZE()/2,getSIZE()*Chunk.getCHUNKSIZE()/2));\n Keyboard.enableRepeatEvents(true);\n createWindow();\n initGL();\n generateWorld();\n Game.gameLoop();\n }", "@Override\n public void simpleInitApp() {\n cam.setLocation(new Vector3f(-2.336393f, 11.91392f, -7.139601f));\n cam.setRotation(new Quaternion(0.23602544f, 0.11321983f, -0.027698677f, 0.96473104f));\n\n Material mat = new Material(assetManager,\"Common/MatDefs/Light/Lighting.j3md\");\n mat.setFloat(\"Shininess\", 15f);\n mat.setBoolean(\"UseMaterialColors\", true);\n mat.setColor(\"Ambient\", ColorRGBA.Yellow.mult(0.2f));\n mat.setColor(\"Diffuse\", ColorRGBA.Yellow.mult(0.2f));\n mat.setColor(\"Specular\", ColorRGBA.Yellow.mult(0.8f));\n\n Material matSoil = new Material(assetManager,\"Common/MatDefs/Light/Lighting.j3md\");\n matSoil.setFloat(\"Shininess\", 15f);\n matSoil.setBoolean(\"UseMaterialColors\", true);\n matSoil.setColor(\"Ambient\", ColorRGBA.Gray);\n matSoil.setColor(\"Diffuse\", ColorRGBA.Black);\n matSoil.setColor(\"Specular\", ColorRGBA.Gray);\n\n Spatial teapot = assetManager.loadModel(\"Models/Teapot/Teapot.obj\");\n teapot.setLocalTranslation(0,0,10);\n\n teapot.setMaterial(mat);\n teapot.setShadowMode(ShadowMode.CastAndReceive);\n teapot.setLocalScale(10.0f);\n rootNode.attachChild(teapot);\n\n Geometry soil = new Geometry(\"soil\", new Box(800, 10, 700));\n soil.setLocalTranslation(0, -13, 550);\n soil.setMaterial(matSoil);\n soil.setShadowMode(ShadowMode.CastAndReceive);\n rootNode.attachChild(soil);\n\n DirectionalLight light=new DirectionalLight();\n light.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());\n light.setColor(ColorRGBA.White.mult(1.5f));\n rootNode.addLight(light);\n\n // load sky\n Spatial sky = SkyFactory.createSky(assetManager, \"Textures/Sky/Bright/FullskiesBlueClear03.dds\", SkyFactory.EnvMapType.CubeMap);\n sky.setCullHint(Spatial.CullHint.Never);\n rootNode.attachChild(sky);\n\n FilterPostProcessor fpp = new FilterPostProcessor(assetManager);\n int numSamples = getContext().getSettings().getSamples();\n if (numSamples > 0) {\n fpp.setNumSamples(numSamples);\n }\n pf = new PosterizationFilter();\n fpp.addFilter(pf);\n\n viewPort.addProcessor(fpp);\n initInputs();\n\n }", "private void setupShadow()\n {\n int maximumPortNumber = Math.max(module_.getInputs().size(), module_.getOutputs().size());\n shadow_ = new BufferedImage(200 + 1 + 20, maximumPortNumber * 20 + 30 + 1 + 20, BufferedImage.TYPE_INT_ARGB);\n Graphics2D g = (Graphics2D) shadow_.getGraphics();\n g.setBackground(Color.white);\n g.setColor(new Color(0.0f, 0.0f, 0.0f, 0.3f));\n g.fillRoundRect(3, 3, 200, maximumPortNumber * 20 + 30, 20, 20);\n g.setColor(Color.white);\n // Convolve the shadow image using a median kernel\n int kSize = 5;\n float[] data = new float[kSize * kSize];\n float value = (float) (1. / (float) (kSize * kSize));\n for (int i = 0; i < data.length; i++)\n {\n data[i] = value;\n }\n op_ = new ConvolveOp(new Kernel(kSize, kSize, data));\n }", "public void draw() {\n if(UPDATE_PHYSICS){\n \n physics.update();\n// physics.update(30);\n \n getCollisionPoints();\n \n removeLostBodies();\n \n for (BObject body : physics.rigidBodies) {\n updateShapes(body);\n }\n \n }\n \n \n // when the camera moves, the renderer restarts\n updateCamActiveStatus();\n if(CAM_ACTIVE || UPDATE_PHYSICS){\n skylight.reset();\n }\n\n // update renderer\n skylight.update();\n \n\n // apply AntiAliasing\n smaa.apply(skylight.renderer.pg_render, pg_aa);\n \n // apply bloom\n if(APPLY_BLOOM){\n filter.bloom.param.mult = 0.15f; //map(mouseX, 0, width, 0, 1);\n filter.bloom.param.radius = 0.5f; // map(mouseY, 0, height, 0, 1);\n filter.bloom.apply(pg_aa, null, pg_aa);\n } \n \n // apply DoF\n if(APPLY_DOF){\n int mult_blur = 5;\n \n geombuffer.update(skylight.renderer.pg_render);\n \n filter.gaussblur.apply(geombuffer.pg_geom, geombuffer.pg_geom, pg_tmp, mult_blur);\n\n dof.param.focus_pos = new float[]{0.5f, 0.5f};\n// dof.param.focus_pos[0] = map(mouseX, 0, width , 0, 1);\n// dof.param.focus_pos[1] = 1-map(mouseY, 0, height, 0, 1);\n dof.param.mult_blur = mult_blur;\n dof.apply(pg_aa, pg_render, geombuffer);\n filter.copy.apply(pg_render, pg_aa);\n }\n \n // display result\n cam.beginHUD();\n {\n background(255);\n noLights();\n image(pg_aa, 0, 0);\n displayCross();\n displayHUD();\n }\n cam.endHUD();\n \n // info\n String txt_fps = String.format(getClass().getName()+ \" [fps %6.2f] [bodies %d]\", frameRate, physics.rigidBodies.size());\n surface.setTitle(txt_fps);\n }", "@Override\n \t\t\t\tpublic void doCreatePointLight() {\n \n \t\t\t\t}", "private void adjustLightFixture(World world, int i, int j, int k, Block block)\n\t{\n\t\tTessellator tess = Tessellator.instance;\n float brightness = block.getLightValue(world, i, j, k);\n int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);\n int modulousModifier = skyLight % 65536;\n int divModifier = skyLight / 65536;\n tess.setColorOpaque_F(brightness, brightness, brightness);\n OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);\n\t}", "public void addLightSource(Item lightSource) {\n/* 5374 */ if (lightSource.getTemplateId() == 1243)\n/* */ return; \n/* 5376 */ for (VirtualZone vz : getWatchers()) {\n/* */ \n/* */ \n/* */ try {\n/* 5380 */ if (lightSource.getColor() != -1)\n/* */ {\n/* 5382 */ int lightStrength = Math.max(WurmColor.getColorRed(lightSource.getColor()), \n/* 5383 */ WurmColor.getColorGreen(lightSource.getColor()));\n/* 5384 */ lightStrength = Math.max(lightStrength, WurmColor.getColorBlue(lightSource.getColor()));\n/* 5385 */ if (lightStrength == 0)\n/* 5386 */ lightStrength = 1; \n/* 5387 */ byte r = (byte)(WurmColor.getColorRed(lightSource.getColor()) * 128 / lightStrength);\n/* 5388 */ byte g = (byte)(WurmColor.getColorGreen(lightSource.getColor()) * 128 / lightStrength);\n/* 5389 */ byte b = (byte)(WurmColor.getColorBlue(lightSource.getColor()) * 128 / lightStrength);\n/* */ \n/* 5391 */ vz.sendAttachItemEffect(lightSource.getWurmId(), (byte)4, r, g, b, lightSource\n/* 5392 */ .getRadius());\n/* */ \n/* */ \n/* */ }\n/* 5396 */ else if (lightSource.isLightBright())\n/* */ {\n/* 5398 */ int lightStrength = (int)(80.0F + lightSource.getCurrentQualityLevel() / 100.0F * 40.0F);\n/* 5399 */ vz.sendAttachItemEffect(lightSource.getWurmId(), (byte)4, \n/* 5400 */ Item.getRLight(lightStrength), Item.getGLight(lightStrength), Item.getBLight(lightStrength), lightSource\n/* 5401 */ .getRadius());\n/* */ }\n/* */ else\n/* */ {\n/* 5405 */ vz.sendAttachItemEffect(lightSource.getWurmId(), (byte)4, (byte)80, (byte)80, (byte)80, lightSource\n/* 5406 */ .getRadius());\n/* */ }\n/* */ \n/* */ }\n/* 5410 */ catch (Exception e) {\n/* */ \n/* 5412 */ logger.log(Level.WARNING, e.getMessage(), e);\n/* */ } \n/* */ } \n/* */ }", "@Override\n \t\t\t\tpublic void doCreateDirectionalLight() {\n \n \t\t\t\t}", "public void renderLights()\r\n\t{\r\n\t\tlightHandler.render();\r\n\t}", "@Override\n public void render() {\n\n renderer.prepWindowRender(globalGameData.getGameWindow());\n renderer.setRenderSpace(0,0,500,500);\n\n\n renderEnvironment(getMainCamera(),testPlayer.getPlayerEntity().getEntityView().getViewableRegions(), instancedGridMesh);\n renderer.enableTransparency();\n walkieTalkie.render(renderer,renderer.getRenderWidth());\n renderer.disableTransparency();\n\n\n\n renderer.setRenderSpace(500,0,500,500);\n if (currentPlayers.containsKey(UUID.fromString(\"087954ba-2b12-4215-9a90-f7b810797562\"))) {\n renderEnvironment(getMainCamera(),currentPlayers.get(UUID.fromString(\"087954ba-2b12-4215-9a90-f7b810797562\")).getEntityView().getViewableRegions(), instancedGridMesh);\n }\n\n renderer.setRenderSpace(1000,0,500,500);\n renderer.enableTransparency();\n renderer.render2DTextItems(debugItems, \"Default2D\");\n renderer.disableTransparency();\n\n /*\n if (currentPlayers.containsKey(UUID.fromString(\"087954ba-2b12-4215-9a90-f7b810797562\"))) {\n renderer.setRenderSpace(500, 0, 500, 500);\n for (Region region : currentPlayers.get(UUID.fromString(\"087954ba-2b12-4215-9a90-f7b810797562\")).getEntityView().getViewableRegions()) {\n for (Block block : region.getBlocksArray()) {\n if (block instanceof CustomRenderBlock) {\n ((CustomRenderBlock) block).renderCustomBlock(renderer, camera);\n }\n }\n for (Entity entity : region.getEntities()) {\n entity.render(renderer, camera);\n }\n }\n }\n */\n\n\n //renderer.setRenderSpace(500,0,280,500);\n //SpriteItem spriteItem = new SpriteItem(AssetLoader.getTextureAsset(\"Noise\"),280,500,true);\n //spriteItem.setPosition(0,0,0);\n //renderer.render2DSpriteItem(spriteItem,\"Default2D\");\n //spriteItem.cleanup();\n\n\n\n /*\n renderer.getShader(\"DebugShader2D\").bind();\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, shaderTestBitmap.getId());\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, shaderTestEffect1.getId());\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, shaderTestEffect2.getId());\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, shaderTestEffect3.getId());\n renderer.getShader(\"DebugShader2D\").setUniform(\"bitmap\", 1);\n renderer.getShader(\"DebugShader2D\").setUniform(\"effect1\", 2);\n renderer.getShader(\"DebugShader2D\").setUniform(\"effect2\", 3);\n renderer.getShader(\"DebugShader2D\").setUniform(\"effect3\", 4);\n i++;\n i %= 600;\n float framePercent = i / 600.0f;\n renderer.getShader(\"DebugShader2D\").setUniform(\"frame\", framePercent);\n System.out.println(i);\n shaderTest.setPosition((float)gameInput.getMouseX(),(float)gameInput.getMouseY(),0);\n renderer.render2DSprite(shaderTest, \"DebugShader2D\");\n */\n\n\n\n\n\n }", "public static void setLightInfo()\n {\n for(int i = 0; i <= 19; i++)\n {\n lights.add(new Light());\n }\n\n //-----set position for all 15 lights-----\\\n //light1 -- middle light\n lights.get(0).setX(475);\n lights.get(0).setY(585);\n\n //--- left side --- \\\\\n\n //light2 - -\n lights.get(1).setX(350);\n lights.get(1).setY(570);\n\n //light3 - -\n lights.get(2).setX(230);\n lights.get(2).setY(530);\n\n //light4 - -\n lights.get(3).setX(130);\n lights.get(3).setY(470);\n\n //light5 - -\n lights.get(4).setX(110);\n lights.get(4).setY(410);\n\n //light6 - -\n lights.get(5).setX(165);\n lights.get(5).setY(370);\n\n //light7 - -\n lights.get(6).setX(230);\n lights.get(6).setY(350);\n\n //light8 - -\n lights.get(7).setX(290);\n lights.get(7).setY(340);\n\n //light9 - -\n lights.get(8).setX(355);\n lights.get(8).setY(337);\n\n //light10 - -\n lights.get(9).setX(420);\n lights.get(9).setY(336);\n\n\n //---- middle ----\\\\\n\n //light11 -\n lights.get(10).setX(485);\n lights.get(10).setY(335);\n\n //---- Right side of circle ----\\\\\n\n //light12 -\n lights.get(11).setX(540);\n lights.get(11).setY(336);\n\n //light13 -\n lights.get(12).setX(595);\n lights.get(12).setY(337);\n\n //light14 -\n lights.get(13).setX(655);\n lights.get(13).setY(340);\n\n //light15 -\n lights.get(14).setX(720);\n lights.get(14).setY(350);\n\n //light16 -\n lights.get(15).setX(785);\n lights.get(15).setY(370);\n\n //light17 -\n lights.get(16).setX(840);\n lights.get(16).setY(410);\n\n //light18 -\n lights.get(17).setX(820);\n lights.get(17).setY(470);\n\n //light19 -\n lights.get(18).setX(720);\n lights.get(18).setY(530);\n\n //light20 -\n lights.get(19).setX(600);\n lights.get(19).setY(570);\n\n }", "public void updateLighting() {\n\t\tint k;\n\t\tint i;\n\n\t\tfor (k=0; k<num_vobjects;k++) {\t\t\t// Loop through all the objects to be illuminated \n\t\t\t\n\t\t\tif ((vobject[k].potentially_visible) && (vobject[k].needs_lighting) ) {\n\t\t\t\tvobject[k].resetLighting();\n\t\t\t\tfor (i=0; i<num_vobjects;i++) {\t// Loop through all the light sources that can illuminate this object\n\t\t\t\t\tif (vobject[i].light_source) {\n\t\t\t\t\t\tvobject[k].addLightSource(vobject[i].abs_x_pos, vobject[i].abs_y_pos, vobject[i].abs_z_pos, vobject[i].light_red, vobject[i].light_green, vobject[i].light_blue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvobject[k].calculateAverageLighting();\n\t\t\t\tvobject[k].needs_lighting=false;\n\t\t\t}\n\t\t}\n\t}", "public void setLight1(){\n }", "@Override\r\n public void simpleUpdate(float tpf) {\r\n// if (firstload == true) {\r\n// MainGUI.Splash.setVisible(false);\r\n// MainGUI.mjf.setVisible(true);\r\n// }\r\n light1.setDirection(\r\n new Vector3f(\r\n cam.getDirection().x,\r\n cam.getDirection().y,\r\n cam.getDirection().z));\r\n\r\n if (GUI.shapeList.isEmpty()) {\r\n rootNode.detachAllChildren();\r\n drawAxis();\r\n }\r\n if(GUI.ShapeStack.getSelectedValue() == null && !GUI.shapeList.isEmpty())\r\n {\r\n rootNode.detachAllChildren();\r\n drawAxis();\r\n for(int ii = 0 ; ii < GUI.shapeList.size(); ii++)\r\n {\r\n Shape s = GUI.shapeList.get(ii);\r\n Geometry g = s.generateGraphics();\r\n Material m = new Material(assetManager,\r\n \"Common/MatDefs/Light/Lighting.j3md\");\r\n\r\n m.setBoolean(\"UseMaterialColors\", true);\r\n m.setColor(\"Diffuse\", ColorRGBA.LightGray);\r\n m.setColor(\"Specular\", ColorRGBA.LightGray);\r\n m.setFloat(\"Shininess\", 128); // [0,128]\r\n\r\n g.setMaterial(m);\r\n rootNode.attachChild(g); \r\n }\r\n }\r\n// com.jme3.scene.shape.Box boxMesh = new com.jme3.scene.shape.Box((float) 10 / 2, (float) 10 / 2, (float) 10 / 2);\r\n// Geometry boxGeo = new Geometry(\"Shiny rock\", boxMesh);\r\n// boxGeo.setLocalTranslation((float) 0, (float) 0, (float) 0);\r\n// TangentBinormalGenerator.generate(boxMesh);\r\n// Geometry g = boxGeo;\r\n// Material m = new Material(assetManager,\r\n// \"Common/MatDefs/Light/Lighting.j3md\");\r\n//\r\n// m.setBoolean(\"UseMaterialColors\", true);\r\n// m.setColor(\"Diffuse\", ColorRGBA.LightGray);\r\n// m.setColor(\"Specular\", ColorRGBA.LightGray);\r\n// m.setFloat(\"Shininess\", 128); // [0,128]\r\n//\r\n// g.setMaterial(m);\r\n// rootNode.attachChild(g);\r\n\r\n// if (MainGUI.ShapeJList.getSelectedValue() != null) {\r\n// rootNode.detachAllChildren();\r\n// drawAxis();\r\n// for (int i = 0; i < MainGUI.allShapes.size(); i++) {\r\n// Shape s = MainGUI.allShapes.get(i);\r\n// Geometry g = s.draw();\r\n// Material m = new Material(assetManager,\r\n// \"Common/MatDefs/Light/Lighting.j3md\");\r\n//\r\n// m.setBoolean(\"UseMaterialColors\", true);\r\n// m.setColor(\"Diffuse\", ColorRGBA.LightGray);\r\n// m.setColor(\"Specular\", ColorRGBA.LightGray);\r\n// m.setFloat(\"Shininess\", 128f); // [0,128]\r\n//\r\n// if (i == MainGUI.ShapeJList.getSelectedIndex()) {\r\n// m = new Material(assetManager,\r\n// \"Common/MatDefs/Light/Lighting.j3md\");\r\n//\r\n// m.setBoolean(\"UseMaterialColors\", true);\r\n// m.setColor(\"Diffuse\", ColorRGBA.Orange);\r\n// m.setColor(\"Specular\", ColorRGBA.Orange);\r\n// m.setFloat(\"Shininess\", 128f); // [0,128]\r\n//\r\n// }\r\n// g.setMaterial(m);\r\n// rootNode.attachChild(g);\r\n//\r\n// }\r\n// }\r\n// if (!MainGUI.allShapes.isEmpty() && MainGUI.ShapeJList.getSelectedValue() == null) {\r\n// rootNode.detachAllChildren();\r\n// drawAxis();\r\n// for (int i = 0; i < MainGUI.allShapes.size(); i++) {\r\n// Shape s = MainGUI.allShapes.get(i);\r\n// Geometry g = s.draw();\r\n// Material m = new Material(assetManager,\r\n// \"Common/MatDefs/Light/Lighting.j3md\");\r\n//\r\n// m.setBoolean(\"UseMaterialColors\", true);\r\n// m.setColor(\"Diffuse\", ColorRGBA.LightGray);\r\n// m.setColor(\"Specular\", ColorRGBA.LightGray);\r\n// m.setFloat(\"Shininess\", 128); // [0,128]\r\n//\r\n// g.setMaterial(m);\r\n// rootNode.attachChild(g);\r\n// }\r\n// }\r\n firstload = false;\r\n }", "public void onSurfaceCreated(GL2 gl) {\r\n gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);\r\n gl.glLoadIdentity();\r\n\r\n // Perspective\r\n final int width = SCREEN_WIDTH;\r\n final int height = SCREEN_HEIGHT;\r\n aspectRatio = (float) width / (float) height;\r\n glu.gluPerspective(camera.getOpeningAngle(), aspectRatio, nearClippingPlane, farClippingPlane);\r\n\r\n // Viewport\r\n gl.glViewport(0, 0, width, height);\r\n gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);\r\n\r\n // Depth\r\n gl.glEnable(GL2.GL_DEPTH_TEST);\r\n\r\n // which is the front? the one which is drawn counter clockwise\r\n gl.glFrontFace(GL2.GL_CCW);\r\n // which one should NOT be drawn\r\n gl.glCullFace(GL2.GL_BACK);\r\n\r\n // define the color we want to be displayed as the \"clipping wall\"\r\n gl.glClearColor((float) (CLEAR_COLOR.get(0)), (float) (CLEAR_COLOR.get(1)), (float) (CLEAR_COLOR.get(2)), OPAQUE);\r\n\r\n // Flat shading\r\n gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL);\r\n\r\n // Set a light, just use the first one from the root node.\r\n if (renderFrame != null && renderFrame.getRoot().getNumberOfLightSources() > 0) {\r\n LightSource lightSource = renderFrame.getRoot().getLightSource(0);\r\n float lightAmbient[] = { 1, 1, 1, 1 };\r\n float lightSpecular[] = { 1, 1, 1, 1 };\r\n float lightPosition[] = lightSource.getPosition().floatData();\r\n float lightDiffuse[] = lightSource.getColor().floatData();\r\n gl.glEnable(GL2.GL_LIGHT0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, lightAmbient, 0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, lightSpecular, 0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, lightDiffuse, 0);\r\n gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, lightPosition, 0);\r\n }\r\n\r\n updateView(gl);\r\n }", "public boolean hasLightWork() {\n/* 48 */ if (this.skyEngine != null && this.skyEngine.hasLightWork()) {\n/* 49 */ return true;\n/* */ }\n/* 51 */ return (this.blockEngine != null && this.blockEngine.hasLightWork());\n/* */ }", "private void renderGuiExtraLive (SpriteBatch batch)\n\t{\n\t\t//float x = cameraGUI.viewportWidth - 50 -\n\t\t//\t\tConstants.LIVES_START * 50;\n\t\t//float y = -15;\n\t\t//for (int i = 0; i < Constants.LIVES_START; i++)\n\t\t//{\n\t\t//\tif (worldController.lives <= i)\n\t\t//\t\tbatch.setColor(0.5f, 0.5f, 0.5f, 0.5f);\n\t\t//\tbatch.draw(Assets.instance.bird.character, \n\t\t//\t\t\tx + i * 50, y, 50, 50, 120, 100, 0.35f, -0.35f, 0);\n\t\t//\tbatch.setColor(1, 1, 1, 1);\n\t\t//}\n\t\t\n\t\tfloat x = cameraGUI.viewportWidth - 50 -\n\t\t\t\t1 * 50;\n\t\tfloat y = -15;\n\t\tfor (int i = 0; i < 1; i++)//Constants.LIVES_START; i++)\n\t\t{\n\t\t\tif (worldController.lives <= i)\n\t\t\t\tbatch.setColor(0.5f, 0.5f, 0.5f, 0.5f);\n\t\t\tbatch.draw(Assets.instance.bird.character, \n\t\t\t\t\tx + i * 50, y, 50, 50, 120, 100, 0.35f, -0.35f, 0);\n\t\t\tbatch.setColor(1, 1, 1, 1);\n\t\t}\n\t\tif (worldController.lives>= 0 &&worldController.livesVisual>worldController.lives) \n\t\t{ \n\t\t\t\n\t\t\tint i = worldController.lives;\n\t\t float alphaColor = Math.max(0, worldController.livesVisual- worldController.lives - 0.5f);\n\t\t float alphaScale = 0.35f * (2 + worldController.lives - worldController.livesVisual) * 2;\n\t\t float alphaRotate = -45 * alphaColor;\n\t\t batch.setColor(1.0f, 0.7f, 0.7f, alphaColor);\n\t\t batch.draw(Assets.instance.bird.character, x + i * 50, y, 50, 50, 120, 100, alphaScale, -alphaScale,alphaRotate);\n\t\t batch.setColor(1, 1, 1, 1);\n\t\t }\n\t}", "private static void turnFlashlightOn() {\n Parameters p = cam.getParameters();\n p.setFlashMode(Parameters.FLASH_MODE_TORCH);\n cam.setParameters(p);\n }", "private void setUp9SpheresScene() {\n camera = new Camera(\n new Point3D(0, 0, 9),\n new Point3D(0,0,0),\n new Point3D(0,1,0),\n Math.PI * 0.5, width, height\n );\n camera.moveForward(1.0);\n\n exposure = 1.0;\n ambientLight = new LightIntensity();\n ambientLight.red = 0.2;\n ambientLight.green = 0.2;\n ambientLight.blue = 0.2;\n\n lightSources.add(\n new LightSource(\n new LightIntensity(.7, .7, .7),\n new RectFace(\n new Point3D(-1.1, 9.99, -5.0),\n new Point3D(1.1, 9.99, -5.0),\n new Point3D(-1.1, 9.99, -6.0)\n )\n ));\n\n Material reflective = new Material();\n reflective.diffuseReflectivity.red = 0.2;\n reflective.diffuseReflectivity.green = 0.2;\n reflective.diffuseReflectivity.blue = 0.2;\n reflective.directReflectivity = LightIntensity.makeUniformRGB(0.5);\n\n Material glass = new Material();\n glass.diffuseReflectivity.red = 0.0;\n glass.diffuseReflectivity.green = 0.0;\n glass.diffuseReflectivity.blue = 0.0;\n glass.passthroughIntensity.red = 0.9;\n glass.passthroughIntensity.green = 0.9;\n glass.passthroughIntensity.blue = 0.9;\n glass.directReflectivity = LightIntensity.makeUniformRGB(0.1);\n glass.refractionIndex = 1.33;\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-9,0), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-9,0), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-9,0), 1), reflective));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-9,2), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-9,2), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-9,2), 1), glass));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-9,4), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-9,4), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-9,4), 1), reflective));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-6,0), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-6,0), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-6,0), 1), glass));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-6,2), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-6,2), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-6,2), 1), reflective));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-6,4), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-6,4), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-6,4), 1), glass));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-3,0), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-3,0), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-3,0), 1), reflective));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-3,2), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-3,2), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-3,2), 1), glass));\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(0,-3,4), 1), reflective));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-2,-3,4), 1), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-4,-3,4), 1), reflective));\n\n Box boundingBox = new Box(\n new Point3D(-10,10, 10),\n new Point3D(-10,10, -10),\n new Point3D(10,10, 10),\n new Point3D(-10,-10, 10)\n );\n\n Material leftWallMaterial = new Material();\n leftWallMaterial.diffuseReflectivity = new LightIntensity(.7,.7, 0.3);\n leftWallMaterial.directReflectivity = LightIntensity.makeUniformRGB(.3);\n\n Material rightWallMaterial = new Material();\n rightWallMaterial.diffuseReflectivity = new LightIntensity(.7,0.3, .7);\n rightWallMaterial.directReflectivity = LightIntensity.makeUniformRGB(.3);\n\n Material frontWallMaterial = new Material();\n frontWallMaterial.diffuseReflectivity = new LightIntensity(0.3,0.3, 0.3);\n frontWallMaterial.directReflectivity = LightIntensity.makeUniformRGB(.3);\n\n Material backWallMaterial = new Material();\n backWallMaterial.diffuseReflectivity = new LightIntensity(.7,0.3, 0.3);\n backWallMaterial.directReflectivity = LightIntensity.makeUniformRGB(.3);\n\n Material topWallMaterial = new Material();\n topWallMaterial.diffuseReflectivity = new LightIntensity(.7,.7, .7);\n topWallMaterial.directReflectivity = LightIntensity.makeUniformRGB(.3);\n\n Material bottomWallMaterial = new Material();\n bottomWallMaterial.diffuseReflectivity = new LightIntensity(.7,.7, .7);\n bottomWallMaterial.directReflectivity = LightIntensity.makeUniformRGB(.3);\n\n try {\n bottomWallMaterial.texture = ImageIO.read(new File(\"C:\\\\Class_work\\\\checkerboard.png\"));\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n solids.add(new RectFace.FaceSolid(boundingBox.left, leftWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.right, rightWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.front, frontWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.back, backWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.top, topWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.bottom, bottomWallMaterial));\n }", "public void setStaticLight(boolean staticLight);", "public void renderWorldBlock(bbb renderblocks, ym iba, int i, int j, int k, int md)\r\n/* 26: */ {\r\n/* 27: 26 */ int cons = 0;\r\n/* 28: 27 */ TilePipe tt = (TilePipe)CoreLib.getTileEntity(iba, i, j, k, TilePipe.class);\r\n/* 29: 29 */ if (tt == null) {\r\n/* 30: 29 */ return;\r\n/* 31: */ }\r\n/* 32: 31 */ this.context.exactTextureCoordinates = true;\r\n/* 33: 32 */ this.context.setTexFlags(55);\r\n/* 34: 33 */ this.context.setTint(1.0F, 1.0F, 1.0F);\r\n/* 35: 34 */ this.context.setPos(i, j, k);\r\n/* 36: 35 */ if (tt.CoverSides > 0)\r\n/* 37: */ {\r\n/* 38: 36 */ this.context.readGlobalLights(iba, i, j, k);\r\n/* 39: 37 */ renderCovers(tt.CoverSides, tt.Covers);\r\n/* 40: */ }\r\n/* 41: 40 */ cons = PipeLib.getConnections(iba, i, j, k);\r\n/* 42: */ \r\n/* 43: */ \r\n/* 44: */ \r\n/* 45: 44 */ this.context.setBrightness(this.block.e(iba, i, j, k));\r\n/* 46: */ \r\n/* 47: 46 */ this.context.setLocalLights(0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F);\r\n/* 48: 47 */ this.context.setPos(i, j, k);\r\n/* 49: */ \r\n/* 50: 49 */ RenderLib.bindTexture(\"/eloraam/machine/machine1.png\");\r\n/* 51: */ \r\n/* 52: */ \r\n/* 53: */ \r\n/* 54: */ \r\n/* 55: */ \r\n/* 56: */ \r\n/* 57: */ \r\n/* 58: */ \r\n/* 59: */ \r\n/* 60: */ \r\n/* 61: */ \r\n/* 62: */ \r\n/* 63: */ \r\n/* 64: 63 */ renderCenterBlock(cons, 26, 28);\r\n/* 65: */ \r\n/* 66: 65 */ tt.cacheFlange();\r\n/* 67: 66 */ renderFlanges(tt.Flanges, 27);\r\n/* 68: */ \r\n/* 69: 68 */ RenderLib.unbindTexture();\r\n/* 70: */ }", "private void toggleLight(){\n\t\tmyGLView.queueEvent(new Runnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tmRenderer.toggleLight();\n\t\t\t}\n\t\t});\n\t\t\n\t}", "public void lookThrough()\r\n {\r\n //rotate the pitch around the X axis\r\n glRotatef(pitch, 1.0f, 0.0f, 0.0f);\r\n //rotate the yaw around the Y axis\r\n glRotatef(yaw, 0.0f, 1.0f, 0.0f);\r\n //translate to the position vector's location\r\n glTranslatef(position.x, position.y, position.z);\r\n \r\n FloatBuffer lightPosition = BufferUtils.createFloatBuffer(4);\r\n lightPosition.put(lPosition.x).put(\r\n lPosition.y).put(lPosition.z).put(1.0f).flip();\r\n glLight(GL_LIGHT0, GL_POSITION, lightPosition);\r\n }", "@Override\n\tpublic void render(Entity camera, Graphics graphics, EntityManager entityManager)\n\t{\n\t\tgraphics.bindFrameBuffer(frameBuffer);\n\t\tgraphics.setViewport(0, 0, colorBuffer.getTexture().width(), colorBuffer.getTexture().height());\n\t\tgraphics.drawBuffers(colorBuffer, depthBuffer);\n\t\n\t\tgraphics.setClearColor(0.0f, 0.1f, 0.12f, 0.0f);\n\t\tgraphics.clearBuffers();\n\t\t\n\t\tdrawShader.bind(graphics);\n\n\t\tGL11.glEnable(GL11.GL_DEPTH_TEST);\n\t\tGL11.glDepthFunc(GL11.GL_LESS);\n\t\tGL11.glEnable(GL11.GL_CULL_FACE);\n\t\tGL11.glCullFace(GL11.GL_BACK);\n\t\tGL11.glEnable(GL11.GL_BLEND);\n\t\tGL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);\n\t\t\n\t\t// View-Perspective\n\t\t\n\t\tCameraComponent cameraComponent = camera.getComponent(PerspectiveCameraComponent.class);\n\t\tTransformComponent cameraTransform = camera.getComponent(TransformComponent.class);\n\t\t\n\t\tMatrix4f view = cameraTransform.getViewMatrix();\n\t\tMatrix4f perspective = cameraComponent.projection;\n\t\tMatrix4f model = new Matrix4f();\n\t\t\n\t\tUniform modelUniform = graphics.getUniform(drawShader, \"model\");\n\n\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"cameraPosition\"), cameraTransform.position);\n\t\t\n\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"ambientColor\"), new Vector3f(1.0f, 1.0f, 1.0f));\n\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"ambientIntensity\"), 0.0f);\n\t\t\n\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"view\"), view);\n\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"perspective\"), perspective);\n\t\t\n\t\t// Directional Lights\n\t\t\n\t\tIterator<Long> dirLightEntityIterator = entityManager.getComponentTable().getEntityIterator(DirectionalLightComponent.class);\n\t\t\n\t\tif(dirLightEntityIterator != null)\n\t\t{\n\t\t\tint dirLightCount = 0;\n\t\t\twhile(dirLightEntityIterator.hasNext())\n\t\t\t{\n\t\t\t\tLong entityID = dirLightEntityIterator.next();\n\t\t\t\t\n\t\t\t\tDirectionalLightComponent dirLight = entityManager.getComponent(DirectionalLightComponent.class, entityID);\n\t\t\t\t\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"dirLights[\" + dirLightCount + \"].direction\"), dirLight.direction);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"dirLights[\" + dirLightCount + \"].color\"), dirLight.color);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"dirLights[\" + dirLightCount + \"].intensity\"), dirLight.intensity);\n\t\t\t\t\n\t\t\t\tdirLightCount++;\n\t\t\t}\n\t\t\t\n\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"dirLightCount\"), dirLightCount);\n\t\t}\n\t\t\n\t\t// Spot Lights\n\t\t\n\t\tIterator<Long> spotLightEntityIterator = entityManager.getComponentTable().getEntityIterator(SpotLightComponent.class);\n\t\n\t\tif(spotLightEntityIterator != null)\n\t\t{\n\t\t\tint spotLightCount = 0;\n\t\t\twhile(spotLightEntityIterator.hasNext())\n\t\t\t{\n\t\t\t\tLong entityID = spotLightEntityIterator.next();\n\t\t\t\t\n\t\t\t\tSpotLightComponent spotLight = entityManager.getComponent(SpotLightComponent.class, entityID);\n\t\t\t\tTransformComponent tansform = entityManager.getComponent(TransformComponent.class, entityID);\n\t\t\t\t\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLights[\" + spotLightCount + \"].position\"), tansform.position);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLights[\" + spotLightCount + \"].direction\"), spotLight.direction);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLights[\" + spotLightCount + \"].attenuation\"), spotLight.attenuation);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLights[\" + spotLightCount + \"].color\"), spotLight.color);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLights[\" + spotLightCount + \"].radius\"), spotLight.radius);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLights[\" + spotLightCount + \"].intensity\"), spotLight.intensity);\n\t\t\t\t\n\t\t\t\tspotLightCount++;\n\t\t\t}\n\t\t\t\n\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"spotLightCount\"), spotLightCount);\n\t\t}\n\t\t\n\t\t// Point Lights\n\t\t\n\t\tIterator<Long> pointLightEntityIterator = entityManager.getComponentTable().getEntityIterator(PointLightComponent.class);\n\t\n\t\tif(pointLightEntityIterator != null)\n\t\t{\n\t\t\tint pointLightCount = 0;\n\t\t\twhile(pointLightEntityIterator.hasNext())\n\t\t\t{\n\t\t\t\tLong entityID = pointLightEntityIterator.next();\n\t\t\t\t\n\t\t\t\tPointLightComponent pointLight = entityManager.getComponent(PointLightComponent.class, entityID);\n\t\t\t\tTransformComponent tansform = entityManager.getComponent(TransformComponent.class, entityID);\n\t\t\t\t\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"pointLights[\" + pointLightCount + \"].position\"), tansform.position);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"pointLights[\" + pointLightCount + \"].attenuation\"), pointLight.attenuation);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"pointLights[\" + pointLightCount + \"].color\"), pointLight.color);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"pointLights[\" + pointLightCount + \"].intensity\"), pointLight.intensity);\n\t\t\t\t\n\t\t\t\tpointLightCount++;\n\t\t\t}\n\t\t\t\n\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"pointLightCount\"), pointLightCount);\n\t\t}\n\t\t\n\t\t// Render Entities\n\t\t\n\t\tIterator<Long> iterator = entityManager.getComponentTable().getEntityIterator(PhongRenderComponent.class);\n\t\t\n\t\twhile(iterator.hasNext())\n\t\t{\n\t\t\tlong entityID = iterator.next();\n\t\t\t\n\t\t\t// Material\n\t\t\t\n\t\t\tPhongMaterialComponent materialComponent = entityManager.getComponent(PhongMaterialComponent.class, entityID);\n//\n//\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.diffuse\"), 0);\n//\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.normal\"), 1);\n//\t\t\t\n//\t\t\tgraphics.setActiveTextureSlot(0);\n//\t\t\tgraphics.bindTexture(material.diffuse);\n//\t\t\t\n//\t\t\tgraphics.setActiveTextureSlot(1);\n//\t\t\tgraphics.bindTexture(material.normal);\n//\t\t\t\n//\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.intensity\"), material.intensity);\n//\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.exponent\"), material.exponent);\n\t\t\t\n\t\t\t// Mesh\n\t\t\t\n\t\t\tTransformComponent \t\ttransform \t= entityManager.getComponent(TransformComponent.class, entityID);\n\t\t\tModelComponent \t\t\tmesh \t\t= entityManager.getComponent(ModelComponent.class, entityID);\n\t\t\t\n\t\t\ttransform.getModelMatrix(model);\n\t\t\tgraphics.setUniform(modelUniform, model);\n\t\t\t\n\t\t\t\n\t\t\tTexture diffuseTexture = null;\n\t\t\tTexture normalTexture = null;\n\t\t\tfloat specularExponent = 0.0f;\n\t\t\tfloat specularIntensity = 0.0f;\n\t\t\t\n\t\t\t// Draw sub-meshes\n\t\t\t\n\t\t\tfor(Mesh subMesh : mesh.model.meshes)\n\t\t\t{\n\t\t\t\tgraphics.bindBuffer(subMesh.vertexBuffer);\n\t\t\t\tgraphics.bindBuffer(subMesh.indexBuffer);\n\t\t\t\t\n\t\t\t\t// Attribute Layout\n\t\t\t\t// TODO: investigate moving to begin()\n\t\t\t\t\n\t\t\t\tGL20.glEnableVertexAttribArray(0);\t// Position\n\t\t\t\tGL20.glEnableVertexAttribArray(1); // TexCoord\n\t\t\t\tGL20.glEnableVertexAttribArray(2); // Normal\n\t\t\t\tGL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 8 * Float.BYTES, 0);\n\t\t\t\tGL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 8 * Float.BYTES, 3 * Float.BYTES);\n\t\t\t\tGL20.glVertexAttribPointer(2, 3, GL11.GL_FLOAT, false, 8 * Float.BYTES, 5 * Float.BYTES);\n\t\t\t\t\n\t\t\t\tMaterial material = subMesh.material;\n\t\t\t\t\n\t\t\t\tif(material == null || material.diffuse == null)\n\t\t\t\t\tdiffuseTexture = materialComponent.diffuse;\n\t\t\t\telse\n\t\t\t\t\tdiffuseTexture = material.diffuse;\n\t\t\t\t\t\n\t\t\t\tif(material == null || material.normal == null)\n\t\t\t\t\tnormalTexture = materialComponent.normal;\n\t\t\t\telse\n\t\t\t\t\tnormalTexture = material.normal;\n\t\t\t\t\n\t\t\t\tif(material == null)\n\t\t\t\t\tspecularExponent = materialComponent.exponent;\n\t\t\t\telse\n\t\t\t\t\tspecularExponent = material.exponent;\n\t\t\t\t\n\t\t\t\tif(material == null)\n\t\t\t\t\tspecularIntensity = materialComponent.intensity;\n\t\t\t\telse\n\t\t\t\t\tspecularIntensity = material.intensity;\n\t\t\t\t\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.diffuse\"), 0);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.normal\"), 1);\n\t\t\t\t\n\t\t\t\tgraphics.setActiveTextureSlot(0);\n\t\t\t\tgraphics.bindTexture(diffuseTexture);\n\t\t\t\t\n\t\t\t\tgraphics.setActiveTextureSlot(1);\n\t\t\t\tgraphics.bindTexture(normalTexture);\n\t\t\t\t\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.intensity\"), specularIntensity);\n\t\t\t\tgraphics.setUniform(graphics.getUniform(drawShader, \"material.exponent\"), specularExponent);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tgraphics.drawElements(DrawMode.TRIANGLES, subMesh.indexSize);\n\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tdrawShader.unbind(graphics);\n\t\t\n\t\tgraphics.unbindFrameBuffer();\n\t\t\n\t\tgraphics.setViewport(0, 0, window.getWidth(), window.getHeight());\n\t\tgraphics.setClearColor(0.0f, 1.0f, 1.0f, 1.0f);\n\t\tgraphics.clearBuffers();\n\n\t\tGL11.glDisable(GL11.GL_DEPTH_TEST);\n\t\tGL11.glDisable(GL11.GL_CULL_FACE);\n\t\tGL11.glDisable(GL11.GL_BLEND);\n\t\t\n\t\t// Render quad\n\t\t\n\t\tquadShader.bind(graphics);\n\t\t\n\t\tgraphics.bindBuffer(renderQuadVBO);\n\t\tgraphics.bindBuffer(renderQuadIBO);\n\t\t\n\t\tGL20.glDisableVertexAttribArray(2);\n\t\tGL20.glDisableVertexAttribArray(3);\n\t\tGL20.glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, 4 * Float.BYTES, 0);\n\t\tGL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 4 * Float.BYTES, 2 * Float.BYTES);\n\t\t\n\t\tgraphics.setActiveTextureSlot(0);\n\t\tgraphics.bindTexture(colorBuffer.getTexture());\n\t\t\n\t\tgraphics.drawElements(DrawMode.TRIANGLES, 6);\n\t\t\n\t\tquadShader.unbind(graphics);\n\t}", "private void lightOn(Map<Light, Matrix4f> lights) {\n numLight = 0;\n GL3 gl = glContext.getGL().getGL3();\n FloatBuffer fb4 = Buffers.newDirectFloatBuffer(4);\n LightLocation lightLoc = new LightLocation();\n for (Entry<Light, Matrix4f> entry : lights.entrySet()) {\n Light light = entry.getKey();\n Matrix4f lightTransForm = entry.getValue();\n Vector4f lightPosition = lightTransForm.transform(new Vector4f(light.getPosition()));\n Vector4f lightDirection = lightTransForm.transform(new Vector4f(light.getSpotDirection()));\n String lightName = \"light[\" + numLight + \"]\";\n lightLoc.position = shaderLocations.getLocation(lightName + \".position\");\n lightLoc.ambient = shaderLocations.getLocation(lightName + \".ambient\");\n lightLoc.diffuse = shaderLocations.getLocation(lightName + \".diffuse\");\n lightLoc.specular = shaderLocations.getLocation(lightName + \".specular\");\n lightLoc.direction = shaderLocations.getLocation(lightName + \".direction\");\n lightLoc.cutOff = shaderLocations.getLocation(lightName + \".cutOff\");\n\n gl.glUniform4fv(lightLoc.position, 1, lightPosition.get(fb4));\n gl.glUniform3fv(lightLoc.ambient, 1, light.getAmbient().get(fb4));\n gl.glUniform3fv(lightLoc.diffuse, 1, light.getDiffuse().get(fb4));\n gl.glUniform3fv(lightLoc.specular, 1, light.getSpecular().get(fb4));\n gl.glUniform4fv(lightLoc.direction, 1, lightDirection.get(fb4));\n gl.glUniform1f(lightLoc.cutOff, light.getSpotCutoff());\n numLight++;\n }\n gl.glUniform1i(shaderLocations.getLocation(\"numLights\"), numLight);\n }", "private void updatePointLight() {\n\t\tfloat light1_position[] = { player.getPosition().x, 0.0f, player.getPosition().z, 1.0f }; // x,y,z,1\n\t\tfloat light1_diff_spec[] = { 1f, 1f, 1f, 1.0f };\n\t\t\n\t\t// Eine weitere Lichtquellen definieren\n\t\tpointLight.setPosition(light1_position);\n\t\tpointLight.setDiffAndSpek(light1_diff_spec);\n\t\t\n\t\tglEnable(GL_LIGHTING);\n\t}", "@Override\r\n\tprotected void render(Renderer renderer) {\n\t\trenderer.disableLighting();\r\n\t\trenderer.render(sun, camera);\r\n\t\t\r\n\t\t// Enable lighting and set the sun as the light source so\r\n\t\t// that the planets are lit by subsequent render calls\r\n\t\trenderer.enableLighting();\r\n\t\trenderer.setLightSource(sun);\r\n\t\t\r\n\t\tfor (Entity planet : planets) {\r\n\t\t\trenderer.render(planet, camera);\r\n\t\t}\r\n\t\t\r\n\t}", "private void generateShadowVolumeStencil() {\n\t\tGL11.glColorMask(false, false, false, false);\n\t\tGL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT\n\t\t\t\t| GL11.GL_STENCIL_BUFFER_BIT);\n\t\tfor (PhysicsEntity<? extends RenderEntity> e : entities) {\n\t\t\tRenderEntity re = e.getWorldEntity();\n\t\t\tre.render(passThruContext);\n\t\t}\n\n\t\t// PERFORM STENCIL TEST OF OBJECTS THAT CAST SHADOWS\n\t\tGL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);\n\t\tGL11.glEnable(GL11.GL_STENCIL_TEST);\n\t\tGL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xff);\n\t\tGL11.glEnable(GL11.GL_DEPTH_TEST);\n\t\tGL11.glDepthFunc(GL11.GL_LESS);\n\t\tGL11.glDepthMask(false);\n\t\tGL11.glEnable(GL11.GL_CULL_FACE);\n\n\t\t// pass 1 frontface culling\n\t\tGL11.glCullFace(GL11.GL_BACK);\n\t\tGL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_INCR);\n\n\t\tfor (PhysicsEntity<? extends RenderEntity> e : entities) {\n\t\t\tRenderEntity re = e.getWorldEntity();\n\t\t\tif (re.castShadows) {\n\t\t\t\tre.render(volumeShadowContext);\n\t\t\t}\n\t\t}\n\n\t\t// pass 2 backface culling\n\t\tGL11.glCullFace(GL11.GL_FRONT);\n\t\tGL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_DECR);\n\t\tfor (PhysicsEntity<? extends RenderEntity> e : entities) {\n\t\t\tRenderEntity re = e.getWorldEntity();\n\t\t\tif (re.castShadows) {\n\t\t\t\tre.render(volumeShadowContext);\n\t\t\t}\n\t\t}\n\t}", "protected void doLessLight() {\r\n\t\talpha = Math.max(0, alpha - 0.05f);\r\n\t\tsetAlphaOnTiles();\r\n\t\trepaint();\r\n\t}", "@FXML\n\tprivate void desligarLuz(){\n\t boxEntity.setEffect(new Lighting()); \n\t\t\n\t\t\n\t\t\n\t}", "private void updateSpotLight() {\n\t\tfloat light0_position[] = { player.getPosition().x, 16.0f, player.getPosition().z, 1.0f }; // x,y,z,1\n\t\tfloat light0_diff_spec[] = { 1f, 1f, 1f, 1.0f };\n\t\tfloat light0_direction[] = {-(float)Math.sin(Math.toRadians(player.getRotY())),0,-(float)Math.cos(Math.toRadians(player.getRotY())), 1f};\n\t\t// Eine weitere Lichtquellen definieren\n\t\tspotLight.setPosition(light0_position);\n\t\tspotLight.setCutoff(45.f);\n\t\tspotLight.setDirection(light0_direction);\n\t\tspotLight.setDiffAndSpek(light0_diff_spec);\n\t\t\n\t\tglEnable(GL_LIGHTING);\n\t}", "private void initLighting() {\n\t\t\n\t\t\n\t\tfloat lmodel_ambient[] = { 1f, 1f, 1f, 1.0f };\n\t\t// Hintergrundbeleuchtung definieren\n\t\tglLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);\n\n\t\t// Eine weitere Lichtquellen definieren\n\t\t\n\t\tglEnable(GL_LIGHTING);\n\n\t\tspotLight.turnLightOn();\n\t\tpointLight.turnLightOn();\n\t}", "private static void doModify3DAttributes(Home home,\n int groundColor, \n HomeTexture groundTexture, \n int skyColor, \n HomeTexture skyTexture, int lightColor, \n float wallsAlpha) {\n HomeEnvironment homeEnvironment = home.getEnvironment();\n homeEnvironment.setGroundColor(groundColor);\n homeEnvironment.setGroundTexture(groundTexture);\n homeEnvironment.setSkyColor(skyColor);\n homeEnvironment.setSkyTexture(skyTexture);\n homeEnvironment.setLightColor(lightColor);\n homeEnvironment.setWallsAlpha(wallsAlpha);\n }", "private void initSun(){\n sun = new DirectionalLight();\n sun.setDirection(lightDir);\n sun.setColor(ColorRGBA.White.clone().multLocal(1.7f));\n rootNode.addLight(sun);\n \n }", "protected void doMoreLight() {\r\n\t\talpha = Math.min(1f, alpha + 0.05f);;\r\n\t\tsetAlphaOnTiles();\r\n\t\trepaint();\r\n\t}", "public void WorldRender() {\n\t\t int BlockX = (int) (Camera.CameraX/Game.TileSize);\n\t\t int BlockY = (int) (Camera.CameraY/Game.TileSize);\n\t\t \n\t\t //Tile.sky.draw(0, 0, Display.getWidth(), Display.getHeight());\n\t\t //Tile.voidBlock.startUse();\n\t\t for(int l = 0; l < this.worldLayers.size(); l++) {\n\t\t\t for(int x = BlockX; x < BlockX + Game.DisplayXBlk; x++) {\n\t\t\t\t for(int y = BlockY; y < BlockY + Game.DisplayYBlk; y++) {\n\t\t\t\t\t //try {\n\t\t\t\t\t //Tile.requestTiles(worldLayers.get(l).getBlock(x, y).id);\n\t\t\t\t\t //} catch (Exception e) { }\n\t\t\t\t\t \n\t\t\t\t\t worldLayers.get(l).renderBlock(x, y);\n\t\t\t\t\t \n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t //Tile.voidBlock.endUse();\n\t }", "public void draw() {\n /* put graphical code here, runs repeatedly at defined framerate in setup, else default at 60fps: */\n if (renderingForce == false) {\n background(255); \n //imageMode(CORNERS);\n image(outputSplat, 0, 0);\n world.draw();\n checkChangeColor();\n }\n}", "public void render() {\n\t\tRenderUtil.clearScreen();\n\t\t\n\t\tEntityShader.getInstance().updateLights(testLight);\n\t\t\n\t\ttestLight.render();\n\t\t\n\t\tsky.render();\n\t\t\t\t\n\t\ttestEntity.render();\t\t\n\t\ttestEntity2.render();\n\t\t\t\t\n\t\tSystem.out.println(\"Entity: \" + testEntity.getPositon().toString());\n\t\tSystem.out.println(\"Camera: \" + Camera.getInstance().getPosition().toString());\n\t\tSystem.out.println(\"Look: \" + Camera.getInstance().getForward().toString());\n\t\tSystem.out.println(\"Light: \" + testLight.getPosition().toString());\n\t\twindow.render();\n\t}", "private void createLights(TiledMap map)\r\n\t{\r\n\t\tlightLayer = map.getLayers().get(\"Lights\").getObjects();\r\n\r\n\t\tfor (int count = 0; count < lightLayer.getCount(); count++)\r\n\t\t{\r\n\t\t\tRectangleMapObject obj = (RectangleMapObject) lightLayer.get(count);\r\n\r\n\t\t\tnew PointLight(lightHandler, 10, Color.WHITE, 30,\r\n\t\t\t\t\tobj.getRectangle().x / Constants.BOX_SCALE,\r\n\t\t\t\t\tobj.getRectangle().y / Constants.BOX_SCALE);\r\n\t\t}\r\n\t}", "public boolean isStaticLight();", "@Override\n public void onWorldRender(RenderEvent event) {\n GlStateManager.pushMatrix();\n mc.world.playerEntities.stream().filter(entityPlayer -> entityPlayer != mc.player).forEach(Chams::drawEntityOutline);\n mc.world.loadedEntityList.stream().filter(entity -> EntityUtil.isLiving(entity) && entity != mc.player).forEach(Chams::drawEntityOutline);\n// entityFBO.unbindFramebuffer();\n GlStateManager.popMatrix();\n// mc.getFramebuffer().bindFramebuffer(true);\n\n// entityFBO.framebufferRenderExt(mc.displayWidth, mc.displayHeight, false);\n\n GlStateManager.color(1,1,1);\n GlStateManager.enableBlend();\n }", "public ShadowMap() throws Exception{\n // Create a FBO to render the depth map\n depthMapFBO = glGenFramebuffers();\n\n // Create the depth map texture\n depthMap = new Texture(SHADOW_MAP_WIDTH, SHADOW_MAP_HEIGHT, GL_DEPTH_COMPONENT);\n\n // Attach the the depth map texture to the FBO\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap.getId(), 0);\n // Set only depth\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n\n if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE){\n throw new Exception(\"Could not create FrameBuffer\");\n }\n\n // Unbind\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n }", "private void setUp2SpheresScene() {\n camera = new Camera(\n new Point3D(0, 0, 9),\n new Point3D(0,0,0),\n new Point3D(0,1,0),\n Math.PI * 0.5, width, height\n );\n camera.moveForward(1.0);\n\n exposure = 1.0;\n ambientLight = new LightIntensity();\n ambientLight.red = 0.2;\n ambientLight.green = 0.2;\n ambientLight.blue = 0.2;\n\n lightSources.add(\n new LightSource(\n new LightIntensity(.7, .7, .3),\n new RectFace(\n new Point3D(-1.1, 9.99, -5.0),\n new Point3D(1.1, 9.99, -5.0),\n new Point3D(-1.1, 9.99, -6.1)\n )\n ));\n\n lightSources.add(\n new LightSource(\n new LightIntensity(.4, .3, .7),\n new RectFace(\n new Point3D(-4.1, 2.99, -5.0),\n new Point3D(-2.9, 2.99, -5.0),\n new Point3D(-4.1, 2.99, -6.1)\n )\n ));\n\n Material reflective = new Material();\n reflective.diffuseReflectivity.red = 0.2;\n reflective.diffuseReflectivity.green = 0.2;\n reflective.diffuseReflectivity.blue = 0.2;\n reflective.directReflectivity = LightIntensity.makeUniformRGB(0.5);\n\n Material glass = new Material();\n glass.diffuseReflectivity.red = 0.0;\n glass.diffuseReflectivity.green = 0.0;\n glass.diffuseReflectivity.blue = 0.0;\n glass.passthroughIntensity.red = 0.9;\n glass.passthroughIntensity.green = 0.9;\n glass.passthroughIntensity.blue = 0.9;\n glass.directReflectivity = LightIntensity.makeUniformRGB(0.1);\n glass.refractionIndex = 1.33;\n\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(-5, -3, -5), 2.5), glass));\n solids.add(new Sphere.SphereSolid(new Sphere(new Point3D(5, -3, -5), 2.5), new Material()));\n\n Box boundingBox = new Box(\n new Point3D(-10,10, 10),\n new Point3D(-10,10, -10),\n new Point3D(10,10, 10),\n new Point3D(-10,-10, 10)\n );\n\n Material leftWallMaterial = new Material();\n leftWallMaterial.diffuseReflectivity = new LightIntensity(.7,.7, 0.3);\n\n Material rightWallMaterial = new Material();\n rightWallMaterial.diffuseReflectivity = new LightIntensity(.7,0.3, .7);\n\n Material frontWallMaterial = new Material();\n frontWallMaterial.diffuseReflectivity = new LightIntensity(0.3,0.3, 0.3);\n\n Material backWallMaterial = new Material();\n backWallMaterial.diffuseReflectivity = new LightIntensity(.7,0.3, 0.3);\n\n Material topWallMaterial = new Material();\n topWallMaterial.diffuseReflectivity = new LightIntensity(.7,.7, .7);\n\n Material bottomWallMaterial = new Material();\n bottomWallMaterial.diffuseReflectivity = new LightIntensity(.7,.7, .7);\n\n try {\n bottomWallMaterial.texture = ImageIO.read(new File(\"C:\\\\Class_work\\\\checkerboard.png\"));\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n solids.add(new RectFace.FaceSolid(boundingBox.left, leftWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.right, rightWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.front, frontWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.back, backWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.top, topWallMaterial));\n solids.add(new RectFace.FaceSolid(boundingBox.bottom, bottomWallMaterial));\n }", "public void onLivingUpdate()\n {\n if (this.worldObj.isDaytime() && !this.worldObj.isRemote && !this.isChild())\n {\n float var1 = this.getBrightness(100.0F);\n\n if (var1 > 0.5F && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))\n {\n boolean var2 = true;\n ItemStack var3 = this.getEquipmentInSlot(4);\n\n if (var3 != null)\n {\n if (var3.isItemStackDamageable())\n {\n var3.setItemDamage(var3.getItemDamageForDisplay() + this.rand.nextInt(2));\n\n if (var3.getItemDamageForDisplay() >= var3.getMaxDamage())\n {\n this.renderBrokenItemStack(var3);\n this.setCurrentItemOrArmor(4, (ItemStack)null);\n }\n }\n\n var2 = false;\n }\n\n if (var2)\n {\n this.setFire(-99);\n }\n }\n }\n\n super.onLivingUpdate();\n }", "public void renderLoop() {\n\t\tplayer.move(calculateVectorDirectionBetweenEyeAndCenter());\n\t\tcamera.move();\n\t\tm.setLookAt(camera.getPosition().x,\n\t\t\t\tcamera.getPosition().y + 10,\n\t\t\t\tcamera.getPosition().z,\n\t\t\t\tplayer.getPosition().x,\n\t\t\t\tplayer.getPosition().y + 10,\n\t\t\t\tplayer.getPosition().z,\n\t\t\t\tcalculateUpVectorOfCameraPosition(secondOrthogonalVector).x,\n\t\t\t\tcalculateUpVectorOfCameraPosition(secondOrthogonalVector).y,\n\t\t\t\tcalculateUpVectorOfCameraPosition(secondOrthogonalVector).z);\n\t\tm.get(fb);\n\n\t\tglLoadMatrixf(fb);\n\t\t\n\t\tglPushMatrix();\n\t\t\tupdateSpotLight();\n\t\t\tupdatePointLight();\n\t\tglPopMatrix();\n\t\t\n\t\tglPushMatrix();\n\t\t\tglPolygonMode(GL_BACK, GL_FILL);\n\t\t\tglPolygonMode(GL_FRONT, GL_POINT);\n\t\t\tterrain.generateCave();\n\t\tglPopMatrix();\n\t\t\n\t\tglPushMatrix();\n\t\t\tglPolygonMode(GL_FRONT, GL_FILL);\n\t\t\tterrain.generateGround();\n\t\tglPopMatrix();\n\n\t\tglPushMatrix();\n\t\t\tterrain.drawEnd();\n\t\tglPopMatrix();\n\t\t\n\t\tglPushMatrix();\n\t\t\tglTranslatef(player.getPosition().x, player.getPosition().y, player.getPosition().z);\n\t\t\tglRotatef(player.getRotY(), 0, 1, 0);\n\t\t\tplayer.getModel().draw(player.getMoveAngle());\n\t\tglPopMatrix();\n\t}", "public LightShot(AbstractGame world) {\n super(world);\n innerColor = Color.WHITE;\n myCircle = new Circle(3);\n myCircle.setCenterX(0);\n myCircle.setCenterY(0);\n myCircle.setFill(innerColor);\n myShape = myCircle;\n speed = 10;\n GaussianBlur blur = new GaussianBlur();\n blur.setRadius(5);\n myShape.setEffect(blur);\n FadeTransition fadeOut = new FadeTransition(Duration.seconds(2), myShape);\n fadeOut.setFromValue(1);\n fadeOut.setToValue(0);\n fadeOut.playFromStart();\n // new AudioClipPlayer(AudioClipPlayer.HEARTBEAT).start();\n }", "@Override\r\n\tpublic void render(float delta) {\n\t\tGdx.gl.glClearColor(0f, 0f, 0f, 1);\r\n\t\tGdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r\n\t\tbatch.setProjectionMatrix(camera.combined);\r\n\t\ttweenManager.update(delta);\r\n\t\tbatch.begin();\r\n\t\tif(isrendereffect)\r\n\t\t\tballspell.render(batch, delta);\r\n\t\tbatch.end();\r\n\t\t\r\n\t}", "public void drawLevelFg( SpriteBatch batch, JARCamera camera )\n {\n for ( int i = 0; i < iWalls.length; ++i )\n {\n //draw block with isometric offset\n iWalls[ i ].iBlock.draw( batch, camera );\n }\n }", "@Override\n public void render(float delta) {\n Gdx.gl.glClearColor(0,0,0,1);\n Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);\n\n batch.begin();\n background.draw(batch);\n batch.end();\n\n renderer.setView(camera);\n renderer.render();\n\n }", "public void drawFloor() {\r\n GLES20.glUseProgram(program);\r\n\r\n // Set ModelView, MVP, position, normals, and color.\r\n GLES20.glUniform3fv(lightPosParam, 1, lightPosInEyeSpace, 0);\r\n GLES20.glUniformMatrix4fv(modelParam, 1, false, model, 0);\r\n GLES20.glUniformMatrix4fv(modelViewParam, 1, false, modelView, 0);\r\n GLES20.glUniformMatrix4fv(modelViewProjectionParam, 1, false, modelViewProjection, 0);\r\n GLES20.glVertexAttribPointer(positionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0, vertices);\r\n GLES20.glVertexAttribPointer(normalParam, 3, GLES20.GL_FLOAT, false, 0, normals);\r\n GLES20.glVertexAttribPointer(colorParam, 4, GLES20.GL_FLOAT, false, 0, colors);\r\n\r\n GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);\r\n\r\n checkGLError(\"drawing floor\");\r\n }", "public void doRender(ModEntityTNTPrimed par1TNTPrimed, double x, double y, double z, float par5, float par6)\n {\n GL11.glPushMatrix();\n GL11.glTranslatef((float)x, (float)y, (float)z);\n float f2;\n\n if ((float)par1TNTPrimed.getFuse() - par6 + 1.0F < 10.0F)\n {\n f2 = 1.0F - ((float)par1TNTPrimed.getFuse() - par6 + 1.0F) / 10.0F;\n\n if (f2 < 0.0F)\n {\n f2 = 0.0F;\n }\n\n if (f2 > 1.0F)\n {\n f2 = 1.0F;\n }\n\n f2 *= f2;\n f2 *= f2;\n float f3 = 1.0F + f2 * 0.3F;\n GL11.glScalef(f3, f3, f3);\n }\n\n f2 = (1.0F - ((float)par1TNTPrimed.getFuse() - par6 + 1.0F) / 100.0F) * 0.8F;\n this.bindEntityTexture(par1TNTPrimed);\n this.blockRenderer.renderBlockAsItem(ModBlocks.modTNT[(par1TNTPrimed.getFuse() / 20) + 1], 0, par1TNTPrimed.getBrightness(par6));\n\n// if (par1TNTPrimed.getFuse() / 5 % 2 == 0)\n// {\n// GL11.glDisable(GL11.GL_TEXTURE_2D);\n// GL11.glDisable(GL11.GL_LIGHTING);\n// GL11.glEnable(GL11.GL_BLEND);\n// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);\n// GL11.glColor4f(1.0F, 1.0F, 1.0F, f2);\n// this.blockRenderer.renderBlockAsItem(ModBlocks.modTNT[(par1TNTPrimed.getFuse() / 20) + 1], 0, 1.0F);\n// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);\n// GL11.glDisable(GL11.GL_BLEND);\n// GL11.glEnable(GL11.GL_LIGHTING);\n// GL11.glEnable(GL11.GL_TEXTURE_2D);\n// }\n\n GL11.glPopMatrix();\n }", "public void loadCommon() {\n \n Node mainScene = new Node(\"Main Scene\");\n rootNode.attachChild(mainScene);\n \n DirectionalLight sun = new DirectionalLight();\n sun.setDirection(lightDir);\n sun.setColor(ColorRGBA.White.clone().multLocal(1.7f));\n rootNode.addLight(sun);\n \n Spatial sky = SkyFactory.createSky(assetManager, \"Scenes/Beach/FullskiesSunset0068.dds\", false);\n sky.setLocalScale(350);\n \n mainScene.attachChild(sky);\n \n water = new WaterFilter(rootNode, lightDir);\n \n FilterPostProcessor fpp = myApp.getFpp();\n \n fpp.addFilter(water);\n BloomFilter bloom = new BloomFilter();\n \n bloom.setExposurePower(55);\n bloom.setBloomIntensity(1.0f);\n \n fpp.addFilter(bloom);\n LightScatteringFilter lsf = new LightScatteringFilter(lightDir.mult(-300));\n lsf.setLightDensity(1.0f);\n fpp.addFilter(lsf);\n \n DepthOfFieldFilter dof = new DepthOfFieldFilter();\n dof.setFocusDistance(0);\n dof.setFocusRange(100);\n fpp.addFilter(dof);\n \n water.setWaveScale(0.003f);\n water.setMaxAmplitude(1f);\n water.setFoamExistence(new Vector3f(1f, 4, 0.5f));\n water.setFoamTexture((Texture2D) assetManager.loadTexture(\"Common/MatDefs/Water/Textures/foam2.jpg\"));\n \n water.setRefractionStrength(0.2f);\n \n water.setWaterHeight(initialWaterHeight);\n uw = cam.getLocation().y < waterHeight;\n \n waves = new AudioNode(assetManager, \"Sounds/Environment/Ocean Waves.ogg\", false);\n waves.setVolume(0.15f);\n waves.setLooping(true);\n waves.setReverbEnabled(true);\n if (uw) {\n waves.setDryFilter(new LowPassFilter(0.5f, 0.1f));\n } else {\n waves.setDryFilter(aboveWaterAudioFilter);\n }\n \n myApp.getViewPort().addProcessor(fpp);\n }", "public void enableLightSources(ChunkPos debug1, boolean debug2) {\n/* 94 */ if (this.blockEngine != null) {\n/* 95 */ this.blockEngine.enableLightSources(debug1, debug2);\n/* */ }\n/* 97 */ if (this.skyEngine != null) {\n/* 98 */ this.skyEngine.enableLightSources(debug1, debug2);\n/* */ }\n/* */ }", "protected void initLight(GL10 gl) {\n\t\tgl.glEnable(GL10.GL_LIGHTING);\n\t\tgl.glEnable(GL10.GL_LIGHT0);\n\t\tgl.glEnable(GL10.GL_LIGHT1);\n\t\tgl.glShadeModel(GL10.GL_SMOOTH);\n\t\tthis.mLight = new Light();\n\t\tthis.mLight.initAmbient(-0.2f, -0.2f, -0.2f, 1.0f);\n\t\tthis.mLight.initDiffuse(1.f, 1.0f, 1.0f, 1f);\n\t\tthis.mLight.initSpecular(1.0f, 1.0f, 1.0f, 1.0f);\n\t\tthis.mLight.initPosition(0.0f, 3f, 20f, 0.0f);\n\t\tthis.mLight.setLight(gl, GL10.GL_LIGHT0);\n\t\t\n\t\tthis.mLight2 = new Light();\n\t\tthis.mLight2.initAmbient(-0.1f, -0.1f, -0.1f, 1.0f);\n\t\tthis.mLight2.initDiffuse(1f, 1f, 1f, 1f);\n\t\tthis.mLight2.initSpecular(1f, 1f, 1f, 1f);\n\t\tthis.mLight2.initPosition(0f, 2f, 13.5f, 0.0f);\n\t\tthis.mLight2.setLight(gl, GL10.GL_LIGHT1);\n//\t\tgl.glDisable(GL10.GL_LIGHT1);\n\t}", "public void land() {\n Game currentGame = this.getGame();\n this.setHasBeenVisited(true);\n currentGame.setMode( Game.Mode.GAME_WON);\n\n }", "@Override\n public void onLivingUpdate() {\n if (this.lastEntityToAttack != this.entityToAttack) {\n IAttributeInstance attribute = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);\n attribute.removeModifier(EntityEnderCreeper.attackingSpeedBoost);\n if (this.entityToAttack != null) {\n attribute.applyModifier(EntityEnderCreeper.attackingSpeedBoost);\n }\n }\n this.lastEntityToAttack = this.entityToAttack;\n\n for (int i = 0; i < 2; i++) {\n this.worldObj.spawnParticle(\"portal\", this.posX + (this.rand.nextDouble() - 0.5) * this.width, this.posY + this.rand.nextDouble() * this.height - 0.25, this.posZ + (this.rand.nextDouble() - 0.5) * this.width, (this.rand.nextDouble() - 0.5) * 2.0, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5) * 2.0);\n }\n if (this.worldObj.isDaytime() && !this.worldObj.isRemote) {\n float brightness = this.getBrightness(1.0F);\n if (brightness > 0.5F && this.worldObj.canBlockSeeTheSky((int)Math.floor(this.posX), (int)Math.floor(this.posY), (int)Math.floor(this.posZ)) && this.rand.nextFloat() * 30.0F < (brightness - 0.4F) * 2.0F) {\n this.entityToAttack = null;\n this.teleportRandomly();\n }\n }\n if (this.isWet()) {\n this.attackEntityFrom(DamageSource.drown, 1);\n this.entityToAttack = null;\n this.teleportRandomly();\n }\n this.isJumping = false;\n if (this.entityToAttack != null) {\n if (this.entityToAttack.getDistanceSqToEntity(this) < 9.0 && this.canEntityBeSeen(this.entityToAttack)) {\n this.setCreeperState(1);\n }\n else {\n this.setCreeperState(-1);\n }\n this.faceEntity(this.entityToAttack, 100.0F, 100.0F);\n }\n if (!this.worldObj.isRemote && this.isEntityAlive()) {\n if (this.entityToAttack != null) {\n if (this.entityToAttack instanceof EntityPlayer && this.shouldAttackPlayer((EntityPlayer)this.entityToAttack)) {\n if (this.getCreeperState() < 0 && this.entityToAttack.getDistanceSqToEntity(this) < 16.0) {\n this.teleportRandomly();\n }\n this.teleportDelay = 0;\n }\n else if (this.entityToAttack.getDistanceSqToEntity(this) > 256.0 && this.teleportDelay++ >= 30 && this.teleportToEntity(this.entityToAttack)) {\n this.teleportDelay = 0;\n }\n }\n else {\n this.teleportDelay = 0;\n }\n }\n super.onLivingUpdate();\n }", "private void GameInitialize()\r\n { \r\n // set to fullscreen to use the entire \r\n // display or false to only use\r\n // the area inbetween the two bars on the display\r\n setFullScreenMode(true);\r\n\r\n // setup 3D\r\n try\r\n {\r\n Object3D[] buffer = Loader.load(\"/RaptorWalk.m3g\");\r\n\r\n for(int i = 0; i < buffer.length; i++)\r\n {\r\n if(buffer[i] instanceof World)\r\n {\r\n // get our world node\r\n mWorld = (World)buffer[i];\r\n mEnemy = (SkinnedMesh)mWorld.find(56);\r\n mEnemyTimer = 0;\r\n break;\r\n }\r\n }\r\n }\r\n catch(Exception e) \r\n { System.out.println(\"Loading error!\" + e.getMessage()); }\r\n\r\n // create a game font\r\n mGameFont = Font.getFont(Font.FACE_MONOSPACE, \r\n Font.STYLE_PLAIN, Font.SIZE_SMALL);\r\n\r\n // Get the active camera from the world\r\n mCam = mWorld.getActiveCamera();\r\n mCam.translate(0, 1.0f, 0);\r\n\r\n // Create an ambient light and add it to the world node\r\n Light light = new Light();\r\n light.setMode(Light.AMBIENT);\r\n light.setIntensity(3);\r\n mWorld.addChild(light);\r\n }", "public static void init() {\n\t\tsetOrtho(Display.getWidth(), Display.getHeight());\n\t\tglEnable(GL_BLEND);\n\t\tglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\t\t\n\t\tLights.init();\n\t\tenableCulling();\n\t}", "public Pj3dLight Light()\r\n\t{\r\n\t\tPj3dLight light = new Pj3dLight(this);\r\n\t\treturn light;\r\n\t}", "@Override\n\tpublic void onDrawFrame(GL10 gl) {\n\t\tgl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); \n\t\t//set vertices shared by all cubes\n\t\t//set vertexpointer(3memberXYZ,FloatData,3Float*4Byte,dataBuffer)\n\t\tgl.glVertexPointer(3, GL10.GL_FLOAT, 12, vertices);\n\t\t//set normals shared by all cubes\n\t\t//normalpointer(dataTYPE,3float*4bytes,dataBuffer)\n\t\tgl.glNormalPointer(GL10.GL_FLOAT, 12, normals);\n\n\t\t//set light parameters\n\t\tgl.glLoadIdentity();\n\t\t//RGBA ambient light colors\n\t\tfloat[] ambientColor = { 0.1f, 0.11f, 0.1f, 1f }; \n\t\t//glLightModelfv(ambientLight, array with color, offset to color)\n\t\tgl.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT, ambientColor, 0);\n\t\t//position from where the light comes to the origin\n\t\tfloat[] pos = {3, 0, 2, 0};\n\t\t//set source1 position \n\t\t//glLightfv(source id, parameter, data array, offset);\n\t\tgl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, pos, 0);\n\n\t\t//enable lighting\n\t\tgl.glEnable(GL10.GL_LIGHTING);\n\t\t//enable source 1\n\t\tgl.glEnable(GL10.GL_LIGHT0);\n\t\t//light shade model interpolate\n\t\tgl.glShadeModel(GL10.GL_SMOOTH);\n\t\t//enable material\n\t\tgl.glEnable(GL10.GL_COLOR_MATERIAL);\n\t\t\n\t\t//1st cube will use default color, so disable color array\n\t\tgl.glDisableClientState(GL10.GL_COLOR_ARRAY);\n\t\t//set default render color for 2nd cube\n\t\tgl.glColor4f(0, 1, 0.5f, 1);\n\t\t\t\t\n\t\t//transform 1st cube\n\t\tgl.glLoadIdentity();\n\t\tgl.glTranslatef(0, 0, -8);\n\t\tgl.glScalef(0.3f, 0.3f, 0.3f);\t\n\t\tgl.glRotatef(angle, 1, 1, 0);\n\t\t\t\t\n\t\t//draw first cube\n\t\tgl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_SHORT, index);\n\t\t//GL10.glDrawElements(DrawType,36 indices,shorData,dataBuffer)\n\t\t\n\t\t//second cube with Vertexcolor\n\t\t//enable color array\n\t\tgl.glEnableClientState(GL10.GL_COLOR_ARRAY);\n\t\t//glcolorpointer(4members RGBA,dataType,4floats*4bytes,dataBuffer)\n\t\tgl.glColorPointer(4, GL10.GL_FLOAT, 16, colors);\n\t\t\t\t\n\t\t//set transformation for second cube\n\t\tgl.glLoadIdentity();\n\t\tgl.glTranslatef(0, 0, -8);\n\t\tgl.glRotatef(angle, 0, 1, 0);\n\t\t//Draw second cube\n\t\tgl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_SHORT, index);\n\t\t\n\t\t//third cube will use texture, disable color array\n\t\tgl.glDisableClientState(GL10.GL_COLOR_ARRAY);\n\t\t//set default color to solid white\n\t\tgl.glColor4f(1, 1, 1, 1);\n\t\t//enable texture coordinates array\n\t\tgl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);\n\t\t//enable 2D texture for bind\n\t\tgl.glEnable(GL10.GL_TEXTURE_2D);\n\t\t//set texturecoord pointer\n\t\tgl.glTexCoordPointer(2, GL10.GL_FLOAT, 8, texturemap); \n\t\t//bind texture\n\t\tgl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);\n\t\t\n\t\t//translate 3rd cube\n\t\tgl.glLoadIdentity();\n\t\tgl.glTranslatef(-5, -1, -7);\n\t\tgl.glRotatef(-angle, 0, 1, 0);\n\t\t//draw 3rd cube\n\t\tgl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_SHORT, index);\n\t\t//unbind texture so other cubes dont use texture\n\t\tgl.glBindTexture(GL10.GL_TEXTURE_2D, 0);\n\t\t//disable texture state if not next frame first cube \n\t\t//will try to use the texture\n\t\tgl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);\n\t\tgl.glDisable(GL10.GL_TEXTURE_2D);\n\t\tangle++;\n\t}", "public void setHasLight(boolean hasLight) {\n\t\tthis.hasLight = hasLight;\n\t}", "private void drawLight() {\n final int pointMVPMatrixHandle = GLES20.glGetUniformLocation(mPointProgramHandle, \"u_MVPMatrix\");\n final int pointPositionHandle = GLES20.glGetAttribLocation(mPointProgramHandle, \"a_Position\");\n\n // Pass in the position.\n GLES20.glVertexAttrib3f(pointPositionHandle, mLightPosInModelSpace[0], mLightPosInModelSpace[1], mLightPosInModelSpace[2]);\n\n // Since we are not using a buffer object, disable vertex arrays for this attribute.\n GLES20.glDisableVertexAttribArray(pointPositionHandle);\n\n // Pass in the transformation matrix.\n Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mLightModelMatrix, 0);\n Matrix.multiplyMM(mTemporaryMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);\n System.arraycopy(mTemporaryMatrix, 0, mMVPMatrix, 0, 16);\n GLES20.glUniformMatrix4fv(pointMVPMatrixHandle, 1, false, mMVPMatrix, 0);\n\n // Draw the point.\n GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 1);\n }", "@Override\n public void draw(float delta) {\n for (int i = 0; i < cameras.length; i++) {\n FrameBuffer fbo = fbos[i];\n OrthographicCamera cam = cameras[i];\n\n fbo.begin();\n\n Gdx.gl.glClearColor(30,30,30, 1);\n Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);\n\n mapRenderer.setView(cam);\n mapRenderer.render();\n\n sb.setProjectionMatrix(cam.combined);\n sb.begin();\n for (Entity e : entities) {\n e.draw(sb, delta);\n }\n sb.end();\n\n debugRenderer.render(world, cam.combined);\n fbo.end();\n }\n\n // render each frame buffer as a split-screen\n sb.setProjectionMatrix(identity);\n sb.begin();\n for (int i = 0; i < fbos.length; i++) {\n // TODO(slandow) make size variable to support different # of players\n sb.draw(\n fbos[i].getColorBufferTexture(),\n -1 + i, 1f, 2, -2\n );\n }\n sb.end();\n\n }", "public void flash(){\n phoneCam.setFlashlightEnabled(!flash);\n flash = !flash;\n }", "@Override\n public void render() {\n Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);\n batch.begin();\n system.render();\n batch.end();\n\n if (g) {\n physicManager.addForce(new Fan(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 20));\n g = false;\n }\n }", "public void turnLightsOn() {\n if (isFlashing()) {\n return;\n }\n \n for (int i = 0; i < topBorder.size(); i++) {\n topBorder.get(i).turnOn();\n }\n for (int i = 0; i < bottomBorder.size(); i++) {\n bottomBorder.get(i).turnOn();\n }\n for (int i = 0; i < leftBorder.size(); i++) {\n leftBorder.get(i).turnOn();\n }\n for (int i = 0; i < rightBorder.size(); i++) {\n rightBorder.get(i).turnOn();\n }\n topLeft.turnOn();\n topRight.turnOn();\n bottomLeft.turnOn();\n bottomRight.turnOn();\n }", "@Override\r\n public void simpleInitApp() {\r\n PhysicsRigidBody.logger2.setLevel(Level.WARNING);\r\n\r\n cam.setLocation(new Vector3f(39f, 64f, 172f));\r\n cam.setRotation(new Quaternion(-0.013f, 0.98608f, -0.1254f, -0.1084f));\r\n flyCam.setMoveSpeed(100f);\r\n\r\n Material hiMat = MyAsset\r\n .createWireframeMaterial(assetManager, ColorRGBA.Red, 3f);\r\n Material loMat = MyAsset\r\n .createWireframeMaterial(assetManager, ColorRGBA.Green, 3f);\r\n\r\n // Add axes\r\n float axisLength = 30f;\r\n AxesVisualizer axes = new AxesVisualizer(assetManager, axisLength);\r\n axes.setLineWidth(AxesVisualizer.widthForSolid);\r\n rootNode.addControl(axes);\r\n axes.setEnabled(true);\r\n\r\n for (int i = 0; i < 1000; ++i) {\r\n float x = -50f + 100f * random.nextFloat();\r\n float z = -50f + 100f * random.nextFloat();\r\n float vz = test(x, z);\r\n\r\n PointMesh pointMesh = new PointMesh();\r\n pointMesh.setLocation(new Vector3f(x, 5f * vz, z));\r\n Geometry geometry = new Geometry(\"result\", pointMesh);\r\n if (vz > 1f) {\r\n geometry.setMaterial(hiMat);\r\n } else {\r\n geometry.setMaterial(loMat);\r\n }\r\n rootNode.attachChild(geometry);\r\n }\r\n }", "private void toggle_light() {\n\t\ttry {\n\t\t\tif (!light_on) {\n\t\t\t\tlightButton.setBackgroundResource(R.drawable.light_selected);\n\t\t\t\tif (handler != null) {\n\t\t\t\t\thandler.quitSynchronously();\n\t\t\t\t\thandler = null;\n\t\t\t\t}\n//\t\t\t\tCameraManager.get().closeDriver();\n\t\t\t\tgetCameraManager().closeDriver();\n\t\t\t\tinitCamera(surfaceHolder);\n\t\t\t\tgetCameraManager().getFramingRect();\n//\t\t\t\tCameraManager.get().turn_onFlash();\n\t\t\t\tgetCameraManager().setTorch(true);\n\n\t\t\t} else {\n\t\t\t\tlightButton.setBackgroundResource(R.drawable.light);\n\t\t\t\tif (handler != null) {\n\t\t\t\t\thandler.quitSynchronously();\n\t\t\t\t\thandler = null;\n\t\t\t\t}\n//\t\t\t\tCameraManager.get().closeDriver();\n\t\t\t\tgetCameraManager().closeDriver();\n\t\t\t\tinitCamera(surfaceHolder);\n//\t\t\t\tCameraManager.get().turn_offFlash();\n\t\t\t\tgetCameraManager().setTorch(false);\n\n\t\t\t}\n\t\t\tlight_on = !light_on;\n\t\t} catch (Exception oEx) {\n\n\t\t}\n\t}", "public void render(List<Terrain> terrains, Matrix4f toShadowSpace){\n shader.loadToShadowMapMatrix(toShadowSpace);\n for(Terrain terrain:terrains){\n prepareTerrain((terrain));\n loadModelMatrix(terrain);\n glDrawElements(GL_TRIANGLES, terrain.getModel().getVertexCount(), GL_UNSIGNED_INT, 0);\n\n unbindTexturedModel();\n }\n }", "public void startDreamScreenFragment() {\n if (this.currentLight != null) {\n try {\n Log.i(tag, \"startDreamScreenFragment\");\n FragmentManager fragmentManager = getSupportFragmentManager();\n for (int i = 0; i < fragmentManager.getBackStackEntryCount(); i++) {\n fragmentManager.popBackStack();\n }\n fragmentManager.beginTransaction().replace(R.id.frameLayout, DreamScreenFragment.newInstance()).commitAllowingStateLoss();\n setToolbarTitle();\n } catch (IllegalStateException e) {\n Log.i(tag, \"startSplashActivity, IllegalStateException \" + e.toString());\n restartApp();\n }\n } else {\n Log.e(tag, \"startDreamScreenFragment currentLight is null\");\n }\n }", "boolean useCamera2FakeFlash();", "public void flashlightSwitch()\n {\n usingFlashlight = !usingFlashlight;\n }", "public float shadows(float var1, float var2, float var3, float var4, float var5, Point intersect, int index) {\r\n float second = 0;\r\n \r\n for(int i = 0; i < lights.size(); i++) {\r\n Vec N, L, V, H;\r\n \r\n Point center = spheres.get(index).getCenter();\r\n \r\n N = (intersect.point_sub(center)).normalize();\r\n L = (lights.get(i).getPoint().point_sub(intersect)).normalize();\r\n V = (window.getEye().point_sub(intersect)).normalize();\r\n H = (L.vec_add(V)).const_div(((L.vec_add(V)).length()));\r\n \r\n float S = 1;\r\n for(int j=0; j < spheres.size(); j++) {\r\n float xd, yd, zd, xo, yo, zo, xc, yc, zc, rc, A, B, C, disc, t0, t1;\r\n \r\n xd = L.getX();\r\n yd = L.getY();\r\n zd = L.getZ();\r\n xo = intersect.getX();\r\n yo = intersect.getY();\r\n zo = intersect.getZ();\r\n xc = spheres.get(j).getCenter().getX();\r\n yc = spheres.get(j).getCenter().getY();\r\n zc = spheres.get(j).getCenter().getZ();\r\n rc = spheres.get(j).getRadius();\r\n \r\n A = xd*xd + yd*yd + zd*zd;\r\n B = 2*(xd*(xo-xc) + yd*(yo-yc) + zd*(zo-zc));\r\n C = (xo-xc)*(xo-xc) + (yo-yc)*(yo-yc) + (zo-zc)*(zo-zc) - rc*rc;\r\n\r\n disc = B*B - 4*A*C;\r\n \r\n t0 = -B + (float) Math.sqrt(disc)/(2*A);\r\n t1 = -B - (float) Math.sqrt(disc)/(2*A);\r\n \r\n if(t0 > t1) {\r\n float flip = t0;\r\n t0 = t1;\r\n t1 = flip;\r\n }\r\n \r\n if(disc >= 0 && t0 > 0 && t0 < (intersect.point_sub(lights.get(i).getPoint())).length()) {\r\n S = 0;\r\n }\r\n } // end spheres for loop\r\n float temp;\r\n if(N.dot(L) < 0) { \r\n temp = 0; \r\n } else {\r\n temp = N.dot(L);\r\n }\r\n \r\n second = second + S*(((var1*var2)*temp) + (float) ((var3*var4)*Math.pow(N.dot(H), var5)));\r\n } // end lights for loop\r\n return second;\r\n }", "public synchronized void draw()\n\t{\n\t\t// First update the lighting of the world\n\t\t//int x = avatar.getX();\n\t\t//int y = avatar.getY();\t\t\n\n\t\tfor (int x = 0; x < width; x++)\n\t\t{\n\t\t\tfor (int y = 0; y < height; y++)\n\t\t\t{\n\t\t\t\ttiles[x][y].draw(x, y);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = monsters.size() - 1; i >=0; i--)\n\t\t{\n\t\t\tMonster monster = monsters.get(i);\n\t\t\tint x = monster.getX();\n\t\t\tint y = monster.getY();\n\t\t\t\n\t\t\t// Check if the monster has been killed\n\t\t\tif (monster.getHitPoints() <= 0)\n\t\t\t{\n\t\t\t\tmonsters.remove(i);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (tiles[x][y].getLit())\n\t\t\t\t\tmonster.draw();\n\t\t\t}\n\t\t}\t\t\n\t\tavatar.draw();\n\t}", "@Override\n\tpublic void render(float delta) {\n\t\tGdx.gl.glClearColor(0, 0, 0.2f, 1);\n\t\t//Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);\n\n\n\n\t\tcamera.update();\n\n\n\t\tbatch.setProjectionMatrix(camera.combined);\n\n\n\t\tbatch.begin();\n\n\t\tbatch.enableBlending();\n\t\tbatch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);\n\n\t\t/* Cloud Movement*/\n\n\t\tbatch.draw(background, 0, -220);\n\n\t\tScoreBitmapFontName.setColor(1.0f, 1.0f, 1.0f, 1.0f);\n\t\tScoreBitmapFontName.draw(batch, ScoreName, 0, 25);\n\n\t\tif (left_screen_border > second_right_screen_border) {\n\t\t\tleft_screen_border = left_screen_border - 10f * Gdx.graphics.getDeltaTime();\n\t\t\tbatch.draw(cloud_lonely, left_screen_border, 450, cloud_lonely.getWidth(), cloud_lonely.getHeight());\n\n\n\t\t} else if (left_screen_border < second_right_screen_border) {\n\n\t\t\tsecond_right_screen_border = 20f;\n\t\t\tleft_screen_border = left_screen_border + 10f * Gdx.graphics.getDeltaTime();\n\t\t\tbatch.draw(cloud_lonely, left_screen_border, 450, cloud_lonely.getWidth(), cloud_lonely.getHeight());\n\n\t\t\tif (left_screen_border > 20f) {\n\t\t\t\tsecond_right_screen_border = -150f;\n\t\t\t}\n\n\t\t}\n\n\t\t/* Cloud Movement 2*/\n\n\n\t\tif (right_screen_border < second_left_screen_border) {\n\t\t\tright_screen_border = right_screen_border + 10f * Gdx.graphics.getDeltaTime();\n\t\t\tbatch.draw(cloud_lonely, right_screen_border, 450);\n\n\t\t} else if (right_screen_border > second_left_screen_border) {\n\n\t\t\tsecond_left_screen_border = -150f;\n\t\t\tright_screen_border = right_screen_border - 10f * Gdx.graphics.getDeltaTime();\n\t\t\tbatch.draw(cloud_lonely, right_screen_border, 450);\n\t\t\tif (right_screen_border < -140f) {\n\t\t\t\tsecond_left_screen_border = 20f;\n\t\t\t}\n\n\t\t}\n\n\n\n\n\n\n\n\t\tbatch.draw(bucketImage, bucket.x, bucket.y);\n\t\tfor(Rectangle raindrop: raindrops) {\n\t\t\tbatch.draw(dropImage, raindrop.x, raindrop.y);\n\t\t}\n\n\t\tbatch.draw(bucketImage, bucket.x, bucket.y);\n\t\tfor(Rectangle badraindrop: badraindrops) {\n\t\t\tbatch.draw(baddroplet, badraindrop.x, badraindrop.y);\n\t\t}\n\n\t\tbatch.draw(bucketImage, bucket.x, bucket.y);\n\t\tfor(Rectangle deathraindrop: deathraindrops) {\n\t\t\tbatch.draw(deathraindropImage, deathraindrop.x, deathraindrop.y);\n\t\t}\n\n\t\tbatch.end();\n\t\tstage.draw();\n\n\n\t\tif(Gdx.input.isTouched()) {\n\t\t\tVector3 touchPos = new Vector3();\n\t\t\ttouchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);\n\t\t\tcamera.unproject(touchPos);\n\t\t\tbucket.x = touchPos.x - 64 / 2;\n\t\t}\n\t\tif(Gdx.input.isKeyPressed(Keys.LEFT)) bucket.x -= 200 * Gdx.graphics.getDeltaTime();\n\t\tif(Gdx.input.isKeyPressed(Keys.RIGHT)) bucket.x += 200 * Gdx.graphics.getDeltaTime();\n\n\n\t\tif(bucket.x < 0) bucket.x = 0;\n\t\tif(bucket.x > 800 - 64) bucket.x = 800 - 64;\n\n\n\t\tif(TimeUtils.nanoTime() - lastDropTime > 1000000000) spawnRaindrop();\n\t\tif(TimeUtils.nanoTime() - lastDropTime2 > 1000000000) spawnbadraindrops();\n\t\tif(TimeUtils.nanoTime() - lastDropTime3 > 1000000000) spawndeathraindrops();\n\n\n\n\t\tfor (Iterator<Rectangle> iter = raindrops.iterator(); iter.hasNext(); ) {\n\t\t\tRectangle raindrop = iter.next();\n\t\t\traindrop.y -= 200 * Gdx.graphics.getDeltaTime();\n\t\t\tif(raindrop.y + 64 < 0) iter.remove();\n\t\t\tif(raindrop.overlaps(bucket)) {\n\t\t\t\tscore++;\n\t\t\t\tScoreName = \"score: \" + score;\n\t\t\t\t//dropSound.play();\n\t\t\t\titer.remove();\n\t\t\t}\n\t\t}\n\n\t\tfor (Iterator<Rectangle> iter = badraindrops.iterator(); iter.hasNext(); ) {\n\t\t\tRectangle badraindrop = iter.next();\n\t\t\tbadraindrop.y -= 200 * Gdx.graphics.getDeltaTime();\n\t\t\tif(badraindrop.y + 64 < 0) iter.remove();\n\t\t\tif(badraindrop.overlaps(bucket)) {\n\t\t\t\tscore--;\n\t\t\t\tScoreName = \"score: \" + score;\n\t\t\t\t//dropSound.play();\n\t\t\t\titer.remove();\n\t\t\t}\n\t\t}\n\n for (Iterator<Rectangle> iter = deathraindrops.iterator(); iter.hasNext(); ) {\n Rectangle deathraindrop = iter.next();\n deathraindrop.y -= 200 * Gdx.graphics.getDeltaTime();\n if(deathraindrop.y + 64 < 0) iter.remove();\n if(deathraindrop.overlaps(bucket)) {\n\t\t\t\tgame.setScreen(new MyGdxGameOver(game));\n score--;\n ScoreName = \"score: \" + score;\n //dropSound.play();\n iter.remove();\n }\n }\n\n\n\n\t}", "private void finalRenderToTexture() {\n\t\tGL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);\n\t\tGL11.glCullFace(GL11.GL_BACK);\n\t\tGL11.glColorMask(true, true, true, true);\n\t\tGL11.glDepthFunc(GL11.GL_LEQUAL);\n\t\tGL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP);\n\t\tGL11.glDepthMask(false);\n\t\tGL11.glEnable(GL11.GL_STENCIL_TEST);\n\n\t\t// ambient pass\n\t\tGL11.glStencilFunc(GL11.GL_NOTEQUAL, 0, 0xff);\n\t\tphongShadowContext.uniform1f(\"ambientOnly\", 1);\n\t\tfor (PhysicsEntity<? extends RenderEntity> e : entities) {\n\t\t\tRenderEntity re = e.getWorldEntity();\n\t\t\tre.render(phongShadowContext);\n\t\t}\n\n\t\t// diffuse pass\n\t\tGL11.glStencilFunc(GL11.GL_EQUAL, 0, 0xff);\n\t\tphongShadowContext.uniform1f(\"ambientOnly\", 0);\n\t\tfor (PhysicsEntity<? extends RenderEntity> e : entities) {\n\t\t\tRenderEntity re = e.getWorldEntity();\n\t\t\tre.render(phongShadowContext);\n\t\t}\n\n\t\tGL11.glDisable(GL11.GL_BLEND);\n\t\tGL11.glDepthFunc(GL11.GL_LEQUAL);\n\t\tGL11.glDepthMask(true);\n\t\tGL11.glDisable(GL11.GL_STENCIL_TEST);\n\n\t\t// SCREEN POST PROCESSING\n\t\tscreenBuffer.copyPixels();\n\t}", "public static void forceLightUpdate() {\n PLC_Sender.getInstance().updatePLC_Lights(true);\n }", "private Vec3 getLightPosition() {\r\n\t\tdouble elapsedTime = getSeconds() - startTime;\r\n\t\tfloat x = 5.0f * (float) (Math.sin(Math.toRadians(elapsedTime * 50)));\r\n\t\tfloat y = 2.7f;\r\n\t\tfloat z = 5.0f * (float) (Math.cos(Math.toRadians(elapsedTime * 50)));\r\n\t\treturn new Vec3(x, y, z);\r\n\r\n\t\t//return new Vec3(5f,3.4f,5f); // use to set in a specific position for testing\r\n\t}", "public void setHasLightSource(Creature creature, byte colorRed, byte colorGreen, byte colorBlue, byte radius) {\n/* 5521 */ for (VirtualZone vz : getWatchers()) {\n/* */ \n/* */ \n/* */ try {\n/* 5525 */ if (vz.getWatcher().getWurmId() == creature.getWurmId())\n/* */ {\n/* 5527 */ vz.sendAttachCreatureEffect(null, (byte)0, colorRed, colorGreen, colorBlue, radius);\n/* */ \n/* */ }\n/* */ else\n/* */ {\n/* 5532 */ vz.sendAttachCreatureEffect(creature, (byte)0, colorRed, colorGreen, colorBlue, radius);\n/* */ }\n/* */ \n/* */ }\n/* 5536 */ catch (Exception e) {\n/* */ \n/* 5538 */ logger.log(Level.WARNING, e.getMessage(), e);\n/* */ } \n/* */ } \n/* */ }", "@Override\r\n public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)\r\n {\n \tif (f3 <= -180F) { f3 += 360F; }\r\n \telse if (f3 >= 180F) { f3 -= 360F; }\r\n \t\r\n \tGlStateManager.pushMatrix();\r\n \tGlStateManager.enableBlend();\r\n \tGlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);\r\n \tGlStateManager.scale(this.scale, this.scale, this.scale);\r\n \tGlStateManager.translate(0F, this.offsetY, 0F);\r\n \t\r\n \t//main body\r\n \tsetRotationAngles(f, f1, f2, f3, f4, f5, entity);\r\n \tthis.BodyMain.render(f5);\r\n \t\r\n \t//light part\r\n \tGlStateManager.disableLighting();\r\n \tGlStateManager.enableCull();\r\n \tOpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);\r\n \tthis.GlowBodyMain.render(f5);\r\n \tGlStateManager.disableCull();\r\n \tGlStateManager.enableLighting();\r\n \t\r\n \tGlStateManager.disableBlend();\r\n \tGlStateManager.popMatrix();\r\n }", "private void drawStatic() {\n Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);\n\n // Pass in the modelview matrix.\n GLES20.glUniformMatrix4fv(mMVMatrixHandle, 1, false, mMVPMatrix, 0);\n\n // This multiplies the modelview matrix by the projection matrix, and stores the result in the MVP matrix\n // (which now contains model * view * projection).\n Matrix.multiplyMM(mTemporaryMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);\n System.arraycopy(mTemporaryMatrix, 0, mMVPMatrix, 0, 16);\n\n // Pass in the combined matrix.\n GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);\n\n // Pass in the light position in eye space.\n GLES20.glUniform3f(mLightPosHandle, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1], mLightPosInEyeSpace[2]);\n }", "public void switchLight(){\r\n _switchedOn = !_switchedOn;\r\n }", "public void areaEffect(Player player){\n if(object.getProperties().containsKey(\"endLevel\")) {\n System.out.println(\"Fin du level\");\n setCategoryFilter(GameTest.DESTROYED_BIT);\n PlayScreen.setEndLevel();\n }\n\n if(object.getProperties().containsKey(\"startBossFight\")) {\n\n System.out.println(\"Start Boss Fight\");\n setCategoryFilter(GameTest.DESTROYED_BIT);\n\n TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();\n cell.setTile(tileSet.getTile(910));\n layer.setCell(99, 6, cell);\n cell.setTile(tileSet.getTile(910));\n layer.setCell(99, 7, cell);\n cell.setTile(tileSet.getTile(910));\n layer.setCell(99, 8, cell);\n cell.setTile(tileSet.getTile(910));\n layer.setCell(99, 9, cell);\n\n cell.setTile(tileSet.getTile(910));\n layer.setCell(100, 6, cell);\n cell.setTile(tileSet.getTile(910));\n layer.setCell(100, 7, cell);\n cell.setTile(tileSet.getTile(910));\n layer.setCell(100, 8, cell);\n cell.setTile(tileSet.getTile(910));\n layer.setCell(100, 9, cell);\n\n PlayScreen.cameraChangeBoss(true);\n setCategoryFilterFixture(GameTest.GROUND_BIT, PlayScreen.getFixtureStartBoss());\n\n }\n\n if(object.getProperties().containsKey(\"blueKnight\")) {\n System.out.println(\"Changement en bleu\");\n setCategoryFilter(GameTest.DESTROYED_BIT);\n getCell().setTile(null);\n PlayScreen.setColorKnight(\"blue\");\n }\n\n if(object.getProperties().containsKey(\"greyKnight\")) {\n System.out.println(\"Changement en gris\");\n setCategoryFilter(GameTest.DESTROYED_BIT);\n getCell().setTile(null);\n PlayScreen.setColorKnight(\"grey\");\n }\n\n if(object.getProperties().containsKey(\"redKnight\")) {\n System.out.println(\"Changement en rouge\");\n setCategoryFilter(GameTest.DESTROYED_BIT);\n getCell().setTile(null);\n PlayScreen.setColorKnight(\"red\");\n }\n\n }", "public boolean smooth(EnumSkyBlock mode) {\r\n \t\t\tint x, y, z, typeid, light, factor;\r\n \t\t\tint loops = 0;\r\n \t\t\tboolean haserror = true;\r\n \t\t\tboolean haderror = false;\r\n \t\t\tint lasterrx, lasterry, lasterrz;\r\n \t\t\tlasterrx = lasterry = lasterrz = 0;\r\n \t\t\twhile (haserror) {\r\n \t\t\t\tif (loops > 100) {\r\n \t\t\t\t\tlasterrx += this.chunk.x << 4;\r\n \t\t\t\t\tlasterrz += this.chunk.z << 4;\r\n \t\t\t\t\tStringBuilder msg = new StringBuilder();\r\n \t\t\t\t\tmsg.append(\"Failed to fix all \" + mode.toString().toLowerCase() + \" lighting at [\");\r\n \t\t\t\t\tmsg.append(lasterrx).append('/').append(lasterry);\r\n \t\t\t\t\tmsg.append('/').append(lasterrz).append(']');\r\n \t\t\t\t\tNoLaggLighting.plugin.log(Level.WARNING, msg.toString());\r\n \t\t\t\t\tbreak;\r\n \t\t\t\t}\r\n \t\t\t\thaserror = false;\r\n \t\t\t\tloops++;\r\n \t\t\t\tint inity;\r\n \t\t\t\tfor (x = 0; x < 16; x++) {\r\n \t\t\t\t\tfor (z = 0; z < 16; z++) {\r\n \t\t\t\t\t\tif (mode == EnumSkyBlock.SKY) {\r\n \t\t\t\t\t\t\tinity = this.chunk.b(x, z);\r\n \t\t\t\t\t\t\tif (inity >= this.world.getHeight()) {\r\n \t\t\t\t\t\t\t\tinity = this.world.getHeight() - 1;\r\n \t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t} else {\r\n \t\t\t\t\t\t\tinity = this.world.getHeight() - 1;\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t\tfor (y = inity; y > 0; --y) {\r\n \t\t\t\t\t\t\tif (this.chunk.i()[y >> 4] == null) {\r\n \t\t\t\t\t\t\t\tcontinue;\r\n \t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\ttypeid = this.chunk.getTypeId(x, y, z);\r\n \t\t\t\t\t\t\tif (!Block.n[typeid]) {\r\n \t\t\t\t\t\t\t\tfactor = Math.max(1, Block.lightBlock[typeid]);\r\n \t\t\t\t\t\t\t\tlight = this.chunk.getBrightness(mode, x, y, z);\r\n \t\t\t\t\t\t\t\t// actual editing here\r\n \t\t\t\t\t\t\t\tint newlight = light + factor;\r\n \t\t\t\t\t\t\t\t// obtain lighting from all sides\r\n \t\t\t\t\t\t\t\tnewlight = Math.max(newlight, getLightLevel(mode, x - 1, y, z));\r\n \t\t\t\t\t\t\t\tnewlight = Math.max(newlight, getLightLevel(mode, x + 1, y, z));\r\n \t\t\t\t\t\t\t\tnewlight = Math.max(newlight, getLightLevel(mode, x, y, z - 1));\r\n \t\t\t\t\t\t\t\tnewlight = Math.max(newlight, getLightLevel(mode, x, y, z + 1));\r\n \t\t\t\t\t\t\t\tnewlight = Math.max(newlight, getLightLevel(mode, x, y - 1, z));\r\n \t\t\t\t\t\t\t\tnewlight = Math.max(newlight, getLightLevel(mode, x, y + 1, z));\r\n \t\t\t\t\t\t\t\tnewlight -= factor;\r\n \t\t\t\t\t\t\t\t// pick the highest value\r\n \t\t\t\t\t\t\t\tif (newlight > light) {\r\n \t\t\t\t\t\t\t\t\tChunkSection chunksection = this.chunk.i()[y >> 4];\r\n \t\t\t\t\t\t\t\t\tif (chunksection != null) {\r\n \t\t\t\t\t\t\t\t\t\tif (mode == EnumSkyBlock.SKY) {\r\n \t\t\t\t\t\t\t\t\t\t\tchunksection.c(x, y & 0xf, z, newlight);\r\n \t\t\t\t\t\t\t\t\t\t} else {\r\n \t\t\t\t\t\t\t\t\t\t\tchunksection.d(x, y & 0xf, z, newlight);\r\n \t\t\t\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\t\t\t\tlasterrx = x;\r\n \t\t\t\t\t\t\t\t\t\tlasterry = y;\r\n \t\t\t\t\t\t\t\t\t\tlasterrz = z;\r\n \t\t\t\t\t\t\t\t\t\thaserror = true;\r\n \t\t\t\t\t\t\t\t\t\thaderror = true;\r\n \t\t\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t\t}\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t}\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t\treturn haderror;\r\n \t\t}", "private void drawDynamic() {\n GLES20.glUniformMatrix4fv(mMVMatrixHandle, 1, false, mMVPMatrix, 0);\n\n // This multiplies the modelview matrix by the projection matrix, and stores the result in the MVP matrix\n // (which now contains model * view * projection).\n Matrix.multiplyMM(mTemporaryMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);\n System.arraycopy(mTemporaryMatrix, 0, mMVPMatrix, 0, 16);\n\n // Pass in the combined matrix.\n GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);\n\n // Pass in the light position in eye space.\n GLES20.glUniform3f(mLightPosHandle, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1], mLightPosInEyeSpace[2]);\n }", "public void initLight(GL10 gl)\n\t{\n\t\tgl.glEnable(GL10.GL_LIGHT0);// 打开0号光源\n\n\t\t// 环境光设置\n\t\tfloat[] ambientParams =\n\t\t{ 0.46f, 0.21f, 0.05f, 1.0f };// 光参数 RGBA\n\t\tgl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, ambientParams, 0);\n\n\t\t// 散射光设置\n\t\tfloat[] diffuseParams =\n\t\t{ 0.46f, 0.21f, 0.05f, 1.0f };\n\t\tgl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, diffuseParams, 0);\n\n\t\t// 镜面光设置\n\t\tfloat[] specularParams =\n\t\t{ 0.46f, 0.21f, 0.05f, 1.0f };\n\t\tgl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, specularParams, 0);\n\n\t\t// 指定光源位置\n\t\tfloat[] directionParams =\n\t\t{ -1f, 1f, 1f, 0 };// 定向光\n\t\tgl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, directionParams, 0);\n\t}", "public Light(Color color){\n this.color = color;\n this.castsShadows = false;\n }", "@Override\n\tpublic void create() {\n\t\tGdx.gl20.glClearColor(1, 1, 1, 1);\n\n\t\t// instancia batch, asset manager e ambiente 3D\n\t\tmodelBatch = new ModelBatch();\n\t\tassets = new AssetManager();\n\t\tambiente = new Environment();\n\t\tambiente.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));\n\t\tambiente.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));\n\n\t\t// configura a câmera\n\t\tfloat razaoAspecto = ((float) Gdx.graphics.getWidth()) / Gdx.graphics.getHeight();\n\t\tcamera = new PerspectiveCamera(67, 480f * razaoAspecto, 480f);\n\t\tcamera.position.set(1f, 1.75f, 3f);\n\t\tcamera.lookAt(0, 0.35f, 0);\n\t\tcamera.near = 1f;\n\t\tcamera.far = 300f;\n\t\tcamera.update();\n\t\tcameraController = new CameraInputController(camera);\n\t\tGdx.input.setInputProcessor(cameraController);\n\n\t\t// solicita carregamento dos 2 modelos 3D da cena\n\t\tassets.load(\"caldeirao.obj\", Model.class);\n\t\tassets.load(\"caldeirao-jogos.obj\", Model.class);\n\t\tassets.load(\"caldeirao-love.obj\", Model.class);\n\t\tassets.load(\"fogueira.obj\", Model.class);\n\n\t\t// instancia e configura 2 tipos de renderizadores de partículas:\n\t\t// 1. Billboards (para fogo)\n\t\t// 2. PointSprites (para bolhas)\n\t\tBillboardParticleBatch billboardBatch = new BillboardParticleBatch(ParticleShader.AlignMode.Screen, true, 500);\n\t\tPointSpriteParticleBatch pointSpriteBatch = new PointSpriteParticleBatch();\n\t\tsistemaParticulas = new ParticleSystem();\n\t\tbillboardBatch.setCamera(camera);\n\t\tpointSpriteBatch.setCamera(camera);\n\t\tsistemaParticulas.add(billboardBatch);\n\t\tsistemaParticulas.add(pointSpriteBatch);\n\n\t\t// solicita o carregamento dos efeitos de partículas\n\t\tParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(\n\t\t\t\tsistemaParticulas.getBatches());\n\t\tassets.load(\"fogo.pfx\", ParticleEffect.class, loadParam);\n\t\tassets.load(\"fogo-jogos.pfx\", ParticleEffect.class, loadParam);\n\t\tassets.load(\"fogo-love.pfx\", ParticleEffect.class, loadParam);\n\t\tassets.load(\"bolhas.pfx\", ParticleEffect.class, loadParam);\n\t\tassets.load(\"bolhas-jogos.pfx\", ParticleEffect.class, loadParam);\n\t\tassets.load(\"bolhas-love.pfx\", ParticleEffect.class, loadParam);\n\n\t\t// solicita carregamento da música\n\t\tmusica = Gdx.audio.newMusic(Gdx.files.internal(\"zelda-potion-shop.mp3\"));\n\n\t\taindaEstaCarregando = true;\n\t}", "public abstract Color3f traceLight(Vector3f pos, Vector3f normal,\n\t Material m, List<Shape> objects);", "private void generateLights(Universe universe) throws SAXException {\n ArrayList<SceneLight> lights = universe.getScene().getLightArray();\n for (int i = 0; i < lights.size(); i++) {\n saver.addAttribute(\"type\", XmlSaver.CDATA, lights.get(i).getLightType().name());\n saver.startTag(\"light\");\n Color3f color = new Color3f(lights.get(i).getColor());\n saver.startTag(\"color\", Converter.tuple3fToString(color));\n switch(lights.get(i).getLightType()){\n// case ambient:\n case point:\n Point3f position = lights.get(i).getPosition();\n saver.startTag(\"position\", Converter.tuple3fToString(position));\n Point3f attenuation = lights.get(i).getAttenuation();\n saver.startTag(\"attenuation\", Converter.tuple3fToString(attenuation));\n break;\n case directional:\n Vector3f direction = lights.get(i).getDirection();\n saver.startTag(\"direction\", Converter.tuple3fToString(direction));\n break;\n }\n saver.closeTag(\"light\");\n }\n }" ]
[ "0.7406273", "0.66819495", "0.6642092", "0.6594267", "0.6526231", "0.6499438", "0.6467036", "0.6445077", "0.6418075", "0.6404295", "0.6269405", "0.62219757", "0.6189424", "0.6174601", "0.6169153", "0.6144349", "0.61308753", "0.61070627", "0.6062252", "0.6059594", "0.60401887", "0.6035719", "0.6010349", "0.59740716", "0.59543186", "0.5934088", "0.59311706", "0.591588", "0.5892881", "0.58903426", "0.5840134", "0.5836402", "0.5829062", "0.5822035", "0.5816068", "0.58151656", "0.5805006", "0.5798999", "0.57906544", "0.5787775", "0.5765372", "0.5762922", "0.5760445", "0.575431", "0.5740331", "0.57315546", "0.571915", "0.5717822", "0.5704592", "0.56825316", "0.5677623", "0.56716496", "0.56447184", "0.5629582", "0.5624978", "0.5622886", "0.5620939", "0.5619449", "0.561659", "0.5611324", "0.5610707", "0.56045103", "0.5578627", "0.5570349", "0.5564644", "0.5555482", "0.55376637", "0.553628", "0.55238247", "0.5514968", "0.55108297", "0.55035883", "0.55002826", "0.5490477", "0.54883796", "0.5485529", "0.547839", "0.54726136", "0.5468483", "0.54666877", "0.5462238", "0.54579324", "0.5454908", "0.5453258", "0.54384845", "0.5438396", "0.54383034", "0.54345745", "0.5434549", "0.53977585", "0.5395189", "0.5395164", "0.53936106", "0.5390341", "0.5389632", "0.53879696", "0.5386833", "0.5384445", "0.5382236", "0.53820914" ]
0.6637899
3