method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
212444a9-c7a0-4f45-9681-270e1708fabb
2
public ResultSet enviarConsulta(String consulta) { ResultSet resultado = null; try { query = factory.getConnection().createStatement(); System.out.println("DEBUG: Consulta: " + consulta); esConsulta = query.execute(consulta); if (esConsulta) { resultado = query.getResultSet(); } else { filasA...
cfde7dd4-c0f4-4ae5-81be-ad0f0cff6bac
7
public ElementMenu(Component e) { this.element = e; JMenuItem tm = new JMenuItem("Menu for " + e.getName()); tm.setFont(new Font(Font.DIALOG, Font.BOLD, 14)); tm.setForeground(Color.red); tm.setBackground(Color.cyan); add(tm); tm.setEnabled(false); add(new JPopupMenu.Separator()); boolean has = fal...
5b3a2847-c03a-4564-93f6-94aa2a280f02
6
@Override public void start() { super.start(); config = container.config(); logger = container.logger(); eb = vertx.eventBus(); address = config.getString("address") == null ? "shortener.persister" : config.getString("address"); host = config.getString("host") == null ? "localhost" : config.getString("h...
eb1076ce-29ca-4822-9f33-5d1599d671dc
0
public static void resignationMsg(String loserName){ System.out.println(loserName + "さんの負けです。"); }
371ebfb4-81a3-46c8-bc3a-9df9f5f62d7c
8
public static void deleteSpeculativeInstsFromReservationStations() { ArrayList<ReservationStationEntry> todelete = new ArrayList<ReservationStationEntry>(); for(ReservationStationEntry rset: ReservationStationALU1.rseSet) { if(rset.inst.specualtive) todelete.add(rset); } ReservationStationALU1...
9b1349fa-f00c-458a-8d6f-27216700f241
9
private int doLogin () throws InterruptedException{ boolean isLogin = false; boolean first = true; int count =0; do { if (!first){ log.error("login error. retry!"); ThreadUtil.sleep( RandomUtil.getRandomInt(YueCheHel...
206135f2-bd1e-4dcf-89a1-e715dea50cc2
3
@Override public List<Tour> findTours(Criteria criteria) throws DaoException { if (criteria.getParam(DAO_TOUR_STATUS) == null) { criteria.addParam(DAO_TOUR_STATUS, ACTIVE); } if (criteria.getParam(DAO_TOUR_DATE_FROM) == null && criteria.getParam(DAO_TOUR_DATE_TO) == null) { ...
770fe9ab-9d2d-48b4-9eab-f336d26aabb1
3
private LinkedList<Sprite> getValidTargets(LinkedList<Sprite>sprites){ LinkedList<Sprite>possibleTargets = new LinkedList<Sprite>(); for(int i = 0; i < sprites.size(); i++){ Sprite s = sprites.get(i); if(validTarget(s))possibleTargets.add(s); } //no targets were found make the list a null val if(possibl...
0660ae56-d2e4-4daa-8a63-e238918e67f9
4
@Test public void testAgeLimits() { Metabolism m = new Metabolism(); try { m.setAge(0); fail("An IncoherentAgeException should have been thrown."); } catch(IncoherentAgeException e) {} try { m.setAge(-12); fail("An IncoherentAgeException should have been thrown."); } catch(IncoherentAgeException ...
28fd13b6-4fb2-4637-b1f9-682f64ec759e
6
public void removeAllNonCreativeModeEntities() { for (int x = 0; x < width; ++x) { for (int y = 0; y < depth; ++y) { for (int z = 0; z < height; ++z) { List<?> entitySlotInGrid = entityGrid[(z * depth + y) * width + x]; for (int i = 0; i < ent...
d5915011-795a-4143-b5cc-e6d1cbf5216c
0
public void setId(int id) { this.id = id; }
adfc51f7-14e9-42a8-9d61-7fe5d95a2e18
1
private static boolean isTri(String s, Set<Integer> set){ int v = 0; for(char c : s.toCharArray()){ v+= c - 'A' + 1; } return set.contains(v); }
5762a8c7-53e6-4f81-b877-a1c8ddf274f7
7
public void paintComponent(Graphics g){ if(save==null) init(g); super.paintComponent(g); if(back!=null) g.drawImage(back, startX, startY, this); grid.paint(g); g.translate(startX, startY); for (int x = 0; x< Map.width; x++){ for(int y = 0; y< Map.height; y++){ int type = current.getRawCell(x, y...
fc9589b9-020c-4dc0-b4b3-9550a720b750
6
public Game(String mapFilePath) { this.commandsQ = new ArrayBlockingQueue<ActionEvent>(1024); timer = new Timer(); this.mapModel = new MapModel(mapFilePath); playerPawns = new ArrayList(); com = new Connection(new IncomingActionListener()); long updateDe...
db73a306-05aa-41a7-b011-6d0a61f01324
1
public static void main(String[] args) { LinkList list = new LinkList(); list.insert(1, 1.01); list.insert(2, 2.02); list.insert(3, 3.03); list.insert(4, 4.04); list.insert(5, 5.05); list.printList(); while(!list.isEmpty()) { Link deletedLink = list.delete(); Syste...
4d27a114-dfaa-46f2-836f-188681f1941f
5
@Override public Character dataFromSignal(List<Double> output) { int highestOutputIndex = -1; double minimum = output.get(0).doubleValue(); for (Double node : output) { if (node.doubleValue() < minimum) { minimum = node.doubleValue(); } } double highestOutput = minimum; for (int i = 0; i < output...
92177b13-e877-4024-839c-94841072c819
0
public int GetTrips() { return trips; }
a738999a-5e75-4892-b013-f6399a6cfe58
9
int insertKeyRehash(char val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
9ee1cc3b-e1ae-4f33-b6f7-f6337ff289a9
1
private static boolean validLoginParameters(String username, String password){ boolean isValid = false; if(validateStringLength(username) & validateStringLength(password)){ isValid = true; } return isValid; }
23c3e9e4-f571-4ed6-a142-c539bdf83ac9
5
@Override public boolean equals(Object m) { if (m == this) { return true; } if (m == null || m.getClass() != this.getClass()) { return false; } Move move = (Move) m; if (move.start.equals(this.start) && move.end.equals(this.end)) { return true; } return false; }
a687399e-ac52-4ad8-b0de-06ae92620504
2
public static WallType getTypeWithReference(int ref) { WallType wallType = WallType.NONE; for (WallType wall : WallType.values()) { if (wall.getReference() == ref) { wallType = wall; } } return wallType; }
e920c89d-cb20-4e82-b953-06c002a894a8
4
public void update(int delta) { // method to anim the fly to go straight(? good english ?) if (current_state != States.FIX) { if (previous_state == current_state) { time_same_state += delta; if (time_same_state > 100 && previous_state != States.FIX) { fix(); } } ...
7e475ca7-ae32-4dba-b255-b457d0c09fbf
6
public void update() { angle = angleCalc(); checkMove(); if (x == targetX) xa = 0; if (y == targetY) ya = 0; move(xa, ya); if (x <= targetX + 5 && x >= targetX - 5 && y <= targetY + 5 && y >= targetY - 5) { checkHit(); } }
13ee2124-6c7a-4c68-bc1b-503ac602bca5
7
public static void startupSequenceIndices() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$...
c8cd57b8-74a4-4826-b0b9-d7761adf9e2a
1
public void regroup(Prop foreground) { for(int x = 1; x<members.size(); x++) { int tempX = (int)((Math.random()*200)-100) + (int)members.get(0).getX(); int tempY = (int)((Math.random()*200)-100) + (int)members.get(0).getY(); members.get(x).setCourse(PathQuadStar.get().findPath(members.get(x), tempX, tempY));...
c4220bf7-21ac-42ec-a95a-efb5f9939d49
4
public void render(Renderer renderer) { renderer.setColor(1, 1, 1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 1); // 1 will always be the map texture for (int z = 0; z < this.getLength() - 1; z++) { glBegin(GL_TRIANGLE_STRIP); for (int x = 0; x < this.getWidth(); x++) { glTexCoord2f(x / ...
610e1d39-b637-4549-8f53-84ef1735098c
9
public StatsPanel(final MineWindow window) { final MineBoard gameBoard = window.getMineBoard(); // Adds a timer label final JLabel timerLabel = new JLabel("Current Time: " + Integer.toString(timePassed)); this.add(timerLabel, BorderLayout.WEST); // adds a "New Game" button //uncomment for new game but...
8aaf7c9f-7b9a-4d84-822b-13dfe40ffc01
5
@Override public SceneNode build(Node node) { String id = ""; Vec3 pos = new Vec3(); NodeList nodeLst = node.getChildNodes(); for (int s = 0; s < nodeLst.getLength(); s++) { Node fstNode = nodeLst.item(s); if (fstNode != null) { if (fstNode.getNodeType() == Node.ELEMENT_NODE) { if ("id"...
0b73c579-bffb-45e3-bf56-74da9dd1fdec
4
private static void findPrimes(int aCeiling, boolean aNoPrintFlag) { PrimeFinder primeFinder = new Eratosthenes(); Instant startTime = Instant.now(); int[] primes = primeFinder.primesNotGreaterThan( aCeiling); Instant stopTime = Instant.now(); Duration computeTime = Duration....
8958997c-0ed1-4e14-87db-a3397b9ee945
7
private void startLatestJiraIssuesWorker() { SwingWorker<ArrayList<Object>, Void> worker = new SwingWorker<ArrayList<Object>, Void>() { @Override public ArrayList<Object> doInBackground() { //Disable the UI updateButton.setEnabled(false); loadLabel.setVisible(true); ArrayList<O...
d7d38b2e-306b-4fd7-84ee-58aecaf7cbc9
0
private Balance() { this.balance = Constants.initialBalance; }
c615b210-43d1-4920-8f00-362918744ccd
3
@Override public void evaluateLabels(Map<String, Integer> labelValues, int position) throws TokenCompileError { if(reference != null) { Integer value = labelValues.get(reference); if(value == null) throw new SymbolLookupError(reference, getToken()); ...
2b72753f-6719-47ba-bde5-776955126104
0
public void setHealth(int health) {this.health = health;}
bd6b316f-18c6-4a88-a3db-5c2bb477ac95
1
public String getSimpleCode(){ String str = this.printLineNumber(true) + this.operand.getSimpleCode() + this.place + " := "; if(!this.isPostFix){ str += this.operator.getValue() + this.place; } else{ str += this.place + this.operator.getValue(); } return str + "\n"; }
d0620fe7-25e2-4a37-b13e-7c1d40793017
8
public void generateSides() { //North if (getNorthNeighbor() != null && getNorthNeighbor().getSouthSide() != null) { fSides.put(COMPASS_POINT_N, getNorthNeighbor().getSouthSide()); } else { fSides.put(COMPASS_POINT_N, new HorizontalSide(fGlobals, this, new Point2D.Double(fPosition.getX() + fWidth / ...
89b38c8c-a016-4b41-8e90-9a127193f0be
9
public int readInt() throws IOException { switch ( type ) { case MatDataTypes.miUINT8: return (int)( buf.get() & 0xFF); case MatDataTypes.miINT8: return (int) buf.get(); case MatDataTypes.miUINT16: return (int)( buf....
83d3bbd3-1338-4faa-9d73-e5d9456f7c75
1
public String getMethod(Method method){ String result = null; method.setAccessible(true); Class[] paramTypes = method.getParameterTypes(); if (paramTypes.length == 0) { String resultOfMethod = ""; resultOfMethod = getFieldValue(ValueType.METHOD_VALUE,...
ff6f6d5c-f804-4479-8da6-aebcb7551e8c
1
public void testGetPartialConverterBadMultipleMatches() { PartialConverter c = new PartialConverter() { public int[] getPartialValues(ReadablePartial partial, Object object, Chronology chrono) {return null;} public int[] getPartialValues(ReadablePartial partial, Object object, Chronology...
695f26c0-35af-48d4-b28b-20942da662b1
6
public String toString() { String rep = ""; switch (_Type) { case STRING: for (Entry<String, Integer> ent : TMS.entrySet()) { rep += ent.getKey() + " -occurs>" + ent.getValue() + "\n"; } break; case INTEGER: for (Entry<Integer, Integer> ent : TMI.entrySet()) { rep += ent.getKey() + " ...
4f04f3b8-5369-4eed-a492-313981534e2e
6
private void executeUpTo(PreparedStatementKey lastToExecute, boolean moveToReuse) throws SQLException { for (Iterator<Map.Entry<PreparedStatementKey, StatementData>> iterator = statementsData.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry<PreparedStatementKey, StatementData> entry = iterat...
271495cd-2669-4c42-9d88-3103aaad3495
3
void openUrl(String url) { try { if(java.awt.Desktop.isDesktopSupported()) { java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); if(desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { java.net.URI uri = new java.net.URI(url); ...
9d131dab-9e70-4887-a329-0baf1df3a427
9
public static void main(String[] args) throws IOException, ParseException { int classNumber = 5; //Define the number of classes in this Naive Bayes. int Ngram = 2; //The default value is unigram. int lengthThreshold = 5; //Document length threshold int minimunNumberofSentence = 2; // each sentence should have...
48e30109-deb5-490c-b57e-5828bfebdc95
6
public static String translate(String str) { if (!turnedon) return str; String res = ""; URL url = url(str); if (url == null) return str; try { final HttpURLConnection uc = (HttpURLConnection) url .openConnection(); ...
7c74f210-c96b-41e9-9a8f-55bdafa5d3d6
5
public boolean advance( Pos pos, char c ) { if ( pos.node == null ) { pos.node = findSon( root, c ); if ( pos.node != null ) { pos.edgePos = pos.node.edgeLabelStart; return true; } else return false; } else { int nodeLabelEnd = getNodeLabelEnd( pos.node ); // already matched ...
6b418e4e-35df-4ef4-bf97-8c4571377143
4
public void setWaarde(int waarde){ //controle if(waarde < minWaarde) waarde = minWaarde; if(waarde > maxWaarde) waarde = maxWaarde; this.waarde = waarde; //stel label in slider.setValue(this.waarde); textField.setText(String.valueOf(this.waarde) + eenheid); ...
b454481a-1c12-4853-bd89-4ee612f1513c
4
private static void parseToolsForInitialDataRepository(Node kitchenToolsNode, Vector<AcquirableKitchenTool> RestKitchenTools) { if (kitchenToolsNode.getNodeType() == Node.ELEMENT_NODE) { Element kitchenToolsElement = (Element) kitchenToolsNode; String toolName= kitchenToolsElement.getElementsByTagName("name").i...
c5d5a00f-e70b-451c-9648-ba33376c6618
6
@Override public void enregistrer() { //String v_titre, String v_region, int v_exp, int v_salMin, int v_salMax, HashMap<Competence, CompType> tblComps // int compsSize = m_tblComps.size(); //System.out.println("size" + m_tblComps.size()); //System.out.println(m_tblComps); Stri...
4f4de027-f0d3-4e5a-8434-0eb808c6e7c0
5
static synchronized void setFilename(String filename) { if(writer != null) { try { writer.close(); writer = null; } catch (IOException e) { System.out.println("Unable to close log file"); } } if(filename == null) { writer = null; return; } FileWriter out = null; try { out = ...
f5058ea8-de25-4b36-b702-4d5709203892
6
public Barrier(int x1, int y1, int x2, int y2, int type) { sx = x1; sy = y1; ex = x2; ey = y2; attribute = type; switch(type) { case Terrarium.BARRIER_GAP_MINI: color = Color.YELLOW; break; case Terrarium.BARRIER_GAP_BIG: color = Color.ORANGE; break; case Terrarium.BARRIER_NET_MINI:...
a88d4dba-47da-4fcb-adb1-f7d45489ec23
4
@Override public String getAsString(FacesContext facesContext, UIComponent component, Object object) { if (object == null || (object instanceof String && ((String) object).length() == 0)) { return null; } if (object instanceof Motivo) { Motivo o = (Mot...
7b72b88b-2be6-49c1-989f-55b0ba4c1f7f
3
public ArrayList<Integer> grayCode(int n) { ArrayList<Integer> result = new ArrayList<Integer>(); result.add(0); if (n == 0) return result; int adder = 1; while (n > 0) { for (int i = result.size() - 1; i > -1; i--) result.add(adder + re...
24b260e2-5ef8-4961-8e33-573aaaf1de6d
1
@Override public void move() { for (int i = 0; i < Initialization.getStepToPredator(); i++) { super.move(); } }
9cdcb9f0-ce97-4e20-9e77-3bcde628a21a
6
@Override public void run() { while(true) { try { //Start server and wait for connection System.out.println("Waiting on port " + serverSocket.getLocalPort()); Socket server = serverSocket.accept(); System.out.println("Connection to " + server.getRemoteSocketAddress()); //after connected, ...
eb98fc32-916f-4e46-8856-0584143a4ce2
5
public static <A, B, C, D, E, F$> Equal<P6<A, B, C, D, E, F$>> p6Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed, final Equal<E> ee, final Eq...
d4b25fb5-d1e4-4852-8649-ae41ec9938eb
5
boolean isValidMatch(Detection other) { return parameterIdMsb != other.parameterIdMsb && parameterIdLsb != other.parameterIdLsb && inRatioRange(w_vel, other.w_vel) && inRatioRange(peak_flux, other.peak_flux) && inRatioRange(int_...
c634516e-b204-4b75-b67d-cb0a0a3acaf4
0
@Override public Queue<WebPage> getUnsearchQueue() { // TODO Auto-generated method stub return null; }
ad71e4ca-2c2f-4f9d-96e7-7d29db973a37
9
public static int[] indicesOfSublist(byte[] array, byte[] sublist) { LinkedList<Integer> indexes = new LinkedList<Integer>(); if (array == null || sublist == null || array.length == 0 || sublist.length == 0 || sublist.length > array.length) { return new int[0]; } ...
91506972-9165-48b0-b597-1089d52c9d4d
1
public List<MenuElement> getChildren() { if (this.children == null) { return new ArrayList<MenuElement>(); } return this.children; }
7bd827f7-f610-4e92-bb57-403ae4ebe3b0
6
private void match(Matcher matcher) { String message = null; if (negation) { if (!matcher.matchNegation()) { message = matcher.getMatchNegationMessage(); } } else { if (!matcher.match()) { message = matcher.getMatchMessage(); } } negation = false; if (message != null) { Throwable exce...
312b3d21-78cd-40e5-8dd6-3d686f581168
5
private synchronized void dequeue(PacketScheduler sched) { Packet np = sched.deque(); if (np != null) { // process ping() packet if (np instanceof InfoPacket) { ((InfoPacket) np).addExitTime( GridSim.clock() ); } if (super.rep...
67a4c7cd-9fc7-4b01-bb2b-4aa41cb73e8f
8
protected static Ptg calcDProduct( Ptg[] operands ) { if( operands.length != 3 ) { return new PtgErr( PtgErr.ERROR_NA ); } DB db = getDb( operands[0] ); Criteria crit = getCriteria( operands[2] ); if( (db == null) || (crit == null) ) { return new PtgErr( PtgErr.ERROR_NUM ); } int fNum = db.fin...
814367fd-46ca-4367-876c-c2533a148ebb
1
public static void main(String[] args) { int sum = 0; for (int i = 1; i < 1000; i++) { sum += spell(i); // System.out.println(sum); // if (i==342 || i ==115) System.out.println(spell(i)); } sum+=11; System.out.println(sum); }
cb783e0e-7c09-4e2a-a9b7-f7f0258e9146
2
public void destroy() { ui.mapview.disol(17); if(walkmod) ui.mapview.release(this); if(ol != null) ol.destroy(); super.destroy(); }
30b68e12-51f1-4575-b6c9-3e3c9f62ef56
8
public void newMixer( Mixer m ) { if( myMixer != m ) { try { if( clip != null ) clip.close(); else if( sourceDataLine != null ) sourceDataLine.close(); } catch( SecurityException e...
81a02ed2-0cab-469b-9e8d-bbccc2c94478
3
public State getStoppedDirectionState(Point point) { Point position = new Point(super.getIntX(), super.getIntY()); if(Point.insideAngle(Point.DOWN_LEFT, Point.DOWN_RIGHT, position, point)) { // Face up return State.STOPPED_UP; } else if(Point.insideAngle(Point.DOWN_RIGHT, Point.UP_RIGHT, position, point)) { //...
0ef6d668-b001-4a5f-85bd-bb1bae592b5c
9
@Override public void actionPerformed(ActionEvent e) { String selectedType = (String) colorOf.getSelectedItem(); if (e.getSource() == ok || e.getSource() == apply) { Color selectedColor = chooser.getColor(); if (selectedType.equals(TO_BE_TYPED)) pref.setToBe...
8e973414-1bda-4232-9e8e-db32d24327b7
1
public static void setSpotLights(SpotLight[] spotLights) { if (spotLights.length > MAX_SPOT_LIGHTS) { System.err .println("Error: You passed in too many spot lights. Max allowed is " + MAX_SPOT_LIGHTS + ", you passed in " ...
5f37c51b-4216-4648-89cd-6d4fd537aee4
8
public boolean isCar(char current, char[] neighbors, int[] position){ if(current == neighbors[0]){ int[] positionTwo = {(position[0]-1), position[1]}; if(!letterExistsElsewhere(current, position, positionTwo, null)){ //System.out.println("car position 1"); return true; } else { return false; }...
14272094-c2ec-429e-87b0-9c7aa23a4e22
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((folderPath == null) ? 0 : folderPath.hashCode()); return result; }
91ad691e-435f-4a11-bb81-0afae9539409
8
public static ItemStack upgrade(Inventory inv, Player p){ ItemStack is = inv.getItem(0); if(is.hasItemMeta()){ if(is.getItemMeta().hasLore()){ //Check old upgrade int oldUp = 1; int newUp = 1; if(is.getItemMeta().getDisplayName().contains("+")){ String name = is.getItemMeta().ge...
572456c1-316e-4b4b-80e1-3ffa9e375672
5
public static Member getMemberByID(int memberID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt = conn.createStatem...
2dd4dc62-2de2-435a-bb28-a7a64887cf3b
3
private static void AllSubsets(String s){ int l = s.length(); StringBuilder sb = new StringBuilder(); for(int i=0;i<Math.pow(2,l);i++){ sb = new StringBuilder(); int base = 1; for(int j=0;j<l;j++){ if((i & base) > 0){ sb.append(s.charAt(j)); } base = base << 1; } System.out.println...
f53a1231-631f-4875-8cf0-59b88b661739
5
public void run() { while (!stop) { try { if ( autoScale == true ) { if ( getYmax() < bufferYmax ) setYmax(bufferYmax); if ( getYmin() > bufferYmin ) setYmin(bufferYmin); } redrawGra...
65f03b0f-b730-4fdf-ae67-f9efbfc89f85
8
public byte nearHandle(double x, double y) { double dx = this.x - x; double dy = this.y - y; if (dx * dx + dy * dy < 16) return UPPER_LEFT; dx = this.x + this.width - x; dy = this.y - y; if (dx * dx + dy * dy < 16) return UPPER_RIGHT; dx = this.x + this.width - x; dy = this.y + this.height - y; ...
51f75e78-61b9-470c-8e31-838b2c67a456
4
public DiskBasedCobweb(){ try { in = new BufferedReader(new FileReader(searchedSitesFilePath)); bw = new BufferedWriter(new FileWriter(tmpSearchedSitesFilePath)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-gener...
1e5da9cf-a051-4309-a735-ac903ce64e46
1
public static final String aAn(String text) { return Text.startsWithVowel(text) ? AN : A; }
817782ef-2de8-4b16-89b4-5de22a60c465
4
@Override public Player getPlayerById(Long id) { checkDataSource(); if (id == null) { throw new IllegalArgumentException("id is null"); } try (Connection conn = dataSource.getConnection(); PreparedStatement st = conn.prepareStatement("SELECT idname,surname...
191324dd-1f71-4e09-ae9b-951194f056f8
0
private void addEncoder(Encoder encoder) { encoders.add(encoder); }
892a3862-0855-44e4-b6ba-ec01db2c8d86
0
public Long getIdConnection() { return idConnection; }
7f7e134d-c704-49f9-a184-324c293f9000
3
public static void print(RandomListNode a) { while (null != a) { int next = -1; int rand = -1; if (null != a.next) next = a.next.label; if (null != a.random) rand = a.random.label; System.out.println(a.label + "(" + next + "," + rand +")"); a = a.next; } }
2696bc60-17a4-42bd-8172-36e3076d4b3a
8
public void setRecursiveNotDirty() { super.setRecursiveNotDirty(); if(this.overlayXY!=null && this.overlayXY.isDirty()) { this.overlayXY.setRecursiveNotDirty(); } if(this.screenXY!=null && this.screenXY.isDirty()) { this.screenXY.setRecursiveNo...
e478c821-5cb6-41fb-8e63-07bfe9365e5e
6
private void init( File file ) { fullName = file ; String fileName = fullName.getName() ; int i1 = fileName.indexOf( '_' ) ; int i2 = fileName.indexOf( '.', -1 ) ; prefix = "" ; suffix = "" ; if ( i1 > 0 ) // has _ => filename with language extension { prefix = fileName.substr...
a3a4cf64-54c1-4413-a361-73e3ab01375f
7
public void evolve() throws GenerationEmptyException { /* @ \label{Population.java:evolve} @ */ if (generation == 0) { makeFirstGeneration(); } if (currentGeneration.size() <= 1) { throw new GenerationEmptyException("Current generation size " + currentGeneration.size() + " too small to evolve"); } ...
0d468555-af85-43bb-994b-2d1824e799ba
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Cliente other = (Cliente) obj; if (idCliente == null) { if (other.idCliente != null) return false; } else if (!idCliente.equals(other.id...
9b58cb72-f056-4fc7-b1ef-b1a0bfde477e
7
@Override public void removePlayer(Player player) { debug("Attempting to remove player " + player.getName()); int go = 0; for (ItemStack i : player.getInventory().getContents()) { if (i == null) continue; if (i.getType() == Material.GOLD_BLOCK) { ...
5a2e2b0c-7fd5-4c84-8f51-bc6948ac0915
8
@Override public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { if (cs instanceof Player) { final Player player = (Player) cs; if (args.length == 1) { final int mapid = Integer.parseInt(args[0]); if (mapid == 1 || mapid == 2 || mapid == 3) { if (mapid == 1) { ...
ab29c293-eec4-428d-9510-1411c23ba361
8
public void passagePert() { Fenetre.lePert.arcs = new ListeArcs(); for (int i = 0; i < Fenetre.lePert.sommets.size(); i++) { Sommet biparti1 = Fenetre.lePert.sommets.elementAt(i); for (int j = 0; j < Fenetre.lePert.sommets.size(); j++) { Sommet biparti2 = Fenetre.lePert.sommets.elementAt(j); for (int ...
6253e635-48e2-4755-b4dd-af9a57e8c8bd
4
private double denari(ICard card) { //Una presa contiene anche la carta in esame List<List<ICard>> prese = Rules.getPrese(card, table.cardsOnTable()); if(prese.size() > 0){ double fp = 0.0; for(List<ICard> presa : prese) for(ICard c : presa) if(c.getSeed() == Seed.DENARI) fp+=0.3; return f...
b49d6656-fcee-4fb3-862c-51b2de3a36dc
6
public double getMin() { if (total_size == 0) return Double.NaN; double min = Double.POSITIVE_INFINITY; if (type == Integer.class) { for (int i = 0; i < total_size; i++) { if (min > ((int[])vals)[i]) min = ((int[])vals)[i]; } } else { ...
10b7fd07-227b-46e8-bc11-2e4d69b96bf1
4
public static void main(String[] args) { int turn = DEFAULT_TURN; boolean vis = DEFAULT_VISUALIZE_FLG; Player p1 = null; Player p2 = null; try { String[] playerClass = new String[2]; int p = 0; for (int i = 0; i < args.length; i++) { if ("-turn".equals(args[i])) turn = Integer.valueOf...
729978b5-a33d-468a-ac6b-7d13881e5871
4
void parseCp() throws java.lang.Exception { char c; if (tryRead('(')) { dataBufferAppend('('); parseElements(); } else { dataBufferAppend(readNmtoken(true)); c = readCh(); switch (c) { case '?': case...
a00038ee-9c9e-4bfe-a35c-90d20557535c
5
public ReturningProjectile createReturningProjectile(Actor source, String im, int sp, Point start, Point end, boolean f, boolean p, boolean dt, int d) { if (gameController.multiplayerMode != gameController.multiplayerMode.CLIENT) { ReturningProjectile projectile = new ReturningProjectile(this, regis...
0f6e4632-4817-41ac-95f2-59088951eff0
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...
b26c0311-fec6-45ea-bc0e-76350248a5cd
3
@Override public TestResult test(Object input, Void... args) { //如果不是基本类型 if( !InputType.isPrimitiveType(input) ){ throw new IllegalArgumentException("Parameter 'input' ONLY support primitive type."); } String inputS = String.valueOf(input); boolean passed = inputS.length() >= 0 && !inputS.trim().re...
1478aa95-a3d7-4035-8638-9586809ca084
3
public ClientModel(ServerModel serverModel) { this.serverModel = serverModel; gameModel = new GameModel(serverModel); HashMap<String, CatanColor> playerColorMap = this.getPlayerColorMap(); log = new ArrayList<client.communication.CommsLogEntry>(); chat = new ArrayList<client.communication.CommsLogEntry>(); ...
ca2f685c-3541-49f2-a5b7-7c5caa3e6cce
8
protected Room alternativeLink(Room room, Room defaultRoom, int dir) { if(room.getGridParent()==this) for(int d=0;d<gridexits.size();d++) { final CrossExit EX=gridexits.elementAt(d); try { if((EX.out)&&(EX.dir==dir) &&(getGridRoomIfExists(EX.x,EX.y)==room)) { final Room R=CMLib.map().ge...
96428f95-0fed-44bb-bf7a-b7a1f004daee
9
public void newGame() { spaces = new Space[height][]; int col = 0; for(int y = 0; y < height; y++) { spaces[y] = new Space[width]; for(int x = 0; x < width; x++) { if(col == 0) spaces[y][x] = new BlackSpace(y, x); else spaces[y][x] = new WhiteSpace(y, x); col = 1 - col; ...
1c8b106c-5589-4760-b84e-020fca6f60b0
4
public List<Entity> getEntitiesContainingAny(Class<?>... componentClassList) { List<Entity> entityList = new LinkedList<Entity>(); for (Class<?> clazz : componentClassList) { // Get all entities that have this component HashMap<Entity, IComponent> entityMap = registeredComponents.get(clazz); // Remember we...
9c8cec7d-c545-4583-9497-ff94e58097a8
3
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof MasterDataEntity)) { return false; } MasterDataEntity other = (MasterDataEntity) object; if (this.id == null ? ...
1bacdaf6-035c-41ba-86f9-0f9443ff1cbd
5
private void checkPitch() { if( channel != null && channel.attachedSource == this && LibraryLWJGLOpenAL.alPitchSupported() && channelOpenAL != null && channelOpenAL.ALSource != null ) { AL10.alSourcef( channelOpenAL.ALSource.get( 0 ), AL1...