method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
07c85f65-f41f-4cba-b7ef-4d7dfa903038
2
public static void main(String[] args) throws IOException { /* * Important: Be sure to fill in your AWS access credentials in the * AwsCredentials.properties file before you try to run this * sample. * http://aws.amazon.com/security-credentials ...
74d049f5-ba6a-4a11-93fc-57650422b9a7
7
void drawHealth(Entity e,Graphics g){ if(e!=null ){ if(e.getHealth() >= 5*e.maxHealth/5){ g.setColor(Color.GREEN); } if(e.getHealth() == 4*e.maxHealth/5){ g.setColor(Color.YELLOW); } if(e.getHealth() == 3*e.maxHealth/5){ g.setColor(Color.ORANGE); } if(e.getHealth() == 2*e.maxHealth/5){ g...
7d0d3796-663e-4968-b224-d2bcc185306d
1
public void stopAnimation() { if(this.play) { this.play = false; this.allive = false; } }
69a3437b-3289-4672-ab66-8462b9e72f16
6
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case 0: // ID return Integer.class; case 1: // Firstname return String.class; case 2: // Lastname return String.class; case 3: // Birth return Date.class; case 4: // Email return String.class; ...
b7e90a82-ac87-4d65-9b97-d58f962b478c
5
public Tile(int x, int y, int type) { this.tileX = x * 40; this.tileY = y * 40; this.type = type; if (type == 5) { tileImage = GameEngine.tiledirt; } else if (type == 8) { tileImage = GameEngine.tilegrassTop; } else if (type == 4) { tileImage = GameEngin...
27e6cd37-c451-430c-884e-5ca668b091dc
0
public String getLoginpwd() { return loginpwd; }
4e97c4fe-6941-4501-97a6-b015bd690c95
0
@Override public void setExecCommand(String execCommand) { this.execCommand = execCommand; }
89a3087c-a54e-4762-b443-c2398682b7bf
0
CarListItf deserializeFromJson(String json) { AutoBean<CarListItf> bean = AutoBeanCodex.decode(factory, CarListItf.class, "{\"cars\": " + json+ "}"); return bean.as(); }
f7bd2c9a-ce67-4dc1-925d-df8846ee9706
1
public static PropertyManager getInstance(){ if(instance == null){ instance = new PropertyManager(); } return instance; }
b49555c3-a62c-47f4-80f1-1c5895bb236b
3
public AdminLogin() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); setLocationRelativeTo(null); JPanel panel = ...
c20f68ad-6437-4eec-8f7e-e46929caa619
8
private boolean testNetworksAccount(){ int testIndex=0; boolean bError=false; Properties twitterAccount= null; Properties blueviaAccount=null; Properties facebookAccount=null; ++testIndex; twitterAccount = Util.getNetworkAccount("aleonar@gmail.com", "TwitterAccount"); if (twitterAccount!=null){ ...
faf9fe54-5a19-4385-acee-5f2429b47d91
9
public static void main(String[] args) throws ParsingException, IOException, XMLStreamException { if(args.length == 0 || args.length > 3) { System.err.println("Incorrect number of arguments"); printHelp(); System.exit(1); } boolean compressed = false; String fileName = null; for(String arg :...
9cb6037e-216a-493c-9a8e-a0bd7a0ae2b3
9
@Override public HashMap<String, Level> loadAll() { //Create hashmap of levels HashMap<String, Level> levels = new HashMap<String, Level>(); //for each file in the directory which has the proper extension for(File f : getDirectory().listFiles( new FilenameFilter(){ @Override public boolean accep...
782d853a-0d09-4583-a424-004f05884446
2
public boolean intersects(BitSet set) { for (int i = Math.min(wordsInUse, set.wordsInUse) - 1; i >= 0; i--) if ((words[i] & set.words[i]) != 0) return true; return false; }
2dcbaa04-db79-4c77-820b-d8720a9e37a8
4
public TroubleTest(final File workingDirectory) { final String name = getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1); this.working_directory = workingDirectory; if (!working_directory.isDirectory()) { Assert.fail("working directory not found: " + working_d...
4c7e15e4-c2fc-487c-ba82-779a70e30b45
7
public void exitState(){ if (state == 0){ // determine deal state ++; muck(); shuffle(); } else if (state == 1){ // deal state ++; } else if (state == 2){ // discard and cut state ++; selections.clear(); count = 0; } else if (state == 3){ // peg state ++; computerHand.getCards()...
01ab47d5-1687-443e-8606-51fe9c57aeec
0
@Test public void testGetCell() throws Exception { System.out.println("getCell"); int[] cell = new int[2]; cell[0] = 0; cell[1] = 0; World instance = new World(); instance.readInWorld("1.world"); Cell expResult = new Cell(0,0); AntBrain ab = n...
416f949c-f334-4b37-bfc1-290cc46a0611
4
protected void setPieceSkirt() { int wmax = width; int hmax; skirt = new int[wmax]; for (int i = 0; i < wmax; i++) { Point temp = null; hmax = 10000; for (int j = 0; j < body.length; j++) { ...
53b12ec6-dbe8-4758-b3ea-12f52a06ec8f
6
public void refreshFilterRec(File parentFile){ for(File child : parentFile.listFiles()){ if(child.isFile() && !isValidFormat(child.getName())){ continue; } if(child.isFile()){ String text = FilenameUtils.getBaseName(child.getAb...
72f13e7f-375f-4391-ad0c-ea0a75d82843
0
public String getUri() { return uri; }
0958ce7e-2177-4924-ad9d-a955624b5b22
1
public void setNextSeg(VehicleAcceptor next) { if (next == null) throw new IllegalArgumentException(); _next = next; }
0a2c4c3d-e44f-4d28-a87b-d9e6cbd4474d
5
public void checkChanges(){ for(File file : listOfPatientFiles){ boolean isInToSend = false; for(int j = 0; j < listToSend.size(); j++){ File toSend = listToSend.get(j); //FILE EXISTS if(file.getName().compareTo(toSend.getName())==0){ isInToSend = true; //NEW VERSION if...
fafb3add-a9ad-41e4-81b9-ad643dcc6aab
9
public static void main(String[] args) { /* * Two Dimensional Array */ String[][] array = new String[10][10]; for(String[] row : array) Arrays.fill(row, "#"); /* * Stack */ Stack<Character> stack = new Stack<Character>(); stack.isEmpty(); stack.push('a'); st...
13fb6b2f-a660-4eba-9610-d80fa4d69ad1
8
@Override public boolean equals(Object other) { if (other instanceof Tuple) { Tuple otherPair = (Tuple) other; return ((this.first == otherPair.first || (this.first != null && otherPair.first != null && this.first.equals(otherPair.first))) && (this.second == otherPair.second || (this.second != null && otherPai...
5d9755a7-a917-44df-ad45-ce809f25bdc7
1
public void trimToSize( ) { int[ ] trimmedArray; if (data.length != manyItems) { trimmedArray = new int[manyItems]; System.arraycopy(data, 0, trimmedArray, 0, manyItems); data = trimmedArray; } }
ce8b0a64-3a5c-42f0-a63a-9cce2f7238d4
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Person)) { return false; } Person other = (Person) object; if ((this.cedule == null && other.cedule != null) ||...
3f3a12b9-aaf3-4a7f-9dcb-3557368f2b24
7
public static boolean readEvents(String name) { InputStream is = null; try { is = new FileInputStream(name); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(is); Scanner scan = new Scanner(is); //...
d196144b-37e5-4067-819e-e7206bf45e6c
4
public static int calulateFaceDistance(int x1, int y1, int x2, int y2, int face) { switch (face) { case 0: return calulateUpDistance(x1, y1, x2, y2); case 1: return calulateRightDistance(x1, y1, x2, y2); case 2: return calulateDownDistance(x1, y1, x2, y2); case 3: return calulateLeftDistance(x1, y...
fad54b4c-b02e-4997-bcf0-0030b367acec
9
private void parseArguements(String[] args, Job job) throws IOException { for (int i = 0; i < args.length; ++i) { if ("-input".equals(args[i])) { String files = args[++i]; for (String file : files.split(",")) { FileInputFormat.addInputPath(job, new Path(file)); } } else if ("-output".equals(arg...
753fbcd6-98ec-42d8-91d8-6ba8349d550e
1
@Test public void TallentaminenToimiiKunKasvatetaanOlemassaOlevaa(){ kirjoitaOikeanmuotoinenSyote(); tiedot.LueTiedotTiedostosta(); tiedot.lisaaUusiOpiskelu("opiskelu1", 5); tiedot.tallennaTiedostoon(); String luettu = lukija.next(); while (lukija.hasNext()){...
d59a7a13-7b84-4d8c-9508-204dfb164d27
3
public boolean startsWith( char[] prefix ) { int i; for ( i=0;i<prefix.length&&i<data.length;i++ ) { if ( data[i] != prefix[i] ) return false; } return i==prefix.length; }
f8f0c553-6e0e-485d-ab52-4b8b42474af3
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Recorder)) { return false; } Recorder other = (Recorder) object; if ((this.id == null && other.id != null) || (...
b63ecdbe-6ff8-4d6d-aaaf-cfca787e7ec2
6
public void onBlockRemoval(World par1World, int par2, int par3, int par4) { TileEntityChest var5 = (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4); if (var5 != null) { for (int var6 = 0; var6 < var5.getSizeInventory(); ++var6) { ItemSt...
5b2fc135-b1ec-4d77-9d8c-77df1a44e42f
5
public OpenAction(EditTextPageModel theModel) { OpenPages pages = theModel.getOpenPages(); System.out.println(pages.size() + "pages"); File fileToOpen = getOpenedFile(); if(fileToOpen!=null){ Scanner scan; try { scan = new Scanner(new FileReader(fileToOpen)); String allText=""; whil...
1f861a29-b02d-49c2-9c1f-474ca3b2455b
3
public String getImageName() { String firstName = isEatable() ? "eatable" : name; StringBuffer imageName = new StringBuffer(firstName); String phot = "" + (isEatable() ? photogram % 4 : photogram); for (int i = 0; i < 3 - phot.length(); i++) { imageName.append("...
eb290a26-98ab-4425-92e6-c168f00fef42
7
public static void main(String[] args) { // TODO code application logic here // 1.- Mira esta serie: 7, 6, 8, 4, 9, 2, 10, 0, 11, -2, ... //Cree una función que recibe dos enteros: x e y. Si alguno de ellos es 0 o negativo, o si son mayores que 255, la función debe devolver -1 //De lo contrario, la función de...
11d599f6-da4c-40a9-935c-595935fd76f9
9
private int getDaysInMonth(int month, int year) { if (month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11) return 31; else if (month != 1) return 30; else if (year % 4 == 0) return 29; else return 28; }
3c48b883-90e1-4b0f-a2db-a5bfb08c372e
5
private void tryLine(int x, int y, ELine line) { int count = 1; EField type = getField(x, y); x += line.getDx(); y += line.getDy(); while(x < getGameSize() && y < getGameSize() && x >=0 && y >=0) { if(getField(x, y) != type) { check(new WinLine(x - cou...
a19e8971-3cdc-435b-8ae1-d8ce1e720599
5
public boolean removeColumn(String sheetName, int colNum) { try{ if(!isSheetExist(sheetName)) return false; fis = new FileInputStream(path); workbook = new XSSFWorkbook(fis); sheet=workbook.getSheet(sheetName); XSSFCellStyle style = workbook.createCellStyle(); style.setFillForegroundColor(HSSFColor.GR...
d1f4eef5-1f79-41f2-b055-499602817650
4
public void merge(Vertex vertex){ //Remove self-loops while(this.adjacentVertexes.remove(vertex)); // Add the arrayList in the current vertex to the array list from incoming vertex for(Vertex n : vertex.getAdjacentVertexes()){ if(n == this) continue; // skip s...
d1a3b171-77ce-4052-8171-00e0be8ffb0d
0
@Override protected void setup(Context context) throws IOException, InterruptedException { headers = context.getConfiguration().get("header").trim() .split("\\,"); }
1279f62a-e650-4ed6-9cac-b5afe8e65452
4
@Override public HashMap<String, Sprite> loadAll() { //First get a hashmap of all images ImageLoader loader = new ImageLoader(); HashMap<String, BufferedImage> imageMap = loader.loadAll(); //Create a hashmap of sprites HashMap<String, Sprite> spriteMap = new HashMap<String, Sprite>(); //Declare a buf...
439a6b62-cc57-49a1-9e8f-25d3d9327de8
0
public int getLength() { return getFollowingGlieder(); }
8e9a9065-8b0f-484a-9f2b-68a335227b68
3
public void tick(long delta) { drawX = (int)(realX - game.getCameraX() - (width / 2)); drawY = (int)(realY - game.getCameraY() - height); //animation if(animated) { animationTimer -= ((0.000000001 * animationSpeed) * delta); if(animationTimer < 0) { animFrame...
3cdfcca7-ea91-42b2-8166-8e4b1e41a12c
9
@Override public void keyPressed(KeyEvent keyEvent) { int keyCode = keyEvent.getKeyCode(); if (keyCode == KeyEvent.VK_LEFT) { moveLeft(); } else if (keyCode == KeyEvent.VK_RIGHT) { moveRight(); } else if (keyCode == KeyEvent.VK_DOWN) { moveDown(); ...
63b92eb3-1ed2-456f-be01-17cb04b47421
3
public int getVariant() { int variant = bytes[8] & 0xff; if (variant >= varRes) return 3; if (variant >= varMS) return 2; if (variant >= varRFC) return 1; else return 0; }
4b85c187-1cbf-4fb8-814f-c384b788caa7
7
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, SvgGraphics svg) { final UPolygon shape = (UPolygon) ushape; final double points[] = new double[shape.getPoints().size() * 2]; int i = 0; for (Point2D pt : shape.getPoints()) { points[i++] = pt.getX() + x; points[i++] ...
acc20387-187d-434f-bbb2-aa74f4a3a174
6
public void run() { byte buf[] = new byte[DNSPacket.MAX_MSG_ABSOLUTE]; DatagramPacket packet = new DatagramPacket(buf, buf.length); packet.setLength(buf.length); while (_bContinueRunning) { try { synchronized(this) { ...
401998e3-20a6-4a95-a5a2-2b9e90b5180c
1
public void print() { if (root == null ) { System.out.println("This TreeBag is empty."); }else { System.out.println("inordered"); root.inorderPrint(); System.out.println("preodered"); root.preorderPrint(); System.out.println("postodered"); ...
f09398d2-0901-4258-b18c-aa8dc081b74a
1
@Override public QuadTree getQuadTree() { if (isParsed) { return quadTree; } else { initiateParsing(); return quadTree; } }
d8b1a7aa-0c63-49e5-aad8-cf0913df207b
9
public void getLeader() { networkController.SendMessage("getPromotion#" + clientId + "," + clientType + "," + userLeader + "," + userName); clientType = userLeader; leader = true; cleanLabels(); if(observer) getObserver.setVisible(true); if(contributor) getContributor.setVisible(true); if(repo...
7d4851bc-fb61-458b-b8f7-2d9c60f31470
6
@Test public void scoreIsReset() { assertTrue(score.getPoints(1) == 0 && score.getPoints(2) == 0 && score.getLives(1) == Const.initialLifeAmount && score.getLives(2) == Const.initialLifeAmount && score.getCombo(1) == Const.cheesePoints && s...
d426a62c-7bfe-45b5-a07e-bae810b70e74
4
@Override public MidiChannel[] getChannels() { ArrayList<MidiChannel> all = new ArrayList<MidiChannel>(); if (theSynths.size() == 1) return theSynths.get(0).getChannels(); else { for (Synthesizer s : theSynths) { MidiChannel[] temp = s.getChannels(); ...
8138e86a-a473-4f2f-b86b-e42742419439
0
public String getName() { return Name; }
ea19a547-9252-4934-9e4d-8d0e15436e55
2
@Override public boolean onKeyDown(int key) { if(super.onKeyDown(key)) { return true; } if(input.onKeyDown(key)) { display.updateScores(); return true; } return false; }
b205331a-c6ec-4086-9a76-85b9465547ae
1
public static void updateVille(int id,int idpays, String nom, String cp)throws SQLException { int result; String query; try { query = "UPDATE VILLE set ID_PAYS=?,VINOM=?,VICP=? WHERE ID_VILLE=? "; PreparedStatement pStatement = (PreparedStatement) ConnectionB...
f6e78fe5-08c9-4109-861a-85c54d6bca92
4
@Override @SuppressWarnings("unchecked") public List<mxGraphAbstractHierarchyCell> getPreviousLayerConnectedCells(int layer) { if (previousLayerConnectedCells == null) { previousLayerConnectedCells = new ArrayList[1]; previousLayerConnectedCells[0] = new ArrayList<mxGraphAbstractHierarchyCell>(connectsAsSo...
50db6b43-429f-4c8a-a879-dffea8c9af1a
9
public synchronized void dots(){ // clear image and z-buffer for (int i = pixels.length-1; i >= 0; i--) { pixels[i] = 0; pixelsZ[i] = 1000; } { for (int row=0; row<height-1; row++){ for (int col=0; col<width-1; col++){ int i = row*width + col; PlotVal p0 = plotList[i]; ...
4c816cbe-339b-43e8-956e-ff55fa665f65
2
public ListNode removeNthFromEnd(ListNode head, int n) { ListNode dummy = new ListNode(0); ListNode front = dummy, back = dummy; dummy.next = head; while(n-- > 0) front = front.next; while(front.next != null){ front = front.next; back = back.next; ...
417dddca-e33a-477a-bbc9-160928148516
2
public Boolean valida(Usuario u){ conn = Conector.conectorBd(); String nom = u.getNombre(); String ape = u.getApellido(); int pa =u.getPassword(); int co =u.getCodigo(); String di =u.getDireccion(); int fo =u.getFono(); String car =u.getCargo(); int ru =u.getRut(); ...
4a19c1b5-e767-4c93-b5c5-0f06cd77e564
0
@Override public <T extends PersistentObject> Collection<T> list(Class<T> entityClass) { CriteriaBuilder qb = em.getCriteriaBuilder(); CriteriaQuery<T> recordsQuery = qb.createQuery(entityClass); Root<T> root = recordsQuery.from(entityClass); recordsQuery.select(root); TypedQ...
c3065980-65a3-4058-bb6b-310a70d05267
0
public Node(int value) { this.value = value; this.prev = this.next = null; this.seqPrev = this; this.seqNext = this; }
bd364ca6-4402-4eca-ae2e-f837544f1189
4
@Override public void keyReleasedHandler(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { getCharacter().setImage(ResourceTools.loadImageFromResource("Resources/rear_idle.png")); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { getCharacter().setImage(ResourceTools.loadI...
88e36e30-ecb8-47d5-8810-c6e036624b91
2
@Override protected void loadDatabase() throws DataLoadFailedException { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException ex) { throw new DataLoadFailedException(ex); } try { connection = DriverManager.getConnection("jd...
7f862b4b-5813-45d7-b773-a6229ebd5b60
7
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked // TODO add your handling code here: database.init(); if (jTextFieldFirstname1.getText().isEmpty() || jTextFieldLastname1.getText().isEmpty() || jTextFieldID1.getText().isEmpty() || jTextFie...
b214d319-30eb-4179-8457-1a2ce249b2df
3
public static Assembly buildAssembly(AssemblyType model) { Assembly assembly = null; switch(model) { case MASS: assembly = new MassAssembly(); break; case SPRING: assembly = new SpringAssembly(); break; case MUSCLE: assembly = new MuscleAssembly(); break; default: throw new IllegalState...
928401b2-257e-4c96-8312-dd1ed092b8f6
0
public PrimitiveUndoableMoveableChange(Node node, int oldState, int newState) { this.node = node; this.oldState = oldState; this.newState = newState; }
3fc06925-2faa-4370-910b-3aeeaad3f383
0
public double evaluate(double x) { return inputTable.get(name); }
c25309db-3c2c-4b03-906d-bbff10932d3d
3
private PDFFile loadPDFFile(File pdfFile) throws IOException { // load the pdf file in the byte buffer // RandomAccessFile raf = new RandomAccessFile(pdfFile, "r"); // FileChannel channel = raf.getChannel(); // ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); // // PDFFile pdf = ...
f9312900-8ab3-484f-a5b1-6197cdac7cda
3
public NameSurferDataBase(String filename) { // You fill this in // dataFile = new HashMap<String, NameSurferEntry>(); try{ BufferedReader source = new BufferedReader(new FileReader(filename)); while(true){ String line = source.readLine(); if(line == null) break; NameSurferEntry entry = new Name...
9ec24db3-267a-4243-9523-999180b51dfe
8
private void botonInsertarAdministrarCatalogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonInsertarAdministrarCatalogoActionPerformed if (this.campoOrigenAdministrarCatalogo.getText().equals("Origen") || this.campoDestinoAdministrarCatalogo.getText().equals("Destino")) { JO...
e6c690e5-e407-4f00-bb90-25fee753246b
2
@Test @TestLink(externalId="testTestLinkAnnotationWithoutId") public void testTestLinkAnnotationWithoutId() { final Description description = Description.createSuiteDescription("foo", new TestLink() { @Override public Class<? extends Annotation> annotationType() { ...
390c328c-b980-4f1b-a7ed-0f61642b2857
8
public FragmentPanel(FragmentRecruiterApp parentPanel) { this.parent = parentPanel; addMouseMotionListener( new MouseMotionListener() { public void mouseMoved(MouseEvent e) { if( e.getY() < getHeight() - numPixelsReservedForGeneAnnotations || genbankAnnotationList == null || ! showGeneAnnotati...
aa62edd2-d9e7-421b-bb26-da2c65c560df
3
public boolean contains(V val) { if (val == null) { return false; } Node<V> cur = head.next; while (cur != null) { if (val.equals(cur.value)) { return true; } cur = cur.next; } return false; }
ed87a556-c1d9-4383-ac7f-4deb5d7c6e2b
4
private CacheResult processCacheHit(CacheResult cacheResult, Object cachedItem, Object[] args) { LOGGER.debug("版本号一致,缓存命中"); String key = cacheResult.getKey(); cacheResult.setRetVal(cachedItem); CacheDefinition cacheDefinition = cacheDefinitionCollection.getCacheDefinition(); Cache cache = cacheResult.getCa...
3d87352f-a166-485d-b98a-81e3f8e855c1
7
public Personagem addProtagonista(Personagem personagem, int opcao){ if (opcao == 1) { Scanner entrada = new Scanner(System.in); System.out.println("Selecione o personagem:"); System.out.println("\nProtagonistas:"); System.out.println("1) Guerreiro"); ...
9be4a82d-3b4e-4462-9782-394f5b13996c
0
public RawEntityConsumer() { Injector injector = GuiceInjector.getInjector(); rawEntityStore = injector.getInstance(RawEntityStore.class); }
8b61bdd4-f1fa-4e41-bf15-bf8447a02c23
2
public void copyColumns(JTable copythis) { TableColumnModel tcm = copythis.getColumnModel(); for (int i = 0; i < tcm.getColumnCount(); i++) { TableColumn tableColumn = copythis.getColumnModel().getColumn(i); if (! tableColumn.getResizable()) return; ...
9c393ce2-4a9e-4ff3-b61b-cda5474b80e1
0
@SuppressWarnings("rawtypes") private static void initializeValidator() throws FileNotFoundException { String validatorFilePath = validatorProperties.getProperty(PropertyKeys.VALIDATOR_FILE.toString()); validator = (Validator) xmlManager.unmarshal(new BufferedInputStream(new FileInputStream(validatorFilePath))); ...
2617e1d0-3cb9-42f0-bf55-dee3d6cafcdb
3
public void drawPicture( Graphics2D g ) // Double buffer { // allow re-size Dimension d = getSize(); // Size of curr. image if ( ( theAG == null ) || ( d.width != theAD.width ) || ( d.height != theAD.height ) ) { ...
c990bda0-ac9a-43c1-89e0-76031a3c3958
7
public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed) { if (fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sprite.getHeight(); y++) { int ya = y + yp; for (int x = 0; x < sprite.getWidth(); x++) { int xa = x + xp; if (xa < 0 || xa >= width || ya < 0 || ya >= heig...
30011c24-77b6-4067-b63f-a1e060eaa2ed
7
private void processClick(int x, int y) { if (checkButtonClicks()) { if (!forceUpdate) { forceUpdate = true; updateScreen(); } return; } if (gameVisible) { xClick = -1; yClick = -1; int xTemp; int yTemp; if (x <= xGridMin) { xTemp = 0; } else if (x >= xGridMax) { xTemp =...
7cd7b11f-3f88-4ae6-bff0-520b6cc3f3a6
2
public List<BeanProducto> getProductos() { List<BeanProducto> ls = new ArrayList<BeanProducto>(); try { PreparedStatement ps = MySQL_Connection.getConection() .prepareStatement(consultar); ResultSet rs = ps.executeQuery(); while (rs.next()) { ...
503c4478-09de-4bdb-b364-61abdc22becb
7
protected Look (VorbisStream source, Mode mode) { int dim=0, acc=0, maxstage=0; map=mode.getMapping(); parts=Residue.this.getClassifications(); fullbooks=source.getSetupHeader().getCodeBooks(); phrasebook=fullbooks[Residue.this.getClassBook()]; dim=phrasebook.getDi...
289316c1-2ec2-42cb-be4d-9693d14ef3e7
0
public float getC() { return c; }
3ac2b14c-ccaa-4e5a-a977-2c9507186172
3
protected void layoutCells(Object[] cells) { if (cells.length > 0) { // Invokes the layouts while removing duplicates mxIGraphModel model = getGraph().getModel(); model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { if (cells[i] != model.getRoot()) { executeLa...
2137ba5d-35ae-413b-9016-61cdd3dc6070
3
private void judgeRoom () { boolean jump = false; for ( int i = client.chatRooms.size() - 1; i >= 0; i-- ) { if ( client.chatRooms.get(i).equals(roomId.getText()) ) // check name { jump = true; } } if (jump == true) ...
6c980f62-0606-4ae4-a2c9-face56889dba
6
public void searchInText(String file){ if(source1.isSelected()){ file="oliver.txt"; File thefile=new File(file); yourFile=thefile; gp.searchSource(yourFile); } else if(source2.isSelected()){ file="worlds.txt"; File thefile=new File(file); yourFile=thefile; gp.searchSource(yourFile); ...
5c42437d-7768-45ca-99e8-41e7db9e3c8e
9
static LinkedListNode findCircularHead(LinkedListNode n) { LinkedListNode fast = null; LinkedListNode slow = null; if (n == null) return null; if (n.next != null && n.next.next != null) { fast = n.next.next; slow = n.next; } while (fast != null &...
9a8794ca-9293-4902-8396-54e86757c20d
5
public boolean include(final Method method) { if (method == null) { return false; } if (method.isSynthetic()) { return false; } if (method.isBridge()) { return false; } final String name = method.getName(); return name.startsWith("get") && !ReflectionUtils.isStatic(method) && !Re...
ca38319b-614c-4bfa-868a-8b889214e2ae
1
public boolean addAdmin(String name, String password) { String insert = "INSERT INTO ADMIN VALUES(?,?)"; int n = 0; try { PreparedStatement ps = conn.prepareStatement(insert); ps.setString(1, name); ps.setString(2, password); n = ps.executeUpdate(); ps.close(); } catch (SQLException e) { e.pri...
2f01ccc4-c2c5-409c-b7d5-b92e3133ae5e
3
public void execute() { switch(selectedItem) { case 1: marioWorld.setWhatcha(Doing.PLAYING); break; case 2: loadAndSave.save(); marioWorld.setWhatcha(Doing.SELECTSTAGE); break; case 3: ...
ae2323a9-c4ba-49de-a6e5-b16a372ff7ff
2
@Test public void testMonopoly() { MonopolyDevRequest request = new MonopolyDevRequest(0, "wood"); ServerModel aGame; aGame = gamesList.get(1); int totalWood = 0; for(Player player : aGame.getPlayers()){ totalWood += aGame.getPlayers().get(player.getPlayerIndex()).getWood(); } try { aGame = m...
363a12e6-b486-4318-bd88-b0f19decaa4a
2
private static int countMatches(final String bigString, final String substring) { int lastIndex = 0; int count = 0; while (lastIndex != -1) { lastIndex = bigString.indexOf(substring, lastIndex); if (lastIndex != -1) { count++; lastIndex +=...
8d4aa022-2859-41b3-81a7-48173c067aab
5
public byte[] toBinaryByte() throws IOException { try { StringBuilder sb = new StringBuilder(); sb.append(getHeader().encodedString()); if(getExtras()!=null) sb.append(getExtras().encodedString()); if(getKey()!=null) sb.append(getEncodedKey()); if(getValue()!=null) { sb.append(HexUtil.encode(ge...
73a66152-28d6-4cb4-9f82-57d7abc73280
4
public Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException { // Native object if (flavor.equals(DATA_FLAVOR)) return fetcher == null ? data : fetcher.getObject(); // String if (flavor.equals(java.awt.datatr...
e0a63dd8-02c6-4e6a-b506-39c573d88f8c
3
public void process(Client sockector) { ConcurrentLinkedQueue<HashMap<String,String>> msgs = sockector.getBizObjects(); if(msgs.isEmpty()){ return; } HashMap<String,String> msg = msgs.poll(); while(msg != null){ msg.put(Constants.FILED_IP, sockector.getIp()); Response rm = Service.getInstance().se...
08e21733-2fdc-40ea-8a55-1377ef10a4b8
0
ErrorCode(int value) { this.value = value; }
6f52a76b-6322-488f-a360-46c31ffe1aa0
3
public IMenu readMenu(Document doc){ // Establecemos los valores del menu principal IMenu menu = new XMLMenu(); XmlParserUtil xpu = new XmlParserUtil(); Node root = doc.getDocumentElement(); menu.setName(xpu.getValueLeafNode(doc, NAME, root)); menu.setDescripction(xpu.getValueLeafNode(doc, DESCRIPTION...
a1eae1e5-4f85-4e0d-9101-a50e7e19b5a8
1
private void setDistances(SimpleVector[] dist) { for(int i = 0; i < dist.length; i++) { distances[i] = dist[i].calcSub(getLocation()); } }