method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e4e8bcfd-273b-40a9-9b32-e6b70147a6b4
5
public boolean hitOtherTanks(List<Tank> tanks){ for(int i = 0 ; i < tanks.size(); i++){ Tank t = tanks.get(i); if(this != t){ if(this.isLive && t.isLive && this.getRect().intersects(t.getRect())){ this.stay(); t.stay(); return true; } } } return false; }
a9daec20-cf0d-49e2-93eb-803e50c3c6ba
2
@Override public void deleteSelection() { if (mDeletableProxy != null && !mSelectedRows.isEmpty()) { mDeletableProxy.deleteSelection(); } }
3cd400f3-fca6-458a-9cf1-cdff7a09cc80
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)pa...
02c2daad-849b-41a0-b666-98b6f3b1f39d
1
private static void isValidChoice(String choice) { int intChoice = 0; intChoice = Integer.parseInt(choice); if (!menu.keySet().contains(intChoice)) { throw new IllegalArgumentException(); } }
ff08b84e-2f78-4e70-96f3-c72810db5bad
6
public JettyHttpContext register(String context, String path) throws Exception { if (context == null || !context.startsWith("/")) { throw new Exception("context must not be null and begin with /"); } if (path == null || !path.startsWith("/")) { throw new Exception("path must not be null and begin with /"); ...
8ea01af9-ea82-41a0-93fb-7455a0d94cbd
9
public void appendPath(String p_addToPath) throws MalformedURIException { if (p_addToPath == null || p_addToPath.trim().length() == 0) { return; } if (!isURIString(p_addToPath)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_PATH_INVALID_CHAR, new...
96b93f4c-1e8f-41d3-ba25-17f5eed652b7
6
protected void _dealRecMessage() { if(null == _m_scSocketChannel) return ; ByteBuffer buf = null; boolean needAddDealTask = false; _lockRecMes(); if(!_m_lRecMessageList.isEmpty()) { //非空才能取出第一个消息对象 buf = _m_lRecMessageLis...
2912380f-7bc5-4992-bef8-2efaabb1870e
3
public String deleteMessage() { if (selectedMessages2.length == 0) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "You have not selected messages for deletion")); return null; } try { messageService.deleteMessage(selectedMessages2); fo...
27826a3f-0896-43d6-ab3d-ff36069fb6b2
6
public void getReferencePage(String opportunityID) { try { String date_entered = ""; String reference_c = ""; String METHOD_NAME = "get_entry"; String SOAP_ACTION = SOAP_URL + METHOD_NAME; SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); ...
e8a547dc-b11d-4f7a-bda3-d4759c89f32e
8
public static QueryResult search(Collection<BusStop> locations, Location departure, Location destination) { PriorityQueue<DistanceCompare> sortedList1 = new PriorityQueue<DistanceCompare>(locations.size ()); for(BusStop b2: locations) sortedList1.offer(new DistanceCompare(departure, b2)); PriorityQueue<Distan...
0158a2cd-4420-4264-8296-5b83607e744c
9
public TableTree(Composite parent, int style) { super(parent, checkStyle(style)); table = new Table(this, style); Listener tableListener = new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.MouseDown: onMouseDown(e); break; case SWT.Selection: onSelection(...
0007b37a-323f-4a41-80b4-c177381b5173
1
public static Animation forId(int id) { if (Animation.animationCache == null) { return null; } else { return Animation.animationCache[id]; } }
fc6f6253-7543-49a7-b16f-28e61d378500
2
public boolean eliminaUsuario(String login) { boolean res = true; Statement statement; ResultSet resultSet; try { Connection con = DriverManager.getConnection(connectString, user, password); statement = con.createStatement(); resultSet = statement.exe...
6684d569-e3f8-43b1-8244-927e2d488f80
4
public void clip(int x,int y,int width, int height){ if (width <= this.completeSprite.getWidth() && height <= this.completeSprite.getHeight() && width > 0 && height > 0){ this.sprite = this.completeSprite.getSubimage(x,y,width,height); } }
15aa6ecf-5462-4935-9fdb-9da9927f9f29
8
public boolean inWild() { if(absX > 2941 && absX < 3392 && absY > 3518 && absY < 3966 || absX > 2941 && absX < 3392 && absY > 9918 && absY < 10366) { return true; } return false; }
534f73e5-26c1-4059-a98f-e5b4a4631a11
5
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
fb61394a-7c8c-4095-b97f-4551e42d455f
8
@Override public void mouseDragged(final MouseEvent e) { // check handlers first for (final Element el : getGraphicPanel().getSelectionManager().getSelectedElements()) { if (el.getComponent().getHandlers().isHandlerAt(e.getPoint())) { if (el instanceof Edge) { ...
e11df9cd-ae3c-4570-96d7-0b2fbac25bea
7
public static HandshakeBuilder translateHandshakeHttp( ByteBuffer buf, Role role ) throws InvalidHandshakeException , IncompleteHandshakeException { HandshakeBuilder handshake; String line = readStringLine( buf ); if( line == null ) throw new IncompleteHandshakeException( buf.capacity() + 128 ); String[] f...
0128037d-4a58-4540-a5c1-4a7019848dae
7
public List<Tree<String>> getTrees() { List<Tree<String>> trees = new ArrayList<Tree<String>>(); for (Backtrace backtrace : backtraces) { if (backtrace instanceof WordBacktrace) { WordBacktrace wordBacktrace = (WordBacktrace) backtrace; trees.add(new Tree<String>(getLabel(), Coll...
04d30774-2e4d-4f80-8f6a-b2cf18c601d6
8
public static void main(String[] args) { Scanner s = new Scanner(System.in); class Point { double x; double y; } class Rectangle { Point upLeft; Point downRight; } Rectangle rect = new Rec...
3885aee8-2fa5-4bdd-a1dc-a66e762ea06b
4
@Override public int compare(Point p1, Point p2) { int det = (p1.x - root.x) * (p2.y - root.y) - (p2.x - root.x) * (p1.y - root.y); if (det == 0) { int dis1 = Math.abs((p1.x - root.x) * (p1.x - root.x) + (p1.y - root.y) * (p1.y - root.y)); int dis2 = Math.abs((p2.x - root.x) * (p2.x - root.x) + (p2.y - ...
d9cd2c1f-ba90-48be-80ff-36b073b93588
8
public String handleSuggestion(String room, String person, String weapon, Player accuser) { String info = null; ArrayList<String> dissapprovals = new ArrayList<String>(); Boolean cardShown = false; for (int i = 0; i < players.size(); i++ ) { if (cardShown) break; if (players.get(i).getName().equalsIgn...
f30da406-aa49-4d3c-b2f2-a23a7b9e6f54
0
public void setPlayerTwoTurn() { currentState = States.PlayerTwoTurn; }
789340dc-13dd-4b38-90c5-d9120ab7f5e6
9
public Photos getUntagged(Date minUploadDate, Date maxUploadDate, Date minTakenDate, Date maxTakenDate, JinxConstants.PrivacyFilter privacyFilter, JinxConstants.MediaType mediaType, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page) throws JinxException { Map<String, String> ...
c45586e0-487a-4ca5-9b10-a287581a2263
5
public void onAction(String name, boolean isPressed, float tpf) { if (name.equals("Izquierda")) { izq = isPressed; } else if (name.equals("Derecha")) { der = isPressed; } else if (name.equals("Arriba")) { arriba ...
930e5af2-83da-476f-b735-4fafe3606aa5
0
public static void writeCDATA(StringBuffer buf, String cdata) { buf.append("<![CDATA["); buf.append(escapeCDATA(cdata)); buf.append("]]>"); }
cb9bd74e-5007-445e-bf3f-8fdf7c582321
1
public static ComplexMatrix identityMatrix(int n) { ComplexMatrix mx = zeroMatrix(n, n); for (int i = 0; i < n; i++) { mx.setElem(i, i, Complex.fromDouble(1.0)); } return mx; }
050aa97e-dc88-4a78-858b-3fe2be5affe4
3
private List<Minutia> rotateFingerprint(List<Minutia> probe, Minutia minutia, double rotation) { List<Minutia> afterTranslation = new ArrayList<Minutia>(); List<Minutia> afterRotation = new ArrayList<Minutia>(); List<Minutia> afterReTranslation = new ArrayList<Minutia>(); double xvector = minutia.getX(); dou...
0f1a46d0-a48c-466a-8449-5613cbc46779
2
public void draw(Graphics2D g) { g.drawImage(image, (int) x, (int) y, null); if (x < 0) { g.drawImage(image, (int) x + GamePanel.WIDTH, (int) y, null); } if (x > 0) { g.drawImage(image, (int) x - GamePanel.WIDTH, (int) y, null); } }
6ffd6dc8-dbab-434f-8f01-b8df44616477
8
public TreeNode lowestCommonParent(TreeNode node1, TreeNode node2){ if(node1 == null || node2 == null) return null; int node1H = 0; while(node1 != null){ node1H++; node1 = node1.parent; } int node2H = 0; while(node2 != null){ node2H++; node2 = node2.parent; } if(node2H > node1H){ ...
717d626f-9e7e-4f86-894d-f2e2810cba30
4
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); fillDP(); d: do { line = br.readLine(); if (line == null || line.length() == 0) break d; int n = Integer...
2d7c2755-d6fa-4619-a2a6-a28c9e01b5f4
3
public void softDrop() { if(paused) return; boolean dropped = chamber.moveZMinus(); if(!dropped && !CheatCodes.LOCKENTER) { chamber.lockPiece(); chamber.nextPiece(); optionPanel.update(); } update(); }
ffbdcc90-d8de-4964-8a16-358f559acfa1
7
protected ArrayList<Tag> coalesceTags() { ArrayList<Tag> result = new ArrayList<Tag>(); // close all open tags for (ArrayList<BeginTag> tagList : openTags.values()) { for (BeginTag tag : tagList) { for (Pattern p : whitelist) { if (p.matcher(tag.name).matches()) { result...
d2c2133a-2a7d-4384-9b99-9bfabc712c14
0
public boolean isRunning(){ return this.running; }
4482232c-e292-4903-a921-3b25ff7eeced
5
private void createAScore() throws YouFailException{ //A: (12.1, 12.2, 13.1 of all wESubjects) * 2 for(Subject thisWESubject:wESubjects){ for(int hj=0; hj<3; hj++){ aScore += thisWESubject.semesters[hj].mark; thisWESubject.semesters[hj].usedState = Semester.Us...
65cd19e4-d12b-4113-9b90-33fb83d2e27e
6
public int _delKey(int key, String subkey) throws RegistryErrorException { if(subkey == null || subkey.length() == 0) throw new RegistryErrorException("subkey cannot be null"); try { Integer ret = (Integer)delKey.invoke(null, new Object[] {new Integer(key), getString(subkey)}); if(ret !=...
800aed5d-62d1-4676-8fda-ffbbb4762b3c
7
public Point getNextPuck(int y) { Point posR = Robot.getInstance().getOdometryPoseProvider().getPose().getLocation(); Field field = Field.getInstance(); if(posR.x<0) { if(field.isPresent(EnumPuck.values()[y*3])) { return new Point(-50, y*60-60); } else if(field.isPresent(EnumPuck.values()[y...
594f62cb-cf0a-4e10-971f-a30e9cad012c
4
public static void main(String[] args) { all = Set.get(args[0]); for (int i = 0; i < all.set.length(); ++i) { rules.put(Set.get("" + all.set.charAt(i)), Set.get("" + all.set.charAt(i))); } for (int i = 1; i < args.length; ++i) { String[] parts = args[i].split("->", 2); final Set left = Set.get(parts[0]...
e7f0f6f2-ecf3-483f-80bf-bd4549820c26
4
public boolean equals(NodeResults other){ if (this.numberSent == other.numberSent){ if (this.numberReceived == other.numberReceived){ if (this.sumSent == other.sumSent){ if (this.sumReceived == other.sumReceived){ return true; } } } } return false; }
883d7c57-0319-4e38-996c-46612ddbc4ba
5
public void run() { try { System.out.println("Prolog Interpreter 0.9: "); System.out.println(" Type 'exit.' to quit this application."); System.out.println(" Type '[...].' to load a file containing facts and rules."); System.out.println(" Otherwise just enter a Pr...
b632cc97-c516-4b07-867e-0c5a66a27e18
7
private void callback(final int type, final int status, final int event, final String filename) { String eventStr = null; if (status != 0) { eventStr = EventType.UKNOWN.string; } else if ((event & EventType.RENAME.value) != 0) { eventStr = EventType.RENAME.string; ...
81e9bf0d-d373-454c-860a-bc9a89e828af
2
public static PackedImage grayscale(PackedImage img) { PackedImage outImg = new PackedImage(img.rows(), img.cols()); int sum; for (int r = 0; r < img.rows(); r++) { for (int c = 0; c < img.cols(); c++) { sum = img.at(r, c, 0) + img.at(r, c, 1) + img.at(r, c, 2); outImg.set(r, c, 0, sum/3); ...
05212bc5-84c6-48b8-96de-d4b0b2fc51f5
5
public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes atts) throws SAXException { if (qName.equals(DPH_tag.QUESTION_TAG)) { for (int i = 0; i < atts.getLength()...
3bdf456d-4298-4fbb-a8f1-7dc3da7e3dac
9
private char escape(char v) { switch (v) { case '\\': return '\\'; case 'b': return '\b'; case 't': return '\t'; case 'n': return '\n'; case 'f': return '\f'; case 'r': return '\r'; case '0': return '\0'; case '"': return '"'; case '\'': return '\''; default: throw new ScoreExcept...
5859cc60-da12-4a4f-8dfe-04a1d0f8ba53
4
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed if (ctrl.getDays() > 0) { jTabbedPane1.setSelectedIndex(1); jTextField13.setText(Integer.parseInt(ctrl.travel() + "") + ""); jTextField12.setText(Integer.pa...
76155047-c96c-42df-828e-c55a24af33c8
3
public Placeable loadChest(int x, int y) { Placeable placeable = new Chest(this, registry, "Placeables/Placed/Chest", "Placeables/Placed/Chest", x, y, Placeable.State.Placed); registerPlaceable(placeable); if (gameController.multiplayerMode == gameController.multiplayerMode.SERVER && registry.g...
39c1c014-bdec-476c-86c0-b38f9ec5c683
5
public static void openWebpage(String url) { try { URI uri = new URI(url); Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) desktop.browse(uri); } catch (URISyntaxException ex) { ...
3d469720-aa68-47c4-8f8b-25a5bf600573
5
@SuppressWarnings( "unchecked" ) public <T extends Item> ItemKey<T> readKey( String uniqueId, Class<T> type ) { DataConverter<T, ?, ?> converter = (DataConverter<T, ?, ?>)convertersByItemType.get( type ); if(converter == null ){ throw new IllegalArgumentException( "unknown type of data: " + type ); } return...
2f74338e-553b-47bf-888e-3a35b444dde8
1
public void makeSelection() { if(tree.getSelectionPath().getPathCount() > 2) { selection = tree.getSelectionPath().getLastPathComponent().toString(); dispose(); } }
310f13c8-2b23-4b5d-bc16-c2b765c7ca8f
4
final public void AddSub_Op() throws ParseException {/*@bgen(jjtree) AddSub_Op */ SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTADDSUB_OP); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token t; try { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PLUS:{ t = jj_con...
9dbe8630-760c-4825-8cd9-5b150a5e2b6b
8
private void handle_piece(){ int count_piece ; int totalDown = new File("peer_" + peerProcess.mypeerID).list().length; if(peerProcess.iComp) { return; } if(peerProcess.mybitmap.get(((Piece)input).pieceIndex) == true) { peerProcess.logObj.stuff("dup request return from handle_piece & piece index is...
d30a64d1-4784-4a3f-86c6-51e2405460cd
5
public boolean midiSourcename(String sourcename) { if (midiChannel == null || sourcename == null) return false; if (midiChannel.getSourcename() == null || sourcename.equals("")) return false; if (sourcename.equals(midiChannel.getSourcename())) return true; return false; }
bde02abf-383e-4900-93a8-b0d7fa3c5caa
4
protected void mover(){ if (Greenfoot.isKeyDown("up")){ move(2); } if (Greenfoot.isKeyDown("down")){ move(-0.5); } if (Greenfoot.isKeyDown("left")){ setRotation( getRotation() - 1 ); } if (Greenfoot.isKeyDown("right")){ ...
8128c601-95fe-46ef-97ab-0a00d59be509
7
protected static URL getURL(String classpathPart, String pkgname) { String urlStr; URL result; File classpathFile; File file; JarFile jarfile; Enumeration enm; String pkgnameTmp; result = nul...
b5b12171-daa1-4383-86d6-e918f51068a5
1
static void initialize(Object instance) { Class<? extends Object> clazz = instance.getClass(); invokeMethodWithAnnotation(clazz, instance, PostConstruct.class ); }
86e3fd35-dbbb-4a9e-97e0-6acc728d47ca
9
private void initialize() { // задаем внешний вид такой же, как у системы try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage(), "Ошибка!", JOptionPane.ERROR_MESSAGE); } // выбрасываем диалог авторизаци...
d8a7ffbf-ad0a-4d33-a285-ade137f06d40
8
public static long bruteDecrpt(long pubKey, long cKey) { int i = 2; while (true) { boolean prime = true; for (int j = 2; j < Math.sqrt(i) + 1; j++) { if (i % j == 0) { prime = false; break; } } if (prime) { if ((cKey % i) == 0) { boolean found = true; for (int k = 2...
79f0471c-0ed2-4348-9a9a-817d00ab344d
2
public Production[] getNonUnitProductions(Grammar grammar) { ArrayList list = new ArrayList(); ProductionChecker pc = new ProductionChecker(); Production[] productions = grammar.getProductions(); for (int k = 0; k < productions.length; k++) { if (!ProductionChecker.isUnitProduction(productions[k])) { li...
28424838-63ee-4448-8c15-1cd0fe6edd8d
9
void doRectCollision() { Vec2D collisionForce = new Vec2D(); pos.add(dir); AABB tempRect = getCollisionRectangle(); // ask the game what this is colliding with, and squeeze out of it! ArrayList<HasRectangle> collide = game.getCollisionsFor(this, tempRect); HasRectangle hr; AABB r; for(int i = 0; i < co...
d3fa9838-f3a1-436a-90c7-bf2ccdbcfc69
1
private void logIgnored(Map<String, Integer> ignored) { for (Map.Entry<String, Integer> ignore : ignored.entrySet()) { getLogger().info( "ignore fetcher task:" + ignore.getValue() + " " + ignore.getKey()); } }
98281f63-2ab5-4fcc-93f3-44b4e2c7b8a2
1
public final void use(Player user, UI ui) { this.howManyUsesRemain--; if (this.howManyUsesRemain == 0) { user.removeItem(this); } performUseAction(user, ui); // after this method, the subclass will do the actual use() stuff... }
e3b1314d-d6c6-4710-948e-82d89c433fea
0
public boolean isCancelled() { return cancelled; }
f59d2aaa-13a3-4fb0-9d9b-053bad57f5b2
1
public boolean compa(String a){ boolean b= true; String txt= a.replaceAll(" ", ""); if(txt.length()==0){ b=false; error.setText("Los campos marcados con asteriscos son obligatorios"); } return b; }
df928ed9-8f04-4e79-8ccc-aa1bdd658aed
1
public void createStudent(Student student) throws DuplicateInstanceException { if (!students.contains(student)) { students.add(student); student.getHouseHold().getMentored().add(student); Persistence.getInstance().save(); } else { throw new DuplicateInstanceException(student, "Student"); } }
e93b4803-830a-4dee-995d-1fbe7e69d5fe
2
public void alterarLista(List<T> ts) throws ValidacaoException { try { transacao = session.beginTransaction(); session.clear(); for (T t : ts) { session.merge(t); } transacao.commit(); } catch (HibernateException e) { ...
fb321a5e-8081-4a04-a1ce-094316cb04cb
0
@Override public Object call(long connectionId, String method, Object params) throws Exception { logger.info(getName() + " call method: " + method + "<idconnection=" + connectionId + ">"); IRemoteCallObject result = remoteServerCall.call(connectionId, method, params); return result.getDataObject().getData...
a6a3e34c-1258-43e5-94bf-79abd01acb0b
5
public static int skipWhitespace( char[] chars, int offset ) { while( offset < chars.length ) { switch( chars[offset] ) { case( ' ' ): case( '\t' ): case( '\r' ): case( '\n' ): ++offset; break; default: return offset; } } return offset; }
f557b6ae-e5fe-4c0f-b02b-24900fc29ffb
1
public ByteVector putShort(final int s) { int length = this.length; if (length + 2 > data.length) { enlarge(2); } byte[] data = this.data; data[length++] = (byte) (s >>> 8); data[length++] = (byte) s; this.length = length; return this; }
d51f5e1e-b8c0-4701-a97d-4e7afc8fac22
8
public GuiSlotStatsItem(GuiStats par1GuiStats) { super(par1GuiStats); field_77269_a = par1GuiStats; field_77266_h = new ArrayList(); Iterator iterator = StatList.itemStats.iterator(); do { if (!iterator.hasNext()) { break; ...
156b20d5-3835-49ee-b3ab-e05218beebc7
2
public double[] standardizedItemStandardDeviations(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedItemStandardDeviations; }
2bb90ef1-b9c2-408c-accf-31390a800f53
2
public GameSettings(GameEngine engine) { // Make sure someone smart hasn't done getInstance(null), and that an // instance doesn't exist already if (engine != null && instance == null) { instance = new Settings(); } }
8b069a54-7e73-4b47-bb82-a827c5145a02
7
@Override @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } GenericResponse other = (GenericResponse) obj; if (this.cas != other.cas) { return false; ...
39899e90-2c75-454d-bb09-e79ec742df32
7
private synchronized void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); int objectsCount = count; if (objectsCount < 0) { // "this" was sealed objectsCount = ~objectsCount; } if (objectsCount == 0) { ...
77e9c162-0b98-4b0c-966f-3e57284588a2
2
private void ouvrirEcriture(){ if(writerSocket == null) { try{ writerSocket = new PrintWriter(socket.getOutputStream(),true); } catch(IOException io){ io.printStackTrace(); } } }
e6a36973-8641-4e09-ac66-df60270c066d
8
public static <T> T processTask(Task task, TaskParameters taskParameters, long timeout) { boolean isFirst = isFirstTask(task, taskParameters); TaskResult<T> result; if (isFirst) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Thread" + Thread.currentThread().getId() + ":当前线程是任务队列的第一个任务,将会被执行"); } res...
de6975ca-e337-439e-ab42-759a4e5a52e1
2
public int getStrenght() { int strenght = 0; int pomoc = 0; for (GroupOfUnits u: units) { pomoc = u.getNumber()*( 2*u.getAttack() + 2*u.getDefense() ); pomoc *= (u.type.level+1)*0.5f; if (u.type.shooting) { pomoc *= 1.3f; } strenght += pomoc; } return strenght; }
21acbadd-8378-4711-994a-74e77e8282fc
0
@Override public void setLastName(String lastName) { super.setLastName(lastName); }
bf9f123b-3996-4979-af92-7b7d6c5f6694
1
public ArrayList<String> getGoToList() { ArrayList collectedAnswers = new ArrayList(); for (int i = 0; i < table.getModel().getRowCount(); i++) { collectedAnswers.add(tableModel.getValueAt(i, 1)); } return collectedAnswers; }
9ce4e375-471d-464d-afef-bfdf290a2613
8
private static String _trim(String value) { if (value != null) { value = value.trim(); StringBuilder sb = new StringBuilder(); char[] charArray = value.toCharArray(); for (int i = 0; i < charArray.length; i++) { if ((Character.isDigit(charArray[i])) || ((charArray[i] == CharPool.DASH) && (i =...
b4d1039c-04d7-4651-85a6-0ddf223462ed
5
@Override public Object getValueAt(int i, int i1) { Object devuelto = null; switch (i1) { case 0: devuelto = datos.get(i).getTitulo(); break; case 1: devuelto = datos.get(i).getFecha_Limite(); ...
9dd83d35-7532-44cb-9fb9-b6d10b18957c
5
VarbitLoader(GameMode mode, int i, IndexLoader loader) { do { try { scriptConfigLoader = loader; if (scriptConfigLoader == null) break; int amountChildren = scriptConfigLoader.getAmountChildren() - 1; scriptConfigLoader.getAmountChildEntries(amountChildren); } catch (RuntimeException runtimeexc...
2cce38fb-05a5-4cd8-8f41-050ee7e2a14f
8
public boolean scan (Position p) { p.advance(); return true; }
f51ca811-293e-4788-849d-1284886b46ca
1
public void input( float delta ) { transform.update(); for ( GameComponent component : components ) component.input( delta ); }
a9a7dd07-d19a-42f1-b291-74073fafe003
7
public IndividualScreen(DBObject obj, String year) { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(10, 10, 745, 485); contentPane = new JPanel(); contentPane.setForeground(Color.DARK_GRAY); contentPane.setBackground(new Color(51, 51, 51)); contentPane.setBorder(UIManager.getBorder("FileChoose...
9ad19ffc-dd86-463d-ae1b-17f5b6b0c373
6
private void textNombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNombreKeyTyped // TODO add your handling code here: if (!Character.isLetterOrDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && evt.getKeyChar() !='-' && evt.getKeyChar() != '.' && !Character.isWhite...
272d094c-e7bc-4140-97e2-d157b85047f2
9
public void reduce(Text key, Iterator<Text> iter, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { mOutput = output; if (key.toString().compareTo("SHORT") == 0) { // my ($tag, $cutoff, $cnt, $sum, $degree, $cov) = split /\t/, $_; while (iter.hasNext()) { ...
01b08277-e3f6-4ae0-96c3-965601dfedad
6
@Override public boolean equals( Object obj) { if ( this == obj) { return true; } if ( obj == null) { return false; } if ( getClass() != obj.getClass()) { return false; } Yen other = ( Yen) obj; if ( amount == null) ...
40288d64-1704-4512-a9d6-1f65b72b17f2
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
73898068-34a2-42fc-bf8c-17c02d68aeff
0
public static void main(String[] args) { // 构造一个文件目录 // 每次NEW一个枝点都会创建一个List,用来保存以下添加的子节点 Root root1 = new Branch("c:\\"); // 这个就是跟节点了 Root win1 = new Branch("windows"); Root sys1 = new Branch("system"); Root sys2 = new Branch("system2"); Root hw1 = new Leafage("HelloWorld.java"); root1.addNode(win1); ...
56a45ac6-fc82-4b1b-8a7e-7349a5483eaf
5
public int getInteractibleObjectHash(int x, int y, int z) { Ground tile = groundArray[z][x][y]; if (tile == null) return 0; for (int e = 0; e < tile.entityCount; e++) { InteractiveObject entity = tile.interactiveObjects[e]; if ((entity.uid >> 29 & 3) == 2 && entity.tileLeft == x && entity.tileTop ==...
2132ef2c-0adc-4218-809c-42f33033681d
9
public static double dynamicallyEstimateGoalCost(Proposition goal) { { Keyword testValue000 = goal.kind; if ((testValue000 == Logic.KWD_ISA) || ((testValue000 == Logic.KWD_FUNCTION) || (testValue000 == Logic.KWD_PREDICATE))) { { GeneralizedSymbol operator = goal.operator; ...
817a6162-6616-4314-aec5-19e7377e345b
3
public boolean deleteResponseToBipolar(BipolarQuestion bipolarQuestion) { Element bipolarQuestionE; boolean flag = false; for (Iterator i = root.elementIterator("responseToBipolar"); i.hasNext();) { bipolarQuestionE = (Element)i.next(); if (bipolarQuestionE.element("id").getText().equals(bipolarQuestion.get...
84a9f3c3-3737-43d2-8939-5841299b4acf
0
public String getConsumerSecret() { return consumerSecret; }
4eb394e7-4561-444e-b609-275ddeab8837
4
public int getWidth(LinkedList<Component> list) { if (list == null) { return 0; } if (list.size() == 1) { return getDimensions(list.get(0)).width; } int width = 0; for (Component c : list) { if (list.contains(c)) { width += getDimensions(c).width; } } width += (list.size() - 1) * hgap; ...
92c49122-1eaa-401a-bb82-cb5c4d0a6a06
7
private synchronized Int2ObjectMap<int[]> getOrLoadStorage() { Int2ObjectMap<int[]> cachedElements; if (cache != null && (cachedElements = cache.get()) != null) { hitCount.incrementAndGet(); return cachedElements; } missCount.incrementAndGet(); cachedElements = new Int2ObjectOpenHashMap...
40fd911c-d6be-4c5c-a0dd-73fb39342d9f
0
public int V() { return V; }
65fe198f-c8cd-40ce-84ad-316073e96888
3
public void MostraPesquisa(List<Usuario> usuario) { while (tmAvaliacao.getRowCount() > 0) { tmAvaliacao.removeRow(0); } if (!usuario.isEmpty()) { String[] linha = new String[]{null, null}; for (int i = 0; i < usuario.size(); i++) { tmAvaliacao....
f8a31256-6ff6-4f87-8179-36faa8b99fe2
8
public ReaperMarkers(FearTheReaper plugin, DynmapAPI dm) { // Setup the API api = dm; mApi = api.getMarkerAPI(); if (mApi == null) { return; } icon = mApi.getMarkerIcon("tomb"); if (icon == null) { InputStream in = getClass().getResourceAsS...
73f96559-370d-467f-9f5d-a1504272a0ff
7
public void startGame(int noPlayers,int gameLevel) throws GameException{ if (noPlayers != 1 && noPlayers != 2) { throw new GameException(ErrorType.ERROR3.getMessage()); } if (noPlayers == 1) {module = 6; if(gameLevel==1){ System.ou...
62842ea3-ed49-442d-bda4-73773d2258a3
7
@Override public T createAdaptiveExtensionProxy(final Class<T> iFaceType) { checkAnnotation(iFaceType); ProxyFactory factory = new ProxyFactory(); factory.setInterfaces(new Class[] { iFaceType }); Class<?> proxyClass = factory.createClass(); MethodHandler mi = new MethodHandler() { public Object invoke(Ob...