method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4698d33e-b660-480a-8d65-cd0eae1a526f
0
public void updateFirmwareVer(int firmwareVer) { lastFirmwareVer = firmwareVer; }
aa097868-1f94-43d1-a0b9-976cc2786605
9
@SuppressWarnings("rawtypes") public void run() { if (state == GameState.Running) { while (true) { robot.update(); if (robot.isJumped()) { currentSprite = characterJumped; } else if (robot.isJumped() == false && robot.isDucked() == false) { currentSprite = anim.getImage(); } ...
b72a99f4-7f69-4745-a7f5-eb26a496efef
7
private CellType getTypeForCell(int x, int y) { // unpaired cols in paired rows are grey if ((x + y) % 2 != 0) { return CellType.WHITE_CELL; } Cell cell = chessBoardModel.getCellAt(x, y); if (cell.isEmpty()) { return CellType.GREY_CELL; } ...
0c371b6e-c604-4e90-a59b-b8054037b2ba
5
@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 UserType)) { return false; } UserType other = (UserType) object; if ((this.id == null && other.id != null) || (...
4a69ec9f-1cca-4c9a-afc1-2d7f091ab5c7
1
public PowerFailureGridFactory(Grid grid, FullGridFactory factory) { if (grid == null) throw new IllegalArgumentException("Grid can't be null!"); this.factory = factory; this.grid = grid; this.map = new HashMap<>(); }
cb217969-c0ea-4499-8814-d73d65259328
6
private boolean checkNestPositions(int size, int[] redPos, int[] blackPos) { if(!(redPos[1]+(size*2)>blackPos[1] && redPos[1]-(size*2)<blackPos[1])) { return true; } else { if(redPos[0]==blackPos[0]) { return false; } else { int[] leftNest; int[] rightNest; if(redPos[0]>blackPos[0]) { ...
220b8cca-f96a-4a2b-95bf-078cf38e9411
1
private void compute_pcm_samples12(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[1...
66952656-2156-4525-9099-42770c5542fc
1
public void skipLine() throws IOException { while ( c != '\n' ) getChar(); }
83624399-2134-4869-afc2-98931fd0e550
6
private static void populateSets(String[] args) throws Exception { int nsetA, ndiff; try { nsetA = Integer.parseInt(args[0]); ndiff = Integer.parseInt(args[1]); } catch (Exception e) { nsetA = 10000; ndiff = 100; } ...
73b547bb-8072-49d1-9a31-e3b5eae7c96e
0
@Override public boolean isManagingFocus() {return true;}
8629907d-ee25-4553-a48c-a0dbe2483b0a
6
public String getDescription() { if(fullDescription == null) { if(description == null || isExtensionListInDescription()) { fullDescription = description==null ? "(" : description + " ("; // build the description from the extension list Enumeration<String> extensions = filters.keys(); if(extensions != nul...
0af05fcc-8ddb-4a32-8a30-d0a69fadc6e6
7
private static boolean[][] truncate(boolean[][] polyomino){ boolean[][] newP = new boolean[polyomino.length-1][polyomino.length-1]; boolean left=false; for (int i=0; i<polyomino.length; i++){ left = left || polyomino[0][i]; } boolean top=false; for (int i=0; i...
631f12a5-16c5-4453-a334-94a7f4969ee3
0
public void mouseEntered(MouseEvent e) { }
9d20e795-b44b-48e0-af7a-10f7985ca2de
5
public String[] sortByOdds(String[] rules) { if(rules.length!=0){ for(String test:rules){ String temp[]=test.split(":"); str = new StringTokenizer(temp[1]); ArrayList<String> values = new ArrayList<String>(); while(str.hasMoreTokens()){ v...
6c928e56-f8b8-4ee4-b010-54fa5d0e85fb
4
public void sortByChipIdentifier() { /* iterator1(i): iterate over hpArray starting at index 0 */ for(int i = 0; i < hpCount - 1; i++) { int min = i; /* dont do anything if theres not at least 2 elements in hpArray */ if(hpCount >= 2) ...
2dbc55cb-d6c0-4e54-9549-416821f5eee5
5
public static void main(String... args) throws InterruptedException { MockBrokerHandler handler = new GlamBrokerHandler(); MockBroker broker = new MockBroker(handler); broker.init(); // Blocks until startup is complete. // At this point the broker is online. Clients can connect to it, publish messages, subscr...
cf0a0ec4-8bf4-46ae-ae60-61427673aed5
4
public void geraCelulaInteligente() { int celula = 0; // Evita que a máquina tente atirar em uma posição qe já foi "atirada" celula = celulasPossiveis[indiceCelula]; while (pJogador.pos.get(celula).acertada) { indiceCelula++; celula = celulasPossiveis[indiceCelula]; if(indiceCelula == 3) in...
f0b4a2e2-f4d5-435a-ad1a-a5cedf9a00ac
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null) { return false; } else if (getClass() != obj.getClass()) { return false; } Segment other = (Segment) obj; if (p1.equals(other.p1) && p2.equals(other.p2)) { return true; } else if (p1....
b2de50cc-3607-469e-92b7-7ad0da1c609c
6
static void quickSort(int low, int high){ int i = low; int j = high; int pivot = list.get(low + (high - low)/2); while(i <= j){ while(list.get(i) < pivot) i++; while(pivot < list.get(j)) j--; if(i <= j){ transfer(i, j); i++; --j; } if(low < j) quickSort(low, j); if...
92c697d9-dcb6-4ea6-b8d4-c743c508f0dd
1
public double calcBonusAttaque(Territoire from, Territoire to) { double bonus = this.bonusAttaque(from, to); if (hasPower()) { bonus += this.pouvoir.bonusAttaque(from, to); } return bonus; }
dcdf7481-63a2-4d91-85ac-fe78fb58ffbb
7
public ShowGoLoadFile(MainWindow mainWindow) { this.mainWindow = mainWindow; fc = new JFileChooser(new File(System.getProperty("user.dir"))) { private static final long serialVersionUID = 1L; @Override public void approveSelection() { File f = getSelectedFile(); if (!f.getName().endsWith(".showgo"...
510c4a74-70e1-4a80-ba0b-dd76896939f0
3
@Override public String strip(String s) throws Exception { final int length = s.length(); if (oldChars.length < length) { oldChars = new char[length]; } s.getChars(0, length, oldChars, 0); int newLen = 0; for (int j = 0; j < length; j++) { char...
61eb1639-6cd3-409c-80f7-aece4c165e8f
9
public final String getTitle(int xIdx, final IOHandler io) { if (!this.init) { align(); if (this.duration == null) { calculateDuration(io); } if (this.title == null) { this.title = this.path.getFilename().substring(0, this.path.getFilename().length() - 4); } } final Integer x = this.r...
01800f14-05fa-43d9-91e3-fa5fb6e74f19
8
private static boolean canExtend(World par0World, int par1, int par2, int par3, int par4) { int var5 = par1 + Facing.offsetsXForSide[par4]; int var6 = par2 + Facing.offsetsYForSide[par4]; int var7 = par3 + Facing.offsetsZForSide[par4]; int var8 = 0; while (true) { ...
85eb675b-22a1-4587-b1fb-69b690c1b4ce
9
@Override protected void layout(Composite composite, boolean flushCache){ getControls(composite); // Rectangle rect = composite.getClientArea(); int left = rect.x, right = rect.width, top = rect.y, bottom = rect.height; // if (north != null){ if (!north.isVisible()){// // Reset bounds:// north...
f026cf4e-1582-48b8-ae0b-aebd3abfbc90
8
public String convertToHacklace(File image) { StringBuilder out = new StringBuilder(); try { BufferedImage buffImage = ImageIO.read(image); if (buffImage == null) { System.err.println(image.getName() + ": not supported image file format"); } else { ...
4cc3b252-1dd1-4bb8-9af5-a88ae22b44ba
0
public LoadFileFormatClassCommand(String name) { super(name); }
8e0c4ce4-0f86-4727-b366-58f312686f54
0
@Override public String toString() {return ("" + cur.getRGB());}
38d3f9b1-e063-4983-9912-8b158797e50e
2
public static void MovePlayersToWorld(Player[] players, String destinationWorld, Boolean resetPlayer) { World wDestWorld = GetWorld(destinationWorld); Location lSpawn = wDestWorld.getSpawnLocation(); for (int i = 0; i < players.length; i++) { players[i].getPlayer().teleport(lSpawn); if (resetPlayer) { ...
4dfa7ded-8622-4eb2-9070-64f3c0b9290a
2
public static int[] sort(int[] list){ if(list == null || list.length == 1){ return list; } else{ return mergeSort(list); } }
de2597e0-2837-41eb-8f7a-e76670657844
8
private void paintFall(Graphics2D g2) { boolean test = false; if (test || m_test) { System.out.println("GameBoardGraphics :: paintFall() BEGIN"); } if (m_type.equals("fall") && m_start && m_changes.size() > 0) { int m_x = m_changes.get(0).getX() * getSquareWidth(); if (m_changes.get(0).getValue() == Ga...
73f629b7-91ff-4665-96db-28bf46cd9f18
8
public void getCategoryDB() throws SQLException{ DataSource ds = null; try{ Context ctx = new InitialContext(); ds = (DataSource)ctx.lookup("java:comp/env/database-category"); if(ds == null) throw new SQLException("Error, could not retrieve data source."); Connection con = ds.getConnect...
28dcc62f-21e3-4f2e-b1ee-6a3638f0c74d
8
public static void undefineOldClass(Stella_Class oldclass, Stella_Class newclass) { { Cons newsubs = Cons.copyConsList(newclass.classDirectSubs.theConsList); Stella_Class.unfinalizeClassAndSubclasses(oldclass); Stella_Class.forgetUnfinalizedClass(oldclass); { Surrogate oldsub = null; Cons...
fba4ab6f-4636-492e-a5fe-90a87e99f9bf
0
public boolean isCellEditable(int row, int column) { return canEditColumn[column]; }
cf85ec16-909f-4106-97a3-7b03ebcac224
5
@Override public Object getValueAt(int row, int col) { switch (col) { case 0: return entidades.get(row).getUsuarioId(); case 1: return entidades.get(row).getNome(); case 2: return entidades.get(row).getSobrenome(); ...
0ec2c08a-e11f-471f-b70d-32c3a2fb565c
0
public int getMinSdkVersion() { return this.minSdkVersion; }
2eaa0c7e-7800-4e62-9c52-88c5f84f142c
0
public Locale(int id) { this.id = id; }
65715eb1-60b9-4747-8bc2-d3567f6504e9
7
public static BooleanVector getIndexingVector(NamedDescription self) { if (self.arity() == 2) { return (NamedDescription.getBinaryIndexingVector(self)); } { BooleanVector cachedvector = ((BooleanVector)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Logic.SYM_LOGIC_INDEXING_VECTOR, null))); i...
5d7d8a39-6cbf-4272-abdf-b2ddf69f9f97
4
public String getPath() { boolean test = false; if (test || m_test) { System.out.println("FileManager :: getPath() BEGIN"); } if (test || m_test) { System.out.println("FileManager :: getPath() END"); } return m_path; }
f9943675-7090-41e2-a38e-1905bbc9ea55
4
@Override public void init() { super.init(); int pos = 0; rowFirst = ByteTools.readShort( getByteAt( pos++ ), getByteAt( pos++ ) ); rowLast = ByteTools.readShort( getByteAt( pos++ ), getByteAt( pos++ ) ); colFirst = ByteTools.readShort( getByteAt( pos++ ), getByteAt( pos++ ) ); colLast = ByteTools.readSho...
4e34f217-403b-430f-857c-ff628ecc8789
2
private Value emitIndexingCode(ArrayDesignator d, BasicBlock cur) throws Exception { ArrayList<Value> index = d.getIndex(); if(index.size() != multipliers.length) { throw new Exception("Error, incorrect number of array indexes"); } ArrayIndex rval = new ArrayIndex(gl...
09040a9b-6994-4425-9c7e-e464aa57421c
3
public static void main(String[] args) throws SQLException { ShowEmployeesNamesandManagersOOP command = new ShowEmployeesNamesandManagersOOP(); Collection<ManagerAdd> allEmployeesBasicInformation = command .getAllEmployeesBasicInformation(); if (allEmployeesBasicInformation == null || allEmployeesBasicInf...
2c84c419-8df5-48a5-938c-b0664e761d22
4
private Direction calculateLineDirection(GridPoint referencePoint) { GridPoint sourceLocation = this.source.getLocation(); if (sourceLocation.equals(referencePoint)) { return Direction.NONE; } int xDiff = referencePoint.getColumn() - sourceLocation.getColumn(); int yDiff = referencePoint.getRow() - source...
a5dc1402-fd87-4526-ab65-16209b0e454e
0
public void setEffMult(double f) { effectivenessMultiplier=f; }
b6578920-8f77-4e4b-a184-3b021b44724a
4
public static void free(Closeable... closeables) throws IOException { List<Throwable> throwables = new LinkedList<Throwable>(); for (Closeable closeable : closeables) { try { if (null != closeable) { closeable.close(); } } catch (IOException e) { throwables.add(e); } } if (!throwab...
0739c658-cc54-49d6-9949-010aaefe6eb7
2
public void stopSimulation() { if (sim != null) { if (sim.getState() == Thread.State.WAITING) { sim.unPause(); } sim.stopSimulation(); } }
eedf269b-061c-4ba4-a8e3-d9c90ef55350
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ClickedRelationship that = (ClickedRelationship) o; if (product != null ? !product.equals(that.product) : that.product != null) return false; i...
1c51a337-8efd-4c63-b5e2-ff1fc46728b7
7
protected Dimension layoutSize(Container parent, int mode) { int wl = 0; int wt = 600; int h = 0; synchronized (parent.getTreeLock()) { Dimension db = (mode == MINIMUM_SIZE) ? lblName.getMinimumSize() : lblName.getPreferredSize(); h += db.height + vgap; for (int i = 0; i < labels.length; i++) {...
5242fc28-ae6f-4ee3-a3dc-0c7a990098a2
9
public Tag findNextTagByName(String name, Tag found) { if (type != Type.TAG_List && type != Type.TAG_Compound) return null; Tag[] subtags = (Tag[]) value; for (Tag subtag : subtags) { if ((subtag.name == null && name == null) || (subtag.name != null && subtag.name.equals(...
e273be03-6bcb-4e70-bd64-94f1c4b498cb
7
private void checkDepth(TreeNode node, int depth) { if (node == null) { return; } depth ++; TreeNode left = node.left; TreeNode right = node.right; if (left == null && right == null) { if (depth < minDepth || minDepth == 0) { min...
508f36c4-7344-439b-9a70-f4165fa3ccb5
8
public void run(){ //This is the bundle we will put all our data in throughout the app, then send over UDP port 57110 osc.OSCBundle bundle = new OSCBundle(); while (true){ // loop to acquire, bundle and send data listenForStateChange(); //Collect raw EEG data and send it out the OSC port. ...
897126ac-ff16-4f25-a001-c3b76fdee7f0
8
private void getClaimList() { titleDLM.removeAllElements(); claimResultList = claim.getClaimList(fileName); if (claimResultList.size() != 0) { for (int i = 0; i < claimResultList.size(); i++) { titleDLM.addElement(claimResultList.get(i).getTitle()); } titleJlst.setSelectedIndex(0); currentClaim = ...
a3e71128-420a-41ed-8f07-70744146e4cc
7
int partition( int[] array, int lowerIndex, int higherIndex){ if(lowerIndex<0 || higherIndex>=array.length || lowerIndex>=higherIndex) return -1; int i = lowerIndex; int j = higherIndex; // calculate pivot number, I am taking pivot as middle index number int pivot = array[lowerIndex+(higherIndex-lowerIndex...
31002552-06ae-49e1-9354-580cf06d3d3b
4
public void mouseDown(MouseEvent event) { if (event.button == 1) { // draw with left mouse button getPaintSurface().commitRubberbandSelection(); } else { // set text with right mouse button getPaintSurface().clearRubberbandSelection(); Shell shell = getPaintSurface().getShell(); final Shell dialog...
f3948d3d-c349-4e67-8883-33f0a7b7f523
4
private static void expandCluster(TimeSerie timeSerie, List<TimeSerie> neighbours, Cluster cluster) { cluster.addTimeSerieIndex(timeSeries.indexOf(timeSerie)); int nrOfNeighbours = neighbours.size(); for (int i = 0; i < nrOfNeighbours; i++) { int indexNeighbourTimeSerie = timeSeries.indexOf(neighbours.ge...
06d060dd-d994-427c-816b-044e58082613
3
private void checkForNewBeat() { if (msSinceBeat > getMsPerBeat()) { measureActions.set(beatNumber, beatBuffer.processBeat(getMsPerBeat())); isNewBeat = true; beatNumber++; if (beatNumber >= beatsPerMeasure) { beatNumber -= beatsPerMeasure; measureNumber++; isNewMeasure = true; } else { ...
c173e18e-c2ca-4581-9256-a755c8e3260e
7
public Object nextContent() throws TXMLException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if(c == 0) { return null; } if(c == '<') { return TXML.LT; } sb = new StringBuffer(); for(;;) { if(c == '<' || c == 0) { back(); return sb.toString()....
d69057e5-c54c-4798-89a9-4dfbd615f73d
2
public Asteroid(int x, int y, double angle, double vx, double vy, double vAngle, int type){ this.type = type; int radius; int vertices; if (type == 0){ radius = RADIUS_LARGE; vertices = VERTICES_LARGE; }else{ radius = RADIUS_SMALL; vertices = VERTICES_SMALL; } model = new AsteroidModel(x, y, a...
cf27ff26-7c3f-4832-8c49-7a52fef3949f
4
@Override public TLValue evaluate() { TLValue a = lhs.evaluate(); TLValue b = rhs.evaluate(); if(a.isNumber() && b.isNumber()) { return new TLValue(a.asDouble() > b.asDouble()); } if(a.isString() && b.isString()) { return new TLValue(a.asString().compareTo(b.asString()) > -1); }...
da81cf53-2731-490a-bcc3-6ddc0937ee72
5
private static double[][] getDistanceMatrix(List<TimeSerie> timeSeries) throws InputException { double[][] distanceMatrix = new double[timeSeries.size()][timeSeries.size()]; // Construct the lower half of the matrix for (int i = 0; i < timeSeries.size(); i++) { for (int j = 0; j < i; j++) { distanceMatr...
44da7e33-9cb8-47ee-ad4d-8479fecacf79
4
public void freeze(int X, int Y, int R) { // long time = System.nanoTime(); for (int i1 = Math.max(X-(R+1),0); i1 < Math.min(X+(R+1),w); i1 ++) { for (int i2 = Math.max(Y-(R+1),0); i2 < Math.min(Y+(R+1),h); i2 ++) { if (Math....
f5509185-daed-4e22-a5e4-5d17bc6374e4
0
public UselessProductionRemover() { }
5bc54311-32d2-4dbd-a8f8-cad225c2cb01
1
private void parseModifierShell(String modifierShell, Class<?>[] paramTypes, Map<String, Integer> paramIndexes) throws DaoGenerateException { ExpressionParser parser = ParserFactory.createExpressionParser(ExpressionType.MONGO_SHELL); parsedModifierShell = parser.parse(modifierShell); List<String> parameterName...
bfe6cd5d-ee0f-45b6-b91e-bddfe36c60a9
2
public static void main(String[] args) { post =new Post(); teacherList = new ArrayList<Teacher>(); postList = new ArrayList<Post>(); try { System.out.println(getJSON("http://dev.mhsnews.org/json_db/updates.php")); test(); getTeachers(); setTeachers(); } catch (IOException e) {e.printStack...
b1ac6f9e-5f66-4522-ad68-b96876e3a136
7
public boolean fireballCollideCheck(Fireball fireball) { if (deadTime != 0) return false; float xD = fireball.x - x; float yD = fireball.y - y; if (xD > -16 && xD < 16) { if (yD > -height && yD < fireball.height) { if (noFireballDeath...
f08bf189-25a9-4748-8a68-8c3119b2851a
4
void BMEaddSpecies( node v, double[][] D, double[][] A) { edge e; //loop variable edge e_min; //points to best edge seen thus far double w_min = 0.0; //used to keep track of tree weights //initialize variables as necessary //CASE 1: T is empty, v is the first node if ( this.root == null ) { t...
fa70e835-ff08-4645-b18e-877052325536
5
public static ArrayList<MediaCopy> searchMediaByCreator(String creator){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<MediaCopy> ...
d4ba1d01-125f-4dd3-8d18-1e0390b20d65
9
private static void ld(ProcessManager p) throws Exception{ if(p.env().instruction().getName().equals("ld")){ TextInput in = null; TextInput oin = null; ImageOutputStream out = null; int order = 0; try { in = p.textInput(); HaplotypeSet hs = p.createHaplotypeSet(in); out = p.imageOutputStre...
bcae437e-e747-4203-a49b-53cc8f8399f9
6
public static double hypot(final double x, final double y) { if (Double.isInfinite(x) || Double.isInfinite(y)) { return Double.POSITIVE_INFINITY; } else if (Double.isNaN(x) || Double.isNaN(y)) { return Double.NaN; } else { final int expX = getExponent(x); ...
ed651c20-0297-4c27-afa5-1598f6766afb
2
public static String unicodeRepresentation(String str) { StringBuilder b = new StringBuilder(); for (char c : str.toCharArray()) { String s = Integer.toHexString(c).toUpperCase(); while (s.length() <= 3) { s = '0' + s; } b.append("\\u").ap...
31af9817-4079-45b6-82c0-a5273595ff36
5
private void parseWKT2RDF(String t, String resource, String s) { try { if (transform != null) { Geometry o = reader.read(s); //Attempt to transform geometry into the target CRS try { o = JTS.transform(o, transform); } catch (Exception e) { e.printStackTrace();...
6300f807-e813-46ad-a37c-6fa81d09b992
7
public ConnectionFileReader(String filepath) { File file = new File(filepath); Charset charset = Charset.forName("UTF-8"); try (BufferedReader reader = Files.newBufferedReader(file.toPath(), charset)) { String line = null; while ((line = reader.readLine()) != null) { if (!line.contains("#")) { if ...
1111d618-b80e-48ba-b855-a099edc33cb2
4
public String getProvinceHistoryFile(final int provId) { // Can't use resolveFilename, because we don't know what the file is // called. if (usingMod) { if (replaced.contains("history")) { // Case 1: History is replaced. // If there is a file in the mo...
b122d8ff-11e2-400a-a658-7c05fdb87fcd
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...
9acf6b1b-4a78-438b-b236-ce4dee4e9c2d
8
public boolean isLegalMoveOne(int pieceNumber){ if (board[pieceNumber].getPieceType()==1 || board[pieceNumber].getPieceType()==2){ if (board[pieceNumber].getX()==0) return false; } else{ if (board[pieceNumber].getY()==0) return false; } int position = board[pieceNumber].getPositions()[...
84e9f85d-7168-4d2a-b5f3-6bed9cd1c961
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
869f1ca2-16b9-415c-8b65-42ea4ab5ba31
6
private void createFontInfoXML(InputStream in, final String dir) throws Exception { XMLReader parser = XMLReaderFactory.createXMLReader(); DefaultHandler handler = new DefaultHandler() { int cc = 0; String ff = ""; short s = 0; boolean bo = false; ...
d16779a6-f674-4931-ad00-c39da4dd0c4b
4
public String getSqlString() { StringBuilder statementBuilder = new StringBuilder(); if (selectedIds.isPresent() || !whereConstraints.isEmpty()) { statementBuilder.append("WHERE ("); statementBuilder.append(getIdSetSqlCondition()); if (selectedIds.isPresent() && !whereConstraints.isEmpty()) {...
b0ab08c5-d92f-4d04-9174-5bf4765fd9ae
1
private void firePeerReady() { for (PeerActivityListener listener : this.listeners) { listener.handlePeerReady(this); } }
bf9e4b3f-d38d-429e-9b9d-0660c982ac54
0
public void mousePressed(MouseEvent event) { //MERLIN MERLIN MERLIN MERLIN MERLIN// block = ((TuringMachine) getAutomaton()).createBlock(event.getPoint()); getView().repaint(); }
9c931d1d-1650-4f24-8653-db8ad0d7ad25
4
public static void returnItem(Messagable ui, String name, String category, String username) { MemberAccount acct = MemberAccount.getAccount(username); Item item = Item.getItem(name, category); boolean itemReturned = true; //Reject if Member Account or Item Doesn't exist if(acct == null){ itemReturned = fal...
442b064a-bae9-4bea-a044-b904017cf120
6
public void shutDown() { // Failure! Handle Files placed on this machine try { //delete any temporary file name blocked by this data node for(String proxy: fileProxyList) NameNode.fs.RemoveFileProxy(proxy); //TODO put all blocks of this node into deletequeue //for all fileblocks on that clien...
6dfc0db0-52e6-4c8e-b22c-42d14e9e477a
2
public static void main(String[] args) { if (!(args.length == 2 || args.length == 3)) { System.out.println("THERE WAS AN ERROR WITH THE INPUTS"); return; } new RUBTClient(args); }
9c92c0c2-9b0c-4548-b698-4f5cc8c9daba
5
public void mouseClicked(MouseEvent e) { for (Table t : plan.getTables()) { int dx = (e.getX() - t.getX()), dy = e.getY() - t.getY(); if (dy >= -20 && dy <= 20 && dx >= -11 && dx <= 28) { clicked = t; getHandler().actionPerformed( new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "FClick...
9e716a99-30f5-4a6f-a457-b7ec417139e1
3
private void setTransport(Transport transport) { logger.fine(String.format("setting transport %s", transport.name)); final Socket self = this; if (this.transport != null) { logger.fine(String.format("clearing existing transport %s", this.transport.name)); this.transport....
40c65abe-2827-462c-b049-74e61a46e867
8
public void scroll(float x, float y) { if ((getX() + x) <= 0 && (getX() + x) >= -getWidth() + Display.getWidth()) { setX(getX() + x); } else if (getX() > 0) { setX(0); } else if (getX() < -getWidth()) { setX(-getWidth()); } if ((getY() + y) ...
31dd8b9c-abfe-45f7-8264-e59ccc2b8d93
8
private boolean downloadFile(String fileSaveURL, String fileDownloadURL) { boolean isSuccessfullyDownloaded = false; URL url = null; URLConnection conn = null; BufferedInputStream in = null; FileOutputStream fout = null; try { url = new URL(fileDownloadURL); conn = url.openConnection(); conn.setRea...
56207cb0-47aa-4a6a-8215-1e006c08252c
5
private boolean proveNumberOfComponents(ICard cardOne, ICard cardTwo, ICard cardThree) { if (cardOne.getNumberOfComponents() == cardTwo.getNumberOfComponents() && cardOne.getNumberOfComponents() == cardThree .getNumberOfComponents()) { return true; } else if (cardOne.getNumberOfComponents() != cardT...
9daa7deb-de7c-4b0c-84ca-2daa433a0963
2
public void setStatustextFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.statustextFontColor = UIFontInits.STATUS.getColor(); } else { this.statustextFontColor = fontcolor; } somethingChanged(); }
613618f3-eaad-419b-a999-c31ac280b575
8
public static void keyPressed(KeyEvent keyEvent) { Iterator<PComponent> it = components.iterator(); while(it.hasNext()) { PComponent comp = it.next(); if(comp == null) continue; if (shouldHandleKeys) { if (comp.shouldHandleKeys()) ...
0411faf9-dfcd-45f0-b91f-7edf90df1ca2
1
public void readTable() { try { TranslationTable table = new TranslationTable(); InputStream input = new FileInputStream(inTableFile); table.load(input); input.close(); basePackage.readTable(table); } catch (java.io.IOException ex) { GlobalOptions.err.println("Can't read rename table " + inTableFi...
250f1013-71a5-4502-a2fa-d49bd2a8fb7f
1
public short getShort( String name ){ XAttribute attribute = getAttribute( name ); if( attribute == null ) throw new XException( "no attribute known with name: " + name ); return attribute.getShort(); }
abec1a96-f4e7-4a0d-86cf-cf5f4802f536
1
public synchronized void stopServer() { this.isStopped = true; try { this.serverSocket.close(); } catch (IOException e) { throw new RuntimeException("Error deteniendo el servidor", e); } }
18450beb-c68a-4a88-822c-29ea9e051af1
0
public int GetFirstTick() { return firstTicks; }
edb86a29-1b3b-4eb8-94cc-fcd06419a8b5
8
private int read0() throws IOException { final int retChar = this.currentChar; switch (this.currentState) { case EOF: return -1; case START_BLOCK_STATE: throw new IllegalStateException(); case RAND_PART_A_STATE: throw new IllegalStateExcepti...
d339d76d-5779-47e0-9d5d-962647176651
7
static public String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String s = Double.toString(d); if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) { ...
027ef4a7-3ce4-4c15-9784-39a67787b536
9
public boolean isScramble(String s1, String s2){ assert(s1 != null && s2 != null); if (s1.length() != s2.length()) return false; if (s1.equals(s2)) return true; char[] s1Array = s1.toCharArray(); char[] s2Array = s2.toCharArray(); Arrays.sort(s1Array); Arrays.sort(s...
8a1856d8-8256-45ca-aaa9-790f853b5873
9
@Override public void onMessage(MessageEvent<PircBotX> event) throws Exception { if(event.getMessage().startsWith("!")){ //NOTE: The isActive Is Reversed if(commands.containsKey(event.getMessage().substring(1).split(" ")[0])){ if(!disabledCommands.contains(eve...
ffac0799-9129-48ed-b20d-95deb5b71bcd
9
private void givePlayerEffect(Ball ball, Paddle paddleLeft, Paddle paddleRight) throws SlickException { Paddle paddleToChange; if(ball.getDeltaX() > 0) { paddleToChange = paddleLeft; } else { paddleToChange = paddleRight; } if(effectType.equals("Larger Paddle")) paddleToChange = largerPaddle(paddleTo...
09706caa-06c9-47f9-bd03-311c6ba0fc0c
0
private void esteRivi(String string, EsteenTyyppi tyyppi) { ArrayList<Integer> koordinaatit = stringKoordinaateiksi(string); ArrayList<Piste> pisteet = muutaPisteiksi(koordinaatit); Este e = new Este(pisteet); e.setTyyppi(tyyppi); taso.lisaaEste(e); }