method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f1f06401-ad75-4fff-8681-a6850519b292
1
@Override public Connection crearConexion() { try { Class.forName("com.mysql.jdbc.Driver"); Conexion oConexion = new Conexion(); Connection connection = DriverManager.getConnection("jdbc:mysql://" + Conexion.getDatabaseHost() + ":" + Conexion.getDatabasePort() + "/" + Con...
21e17ee7-a787-42c0-80b7-33520c2f2a3e
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = ""; response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); PrintWriter writer = response.getWriter(); String dbDriver = "org.postgresql.Driver"; ...
918ca02a-eab0-46b9-bd6f-9b9d7a4f869f
1
@Test public void WhenFailedPath0011_ExpectHostWithPrefix001() throws UnknownHostException { // localhost: "000" // failed: "0011" // resulted prefix: "001" RoutingTable routingTable = new RoutingTable(); Host localhost = new PGridHost("127.0.0.1", 3000); localhost.se...
a22c494e-b8ae-4918-a4f6-9db1b8d68041
4
@Override public StatusType getInput(Object object) { StatusType status = StatusType.PLAYING; do { try { this.display(); //displays the display method from this class //get the input command entered by user String input = this.getCommand()...
330b9a87-a17e-4638-b922-c304fbb9bab0
8
private void click() { this.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { _clics.add(e.getPoint()); Insets insets = getInsets(); double h = getHeight() - insets.top - insets.bottom; ...
6452f2e9-28b8-451e-b538-c9e57a5bfbf8
0
public int getId() { return id; }
8b0679bb-2509-4ea2-bb70-ea3c3aefe513
1
public FindAlbumArtist(String artist, String album, String title) throws FindAlbumArtistException { this.artistName= artist; this.albumName= album; this.title= title; if (title.equals("") == false) this.find(); }
497aac98-bda2-43af-a4ff-60361aca1ee2
6
public boolean shouldExecute() { this.func_48286_h(); if (this.field_48289_e && this.theEntity.worldObj.isDaytime()) { return false; } else { Village var1 = this.theEntity.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_doubl...
a2fb18ed-c071-4858-8ab4-fd023c4b56c6
9
public void createUI(final JPanel parent) { final GridBagConstraints c = new GridBagConstraints(); final JLabel label = new JLabel(this.name); if ((this.value != null) && (this.value.getClass().equals(boolean.class) || this.value .getClass().equals(Boolean.class))) { final JCheckBox checkBox =...
4274d122-4ea5-496b-adca-100514589d3e
5
private void checkMoveFrom(int x, int y, int numMoves, ArrayDeque<Point> path){ path.add(new Point(x, y)); worldMap[x][y].setPath(path); worldMap[x][y].setReachableByActive(true); if(numMoves==0) return; if(validMove(x+1, y, path)) checkMoveFrom(x+1, y, numMoves-1, path.clone()); if(validMove(x-1, y, p...
b71992f7-c4b9-4a47-b976-2bc25e42818b
0
public static void showHelp() { System.out.println(); System.out.println("Uso: java Setup -i [interface ROUTER_NAME NAME:NEIGHBOR:COST [NAME:NEIGHBOR:COST ...]]"); System.exit(1); }
2f0218f5-f240-469a-b081-e28b81b6e2c2
1
public void testPlus_Weeks() { Weeks test2 = Weeks.weeks(2); Weeks test3 = Weeks.weeks(3); Weeks result = test2.plus(test3); assertEquals(2, test2.getWeeks()); assertEquals(3, test3.getWeeks()); assertEquals(5, result.getWeeks()); assertEquals(1, Weeks.ON...
8de6aa8e-852f-4ba1-989d-6d4c30ef7956
9
public void consultarEstudiantes() { estudiantes = new LinkedList<Estudiante>(); String sql = "select DISTINCT u.id, u.cedula, u.first_name, u.last_name, u.phone_1, u.phone_2, u.direccion, u.email, u.username, u.activated, u.user_types_id, u.sections_id, u.created_at, e.monitoreo, e.investigacion, s.nom...
e9fb3dbd-3066-4cf6-b592-ede710d0f6f7
5
public static void print(Object[] array) { int i = 0; int rowCount = 1; int indent = array.length; int spaces = 0; while (i < array.length) { indent = (int)Math.floor((float)(indent) / 2.0); for (int k = indent; k > 0; k--) { System.out.print(" "); } for (int j = rowCount; j > 0 && i ...
4afda5ed-bf28-4086-8736-e8a8f17d7fbd
2
public void ensureCapacity(int minCapacity){ modCount++; int oldCapacity=tasks.length; if (minCapacity > oldCapacity) { int newCapacity = (oldCapacity *3)/ 2+1; if(newCapacity < minCapacity) newCapacity = minCapacity; //minCapacity is uasually close to size, so this is a win: tasks = Array...
9e77382a-49fc-4818-aeb0-2817c4d26a75
7
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { ResultSetTableModel model; Component result; boolean found; result = super.getTableCellRendererComponent( ...
850ad64b-cc45-4e38-a5a7-d2f78cce4b68
6
private static void saveGrid() { File mapFolder = FileSystem.getFolder(worldFolder, "map"); for (Quadrant q : world.getGrid().QUADRANTS) { StringBuilder quadText = new StringBuilder(); for (int y = 0; y < q.getChunks().size(); y++) { for (int x = 0; x < q.getChunks().get(y).size(); x++) { for (int...
9bb92c07-b833-4bd8-b2a3-3b415039c736
4
public int partition(int left, int right) throws InterruptedException{ int i = left, j = right; int pivot = values[(left + right) / 2]; //middle element as pivot while (i <= j) { sortStateLock.lock(); try{ pivotPos = (left+right)/2; while (values[i] < pivot){ i++;...
5c8832d8-1148-49c8-8424-5e7208edac96
1
@Override protected boolean isAttackPlacesForPositionNotHarmingToAnotherFigures(int position, char[] boardElements, int dimension) { return isPerpendicularAttackPlacementNotHarming(position, dimension, boardElements) && isDiagonalAttackPlacementNotHarming(position, boardElements, dimension);...
d950241d-8ebb-4f2e-9d15-81ef4c6b379c
4
public String decrypt(String str){ try{ ArrayList<Byte> tmp = new ArrayList<Byte>(); int flag = 0; for(int i=0; i<str.length(); i++){ if(str.charAt(i)=='x'){ tmp.add(Byte.parseByte(str.substring(flag, i))); flag = i+1; ...
1af1e114-0bc7-45cc-921c-9b44c9aad5a7
2
public int compareTo(Employee other) { if (salary < other.salary) return -1; if (salary > other.salary) return 1; return 0; }
f8fa8e4d-fb27-4c18-981a-5fc6475c07a7
7
public void FileReading(String filename){ RemoteClientAuctionService client = new RemoteClientAuctionService(); String name = ""; String id; String date = null; String bidsRemaining; String current; long endsBy = 0; double currentBid = 1; long itemId = 0; int Bid; int bidsRem = 0; // byte[] b = ...
c45ce88a-de84-4d07-ba18-b9223f410823
8
public void fillStatement(PreparedStatement stmt, Object... params) throws SQLException { // check the parameter count, if we can ParameterMetaData pmd = null; if (!pmdKnownBroken) { pmd = stmt.getParameterMetaData(); int stmtCount = pmd.getParameterCount(); ...
6ffb9687-6d99-41ff-b938-caa21f34fb4d
8
public void renderSpriteWithAlpha(int xp, int yp, Sprite sprite, int alphaPercentage) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < sprite.SIZEY; y++) { int ya = y + yp; for (int x = 0; x < sprite.SIZEX; x++) { int xa = x + xp; if (xa < - sprite.SIZEX || xa >= width || ya < 0 || ya >= height) ...
50bdf567-26b1-4e82-b0b8-1272528ae385
5
public void checkHit(Car incommingCar) throws GameEndException{//untersucht ob an den angegebenen korrdinaten bereits ein auto steht und ob es ein hit ist synchronized(this){ if(currentCars.size() > 0){ for(Car c : currentCars){ if(incommingCar.getDirection().opposedTo(c.getDirection())){ try{ ...
7f5a7717-f75e-4090-800d-240d96d62fe0
4
public Status runGame(Board board) throws ExitException{ boolean repeat = true; final Timer timer = new Timer(); int time = 0; final SecondTask add = new SecondTask(time); timer.scheduleAtFixedRate(add, 0, 1000); board.displayGrid(); while (repeat) { ...
681475db-7332-41ba-80c5-55dcc62a178b
7
private VariablePrecisionTime getId3v2ReleaseDate() { /* id3v1, v2.2, v2.3 */ VariablePrecisionTime id3year_yyyy=(VariablePrecisionTime)(getParent().queryBestResult(MediaProperty.ID3_YEAR)); Integer id3v2date_mmdd=(Integer)getParent().queryBestResult(MediaProperty.ID3V2_DATE); Integer id3v2time_hhmm=(Integer)ge...
e5f343b2-1186-4464-91e0-307894d3033e
2
private void resetImageProducers() { if (topLeftCanvas != null) { return; } super.graphicsBuffer = null; aGraphicsBuffer_1166 = null; minimapCanvas = null; aGraphicsBuffer_1163 = null; gameScreenCanvas = null; aGraphicsBuffer_1123 = null; ...
02b4eb62-0adf-4fc8-b556-cbdd7b3033ce
1
private int getFbo() { if (fbo == 0) { fbo = device.createRenderTarget(width, height, id); } return fbo; }
21ecb7ed-ecda-4719-b391-90f11567e6da
3
private void updateBoard(int x, int y, boolean doBacktrack) { b[x][y] = (-1)*b[x][y]; for(int i = 0; i < springer.length;i+=2) { int newX = x+ springer[i]; //x position of next jump point int newY = y+ springer[i+1]; //check if springer can jump on this position if(fieldAvailable(newX,newY)) { ...
277a5d75-3e58-4963-8f1a-1c209be8b83d
8
public void getInput() { Scanner scanner=new Scanner(System.in); int a, b, count=0,val1, startSquare=0; double value, newValue, m; while(scanner.hasNextInt()) { a=scanner.nextInt(); b=scanner.nextInt(); if(a==0 && b==0) break; value=Math.sqrt(a); val1=(int) Math.sqrt(a); newVal...
22c52acf-15e2-4ae7-8d10-ea1022a291ab
5
public void start() { //Set up Display try { Display.setDisplayMode(new DisplayMode(800,600)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(-1); } // init OpenGL GL11.glMatrixMode(GL11.GL...
c10f1c6e-7a67-4a8f-84e7-de115d8979e3
9
public void start2 () { wm = new double[20][Data.windows_size]; String QueryKinasesName = "%" + Data.kinease + "%"; //data.code = data.codenames[3]; String QueryCodeName = Data.code; int windows_size = Data.windows_size; //int windows_size = 9; int shift = windows_s...
8f9a32ac-5438-4738-a08e-96a74a0eeb72
7
private static boolean fieldsLegit(Level level, Field currentField, Field currentFieldNeighbour, List<Field> bannedFields) { if(currentField == null || currentFieldNeighbour == null) return false; if(bannedFields.contains(currentField) || bannedFields.contains(currentFieldNeighbour)) return false; if(...
a27bf7a9-dd53-42ba-8ac0-456c96e0d6fc
3
@SuppressWarnings("unchecked") private void loadPlayerMap() { checkFile(); try { FileInputStream fileInputStream = new FileInputStream(getFile()); ObjectInputStream objInputStream = new ObjectInputStream( fileInputStream); PlayerMap = (HashMap<String, Player>) objInputStream.readObject(); objInput...
be315293-bbfb-4c5d-b499-5b2f05d1cb0e
5
static void lucasReeks(int aantal) { int lucasEen, lucasTwee, lucasNieuw; lucasEen = 2; lucasTwee = 1; if(aantal == 2) { System.out.print("De eerste " + aantal + " Lucas-getallen: " + lucasEen + " " + lucasTwee); } else if(aantal == 1) { System.out.print("De eerste " + aantal + " Lucas-getallen: " + l...
a38f87c5-a2e9-43f7-90a3-6d55640ab2a7
5
public static Packet unpackPacket(SocketAddress address, short id, ByteBuffer data){ switch (id){ case 1: return new RegisterUserPacket(address, data.array()); case 2: return new GetUserPacket(address, data.array()); case 3: return new GetUsersPacket(address); cas...
3279534a-15d0-4810-9d62-67f7c5bb153c
1
public Venda finalizarVendaAvista(double desconto) throws ExceptionGerenteVendas { if(atual != null){ return this.finazilarVenda(desconto, FormaPagamento.A_VISTA.titulo, atual.getCliente(), atual.getDependente()); } throw new ExceptionGerenteVendas( "A venda deve ser criada antes de ser finalizada"...
3dd9ee9d-6da9-439e-b368-4dd5294a72b3
2
ModelAndView handle(HttpServletRequest request, HttpServletResponse response) throws Exception { final HandlerMapping handlerMapping = applicationContext.getBean(HandlerMapping.class); final HandlerExecutionChain handler = handlerMapping.getHandler(request); Assert.assertNotNull("No handler found for request, che...
4e6782ac-6084-43ea-bd7d-e61280c7f487
6
@Override public ArrayList<String> lisaaViite(Viitetyyppi tyyppi, Map arvot) { Viite lisattava; Syotetarkastaja tarkastaja = new Syotetarkastaja(); if (tyyppi == Viitetyyppi.article) { lisattava = new Article(tarkastaja); } else if (tyyppi == Viitetyyppi.book) { ...
c88cd97a-2b5d-4884-9798-d0cd00ba90b3
5
public void setCompressed(boolean compressed) { if (compressed != compressed_) { this.compressed_ = compressed; if (!compressed) { this.setSize(getNormalSize()); this.setPreferredSize(getNormalSize()); this.setMaximumSize(getNormalSize()); for (Component c : getComponents()) c.setVisible(tr...
ca142853-f178-487a-90fa-a12a3325d17a
9
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "new" - Add a transaction // "edit" - Edit a transaction // "delete" - Delete a transaction // "help" - Display help for loan accounts // try { int ro...
ff666a5f-eb53-4f53-92a8-9ff6d2d77876
8
public void setRenderer(int row, int column) { if (highlightedLines.contains(new Integer(row))) setBackground(Color.yellow); else setBackground(null); if (emphasizedLines.contains(new Integer(row))) setForeground(Color.red); ...
eb61c8f5-9f9b-4082-bbc2-52c3cef1c676
2
@Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub // TODO Auto-generated method stub if(arg0.getComponent() == updateItem){ }else if(arg0.getComponent() == menuItem){ menuItem.setBackground(clickedColor); } }
a71c7534-c5a3-4177-bde5-aa7358083f25
0
public ListIterator(Node<Item> first) { current = first; }
de007264-16a2-4f18-96fd-afca8a6aa9fc
1
public String generaTabla(String busqueda) { ArrayList<String[]> equipos = bd.regresaMarcaSerieDeparta(Integer.parseInt(busqueda)); String tablaIn = "<table style=\"width:100%\" id=\"tablaResultado\">"; String tablaFin = "</table>"; String tr1 = "<tr>"; String tr2 = "</tr>"; ...
d55160c8-8678-4836-93bf-aaef8a6de6c9
6
private String generateSignature(URL url, String consumerSecret, String tokenSecret, String httpMethod, List<QParameter> parameters, StringBuffer normalizedUrl, StringBuffer normalizedRequestParameters) { String signatureBase = generateSignatureBase(url, httpMethod, parameters, normalizedUrl, normalizedReq...
ad461867-121c-4cdc-8f51-9b23633b0d82
0
@SuppressWarnings("unchecked") public Map<String, String> getDBStats() { return imageTemplateRepository.getDBStats().toMap(); }
ccc8bf85-851e-4ebe-9210-6deea3af6822
7
public String[] getOptions() { String[] superOptions = super.getOptions(); String[] options = new String[4 + superOptions.length]; int current = 0; if (getMarkovBlanketClassifier()) options[current++] = "-mbc"; options[current++] = "-S"; switch (m_nCVType) { case (LOOCV) : options[current++] =...
9321aa44-5da4-49ef-8093-0211ebadf60e
0
public Automaton getAutomaton() { return (Automaton) getSource(); }
9889ae3f-5a58-4a14-b7a4-93d882d1630d
3
public static String formatPlayerNameForDisplay(String name) { name = name.replaceAll("_", " "); name = name.toLowerCase(); StringBuilder newName = new StringBuilder(); boolean wasSpace = true; for (int i = 0; i < name.length(); i++) { if (wasSpace) { ...
3616e1d2-9153-49dd-b7b4-d0fc59a4607c
1
public void testIsAfter_LocalTime() { LocalTime test1 = new LocalTime(10, 20, 30, 40); LocalTime test1a = new LocalTime(10, 20, 30, 40); assertEquals(false, test1.isAfter(test1a)); assertEquals(false, test1a.isAfter(test1)); assertEquals(false, test1.isAfter(test1)); asse...
ea080dd4-4b0c-4b92-808e-445dc12727d5
9
public @Override void execute() throws CommandException { final Module module = getModule(); final Namespace<? extends Kind> kindNamespace = module.getKindNamespace(); assert (kindNamespace != null): "Module supplied null kind namespace"; final Namespace<? extends Functor> functorNamespace = module.getFunctorNa...
49747e05-0b09-458b-8cc0-f81734c6c22d
3
public float low(float x) { if (x <= a) return 1; else if (x > a && x <= b) return (1f / (a - b)) * x - ((float) b / (a - b)); else return 0; }
1ae1652a-5283-4899-8a8b-e524171021be
2
public static void main(String[] args) { stringWorld = new StringWorld(); try { ServerSocket serverSocket = new ServerSocket(5000); while(true) { Socket socket = serverSocket.accept(); System.out.println("accept connection " + serverSocket.getInetA...
3dcd4ef2-8581-4477-a3fb-dbde6fc6a31c
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof User)) return false; User other = (User) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return...
e57f9f15-ff87-4257-be4d-b5e9ac6827b7
9
private int fastMaybeExtractCountryCode(StringBuilder nationalNumber, PhoneMetadata defaultRegionMetadata) throws NumberParseException { String possibleCountryIddPrefix = "NonMatch"; if (defaultRegionMetadata != null) { possibleCountryIddPrefix = defaultRegionMetadata...
3cf95675-b395-4933-8cc2-1f8c47a01e37
5
public void setUser(ProfileBean pb) throws Exception{ Connection conn =null; Statement stmt = null; int rs; try{ Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection(url); stmt = conn.createStatement(); St...
734b9552-297b-469c-9919-ce544d431b0e
1
public long read4bytes() throws IOException { long b0 = read(); long b1 = read(); long b2 = read(); long b3 = read(); if (le) return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24); else return b3 | (b2 << 8) | (b1 << 16) | (b0 << 24); }
b4b42d07-7fc0-463c-972c-31b1865057f3
2
public boolean isError(SoapObject body) { boolean flag = false; try { SoapObject error = (SoapObject) body.getProperty("error"); System.out.print(error); String error_value = (String) error.getProperty("description"); String error_number = (String) error.g...
e42bbca9-9d00-402f-aa49-f05e633d85bc
6
private boolean checkJob(int arrive , int burst , int priority) { if( arrive < 0 || arrive > 999999999 ) {return false;} if( burst <= 0 || burst > 999999999 ) {return false;} if( priority <=0 || priority > 999999999) {return false;} return true; }
d01c5f85-3343-4834-846f-d979905b767a
9
* @param arg * @param client */ private void cmd_flag(final String arg, final Client client) { // @flag <object> = <flags // ex. @flag me=D, should add the dark flag final String[] args = arg.split("="); final Player player = getPlayer(client); final Room room = getRoom( player.getLocation() ); final...
2ab71ab7-4ace-4f29-bee1-90b0f8908114
3
@Override public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) { if(args.length < 1) return false; final Shrine s = AGManager.getShrineHandler().getShrine(args[0]); if(!(sender instanceof Player)) Messenger.sendMessage(sender, "You're not a player"); else if(s ==...
d2042b6a-3c2a-4dfa-a177-c39885075676
2
@Override public Object callFunction(String name, List<Object> arguments) { Function function = functions.get(name.toLowerCase()); if (function != null){ Object returnValue = function.invoke(this,arguments); return returnValue == null ? Nothing.VALUE : returnValue; } else { errorReporter.reportError(...
b01da829-6afb-4704-9b72-8e2b1af4db38
0
public String getName() { return this._name; }
7dc7c098-58cd-44fc-85d2-50eab14a24c5
1
private boolean isPossibleToPlaceDiagRightBelow(int boardElementsLength, int position, int dimension, int positionRightBelow) { return elementDiagonallyRightBelow(dimension, position, positionRightBelow) < boardElementsLength && (elementDiagonallyRightBelow(dimension, position, positionRightBelo...
7f72541c-aa3a-4baf-bdf1-1f9e2abce85a
0
public String getDescription() { return "JFLAP 4 Beta File"; }
cfa13a1f-2964-4214-b85f-99dc26530cfb
3
private CellGui cellGuiAt(int row, int col, BoardGui board) { for (CellGui cell : board.getCellGuis()) { if (cell.underlying().row == row && cell.underlying().column == col) return cell; } throw new RuntimeException(); }
20e39d60-3581-49dd-a529-0b598e6251df
3
public PDFXrefEntry makeXrefStreamEntry(int field2, int field3) { switch (this) { case FREE: return forFreedObject(); case OBJ_IN_BODY: return toBodyObject(field3, field2); case OBJ_IN_STREAM: return ...
ecfd9791-2894-4228-adb9-60d1592b417d
0
protected Class getTransitionClass() { return automata.pda.PDATransition.class; }
9b762ce3-84fc-4f0e-9ace-3b87baf88ba7
5
@Override public void executeTask() { try { sendingSocket = new DatagramSocket(SENDING_PORT); sendingSocket.setBroadcast(true); client = new Client(); client.setCurrentIP(InetAddress.getLocalHost().getHostAddress()); client.setHostname(InetAddress.getLocalHost().getHostName()); client.setPort(Serv...
3a434a5a-3f0f-40b9-b2a9-b6f27b6df30b
3
static void quickSort(long arr[], byte[] values, int sizeOf, int left, int right) { if (left < right) { int index = partition(arr, values, sizeOf, left, right); if (left < index - 1) quickSort(arr, values, sizeOf, left, index - 1); if (index < right) ...
63d5dbef-86ed-40c6-82e2-2260f724bfcd
9
public Deck() { for (i = 0; i < 52; i++) { if (z >= 13) z = 0; if (i < 13) { Spades sCard = new Spades(); sCard.makeCard(z); deck[i] = sCard; z++; } if (i >= 13 && i < 26) { Clubs sCard = new Clubs(); sCard.makeCard(z); deck[i] = sCard; z++; } if (i >= 26 && i < 3...
b8048edd-bb50-4ad0-89a7-73fbe832688b
4
public void SetAnimation(String type, ArrayList<Coordinate> changes){ boolean test = false; if (test || m_test) { System.out.println("GameWindow :: SetAnimation() BEGIN"); } getDrawing().SetAnimation(type, changes); if (test || m_test) { System.out.println("GameWindow :: SetAnima...
23f6574b-d840-4538-a4f9-f3234465b89e
6
public static List<SkeletonStream> getSkeletonStreams(OggPacketReader r) throws IOException { Map<Integer, SkeletonStream> skelIds = new HashMap<Integer, SkeletonStream>(); List<SkeletonStream> skels = new ArrayList<SkeletonStream>(); int streams = 0; OggPacket p; while( (p = r....
91e86281-f06a-4d2d-bc39-0786af18ba66
5
@Override public boolean posNeg(int a, int b, boolean negative) { if (negative) { return (a < 0 && b < 0); } else { return ((a < 0 && b > 0) || (a > 0 && b < 0)); } }
1b4faed4-bb37-445e-a1d1-36a7c92e7c09
7
public static int runGame() throws IOException{ initializeGame(); while(isGameNotOver()){ try { game.printBoard(boardSize); System.out.println("\nEnter your guesses \n" + "------------------------------------------"); if(startWith >= playerCount) startWith = 0; for(currPlayer = startWi...
9c4cf7fb-b843-49e8-8691-067afc0580e5
8
public Vector getObjects(String prefix,int cidmask,boolean suspended_obj, JGRectangle bbox) { Vector objects_v = new Vector(50,100); int nr_obj=0; JGRectangle obj_bbox = tmprect1; int firstidx=getFirstObjectIndex(prefix); int lastidx=getLastObjectIndex(prefix); for (int i=firstidx; i<lastidx; i++) { JGO...
dc2ffb52-6232-430f-a855-aff301f6e7b7
9
static ResourceData createNegativeRR(byte rrtype, long expiry) { switch (rrtype) { case Resolver.QTYPE_A: return new RR_A(null, 0, expiry); case Resolver.QTYPE_PTR: return new RR_PTR(null, 0, expiry); case Resolver.QTYPE_NS: return new RR_NS(null, null, expiry); case Resolver.QTYPE_MX: return new ...
b2837ae9-584f-4cd0-b565-6d1107e6c017
1
public Class<?> getReturnComponentType() { return returnComponentType; }
0a345156-b82f-433c-bae1-e771060e67cb
1
private static void drawVerticalGripper(Graphics gc, DockLayoutNode secondary) { int x = secondary.getX() + (secondary.getWidth() - GRIP_LENGTH) / 2; int y = secondary.getY() - DIVIDER_SIZE + (DIVIDER_SIZE - GRIP_WIDTH) / 2; int top = GRIP_HEIGHT / 2; int bottom = GRIP_HEIGHT - top; for (int xx = x; xx < x + ...
fe0be382-00f8-4f78-bc9f-b1dd4d1b60e7
4
private boolean checkState() { while (paused && (player != null)) { synchronized (player) { if (player != null) { try { player.wait(); } catch (InterruptedException e) { // ignored } } } } return stopped(); }
3cb49b11-71c2-4a69-a07e-d7c08ba80c7b
2
public static void call(final String mapping, final String data) throws Exception { final Parser pzparser = DefaultParserFactory.getInstance().newFixedLengthParser(new File(mapping), new File(data)); final DataSet ds = pzparser.parse(); final String[] colNames = ds.getColumns(); while ...
46c6a3f5-0a70-48d4-a2c4-fcaac2d01268
3
private void isDead(Character character) { if (player == character) { System.out.println("Zuul Tharn appears from nowhere and walks slowly towards you as Hrangst Jaltibrond cuts his own throat and falls to the ground on the other side of the room."); System.out.println("Zuul Tharn: How d...
e7641349-35a5-4873-bf54-b751dd846085
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
1f38ce0a-e0ae-45d3-ad58-b1b585b38395
0
@Override public boolean hasNext() { return _index < this._source.length; }
7517bff5-5e9c-46b3-b167-4dddab101940
0
public String getReasonForStopping() { return reasonForStopping; }
511c61f0-2116-4e07-8741-75ab629ca056
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...
7c1477f8-cec8-472c-95a3-c1e28dccfc29
8
public boolean saveZutat(String zutatId, String zutatName, String zutatPreis, String zutatLager, String zutatEinheit){ boolean isValid = true; int zId = Integer.parseInt(zutatId); // Validation if(!formValidator.isValidName(zutatName)){ isValid = false; this.appendFormError("Feld \"Name\" fehlerhaft: "+f...
d2002e46-5354-45db-91a1-c5cf630d0a7c
0
public DataOut getOut(){ return out; }
40f4b6d4-cc19-4148-a728-fcb6ab198b3f
2
static long div(long dividend, long divisor) { if (divisor < 0) { throw new IllegalArgumentException("divisor must be positive: " + divisor); } if (dividend >= 0) { return dividend / divisor; } else { return (dividend + 1) / divisor - 1; } ...
9983f89c-fdff-4a95-88fd-9304e25409a0
6
public static boolean unbanPlayer(String[] args, CommandSender s) { //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you be...
19735998-d15d-4181-9494-f9c5b3fe0d87
2
public void act(List<Actor> newGrass) { incrementAge(); if(isAlive()) { giveBirth(newGrass); // Try to move into a free location. Location newLocation = getField().freeAdjacentLocation(getLocation()); if(newLocation != null) { ...
cab78847-92e7-41d9-bff4-1ebfb4835816
0
public InputStream getData() { return data; }
a5ab575b-1d25-4969-9f25-fcea95fc3422
4
public void processStimulus(Enumeration e) { WakeupCriterion wc; AWTEvent[] awtea; while (e.hasMoreElements()) { wc = (WakeupCriterion) e.nextElement(); if (!(wc instanceof WakeupOnAWTEvent)) { continue; } awtea = ((WakeupOnAWTEvent) wc).getAWTEvent(); for (int i = 0; i < awtea.length; i++) { ...
547d81a4-4576-4f92-8925-72fe67594a4f
3
public static boolean isMD5( String str ) throws NullPointerException { // MD5 hashes are 32 hex-characters long (representing 16 bytes) if( str.length() != 32 ) return false; // Each char must be a hex-character try { for( int i = 0; i < str.length(); i++ ) { int tmp = hex2int( str.charAt(i) );...
7962c293-595e-41b0-8822-d875f9503cee
1
@Override public PaymentResponse requestPayment(PaymentRequest request) throws ArsenalPayApiException { ApiCommandProducer producer = new InitPayMkProducer(request, credentials); ApiCommand command = producer.getCommand(); try { final ApiResponse apiResponse = apiClient.executeCo...
3ed25a50-63bb-4d3f-bac8-814c99e00015
8
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int x = Integer.parseInt(st.nextToken()); ArrayLi...
991ad53e-bc64-4a3b-99da-efb1ff4c5213
8
protected void setupStreams(ITestResult result, boolean printMethodName) { String test_name=result.getTestClass().getName(); File dir=new File(output_dir + File.separator + test_name); if(!dir.exists()) dir.mkdirs(); File _tests=new File(dir, TESTS), _stdout=new File(dir, STD...
d5c0beab-3cd5-44ff-b3de-47a5e2d3d476
5
public boolean purchaseSpecialTile(String name, Tile t){ Player p = getPlayer(name); if(p== null ||!p.equals(getCurrentPlayer())){ return false;//not your turn; } if(t==null || !(t instanceof SpecialTile)){ return false; } SpecialTile st = (SpecialTile) t; if(p.getPoints() < st.getPrice()) return...