method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5319e11e-930a-4f55-b1c7-75f6549a567a
6
@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { Player player = event.getEntity(); Iterator<ItemStack> itr = event.getDrops().iterator(); while (itr.hasNext()) { ItemStack item = itr.next(); if (this.manager.isDeincartItem(item) || this.manager.isRouteCancelItem(item)) { itr.remove...
0e698b92-fc18-47a2-be90-6553988dc8e5
9
public Object getReportes(String descriptorSource) throws ReporteJasperException { ArrayList lista=null; //System.out.println(""+descriptorSource); try { org.w3c.dom.Document descriptorXML; descriptorXML = stringToDom(descriptorSour...
1d677d34-f9ef-4025-b5d0-de0e0ea1a9ff
2
private static void appendIpAdress(StringBuilder buffer, byte[] bytes) { for(int i = 0; i < bytes.length; i++) { if(i > 0) buffer.append('.'); buffer.append(Integer.toString(bytes[i] & 0xFF)); } }
d1d91a43-b54c-4eca-983e-a800be5ed624
2
private void doubleSize() { if (vortexSpaces.length == 0) { vortexSpaces = new VortexSpace[2]; return; } VortexSpace[] newVersionOfSpaces = new VortexSpace[vortexSpaces.length*2]; for (int i=0; i<vortexSpaces.length; i++) { newVersionOfSpaces[i] = vortexSpaces[i]; } vortexSpaces = newVersi...
33a1e7ac-0da9-48ea-9838-b0cabd1fb412
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (getClass() != obj.getClass()) { return false; } final Entity other = (Entity) obj; if (id != other.id && (id == null || !id.equals(other.id))) { return false; } return ...
7f9ee131-3c85-4bf7-920c-d6f184837ebe
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Answer other = (Answer) obj; if (answer == null) { if (other.answer != null) return false; } else if (!answer.equals(other.answer)) r...
07db8bf9-d23d-4c84-b124-0ccaf3dda282
6
public void resample_linear( int sample_idx, int sample_frac, int step, int left_gain, int right_gain, int[] mix_buffer, int frame_offset, int frames ) { int loop_end, offset, end, max_sample_idx, amplitude; sample_idx += OVERLAP; loop_end = loop_start + loop_length - 1; offset = frame_offset << 1; end ...
3ae86546-2493-4104-9005-ee108b198890
0
public static List<RapportVisite> selectAll(EntityManager em) throws PersistenceException { List<RapportVisite> lesRapportVisites = null; Query query= em.createQuery("select rv from RapportVisite rv"); lesRapportVisites = query.getResultList(); return lesRapportVisites; }
f25fdcff-2f54-4b68-8c84-a41657550d9a
5
public void normalize() { float[] max = new float[FieldCount];// 找最大值 for (int i = 0; i < InstanceNumber; i++) { for (int j = 0; j < FieldCount; j++) { if (data[i][j] > max[j]) max[j] = data[i][j]; } } // 归一化 for (int i = 0; i < InstanceNumber; i++) { for (int j = 0; j < FieldCount; ...
dfb74cda-24b5-431b-b753-dbb2233f7301
3
private Vehicle vehicleFactory (int idx, Vehicle.Type type, Time time) { switch (type) { case car: return new Car(idx, type, time); case suv: return new SUV(idx, type, time); case van: return new Van(idx, type, time); } return null; }
23061e94-8845-4318-a647-91365c83d3d2
4
private String formatClass(String str) { String class_abbrv = ""; String class_num = ""; String class_section = ""; String formattedString = ""; int firstSub = 0; int secondSub = 0; int thirdSub = 0; int fourthSub = 0; int fifthSub = 0...
7ec2c86f-dc54-4cec-aaf1-2a67aa847ca1
2
@Override public Ticket in(Car car, List<Park> parkList) { for(Park park : parkList) { if (!park.isFull()) { return park.in(car); } } throw new ParkException("没有空的停车位!"); }
1f40cfbb-0c04-41e4-af76-a14fddf4f362
3
@Override public int getNextRound() { // skip to the next reserved slot // System.out.println("Starting search at index " + index); for(; index < numSlots && !chosenSlots[index]; index++); if(index < numSlots) { poolSize--; // System.out.println("Providing slot " + index); int slot = index; index++...
2a837611-d636-4832-891d-a77d77599d9f
5
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "ok" - Data entry is complete // "cancel" - Cancel the request // "help" - Display help for credit accounts // try { switch (ae.getActionCommand()) { ...
c2bdda4e-498f-443d-b5f9-71fbf03c69e7
6
public List<Tile> getTilesNear(LogicailArea area, Locatable locatable, double maxDistance) { List<Tile> tiles = new ArrayList<Tile>(); final Filter<GameObject> filter = new Filter<GameObject>() { @Override public boolean accept(GameObject gameObject) { final GameObject.Type type = gameObject.type(); ...
5bb3e589-ab40-4f70-a236-cef777e046d3
2
public static void main(String[] args) { Properties props = new Properties(); try { props.load(ResourceLoader.getResourceAsStream("game.properties")); Config config = new Config(props); Game game = new Game("PlatformerState"); AppGameContainer app = new Ap...
ed0f866a-b41e-4fd0-8a73-0ccdc9918f9d
4
@Override public boolean equals(Object obj) { boolean equal = false; if (obj instanceof Device) { Device dev = (Device) obj; Map<String, String> otherDevProps = dev.getProperties(); boolean areAllEqual = true; if (otherDevProps.size() == deviceProperties.size()) { for (String prop : devicePropertie...
be29629d-28ae-4cc0-b2c7-71ad23160b4c
8
public ResourceGrid(int width, int height, int voxel_size) { super(width, height, voxel_size); resource_density = new int[voxels.length][voxels[0].length]; locked = new boolean[voxels.length][voxels[0].length]; avoid_resources = new HeightMapGradient(width, height, voxel_size); clumps = new LinkedList<Resou...
3a6543e6-4bd4-4f40-b198-2672b849d3a4
4
public boolean tickAI() { if (current_count != tc.count) { current_count = tc.count; mMove = mBrain.bestMove(new Board(tc.board), tc.currentMove.piece, tc.nextPiece, tc.board.getHeight()-TetrisController.TOP_SPACE); } if (!tc.currentMove.piece.equals(mMove.piece)) { super.tick(TetrisController.ROTATE...
bef1d4a7-5af9-478b-b826-5b597512637e
2
public SerialBox() { for(int x = 0; x<1000; x++) { rects.add(new Rectangle2D.Float(x, 2 * x, 10, 11)); } try (FileOutputStream fileOut= new FileOutputStream("tmp/employee.ser"); ObjectOutputStream out = new ObjectOutputStream(fileOut)) { out.writeObject(this); System.out.println("Serialized data i...
4afe34b8-478a-417b-92ce-88efef62391c
4
public void incorrect(int action) { switch (action){ case 1: lblIncorrectMail.setVisible(true); break; case 2: lblIncorrectActive.setVisible(true); break; case 3: lblIncorrectPassword.setVisible(true); break; case 4: lblIncorrectPlatform.setVisible(true); break; } }
018b9c75-0c3e-4cfa-acad-e8a63b14abb1
6
public JsonElement serialize() { JsonObject obj = new JsonObject(); if (this.success != null) { obj.addProperty("success", this.success); } if (this.completion != null) { obj.addProperty("completion", this.completion); } if (this.response != null) { obj.addProperty("response", this.response); } ...
12f0f08c-3326-4cb1-b25c-2f4f4872f63f
3
public void deleteField(final int nameIndex) { final List newFields = new ArrayList(); boolean foundIt = false; for (int i = 0; i < this.fields.length; i++) { final Field field = this.fields[i]; if (field.nameIndex() == nameIndex) { foundIt = true; } else { newFields.add(field); } } if ...
6171fcbe-2e14-41c1-9221-70aa662513c3
4
public static void calcF1Score(String dirName) { File dir = new File("./data/metrics/" + dirName); for (File file : dir.listFiles()) { FileReader reader; try { reader = new FileReader(file); BufferedReader br = new BufferedReader(reader); String line = null; int count = 0; while ((line = b...
255ab48d-6ba6-484b-9c8f-310b0718ed5c
8
public static TVDBUpdates getUpdates(String urlString, int seriesId) throws TvDbException { TVDBUpdates updates = new TVDBUpdates(); Document doc = DOMHelper.getEventDocFromUrl(urlString); if (doc != null) { Node root = doc.getChildNodes().item(0); List<SeriesUpdate> se...
dbf9b8fa-03c1-44db-97e0-66f10bd13bfa
2
public String intToRoman(int num) { for(int x : dic.keySet()){ if(num >=x){ return dic.get(x) + intToRoman(num - x); } } return ""; }
01fe456d-dd26-4db3-bda8-7e3c6ec199b2
0
@Override public void keyReleased(KeyEvent e) {}
8d414715-c999-4673-8f40-b06f57bfc681
3
private void quit() { if (!isConnected() || IRCUtil.confirmDialog("Are you sure to exit?", "Quit")) { if (isConnected()) { conn.doQuit(quitMsg); conn.close(); } saveSettings(); System.exit(0); } }
685258c8-fe5e-4779-8710-0da30f71957c
3
public static void main(String[] args) { System.out.println("Witaj!"); System.out.println("Dzisiaj jest: "+(new Date())); int x = 100; int y = 212; int z = (x ^ y); int l = (int)Math.log(Math.max(x, y))+1; String xstring = Integer.toBinaryString(x); String ystring = Integer.toBinaryString(y); System.o...
3d5c6248-0e04-48fa-9d10-5ce71539d805
9
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 m = Integer.parseInt(st.nextToken()); st = ne...
3e461d5f-2b11-44e4-9437-be1b9bcc4f40
7
@Override public int hashCode() { int hash = 3; hash = 89 * hash + (this.firstName != null ? this.firstName.hashCode() : 0); hash = 89 * hash + (this.lastName != null ? this.lastName.hashCode() : 0); hash = 89 * hash + (this.birthDay != null ? this.birthDay.hashCode() : 0); h...
ff944b5f-e79b-4650-903e-ef6c340e8e40
6
private static String just(String src, int length, String fill, boolean ljust) throws IOException { if (isStringNullOrEmpty(fill) || length <= src.length()) { return src; } else { StringReader sr = new StringReader(fill); StringBuilder sb = new StringBuilder(); if (ljust) sb.append(src); int toFillLe...
1cd85fd3-d316-425b-8353-f1ccc1c76e4b
5
private void AdicionarJuiz_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AdicionarJuiz_ButtonActionPerformed if(Nome_TextField.getText() == "" || Username_TextField.getText() == "" || Password_PasswordField.getPassword().toString() == "" || Confirm...
15d351a3-a682-4d77-a4f3-42062c374e7a
8
public static void findBestMomentum(String filename, int reps, int epochsPerRep, int printFrequency, ANN ann, double[] mentums, double[][] inputs, double[][] outputs) throws IOException { //ANN ann = new ANN(1, 0.5, 0.1, 2, 3, 1); int numDataPoints = epochsPerRep/printFrequency; int mloc = reps/2; File file...
f9461253-4062-4c9b-aa1a-e044ce620928
2
public static String loadShader(String fileName) { StringBuilder shaderSource = new StringBuilder(); BufferedReader shaderReader = null; try { shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName)); String line; while((line = shaderReader.readLine()) != null) { shader...
5b1b95b6-0f43-41e7-8cf9-5a4fb3b5741f
2
public String findConfig(String configName){ for (String s : configs){ if (s.startsWith(configName)){ return s; } } return null; }
56b0464b-084e-48f3-a152-a9772bbb5da9
9
@Override public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception { final ChannelFuture future = e.getFuture(); if (e instanceof ChannelStateEvent) { final ChannelStateEvent stateEvent = (ChannelStateEvent) e; final ChannelState state = stateEvent.getState(); final ...
fb988dfb-5c75-459b-aba2-6dbb8175e7a6
7
private Entity lookupEntity(String object) { Entity entity = null; String specialEntity = vocabulary.getSpecialEntities().get(object); // Check if entity is a special entity if (specialEntity != null) { if (specialEntity.equals("thisLocation")) { entity = currentLocation; } else if (specialEntit...
1e73457c-0da3-4c04-89e7-d8ae80c2d3fe
7
@Test public void test() { UserInterface testInstance = null; try { testInstance = UserInterface.getTestInstance(); } catch (NoSuchAlgorithmException e) { String error = "Not able to use SHA-512!"; fail(error); } ...
f726c371-0902-4004-94ee-9c5c0be914c2
0
public int getLineNumber() { return lineNumber; }
ab59fbc5-a44f-4e9f-bf20-c8a308e860e3
1
public static Connection getConn() { Connection conn = null; try { Class.forName(driver); conn = DriverManager.getConnection("jdbc:mysql://"+ip+":3306/?useUnicode=true&characterEncoding="+encode, user , pwd); //conn = DriverManager.getConnection("jdbc:sqlite:"+databaseName); }...
fbdc271a-a671-49db-a94e-8a099aad4519
0
public void initPackets(PacketManager manager){ }
a0b6b69e-3486-47a9-851d-fd4f64d240a8
0
protected void onIncomingFileTransfer(DccFileTransfer transfer) {}
e088ac14-556d-4076-836f-72c510e26c0a
2
public void decreaseShieldEnergy() { if(shieldEnergy > 0) { shieldEnergy--; leftOverEnergy++; for(int i=0; i < ship.shields.size(); i++) { ship.shields.get(i).setStrength(shieldEnergy*100); } } }
2571da33-a201-4abe-8135-e87480a82a76
9
public static boolean check(Clue c, int n) { v1 = v2 = 0; int num[] = nums[n], equal = 0, semi = 0; for (int i = 0; i < num.length; i++) if (num[i] == c.num[i]) { v1 |= (1 << i); v2 |= (1 << i); equal++; } if (equal != c.equal) return false; for (int i = 0; i < c.num.length; i++) { if ...
8931ceed-2fbc-430d-9b65-2dfc376ecf49
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Transicao other = (Transicao) obj; if (this.simbolo != other.simbolo && (this.simbolo == null || !this.si...
9bc216b6-321f-4322-90ea-77bb70832c9a
1
public void addAvailableToRecruit(int tier, int no) { availableToRecruit[tier-1] += no; System.out.println("ADD AVAILABLE: "+getName() + availableToRecruit[tier-1]); if (!getName().equals("")) { Thread.dumpStack(); } }
b67c18d6-423b-4f7d-a758-cf63beca9de0
2
public Object get(Object jvmClassName) { Object found = super.get(jvmClassName); if (found == null && parent != null) return parent.get(jvmClassName); else return found; }
864b1c26-d36d-4525-bfec-317c23c8f17d
9
public final Socket initConnectToMe(String user, String direction) throws Exception { if (!isConnected()) { throw new BotException(BotException.NOT_CONNECTED_TO_HUB); } if (!UserExist(user)) { throw new BotException(BotException.USRNAME_NOT_FOUND); } direction = direction.toLowerCase(); direction = d...
50262d3f-783a-430f-b201-69fbc1762793
8
public static void main(String[] args) { try { StormyInning si = new StormyInning(); si.atBat(); si.f(); } catch(PopFoul e) { System.out.println("Pop foul"); } catch(RainedOut e) { System.out.println("Rained out"); } catch(Baseb...
cdd6108e-335e-4f77-a658-e655a2ebe886
6
public SQLRequestHandler() { // create database here Connection conn = null; Statement stmt = null; try{ //STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); //STEP 3: Open a connection System.out.println("Connecting to a selected database....
a875c40f-4f34-4f8c-ade4-e0afb2eb0eaf
7
private void resumeReading() { Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "resumeReading"); resumeReadingReady = false; new Thread(() -> { Logger.getLogger(MainInterface.class.getName()).log(Level.INFO, "Resume the reading"); T...
f3150df2-65f1-4cb5-8aa3-9431f9de901d
2
public static void main(String[] args) throws IOException { printProp("java.class.path"); printProp("java.library.path"); System.setProperty("org.lwjgl.librarypath", new File("natives").getAbsolutePath()); Thread.UncaughtExceptionHandler teh = new Thread.UncaughtExceptionHandler() { @Override public void ...
64386ef6-7e7c-4593-9319-122865b5f748
4
public static String[] wrap(String raw, Font f, int width) { String[] words = raw.split(" "); ArrayList<String> lines = new ArrayList<>(); int wordIndex = 0; String line = ""; TrueTypeFont ttf = FontAssistant.getFont(f); while (wordIndex < words.length) { if (ttf.getWidth(line + " " + words[wordIndex]...
82532fc7-9ebc-40e9-bfda-6de0b8a6d65d
1
public void changeProperty(Property newProperty) { if(newProperty==null) return; /* if(!newProperty.isTypeOf(this.getNodeProperty())) return;*/ this.property=newProperty; }
0f192c7c-0354-43c7-a562-99f5a286bf8a
4
long getCount(HashMap<String, Long> hash, String type) { // We have a special type called 'Total' if (type.equalsIgnoreCase(TOTAL_TYPE)) { long total = 0; for (Long count : hash.values()) total += (count != null ? count : 0); return total; } // OK get change by effect Long count = hash.get(type)...
87edd1ec-04e2-48f7-ad1e-74297b3466c8
5
static final void method2678(int i) { if (i != -2049) anIntArrayArray4233 = null; anInt4229++; if (r.aBoolean9722) { Widget class46 = Class348_Sub22.getWidgetChild(Class9.anInt169, Class149.anInt2046); if (class46 != null && ((Widget) class46).anObjectArray680 != null) { InterfaceScript...
10920c7c-1171-459a-b6c3-8ff4b77fdc36
7
@Deprecated public boolean isGreaterThan(Country country) { if (this.gold > country.gold) { return true; } else if (this.gold == country.gold) { if (this.silver > country.silver) { return true; } else if (this.silver == country.silver) { if (this.bronze > country.bronze) { return tru...
16c77033-ff36-4b03-82c0-4016fa5fc359
9
public void scrollToView(Point p, Alignment align) { Point anc = pointFigureToScreen(p); switch(align) { case TOP_LEFT: break; case TOP_CENTER: anc.x -= container.getWidth() / 2; break; case CENTER: anc.x -= container.getWidth() / 2; anc.y -= container.getHeight() / 2; break; case...
a3455389-bc17-4297-adba-b730efed5308
2
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } final Address address1 = (Address) o; return this.hashCode() == address1.hashCode(); }
264d31e7-f179-4324-9d4c-cc32c570b206
6
public boolean contains(E item) { if (root == null) return false; Node node = root; while (true) { if (item.compareTo(node.data) < 0) { if (node.left == null) return false; else node = node.left; } else if (item.compareTo(node.data) > 0) { if (node.right == null) return f...
be0a86be-fc15-4d2b-9f4b-fd6bce9ff5a6
4
public void copyPicture(SimplePicture sourcePicture) { Pixel sourcePixel = null; Pixel targetPixel = null; // loop through the columns for (int sourceX = 0, targetX = 0; sourceX < sourcePicture.getWidth() && targetX < this.getWidth(); sourceX++, targetX++) { // loop thr...
c1810803-02c9-48a7-adc3-3249de277d7a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Appointment other = (Appointment) obj; if (end == null) { if (other.end != null) return false; } else if (!end.equals(other.end)) ret...
b93f45c2-9ac5-456a-95c9-f3950d863877
3
public boolean isPointInsideShape(int x, int y) { boolean rval = false; int smallest = Integer.MAX_VALUE; ImagemapShape shape = null; int areasize = 0; for (int i = size() - 1; i >= 0; i--) { shape = (ImagemapShape)shapes.get(i); if (shape.inside(x, y)) { if ((areasize = shape.getAreaSize()) < small...
3990ebc8-cf5f-46fe-b74a-8281e4fbf22e
0
public MyFrame(String title) { super(title); }
1e939c58-81ae-4184-b615-e9152cfcb505
3
public void initTextures(ByteBuffer data, int[] filters, int[] internalFormat, int[] format, boolean clamp) { for (int i = 0; i < id.length; i++) { id[i] = glGenTextures(); } for (int i = 0; i < id.length; i++) { glBindTexture(textureTarget, id[i]); glTexPara...
b9caccfa-8d85-4326-830d-d105ad520047
1
private static byte[] floatToByteArray(String f) { ByteBuffer bb = ByteBuffer.allocate(4); bb.order(ByteOrder.LITTLE_ENDIAN); bb.putFloat(Float.parseFloat(f.isEmpty() ? "0" : f)); return bb.array(); }
59fed9e8-9115-4a59-8244-e78fece00d76
2
public JMud(String title, int xSize, int ySize, Color bgColor, boolean main,boolean menu,int id) { this.xSize=xSize; this.ySize=ySize; this.title=title; this.bgColor=bgColor; this.menu=menu; this.id=id; this.frame=new JFrame(); this.jMudPanel = new JMudPanel(); this.frame.add(jMudPanel); if(menu) ...
082b5ca2-fab2-493d-85c1-3759ec2a3862
1
public Bd(){ try{ Class.forName("com.mysql.jdbc.Driver"); conexao = DriverManager // .getConnection("jdbc:mysql://localhost:3306/trabalho","root","aluno"); .getConnection("jdbc:mysql://localhost:3306/trabalho","root","170737"); conexao.setAutoCo...
ed358b1e-aabf-41bc-9cda-ba7a0c592ec5
7
public String getcontent(String linestr) { String line = linestr.substring(0, 2); switch (line) { case "#*": return "title"; case "#@": return "authors"; case "#t": return "year"; case "#c": return "publication"; case "#i": return "index"; case "#%": return "citation"; case "#!": ...
5da8dc61-06f8-4dda-b609-a51e9bd3c361
6
public void process(int[] array) { for(int n = icnt + ecnt; n < array.length; n++) { array[n] = 2; } for(Integer[] row : table) { if(row.length != array.length) { return; } else { boolean equal = true; ...
bb0627fa-3736-4c8c-b7b7-1ccc5b387f42
3
public String toString() { String board = new String(); for (Field field : this.fields) { board += field.hasPiece() ? "x" : "."; if (field.file == '8') { board += "\n"; } } return board; }
70a94b54-bd12-4d66-956e-a04dd1a0fec6
1
public void setId(int i) { if (i >= 0) { id = i; } }
39ae191a-77ee-4381-8926-3949ce02af6d
7
void doVirtual(final MethodEditor caller, final MemberRef callee) { // Figure out which methods the callee can resolve to. final Iterator resolvesToWith = hier.resolvesToWith(callee).iterator(); while (resolvesToWith.hasNext()) { final ClassHierarchy.ResolvesToWith rtw = (ClassHierarchy.ResolvesToWith) resolv...
bb1201ab-7606-4759-b35c-cae0e9ce4e50
7
public void update(){ if(JudokaComponent.input.up) selectedItem --; if(JudokaComponent.input.down) selectedItem ++; if(selectedItem > items.length - 1) selectedItem = items.length - 1; if(selectedItem < 0) selectedItem = 0; if(JudokaComponent.input.enter){ if(selectedItem == 0) return;//JudokaComponent.cha...
eac194f0-fdac-4574-a14d-c634da926492
7
private void drawCells (Graphics2D g2d) { for (int i = 0; i < fieldWidth; i++) { int paintX = i * cellSize; for (int j = 0; j < fieldHeight; j++) { int paintY = j * cellSize; if (isCellOpened(new Point(i, j)) && !(alg.getCell(i, j) instanceof StartCell)) ...
aeddc85c-e7f2-4475-bc8e-ef45c4536634
7
@Override public void actionPerformed(ActionEvent e) { String name = e.getActionCommand(); if(name=="Sort") { //title if(r1_sort.isSelected()) { customer.sortBookByTitle(); GUIInterface.aText_p4.setText(Main.TITLE+Main.array.toString()); } //authorName else if(r2_sort.isSelected()) ...
2899b075-f0e9-4080-984d-61fc8ee4df37
5
public void gameUpdated(GameUpdateType type) { switch (type) { case GAMEOVER: System.out.println("" + engine.getCurrentRound() +","+engine.getBoard().mosquitosCaught+"," + engine.getConfig().getNumLights() + ","+engine.getConfig().getNumMosquitos() + "," +engine.getConfig().getSelectedBoard().getName() ...
3e09202f-9da0-4243-af8f-540c66711f7e
1
public boolean canHaveAsCustomerId(String customerId) { return (customerId != null) && (customerId.length() >= 3); }
8fd3375b-f0cf-4791-8c20-a4433ce90f08
2
public static void rethrowException(Throwable ex) throws Exception { if (ex instanceof Exception) { throw (Exception) ex; } if (ex instanceof Error) { throw (Error) ex; } throw new UndeclaredThrowableException(ex); }
01a364c3-88c7-4447-a388-d2643e6f8e00
9
private void reweight(double threshold, List<Card> board, int numPlayers, double potOdds) { double variance; variance = VARIANCE_FACTOR * (1 - threshold); List<EnumCandidate> holeCards = EnumCandidate.buildCandidates(null, board); _wt.initReweight(); ...
346a878b-874b-41b2-ae73-9caa57358f47
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof SimpleTf) { SimpleTf otherStf = (SimpleTf) obj; if (this.not == otherStf.not && this.isEpsilon == otherStf.isEpsilon ...
93311dc8-358e-4e1d-ae47-6ed0733befd8
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); ...
0b00f518-00db-4803-8bcc-7193a537939d
4
@Override public void processWalksAtVertex(WalkArray walkArray, ChiVertex<EmptyType, EmptyType> vertex, DrunkardContext drunkardContext_, Random randomGenerator) { int[] walks = ((IntWalkArray)walk...
77ca2219-0900-429c-b7ac-78d799b6c06a
4
public void writeXmlFile( TProject project, File file ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance() ; DocumentBuilder builder = factory.newDocumentBuilder() ; org.w3c.dom.Document document = builder.newDocument() ; // Create from whole cloth // main ...
79b907b2-cc7e-418d-b139-907576fcc7da
3
@Override public float calculateDesire() { float desire = 0f; Actor actor = ai.getActor(); if (actor == null) { return desire; } newTarget = registry.getPlaceableManager().getClosestActivated(actor.getCenterPoint()); if (newTarget == null) { ...
570d691a-7c3a-4063-855f-4bb645d7a3c6
3
public boolean checkIfAABBIsClear(AxisAlignedBB var1) { List var2 = this.getEntitiesWithinAABBExcludingEntity((Entity) null, var1); for (int var3 = 0; var3 < var2.size(); ++var3) { Entity var4 = (Entity) var2.get(var3); if (!var4.isDead && var4.preventEntitySpawning) { ...
64d6f877-0743-4d4c-bee5-b057f9699a6f
2
public Map<Integer, CatalogPage> GrabPrimaryPages() { Map<Integer, CatalogPage> Primaries = new HashMap<Integer, CatalogPage>(); for(CatalogPage Page : Pages.values()) { if (Page.Parent == -1) { Primaries.put(new Integer(Page.ID), Page); } } return Primaries; }
e02ae1ad-c9a7-490d-ac93-1cd0f861d5f0
6
public void Solve() { long[] phiNumerators = new long[_max + 1]; long[] phiDenomitors = new long[_max + 1]; for (int i = 0; i < phiDenomitors.length; i++) { phiNumerators[i] = i; phiDenomitors[i] = 1; } for (int i = 2; i < phiNumerators.length; i++) { ...
8e09c6e5-c40b-4e43-8483-620503cf4382
3
public boolean lookupUsername(String username) { Connection connection = null; String query = null; PreparedStatement statement = null; try { connection = dataSource.getConnection(); query = "SELECT * FROM users WHERE username = ?;"; statement = (PreparedStatement)connection.prepareStateme...
552aa094-13e5-4906-9a45-a56e16012147
3
public boolean isEmptySpace() { int i = 0, j = 0; for(i = 0; i < 9; i++) { for(j = 0; j < 16; j++) { if(entries[i][j].getText().equals("")) { System.out.println("isEmptySpace() returned false at i: " + i + " j: "+j); return false; } } } return true; }
25fbf3b5-3cc5-4c95-9507-a971c7a8272f
2
@Override public V put(K key, V value) { // Find the key int elementIndex = findKeyIndex(key); // If the key was already in the map, update the value of that entry // and return the old value if (elementIndex != -1) { V oldVal = mapArray[elementIndex].getValue(); mapArray[elementIndex] = new Pair<>(ke...
fe630732-33e3-43b2-9b16-809da58e64d8
4
private void validate() { if (getTarget() < getMinValue()) setTarget(getMinValue()); if (getTarget() > getMaxValue()) setTarget(getMaxValue()); if (getValue() < getMinValue()) setValue(getMinValue()); if (getValue() > getMaxValue()) setValue(getMaxValue()); }
a3a1318f-b1ca-4f6b-9aba-204b523a3b78
5
public void passEigenValues( double[] eigenValues, double[][] eigenVectors ) { int n = eigenValues.length; // generate value list with identity permutation LinkedList<Pair> list = new LinkedList<Pair>(); for ( int j = 0; j < n; ++j ) { Pair pair = new Pair(); if ( this.absolute ) pair.value = Math.abs(eig...
9833c104-2507-40f3-a005-1e28ea02ba18
8
private static void decodeConstructedOf(ParseContext pctx) { ThreadContext ctx = pctx.getCtx(); Definition definition = pctx.getDefinition(); ErrorCollector collector = pctx.getCollector(); Ruby runtime = ctx.getRuntime(); String name = determineName(definition.getName().orNull()...
bef9b0eb-fdfa-4c7c-b927-724d026bcf67
2
@Override public Intersection findIntersect(Ray r) { Intersection i = super.findIntersect(r); if (i == null) { return null; } double d = i.getIntersection().sub(getPoint()).length(); return d > radius ? null : i; }
f7fba977-030c-4b8b-9a88-72a1a9d22523
7
public void fire() { switch (weapon){ case 0: bullets.add(new ABullet(x + width/2-2, y+5)); ABoard.playSound(ABoard.Sbullet); break; case 1: if(missiles.size()<ABoard.missileMax){ ABoard.playSound(ABoard.Smissile); ...
25448856-c52b-484e-bb5f-7d7faae2c2dd
7
private boolean r_more_than_one_syllable_word() { int v_1; int v_3; // (, line 445 // test, line 446 v_1 = cursor; // (, line 446 // atleast, line 446 { int v_2 = 2; // atleast, line 446 replab0: while (true) { v_3 = cursor; lab1: do { // (, line 446 // gopast, line 446 g...
44a89ef1-33bf-4b81-8225-ab53f90a9de8
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
eb62cb10-721a-45d8-8055-e70dc9856b03
9
private void buttonAdicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAdicionarActionPerformed boolean canAdd = true; if (textNome.getText().equals("")) { canAdd = false; } if (cboxTipo.getSelectedItem().toString().equals("int")) { ...