method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6865a4e3-9c4f-4219-b7b0-6dbe55b06a56
9
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { // Retrieve format tags. RasterFormatTag[] formatTags = getFormatTags(); RasterAccessor s1 = new RasterAccessor(sources[0], destRect, ...
8bf98ddc-ccf5-44b3-992d-7200244141c1
7
static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
36bdf12c-6a81-46d8-a1e9-27ce812cb329
1
public void checkException () throws Exception { if ( this.exception != null ) { throw this.exception; } }
6683b398-9d63-46fe-b1b0-3e2b50d3617e
1
public static void save(Document doc){ try ( OutputStream file = new FileOutputStream(SAVE_PATH+doc.getName()); OutputStream buffer = new BufferedOutputStream(file); ObjectOutput output = new ObjectOutputStream(buffer); ){ output.writeObject(doc); System.out.println("Document saved."); } c...
c3edfd0e-9a8f-46e7-8883-b9bfd8d07d8d
0
public static Settings getInstance() { return settings; }
1dd0f620-a762-4b4d-a3c5-6f80556d8983
7
public void setOptions(String[] options) throws Exception { String tableString, inputString, tmpStr; resetOptions(); tmpStr = Utils.getOption("url", options); if (tmpStr.length() != 0) setUrl(tmpStr); tmpStr = Utils.getOption("user", options); if (tmpStr.length() != 0) ...
ce547f6a-9905-4ce7-a569-906c087357a0
8
public void disconnectRejectPart() { rejectPartItems = new ShareableHashSet<Item>(); for (Item i : items) { if (i.production.usedForReject) { rejectPartItems.add(i); } } items.removeAll(rejectPartItems); rejectPartTransitions = new ShareableHashSet<Transition>(); rejectPartBridges = new Shareab...
778ff574-12dc-42c4-a87b-212d09ded448
9
public static int stringToInt (String st) { int res = 0; if (st.equals("integer") || st.equals("INTEGER")) res = INTEGER; else if (st.equals("float") || st.equals("FLOAT")) res = DOUBLE; else if (st.equals("text") || st.equals("VARCHAR") || st.equals("TEXT")) res = STRING; else if (st.equals("bool") || st.equ...
7cf1eed2-8953-4dec-bbca-1fa249dde278
5
public void run() { int counter = 0; while (LazyHomer.noreply || counter<10) { if (counter>4 && LazyHomer.noreply) LOG.info("Still looking for smithers on multicast port "+port+" ("+LazyHomer.noreply+")"); LazyHomer.send("INFO","/domain/internal/service/getname"); try { slee...
385dde24-ab95-46ca-a6dc-e241001571c6
5
@Override protected void channelRead0(final ChannelHandlerContext ctx, HttpRequest request) throws Exception { QueryStringDecoder decoder = new QueryStringDecoder(request.getUri()); String decodedUri = decoder.path(); statCollector.addProcessedConnection(ctx.channel(), ConnectionParameter.URI, decodedUri);...
58262e9a-ee35-47f2-94e2-d4da4d9da39b
8
@SuppressWarnings("empty-statement") @Override public void run() { while (true) { try { synchronized (guard) { }; if (sel.select() <= 0) { continue; } } catch (IOException e) { ...
48853d13-2140-4db1-b31c-c338ba65fd32
8
void computeBoardScale() { Dimension target = new Dimension(1500, 1500); Dimension container = this.getSize(); Double s = 1.0; if ( ( target.width <= container.width ) && ( target.height <= container.height ) ) {} // It already fits in container else if ( (target....
7cf2d3c9-2953-4413-bbc4-8c03c13a47ff
6
private void quitChan(String user_name, CommandArgsIterator args_it) throws IOException { if (args_it.hasNext()) { String chan_arg = args_it.next(); if (!args_it.hasNext() && chan_arg.length() >= 2 && chan_arg.charAt(0) == '#') { String...
acc5ca83-bd39-413f-890e-550afcebfea1
4
private void playGame() { System.out.println("Game initialing......."); this.initialGame(); System.out.println("Game starting..........."); System.out.println("> Select Game Mode :"); System.out.println(" > 1. Normal Mode"); System.out.println(" > 2. Intellligence Mode...
b3a5c3ab-d81f-4cfe-a638-4d06d48ee846
7
@Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; Rectangle clip = g2.getClipBounds(); rowRenderer.paintBackground(g, this); for (int i=0; i<getModel().getRowCount(); i++) { Rectangle2D bounds = getRowBounds(i); if (bounds.intersects(clip)) { rowRenderer.pain...
8a122d14-026f-4716-ac3a-1dbb3e6e8b9c
6
public static void main(String args[]) { abTrajectory ar = new abTrajectory(); ImageSegFrame frame = null; GameStateExtractor gameStateExtractor = new GameStateExtractor(); TrajectoryPlanner trajectory = new TrajectoryPlanner(); while (true) { // capture image ...
49b55af6-1f8c-43e8-97a9-f809526fcf5a
1
private double calculateMantissa(int[] binaryNumber) { double mantissa = 1; int power = -1; for(int i = 9; i < binaryNumber.length; i++){ mantissa = mantissa + binaryNumber[i] * Math.pow(2, power); power--; } return mantissa; }
28d0cdb0-389c-4f38-8c51-3a52b64a9db7
0
public void setMin(int min) { myMin = min; refresh(); }
7e6ee0e3-d177-4970-a112-008cbf1f9a08
0
@BeforeClass public static void setUpClass() { }
af749295-ebcc-4593-baca-b9c38e41e693
9
private double calcY(final double TOP, final double TOTAL_HEIGHT ) { switch (popupLocation) { case TOP_LEFT : case TOP_CENTER : case TOP_RIGHT : return TOP + offsetY; case CENTER_LEFT: case CENTER : case CENTER_RIGHT: return TOP + (TOTAL_HEIGHT- height)/2 - offset...
3a4c90b8-53cd-4699-b14a-58f193318f3e
0
public int getWidth() { return width; }
caf37f3d-1a7b-4245-8960-d00d5d34fbf6
7
public boolean pickAndExecuteAnAction() { // If there is a customer waiting //synchronized(Customers) { for (MyCustomer c : Customers) { if (c.state.equals(MyCustomer.State.waiting)) { // And an unoccupied table for (Table t : Tables) { if (! t.occupied) { // And at least...
e482ba0b-0dba-4b5c-a151-b74f66410623
9
static final void method407(float f, int i, int i_1_, float f_2_, int i_3_, float[] fs, int i_4_, int i_5_, int i_6_, int i_7_, int i_8_, float f_9_, float[] fs_10_, int i_11_) { i_4_ -= i_3_; anInt577++; i_1_ -= i_7_; i_6_ -= i_8_; float f_12_ = fs_10_[2] * (float) i_6_ + ((float) i_1_ * fs_10_[0] + fs_10_[1...
a27622e5-592e-46c1-9bed-923b803b1d25
2
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { VMSMain vms = new VMSMain(); ReadErrorFile ref = new ReadErrorFile(); try { if (vms.checkForUpdate()) { Main frame = new Main(); frame.setVisible(true); } else { OldVer...
03f4e013-46ee-4e5a-a865-500a60f73c78
7
public Pid searchByURI(String uri) throws IOException { ClientResponse cr = wr.path(localPrefix) .queryParam(Strings.PID_RECORD_KEY_URL, uri.toString()) .header(Strings.HEADER_ACCEPT, MediaType.APPLICATION_JSON) .get(ClientResponse.class); if (cr.getStatu...
30e5b7c3-4efa-43fc-a49b-9e05f1a21441
7
public void mostrarDatosDeIngreso(String campo, beansHistorial registro){ String descripcion = null, parametro = null; switch(campo.trim()){ case "downline": descripcion = "Nombre del downline nuevo "; parametro = registro.getDownline().getNombre(); break; case "upline": descripcion = "No...
ad1a30d3-3fa1-45ce-99ac-53e1bdd7351b
7
private static boolean handleStaircases(Player player, WorldObject object, int optionId) { String option = object.getDefinitions().getOption(optionId); if (option.equalsIgnoreCase("Climb-up")) { if (player.getPlane() == 3) return false; player.useStairs(-1, new WorldTile(player.getX(), player.getY(), ...
46a63541-890b-4f0d-afae-c7bceca4c3d5
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RecipeStepData other = (RecipeStepData) obj; if (description == null) { if (other.description != null) return false; } else if (!description.equals(...
08119c7d-7d32-49c1-9640-0dd48e54b980
2
public boolean isAllowed(int patient_no, int test_id) { String selectNotAllowedQuery = "SELECT * FROM NOT_ALLOWED WHERE health_care_no = " + patient_no + " AND test_id = " + test_id; boolean isAllowed = true; try { rs = stmt.executeQuery(selectNotAllowedQuery); if (rs.next()) { isAllowed = false; ...
6de6db95-adab-4645-9d19-fab0f2bd40f3
3
public void setModifiers(int mod) { ClassFile cf = getClassFile2(); if (Modifier.isStatic(mod)) { int flags = cf.getInnerAccessFlags(); if (flags != -1 && (flags & AccessFlag.STATIC) != 0) mod = mod & ~Modifier.STATIC; else throw new Ru...
6ec53748-aa28-47b8-8d3a-4ca5d200f4b8
6
@EventHandler public void onPlayerQuit(PlayerQuitEvent e) { Player p = e.getPlayer(); if (CTF.gm.isPlaying(p)) { PlayerInventory inv = p.getInventory(); inv.setHelmet(new ItemStack(Material.AIR, 1)); inv.setChestplate(new ItemStack(Material.AIR, 1)); i...
cd291f7e-1a93-489b-adf0-26f65513a9a0
5
public void buildGui(Calculator calculator) { this.calculator = calculator; JFrame aFrame = new JFrame(TITLE); // Create a the main panel, with 4 lines JPanel mainPanel = new JPanel(new GridLayout(6, 1)); JPanel gridLines[] = { new JPanel(new GridLayout(1, 5)), new JPanel(new GridLayout(1, 5)), new ...
a12c54b2-c005-474e-a60f-db2df5a7ff87
6
private void drawFields(Graphics g){ g.setColor(EMPTY_CIRCLE_COLOR); // Zeiche Sekunden-Felder: for (int a = 0; a < 2; a++){ for (int i = 0; i < Position.time_day[1].length; i++){ // x-Coorodinate y-Coordinate g.drawOval(Position.time_day[a][i][0], Position.time_day[a][i][1], EMPTY_CIRCLE, EMPTY_CIR...
cf589c86-a109-42b8-8572-e3b25b7775ef
3
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (mDrawFocus) { x = 1; y = height - 2; while (x < width) { g.drawLine(x, 1, x, 1); g.drawLine(x + 2, y, x + 2, y); x += 2; } x = width - 2; y = 1; while (y < height) { g.drawLi...
e174cfe4-3b23-4b13-8bd5-4adf1a1ca640
7
public static void main(String[] args) { Song s1 = new Song("Yellow", "Cold Play", 2.4); Song s2 = new Song("Clocks", "Cold Play", 3.56); System.out.println(s2); Playlist p = new Playlist("ColdPlayHits"); if(p.addSong(s1))System.out.println(s1+" added");; if(p.addSong(s2))System.out.println(s...
3a2527f1-259a-4787-9600-5fc419e0b89d
6
private void createPlayer(){ CategoryType kat; Track t; ArrayList<Track> tracks = rep.getTracks(); for(int i = 0; i < tracks.size(); i++){ t = tracks.get(i); kat = t.getKat(); switch(kat) { case BASS: bassPlayer.add(new Player(t)); break; case BEATS: beatsPlayer.add(new Pl...
86ee4fb6-99a3-4ced-92d4-b8b65fcb02af
9
private void checkCollision(PVector handAbsolute, DrumSingle myDrum, Player player, boolean left) { PVector handAbsoluteNormalized = handAbsolute.get(); handAbsoluteNormalized.normalize(); PVector ov = myDrum.ov(true); // Dot Product float dotProduct = handAbsolute.dot(ov); // Entfernung berechnen floa...
1be636d7-bc37-4a8c-b369-a4b099652e12
5
private static void prepareProfInfo(Player p, String prof, Professions plugin) { ArrayList<ArrayList<ArrayList<String>>> j = getProfData(prof, plugin); Integer i1; Integer i2; String temp; for ( i1 = 0; i1 <j.size(); i1++ ) { p.sendMessage(...
ec4afffa-4e1a-40b9-b289-cd008335fc1d
8
public int getAlignment() { checkWidget(); if ((style & SWT.ARROW) != 0) { if ((style & SWT.UP) != 0) return SWT.UP; if ((style & SWT.DOWN) != 0) return SWT.DOWN; if ((style & SWT.LEFT) != 0) return SWT.LEFT; if ((style & SWT.RIGHT) != 0) return SWT.RIGHT; return SWT.UP; } if ((st...
a2104b25-784e-458f-8d62-fc2cddc3b854
5
public AlgReader(File file) throws FileNotFoundException { if (!file.exists()) return; map = new TreeMap<String, String>(); this.file = file; String ext = file.getName().substring(file.getName().lastIndexOf('.')); setValue("Program", "path", file.getParent() + "/"); ...
8f362b1a-89cf-457a-bd3f-72933cf39804
0
public void setFamilienaam(String familienaam) { this.familienaam = familienaam; }
5ed75437-3105-49e0-b928-5a114d6d5bc2
4
public Class<?> lookupType(String name) throws ClassNotFoundException { if (name == null) { throw new IllegalArgumentException("name must not be null"); } Class<?> type = typeRenames.get(name); if (type == null) { type = loadType(name); } return ty...
38e0f74e-1142-4404-a308-05e5bf979817
4
@SuppressWarnings({ "rawtypes", "unchecked" }) public static List Querybooks(String authorid){ List list=new ArrayList(); ResultSet restl=null; int i = 0; double d = 0; try{ contct=connector.getConnection(); Sttt=contct.prepareStatement("select * from bk where authorid= '"+authorid+"'"); ...
3ebbb056-3555-4606-b523-39630caa18c1
1
void addCall(final MethodEditor callerMethod, final MemberRef callee) { // Just maintain the calls mapping final MemberRef caller = callerMethod.memberRef(); Set callees = (Set) this.calls.get(caller); if (callees == null) { callees = new HashSet(); this.calls.put(caller, callees); } callees.add(calle...
32b9e5ec-66ac-406f-9ca2-ae226fe6ad96
8
public Reference getRef(int i) throws ClassFormatException { if (i == 0) return null; if (tags[i] != FIELDREF && tags[i] != METHODREF && tags[i] != INTERFACEMETHODREF) throw new ClassFormatException("Tag mismatch"); if (constants[i] == null) { int classIndex = indices1[i]; int nameTypeIndex = indi...
7d961b79-1f9a-4a7e-9ea5-c4e5aa98886e
6
@Test public void testStrings(){ System.out.println(System.getProperty("java.library.path")); Strings strings = new Strings(); String s1 = "Hi"; String s2 = "Howdy"; String s3 = "Lollapalooza"; String s4 = "gg"; assertTrue(strings.allUniqueCharacters(s1)); assertTrue(strings.allUniqueCharacters(s2)); ...
1886fd6a-846b-4144-b0c8-24be666c0792
1
public boolean mousedown(Coord c, int button) { if (button != 1) return (false); a = true; ui.grabmouse(this); return (true); }
fe1144a6-0936-45a9-83fb-b4b7054fffce
1
public int compareTo(WildcardString arg0) { if(arg0==null) throw new NullPointerException("cannot compare WildcardString to null"); return compareWildcardString(string,arg0.toString()); }
b855700f-da5e-43d8-b5d2-fe4e8aaf98a5
8
public void update() { glLoadIdentity(); //reset field of view to position = rotation = 0 float dt = Time.dt; Vector3f velocity = new Vector3f(); //handle translation input if (Keyboard.isKeyDown(Keyboard.KEY_W)) { velocity.z += speed*dt; } if (Keyboard.isKeyDown(Keyboard.KEY_S)) { velocity.z -= speed...
f2f2e450-2b61-4545-bd12-59e2012de84f
6
public static void main(String... args) throws Throwable { final CountDownLatch connectLatch = new CountDownLatch(1); final AtomicReference<ConnectReturnCode> connectReturnCode = new AtomicReference<ConnectReturnCode>(); AsyncClientListener listener = new AsyncClientListener() { @Override public void publi...
4ebc0fbc-31f7-4f72-95a4-c1545d11ca7e
8
public Object adjustParameterValueForEnumRefValue( Object aParameterValue, ParameterT aParameter, ControlT aControl ) { logger.debug("aParameterValue: " + aParameterValue + " aParameter: " + aParameter + " aControl: " + aControl ); if ( ( aParameterValue != null ) && ( aParameter != null ) && ( aControl != null ) ...
a9e1f1d2-e34e-4320-8c15-629d393fb9bc
8
@Override public String getStylePref(String type) { if(type.equals("doctype")) { return DOCTYPE_COLOR; } if(type.equals("html")) { return HTML_COLOR; } if(type.equals("string")) { return STRING_COLOR; } if(type.equals("tag")) { return TAG_COLOR; } if(type.equals("expression")) { return...
b7bf48d0-d73e-4f42-bcd8-06c6c131a005
3
@Override public boolean saveLog(String name) { // stringefy dataLog and save to file in readable // xml format String dump = ""; String ret = "\n"; dump += dataLog.size() + ret; Iterator<DataItem> it=dataLog.iterator(); while(it.hasNext()){ Dat...
49f07df6-4d5b-442e-8906-207c9e7df976
3
public static void updateAPList () { for(int x = 0; x < chbxlist.size() ; x++) { String [] parse = chbxlist.get(x).getText().split("Sample Count: " ); chbxlist.get(x).setText(parse[0] + "Sample Count: " + PaintPane.Mac.get(x).getSampleCount() + "<br>" + "</html>"); } for(int x = chbxlist.size(); x <...
662d0e62-8d04-46f7-8ddd-1b87eb74fbba
4
public Type getHint() { if (ifaces.length == 0 || (clazz == null && ifaces.length == 1)) return this; if (clazz != null) return Type.tClass(clazz.getName()); else return Type.tClass(ifaces[0].getName()); }
d63e79a4-52a1-470d-bd2d-68d0d395275e
9
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerMove(PlayerMoveEvent event) { if (plugin.datacore.getBoolean("users." + event.getPlayer().getName() + ".frozen") == true){ Location from = event.getFrom(); double xfrom = event.getFrom().getX(); double yfrom = event.getFrom().getY(); ...
e0ac1aec-7d6b-4847-95af-706223e23302
7
@Override public String perform(Company which) { int n = Random.getInstance().randomInt(6); String in = JOptionPane.showInputDialog(null, "You have landed on the Patents tile. " + "Enter 0-5 to try your luck!", "Patents Tile", JOptionPane.QUESTION_MESSAGE); try { ...
b7647cdf-914f-4f73-8df5-bc4636842d07
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ScrollRestriction other = (ScrollRestriction) obj; if (itemslots == null) { if (other.itemslots != null) return false; } else if (!items...
dc9b30f1-20ae-4e4f-b260-eaf8833286fc
8
private boolean r_un_accent() { int v_3; // (, line 215 // atleast, line 216 { int v_1 = 1; // atleast, line 216 replab0: while(true) { ...
44b51421-248c-47e1-95cd-f4dad60e7edb
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
6cfa293e-2b5f-454b-b3de-da0464bebadd
3
protected ConfigurationSerializable deserializeViaMethod(Method method, Map<String, Object> args) { try { ConfigurationSerializable result = (ConfigurationSerializable) method.invoke(null, args); if (result == null) { Logger.getLogger(ConfigurationSerialization.class.get...
909e8eb5-a06c-46c4-89a9-4ce715042a01
6
public void updateReplicaState(Replica replica) { switch (replica.getState()) { case FAILED: case CANCELLED: case ABORTED: boolean anyRunning = false; for (Replica eachReplica : replica.getTask().getReplicas()) { if (ExecutionState.RUNNING.equals(eachReplica.getState())) { anyRunning = true; ...
c3c0e410-c860-4a1d-b351-fa2090b88615
6
@EventHandler public void EnderDragonJump(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEnderDragonConfig().getDouble("EnderDr...
c5ba7f61-57bf-4a04-91b6-c3d21788195f
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Paciente other = (Paciente) obj; if (!Objects.equals(this.idPessoa, other.idPessoa)) { return...
fc917936-6546-4785-bd81-35b50222ef49
9
public SortedMap<Long, Boolean> berechneZustandsWechselZustand(Long von, Long bis, int jahr) { // Die Abfrage besitzt eine eigene Zustandsliste // ListeZustandsWechsel listeZustandsWechselAbfrage = new ListeZustandsWechsel(); listeZustandsWechsel = new ListeZustandsWechsel(); long time = 0; long ...
20757e25-062d-4da5-9df3-bc47bb8626db
3
protected static long getLong(String key, JSONObject json) throws JSONException { String str = json.getString(key); if(null == str || "".equals(str)||"null".equals(str)){ return -1; } return Long.parseLong(str); }
3a325e5f-e833-4a52-b582-45c67e6c563b
3
public boolean matches(Item item) { if (item instanceof ToolItem) { ToolItem other = (ToolItem) item; if (other.type != type) return false; if (other.level != level) return false; return true; } return false; }
88a54c6d-3b5e-4685-927b-a5eec828aaa6
1
public List<String> getColumnTitles() { List<String> titles = new ArrayList<String>(); for (HeaderCell cell : cells) { titles.add(cell.getValue()); } return titles; }
3ca31687-e631-4dd4-aaa4-fb9a6476ff90
6
public static void main(String args[]){ //Creating a colour scheme to test the renderer with int colourSize = 5; Colour[] colours = new Colour[colourSize]; for (int i=0; i<colourSize; i++) { switch (i) { case 0: Colour black = new Colour("#000000"); colours[i] =...
9d9aece2-bac7-43e2-ac9f-2cc0fc161e78
5
final void method3750(int i, Interface2 interface2) { try { if (i <= 39) ((OpenGlToolkit) this).anInt7782 = 120; if (interface2 != anInterface2_7852) { if (aBoolean7873) OpenGL.glBindBufferARB(34962, interface2.method10(true)); anInterface2_7852 = interface2; } anInt7552++; } catch (Ru...
75012cd4-dc24-47e6-8559-56c1f6dd636f
1
public synchronized String getMessage() throws InterruptedException { notify(); while (messages.size() == 0) wait(); String message = (String) messages.firstElement(); messages.removeElement(message); return message; }
b6d65356-47f0-4117-a676-f7533070eef1
1
@Test public void MinMaxWithMultipleInserts() { l.insert(b); for (int i = 0; i < 10; i++) { l.insert(v); } l.insert(a); assertEquals(a, l.min()); assertEquals(b, l.max()); }
0406531e-4666-4311-a74a-9a1a717b02e7
7
public void revalidatePieces() { int amountOfRemovedLooseSnakePieces = 0; for (int i = 0; i < looseSnakePieces.size(); i++) { Piece piece = looseSnakePieces.get(i); if (checkForOutOfBoundsForPiece(piece)) { looseSnakePieces.remove(i); amountOfRemovedLooseSnakePieces++; } } for (int i = ...
e9c30f7b-2f77-40a7-968a-5e13a1014d53
0
public AbstractPlay nextPlay(){ Huffer huffer = new Huffer(this); largestCapture = huffer.getLargestCapture(); FactoryOfPlaysForCpu factory = new FactoryOfPlaysForCpu(this,largestCapture); AbstractPlay play = factory.getBest(); return play; }
583873a5-2bfb-4eb9-bae8-88b9e2c12d10
6
public boolean addPiece(Tetromino piece, int x, int y, int orientation){ boolean[][] tiles = piece.getTiles(); int count = 0; int width = piece.getTiles()[0].length == 9 ? 3 : 4; // get width (3 or 4) of piece width = piece.getTiles()[0].length == 4 ? 2 : width; for(int row = 0; row < width; ++row) { for(i...
15721141-c489-4821-aa91-5ccb32d4c719
2
public void insertFirst(int value) { if(isFull()) throw new ArrayIndexOutOfBoundsException(); for(int i = size; i > 0; i--) ListArray[i] = ListArray[i-1]; ListArray[0] = value; size++; }
46f7e40b-9caa-4d7c-a6b1-95d2d0171fd3
6
public int getAnswerIndex() { if(answer == null || options == null || isSurvey || style != DROP_DOWN_QUESTION){ return -1; } for(int i=0; i<options.length; i++){ if(answer.equals(options[i])){ return i; } } return -1; }
d4536245-0d9a-4008-8f23-8327d70ce281
4
protected static Class tryLoadMainClass(String jarFileName, String fileClassName) throws Exception { try { JarClassLoader loader; try { loader = new JarClassLoader(new URL("file:///" + jarFileName)); } catch (MalformedURLException exc) { throw new Exception("MalformedURLExcep...
4c2bab6f-21a0-4d55-9233-f52b78069dc2
7
public ListNode mergeKLists(ListNode[] lists) { if (lists.length == 0) return null; NavigableSet<ListNode> priorityQueue = new TreeSet<ListNode>( new ListNodeComparator()); for (ListNode node : lists) { if (node == null) continue; priorityQueue.add(node); } if (priorityQueue.isEmpty()...
95ec239e-927c-4487-af83-f0ba9cb05e98
2
@Override public void out() throws Exception { Object val = getFieldValue(); // Object val = access; if (ens.shouldFire()) { DataflowEvent e = new DataflowEvent(ens.getController(), this, val); // DataflowEvent e = new DataflowEvent(ens.getController(), this, access.to...
4a7a0f73-bdff-4257-879e-acca69c15f54
6
public boolean savemoreinfo() { BufferedWriter characterfile = null; try { characterfile = new BufferedWriter(new FileWriter("./moreinfo/"+playerName+".txt")); characterfile.write("[MOREINFO]", 0, 10); characterfile.newLine(); characterfile.write("character-clueid = ", 0, 19); characterfile.write(Intege...
d2a43116-37b6-44e1-8680-d559bc065960
6
private void jLabelUrlMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelUrlMousePressed if (evt.getButton() == java.awt.event.MouseEvent.BUTTON1 && jLabelUrl.isEnabled()) { if (java.awt.Desktop.isDesktopSupported()) { java.awt.Desktop desktop = java.awt.Desktop.ge...
65ff7943-4728-4ae5-8918-bfd6fd3ee65a
1
public int nextSelectedIndex(int fromIndex) { int index = mSelection.nextSetBit(fromIndex); return index < mSize ? index : -1; }
7d38be0a-47c1-49c4-9101-880425366667
8
@Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case boardPackage.BOARD__COUNTRIES: return ((InternalEList<?>)getCountries()).basicRemove(otherEnd, msgs); case boardPackage.BOARD__BORDERS: return ((InternalEList<?...
f764f395-88de-44fd-bfc6-3ddca5578a29
4
private List<ReducerEstimatedJvmCost> estimateReducersMemory(List<Reducer> eReducers, InitialJvmCapacity gcCap) { int fReducerNum = finishedConf.getMapred_reduce_tasks(); if(fReducerNum == 0) return null; List<ReducerEstimatedJvmCost> reducersJvmCostList = new ArrayList<ReducerEstimatedJvmCost>(); Re...
479aae3b-87b8-4d33-b9d9-ac0cff22261f
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
9f368264-bdba-4876-b8eb-93c8cc61c56e
1
public ChatRoom(String text, Client Client) { initComponents(); this.roomId = text; this.setTitle(text); this.client = Client; int screen_width = Toolkit.getDefaultToolkit().getScreenSize().width; int screen_height = Toolkit.getDefaultToolkit().getScreenSize().height; ...
6877c087-f27e-4851-9508-d74ee9a1814a
4
@Override public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet) { if (npc.isScriptValue(0)) { int npcId = npc.getNpcId(); if (npcId != 20767) { for (int val : MINIONS.get(npcId)) { L2Attackable newNpc = (L2Attackable) addSpawn(val, npc.getX() + Rnd.get(-150, 150...
b658808e-2e38-40ea-b40e-8fc54c9c2f9c
6
@EventHandler public void onGrowEvent(BlockGrowEvent evt){//FIXME if(evt.getBlock().getType().equals(Material.CROPS)){ if(((Crops)evt.getNewState().getData()).getState() == CropState.RIPE){ for(Farm farm : mainClass.farmList){ if(farm.containsBlock(evt.getBlock())){ evt.getNewState().update(); ...
fd671061-f1c6-4735-98fd-803a0513de68
4
@Override public void show() { System.out.println(name + ", here are your search results:"); Auction[] auctionResults = as.search(input); if(auctionResults.length > 0){ System.out.println(String.format("%-20s%-100s%-15s%-15s%-20s%-18s", "ID:", "Name:", "Current Bid:", "Bid Count:", "Owner:", "Ends By:")); }...
86239c1c-2b2f-43fd-ba61-f87cf800d766
6
public int readPacketBytes( byte[] buf, int offset, int maxLength ) throws IOException { int b = read(); int i; for( i=0; b != -1 && (byte)b != END && i < maxLength; ++i ) { if( (byte)b == ESC ) { b = read(); if( (byte)b == ESC_END ) b = END; else if( (byte)b == ESC_ESC ) b = ESC; }...
81168904-52fb-497f-a74c-bf2ffea5afb9
3
byte[] buildBrushSoft(byte[] brush, CPBrushInfo brushInfo) { int intSize = (int) (brushInfo.curSize + .99f); float center = intSize / 2.f; float sqrRadius = (brushInfo.curSize / 2) * (brushInfo.curSize / 2); float xFactor = 1f + brushInfo.curSqueeze * MAX_SQUEEZE; float cosA = (float) Math.cos(brushInfo.curA...
ba0b13e8-466b-41c4-82f0-e6288f9b4c1c
2
public ListaSimpleProceso crearProceso(int cantProcesos) { String listadoProceso = ""; String nombre; int i = 1; while (i <= cantProcesos) { nombre = JOptionPane.showInputDialog("Nombre del proceso " + i); if (nombre.isEmpty()) { int j= cantProcesos; ...
45eb6305-e314-47a2-9d0f-1abaf9d2bb0c
3
private static Integer getNumber(String toBeFormatted) { StringBuilder sb = new StringBuilder(); char[] characters = toBeFormatted.toCharArray(); for (int i = 0; i < characters.length; i++){ if (characters[i] == '_') continue; else if (Character.isDigit(characters[i])){ sb.append(characters[i]); }...
e1fb47a0-b3e5-4d96-b4b2-0cc986b2f2f1
1
@Test @Ignore public void test_AssociationListBulkDelete() { int liNumOfRecs = 3; // Setup AssociationList laAssocListData = associationListPost(liNumOfRecs); // End Setup // Bulk Delete DefaultResponse laResponse = laClient .postBulkDeleteAssociationList(laAssocListData); Assert.assertEquals(laRe...
1c6e11ff-906d-43c5-8af7-31ba8c0d425b
7
public static JulianDate jauTaiutc(double tai1, double tai2) throws JSOFAIllegalParameter, JSOFAInternalError { boolean big1; int i; double a1, a2,dats1, ddats, dats2, datd = 0.0, as1, as2, da, d1, d2, fd; double utc1, utc2; /* Put the two parts of the TAI into big-first or...
5b643943-0333-46f6-9fb3-1a6c246d3dc2
7
private void completeInPlaceRestore(FileDTO file, VersionDTO version) throws DBException, IOException { Manager db = getDb(); Logger log = log(); ReplicaDTO replica = getCurrentReplica(); FileDAO fileDAO = db.findDAO(FileDAO.class); LastSyncDAO lsDAO = db.findDAO(LastSyncDAO.class); VersionDAO versionDAO...
8b68d3b3-dbb2-4c31-8d40-8bafef489488
1
public void setIsHostToZero(String hostName){ try { cs = con.prepareCall("{call SET_ISHOST_TO_ZERO(?)}"); cs.setString(1, hostName); cs.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
4549c87b-39ad-4e4d-b839-407a7dd5bf4c
0
@Override protected EntityManager getEntityManager() { return em; }
c4c273f4-b7c6-45bb-8b03-338128ed6a98
2
private void test() { final String title = "PushTraps - Prueba"; final String body = "Esto es una notificación de prueba de Pushtraps. Si puedes ver este mensaje," + " la aplicación está funcionando"; BufferedReader bufferRead; Service service; int i; int option; try { UI.printHeader(); System....