method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0b2bd5fe-c458-43dc-bcc0-904c9bbfc6c2
2
@Override public void actionPerformed(ActionEvent event) { String before = gui.getOutput().getText(); if (before.equals("0") && !leaveZero) before = ""; gui.getOutput().setText(before + text); }
6e76e34a-f58b-4c12-b97c-8be42da9396f
2
public static ArrayList<Titulo> sqlSelectTodos(){ ArrayList<Titulo> titulo = new ArrayList(); if(!BD.getInstance().sqlSelect("SELECT * FROM titulo ORDER BY idtitulo DESC")){ return titulo; } while(BD.getInstance().sqlFetch()){ titulo.add(new Titulo(BD.getI...
3df2913e-3916-4689-b2ba-84c77b7a3cce
4
public String convertHashToString2(HashMap<String, Boolean> hash) { if (hash.isEmpty() || hash == null || hash.size() < 1) return ""; StringBuilder sb = new StringBuilder(); for (Map.Entry<String, Boolean> en : hash.entrySet()) { sb.append(en.getKey()+":"+en.getValue()+","); } sb.deleteCharAt(sb.length()-1...
44e0513f-285d-461c-8d1f-5eb4d19da82a
8
private Dish process(String transition, boolean await) { requireNonNull(transition, "transition is null"); int l = transition.length(); if (l == 0) { throw new IllegalArgumentException("transition is the empty string (\"\")"); } Parser parser = new Parser(transition);...
d2ad7252-4900-460f-b6f3-caf29b299628
5
public MainFrame(Fachada fachada) { this.fachada = fachada; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 873, 554); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); this....
d63f6c42-6f70-43bc-a709-52209340d5af
7
private SeekTable makeSeekTable() { long lastSampleNumber = 0; long lastStreamOffset = 0; // process selected files for (int i = 0; i < flacFiles.size(); i++) { File file = (File)flacFiles.get(i); try { FileInputStream is = new FileInputSt...
4a3bab30-760b-4e9e-ab5f-554a25e06759
8
public void actionPerformed(ActionEvent ae) { String command = ae.getActionCommand(); String subCommand = command.substring(1); /* * Prefix ------ D:tablet display L:Login F:Floor T:Table C:Command * M:Menu S:SubMenu R:Register */ switch (command.charAt(0)) { case 'D': eventDisplay(subCommand); ...
22d80d5f-0c6c-405a-af33-2da17f4f4a7e
9
@Override public void sell(String title, double price) { if (removed_dvds.contains(title)) throw new IllegalArgumentException( SessionErrors.TRANSACTIONS_NOT_ALLOWED); if (!dvd_collection.containsKey(title)) throw new IllegalArgumentException(SessionErrors.DVD_NOT_FOUND); if (price <= 0) throw new ...
3dcc132b-897d-4b62-bf94-1e5176679498
7
public CameraFeed (JPanel content, String view) { String url = ""; boolean contains = false; String text = ""; JLabel viewText = new JLabel(); viewText.setFont(new Font("Sans Serif", Font.BOLD, 30)); for(String i : screens){ if(i.equals(view)){ url += "Images/" + view + "_large.jpg"; cont...
0b790bd7-8845-4bf0-878f-3c6f7455c767
3
@Override public void removePlayer(User user) { GuessTheNumberPlayer u = null; for (GuessTheNumberPlayer guessTheNumberPlayer : players) { if(guessTheNumberPlayer.getUser().equals(user)) { u = guessTheNumberPlayer; break; } } players.remove(u); if(players.size() == 0) super.removeGame(); }
78e449c9-2891-4f86-8889-f2682602b531
6
public static boolean fullyDelete(File dir) throws IOException { File contents[] = dir.listFiles(); if (contents != null) { for (int i = 0; i < contents.length; i++) { if (contents[i].isFile()) { if (!contents[i].delete()) { return ...
a0f3a97f-7737-4cba-86b6-c292f524c7e4
5
synchronized int decodevs_add(float[] a, int offset, Buffer b, int n){ int step=n/dim; int entry; int i, j, o; if(t.length<step){ t=new int[step]; } for(i=0; i<step; i++){ entry=decode(b); if(entry==-1) return (-1); t[i]=entry*dim; } for(i=0, o=0; i<dim;...
10d4f05a-b914-42c6-b8ed-6baa1b1de57b
7
@SuppressWarnings({"unchecked", "rawtypes"}) private ModelAndView handleResponseBody(Object returnValue, ServletWebRequest webRequest) throws ServletException, IOException { HttpInputMessage inputMessage = new ServletServerHttpRequest( webRequest....
47fd817c-4fbe-48e6-b75a-cb3a41cbf107
7
public void pushCookie() throws IOException, JSONException, IllegalBlockSizeException, IllegalBlockSizeException, IllegalBlockSizeException, BadPaddingException, BadPaddingException, BadPaddingException, NoSuchAlgorithmException, NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, NoSuchPaddingExcep...
a47784e2-8204-40e4-b172-1842836ae0ff
4
private void getWaitingPage(HttpServletResponse resp, UserSession session, Map<String, Object> pageVariables, String pageTemplate) throws ServletException, IOException { String isWaiting = "false"; if (session != null) { switch (session.getStatus()) { case AccountServiceMessa...
512f6d67-7013-4fb5-b20b-a75f1a94132c
1
@Test public void testInvalidType() throws Exception { final Properties p = new Properties(); p.setProperty("type", "java.lang.String"); final Properties[] configs = new Properties[]{p}; final FilterFactory ff = new FilterFactory(configs); try { final Filter[] fil...
e514d652-b541-4345-9e18-4e443bd6445b
2
public Object getValueForKeyword(final CycSymbol keyword) { for (int i = 0; i < this.size() - 1; i++) { if (this.get(i).equals(keyword)) { return this.get(i + 1); } } return null; }
03b91500-4bcb-42e2-b0e2-01d03f13a483
3
public ButtonArray(int sizeField) { this.graphic = new ArrayList(); for (int i = 0; i < sizeField; i++) graphic.add(new ArrayList<Button>()); for (int i = 0; i < sizeField; i++) { for (int j = 0; j < sizeField; j++) { graphic.get(j).add(new Button("", i, j)); ...
aa6b6256-82f5-4bda-ac00-490b389eadc5
2
private void searchNewPath() { if(Goals.isEmpty()) { return; } //Zufaellige Position bestimmen und Weg ermitteln int[] pos = getValidPosition(); int[] bg = PathFinder.getBestGoal(Lines, Goals, new float[]{pos[0], pos[1]}, false); PathFinder PF = new PathFinder(Lines, pos, bg, PathFinder.MODE_TREE...
69ccf825-0848-4605-a48a-cdb5d7520828
2
public void selectFile() { filePath = dlgFileSelector.open(); if (filePath != null) { String name = dlgFileSelector.getFileName(); if (name.length() > 50) { name = name.substring(0, 47) + "..."; } lblBoardFileName.setText(name); } ...
a6520ad2-3ffe-4c03-858c-2c7ffa5237b0
3
public String getTooltipExtraText(final Province current) { if (!Main.map.isLand(current.getId())) return ""; StringBuilder ret = new StringBuilder("Regions: "); List<String> regions = Main.map.getRegionsOfProv(current.getId()); java.util.Iterator<String> itr = regio...
f342886c-eac4-4fde-8131-79797f75ce73
9
private boolean crossingInternal(Point2D.Double direction1, Point2D.Double direction2) { if (angles.size() < 2) { return false; } final double angle1 = convertAngle(getAngle(new Line2D.Double(center, direction1))); final double angle2 = convertAngle(getAngle(new Line2D.Double(center, direction2))); Double...
4d3ec3b4-57e0-45ee-b93b-af283855f687
0
public void setMaximized(boolean maximized) { ((OutlinerDesktopManager) getDesktopManager()).setMaximized(maximized); }
06c65bfe-ce76-4415-8480-4e5a16bc3b56
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to str...
409aab26-97e7-48bd-86a0-830b9aae2090
1
public static void main(String[] args) { // TODO code application logic here BigInteger TwoInThouthand, Two; String TwoInTh; int a = 2; int sum = 0; int Thouthand = 1000; Two = BigInteger.valueOf(a); TwoInThouthand = Two.pow(Thouthand); TwoInTh = T...
771d0d8b-c5dc-40b1-bc54-49cb0573d30b
0
public RoomEntity getRooms() { return rooms; }
b02df491-0def-44db-aa84-0a728b6edcb3
4
private long persistPhysical(Physical physical, String table) throws SQLException { Connection connection = null; PreparedStatement preparedStatement = null; String insertSQL = "INSERT INTO " + table + "(bank_account,name,surname,patronymic,passport_series,passport_number,phone) VALUES" + "(?,?,?...
94ca3211-5a57-4080-b30b-e08619330087
3
@Override public void run() { while (this.isRunning) { try { // Tell model to update, send next key press. // or 0 if no new keypress since last update. this.gameModel.gameUpdate(nextKeyPress()); this.view.repaint(); Thread.sleep(this.updateInterval); } catch (GameOverException e) { /...
b8c7106b-9fad-457f-9a58-f630ca6a9940
8
public void run() { boolean newPeer; generateHandshake(); byte[] handshakeResponse; // this happens when we are the ones who want to download if (s == null) { newPeer = false; if (getConnection()) { System.out.println("got connection to " + this.ip); pMgr.addConnectedPeer(this); } ...
bf66bad8-b6be-425d-8627-f36bb2aa8b7c
2
@Override public void replaceArgument(Value replace, Value newVal, boolean throwOnError) throws Exception { if(argument.equals(replace)) { argument = newVal; } else if (throwOnError) { throw new Exception("error replacing argument, argument not present in instruction"); ...
b96cdda7-a13c-48d4-8f03-55adb2c47a60
2
public void crearDomino(){ //Crea todo el domino en la lista de Fichas "listaFicha" for (int i = 0; i < 7; i++) { for (int j = i; j < 7; j++) { Domino.listaFicha.add(new BotonFicha(i,j)); Domino.listaFicha.get(Domino.listaFicha.size()-1).setName(i+"-"+j); ...
c722c649-0e26-4deb-8a54-fdc4d2a42eaf
4
public Direction getDirectionToLocation(Location loc) { if(row < loc.getRow()) return Direction.SOUTH; if(row > loc.getRow()) return Direction.NORTH; if(column < loc.getColumn()) return Direction.EAST; if(column > loc.getColumn()) return Direction.WEST; return null; }
dc6d89fa-83f6-4ccb-991f-20974e8bd319
2
public void Imprimir() { if (VaciaLista()) { System.out.println( "vacia" +Nombre); } //fin del primer if else { System.out.print( "La " + Nombre +" es: "); NodosProcesos Actual = PrimerNodo; while (Actual.siguiente != PrimerNodo) { System.out.print (Actual.datos + " "); ...
2f89102b-0111-4985-ac72-70abd7c62406
8
private Vector getReflectedVector(final Projectile oldProjectile, final Vector oldVelocity) { Vector newVector = oldVelocity.clone(); newVector.setY(-newVector.getY()); Vector normalized = oldVelocity.normalize(); double x = normalized.getX(), z = normalized.getZ(); Block loc = oldProjectile.getLocation()...
9df39f37-f788-4145-85eb-85d7c3cb0ad2
0
public PlotView() { surfacePanel = new JSurfacePanel(); }
31d946d8-291a-423d-a921-1aba7335d7a7
1
public void writeLong(long v) { // writeQWord try { payload[offset++] = (byte) (int) (v >> 56); payload[offset++] = (byte) (int) (v >> 48); payload[offset++] = (byte) (int) (v >> 40); payload[offset++] = (byte) (int) (v >> 32); payload[offset++] = (byte) (int) (v >> 24); payload[offset++] = (byte) (...
77f5d548-4d02-4e2d-80f1-dc7a2ef2d4c9
2
int trimIndex(Fastq fastq) { int qual[] = FastqTools.qualtityArray(fastq); for( int i = 0; i < qual.length; i++ ) if( qual[i] < qualityThreshold ) return i; return qual.length; }
25fc0f97-b170-45f5-84aa-ada877c65202
0
private void action(final int aNumber) { System.out.println(aNumber); }
6dd5c5ac-51b1-4ff2-853d-8db0c6b7e5fa
3
public static void shallowCopyFieldState(final Object src, final Object dest) throws IllegalArgumentException { if (src == null) { throw new IllegalArgumentException( "Source for field copy cannot be null"); } if (dest == null) { throw new IllegalArgumentException( "Destination for field copy c...
adfa0538-997c-4bc0-988f-f55c0d3fdae3
9
public MasterGraph(Layer layer) { super(); View view = layer.getParent(); view.updateAlignmentData(); ArrayList<ArrayList<Pair<Layer, Node>>> alignmentGroups = view.getAlignmentGroups(); ArrayList<Node> masterNodes = new ArrayList<Node>(); Hashtable<Node, Node> nodeToMasterNode = new Hashtable<Node, No...
9bd37dac-9977-4f1b-9048-58a291155c13
1
public JMenuItem getMntmSalir() { if (mntmSalir == null) { mntmSalir = new JMenuItem("Salir"); } return mntmSalir; }
d0842e87-0676-4c2f-8e74-6e70f5aa0886
6
public static ArrayList<LinkedList<TreeNode>> findLevelLinkedList(TreeNode root){ ArrayList<LinkedList<TreeNode>> result = new ArrayList<LinkedList<TreeNode>>(); LinkedList<TreeNode> list = new LinkedList<TreeNode>(); int level = 0; list.add(root); result.add(level, list); while(true){ list = new LinkedL...
81563610-1467-4e52-ab10-9d2390eedc39
5
@Override public boolean equals(Object c) { if (c == null) { return false; } if (c == this) { return true; } //since Combination is a final class, the instanceof operator is safe here if (! getClass().equals(c.getClass())) { ...
dd41e623-65f1-4ac0-ad2c-24323275203e
4
public void setFullscreen(final boolean fullscreen) { /* * if(macOsUtils != null) { macOsUtils.setFullscreen(fullscreen); * return; } */ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GraphicsDevice screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScree...
6ca09011-5abe-48ee-9d55-0dac22f1e7b4
3
public static void main(String[] args) { File file = new File("/home/elblonko/Desktop/DICOMFiles/BRAINIX/sequence/IM-0001-0001.dcm"); FileInputStream fis = null; try { fis = new FileInputStream(file); System.out.println("Total file size to read (in bytes) : " ...
4673b718-68e7-44aa-af6c-b309859ef6f1
3
public void display() { if(this.isEmpty()) { System.out.println("Empty... nothing to display"); }else { System.out.println("The Array: "); for (int i =0; i<bookArray.length; i++) { if(bookArray[i]!=null) System.out.println("\t"+'"'+bookArray[i]+'"'); } } }
4699b3e9-f764-402c-976d-291416fab695
1
public final void setX(int x) { if (x < 0) { return; } this.x = x; }
2a10d611-ba16-4256-86b1-d78f694949ad
0
public void setString (String someString) { string = someString; }
e070594d-d412-4ba2-ab13-4f1b83f62185
6
public BiCubicSplineFast(double[] x1, double[] x2, double[][] y){ this.nPoints=x1.length; this.mPoints=x2.length; this.csm = new CubicSplineFast(this.nPoints); this.csn = CubicSplineFast.oneDarray(this.nPoints, this.mPoints); this.x1 = new double[this.nPoints]; thi...
87b05426-19ec-46f6-98f8-1c8aeae7438e
4
public boolean egaliteDesCentres(List<Float> a, List<Float> b) { boolean resultat=true; int nbMiniCoordonnees = Math.min(a.size(), b.size()); if (nbMiniCoordonnees==0) { resultat=false; } for (int i=0; i<nbMiniCoordonnees ; i++) { if (a.get(i)!=null && b.get(i)!=null) { resultat&=(Math.abs(a....
9a50bd21-2012-437b-8240-cf3207424aaa
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; @SuppressWarnings("unchecked") Pair<F, S> other = (Pair<F, S>) obj; if (f == ...
e6d90858-5c5a-4cad-930c-f6e916cb82fe
6
public Configuracion() { initComponents(); ImageIcon iconLogo = new ImageIcon(IMG.getImage("menu_soldados.png")); ImageIcon iconLogo2 = new ImageIcon(IMG.getImage("Label_nombre.png")); jLabel2.setIcon(iconLogo); JTextField jTextField1 = new javax.swing.JTextField(); jText...
0ec799ed-89c4-48af-8533-6013a987090d
5
public static boolean portAvailable(int port) { if (port < 0 || port > 65535) { throw new IllegalArgumentException("Invalid start port: " + port); } ServerSocket ss = null; try { ss = new ServerSocket(port); ss.setReuseAddress(true); return true; } catch (IOException...
45f46d27-e793-4f16-8747-4c7784674462
5
public String getDirectory(String folder){ String path = this.gameDirectory; switch( folder ) { case "guess": path += "\\Images\\GuessImages\\"; return path; case "menu": path += "\\Images\\MenuImages\\"; return pat...
c282a5cc-fb21-4f8c-a115-9c0a4f121ea8
4
public void actionPerformed(ActionEvent e) { if(e.getSource() == wButton) { label1.setText("You go to the front of the bus and see no driver. The bus suddenly combusts sending you flying into the air. You land on the ground next to a tree. You see a shack to the north and a forest on all other sides...
ac4532b4-37d7-4d24-8986-21c74cc27f61
1
private String formatExecuteMethod(int testCount) { StringBuilder testMethodCalls = new StringBuilder(); for (int i = 0; i < testCount; i++) { testMethodCalls.append(String.format(TEST_METHOD_CALL_TEMPLATE, i)); } return String.format(EXECUTE_METHOD_TEMPLATE, testMethodCalls....
f81c98be-afa4-410d-862d-bb55c57a4ef1
7
public void buildClassifier(Instances data) throws Exception { if (!m_checksTurnedOff) { // can classifier handle the data? getCapabilities().testWithFail(data); // remove instances with missing class data = new Instances(data); data.deleteWithMissingClass(); } // Preproce...
e7405ebb-79fa-4d07-b652-56b697d9675a
6
@Override public void run() { if (announcements.size() > 0) { while (!(announcements.get(counter).equals(")"))) { String message = FontFormat.translateString(prefix + announcements.get(counter)); if (plugin.getConfigStorage().settings_bouncybungeeon) { BungeeAnn...
f256d1d7-fafc-4763-ba59-1bb444782ef2
4
protected void fireUndoableEditUpdate(UndoableEditEvent e){ String s = e.getEdit().getPresentationName(); if( keyword != null && s.contains(keyword)){ currentCompoundEdit.addEdit(e.getEdit()); currentCompoundEdit.end(); keyword=null; //fireUndoableEditUpdate(new UndoableEditEvent(this, (UndoableEdit)currentC...
4d2baf93-a2e7-40cf-9955-550ae617eb80
2
public boolean quitChecker(String input) { boolean okToQuit = false; if (input != null && input.equals("sayonara")) { okToQuit = true; } return okToQuit; }
26cc1ec9-7dcf-4f53-8f19-97bf1da3321b
3
public List<Integer> getFieldIntegerList() { List<Integer> a = new ArrayList<Integer>(); for (int i = 0; i < 999999; i++) { if (fcw.isSet(field + i)) a.add(i); else { breakCounter++; if (breakCounter > BREAK_COUNTER_LIMIT) return a; } } return a; }
653ca8f0-6613-43fb-9216-f44e0c86997a
1
@Override public void render(){ Transform adjustT = getTransform().copy(); adjustT.setScale(getScale().getX(),getScale().getY() - topBarHeight,0); SpriteVSShader.getInstance().bind(); SpriteVSShader.getInstance().updateUniforms(adjustT, material,new Vector4f(0,0,1,1)); MeshM...
3dcd32c0-63a0-4360-8384-06e2ff2057a4
9
static private boolean jj_3R_10() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(77)) { jj_scanpos = xsp; if (jj_3R_24()) { jj_scanpos = xsp; if (jj_3R_25()) { jj_scanpos = xsp; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3R_27()) { jj_scanpos = xsp; if (jj_3R_28()) ...
2d5a0b96-de28-45dd-91e3-26ec433f93b2
8
public boolean execute(Closure closure){ // get the internal thread number int i = getInternalThreadId(); System.out.println("activate(" + i + ")"); // ####################################################################### // guard stage // ###############################################################...
9e5fa99d-9396-48e3-8107-60582c763be8
0
public void add(T t) { objArr[index++] = t; }
7d971a63-1f12-4c05-a243-45d074f7d749
5
public void willTasteninfo(Object o) { for (Method meth : o.getClass().getMethods()) { if (meth.getName().equals(TASTE)) { Class<?>[] typen = meth.getParameterTypes(); boolean ok = (typen.length == 1); if (ok && typen[0] == java.lang.String.class) tastaturListener.add(o); ...
89aceb97-38aa-41b3-a3ce-ed569dfdefcc
2
@Test @Ignore public void test_AttendanceReadListGet() { AttendanceReadList laReadList = laClient.getAttendanceReadList(5, null, null, null); if (laReadList.getAttendanceReadList().size() > 0) { for (AttendanceRead laRead : laReadList.getAttendanceReadList()) { System.out.println(laRead.toString(...
e1970e97-4779-4daa-999d-db296c7a7e8a
4
public void attaquerCible(Attaque attaque, Personnage persoCible) { persoCible.appliquerEffets(attaque); if(persoCible.getPv() <= 0){ for(Joueur j : this.getJoueurs()){ if(j.getPersonnages().contains(persoCible)){ j.getPersonnages().remove(persoCible); ...
32ef2ded-5156-40dc-a4d7-dacc3eeae4da
4
@Override public int compare(TwoTuple<Boolean, GameEntity> tt1, TwoTuple<Boolean, GameEntity> tt2) { if (!tt1.one && tt2.one) { return 1; } else if (tt1.one && !tt2.one) { return -1; } ...
5115b5ef-89db-4163-8ca6-384e30e1237b
0
public boolean isAccept() { return isAccept; }
85f7106d-f27f-4abc-94a1-520f95ca9633
2
public MatrixDialog( Frame owner, String title, double[][] initMatrix ) { // create dialog super(owner, title, true); // create data int m = Matrix.getNumOfRows(initMatrix); int n = Matrix.getNumOfColumns(initMatrix); matrix = Matrix.newMatrix(m, n); // create dialog content JPanel mainPn = new JPanel(new ...
db566a31-6065-4e38-aaa8-5c761f90b327
7
@Test public void testMultipleJobsDataRequests() { System.out.println("multipleJobsWithDataRequests"); final Counter totalCounter = new Counter(); final Counter requestCounter = new Counter(); final String dataTitle = "dataId"; final double requestMultiplier = 2; c....
a5d1d810-df06-48fc-9076-e8ebfe080c87
0
public static List<Visiteur> selectAll(EntityManager em) throws PersistenceException { List<Visiteur> lesVisiteurs = null; Query query= em.createQuery("select v from Visiteur v"); lesVisiteurs = query.getResultList(); return lesVisiteurs; }
670f2241-1eeb-4d7c-9b41-c0ce80ea50d0
7
private void parse(CommandSender sender, UltimateCommand command, String label, List<String> args) { if (!reqAreMet(sender, command)) { // noPerms(sender); return; } for (UltimateCommand cmd : command.getSubCommands()) { if (args.size() > 0 && StringUtils.conta...
5e1bddf0-96ce-4fe4-86f5-7842abc1a6e5
2
public PlayerMP getPlayerMP(String username){ for(PlayerMP player : this.connectedPlayers){ if(player.getUsername().equals(username)){ return player; } } return null; }
a3ed7a38-0c10-483e-b19e-daf9749e2502
8
private static void initialize(){ /*Initialize modules*/ office = new Office(); trackModelInterface = new TrackModelInterface2(); trainModel = new Vector(); trainController = new Vector(); trainControllerUI ...
802074df-2e15-4e1d-9beb-5dc5dc36872f
8
public static void sanityCheckIfInLegalMoveList(Position currentPos, String explicitMove, String filename) { ArrayList<String> moveList = LegalMoveFetcher.getLegalMoveListPlusCheckDetails(currentPos); String fromMyProg; String fromFile; for(int i=0; i<moveList.size(); i++) { //For Carlsen: (he has no # si...
58656730-de0b-4493-9b55-552da7a4a179
7
public void ping() { new Thread() { public void run() { try { pinging = true; ping = -1; Socket s = new Socket(); s.connect(getAddress(), 2000); Server server = new Server(s); Client.instance.remotes.add(server); final long start = System.currentTimeMillis(); serv...
1a404fe1-4ac4-42b7-be77-cb087d80942b
6
public static void main(String args[]) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); int testCase = 0; while (T > 0) { T--; testCase++; HashMap websites = new HashMap(); HashMap input =new HashMap(); websites.clea...
db43cb35-6809-40e2-b7a0-ef68a28a33f3
4
public Mob copy(){ Mob n = new Mob(name, ID, sceneID, x, y, layer); n.resetHealth(health, maxHealth); n.setDefaultState(defaultState); if(script!=null) n.setDialogueScript(script.ID); if(discoverScript!=null) n.setDiscoverScript(discoverScript.ID); if(attackScript!=null) n.setAttackScript(attackS...
7d8564c9-fd9e-4e10-920a-72a560b32c45
5
private void JARbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JARbuttonActionPerformed // TODO add your handling code here: try { JarClassLoader jarLoader = new JarClassLoader(new URL("http://apollophotos.com/cs360/test/")); try { jarL...
161325d0-3734-40a4-9b52-c54c22469c4b
9
protected void computeMaxAndMin() { Vector3d max = new Vector3d(); Vector3d min = new Vector3d(); for (int i = 0; i < 3; i++) { maxVtxs[i] = minVtxs[i] = pointBuffer[0]; } max.set(pointBuffer[0].pnt); min.set(pointBuffer[0].pnt); for (int i = 1; i < ...
577a5e15-501c-4a15-a627-5c21b02c008f
6
@Override public Collection<Appliance> getViableAppliances(Collection<Appliance> allObjects){ Collection<Appliance> viableObjects = new ArrayList<>(); if(performedAt != null){ for (Appliance obj : allObjects) { if (performedAt.equals(obj.type)) { ...
1bca69a9-5b99-4f55-8079-bf0eed942780
4
@SuppressWarnings({ "unchecked", "rawtypes" }) public static final byte[] encode(Object o) throws BencodingException { if(o instanceof HashMap) return encodeDictionary((HashMap)o); else if(o instanceof ArrayList) return encodeList((ArrayList)o); else if(o instanceof ...
d52c72e6-c610-4d29-8a95-46a66e0d05bf
0
public void contextDestroyed(ServletContextEvent sce) { }
5bb372a4-b747-4fd1-9c0b-700eb2b6bc85
0
public int getCost(int skill) { return skillCosts[skill]; }
ece4d57d-3ef2-46c0-8eb1-0e4525e1ccfd
5
public void initResources() { final Class clazz = PaintExample.class; if (resourceBundle != null) { try { for (int i = 0; i < tools.length; ++i) { Tool tool = tools[i]; String id = tool.group + '.' + tool.name; InputStream sourceStream = clazz.getResourceAsStream(getResourceString(id + ".image...
0c6eabdc-32fc-4158-8795-c9f0fc859eb9
1
public User saveUser(User user) { if (log.isDebugEnabled()) { log.debug("user's id: " + user.getId()); } getHibernateTemplate().saveOrUpdate(user); // necessary to throw a DataIntegrityViolation and catch it in UserManager getHibernateTemplate().flush(); retur...
e49c1fe9-e06f-4199-b3ae-04d366e8ee25
3
private boolean _jspx_meth_c_import_0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:import org.apache.taglibs.standard.tag.rt.core.ImportTag _jspx_th_c_import_0 = (org.apache.taglibs.standard....
1348b84f-c80e-4310-82b7-77ee37e55f4b
1
private void downloadCache(String... args) { if(!DOWNLOAD_CACHE) return; CacheDownloader.main(args); }
b2c60dfb-ae68-4210-ada2-b35cb32072c4
6
private BalancedTreeNode<E> balance(BalancedTreeNode<E> node) { if(node == null) { return node; } if(height(node.left)-height(node.right) == 2) { if(height(node.left.left) >= height(node.left.right)) { node = rightRotate(node); //LL } else { node = leftRightRotate(node); //LR } } else if(...
617d8600-faa4-4726-ad3c-7012caa49e8e
7
public int hexSideInPixels(int availableWidthForMapInPixels, int availableHeightForMapInPixels) { int h = availableHeightForMapInPixels; int w = availableWidthForMapInPixels; int resultBasedOnHeight = (int) Drafter.roundToNearestEvenNumber(h / getMapHeightInHexSide...
b8164b0c-4847-43d7-85d6-3dd36e751f3f
0
private String readInput() throws IOException { return this.keyboard.readLine(); }
d50bbd01-c3ee-4752-829a-e3a80eb47c3f
1
public boolean contains(int key) { if (list.containsKey(key)) { Opponent opp = list.get(key); opp.checkNewDay(); opp.select(); return true; } else { return false; } }
ae49e577-b1d0-4c79-a74e-9986bd071b1b
0
private void daytonaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_daytonaButtonActionPerformed // TODO add your handling code here: EventDescriptionWindow newWindow = new EventDescriptionWindow(); EventDescriptionWindow.setEventDesription(knowledge.daytona.getEventDesc...
f78d46e0-5e55-41b6-ab1f-db81c38114d1
3
private boolean CFASLStringTest(String str, int opcode) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); CfaslOutputStream cos = new CfaslOutputStream(baos); cos.writeObject(str); cos.flush(); byte[] ba = baos.toByteArray(); if (ba == null || ba.length == 0) ...
a130d086-c853-4f8a-9c43-92c293eae817
4
/* */ public void mouseClicked(MouseEvent m) /* */ { /* 438 */ switch (m.getButton()) /* */ { /* */ case 1: /* 441 */ break; /* */ case 2: /* 445 */ break; /* */ case 3: /* 448 */ break; /* */ case 4: /* */ } /* */ }
23ef72de-bae7-48be-a815-8190a40e0b90
5
public long recursiveAddition(int depth, int index) { long valueLeft=0; long valueRight=0; long valueBiggest; // calculatedPath.append(depth); // calculatedPath.append(index); if (depth==0){ // || if the value is already known calculatedPath.append(depth); calculatedPath.append(index); memoStri...
9ab9687d-d8ea-4576-b11c-1cb4ffdddc87
4
public AccessCache buildCache(String[] detailsURIs, String cacheType) throws IOException{ AccessCache cache = new AccessCache(); ArrayList<String> links = new ArrayList<String>(); ArrayList<String> filter = new ArrayList<String>(); ArrayList<String> magnetLinks = new ArrayList<String>(); ArrayList<String...
e1f8b579-569c-44df-bcd8-6882b27be696
9
public int getBlockTextureFromSideAndMetadata(int par1, int par2) { int i = par2 & 7; if (i == 0) { return par1 > 1 ? 5 : 6; } if (i == 1) { if (par1 == 0) { return 208; } return par1 != 1 ...