method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7e3588a4-5fcb-46cf-ae06-bf1c0ecb9ca2
4
public ArrayList<Administrador> getByDNI(Administrador admin){ PreparedStatement ps; ArrayList<Administrador> admins = new ArrayList<>(); try { ps = mycon.prepareStatement("SELECT * FROM Administradores WHERE dni=?"); ps.setString(1, admin.getDNI()); ResultSet...
c93616b3-6de0-4948-929e-edc1730b54ee
6
@Override public void actionPerformed(ActionEvent e) { if(e.getID() == ActionEvent.ACTION_PERFORMED) { GuiButton button = (GuiButton)e.getSource(); if(button == newGame) Client.instance.setGuiScreen(new GuiSelectServer(this)); else if(button == test) Client.instance.activateMap(true); else ...
cbd7f88e-2032-450f-8dda-2894b2f1a4f2
4
public static void main(String[] args) { Random r = new Random(); ArrayList<Integer> ArrayA = new ArrayList<Integer>(); ArrayList<Integer> ArrayB = new ArrayList<Integer>(); ArrayList<Integer> ArrayC = new ArrayList<Integer>(); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)...
8f2d182d-a3c8-4f7a-b2e5-7ab6c63e78f1
8
public void getSimpleRandomGraph(mxAnalysisGraph aGraph, int numNodes, int numEdges, boolean allowSelfLoops, boolean allowMultipleEdges, boolean forceConnected) { mxGraph graph = aGraph.getGraph(); Object parent = graph.getDefaultParent(); Object[] vertices = new Object[numNodes]; for (int i = 0; i < num...
52738fe1-819b-4667-a75a-636c44b77e9d
0
public static void Balconey() { currentRoomName = "Balconey"; currentRoom = 7; RoomDescription = "The wafer thin doors are almost crushed in your hands as you open them and enter the balconey." + "You are immediately faced with the dark figure you saw earlier; only this time, he is slung over the " + "ba...
04d20a97-024d-46c1-a096-9f1b1ac5f5fe
1
private String findCaller(int depth) { if (depth < 0) { throw new IllegalArgumentException(); } tracer.fillInStackTrace(); return tracer.getStackTrace()[depth+1].toString(); }
315d88b1-a546-4533-927e-a17515dbd730
2
public static void main(String[] args) { // INSERT INTO `bible`.`books` // (`ID`, `TESTAMENT`, `TITLE`, `TITLE_CN`, `TITLE_CN_SHORT`) // VALUES // ('1', 'OT', 'Genesis', '創世紀', '創'); StringBuilder sb = new StringBuilder(); for (int k = 0; k < 39; k++) ...
37d8f596-444e-4dfe-9a05-13ad3b5f980e
4
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { if (computeSVUID) { if ("serialVersionUID".equals(name)) { // since the class already has SVUID, we won't be computing it. computeSVUID = false; hasSVUID = true; } ...
15805ef8-460a-4bda-acb4-1ba90531a89e
8
public int maxP(int[] A){ int length = A.length; if(length == 1) return A[0]; if(A== null || A.length ==0 ) return 0; int max = A[0]; int n = 0; int total = 1; int[] pre = new int[length]; int[] aft = new int[length]; for(...
266f67ee-dc2b-4350-a6c8-e0be1c424e47
0
public void chooseM() { m = LemmaMath.fetchRandInt(myRange[0], myRange[1]); }
8a9af1c7-764c-4702-83cb-2c52a90b9fa3
5
private static CustomButton doIndividualTickerButtonForPanel( ArrayList<String> bundle, final String ticker, final String buttonData, final JFrame closeMe, int type) { boolean filterResults = meetsFilter(ticker); if (!filterResults) return null; final CustomButton a = new CustomButton((ticker)); a.se...
df3b5298-d20b-40df-9b65-d6afea747011
8
public boolean hasNeighbor(int piece, boolean withOpponents) { boolean condition = false; for (int dh = UP; dh <= DOWN; dh++) { for (int dv = LEFT; dv <= RIGHT; dv++) { if (dh == 0 && dv == 0) continue; int neighbor = searchNeighbor(piece, dh, dv); if (neighbor != -1) { condition = conditio...
eef211d5-17b1-48fe-9e3f-bc6c3b5c9a53
7
public void connect(TreeLinkNode root) { if(root == null) return; if(root.left == null && root.right == null){ root.next = null; return; } TreeLinkNode tempRoot = root; tempRoot.next = null; while(tempRoot != null){ TreeLinkNode startPoint = tempRoot; while(startPoint != null){ if(startPo...
6252212b-0d36-40ec-9770-8e42df57de88
1
public void printTrees(QuadTree tree) { // Include parent tree // System.out.println(tree); // for (Point2D p : tree.getEdges()) { // System.out.println(p.getX() + ", " + p.getY()); //} // Child trees for (QuadTree t : tree) { System.out.println(t); //for (Point2D p : t.getEdges()) { //Sys...
995b36ed-ae9f-479a-b772-4fe9207547af
9
private static ArrayList<String> loadFile() { ArrayList<String> texts = new ArrayList<String>(); File aFile = null; BufferedReader aBufferedReader = null; FileReader aFileReader = null; JFileChooser aFileChooser = new JFileChooser(); int selected = aFileChooser.showOpenDialog(null); if(selected == JFile...
b49793b7-cc62-4e7f-8f7a-7c208297f1f7
2
public void newFrame() { int i = JOptionPane.showOptionDialog(this, "What kind of page would you like to add?", "New Page", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[]{"Blank Pa...
26546f58-1470-4d34-b439-3554e837f176
9
public void guardarImagen(String rutaArchivo) { FileWriter fw = null; PrintWriter pw; try { fw = new FileWriter(rutaArchivo); pw = new PrintWriter(fw); String comentario = "# Imagen guardada desde programa AxpherPicture\n"; comentario += "# Autor: ...
bbafdbc4-06a9-4b9e-ad19-216ba453b5cd
3
private void doubleClickedNode(Object obj) { if (obj instanceof File) { final File f = (File) obj; FileType ft = FileType.typeForFile(f); //Do first action for (final FileAction act : Actions.actions) if (act.canDoOn(ft)) ...
cd7940bc-8f0a-40c4-8ec5-61c027c8e361
4
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(null == image) { return; } BMPImage.BMPColor[][] bitmap = image.getBitMap(); int height = image.getHeight(); int width = image.getWidth(); BufferedImage bufferedIma...
df06caeb-ffd0-4f3e-afd1-322f7051cc60
0
@Test public void containsReturnsFalseWhenElementNotInArray() { a.insert(new Vertex(493)); assertFalse(a.contains(v)); }
0db072fb-0398-4de4-a858-cbd90a96f798
2
@Override public int compareTo(Object ob){ Event e = (Event) ob; if(this.time < e.getTime()){ return -1; } if(this.time > e.getTime()){ return 1; } return 0; }
7d83bbf1-c32b-444a-90a2-8f977ad161d5
6
private static void solve_nu_svc(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si) { int i; int l = prob.l; double nu = param.nu; byte[] y = new byte[l]; for(i=0;i<l;i++) if(prob.y[i]>0) y[i] = +1; else y[i] = -1; double sum_pos = nu*l/2; double sum_neg ...
5a02aa99-b21b-498b-936e-fb65877a0a8d
3
@Override // Draw certain pictures based on # of lives remaining public void draw(Graphics g) { if (Lives >= 3) { g.drawImage(img1, pos_x, pos_y, width, height, null); } else if (Lives == 2) { g.drawImage(img2, pos_x, pos_y, width, height, null); } else if (Lives == 1) { g.drawImage(img3, pos_x, pos_y,...
3f20a4cb-24fe-4cd6-8152-ab46903cce30
5
public void persistir() { FileOutputStream fos = null; ObjectOutputStream stream = null; try { fos = new FileOutputStream("arquivo.bin"); stream = new ObjectOutputStream(fos); stream.writeObject(persistencia); } catch (IOException e) { e.printStackTrace(); } finally { if (fos != null) { tr...
9ae1cff5-020e-4195-b202-23b7510464ea
1
public int[] getItemLastModifier(int itemSlot, BagLocation bag) throws IOException { GWCAPacket receivedGwcaPacket = sendAndReceivePacket(GWCAOperation.GET_ITEM_LAST_MODIFIER, itemSlot, bag != null ? bag.getValue() : ZERO); return receivedGwcaPacket.getParamsAsIntArray(); }
26009188-7a2d-4d2d-8c30-aa22a8e0b119
0
public boolean isPropertyInherited() {return propInherited;}
c6f16d77-254e-4635-985c-42093ab2ef43
3
public void addUserInterruptListener(ActionListener al){ if (listeners==null ||(listeners!=null && listeners.isEmpty()) ) listeners = new Vector<ActionListener>(); listeners.add(al); }
c71b6ffa-2bdd-45f3-aab2-ba893d8c0d4d
6
public static Object getProperty(Object obj, String propertyName) { if (obj == null) return null; try { BeanInfo info = Introspector.getBeanInfo(obj.getClass()); PropertyDescriptor[] descriptors = info.getPropertyDescriptors(); for (int i = 0; ...
1554afe9-5b0b-4141-b3b3-6a761d4c5af2
8
public Object[][][] readLine() { try { //Excelのワークブックを読み込みます。 POIFSFileSystem filein = new POIFSFileSystem(new FileInputStream(targetFile)); HSSFWorkbook wb = new HSSFWorkbook(filein); Object[][][] sheetArray = new Object[wb.getNumberOfSheets()][][]; // シートごとのループ for (int i = 0; i < wb.getNumberOfS...
80cdd5c6-4dd2-4442-bdb1-1a1a9e972b85
1
public String searchByName(final String name) throws IOException { if (searchingFile(name,"name") == null) { return null; } return searchingFile(name,"name").toString(); }
90000d7b-3194-49b1-ab54-59eb202ebd22
0
@Override public SQLPermissionRcon getRcon() throws DataLoadFailedException { checkCache(PermissionType.RCON, null); return (SQLPermissionRcon) cache.get(PermissionType.RCON).get(null); }
37e68b76-6106-4dcf-a5d9-b24a70499775
0
public void setPcaUsuario(String pcaUsuario) { this.pcaUsuario = pcaUsuario; }
6aaf4bdb-7c70-4bc8-9985-7baeb02a7bc5
5
public static Collection<? extends Bean> scanForBeansFromMethods(Class baseType) { Set<Bean> beansCollection = new HashSet<Bean>(); Method[] methods=baseType.getDeclaredMethods(); for (Method method : methods) { org.frameworkdi.poc.annotations.Bean bean = method.getAnnotation(org.f...
2b2f13ca-8bbc-4bca-90a8-261c28fcb316
0
@Override public int getConnTimeout() { return connTimeout; }
1cc04380-36a1-4c07-9251-023583aa277f
7
public Controller(final JComponent c){ final GameComponent gc = (GameComponent) c; ArrayList<Player> players = GameComponent.getPlayers(); im = gc.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); am = gc.getActionMap(); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false), ...
da5b4a7e-45d0-403e-bfc5-94801d5cb3bc
2
public final static void encode(Image image, OutputStream os) throws IOException { CRC32 crc = new CRC32(); int width = image.width; int height = image.height; write(os, null, PNGHelper.ID); write(os, crc, PNGHelper.IHDR); write(os, crc, width); write(os, crc, height); write(os, crc, PNGHelper.HEAD);...
8fea724f-7c76-4eda-9ed5-5747994c86b3
6
public void combineElements(int key1, int key2) { Element element1 = elements.get(key1); Element element2 = elements.get(key2); if (element1 == null) { throw new IllegalArgumentException( "Unable to find element with key: " + key1); } if (element2 == null) { throw new IllegalArgumentException( ...
2f9d38ef-9018-44a2-8abb-d25a2d9f0057
8
public ArrayList <boid> getArrayNeightEdge(boid osobnik){ ArrayList <boid> temp=new ArrayList <>(); temp.ensureCapacity(400); int dX=osobnik.getBucketX()+2; int dY=osobnik.getBucketY()+2; int tx=0,ty=0; temp.addAll(bucketList.get(dX-2).get(dY-2).koszyk); for (int i=dX-3;...
15f83d1d-2b6f-442d-867e-5ee1769a7b61
3
private void showLoadDialog() { try { if (matchFileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { if (matchFileChooser.getSelectedFile().isFile()) { setMatch(MatchLoader.loadFromSave(matchFileChooser.getSelectedFile().getPath())); displayMatch(); } else { throw new FileNotFou...
6b975ad9-639a-4e9d-91e2-2ad318a915da
1
private void runSSLTasks() { Runnable task = null; while ((task = mEngine.getDelegatedTask()) != null) { task.run(); } }
89673c8c-17ec-4f0b-9cd7-1f72f8788cc3
7
public void deleteTag() { if (this.myApplicationsAppMyTagsList.getSelectedValue()!=null && this.myApplicationsTree.getSelectionPath()!=null) { String appId = ((DefaultMutableTreeNode)this.myApplicationsTree.getLastSelectedPathComponent()).toString(); String tagName = ((TagListItem)this.myApplicationsAppMyTag...
3091ee68-5258-4211-b8f3-56c2d9dcce05
9
private static PDFDecrypter createStandardDecrypter( PDFObject encryptDict, PDFObject documentId, PDFPassword password, Integer keyLength, boolean encryptMetadata, StandardDecrypter.EncryptionAlgorithm encryptionAlgorithm) throws ...
3eef064b-a124-4d60-8c62-c23d9eab64d6
9
protected void _realSendMessage() { if(null == _m_scSocket) return ; if(!_m_scSocket.isConnected()) { ALBasicSendingClientManager.getInstance().addSendSocket(this); return ; } boolean needAddToSendList = false; _lockBuf();...
62ccd733-0026-4e39-a8d7-d010ee9e2406
0
public static void main(String[] args) { System.out.println(HeaderType.valueOf("id").toString()); }
a55342ba-21ba-4c6d-8109-85b8379d74ee
7
public static PairedAlignment getAlignment(String s1, List<IndividualEdit> edits) throws Exception { final StringBuffer top = new StringBuffer(); final StringBuffer bottom = new StringBuffer(); int index=0; for( IndividualEdit ie : edits) { if( ie.getPostion() > index && index < s1.length() ) {...
9fbdb479-4965-44df-892f-953cb32f2d42
0
public void testDate2String() { Calendar calendar = Calendar.getInstance(); calendar.set(2012, Calendar.SEPTEMBER, 22, 9, 18, 1); String date = DateUtils.date2String(calendar.getTime()); assertEquals("2012-09-22 09:18:01", date); date = DateUtils.date2String(calendar.getTime(), "yyyy-MM-dd"); assertEquals(...
819ce6d1-63e6-4291-a009-b4644bf919d6
6
protected boolean shouldPaint(final int horizIteration, final int verticalIteration) { if (horizIteration < 0) { throw new IllegalArgumentException(String.format( "Passed horizIteration must be greater equal than 0! %d given.", horizIteration)); } ...
d6ec93ee-925b-4c79-813c-7077a4227eee
9
public static void main(String[] args) { BigInteger secwet = new BigInteger("1234"); System.out.println("in: " + secwet.toString(2)); System.out.println(); int bitlen = secwet.bitLength(); bitlen += 3; int k = 3, k2 = 3; SecretSend s = new SecretSend(secwet, k, ...
2ba1911d-20c4-4eb8-b1ab-2986b661c0dc
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
8365dddb-7a0c-4545-bd55-f9ef5b4b156c
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
75cf558f-3b16-483d-bbcb-546f4de50cba
5
@Override public List<Action> cleanup() { List<Action> ret = super.cleanup(); // move arrows and kill hunters / wumpii List<Actor> toKill = new ArrayList<Actor>(); for(Actor arrow : Groups.ofType(Arrow.class, model.actors)) { MoveAction move = new MoveAction(model, ((Arrow)arrow).nextLocation(), arrow); ...
23302ff1-c143-485f-ad00-0d3aafb0a43e
4
public static float getFloat() { float x = 0.0F; while (true) { String str = readRealString(); if (str == null) { errorMessage("Floating point number not found.", "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); } ...
6650d8de-dc70-4e80-9d67-88668ead1d84
1
static FrequencyTable readFrequencies(BitInputStream in) throws IOException { int[] freqs = new int[3]; for (int i = 0; i < 2; i++) freqs[i] = readInt(in, 32); freqs[2] = 1; // EOF symbol return new SimpleFrequencyTable(freqs); }
839dabc0-904d-407f-b4a6-9231a66fc10c
7
public final JPoclASTParser.expr0_return expr0() throws RecognitionException { JPoclASTParser.expr0_return retval = new JPoclASTParser.expr0_return(); retval.start = input.LT(1); TypeTree root_0 = null; Token set79=null; JPoclASTParser.expr1_return expr178 =null; JPoc...
e26b3480-7330-482f-a0e5-91189f0cd8c9
5
@Override public boolean register(Player player) { if (_started == false && player.getName() != "" && _list.size() <= 4) { _list.add(player); new GUI(); return true; } if (_started == true || player.getName() == "") { return false; } return false; }
efbda657-e7cd-4af3-b49e-710354fc5268
4
public static int addConnectionThread(Thread con) { boolean added = false; int num = 0; for(int k = 0;k<=5;k++) { if(MainThread.uploadConnectionThreads[k] == null && added == false) { MainThread.uploadConnectionThreads[k] = con; added = true; } } if(added = false) { return 99; ...
059cf155-8a51-443d-8eb2-0e39e27d62e7
9
@Override public void processKeyEvent(KeyEvent keyEvent) { final int VK_LEFT = 0x25; final int VK_RIGHT = 0x27; final int VK_UP = 0x26; final int VK_DOWN = 0x28; final int VK_JUMP = 0x42; final int VK_W = 0x57; final int VK_S = 0x53; final int VK_A = 0x41; final int VK_D = 0x44; ...
a5aab3eb-c32b-4f1c-996e-e8626769d87e
4
private void processEvent(BaseEvent event) { // Retrieve all eventlisteners that are subscribed to this eventtype. ArrayList<IEventListener> listeners = listenerMap.get(event.getEventType().getID()); if(listeners == null) { return; } for(IEventListener ie : listeners) { // handleE...
8bc5cd6b-ddaa-45e3-b879-063b562f41f5
7
public void Solve() { HashSet<Integer> numbers = new HashSet<Integer>(); for (int a = 1; a < 100; a++) { for (int b = a; b < 10000; b++) { int c = a * b; ArrayList<Integer> temp = new ArrayList<Integer>(); temp.addAll(GetDigits(a)); ...
863c1337-e640-4a30-bff0-f4e50eeb5481
2
public String toString() { String rep = ""; for (int i = 0; i < this.board.length; i++) { for (int j = 0; j < this.board[i].length; j++) { rep += MoveHandler.convertIntToPieceString(this.board[i][j], true) + " "; } rep += "\n"; } return rep; }
3c695bf7-d7d6-47c3-88a6-7c76ca3aadfb
7
static final public int one_line() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MINUS: case CONSTANT: case 12: sum(); jj_consume_token(11); {if (true) return 0;} break; case 11: jj_consume_token(11); {if (true) return 1;} break; defau...
a3be959d-dc11-435f-b2cb-fecc86c8b57a
5
public void berechneRestzeit(Date end) { Date now = new Date(); //current date long diff = end.getTime() - now.getTime(); //milliseconds long days = diff/(1000*60*60*24); long hours = (diff-days*1000*60*60*24)/(1000*60*60); long minutes = (diff-days*1000*60*60*24-hours*1000*60*60)/(1000*60); String rest = "...
db5f860f-c2f3-448e-aeed-16eb63694263
9
public static boolean join(Player player, String arena, BowSpleef plugin) { if (player.hasPermission("bs.join")) { if (BowSpleef.arenaConfig.contains("arenas." + arena)) { if (BowSpleef.arenaConfig.getBoolean("arenas." + arena + ".enabled")) { if (!BowSpleef.arenaConfig.getBoolean("arenas." + ar...
943c55a7-dc0f-4a6d-9478-7eafd1cc60f3
7
public PartieDeRisk(int nombreDeJoueurs) { this.plateau = new Plateau(); this.nombreDeJoueurs = nombreDeJoueurs; this.joueursDeLaPartie = new Joueur[nombreDeJoueurs]; int[] total = new int[6]; switch (nombreDeJoueurs) { case 2: total[0] = 21; total[1] = 21; this.nbRenfortPremierTour = 40; ...
82dd5191-a79a-4bae-984b-a579e313ee46
4
void addShapelessRecipe(ItemStack var1, Object ... var2) { ArrayList var3 = new ArrayList(); Object[] var4 = var2; int var5 = var2.length; for(int var6 = 0; var6 < var5; ++var6) { Object var7 = var4[var6]; if(var7 instanceof ItemStack) { var3.add(((ItemStack)var7)....
01673487-8ec5-4c32-97cc-7a68a7a8b42b
6
public List<Interval> merge(List<Interval> intervals) { int size = intervals.size(); if(size <= 1) return intervals; Collections.sort(intervals, new Comparator<Interval>(){ @Override public int compare(Interval A, Interval B) { if(A.start < B.start) return -1; if(A.start ...
a46f5a1a-7287-40dc-8fb5-87b4878beddd
8
static int checkStyle(Shell parent, int style) { int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL; if ((style & SWT.SHEET) != 0) { style &= ~SWT.SHEET; if ((style & mask) == 0) { style |= parent == null ? SWT.APPLICATION_MODAL : SWT.PRIMARY_MODAL; } } if ((style & mask)...
874bdaca-1148-4ad3-9824-b2e77021b6df
7
private static Binomialnode merge(Binomial heap1, Binomial heap2) { //Jos toisen juuri on tyhjä, palautetaan suoraan toinen if (heap1.root == null) { return heap2.root; } else if (heap2.root == null) { return heap1.root; } //Kumpikaan juurilista ei siis ol...
fd8dd0e5-abc1-4954-98b6-6e6de098c4d0
0
public BinaryLogicalOperator<Boolean> getOperator() { return binaryLogicalOperator; }
73c3ff83-88b2-454d-8ba7-94e3ce7fada6
2
protected int byteArrayToInt(byte[] bytes) { int result = 0; int l = bytes.length - 1; for (int i = 0; i < bytes.length; i++) { if (i == l) result += bytes[i] << i * 8; else result += (bytes[i] & 0xFF) << i * 8; } return result; }
c704a7b9-faf8-418e-bf64-ad4033e2d8a0
3
@Override public double[] get2DData(int px, int pz, int sx, int sz) { double[] da = a.get2DData(px, pz, sx, sz); double[] db; if(a == b) db = da; else db = b.get2DData(px, pz, sx, sz); int s = sx*sz; for(int i = 0; i < s; i++) da[i] = da[i] > db[i] ? da[i] : db[i]; ...
e4a9842e-6662-401f-bbc0-b4ade63e55f3
8
protected static Ptg calcDGet( Ptg[] operands ) { if( operands.length != 3 ) { return new PtgErr( PtgErr.ERROR_NULL ); } DB db = getDb( operands[0] ); Criteria crit = getCriteria( operands[2] ); if( (db == null) || (crit == null) ) { return new PtgErr( PtgErr.ERROR_NUM ); } int fNum = db.findC...
33b7d664-f1da-47da-9ac6-2fa54e38ee25
6
public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // LEFT_RHINO_ID return LEFT_RHINO_ID; case 2: // LEFT_TITAN_ID return LEFT_TITAN_ID; case 3: // RIGHT_RHINO_ID return RIGHT_RHINO_ID; case 4: // RIGHT_TITAN_ID ret...
e59967ff-5639-4a32-83dc-7caf5a5e3e1a
0
public static void runFileDataBaseEditor(){ frames.runFileDataBaseEditor(); frames.getFileDataBaseEditor().setVisible(true); }
72775451-0533-470c-a65d-2a804e3726f7
4
private static Move ForwardLeftForBlack(int r, int c, Board board){ Move forwardLeft = null; assert(board.cell[r][c] == CellEntry.black || board.cell[r][c] == CellEntry.blackKing); if( r>=1 && c<Board.cols-1 && board.cell[r-1][c+1] == CellEntry.empty ...
f0e44f0d-280a-4cca-a831-90fbc3a7a7d1
7
public Section(int sectionId, String name, Subject subject, Schedule schedule, Teacher teacher) throws ScheduleConflictException { if (sectionId < 0) { throw new IllegalArgumentException("Section id must not be negative."); } if (name == null) { throw new IllegalArgumentException("Section name must not ...
43438847-6950-42fe-b0db-479ad8a7dff9
7
@EventHandler(priority=EventPriority.LOWEST, ignoreCancelled=true) public void onPlayerPortal(PlayerPortalEvent event1) { if(debug) this.getLogger().info("PlayerPortalEvent cast"); UnitedPortalEvent ev=new UnitedPortalEvent(event1); if(!chevronFinder(ev)) { if(gateHandler(ev)) { ...
39fe42bf-392d-4ffb-8779-dd3d8d0431c9
1
private static int myRecursiveMethod(int aValue) { aValue--; System.out.println(aValue); if(aValue == 0) { return 0; } return myRecursiveMethod(aValue); }
9a6cbbca-12e5-42af-b608-6ae497329f05
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
16a4fba2-87b4-4cbc-a190-91d665340fa2
1
public void PerformIPTest() { if(!responseServer.running) { gameList.clear(); UpdateGameList(); } responseServer.startServerIPTest(); }
e131d3d5-ed72-4252-ad20-1445e1596bc7
0
public boolean isSatisfied() { return Satisfied; }
a08f10a8-cf47-4938-b87e-195d52a72a69
0
public void setUp() { Scanner scanner = new Scanner(System.in); setAquarium(scanner); setVictims(scanner); setStepToVictim(scanner); setPredators(scanner); setStepToPredator(scanner); setHurdles(scanner); setLengthLifeInAquarium(scanner); }
ac0f0b8a-b42e-438a-852e-0b4a4b1eeaf4
0
public int getCityID(){ return targetCityID; }
40e7cacd-d841-46b9-bf0e-a06196d9b58c
0
public JCheckBoxMenuItem getAcceptByHaltingCheckBox() { return turingAcceptByHaltingCheckBox; }
9021eba0-478f-4331-8e83-c303ea994277
2
private User findGameHostByID(String gameHostID) { for (int i = 0; i < availableGames.size(); i++) { if (availableGames.get(i).getID().equals(gameHostID)) { return availableGames.get(i); } } return null; }
aa00c9f3-0f73-41e4-911c-c659ddde83a2
4
public void setInterpolationMethod(int interpolationMethod) { switch(interpolationMethod) { case INTERPOLATE_REGRESSION: calculateBestFitLine(); case INTERPOLATE_LEFT: case INTERPOLATE_RIGHT: case INTERPOLATE_LINEAR: this.interpolationMethod = interpolationMethod; break; default: this.i...
e71e7ef7-cf9e-46c8-843c-060ca41cf630
7
private String startSetToString() { StringBuffer FString = new StringBuffer(); boolean didPrint; if (m_starting == null) { return getStartSet(); } for (int i = 0; i < m_starting.length; i++) { didPrint = false; if ((m_hasClass == false) || (m_hasClass == tru...
ecc49631-63ee-493e-a4ce-7a8d005a6314
6
private void FindObjectInRow (ABObject target, List<ABObject> objects, List<ABObject> directList) { for (int i = 0; i < objects.size(); i++) { if (directList.size() <= 3) { ABObject x = objects.get(i); if (x.getCenterX() >= target.getMaxX() && x.getCenterX() <= target.getMaxX() + 10) { if (x...
00267f11-f1dc-4f26-aa6f-71524fb61200
3
public static boolean isValidTime(String time) { String[] times = time.split(":"); for (int i = 0; i < times.length - 1; i++) if (!isInteger(times[i])) return false; if (!isDouble(times[times.length - 1])) return false; return true; ...
bd9e3bec-84c9-4797-ba30-d4d8d49983c3
8
public boolean stateEquals(Object o) { if (o == this) return true; if (o == null || !(o instanceof MersenneTwister)) return false; MersenneTwister other = (MersenneTwister) o; if (mti != other.mti) return false; for (int x = 0; x < mag01.length; x++) if (m...
6bb99425-d477-48e3-97db-cbeb6f41b742
5
private static void method499(char arg0[]) { boolean flag = true; for (int chars = 0; chars < arg0.length; chars++) { char c = arg0[chars]; if (Censor.isLetter(c)) { if (flag) { if (Censor.isLowerCaseLetter(c)) { flag = false; } } else if (Censor.isUpperCaseLetter(c)) { arg0[chars...
f3562e8a-152a-4066-bda3-bee844e2b800
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FloatPair floatPair = (FloatPair) o; return(floatPair.first == first && floatPair.second == second); }
a9f073dd-812b-4cc3-b535-6dd9368e0a82
5
public JmeControlsDemoScreenController(final String ... mapping) { if (mapping == null || mapping.length == 0 || mapping.length % 2 != 0) { logger.warning("expecting pairs of values that map menuButton IDs to dialog IDs"); } else { for (int i=0; i<mapping.length/2; i++) { String menuButtonId...
ecb89b92-eb83-427c-8396-31aa97eec7bf
7
public int[][] setMatrixZeros(int[][] m){ int nRow = m.length; int nColumn = m[0].length; //find all rows and columns should be set to zero boolean[] isZeroRow = new boolean[nRow]; boolean[] isZeroColumn = new boolean[nColumn]; for(int i=0;i<nRow;i++){ for(int j=0;j<nColumn;j++){ if(m[i][j]==0){ ...
3692842a-85bc-4372-8f0b-cb296f82ab8d
1
public Object getElement(int index) { if (indexOK(index)) { return array[index]; } return null; }
d52d7f99-457f-40a5-bbf6-b361e7c120f5
2
private void getFileNameImage(String line) { StringTokenizer tokens = new StringTokenizer(line); if (tokens.countTokens() == 2) { tokens.nextToken(); // skip command label loadSingleImage(GameController.IMAGES_DIR + tokens.nextToken(), "", 1.0f, (short) -1, (short) -1, (short...
081d7858-e48a-480c-97e4-8b6edc11d848
7
public void generateUsers(int nb) { String line; int end = currentLine + nb; int i = 0; InputStream is = null; BufferedReader br = null; try { is = getClass().getClassLoader().getResourceAsStream("data/data.csv"); br = new BufferedReader(new Inpu...
16658e71-226e-400a-aae5-fc7eac13eeb0
8
public void train(Vector labelset, Matrix dataset) throws TrainingException { if (labelset.size() != dataset.columnSize()) { throw new CardinalityException(labelset.size(), dataset.columnSize()); } boolean converged = false; int iteration = 0; while (!converged) { if (iteration > 10...
13055f1c-26f8-4c31-8503-d197cd6161c3
4
@Override public void apply(Graphics2D g) { g.setColor(new Color(color)); g.setStroke(new BasicStroke(strokeSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); int minX = Math.min(x, width); int minY = Math.min(y, height); int maxX = Math.max(x, width); int maxY = Math.max(y, height); int width = m...
8d6606df-8158-41e7-8c7e-6355bf305346
7
public synchronized void run() { long lastMinute = System.currentTimeMillis(); long lastTime = System.nanoTime(); double nsPerTick = 1000000000 / 60.0; int frames = 0; long lastTimer = System.currentTimeMillis(); double delta = 0; while (running) { try { if (System.currentTimeMillis() > lastMinute...