method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6a83cbe7-66af-433b-bb00-28133d37b2d2
6
public double smoothRecursion(String suffix, String tag) { double theta = 0.2; // Assume a value for now // Recursive case: MLE of suffix + theta * recursion over smaller suffix if(!suffix.equals("")) { // A: Initial MLE of P(tag | suffix) // double MLE = getPriorProbability(tag); // Placeholder value ...
d58179b9-f57e-49bb-8c0f-4fa55ea48671
7
public DBConnection(String DB_NUM) throws CustomerizedException{ ConfigFileReader config = new ConfigFileReader(); if(config != null){ this.isTruncate = config.getResourceInfo("TRUNCATE_STATUS"); if(DB_NUM.equalsIgnoreCase("DB1")){ this.DriverName = config.getResourceInfo("DB1_DRIVERNAME"); this.URL =...
29dbbf07-7d02-42cf-a87e-ff404044ba83
8
private void buscar_constancia_byfiltro() { int contador = 0; ArrayList<String> lista = new ArrayList(); String condicionFinal = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); boolean fecha = chkFecha_Constancia.isSelected(); boolean campania = chkCampania...
55815bd4-d120-49b5-8d04-6341599f18e3
0
public String getFirst() { return first; }
e1e3df5e-98d3-4245-bed6-bbd64cf15f8d
0
@Basic @Column(name = "FUN_FECHA_CAMBIO_CLAVE") public Date getFunFechaCambioClave() { return funFechaCambioClave; }
b24b1fa5-ed37-401a-a1b9-690084621159
8
private void save(){ System.out.println("Saving files..."); PrintWriter out = null; try{ File file = new File("users.txt"); file.createNewFile(); FileOutputStream output = new FileOutputStream(file.getPath()); System.out.println("FileOutputStream p...
67e96eaf-e8f3-46ae-bc2e-0bca1fd7cc07
1
@Override public boolean write(Data data) { registerContents = data; fireUpdate(display()); if (registerContents == null) { return false; } return true; }
1e9a6646-cd39-4b21-8cd0-b5d51dc326a3
7
public static int[][] trimWhiteRows(int[][] seg){ boolean blackflag = false; if(seg.length < 1 ) return seg; if(seg[0].length < 1) return seg; int[][] eToESeg = new int[seg.length][seg[0].length]; int newSegCurrentRow = 0; for(int i = 0; i < seg.length; i++ ){ blackflag...
6c499ac4-9173-4a72-bd38-d370ba1d009b
7
public URL buildURL( ) throws MalformedURLException { StringBuilder urlString = new StringBuilder( ); urlString.append( this.proto( ) == null ? DEFAULT_PROTO : this.proto( ) ); urlString.append( PROTO_SEPARATOR ); urlString.append( this.host( ) ); if ( port != null && port > 0 ) urlString.append( PORT_S...
9cb94205-8e26-4240-9b18-7fafec4da5f7
6
@Override public void process() { if(fontSize == null) fontSize = "null"; if(magnification == null) magnification = "null"; if(foregroundColor == null) foregroundColor = "null"; if(backgroundColor == null) backgroundColor = "null";...
24e28e09-d645-4e5f-a32c-b22f50db030e
1
public boolean showAttack() { if(!done) { Game.paths.findPath(new int[]{x, y, 0, getMinRANGE(), getMaxRANGE(), team}); moved = true; attacking = true; return true; } return false; }
c5de97b9-70f2-4558-b3b1-77db05865dd1
2
public void playAudio(boolean loop) { if(type == SoundType.OGG) { audio.playAsMusic(1.0f, 1.0f, loop); } if(type == SoundType.WAV) { audio.playAsSoundEffect(1.0f, 1.0f, false); } SoundStore.get().poll(0); }
6f204e58-d28c-4968-85f6-95d5b88c4592
3
public void fireSelectionEvent(final SelectionEvent EVENT) { fireEvent(EVENT); final EventType TYPE = EVENT.getEventType(); final EventHandler<SelectionEvent> HANDLER; if (SelectionEvent.SELECT == TYPE) { HANDLER = getOnSelect(); } else if (SelectionEvent.DESELECT == ...
e327d548-0b78-4f4a-94f9-6b104f0240c3
0
@Override public String getID() { return super.getID(); }
ee1ad3a5-f7ff-41a6-b160-1cc216181cdf
5
public BoxLayoutFrame() { super("Demonstrating BoxLayout"); Box horizontal1 = Box.createHorizontalBox(); Box vertical1 = Box.createVerticalBox(); Box horizontal2 = Box.createHorizontalBox(); Box vertical2 = Box.createVerticalBox(); ...
bda72f3c-3576-445f-9f46-419c3fb03de5
6
private DrawCanvas drawVar(String string, int i) { DrawCanvas drawCanvas = null; switch (string.charAt(i)) { case 'F': drawCanvas = drawStep(); break; case 'b': moveStep(); break; case '+': ...
cf0456fb-ddb9-4dc3-bf17-6b21d3915759
5
@Override public void paintComponent(Graphics g){ Paint paint; Graphics2D g2d; if (g instanceof Graphics2D) { g2d = (Graphics2D) g; } else { System.out.println("Error"); return; } RenderingHints qualityHints=new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); ...
71591cad-02d7-4349-b8f6-a054cf71ef2a
2
public void set(String dna) { char bases[] = dna.toCharArray(); for (int i = 0; i < bases.length; i++) { // Fake count for (int j = 0; j < BASES.length; j++) countMatrix[j][i] = 1; countMatrix[base2int(bases[i])][i] = SCALE; } }
250042db-26c8-499f-bdd0-0e490343dfd3
5
final void method1569(int i, ByteBuffer class348_sub49) { try { if (i != 768) method1565(true, -71); for (;;) { int i_93_ = class348_sub49.getUByte(); if ((i_93_ ^ 0xffffffff) == -1) break; method1566(4, i_93_, class348_sub49); } anInt2800++; } catch (RuntimeException runtimeexceptio...
3c6bbc88-bfc6-42e3-bba2-44e44b5d2a58
1
public Catch[] exceptionHandlers() { if (code != null) { return code.exceptionHandlers(); } return new Catch[0]; }
2933c1c4-2480-43fb-8fb9-e90004eff39d
9
private Object binarySearchKids(int firstIndex, int lastIndex, String name) { if (firstIndex > lastIndex) return NOT_FOUND; int pivot = firstIndex + ((lastIndex - firstIndex) / 2); Object ret = getNode(pivot).search(name); //System.out.print("binarySearchKids [ " + firstIndex + ", "...
1d83c89b-ac5b-4866-b403-c5baac813e3b
3
@Override public String toString() { String retour = ""; int[][] tab = new int[nbLine][nbCol]; try { tab = readMap(); } catch(IOException e) { e.printStackTrace(); } for(int i1 = 0; i1 < nbLine; i1++) { for...
7f1b0c50-c5e8-4f9b-87c5-43a0a8369dba
2
public boolean contains(String key) { for(Item i : items){ if(key.equals(i.getName())){ return true; } } return false; }
6375dee8-a029-4fa9-a367-290fcb105df8
8
public void run() { //The K contacts nearest to the lookup key are added to the shortList Collection<Contact> nearestContacts = node.getRouteTable().select(key, K); shortList.addAll(nearestContacts); if (shortList.isEmpty()) { set(new TreeSet<Contact>()); return; } //References to the node clos...
afdd2d48-41f3-4f53-993f-4ae2e05ff1f1
4
public double addRoot(Complex root) { ListIterator<Complex> i = (ListIterator<Complex>) roots.iterator(); double colorFactor = 10 / rootBoundry; while (i.hasNext()) { int index = i.nextIndex(); Complex c = (Complex) i.next(); if (distance(root, c) < rootBoundry) { double retVal = index + colorFactor ...
a97ef637-be4c-4e32-94e7-450031177a25
8
public String decodedDateTimeToIso8601String() { { DecodedDateTime date = this; { StringBuffer buffer = Stella.makeRawMutableString(25); int index = 0; if (date.dateTimeYear != Stella.NULL_INTEGER) { index = Stella.insertString(Native.integerToString(((long)(date.dateTimeYear))), 0...
46fb4abc-6c70-411b-84e0-30f8653c3271
1
float getBandFactor(float eq) { if (eq==BAND_NOT_PRESENT) return 0.0f; float f = (float)Math.pow(2.0, eq); return f; }
7c49b423-ad2a-40d3-afc0-c3e3c7d846a0
4
@Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { int playerCabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId()); int sealAvariceOwner = SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_AVARICE); int compWinner = SevenSigns.getInstance().getCabalHighestScore(); if ...
266381af-4f0f-46bb-907a-4e6aa37e0e2f
4
static Object rsToObject(ResultSet rs, Class model) { Object object = null; try { if (rs.next()) { Object obj = model.newInstance(); Field[] fields = getFields(model); for (int i = 0; i < rs.getMetaData().getColumnCount() && i < fields.length; ...
eafdcef2-7800-4322-9294-5e6d1568fcbd
2
boolean isMatched(String _host){ if(!hashed){ return super.isMatched(_host); } MAC macsha1=getHMACSHA1(); try{ synchronized(macsha1){ macsha1.init(salt); byte[] foo=Util.str2byte(_host); macsha1.update(foo, 0, foo.length); byte[] bar=new by...
d535810e-fe9e-4ace-965d-0ba6fce0f481
6
private ModelAppResponse routeREST(HTTPRequest request, ModelUser user, BufferedReader is) { HTTPMethod method = request.getMethod(); String path = request.getRequestedPath(); String body = null; if (method == HTTPMethod.POST || method == HTTPMethod.PUT) { try { body = HelperUtils.readRequestBody(is, req...
2163be4d-4b9f-4c95-beac-bd4ebe18983a
2
private int print(int[] l) { int max = 0; for (int tmp : l) { System.out.print(tmp + " "); if (max < tmp) max = tmp; } System.out.println(); return max; }
91eba657-2422-45b7-8bcb-7f50be9691b0
5
@Override boolean isGoal() { if((board.length != GOAL.length) || (board[0].length != GOAL[0].length)) return false; for(int i = 0; i < board.length; i++){ for(int j = 0; j < board[0].length; j++){ if(board[i][j] != GOAL[i][j]) return false; } } return true; }
26d76dab-2e39-4547-bb68-80fd2e59c68e
8
public synchronized boolean equals(Object obj) { if (!(obj instanceof ArrayOfMessage)) return false; ArrayOfMessage other = (ArrayOfMessage) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); ...
a675498a-7ecd-4dcd-bb15-b1872c02b5ab
9
public boolean equals(final Object a, final Object b) { if ((a == null) || (b == null)) { return a == b; } if (a.getClass().isArray()) { if (!b.getClass().isArray()) { return false; } if (a.getClass().getComponentType() != b.getClas...
7b3aeeb5-3d5a-4188-809b-206b38af1efd
0
public String getName() { return name; }
2e15cb42-7832-4057-8b7d-da878f7420d2
8
public void send(final ThinClient client) throws IOException { // System.out.println("\n=====Sending Message..."); int maxSize = client.getMTU() - 10 - 42; byte[] buffer = new byte[maxSize]; int type = 1; int bufferLength = 16; int nextPacketStartAt = 0; int size = this.operations.size(); for (int i = ...
70fd283a-ae9d-4b1e-8a75-ad640b81a379
6
public RoomManager(Server Env) throws Exception { Environment = Env; DatabaseClient DB = new DatabaseClient(Environment.DataBase); ResultSet table = DB.Query("SELECT * FROM room_models;"); while (table.next()) { RoomModel Model = new RoomModel(); Mod...
6e223f93-53be-496c-8f63-e64ba496ff33
0
public int getId() { return id; }
6fe20fdf-1cb5-455c-83a9-1e45e18d814c
8
private static String fetch(String artistName, String songName) { byte[] utf8Bytes = null; // This array of bytes will store UTF_8 encoded values of each character, for each line // we print (html page has utf-8 charset) String lyricsText = ""; // String to return try { URL lyricsPage = new URL(co...
6035d618-ab24-4df8-bcd4-9363eaf765b4
1
public String printWinOrLose() { String result; if (!containsUnderscores()) { result = "YOU WIN!!"; } else { result = "You're a loser...the word was: " + word; } return result; }
753ffa4f-3cc7-42e4-bcab-20d0d1cb16c0
6
FormAttachment setAttachment (String attachment) { String control, align; int position, offset; int comma = attachment.indexOf (','); char first = attachment.charAt (0); if (Character.isLetter(first)) { /* Case where there is a control */ control = attachment.substring (0, comma); int i = 0; while...
b3b624fc-b81d-4e92-9e93-12289835fa64
8
public Point getNextStep(Point p, Cardinal direction){ switch(direction){ case WEST: if(p.x == Game.gameGrid.getPXX()) return new Point(Game.gameGrid.getTileWidth() - 1, p.y); else return new Point(p.x - 1, p.y); case NORTH: if(p.y == Game.gameGrid.getPXY()) return new Point(p.x, Game.gameGri...
6402ca75-b661-4ec3-8ac9-5ee068bd2500
3
public void init() { if (inited) { return; } inited = true; int numCSComps = colorSpace.getNumComponents(); int b1[] = new int[numCSComps]; float f1[] = new float[numCSComps]; cols = new Color[hival + 1]; for (int j = 0; j <= hival; j++) { ...
49fc93ae-f967-4a67-bc44-08524507325f
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessa...
aba54d5d-d701-4cc4-9a29-9107eadd342d
3
private void leftDown(float delta){ if(selectedNode == null){ for(Node node : this.getNodes()){ double radiusSquared = node.size * node.size, dx = mouseX - node.position.x, dy = mouseY - node.position.y, distSquared; distSquared = dx * dx + dy * dy; if(distSquared <= radiusSquared){ se...
c52da11f-d9f1-4452-8a70-0ae85d1d2d1b
4
public boolean FullDharokEquipped() { if(playerEquipment[playerHat] == 4716 &&playerEquipment[playerChest] == 4720 && playerEquipment[playerLegs] == 4722 && playerEquipment[playerWeapon] == 4718) { return true; } return false; }
1280f016-a15d-491e-9de1-8954c363e0f5
0
public Adapter(Adaptee adaptee) { // 组合的方式 this.adaptee = adaptee; }
d141a002-0171-4638-9c89-496c6fa8ba02
1
public Double getValorTasas() { if (valorTasas==null) { return 0.00; } return valorTasas; }
d65973e5-ff60-4e3b-ba05-a0c3c72e303a
9
public static void openURL(String url) { try { //attempt to use Desktop library from JDK 1.6+ (even if on 1.5) Class<?> d = Class.forName("java.awt.Desktop"); d.getDeclaredMethod("browse", new Class[] {java.net.URI.class}).invoke( d.getDeclaredMethod("getDesktop").invoke(null), ...
8e3f37b5-a0c9-4138-aa13-f62572a3f9ed
3
public static int toInt(Type type) { switch ( type ) { case simple: return 0; case conjugation: return 1; case number: return 2; } return -1; }
abacd7b2-bbf9-46e9-9464-2c216a16ebb9
2
private void updateCountry() { CountryBO countryBO = ServiceLocator.getBean(CountryBO.class); BufferedImage imBuff = null; InputStream is = InsertImageTest.class.getResourceAsStream("/flags/croatia.png"); try { imBuff = ImageIO.read(is); } catch (IOException e) { e.printStackTrace(...
114c7368-9adf-4e28-ad7b-26c783c8c661
7
private void determineType() { int x = nextChar; // data preservation // is it a symbol? if(x==40|x ==41|x==123|x==125|x==91|x==93|x==43|x==45|x==42|x==47|x==62|x==60|x==61|x==44|x==59|x==58|x==33){ nextState = 2; // see state diagram for reference } // is it a letter? [a,z] + [A,Z] + _ + [0,9] aft...
ba9852bb-ae34-461d-827a-6bea70add7c4
2
@Override public void desconexion() throws Exception { try { if (oConexionMySQL != null) { oConexionMySQL.close(); } } catch (SQLException e) { throw new Exception("MySQL.CerrarConexion: Error al cerrar la conexion" + e.getMessage()); } ...
a82b06bb-a080-4c83-bd7e-ecef69fc8693
0
public void update(int x, int y) { this.x = x; this.y = y; }
8babc261-8d92-4616-8324-2d2c80e78952
2
public Socket socket(String nsp) { Socket socket = this.nsps.get(nsp); if (socket == null) { socket = new Socket(this, nsp); Socket _socket = this.nsps.putIfAbsent(nsp, socket); if (_socket != null) { socket = _socket; } else { ...
cc13a8bf-266f-4f25-b9e6-6a3f9a5c9f0f
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int n = to.length(); char[] circle = new char[n]; /* * First fill the circle buffer with as many characters as are in the * to string. If we...
81993451-930a-4c09-b7b2-19151956d705
3
public int getDegreeInChain(Object vertex) { int count = 0; for (int i=0; i<vertices.size(); i++) if (graph.hasEdge(vertex, vertices.get(i)) && !vertices.get(i).equals(vertex)) count++; return count; }
3a460755-d8c4-49ee-b4b5-59d9c23ec400
0
@Override public void add(Employee employee) { }
3e6d38cc-acb8-4373-af04-49882c865cf0
3
public TreeNode firstCommonAncestor(TreeNode node1, TreeNode node2){ if(node1==null || node2==null){ return null; } if(node1==node2){ return node1; } return null; }
26c2702f-c0ee-4b33-898b-f5706d6d8342
1
public Color getColor(Point p) { int radius = Math.min(getWidth() / 2, getHeight() / 2) - 20; double r = euclid(mousePosn, new Point(getWidth() / 2, getHeight() / 2)); double deg = Math.atan2(getHeight() / 2 - mousePosn.y, getWidth() / 2 - mousePosn.x) * 180 / Math.PI + 180; try { ...
b7e92d1e-5012-4e69-9bc9-31163fc45562
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } BoxState other = (BoxState) obj; if (goal == null...
260e4a24-0ec1-4db5-8316-9853910776cf
3
private boolean isForbidden(String s) { for (int x = 0; x < FORBIDDEN_STRINGS.length; x++) { if (s.equals(FORBIDDEN_STRINGS[x])) { return true; } } if(forbiddenStrings.contains(s)) { return true; } return false; }
7241acb7-86ba-4fd3-98a6-3e9135ecfbd5
9
@Override public void run() { Socket socket = null; try { socket = anonymounsServer.accept(); BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter pw = new PrintWriter(socket.getOutputStream(),true); String msg = null; while(true){ if((msg=...
d056ada6-c720-49c5-b5ae-c9418516b83d
9
public final synchronized Point2D getCurrentPoint() { int index = numCoords; if (numTypes < 1 || index < 1) { return null; } if (pointTypes[numTypes - 1] == SEG_CLOSE) { loop: for (int i = numTypes - 2; i > 0; i--) { switch (pointTypes[i]) ...
2e8614ea-2fca-493f-a8e1-7d919d7a0f1c
2
public static final boolean isPHP(String fileName) { for (String file : PHP) { if (file.equals(fileName)) { return true; } } return false; }
8f75b361-a7b4-484a-9213-93beaac0d183
5
public static void main(String args[]) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int stringNumber = Integer.parseInt(reader.readLine()); int[] counts; int maxIndex; for (int i=0; i < stringNumber; i++) { counts = new int [26]; maxIndex = 0; f...
03cb4de2-08fd-40d7-8691-3690f4676236
8
public Item getMyPair() { final List<String> p=getParsedText(); Room R=null; if(p.size()>=2) R=CMLib.map().getRoom(p.get(1)); if(R==null) return null; Item I=null; for(int i=0;i<R.numItems();i++) { I=R.getItem(i); if(isMyPair(p,I)) return I; } MOB M=null; for(int m=0;m<R.numInhabita...
ac2ca7f2-2232-4eec-80d3-19f99d03d367
2
@Override public boolean removeCitation(Integer id) { for (Citation c : citations) { if (id.equals(c.getId())) { citations.remove(c); return true; } } return false; }
fb0f7440-90f2-4e8a-86d1-b39a93cbf818
7
private void generateArff(List<sei.buaa.program.analyzer.TestCase> tcs) { StringBuilder builder = new StringBuilder(); builder.append("@relation "+program+versionID+"\n"); int attrCnt = af.getAttributeCount(); if (pruneAttributes == false)attrCnt = totalExecutableCodeCnt; // System.out.println("attribute si...
697cc155-99ba-46e7-9077-edee540999e1
8
public Double getNormalizedLoggedDataPoint(String sample, String taxa) throws Exception { int x = -1; for (int i = 0; x == -1 && i < getSampleNames().size(); i++) if (sample.equals(getSampleNames().get(i))) x = i; int y = -1; for (int i = 0; y == -1 && i < getOtuNames().size(); i++) if (taxa.equ...
86dec8d3-4575-4b51-a823-ac42b7eec68b
1
public void addOutlink(Node n){ //Ignore bias weights as outputs if (!n.is_bias){ links_out.add(n); double weight = ran.nextDouble()/ADJUST - 1/ADJUST/2; weights.add(weight); } }
e47054b7-7008-4d3d-8ad7-992c2d5e010d
5
public void buttonP(int i) { if(i == 1) { if(BLeft.contains(Main.mse)&&Page>1) { Page--; } else if(BRight.contains(Main.mse)&&Page<Pages) { Page++; } } }
9b808d42-6f32-4c06-9b27-af54b6c61fb9
1
public synchronized void stop() { running = false; try { mainThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } }
3419704a-06b5-4cbe-8dc5-2ac0c3168f3c
0
public void setASymmetricAlgo(AlgoCryptType algo) { this.asymmAlgo = algo; }
24000529-937c-43ce-a36c-0dd1c69bdcb3
5
public void updateQuantity(int cartItemId, int newQuantity) { try { //checks quantity and throws exception if quantity is <= 0 if(newQuantity <=0){ IlegalQuantityException ex = new IlegalQuantityException(); ex.setMessage("invalid quanitity amount entered, 0 or less"); throw ex;...
336d1af3-cf15-4bbe-9848-d5cf54c52a04
5
public void waitForImage(java.awt.Image image, String info) { //System.out.println ("enter waitforimage" +manager.displayContainer); if (image == null) throw new RuntimeException("Image " + info + " is null"); //System.out.println("wait for img: " + info); if (manager.track...
fea238fc-30d7-4b40-bb3a-d3ee677a17bd
1
@Test public void transferInstrMOVE_testInvalidSourceRegisterRef() { //Checks MOVE instruction not created with invalid register ref. try { instr = new TransferInstr(Opcode.MOVE, 50, 3); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); }
6d2f4e7e-aa25-4c51-b10d-c3f8a20ca8af
1
public void deplacementGauche() { if (!pause) { plateau.updatePosition(-1, 0); updateObservers(); } }
2f147c0e-359e-457b-9dc0-a81a0a538ae6
0
public BufferedWriter getWriter(){ return Writer; }
6f831351-2496-479a-b1fd-6b8a14c895e1
7
private void processPatBlt(RdpPacket_Localised data, PatBltOrder patblt, int present, boolean delta) { if ((present & 0x01) != 0) patblt.setX(setCoordinate(data, patblt.getX(), delta)); if ((present & 0x02) != 0) patblt.setY(setCoordinate(data, patblt.getY(), delta));...
f2086a76-269d-4c16-8c06-b14957c31601
1
public boolean isSuperOrThis() { ClassInfo clazz = getClassInfo(); if (clazz != null) { return clazz.superClassOf(methodAnalyzer.getClazz()); } return false; }
d10ff6da-a447-452f-832b-16acec9e705b
8
private void setupWindow() { JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.setBackground(new Color(108,75,31)); mainPanel.setMaximumSize(new Dimension(250, 120)); mainPanel.setMinimumSize(new Dimension(250, 120)); //spacing JPanel upperPanel = new JPanel();...
dee6c638-32a8-4382-9309-190a0caea3c4
4
@Override public void update(Observable obs, Object arg) { if(carros.contains(obs)) { try { int[] received= (int[]) arg; int state= received[0]; int codCar= received[1]; Carro c=(Carro)obs; if(state==Carro.MOVING){ txtCars[0][codCar-1].setText(String.valueOf(c.getPosX())); txtCa...
8cd4dfa9-27c7-4b04-a1eb-0cbccce54be4
4
public int getBlockTypeOverrideIdFromPixel(int imagePixel) { int blockTypeId = -1; String[] line = (String[])groupOverrides.get((level+1)+""+imagePixel); if(line != null) { int newBlockType = blockManager.getRandomIdByGroup(line[0]); if(newBlockType > 0) { ...
d1c3c660-edb2-4a8b-afa9-b1255f1d3bc9
3
public static void checkAccount(String accountName, String accountPassword) { String uuid = UUID.randomUUID().toString(); AuthManager am = new AuthManager(); SessionResponse response = am.authenticate(accountName, accountPassword, uuid); System.out.print("Checking Account: " + accountNam...
2ee5d911-4562-4b39-a07c-c2bedb3dfca7
3
@Override protected final void finalize() { synchronized (instances) { for (final WeakReference<Variable> wRef : instances) { if ((wRef != null) && (wRef.get() == this)) { instances.remove(wRef); return; } } } }
793acbdd-6e03-43b2-ad5f-58521a2ffb6c
2
public static boolean TRNExist(String trn){ SQLiteJDBC db = new SQLiteJDBC(); String sql = String.format("SELECT user_id FROM customers WHERE trn='%s'", trn); ResultSet resultSet = db.query(sql); try { if(resultSet.next()){ db.close(); ...
af05b00c-89ba-427c-a4e1-c77c0190918e
7
@Override public SortedSet<T> subSet(T fromElement, T toElement) { int size = this.size(); ArrayList subset = new ArrayList(size); boolean capture = false; boolean finished = false; if (this.contains(fromElement) && this.contains(toElement)) { while (!finished) { ...
2c87e92d-9c6b-4bb0-82f1-dc2b6c0b2916
3
public double getX(UIBounds bounds) { switch(this) { case LEFT: return 0; case CENTER: return -bounds.getWidth() * 0.5; case RIGHT: return -bounds.getWidth(); default: return 0; } }
d8177d66-db7d-488d-9c06-c127b39b34b3
7
private void findSubroutineSuccessors( final int id, final Label[] JSRs, final int nJSRs){ // iterates over all the basic blocks... Label l = labels; while(l != null) { // for those that belong to subroutine 'id'... if((l.status & id) != 0) { if((l.status & Label.JSR) != 0) { // finds the s...
cfb783c8-573c-4031-99d3-a4b1010fb541
3
public void populate_with_freebase() throws GeneralSecurityException, IOException{ try{ Connection connection = DriverManager.getConnection(connectionString); Statement s = connection.createStatement(); s.executeUpdate("CREATE TABLE ingredient(id integer primary key, name text)"); s.executeUpdate("CREATE ...
04939fc7-c3f7-4c53-8aa1-6feb947d9816
6
@Override public void removeUpdate(DocumentEvent event) { if(event.getDocument() == nameTb.getDocument() || event.getDocument() == messageTbLeft.getDocument()){ previewLeft.update(messageTbLeft.getText(), "%JOINEDPLAYER%", nameTb.getText()); if(nameTb.getText().equalsIgnoreCase("join-format-string") || nam...
56dae105-50d0-42a7-8911-e1e2211f09b5
6
private static final boolean isDmgSponge(final int mid) { switch (mid) { case 8810018: case 8820010: case 8820011: case 8820012: case 8820013: case 8820014: return true; } return false; }
c18226fb-4b98-4197-833d-f1b204f07c07
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Estado other = (Estado) obj; if (this.idEstado != other.idEstado && (this.idEstado == null || !this.idEst...
391dc416-4787-46d1-9d76-10c0298f8567
5
private PluginStub createStub(File stubFile) { PluginStub stub = new PluginStub(); Properties stubProps = new Properties(); try { stubProps.loadFromXML(new FileInputStream(stubFile)); } catch(Exception e) { e.printStackTrace(); return null; } stub.setName(stubProps.getProperty("name")); stub.setA...
de0a8173-be0b-455a-80bc-d4fb771dee13
6
public List<ABObject> findObjects() { int xMin = 0; if (_sling != null) xMin = _sling.x + 100; List<ABObject> blocks = new LinkedList<ABObject>(); for (ConnectedComponent c : _components) { if ((c.getType() > ImageSegmenter.PIG && c.getTyp...
d4fc9549-80ad-4d2f-aeee-f90677d1f4a0
6
public ArrayList<int[]> getIncidenceMatrix() { ArrayList<int[]> incidenceMatrix = new ArrayList<int[]>(); for (Place place : getPn().getListOfPlaces()) { int[] incidenceRow = new int[getPn().getListOfTransitions().size()]; for (Arc a : place.getListOfOutArcs()) { ...
63088b17-a514-4dfa-91f6-67bcea40a841
8
public void saveFile(BoardFileBean file) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; String sql = "insert into boardfile values(boardfile_fileid_seq.nextval,?,?,?)"; try { conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setStrin...
8052eef1-2242-43b4-88ff-eba3612d9c1d
5
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == movimientos.getIzq().getCode() || e.getKeyCode() == movimientos.getDer().getCode()) xv = 0; else if (e.getKeyCode() == movimientos.getArr().getCode() || e.getKeyCode() == movimientos.getAba().getCode(...