method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1c88b1e4-f52e-470d-93df-d998f306abc3
2
private static Map<String, Double> sortByComparator(Map<String, Double> unsortMap, final boolean order) { List<Entry<String, Double>> list = new LinkedList<Entry<String, Double>>(unsortMap.entrySet()); // Sorting the list based on values Collections.sort(list, new Comparator<Entry<String, Double>>...
f83f5f1b-1508-4149-8a9b-2f895d830ac9
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just created an earthquake!"); return random.nextInt((int) agility) * 2; } return 0; }
7cabbb24-d5fc-49eb-bf85-3e09be26d921
1
public void close_connection() { try { this.connection.close(); this.res_set.close(); this.connected = false; } catch(SQLException sqlEx) { System.err.println(sqlEx.getMessage()); } }
5adc6715-2613-4a9d-898c-3d5a7f799de5
8
@Override @SuppressWarnings("unchecked") public int getHolidayIndex(String named) { final Object resp=getHolidayFile(); if(resp instanceof String) { return -1; } List<String> steps=null; if(resp instanceof List) steps=(List<String>)resp; else return -1; Vector<String> lineV=null; String l...
7c6e6497-fb43-4bfd-9731-594314b24e0e
6
@EventHandler public void onPlayerMoveIn(PlayerMoveEvent event){ final Player p = event.getPlayer(); String worldName = p.getWorld().getName(); if(worldName.contains("zombieRun")||worldName.equals("world")){ Material blockIsIn = p.getLocation().getBlock().getType(); World world = p.getWorld(); Location ...
fb6d29ab-6de2-4748-8a8a-1bd2a6ab63dc
9
protected void quantize(String path, int numColors) throws IOException { File file = new File(path).getCanonicalFile(); if (file == null || !file.exists() || !file.isFile() || !file.canRead()) { throw new FileNotFoundException(path); } path = file.getAbsolutePath(); //Dither to DS colors BufferedImage...
ecf0ca17-40f3-4dd7-a496-611f0adf422f
4
public boolean checkSave() { if (hasChanged()) { int c = JOptionPane.showConfirmDialog(frame, Resources.getString("Jeie.UNSAVED_MESSAGE"), Resources.getString("Jeie.UNSAVED_TITLE"), JOptionPane.YES_NO_CANCEL_OPTION); if (c == JOptionPane.CANCEL_OPTION) return false; if (c == JOptionPane.Y...
f9618388-4c9f-4721-92f1-a8f9fe2ef29a
7
public static boolean collidesWithRegion(SpaceRegion region, Vec3 position, Vec3 direction) { // This is where the shit hits the fan if ( region.isInside( position ) && direction.isValid() && !direction.isZero() ) { //ok, that was easy. Even if very small, having a non-zero, valid, //direction and being in...
b1db5bcb-7279-418d-98eb-1ee75fc0434e
1
public GameLogging(Class<?> clazz) { logger = LoggerFactory.getLogger(clazz); }
a6e43d9c-fa75-45b5-b0fa-29011e2775d7
8
@Override public double getDoubleVal() { Object pob = null; Double d = null; try { pob = getValue(); if( pob == null ) { log.error( "Unable to calculate Formula at " + getLocation() ); return java.lang.Double.NaN; } d = (Double) pob; } catch( ClassCastException e ) { try { ...
a539423b-74a4-4c5c-add9-04308562261c
3
public String magnitudeString(int strength){ String convertedStrength; if (strength == Relationship.HIGH){convertedStrength = "High";} else if (strength == Relationship.MEDIUM){convertedStrength = "Med";} else if (strength == Relationship.LOW){convertedStrength = "Low";} else con...
8d9d3c03-c710-4b8f-9fc6-583fa3558889
5
protected ListPanel getAlarmByFiremanId(int firemanId) { ArrayList<Time_Sheet> timeSheet = new ArrayList<Time_Sheet>(); ListPanel list = new ListPanel(parent.getWidth()); ArrayList<Alarm> alarms = new ArrayList<Alarm>(); try{ timeSheet = tsa.getTimeSheetsbyFirema...
9c3b1da5-6596-48b6-ba24-3d98f9798cb1
9
private void assignAvailableMoves(){ // Track how many are available int count = 0; // Check every spot for (int i = 0; i < 4; i++){ for (int j = 0; j < 12; j++){ // Anywhere is legal on first turn if (turn == 0) { available_locations[i][j] = true; } // If the spot is taken t...
726f0129-8ad6-48fd-ae56-a9aec17a2a3d
1
public void setGuardAngle(float angle) { if(angle < 0) { guardAngle = angle + MathUtil.PI * 2; } else { guardAngle = angle; } }
498ac687-53a6-4fd9-ac76-469d5254406d
3
static final public void select_statement() throws ParseException { String str; String path; jj_consume_token(SELECT); System.out.println("Select\ubb38 \ud638\ucd9c!"); str = select_regex(); label_1: while (true) { jj_consume_token(39); select_regex(); switch ((...
3510cb33-d2ca-43f1-879d-6dfcb631dc2c
9
protected void forward(DatasetExample example) { int size = example.size(); // Initialize the alpha[0] values. Vector<Double> first = alpha.get(0); if (tagged[0]) { // Set all state probabilities to zero. for (int state = 0; state < numStates; ++state) first.set(state, 0.0); // Get the correct st...
8bcdb77e-ed1f-4cf8-8af5-508497b6fbdc
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final WorkType other = (WorkType) obj; if (this.id != other.id) { return false; } i...
07bc8e4b-01c9-4515-9881-736faaa10665
5
private IService initService(Class<?> serviceClass, Properties properties) throws ServiceException{ if (IService.class.isAssignableFrom(serviceClass)){ IService service; try { service = (IService) serviceClass.newInstance(); service.init(properties); return service; } catch (InstantiationExceptio...
d019da00-efc6-4af2-a320-4aa0c0bed7c4
1
@Override public Iterator<Data<?>> iterator() { return data.iterator(); }
254abf6f-6684-4d49-9742-6984f0e137ee
4
private void calcula(String operador, String numero) { int num = Integer.parseInt(numero); switch (operador) { case "+": CALCULADO += num; break; case "-": CALCULADO -= num; break; case "*": ...
f6c08a0d-a62b-49c3-86e1-9367b3b7531e
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PeriodSBU other = (PeriodSBU) obj;; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) re...
efc0f801-2cb9-4b4c-84aa-ef9ba020cc72
8
public byte[] getEContent() { SignerInfo signerInfo = getSignerInfo(signedData); ASN1Set signedAttributesSet = signerInfo.getAuthenticatedAttributes(); ContentInfo contentInfo = signedData.getEncapContentInfo(); byte[] contentBytes = ((DEROctetString) contentInfo.getContent()) .getOctets(); if (signedAt...
a0208f9d-66e8-4b3b-b9a5-e8ff4edd09ed
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...
3fc0d1d3-74e8-4c50-a961-a314dd6c26a5
2
public static SocketBase zmq_socket (Ctx ctx_, int type_) { if (ctx_ == null || !ctx_.check_tag ()) { throw new IllegalStateException(); } SocketBase s = ctx_.create_socket (type_); return s; }
4674a397-d372-4bfa-89f9-f70cfed94de4
1
public static boolean removePreLive(final String name) { if (CallGraph.preLive == null) { CallGraph.init(); } return (CallGraph.preLive.remove(name)); }
fc65c6b6-d1b6-4926-9684-1425eddd31e0
7
private static Instances clusterInstances(Instances data) { XMeans xmeans = new XMeans(); Remove filter = new Remove(); Instances dataClusterer = null; if (data == null) { throw new NullPointerException("Data is null at clusteredInstances method"); } //Get the...
d7ca9b29-6f18-46a3-a114-3df851d5dc16
6
public List<Jvm> parse(String[] processes) { List<Jvm> jvms = new ArrayList<Jvm>(); for(String process : processes) { if(!process.isEmpty() && !process.contains("process information unavailable")) { String[] datas = process.split(" ...
4c087dcb-85ca-40e9-be25-47c41688b045
3
@Override public boolean isMine(String command) { if (super.isMine(command)) { if ((command.indexOf("(") == -1) || (command.indexOf(")") == -1)) { error = hint; return false; } types = command.substring(command.indexOf("("), command.lastInd...
c0979d0c-c143-411e-95f9-a48959485854
2
private void shrinkBase() { while (this.base != 0 && this.base % 10 == 0) { this.base /= 10; this.factor--; } }
9a395a7b-f0f3-4a1c-89da-a4f9fe475f0f
0
@Override public boolean supportsMoveability() {return true;}
d1864865-fc5d-4e69-b9dc-ba31bcf57175
8
public AssetTransactionEditDialog(JFrame parent, String title, TransactionPanel transactionPanel, TransactionRecord transaction) { super(parent, title, Dialog.ModalityType.DOCUMENT_MODAL); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.tran...
e4303a96-7d2d-4d26-a751-43ed5f114766
1
public int getNewKeys() { int allNewSize = 0; for (int i = 0; i < 256; ++i) { allNewSize += files[i].getNewKeys(); } return allNewSize; }
79dca91e-994e-41b0-8f46-826c142385cd
1
public String getMBS32(String key) { long now = System.currentTimeMillis(); String tmp = ""; System.out.println("panjang " + key.length()); for(int i = 0; i < key.length(); i++) { tmp = "" + this.getSHA("" + key.charAt(i)); } String a1 = this.getSH...
ebde50f8-63af-4398-9026-b4dbba750af2
8
public double run() { double nextStartNumber, nextEndNumber, currentEndNumber; boolean stopped = false; pi = 4; nCompletedCalculations = 0; /* * Create a threadpool have fixed number of threads */ executor = Executors.newFixedThreadPool(nThreads); taskPool = createTaskPool(); Iterator<Algorithm...
a1cad4c0-66bc-4484-9dea-5aa5d0c30f2e
9
private void gameRender(Graphics2D gScr) { countFramesForAttackingHero++; // Hintergrund faerben gScr.setColor(Color.black); gScr.fillRect(0, 0, pWidth, pHeight); gScr.setFont(font); gScr.setColor(Color.black); switch(state) { case INTRO : state = state.MENU; ...
3e1cca6c-9028-4ac3-847b-d60cabf5c8c6
6
public boolean updateVecs(Equation e, Integer i) { if (e.TypeSel.getSelectedIndex() == Equation.posCartLine) { float[] out = getInput(e.cartLInputs); vecs[i] = createCartLine(out); return true; } if (e.TypeSel.getSelectedIndex() == Equation.posVecLine) { float[] out = getInput(e.vecLInputs); vec...
2842eeb7-57b7-4884-a9bc-d65520160fe9
5
public void connecterServeur(CallbackListener callback) throws IOException { coucheReseau = new InterfaceReseau(Protocole.TCP, Constantes.IPDistante, portLocal, Constantes.portDistantTCP); coucheReseau.envoyer("INIT "+portLocal); if((reponse = coucheReseau.recevoir()).equals("2...
32ea33cd-7d2a-46f8-8f05-7b7774e15975
0
@Override protected void generateFrameData(ResizingByteBuffer bb) throws FileNotFoundException, IOException { // TODO: generate, don't reload bb.put(this.reload()); }
2bdee9a4-4b52-4077-acac-b6a53137219c
5
static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future) { int diff = 0; long savedDate = fromDate.getTimeInMillis(); while ((future && !fromDate.after(toDate)) || (!future && !fromDate.before(toDate))) { savedDate = fromDate.getTimeInMillis(); fr...
6551aa35-970f-4635-9c6b-188943877cc9
9
static void project( Region src, float x, float y, Region dest, int destX, int destY ) { dest.clear(); final int rayCount=512; for( int i=0; i<rayCount; ++i ) { // 64 rays! float angle = i*(float)Math.PI*2/rayCount; float dx = (float)Math.cos(angle); float dy = (float)Math.sin(angle); float cx =...
81af6a61-a464-45c3-9420-1fd19fbaef6e
0
public void setCliente(int cliente) { this.cliente = cliente; }
206a8bf1-b886-4945-80ad-d1dfc3fe489f
9
static double term(Reader in, Set<Integer> terminators) throws ParserException, IOException { boolean negative = false; if (read(in) == '-') { negative = true; } else { in.reset(); //return to mark } Set<Integer> multTerminators = new HashSet<>(terminator...
1249f63c-e81f-46c3-ad5e-9ebe331e7407
0
public GenericContainer() { }
cc4f4414-de7c-478d-a765-0535fad44809
2
protected void initializeFilepaths(){ filePaths = new String[mapSizeY][mapSizeX]; int n = 1; for(int i = 0; i < mapSizeY; i++){ for(int j = 0; j < mapSizeX; j++){ filePaths[i][j] = filePath + "testLevel" + n; n++; } } }
431cff69-1911-4c64-913b-03a2f7132109
6
public void move() { if (isVisible == true && (lovelyStrip == 0 || lovelyStrip == 3)){ area.x += moveX; if(!isInsideStripArea()){ isVisible = false; } } else if(isVisible == true){ area.x -= moveX; if(!isI...
7c386c90-eef1-47ef-bc2c-8e2e52f95dbc
5
@Override public void caseAParaComando(AParaComando node) { inAParaComando(node); if(node.getVariavel() != null) { node.getVariavel().apply(this); } if(node.getIPara() != null) { node.getIPara().apply(this); } if(node.getPas...
f5cb457b-7a38-428a-8ce2-f9031603e362
4
public static void compare( final int ARRAY_SIZE, final int iterations, SortAlgorithm[] algos ) { int size = algos.length; long means[] = new long[ size ]; for(int i = 0; i < size; means[i++] = 0) { // nothing to do } for(int i = 0; i < iterations; ++i) { System.out.print("Iteration " + (i+1) + "......
673d71a0-9123-4b53-8d7e-fdf2d5b6457b
0
public void setStartVariable(String variable) { myStartVariable = variable; }
ccad2996-99ed-44e2-ba85-4014b48961f1
5
public static Double[][] randCostArray(int n) { n = n < 2 ? randInt(5,1000):n; Double[][] array = new Double[n][n]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if( j > i) array[i][j] = (double) randInt(1, 100); else if( i == j) array[i][j] = 0.0; else array[i][...
e2069f79-39a2-42df-a8c2-b24271d8a4e8
3
public void logToFile(String message) { try { warnLog = new File(dataFolder + File.separator + "WarnLog.txt"); //Bukkit.broadcastMessage("Test1: " + warnLog.getPath()); File dataFolder = getDataFolder(); if (!dataFolder.exists()) { dataFolder.mkdir(); } if (!warnLog.exists()) { warnLog....
dd88840b-4df1-438f-b9ed-ee9c7f2d09f1
8
public static void CheckEndGame() { // TODO: Implement game checking code here. int winningPlayer = -1; switch(Instance.gameMode) { case DOMINATION : //First player to control >= 75% of all planets in the game. float limit = (float) (Instance.numPlanets) * 0.75f; for(int i = 0; i < TurnManager.numPlayers;...
e3ad9d54-cf77-4a9d-868e-cac9b2aab00d
1
public static <T> CycList<T> makeDottedPair(final T normalElement, final T dottedElement) { if (CycObjectFactory.nil.equals(dottedElement)) { return new CycList<T>(normalElement); } final CycList<T> cycList = new CycList<T>(normalElement); cycList.setDottedElement((T) dottedElement); return cy...
394a4417-d706-4eb0-8ebd-5851adb7167b
4
static final public Behavior behavior() throws ParseException { Behavior result; Token name; MessageHandler handler; jj_consume_token(BEHAVIOR); name = jj_consume_token(BEHAVIORIDENT); result = new Behavior(name.image); jj_consume_token(LPAREN); ...
91958879-0ffd-4939-89a1-e6b20c53679a
5
public boolean add(VetVisit visitX) { boolean visitAdded = false; if(visitX.equals(null)) return visitAdded; //returns false /* check to verify visitX isn't already in the list. if it isn't already in the * list, proceed to add visitX to list (if visit...
af5f09fa-79b3-4081-866a-bd0c3a692f12
7
private boolean isHovering(MouseEvent e) { Rectangle r1 = new Rectangle(sRect1.x + (int)sXPos - 1, sRect1.y + (int)sYPos - 1, sRect1.width+2, sRect1.height+2); Rectangle r2 = new Rectangle(sRect2.x + (int)sXPos - 1, sRect2.y + (int)sYPos - 1, sRect2.width+2, sRect2.height+2); Rectangle w1 = new Rectangle(wRect1.x + ...
7ebfb6bf-6bf6-4993-9aab-22ce7ff9e6ea
2
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for(int i=0;i<n;i++){ a[i]=in.nextInt(); } String result = check(a); System.out.println(result); if(result.equals("yes")) System.out.println(range[0]+" "+range[1]); ...
7d749747-e1fe-4ed2-ad8a-5930f14b8eb2
1
@Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (DATA_FLAVOR.equals(flavor)) { return this; } throw new UnsupportedFlavorException(flavor); }
2f0782fc-0957-43d5-83d0-685cb9e3950a
7
public byte mean(String fileName) throws IOException { FileInputStream is = null; DataInputStream dis = null; BufferedWriter br = new BufferedWriter(new FileWriter("mean_bin.txt")); NumberFormat formatter = new DecimalFormat(); formatter = new DecimalFormat("0.000E00"); try { is = new FileInputStre...
26b20ad3-6d29-4f4c-97e3-c5e1f3c7ab98
1
public void setBackgroundWithoutHandling(Path img) { if (FileUtil.control(img)) { this.imgBackground = img; this.backgroundImgChanged = true; } else { this.imgBackground = null; this.backgroundImgChanged = false; } somethingChanged(); ...
4bbbd27b-cdc8-4ab3-9ff6-91bdde1189ee
6
@EventHandler public void SpiderInvisibility(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSpiderConfig().getDouble("Spider.In...
c480fda7-ee1c-49ec-8472-9ab29a65395a
3
private void createSuggestionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createSuggestionButtonActionPerformed String subject = subjectTextField.getText(); String description = descriptionTextArea.getText(); boolean success; if(suggestion != null && suggest...
78e4d177-3019-4f25-a716-ae325bf0480e
2
public void startFile(String logfile) { File parent = new File(logfile).getParentFile(); if (!parent.isDirectory() && !parent.mkdirs()) { logger.warning("Could not create log folder: " + parent); } Handler fileHandler = new RotatingFileHandler(logfile); fileHandler.se...
54518a53-6e60-4736-96d9-3dda1739995a
1
public static void main(String[] args) { try { AppGameContainer app = new AppGameContainer(new main()); app.setDisplayMode(1280, 768, false); //was 960 and 1080 app.setTargetFrameRate(60); app.setFullscreen(false);; app.start(); } catch (SlickException e) { e.printStackTrace(); } }
a97e7427-60ec-425f-8de6-bde9edbad3fe
2
public boolean isEmpty(int checkId) { ListElement currentRobot = this.robotPlace.getHead(); while (currentRobot != null) { if (currentRobot.getId() == checkId) { return false; } currentRobot = currentRobot.getNext(); } return true; ...
113c3967-4bb2-4a7b-8c46-a6c6b72b2446
3
public static void arrayDisplay(int x[][]){ //loops through the rows, then loops through the columns if there is any for(int row = 0; row < x.length; row++){ System.out.println("Row: " + row); if(x[row].length <= 1)//detects the amount of columns the row in the array has { System.out.println("Th...
f0622048-7ead-4b39-bd36-b23854bf26b5
0
public synchronized static void setDone(boolean done) { RaceCondition2.done = done; }
b1f83a9b-27ef-4156-a536-6381b4c0ee5d
9
protected Document parseXmlResponse (String xmlString) throws Exception { Document xmlDoc; try { xmlDoc = XmlUtils.parseXmlString(xmlString); } catch (SAXParseException e1) { throw new ServiceException(INVALID_WEB_SERVICE_RESPONSE, "Error parsing xml", e1); } ...
68772bca-a339-4a92-8000-16f1fdcc5c0b
8
public void analyseLargestComponentMembership(String dir){ File[] files = new File(dir).listFiles(); String line; String[] parts; int[] monthsT = new int[files.length]; int index =0; Map<Integer,File> fileMap = new HashMap<Integer,File>(); for(File file : files) ...
0382fa2f-b2b0-444d-9635-0b95a1226662
1
public void start() { if (running) return; running = true; beater = new Beater(this); beater.start(); }
bbea6090-e444-438c-bd45-6da6cbaa0b4e
3
public void vuoro(int x, int y, int rivi, int sarake) { if (this.logiikka.getVuoro() == 1) { this.logiikka.suoritaVuoro(1, rivi, sarake); if (this.logiikka.getRistinAsetus() == 1) { this.piirtoalusta.piirraNormaaliRisti(x, y); } else { this.pii...
3ffce718-beab-4eed-9766-9652cbbc63e2
1
public void place(String string, World world) { this.loadFromFile(string, world); for (Blocks bl : blocks) { bl.set(); } }
7e6c754e-46cd-40dd-9299-654ef5b096ad
6
public void render() { bg.bind(); Molybdenum.GLQuad(0, 0, Display.getWidth(), Display.getHeight()); Molybdenum.setAwtColor(Color.WHITE); Molybdenum.getText().drawStringS("Molybdenum | Properties", 16, 16, Text.LEFT, 3f,4); Molybdenum.setAwtColor(Color.DARK_GRAY); Molybdenum.getText().drawString("Version "...
8ec1b317-9fdd-4c74-97be-25f664a25e48
4
@Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } if (userId != null) { return userId.equals(((User) that).userId); } return super.equals(that); }
38e13956-bbff-4916-a438-9b501609d787
3
public void printSccs() { Iterator<Integer> it = sccsOfLeader.keySet().iterator(); int j = 0; while (it.hasNext() && j < 10) { int leaderVertex = it.next(); System.out.print((leaderVertex + 1) + ":"); for (int i = 0; i < sccsOfLeader.get(leaderVertex).size(); i++) { System.out.print((sccsOfLeader.get...
81f5a0b3-27c4-4594-9ea4-162f5490f55e
7
int[] LIS(int[] num) { ArrayList<Integer> trace = new ArrayList<Integer>(); // for back-tracing ArrayList<Integer> lis = new ArrayList<Integer>(); // recording the current optimal LIS trace.add(-1); lis.add(0); for (int i = 1; i < num.length; i++) { int l = 0, r = lis.size() - 1; while (l <= r) { in...
0d4bfdf4-d795-4f57-ac3a-65f338da242e
4
public boolean canPlace() { if (! super.canPlace()) return false ; for (Tile t : Spacing.perimeter(area(), origin().world)) if (t != null) { if (t.owningType() >= this.owningType()) return false ; } return true ; }
2d9b04c3-ded7-4e87-adf2-adc9e910d1c1
8
private boolean isPacketLine(String line) { if (line.isEmpty()) { return false; } if (this.accumulator == null && line.length() < 32) { return false; } for (char c : line.toCharArray()) { if ((c < '0' || c > '9') &...
99f38aa9-6713-451d-a714-4b3ec4589808
1
@Override public void flush() { for (int i = 0; i < printStreams.length; i++){ printStreams[i].flush(); }; }
3d6709e4-8169-4f2d-9d42-a048d3a367b0
4
public int[] findZ(int base){ int[] z = new int[2]; int pos = base-1; while (true){ if (this.getN(pos) == 0){ z[0] = pos; break; }else{ --pos; } } pos = base + 1; while (true){ ...
7289fb27-bf31-48b6-8f9d-b22d42ac5a57
8
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
920fd47d-0224-4103-b6f3-195f9c6e9781
3
private int countG (Point currentCell) { Point localCell = currentCell; int G = 0; while (!localCell.equals(startCell)) { Point parentCell = field[localCell.x][localCell.y].getParent(); if (localCell.x == parentCell.x || localCell.y == parentCell.y) { G ...
2d2e236b-2d8a-4cfa-ba2a-b356a58d4f63
1
public void setCount(int count) { if (count < 1) { throw new ComponentException("Illegal number of test cases: " + count); } this.count = count; }
d287e415-17ef-40ea-a216-a7b5d170d434
3
public static int romanValueOf(String roman) { roman = roman.toUpperCase(); if (roman.length() == 0) return 0; for (int i = 0; i < symbol.length; i++) { int pos = roman.indexOf(symbol[i]); if (pos >= 0) return value[i] - romanValueOf(roman.substring(0, pos)) + romanValueOf(roman.substring(pos +...
8b1129f1-6c37-496b-9b7e-6512a87a2ed3
0
public int getBitsPerPixel() { return bitsPerPixel; }
74a096b9-5cac-4f36-aa28-05454eb4fc7f
9
public static void startGame() { GameGUI.song.play(); GameGUI.song.loop(); // This allows us to restart the game without quitting the program if (gui != null){ // Is a replay, close the old game, clear the disks prompt, show it gui.close(); } // Contents of dialogue final String[] options = {"...
d4e23ebd-e40e-4a9e-a155-920bc5dba2c9
7
static private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 40: return jjStopAtPos(0, 12); case 41: return jjStopAtPos(0, 13); case 42: return jjStopAtPos(0, 7); case 43: return jjStopAtPos(0, 5); case 45: return jjStopAtPos(0,...
fd93c471-6fce-44fa-8389-1d0109f5f438
0
public long getSeatType() { return this._seatType; }
ee31c3be-9f4b-4165-8fc6-74269c6d78ce
4
@Override public void draw(Graphics g) { g.setColor(Color.black); g.fillRect(0, 0, width, height); if(!ready){ esm.panel.add(initiationLabel); esm.panel.updateUI(); } else if(ready){ drawFixationCross(g); if(drawSaccadeCrossOne){ drawSaccadeCross(g, 1); } if(drawSaccadeCr...
09292ffe-1616-4c38-9e98-1d7ec77c9a45
5
public ConnectFourPanel(ConnectFourPiece[][] pieces) { //Initialise m_pieces m_pieces = new ConnectFourPiece[BOARD_WIDTH][BOARD_HEIGHT]; updatePieces(pieces); //Load board image ImageIcon boardImage; try { boardImage = new ImageIcon(this.getClass() ...
8cdad0de-1d0e-44c5-8088-b4114293e436
9
* @param nodeSet the set of desired nodes * @param weight the score multiplier */ protected void bestSpot2AwayFromANodeSet(Hashtable nodesIn, Vector nodeSet, int weight) { Enumeration nodesInEnum = nodesIn.keys(); while (nodesInEnum.hasMoreElements()) { Intege...
1a961642-a8d3-43a6-8e84-a03245a599c7
1
public void aloitaUusiPeli(){ this.pause = false; this.jatkuu = true; this.pisteet = 0; this.taso = 1; this.rivit = 0; this.alkutaso = 0; this.viive = 2000; this.pelipalikat = new Palikka[20][]; for (int i = 0; i < 20; i++) { pelipalika...
7508466c-f2b5-43b6-aa05-c64b8141f2e9
3
public static void main(String[] args) throws UnknownHostException, IOException, NumberFormatException, InterruptedException { // Connect to the server socket = new Socket("localhost", PORT); // Write and read from the server through sockets out = new PrintWriter(socket.getOutputStream(), true); in = new B...
d9a70acc-3e31-4d3b-a233-c3e639c7b3c3
2
public void addDefaultBalances() { Balance resultBalance = createResultBalance(accounts); Balance relationsBalance = createRelationsBalance(accounts); Balance yearBalance = createClosingBalance(accounts); try { addBusinessObject(resultBalance); addBusinessObject(...
f2f1c46b-b8ad-4d50-b680-3285086e5cbf
4
public static void creer(String pseudo, String motDePasse, String courriel, byte[] avatar, String avatarType, HttpServletRequest requete) throws ChampInvalideException, ChampVideException, UtilisateurExistantException, MessagingException { EntityTransaction transaction = UtilisateurRepo.get().trans...
a67dcd70-66a0-4861-97b8-e1e271eb1081
0
@Test public void testAdjacentCell() { System.out.println("adjacentCell"); Cell instance = new Cell(2,2); int[] result = instance.adjacentCell(0); assertEquals(2, result[0]); assertEquals(3, result[1]); result = instance.adjacentCell(1); asse...
1f81b45a-5158-42d5-a7ee-2e3561cf28af
9
private AbstractBarcodeBean createBarcode(BarcodeTypes barcodeType) throws NotSupportedException { AbstractBarcodeBean bean = null; if (barcodeType == BarcodeTypes.CODE39) { bean = new Code39Bean(); ((Code39Bean)bean).setWideFactor(3); } else if (barcodeType == BarcodeTypes.CODE128) { bean = new Co...
fabea6e9-8a4f-4e17-a186-57867de2ce46
5
private void addEmployee() throws EndDataEntry { try { System.out.print("Enter the employee's name: "); String name = IOGeneric.getString(); if (name.length() == 0) throw new EndDataEntry(); System.out.print("Enter the employee's ID: "); ...
a38e38d8-2917-4161-bd9d-1568e786ccb6
6
public void setTitleForAudioPlayer(String streamName, String title, boolean isErrorMessage) { if(title != null && audioPanel != null) { String gesTitle = streamName + " : " + title; //if the title is empty, change the title to //the program name if(title == null || title.trim().equals("")) ...
dc7d2e21-d863-48fc-b7e2-4535ef669b11
4
public static String getProjectName() { if (GuiPackage.getInstance() == null) return null; String projectPath = GuiPackage.getInstance().getTestPlanFile(); String filename = "untitled"; if (projectPath != null) { filename = new File(projectPath).getName(); ...
d47bfc56-e088-4c5f-be57-76c1c91129b8
4
private void create_hash(String k,HashMap<String,Character> map) { String k_u=k.toUpperCase(); boolean[] filled=new boolean[26]; int total_cnt=0; for(char c:k_u.toCharArray()) { int pos=c-'A'; if(!filled[pos]) { String d=get_alphabet_morse(total_cnt); map.put(d, Character.valueOf(c)); fi...