method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e8c4373b-d178-42f8-9203-24628a3828f1
7
public ArrayList getSolutionsRunningOnSpecificDevice(int tmpClassID, String tmpDeviceName) { if(printDebugInfo) { System.out.println("\ngetSolutionsRunningOnSpecificDevice --- START"); System.out.println("\t" + getClassNameByID(tmpClassID) + "(s) running on " + tmpDeviceName ...
ce67b06a-6898-47e1-98fd-03540bb063ea
8
private boolean makeServiceNameUnique(ServiceInfoImpl info) { final String originalQualifiedName = info.getQualifiedName(); final long now = System.currentTimeMillis(); boolean collision; do { collision = false; // Check for collision in cache ...
8a54b909-9c95-4c71-975b-bec4f7118de0
9
@Override public void copySources( HashMap<String, Source> srcMap ) { if( srcMap == null ) return; Set<String> keys = srcMap.keySet(); Iterator<String> iter = keys.iterator(); String sourcename; Source source; // Make sure the buffer m...
cb20944c-bca6-4d43-b84f-b179770b0ba5
5
public boolean IniciarServidor() { MensajeServidor("Servidor Iniciado"); try { // Se abre el host en el puerto esperando que un cliente llegue ServerSocket s = new ServerSocket(puerto); MensajeServidor("Esperando Conexion......"); String url = "http://localhost:"+puerto; ...
8c73bedf-0aaf-4bc2-bc14-56e7eec1c94a
3
public Product grabAProduct(){ Document doc = null; try { doc = Jsoup.connect("http://www.mathem.se/sok?q=socker&qtype=p").get(); } catch (IOException ex) { Logger.getLogger(ProductRetriever.class.getName()).log(Level.SEVERE, null, ex); } System.out.printl...
47188a7a-3b00-4f52-9ee0-6cbcfe5a35ee
8
private boolean displayModesMatch(DisplayMode m1, DisplayMode m2) { if(m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight()) {return false;} if(m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m1.getBitDepth() != m2.getBitDepth()) {r...
7590456e-c398-493f-b4cc-62cee0aa1214
1
public void clear_buffer() { for (int i = 0; i < channels; ++i) bufferp[i] = (short)i; }
454f2582-87c6-41f3-bd91-a14cc9bf2d5d
9
private int returnStep (int vertex) { int maxVertex = 0; int i, j; for (Vertex incidentVertex : numberToVertex.get(vertex).getIncidentVertices()) { j = vertexToNumber.get(incidentVertex); if (j < vertex) { maxVertex = j; } } j =...
c1b5b280-f41d-46d9-bf6f-543385bc04b4
9
public static StandardObject walkFirstArgumentToFunction(MethodSlot fnslot, Cons tree) { { List ptypespecs = fnslot.methodParameterTypeSpecifiers(); StandardObject targetts = ((StandardObject)(ptypespecs.first())); if (!fnslot.methodEvaluateArgumentsP()) { tree.rest = MethodSlot.quoteArguments(...
78522aa8-92c9-4013-8ede-9469c9673892
7
public void body() { // Gets the PE's rating for each Machine in the list. // Assumed one Machine has same PE rating. MachineList list = super.resource_.getMachineList(); int size = list.size(); machineRating_ = new int[size]; for (int i = 0; i < size; i++) { ...
05cd0f2a-9a0f-412a-a8c7-262c2f02428b
7
private void ScheduleSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ScheduleSessionActionPerformed // TODO add your handling code here: if(memID != null){ int day, month, year; Boolean facial, haircut, massage,pedicure; try{ ...
f46b4c34-c0d0-40ef-b3a2-16d723186e9e
8
private ArrayList<Coordinate> getAvailableMoves() { boolean test = false; if (test || m_test) { System.out.println("OthelloAI :: getAvailableMoves() BEGIN"); } ArrayList<Coordinate> list = new ArrayList<Coordinate>(); if (getYourTurn()) { for (int y = 0; y < GAME_HEIGHT; y++) { fo...
354be96f-bb89-487c-b741-e66f83036813
1
public boolean agregar(String tabla, String campos, String[] valores) { String query = "INSERT INTO " + tabla; String[] camp = campos.split(","); int max = camp.length; query += campos(max, camp); query += valores(max); //System.out.println(query); if (prepararEs...
22ea93a2-8823-40ff-a7b4-be1acbfe0fa0
3
public static StompFrame factory(String wholeMessage){ HashMap<String, String> headers=parseHeaders(wholeMessage); if (headers == null) return ErrorFrame.factory(wholeMessage, "cannot read headers"); if (headers.get("destination") == null) return ErrorFrame.factory(wholeMessage, "invalid subscribe: no desti...
654cffb9-c16a-428f-a7c9-272fe8e05e11
3
@Override public Iterable<K> keySet() { ArrayList<K> keys = new ArrayList<>();// return container for (int i = 0; i < capacity; i++) { if ((bucket[i] != null) && (bucket[i] != available)) keys.add(bucket[i].getKey()); } return keys; }
b3f0b304-c883-4a26-8caf-cfcd9df29910
7
public boolean equivalentWasEndedBys (WasEndedBy description1, WasEndedBy description2) { return bothNull (description1, description2) || (neitherNull (description1, description2) && equivalentIdentifiers (description1, description2) && equivalentAttributes (...
64b3fa5e-c087-4481-b738-d4bf832338db
2
public void remove(Item item) { if (item == null) throw new IllegalArgumentException("Item can't be null!"); if (!items.contains(item)) throw new IllegalArgumentException("The item is not in the inventory!"); items.remove(item); }
b0186793-013c-4ec4-98c8-0a919dbc3e29
8
public static String cleanPath(String path) { if (path == null) { return null; } String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR, FOLDER_SEPARATOR); // Strip prefix from path to analyze, to not treat it as part of the // first path element. This is necessary to correctl...
401ea232-09f7-4331-8d24-55a30ee9f56f
1
public void insert(Key v) { if (N == pq.length - 1) resize(pq.length * 2); pq[++N] = v; swim(N); }
4b1c7b7c-2a6b-4709-8bbb-72d4b4f258e7
9
public static String stripNonDoubleChars(final String value) { final StringBuilder newString = new StringBuilder(); for (int i = 0; i < value.length(); i++) { final char c = value.charAt(i); if (c >= '0' && c <= '9' || c == '-' || c == '.') { newString.append(c);...
5a7bba8e-34a9-4f84-aedd-17a2e9497dd9
3
public static Tuple[] fromResultSet(ResultSet in) throws SQLException { List<Tuple> res = new ArrayList<Tuple>(); int colCount = in.getMetaData().getColumnCount(); boolean empty = !in.next(); while (!in.isAfterLast() && !empty) { Object[] objects = new Object[colCount]; for (int i = 0; i < colCount; i++) ...
3d6de596-1814-40c8-9eea-c764057fc177
4
private boolean isDataEnd() { String flag = buffer.substring( buffer.lastIndexOf( "\n" ) + 1, buffer.length() ); int indexLeft = flag.lastIndexOf( "[" ); int indexRight = flag.lastIndexOf( "@" ); if ( indexLeft == -1 || indexRight == -1 || indexLeft > indexRight ) { return false; } if ( ...
78cb651f-19bf-40db-9ad4-7e04dad2dbbc
3
private void loadUserSettings(){ if(!this.fUserData.exists()){ File fDir = new File(sDir); if(!fDir.exists()){ fDir.mkdir(); } try { this.fUserData.createNewFile(); saveUserSettings(); } catch (Exception e) { e.printStackTrace(); } } // Initialise or load the User Settings thi...
686184fe-49a8-4825-83e3-b0a28844605e
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...
7aa2d5c9-9223-4786-94db-e6b98f96b646
1
public static Enumeration getClassesAndPackages(final String packageName) { final Enumeration enum_ = classpath.listFiles(packageName.replace('.', '/')); return new Enumeration() { public boolean hasMoreElements() { return enum_.hasMoreElements(); } public Object nextElement() { String name = ...
18097f33-598f-4388-939e-7c7c113cc09c
6
@Test /* No output should be printed about unhandled tokens */ public void testLoadString() { File dir = new File(graphics.core.Model.MODEL_PATH); // Loop through all models in models directory for(String file: dir.list()) { if (file.toLowerCase().endsWith(graphics.c...
dafc0be8-b1ca-42c6-965d-b4f34ee361da
1
public static void main(String[] args){ DataStoreImpl dataStoreImpl = new DataStoreImpl(); if(dataStoreImpl.loginUser("randomUser", "password")){ System.out.println("success"); } else { System.out.println("fail"); } }
dc9f9a6a-d605-4393-bf8c-99d6f11ca66a
4
public T get(final int index) { final int i0 = index >>> 24; final T[][] map1; if (i0 != 0) { if (map == null) return null; // NOT_FOUND; map1 = map[i0]; if (map1 == null) return null; // NOT_FOUND; } else { map1 = map10; } final T[] map2 = map1[(index >>> 12) & 0xfff]; if (map2 == ...
884d8383-3bfb-4aef-b93d-1486e37e03eb
3
public int atrLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) ) return -1; return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Atr.ordinal()]) ; ...
1bceac26-7a84-48b8-a41d-f4dd7dd8d930
0
public EventBranch findEventBranchById(final Long id) { return new EventBranch(); }
da947ef9-9100-4323-8892-69c14c2b9ce3
7
public static ArrayList<DebtAccount> readDebtAccounts(String filename) { File file = new File(filename); if (file.exists()) { ObjectInputStream ois = null; try { // // Read the previously stored SecretKey. /...
fa506ece-8e64-4e8c-b46c-cc4dc635c63b
5
public MainFrame() { lf = null; sponsorlopen = new ArrayList<Sponsorloop>(); setSize(200, 200); lab1 = new JLabel("Sponsorlopen", JLabel.CENTER); lab2 = new JLabel(); listModel = new DefaultListModel(); list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); deselec...
e60e3c31-02d1-45be-b070-01ac82381024
5
@Override public List<Usuario> Buscar(Usuario obj) { String sql = "select a from Usuario a"; String filtros = ""; if(obj != null){ if(obj.getId() != null){ filtros += "a.id = " + obj.getId(); } if(obj.getNome() != null){ ...
5e6eeeba-92ab-4434-b47f-2f7bc13d8f85
3
public String addMoreInfo() throws Exception { Connection conn = null; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(url, user, psw); if (!conn.isClosed()) System.out.println("Success connecting to the Database!"); else System.out.print...
541f1f81-549d-4dd8-98e0-2aeb8392f0e3
2
public Teaches add(Teacher t, ClassGroup c) { Teaches newTeach = new Teaches(c, t); if (!this.teachingList.contains(newTeach)) { this.teachingList.add(newTeach); // If a object matching the new instance has been recently deleeted, remove that record. if (this.deletedTeaching.contains(newTeach)) this.de...
be14a2d2-fdac-4db5-88dd-38becae2bf2a
8
public void actionPerformed(ActionEvent e) { if ("btnOpen".equals(e.getActionCommand())) { if (chart != null) chart.closeChart(); frame.setVisible(false); getList(); // chart = new ValueChart(vc_files); if (btnVC.isSelected()) { ...
042f4d53-e4d1-4023-a9df-6941ac501ed1
1
public void setSource(int x, int y, double value) { if (_maxValue < value) { _maxValue = value; } _source[y][x] = value; }
e4364099-61e0-433c-afda-14bc82ac571d
5
private long waitForBackupSizeToBecomeStable(Date timeoutDate, String backupName) throws ReadTimeoutException { com.unispezi.cpanelremotebackup.tools.Console.print("Polling for backup file size to become stable"); long lastFileSize = 0; long currentFileSize = 0; Date now = new Date(); ...
9f040ec9-8a46-499e-ae1f-9a1e95901cbb
9
@Override public void actionPerformed(ActionEvent arg0) { if(item.getLabel().equals("Square")) { b.mousetype = "square"; b.last_mouse_type.add("square"); } else if(item.getLabel().equals("Circle")) { b.mousetype = "circle"; b.last_mouse_type.add("circle"); } else if(item.getLabel().e...
fad152ff-9e5b-4422-86ab-5b152c26c8b8
0
public static IntArrayBag union(IntArrayBag b1, IntArrayBag b2) { IntArrayBag answer = new IntArrayBag(b1.getCapacity() + b2.getCapacity()); System.arraycopy(b1.data, 0, answer.data, 0, b1.manyItems); System.arraycopy(b2.data, 0, answer.data, b1.manyItems, b2.manyItems); answer.manyItems = b1.manyItems...
a869afb7-586c-4b93-b328-f8dcf952a3da
8
public FileStream(RandomAccessFile source) throws OggFormatException, IOException { this.source=source; ArrayList po=new ArrayList(); int pageNumber=0; try { while(true) { po.add(new Long(this.source.getFilePointer())); // skip data if pageNumber>0 ...
9fc18544-6983-478c-ab66-a8c87a7d9d7b
3
@Override public boolean activate() { return (Bank.isOpen() && !Widgets.get(13, 0).isOnScreen() && !Settings.usingFlask && !Settings.usingHerb ); }
61e67846-af86-4d70-b297-aec72c7157b2
7
public void setPictureMimeType(String pictureMimeType) { if (pictureMimeType != null && !pictureMimeType.equals("") && !pictureMimeType.equals("image/") && !pictureMimeType.equals("image/jpg") && !pictureMimeType.equals("image/png")) throw new IllegalArgumentException("The picture mime type field in t...
acb962ec-3aab-49d1-bb4d-fc4321711420
3
private ModDatabase() { try { Properties p = new Properties(); InputStream in = getClass().getResourceAsStream(".password"); p.load(in); in.close(); host = p.getProperty("host"); database = p.getProperty("database"); user = p.getProperty("user"); password = p.getProperty("password"); if (...
89d327f3-1131-4163-91b7-dbac8ecad0f7
5
public LinkedList<CarteTroupe> initialisationPaquetTroupe(){ LinkedList<CarteTroupe> llct = new LinkedList<CarteTroupe>(); int i=1; for(Troupes t : hashTroupes){ CarteTroupe ct = new CarteTroupe(t); // On met 6 fois la même carte dans la liste for(int...
1a3b5fa8-514d-4249-8aba-91b34bfba0d5
9
private void postPlugin(final boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc final PluginDescriptionFile description = plugin.getDescription(); // Construct the post data final StringBuilder data =...
4beeb1e8-cd75-49bd-80ce-0d9a818d3aa3
3
private static String[] readTokens() throws IOException { Set<String> result = new TreeSet<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String t; while (true) { System.out.print("Enter token or blank line to end input: "); ...
8671f0ce-a560-4a8f-ac8f-828e8a21963d
2
public static void addEnder(List<LabeledToken> parsedContents) { int offset=0, length=0; if (parsedContents==null) { parsedContents=new ArrayList<LabeledToken>(); } if (parsedContents.size()>0) { LabeledToken lastToken=parsedContents.get(parsedContents.size()-1); offset=lastToken.getOffset(); le...
fbf2e514-531c-428f-94a7-40d249704e56
9
public boolean equals (Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Path other = (Path)obj; if (dir == null) { if (other.dir != null) return false; } else if (!dir.equals(other.dir)) return false; if (name == null) { ...
9a25d114-374c-46e1-87c6-5ff6e2f902d0
2
private static void displayApparentPlace(double t, ApparentPlace ap, int referenceSystem, PrintStream ps) { switch (referenceSystem) { case EQUATORIAL: displayApparentPlaceEquatorial(t, ap, ps); break; case ECLIPTIC: displayApparentPlaceEcliptic(t, ap, ps); break; } }
8a4fba5b-3b56-4fa5-b121-868047f5b7b7
1
@SuppressWarnings("unchecked") public Map<String, BEValue> getMap() throws InvalidBEncodingException { if (this.value instanceof HashMap) { return (Map<String, BEValue>)this.value; } else { throw new InvalidBEncodingException("Expected Map<String, BEValue> !"); } }
c0d410d6-b92d-4050-9ba5-3fd72467a81b
5
public int compareTo(Object object) { if (this instanceof CycConstant) { if (object instanceof CycConstant) return this.toString().compareTo(object.toString()); else if (object instanceof CycNart) return this.toString().compareTo(object.toString().substring(1)); else throw ...
e1da30ec-e006-4471-baf0-be50187ceda7
3
@Override public void deserialize(Buffer buf) { spellId = buf.readShort(); if (spellId < 0) throw new RuntimeException("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0"); cellId = buf.readShort(); if (cellId < -1 || c...
6e2c3a36-d72e-4799-bea3-14adbda61f4e
8
public List<Double> getDoubleList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Double>(0); } List<Double> result = new ArrayList<Double>(); for (Object object : list) { if (object instanceof Double) { ...
11e258e3-9dd4-4396-9c85-f9faeba235d3
5
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == btnChars[0]){ //System.out.println("Green Char"); _Model.setBallChoice(GameModel.ballGreen); } if(e.getSource() == btnChars[1]){ //System.out.println("Bl...
7f8523c8-445b-4dff-b65a-2e781de1b80a
2
public void editNextShip() { if(editingPos < shipSizes.length-1) { editingPos++; if(myTurnEditing) { editingShip = new Ship(shipSizes[editingPos], mySea.sea.length, mySea.sea[0].length, mySea.fleet); mySea.renderEditingShip = true; } else { editingShip = new Ship(shipSizes[editingPos]...
6ead171a-c18b-4717-afcc-bd9ba0fc868a
8
public static MapleShop createFromDB(int id, boolean isShopId) { MapleShop ret = null; int shopId; try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement(isShopId ? "SELECT * FROM shops WHERE shopid = ?" : "SELECT * FROM shops WHERE npcid = ?"); ps.set...
4775bbe3-23e8-4a51-9315-4a114f3fe78c
2
public Reader createReader() { return new Reader() { public Iterable<? extends Player> readPlayers(String key) throws KeyNotFoundException { try { // ToDo return DatabaseFactory.createDatabase(key); } catch (FileNotFoundExceptio...
d28d07a7-a939-4fb7-a898-a835504e4cb8
5
public void drawImageString(JGEngineInterface eng, String string, double x, double y, int align, String imgmap, int char_offset, int spacing,boolean pf_relative) { ImageMap map = (ImageMap) imagemaps.get(imgmap); if (map==null) throw new JGameError( "Font image map '"+imgmap+"' not found.",true ); if (align...
cd30c290-7337-4c06-aa9e-a0ead561a7ad
3
* * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public CycList converseList(Object command) throws UnknownHostException, IOExcepti...
3dbdfa32-2c31-4636-96d5-d80d86d93278
0
@Basic @Column(name = "SOL_ID_ELEMENTO") public Integer getSolIdElemento() { return solIdElemento; }
ab1203f1-febe-4219-9ec3-d7473320efea
7
@Override public void executeMsg(Environmental myHost, CMMsg affect) { super.executeMsg(myHost, affect); if((affect.target()!=null)&&(affect.target().equals(affected)) &&(affect.tool()!=null)&&(affect.tool().ID().equals("Scrapping"))) { final Item item=(Item)affect.target(); final MOB mob = affect.so...
c6c03724-992b-4e1e-bb46-3af8de15ae8a
8
public Color stringToColor(String color) { if(color.equals("white")) return Color.white; else if(color.equals("red")) return Color.red; else if(color.equals("blue")) return Color.blue; else if(color.equals("green")) return Color.green; else if(color.equals("gray")) return Color.gra...
ff36ed85-5ab1-4acf-a6e6-67b1521a267e
1
@Override public int compare(Rate a, Rate b) { if (a.get() > b.get()) { return 1; } else { return -1; } }
840027ed-d4f3-4ce6-8b26-d40239c40696
9
public void updateMissileTime(int time, String missileId, String type, String destination, int damage, int flyTime) { Iterator<String> keySetIterator = map.keySet().iterator(); Iterator<String> destuctorsSetIterator = destructors.keySet() .iterator(); if (type == "missile") { while (keySetIterator.hasNe...
380a559f-8e47-45af-ab10-48c667e712fd
0
public CategoryServlet() { super(); // TODO Auto-generated constructor stub }
da65451f-73e5-4a32-a290-96bf874aad7b
1
@Override public void actionPerformed(ActionEvent e) { if (e.getSource()==questionDeleteButton) { this.setVisible(false); this.getParent().remove(this); this.invalidate(); } }
e610e49b-006c-4998-95de-99bd0418fb39
2
public double getDouble(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); } catch (Exception e) { throw new JSONException("JS...
5cf46c09-6290-4c69-b5b9-875790e49eb9
1
public static double[] readAudioFile( File audioFile, float sampleRate ) throws IOException, UnsupportedAudioFileException { AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile); AudioFormat audioFormat = new AudioFormat(sampleRate, 16, 1, true, true); DataInputStream dataStream = new ...
9f5681c5-4439-49fd-b1db-191096cd4f91
1
public XmlParser(String src) { try { xmlFile = new File(src); } catch (Exception e) { System.out.println("Erro ao abrir o arquivo XML\nErro: " + e.getMessage()); } }
c22f785f-8c92-4766-9ccb-e794f75ebeb4
3
@Override public void doLogic() { if (inputList[0] == true && inputList[1] == true){ this.power = true; this.solved = true; } else { this.power = false; } if (solved == false){ inputList[0] = false; inputList[1] = false; } }
cd4b33bf-f57d-4ce9-867b-5cd6becfda1e
2
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.load...
54832012-3a69-412e-8f58-156e9d317786
0
@Override public void mouseClicked(MouseEvent e) { }
675e0326-443f-4070-a6af-86364cfc718a
4
public MiniAirplaneTurnImage(String imageURL, PlaneColor color) { super(imageURL); totalFrame=8;//3 frames per plane delayCounter=0;//delay counter starts at 0 //Set the image to military color if(color==PlaneColor.MILITARY) { yLocationSpriteSheet=136; } //Set the image to white color else if(...
e843a66c-4890-4618-b157-3f1056e05b9e
9
private BitSet[] findElementaryCycles( BitSet reachables ) { ArrayList<BitSet> elementaryCycles = new ArrayList<BitSet>(); ArrayList<Integer> queue = new ArrayList<Integer>(); queue.add(0); BitSet bitSet; int last, parent, son; for ( int source = dRun.length - 1; source >= 0; source-- ) if ( r...
a2a1f427-7d5d-4633-acb5-13c71b852a1d
0
public void setPackageName(String name) { this.packageName = name; }
0e39e961-4aec-4ee0-b333-75d526a1c473
8
protected void shiftCell(Object cell, double dx, double dy, double x0, double y0, double right, double bottom, double fx, double fy, boolean extendParent) { mxGraph graph = getGraph(); mxCellState state = graph.getView().getState(cell); if (state != null) { mxIGraphModel model = graph.getModel(); ...
82a7ba8b-c5fb-49dd-9cbb-3becd325e6e7
7
public void run(int interfaceId, int componentId) { if (stage == -1) { sendEntityDialogue((short) 241, new String[] { player.getDisplayName(), "Sure, let's see what I can set it to!" }, (byte) 0, player.getIndex(), 9827); stage = 1; } else if (stage == 1) { sendDialogue((short) 238, new St...
602da4fb-bf68-4025-b0c6-7a1a1307a9f9
6
private Image warpImage(String imagePath){ BufferedImage image = null; //load image try { image = ImageIO.read(this.getClass().getResource(imagePath)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //wrap image in the transformer object javaxt.io.Image warped...
2287fd82-4903-44e0-8c5a-6e20d38031e8
8
private void parse(CommandLine line) throws FileNotFoundException, UnsupportedEncodingException { if(line.getArgList().isEmpty() || line.hasOption("help")) { printUsage(); return; } if(line.hasOption("in")) { String inFile = line.getOptionValue("in"); ...
a9728728-46fb-488a-90c5-2541081b496e
8
private boolean checkTouchBullet() { boolean tocat = false; this.setVisible(true); ArrayList<Line2D.Double> linies = this.getBoundLines(); if (!Board.getBullets().isEmpty()) { for (int i = 0; i < linies.size(); i++) { for (int t = 0; t < Board.getBullets()....
f6ff9197-3a08-491a-acc0-43e2a0bb021b
4
public void move(int m) { int pX = x; int pY = y; switch (m) { case 0: { pY--; break; } case 2: { pY++; break; } case 1: { pX++; break; ...
6fcbd203-def4-4acf-9e80-c032179eec3a
2
@EventHandler public void onDisconnectEvent(ClientDisconnectEvent event){ try{ Client c = ClientManager.get(event.sc); if(c.isLoggedIn()){System.out.println(c.getUsername() + " Disconnected!");} else{System.out.println(event.sc.getLocalAddress()+" Disconnected!");} ClientManager.remove(event.getSocketCha...
452d8556-249c-4673-9009-3472827e9004
6
public void fixAllBarrows() { int totalCost = 0; int cashAmount = c.getItems().getItemAmount(995); for (int j = 0; j < c.playerItems.length; j++) { boolean breakOut = false; for (int i = 0; i < c.getItems().brokenBarrows.length; i++) { if (c.playerItems[j]-1 == c.getItems().brokenBarrows[i][1]) { ...
24d42f5a-3e15-4e39-97e9-a6da35794e97
9
public String searchANDdescribe() { StringBuilder result = new StringBuilder(); for(K k : this) { if(k.getClass().equals(PapaBuilding.class)){ result.append(((PapaBuilding) k).getAttributes()); }else if(k.getClass().equals(PapaBicho.class)){ result.append(((PapaBicho) k).getAttributes()); }else if(...
24e0bc56-10fb-4c39-9322-a6cb4cf356d4
7
static void quick_sort (int lowerIndex, int higherIndex,int array[]) { int i = lowerIndex; int j = higherIndex; // calculate pivot number, I am taking pivot as middle index number int pivot = array[lowerIndex+(higherIndex-lowerIndex)/2]; // Divide into two arrays whi...
900d64aa-1aa7-4a13-b73d-de330240b8ed
5
private int splitOutputFile(final File tempOutputFile, final File outputFolder) throws IOException { //output should be words_1.dict....words_n.dict InputStream inputStream = new FileInputStream(tempOutputFile); int file_postfix = 0; int current_output_fil...
b8ab2ace-4a50-4231-bede-1a77f6ac613d
7
public static int removeElement(int[] A, int elem) { if (A == null || A.length == 0) return 0; int foundNum = 0; int i = 0; while (i < A.length && i <= A.length - 1 - foundNum) { if (A[i] == elem) { int j = A.length - 1 - foundNum; while (j > i) { if (A[j] == elem) foundNum++; els...
d2bdc224-ad73-4ce3-8a53-8b9d93e885d2
6
private void moveGhosts(){ if (this.ghostMoveCounter == 0){ for (int i=0; i < 4; i++){ if (this.ghosts[i].getIsAlive() && (i != 2)) this.ghosts[i].move(); } if (this.ghosts[2].getIsAlive()) if (!didGhostsCollide()) this.ghosts[2].move(); } }
674e6970-ebb9-43f1-8b67-627af0b20e75
2
private int handleL(String value, DoubleMetaphoneResult result, int index) { result.append('L'); if (charAt(value, index + 1) == 'L') { if (conditionL0(value, index)) { result.appendAlternate(' '); } in...
8968b349-7a0a-4b1c-8632-cc6e060a030b
8
private String[] getTroisMeilleurs(String nomJeu, String xmlJeu, String xmlUsers) { String[] result = new String[3]; HashMap<String, List<String>> partiesParJoueur = getParties(nomJeu, xmlUsers); if (partiesParJoueur == null) return result; HashMap<Integer, Integer> pointParSituation = getPoints(...
3e8f90e3-100e-489f-a6d1-f82c6d4330fe
3
public static void initbardas() { try { for (Class<?> c : barda) Class.forName(c.getName(), true, c.getClassLoader()); } catch (ClassNotFoundException e) { e.printStackTrace(); throw (new Error(e)); } }
d9017dd0-a8a5-4d8b-8aaa-116d40a9ee9a
7
public static Cons yieldContextSensitiveSlotValueSetterTree(StorageSlot slot, Stella_Object objectref, Stella_Object valueref, StandardObject returntype, Cons csoptions, Object [] MV_returnarray) { { boolean contextsensitiveP = !((csoptions != null) && (Cons.searchPlist(csoptions, Stella.KWD_CONTEXT_SENSI...
4cc74e3d-f846-4b0b-8f09-57ee031f3292
9
public Queue<String> escoltaXMLUnit (){ try { path = new File(".").getCanonicalPath(); FileInputStream file = new FileInputStream(new File(path + "/xml/papabicho.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); D...
71b315f9-bbcc-47de-b3bf-4700d03584da
5
public boolean after(Temps t) { boolean aft=true; if (this.heures<t.heures) { aft=false; } else { if (this.heures==t.heures) { if (this.minutes<t.minutes) { aft=false; } else { if (this.minutes==t.minutes) { if (this.s...
9bc2bdf1-a541-485d-b15e-94641f6482e5
8
public static double ddot_f77 (int n, double dx[], int incx, double dy[], int incy) { double ddot; int i,ix,iy,m; ddot = 0.0; if (n <= 0) return ddot; if ((incx == 1) && (incy == 1)) { // both increments equal to 1 m = n%5; for (i = 1; i <= ...
be0288f8-eabe-4fb1-a795-7b51125fedb2
4
public boolean supprimerPointLivraison(Noeud noeudASup) throws HorsPlageException{ boolean trouve = false; int i; Chemin cheminAvant = null; Chemin cheminApres = null; for (i=0 ; i<cheminsResultats.size() ; i++) { int idNoeudASup = noeudASup.getId(); if ((...
921badff-c011-439a-b787-8f43c1d7c191
2
public static void main( String[] args ) throws Exception { CUI c = new CUI(); String cui = "C0032344"; System.out.println(cui); System.out.println("----------"); System.out.println("Definition: "); System.out.println(c.retreiveDefinition(cui)); Syste...
80c72a11-3227-42a9-bb8e-a28aa47643ac
6
protected BufferedImage initOffsets() { BufferedImage img = image; if( img == null ) return img; scale = 1; while( img.getWidth() * (scale+1) <= getWidth() && img.getHeight() * (scale+1) <= getHeight() ) { ++scale; } while( scale > 1 && (img.getWidth() * scale > getWidth() || img.getHeight() * scal...
fbb86148-9a00-43c4-9d4b-aabc0eb9be95
1
public RuleMatch matchRule(Rule rule) { List<UnificationPair> mgu = unifier.unify(new UnificationPair(rule.getHead(), target)); // If there exists a most general unifier, then we have found a suitable rule if (mgu != null) { return new RuleMatch(rule, mgu); ...