method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
226db4bb-cfb2-46e5-b0f6-5bf29b510c0b
6
public int findMin(List<Integer> l){ if(l==null){ return 0; } if(l.size()==0){ return 0; } if(l.size()==1){ return l.get(0); } int min = -1; int tmp; for(int i=0;i<l.size();i++){ if(i==0){ min = i; }else{ tmp = l.get(i); if(tmp <min){ min = tmp; } } } return ...
279e69d6-a6ae-4e6e-91a6-34915b17e743
9
public static void main(String[] args) { System.out.println("Hello and welcome to team 3-3's 449 a1, java version!" + '\n' ); // check if the correct arguments are being used // myProgram myInput myOutput _args = args; if (args.length != 2) { System.out.println("Usage: <input file> <output file>"); ...
cc580a6c-4946-4611-9136-8e66a3f5c5e1
5
@EventHandler(ignoreCancelled = true) public void handle(BlockPlaceEvent event) { Player player = event.getPlayer(); GameSession session = plugin.getGameManager().getGameSessionOfPlayer( player); if (session == null) { return; } if (!(session.isStarted()) && !(session.isAdmin(player))) { event.setC...
313b6d0c-0d6d-4a47-b90f-c9ce4016d2ec
9
public void move() { String snarkyComment = "Can't do that! *mumbles under breath* dummy"; System.out.println("Where to?"); String dir = Driver.getScanner().nextLine(); if(dir.equalsIgnoreCase("up")) { if(getCurrentRoom().moveUp()) { ...
e4ff52f3-7431-4d94-906a-9dbdee63e75c
7
private static TspPopulation[] generate(){ Graph g = new Graph(INDIVIDUAL_SIZE); TspPopulation[] h = new TspPopulation[GLOBAL_STEPS]; for (int i = 0; i < GLOBAL_STEPS; ++i){ h[i] = new TspPopulation(POPULATION_SIZE, INDIVIDUAL_SIZE, g.getGraph()); } resultsRandom = ne...
7690a2c4-4821-4125-bf69-2e1eb6c0dafd
1
protected JPanel getFontFamilyPanel() { if (fontNamePanel == null) { fontNamePanel = new JPanel(); fontNamePanel.setLayout(new BorderLayout()); fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); fontNamePanel.setPreferredSize(new Dim...
0f0ee9be-9474-42dd-936b-247ec14b0994
5
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null) { return; } if (Main.Data.RatedRooms.contains(Room.Id) || Room.CheckRights(Main.Data, true)) ...
30bcb7f5-e3ba-4bac-9afb-ca93df006b1b
7
public void ChangeStatus(){ if (x.textfieldStartStop.getText().equals("Working")){ x.textfieldStartStop.setText("WaitingForProcessor"); } else if (x.textfieldLoader.getText().equals("Working")){ x.textfieldLoader.setText("WaitingForProcessor"); }else if (x.textfieldMain...
9dc94d9c-ab54-40ae-91e8-805c0cdbb490
2
private void addOutsideCurve(int end, int newRadius) { if (restricted.isSelected()) { int sectionBeginning = road.sectionBeginning(); road.addOutsideCurve(end, false, newRadius); if (sectionLongerThanSmax(end, sectionBeginning)) return; } else { road.addOutsideCurve(end, true, newRadius); } }
ed535b87-e398-49f8-b2b0-1bb902208d81
2
private static DecimalImpl safeAdd(final long d1, final long d2, final int factor) { final long sum = d1 + d2; if (DPU.isSameSign(d1, d2) && !DPU.isSameSign(sum, d1)) { final long shrinkedSum = d1 / 10 + d2 / 10; return safegetInstance(shrinkedSum, factor - 1); } else { return safegetInstance(sum, fact...
d4fd6d99-25e2-4d73-9382-684f54853e9f
4
public void makeSidePanel() { JPanel sideBar = new JPanel(new GridLayout(3,1,20,20)); // Buttons JPanel sideBarButtons = new JPanel(new GridLayout(2,1)); JButton add = new JButton("Add"); add.setPreferredSize( new Dimension(80, 30) ); add.addActionListener(new ActionListener() { public void actionP...
cb0c9e99-da04-46ae-9654-03856a6e026d
5
private void connectConnection(String host, int port) throws ChannelError { if (HydnaDebug.HYDNADEBUG) { DebugHelper.debugPrint("Connection", 0, "Connecting, attempt "); } try { SocketAddress address = new InetSocketAddress(host, port); m_s...
f1ed2761-b844-4ff6-86be-a6d8d70a7e4b
1
static int[] calculateVendingMachineChange(int[] coin_totals, BigDecimal balance) { String[] change_denomination = {"1.0", "0.5", "0.2", "0.1"}; for(int i = 0; i < coin_totals.length; i++) { balance = change(coin_totals, balance, change_denomination[i], i); } return coin_t...
0ac7073b-39bb-46f2-b6ae-5bded4c7f197
6
private void initBorderMaze() { for (int x = 0; x < bufferedImage.getWidth(); x++) { for (int y = 0; y < bufferedImage.getHeight(); y++) { if (x == 0 || x == bufferedImage.getWidth() - 1 || y == 0 || y == bufferedImage.getHeight() - 1) { bufferedImage.setRGB(x, y, Color.BLACK.getRGB()); continu...
231adc1c-c1d2-418a-a7ef-9005fc85bd2a
2
public synchronized void close() { AudioDevice out = audio; if (out != null) { closed = true; audio = null; // this may fail, so ensure object state is set up before // calling this method. out.close(); lastPosition = out.getPositio...
150b082b-b85a-45b1-a745-63bf6f1f83c7
2
private void fireServerEvent(ServerEvent evt) { Object[] listeners = serverEventListenerList.getListenerList(); for (int i=0; i<listeners.length; i+=2) { if (listeners[i]==IServerEventListener.class) { ((IServerEventListener)listeners[i+1]).OnServerEvent(evt); } } }
32b1167e-8a78-414d-986d-c59ed5136bfb
3
private void changeLead() { Anstalld selAnst = (Anstalld) cbLead.getSelectedItem(); if (selAnst.getAid() != -1) { //if not no predefined lead try { String query = "update spelprojekt set aid=" + selAnst.getAid() + " where sid=" + selectedSpelprojekt; DB.update...
3fc90ae7-b9fb-489c-83fc-b14f60402594
9
public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return listMembre.get(rowIndex).getId(); case 1: return listMembre.get(rowIndex).getNom(); case 2: return listMembre.get(rowIndex).getPreno...
621fce54-2781-4ca1-83e6-f23486dfeba2
4
private void findNegativeCycle(EdgeWeightedDigraph G) { // Create a Digraph from edgeTo[] Digraph spt = new Digraph(G.V()); try { for (int v = 0; v < G.V(); v++) if (vertex[v].edgeTo != null) spt.addEdge(vertex[v].edgeTo.from(), vertex[v].edgeTo.to()); } catch (Exception e) { System.out.pr...
ff2cc514-643c-4ca6-ac1b-aba5bf869266
6
public static JInternalFrame createHeirarchyFrame(final JFrame frame) { BasicFrames.removeDropdown(internalFrame); internalFrame.setVisible(true); internalFrame.setBounds(200, 200, 518, 352); internalFrame.setFocusable(true); try { internalFrame.setSelected...
4ce16e4e-c7d5-4ac9-8d7e-fb97b5f2e432
4
public boolean isConjugateTo(PGridPath path) { if (path == null) { throw new NullPointerException(); } String common = commonPrefix(path); if (path.length() == path_.length()) { int otherLen = path.length() - common.length(); int thisLen = path_.lengt...
b49f8ba7-496c-4754-a7c7-a2f270369818
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/blockTransition.gif"); return new javax.swing.ImageIcon(url); }
19b35d8b-925a-40e3-9772-7846d9fabf44
3
private int trMedian3 (final int ISA, final int ISAd, final int ISAn, int v1, int v2, int v3) { final int[] SA = this.SA; int SA_v1 = trGetC (ISA, ISAd, ISAn, SA[v1]); int SA_v2 = trGetC (ISA, ISAd, ISAn, SA[v2]); int SA_v3 = trGetC (ISA, ISAd, ISAn, SA[v3]); if (SA_v1 > SA_v2) { final int temp = v1; ...
c3a8b2b2-6fe8-404a-a965-ec1b053b131e
9
private void loadLayout(){ //Do a random layout for now... if(texturePack == null || texturePack.floor == null || texturePack.wall == null || texturePack.brick == null) System.out.println("ERROR: Broken texture pack!"); Random rand = new Random(); for(int x=0; x<size.width; x++){ for(int y=0; y<size.he...
c9d72dac-6e5d-4382-b51b-b6440fd4e220
0
public void setId(int id) { this.id = id; }
6327a7a0-c8f5-40ce-ac9d-e7056f63423b
9
private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed int servicePort = new Integer(bootstrapServicePortTextField.getText()).intValue(); int registryPort = new Integer(registryPortTextField.getText()).intValue(); bootstrapServer = new Boo...
2341a693-5f16-4626-a5ac-373ae4d7b29d
6
private void processTile(ArrayList<ArrayList<DataTile>> tiles, float lat, float lon) throws InterruptedException { int rankAverage; int rankTotal = 0; Double finalHeight; Double heightTotal = 0d; ArrayList<Integer> rankArray = new ArrayList<Integer>(); ArrayList<Float> heightArray = new ArrayList<Float...
184f9766-4172-4e8d-8f59-2a3367171ec8
9
private ArrayList<EziInfo> indexFolder(File filesFolder, File eziFolder, ArrayList<EziInfo> eziFiles) { try { for (File file : filesFolder.listFiles()) { if (file.isDirectory()) { eziFiles = indexFolder(file, eziFolder, eziFiles); } else { ...
834249b6-16b3-44d8-92c4-02096566a214
3
private void classNotInEditorFolder(File file) { String filePath; File fileDir; filePath = file.getParent(); fileDir = new File(filePath); if(fileDir.exists() && fileDir.isDirectory()) { System.out.println("Class Not in editor"); ...
0e6ad248-d867-48e9-9b99-028dca8df6e1
4
int getB(String s1, String s2) { int b = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) { continue; } if (s1.charAt(i) == s2.charAt(j)) { b++; } } ...
3fe7137f-55ee-431f-9933-ac05c9c6854c
7
@Override public boolean accept(File f) { if (f.isDirectory()) return true; String s = f.getName(); int index = s.lastIndexOf('.'); if (index > 0 && index < s.length() - 1) { String ext = s.substring(index+1).toLowerCase(); return (ext.equals("...
8087916b-5f84-4038-8f70-a696adca49ae
0
public void cleanStop() { this.running = false; }//stop
1d9e051b-0097-468f-b856-ceafeee17b03
3
public boolean match(ScheduleItem item) { long runtime = 0; if(item instanceof SSGridlet) { runtime = forecastExecutionTime((SSGridlet)item); } else { runtime = ((ServerReservation)item).getDurationTime(); } if(runtime < minRuntime || runtime >= maxRuntime) { return false; } return true; }
7aa2acb1-ea33-4b4d-b79e-f3102f98e8ff
0
@Override public String getDesc() { return "EarthSpike"; }
dc5a360f-4791-44e8-8ce8-1dd950e4768c
1
private void firePieceSent(Piece piece) { for (PeerActivityListener listener : this.listeners) { listener.handlePieceSent(this, piece); } }
1427d63d-7fb2-4e09-b289-f2f201ea1d38
8
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.thrower), 0)) { ; } if (!this.worldObj.isRemote && thi...
df6582db-1d44-49f4-9db3-b1e91d6e3b06
2
public void set(Integer key, Integer value) { if(!super.containsKey(key)){ if(count == capacity){ --count; Integer keyDel = super.keySet().iterator().next(); super.remove(keyDel); } super.put(key, value); ++count; ...
ab1defc7-c430-4754-a22f-f09385567cfd
6
public void addAtIndex(int index, int item) { if(index > size || index < 0) { System.out.println("Index out of boundary"); } else { if(index == 0) { addFirst(item); } else if(index == size) { addLast(item); } else { int i = 0; Node node = head; while(i ...
ce23827a-40f8-461f-90bd-2cfd241a723e
9
public int evalRPN(String[] tokens) { Stack<Integer> stack = new Stack<Integer>(); int result = 0; for (String t : tokens) { if ((t.charAt(0) == '-' && t.length() > 1) || (t.charAt(0) >= '0' && t.charAt(0) <= '9')) { stack.push(Integer.parseInt(t)); } else...
cc569ae7-2f30-43f5-9543-19b830259b5a
4
public boolean setPlayer2(Player p) { boolean test = false; if (test || m_test) { System.out.println("FileManager :: setPlayer2() BEGIN"); } m_player2 = p; if (test || m_test) { System.out.println("FileManager :: setPlayer2() END"); } return true; }
175bb2bd-bf47-4f05-bbd6-5280aec5c6f5
5
private boolean verticalLineTo(Graphics2D g, Connector c, Point ep) { Point p = c.getDirectP(); Point tp; if (c.isVertical()) tp = new Point(ep.x, p.y); else tp = new Point(p.x, ep.y); if (eFrom.intersects(tp, p) || eTo.intersects(tp, p) || eFrom.intersects(tp, ep) || eTo.intersects(tp, ep)) ret...
a6fdcbfa-9320-412c-a47e-9dc778729039
5
private JPanel getSaveConfigurationsPanel(){ JPanel saveConfigurationPanel = new JPanel(new BorderLayout()); // Create the check box that will enable/disable the user to modify the file JCheckBox enableSphinxConfiguration = new JCheckBox("Disable modifications"); enableSphinxConfiguratio...
aa770608-64ee-4e55-b6f6-a29eeeb42b89
0
public double getRelativeY() {return pos.getY();}
0e47b3f9-c2f3-4f72-9930-223fc92e8d7f
3
protected boolean isIntervalEditable(Interval interval) { if (editedBy != null) return true; for (Interval i : editedIntervals) if (i.contains(interval)) return true; return false; }
d5f839ac-5f43-4ff4-8149-38dc7ebe17ac
0
@Test public void itSetsWarmerPlateStatus() { maker.setWarmerPlateStatus(CoffeeMakerAPI.WARMER_ON); assertEquals(CoffeeMakerAPI.WARMER_ON, maker.getWarmerPlateStatus()); maker.setWarmerPlateStatus(CoffeeMakerAPI.WARMER_OFF); assertEquals(CoffeeMakerAPI.WARMER_OFF, maker.getWarmerPla...
c0ef3338-30d1-4489-a305-f170ff663286
8
private boolean destroyBlocksInAABB(AxisAlignedBB par1AxisAlignedBB) { int var2 = MathHelper.floor_double(par1AxisAlignedBB.minX); int var3 = MathHelper.floor_double(par1AxisAlignedBB.minY); int var4 = MathHelper.floor_double(par1AxisAlignedBB.minZ); int var5 = MathHelper.floor_doubl...
5797b70a-0a78-4cc6-bfb6-bdb9e9b01f08
3
public static void main(String[] arg) { if (arg.length != 2) { System.out.println("Usage:\n java Reorganize [source] [target]"); return; } BufferedImage source = null; try { source = ImageIO.read(new File(arg[0])); } catch (IOException e...
5179e584-3824-42b2-9478-9bdb5e728def
5
@BeforeClass public static void setUpBeforeClass() { try { new MySQLConnection(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e...
aba9a7eb-9a21-465e-a223-5518eb2aca09
6
public int alphaBetaNegamax( Board board, int depth, int alpha, int beta ) { if ( board.isCheckmate() ) { return ( Integer.MIN_VALUE + 1 + this.depth - depth ); } else if ( board.isStalemate() ) { return 0; } else if ( depth <= 0 ) { return ( evaluator.evaluate( board ) ); } int s...
4575a092-a630-4c1f-b959-556055546f8c
5
public Locus(String locusName, double position, String[] alleleNames, PopulationData popdata) { if (locusName==null || locusName.trim().isEmpty()) { DecimalFormat fix3 = new DecimalFormat("#0.000"); locusName = fix3.format(position); } else { this.locusNam...
7cf293eb-169f-4924-aa36-58ee25a7582c
4
public void mouseDragged(MouseEvent arg0) { // MOUSE_MOVED sluzy do przesuwania wzgledem x, a dragged y boolean isChanged = false; int centerX = Application.getWindow().getWidth() / 2 + Application.getWindow().getXposition(); int centerY = Application.getWindow().getHeight() / 2 + Application.getWindow(...
30673c69-463f-4ddd-81ed-09a4f7664611
3
public Scanner(String rootDir, int interval) { if (StrKit.isBlank(rootDir)) { throw new IllegalArgumentException("the rootDir can not be blank"); } this.rootDir = new File(rootDir); if (!this.rootDir.isDirectory()) { throw new IllegalArgumentException("the "+rootDir+"is not a directory"); } if (interv...
9812138b-6a72-4ef5-899e-c32689acb18c
4
public void put(final E element) { int index = 0; boolean added = false; while (!added) { // #1 // To set or not to set... if (array.getElement(index) == null) { array.setElement(index, element); added = true; ...
a8bfb6ab-0c2b-42f7-b9c1-0626f70757bc
4
public Population stochasticUniversalSampling(Population pop, int outSize){ Individual [] subset = new Individual[outSize]; double[] maxFitScores = new double[pop.population.size()]; double populationFitness = pop.calculateTotalFitness(); for (int i = 0; i<pop.population.size(); i++){//calcula...
9a2f3a65-a4fe-4f47-b37f-52cbe4d30e9e
1
public boolean fromDiscardForReal(Game g, Rack r) { int index = indexer.index(g, r); int newDrawAction = drawStates[index].getBestReward(); if (newDrawAction == 0) return false; else return true; }
0ba17ebd-0621-4349-a3f6-7d31a9f351e0
7
public Behavior getSailor() { if(affected instanceof PhysicalAgent) { PhysicalAgent agent=(PhysicalAgent)affected; if((sailor == null)||(agent.fetchBehavior("Sailor")!=sailor)) { final Behavior B=agent.fetchBehavior("Sailor"); if(B!=null) agent.delBehavior(B); sailor = CMClass.getBehavior...
156ac8df-13ef-4b52-b3b2-cc1ec34e55ec
1
public ResponseList<UserList> getLists() { try { return getTwitter().getUserLists(-1); } catch (TwitterException e) { e.printStackTrace(); return null; } }
e3d0ea11-39ab-4642-bdea-43a15b658dfc
2
public Document getDocument() throws Exception { Document doc = Utilities.createDocument(); Map<String, String> namespaces = this.initializeDocument(doc); Element root = this.createTransactionElement(doc, namespaces); Element payloadElem = doc.createElementNS(DEFAULT_NAMESPACE, XMLLabels.ELEM_SERVICE_G...
ea2560e5-0a43-44a4-a5b2-b7af7f52829c
9
private void generate(Class c) { if (generated(c)) { return; } Class super_ = c.getSuperclass(); boolean extendSuper = super_.isAnnotationPresent(GenerateWrapper.class); if (extendSuper) { generate(super_); } System.out.println("Generating ...
4de97d6c-5be2-43ac-8231-d2edff5bd4c8
5
private boolean findUnexploredCellWithDist(int rowCount, int colCount) { boolean foundMin = false; for(int rowID = 0;rowID < rowCount ; rowID++){ for(int colID = 0;colID < colCount;colID++){ for(int drcID = OREITATION_MIN;drcID <= OREITATION_MAX;drcID ++){ if(!explored[rowID][colID][drcID] && d...
85302df8-e006-46dc-a6a4-6e769b6907c0
5
private boolean existsCellOnOrientaion(Robot robot, Orientation ori,CellState state){ Boolean needExplore = null; if(robotOnArenaEdge(robot, ori)) return false; if(ori.equals(Orientation.NORTH)) needExplore = existsCellOnTheNorth(robot,state); if(ori.equals(Orientation.WEST)) needExplore = existsCellOnTheWest...
c40bdecd-777b-4b8c-aec2-8edfb78badf6
8
private void mayor() throws Exception{ op2 = pila.pop(); if (op2.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); op1 = pila.pop(); if (op1.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); Elem resultado = new Ele...
704fcfe3-8647-481e-acef-e16f78afa155
7
public void setManaTypes(String manaTypes) { if (manaTypes.equals("")) { this.manaTypes = ""; if (this.cardText.contains("{R}")) this.manaTypes += "R"; if (this.cardText.contains("{U}")) this.manaTypes += "U"; if (this.cardText.contains("{B}")) this.manaTypes += "B"; if (this.cardText.co...
662a95ae-8e08-4e35-a5ee-541711e9df8d
9
private boolean GetOverlapSegment(IntPoint pt1a, IntPoint pt1b, IntPoint pt2a, IntPoint pt2b, final AtomicReference<IntPoint> pt1, final AtomicReference<IntPoint> pt2) { // precondition: segments are colinear. if(Math.abs(pt1a.x - pt1b.x) > Math.abs(pt1a.y - pt1b.y)) { if(pt1a.x > pt1b.x) { IntPoint t = pt1a...
ec42e232-bcd5-4176-a0a6-4e05d84481c0
6
public void actionPerformed(ActionEvent e) { Object s = e.getSource(); if (s instanceof JButton && (JButton)s == clearButton) { current = ""; textArea.setText(current); } else if (s instanceof JButton && (JButton)s == sendButton) { current = textArea.getText(); cc.writeClientCutText(...
7c8a1146-16e0-4a81-abc1-81f165821b6f
4
public Select tables(String... tables) { int counter = 0; //int added = 0; for (String table : tables) { if (table != null && !table.isEmpty()) { if (!table.contains("`")) { this.tables.add(table); //added++; } else { db.writeError("Skipping table " + table + " in SELECT statement that h...
cbad0fc8-d5b7-4060-a3a6-33c5fe847d4c
8
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... paramTypes) { Class<?>[] t = toPrimitiveTypeArray(paramTypes); for (Constructor<?> c : clazz.getConstructors()) { Class<?>[] types = toPrimitiveTypeArray(c.getParameterTypes()); if (equalsTypeArray(types, t))...
4508814d-9c75-4032-9035-bf0ea41f94da
1
public ArrayList viewMyBookingPayment() { ArrayList temp = new ArrayList(); Query q = em.createQuery("SELECT t from BookingEntity t"); for (Object o : q.getResultList()) { BookingEntity p = (BookingEntity) o; temp.add(String.valueOf(p.getPayment().getAmountPaid())); ...
dd440767-1de0-4afb-bc06-52104b814180
7
protected boolean hasIndirectValueForTargetType(int targetType) { switch (targetType) { case TARGET_TYPE__AWARD: case TARGET_TYPE__ITEM: case TARGET_TYPE__NPC_IN_PARTY: case TARGET_TYPE__NPC_PROFESSION_IN_PARTY: case TARGET_TYPE__EVENT_AUTONOTE: case TARGET_TYPE__CLASS: case TARGET_TYPE__QUES...
26a86ab2-90cf-4631-8c11-8461dac15855
7
public void draw(Graphics2D graphics, int width, int height) { // Convert text if needed String drawnText = text; int start, end; boolean found; do { found = false; start = drawnText.indexOf("$date{"); if (start != -1) { end = drawnText.indexOf('}', start); if (end != -1) { found = true;...
3d58d9a1-38e3-48ff-8020-8daa6668ded3
0
@Override public void startSetup(Attributes atts) { JCheckBox component = new JCheckBox(); setComponent(component); super.startSetup(atts); component.addActionListener(new CheckboxListener(component, getPreference())); }
6c86c3b3-3193-4db6-b0a7-2c28cbbae002
1
protected void newPurchaseButtonClicked() { log.info("New purchase started"); try { domainController.startNewPurchase(); startNewSale(); } catch (VerificationFailedException e1) { log.error(e1.getMessage()); } }
de901c06-1862-4d7d-b83d-790c01548f8d
5
public void charger(Element deSixFace) { valeur = Integer.valueOf(deSixFace.getChildText("valeur")); switch(deSixFace.getChildText("isUtilise")){ case "oui":isUtilise = true;break; case "non":isUtilise = false; } switch(deSixFace.getChildText("couleurDe")){ case "BLANC":couleurDe = CouleurCase.B...
90d4a498-06e3-43b6-9688-d7793d30a2e6
4
public Neuneu getInstanceNeuneu(String name, Loft loft) { if(this.getClassNom().equals(Lapin.class.getName())) { return new Lapin(name, this.energie, this.caseDeplacement, loft); } else if(this.getClassNom().equals(Cannibale.class.getName())) { return new Cannibale(name, this.energie, this.caseDeplacement, lo...
5e5e5c7e-34f9-45cc-ae8c-090a5ed26f41
9
public static boolean validDate(String date){ boolean valid = true; String strDay = date.substring(0,date.indexOf("/")); date = date.substring(strDay.length() + 1, date.length()); String strMonth = date.substring(0,date.indexOf("/")); String strYear = date.substring(strMonth.length() + 1, date.length()); ...
2ecafb06-dcc9-4308-b26a-173778866433
5
public static boolean canAccess(String position, String subsystem){ if(position.equals("manager")) return true; if(position.equals("pharmacist")&&!subsystem.equals("employee")) return true; if(position.equals("tech")&&subsystem.equals("patient")) return true; return false; }
6c9ed878-a037-4255-9a88-40034c55a466
5
public boolean check_any_marker_at(int[] pos, Colour colour){ boolean bool = false; int i = 0; Cell c = world.getCell(pos[0],pos[1]); if (colour==Colour.RED){ while(!bool && i <6){ bool = c.getRMarker()[i]; i++; } } else{ while(!bool && i <6){ bool = c.getBMarker()[i]; i++; } }...
1007069b-63b7-4b0b-9298-b876f85bc6c2
3
public static Stock QueryOne(String code) { URL url; InputStream is = null; BufferedReader br; String line; Stock s = null; String urlStr = "http://finance.yahoo.com/d/quotes.csv?s=" + code + "&f=nsl1"; try { url = new URL(urlStr); is = u...
ad1fd67d-cad6-4d9e-b528-12a9ee11e9e4
5
@Override public void validate(Object target, Errors errors) { GameInfoWrapper gameInfo = (GameInfoWrapper) target; if(gameInfo.getMaxRounds() > MAX_ROUND_NUM_VALUE) { errors.rejectValue("maxRounds", "Max.gameInfoWrapper.maxRounds", new Integer[]{MAX_ROUND_NUM_VALUE}, ""); } ...
3ea9a8bc-a758-4c9b-8175-efd7c41185be
7
public static BufferedImage HistogramEqualization(BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); int[] H = new int[256]; BufferedImage temp = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); for(int i = 0; i < 256; i++) ...
59b76b20-a24a-476c-a612-b5214ba08556
4
private void takeItem(Command command){ if(!command.hasNthWord(2)){ System.out.println("Take what?"); } else { Item i = rooms.get(currentRoom).removeItem(command.getNthSegment(1)); if(i == null){ System.out.println("There is no " + command.getNthSegmen...
97fe255b-4854-41a1-952c-3d06cc9c4cef
5
public static boolean valida_contrasenia(String contraseniaUno, String contraseniaDos) { String contrasenia_pat = "^[^';]+$"; if (contraseniaUno == null || contraseniaDos == null) { return false; } return contraseniaUno.matches(contrasenia_pat) && contraseniaUno.length() >...
14b1b85a-9c7d-4fc0-a0ff-3ff126b815c6
5
private boolean valid() { if (actors == null) { return false; } if ((spawningPositions == null) || (spawningPositions.size() < 1)) { return false; } if (name == null) { return false; } if (skybox == null) { return fa...
e5863082-b5e3-40da-aa67-6ff35506618c
2
@Override public double getAverageClientWaitTime() { int clients = 0; int totalWaitTime = 0; for(int i = 0; i < cashiers; i++){ for(int j = 0; j < lines[i].size(); j++){ clients++; totalWaitTime += lines[i].get(j).getExpectedServiceTime(); } } return totalWaitTime/clients; }
f418e5c4-389d-46c7-84dd-a45ccc286e67
3
@Override public int stepThrough() { if(ptr==0){ if(isCompileClicked()){ setCompileClicked(false); this.setViewToDefault(); } else{ refreshOutputs(); this.setViewToDefault(); } this.runner = new Runner(this.compiler); } else { this.runner = new Runner(this.compiler, this.sim40,...
d3ef802e-8f27-4f5c-8bcf-2f496a087683
0
@Override public void execute(VirtualMachine vm) { DebuggerVirtualMachine dvm = (DebuggerVirtualMachine) vm; dvm.setFunctionInfo(functionName, startLineNumber, endLineNumber); }
b15034e8-8968-4863-b1da-a9fff1cf00e9
0
public remove() { this.requireLogin = true; this.info = "remove an appointment"; this.addParamConstraint("id", ParamCons.INTEGER); this.addRtnCode(405, "appointment not found"); this.addRtnCode(406, "permission denied"); this.addRtnCode(407, "illegal time"); }
c2452787-fd5b-4ea7-b6fe-cb1b5df1b816
9
public boolean isCheckMate() { if ( (this.board.getBlackTime() == 0 || this.board.getWhiteTime() == 0) && this.hasTimer() ) { this.cancelTimer(); return true; } boolean possibleCheckmate = false; for (Piece p : this.board.getPieces()) { if (p.isWhite() == this.board.isWhiteTurn()) { if (!p...
83ed230e-8c09-4cca-a7fe-c8642866b551
5
public boolean hitSquare(){ World myWorld = getWorld(); int x = getX(); int y = getY(); switch(direction) { case SOUTH : y++; break; case EAST : x++; break; case NORTH : ...
f980ce79-f259-434d-aefa-b08659075f99
6
private int getMaxidUsuario(){ int max = 0; try { conn = PaginaWebConnectionFactory.getInstance().getConnection(); String sql = "select MAX(id_usuario) as maximo from usuario"; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); if (rs.next()){ max = rs.getInt("maximo"); } } ...
eb237b0b-42ec-4334-8320-0843b9bd548d
7
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.ban"))){ sender.sendMessage(ChatColor.DARK_RED + "You cannot BAN ME!"); return true; } if(args.length == 0){ sender.sendMessage...
0a15a9b0-b154-4bad-85fd-8e60403a1950
6
@EventHandler public void SnowmanJump(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getsnowgolemConfig().getDouble("Snowman.Jump....
5a0cdf2b-644a-486e-8d08-eac068f23761
1
private static void setEmptyTile(TileType[][] data, int x, int y, TileType type) { if (data[x][y] == TileType.NONE) data[x][y] = type; }
15eaf6da-feb2-45ba-a4d0-e4560d983deb
5
private int stripMultipartHeaders(ByteBuffer b, int offset) { int i; for (i = offset; i < b.limit(); i++) { if (b.get(i) == '\r' && b.get(++i) == '\n' && b.get(++i) == '\r' && b.get(++i) == '\n') { break; } } return i + ...
a1dab3e2-8961-468d-b22e-596652766028
7
public void updateItems() { try { String strResult = ""+(char)6, strStore; int i; Item itmStore; LifoQueue qStore; Iterator iter=vctItems.keySet().iterator(); while(iter.hasNext()) { qStore = (LifoQueue)vctItems.get(iter.next()); if (qStore.size() > 0) { itmStore = (Item)...
5a8f1aaf-f2a3-47fb-89e6-1b90dda78aad
7
protected boolean checkXObstacle(CommonObject so, double time) { return (((this.currentCoord.getX() + this.currentWidth + currentHorizontalSpeed * time >= so.getCurrentCoordinates().getX() && currentHorizontalSpeed > 0 && this.currentCoord.getX() < so.getCurrentCoordinates().getX()) ...
7f99f9fa-8fe5-47a3-94cf-a3e17efabb6a
9
public void setStatge(int stageID, Map<String, String> data) { if(this.mouseListener != null){ gamePanel.removeMouseListener(this.mouseListener); } startedLoadingTime = System.nanoTime(); if (stage != null) { Stage s = stage; stage = null; s.close(); } if (stageID == STAGE_WELCOME) { stage = ...
cecd7814-90f8-4cd8-8e71-b5b7eea55528
6
public static int getStateMetric(State s) { switch(STATE_METRIC) { case DIV: return (((s.rngState>>16)&0x3F)<<8) + ((s.rngState>>22)&0xFF); case DSum: return (((s.rngState>>8)&0xFF) + (s.rngState&0xFF))&0xFF; case RNG: return s.rngState & 0xFFFF; case RNG1: return s.rngState ...
4ca3204b-6b66-474a-b944-3e42b05dfebe
6
@Test public void testServerClientDisconnectWithHash() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerClientDisconnectWithHash -----"); String client_hash = ""; String server_hash = ""; server1.setUseDisconnectedSockets(true); try { server1.startThread();...
a8bb4e2b-f4ef-4d84-b47e-ec37586129a0
9
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof Tag)) { return false; } Tag o = (Tag) obj; if (getId() != o.getId()) { return false; } if (name == null && o.name != null || name != null && o.name == null) { ...