method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1a1eeff2-7eab-46eb-8e1c-976e060fae7d
1
public String generateCacheKey(Object[] args) { String oriKey = buildSimpleKey(args, getParsedKey(), getKeyGetterMethods(), getKeyParameterIndexes()); StringBuilder cacheKey = new StringBuilder(); cacheKey.append(oriKey); Page page = getPageArgument(args); if (page != null) { cacheKey.append("-p").appen...
956cb534-8418-43d1-b103-9f60f69f2894
2
private double average(int[] record){ int sum=0; int i; double avg; int ct = 0; for (i=0;i<record.length;i++){ sum = sum+record[i]; System.out.printf("\n the %d th record is %d\n",i, record[i]); if (record[i]!=0) ct=i; } avg = sum/(ct+1); System.out.printf("\n the avg score is %f\n", avg); ...
aa7bae6a-121d-4618-9c10-5cdd10d3b534
4
public BloodParticle(int id, int x, int y, int col, int size, double force, Dungeon dungeon, Random random) { super(id, x, y, dungeon, random); this.size = size + random.nextInt(2); int r = random.nextInt(10); if(r <= 10) this.col = 0xff752323; if(r <= 7) this.col = 0xff912C2C; if(r <= 3) this.col = 0xf...
e49e0bce-3a04-4f06-a549-cd4ead641b91
4
public static boolean applyLookAndFeelByName(String name) { try { if (name != null) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (name.equals(info.getName())) { ...
ecbd56da-722a-4230-ba47-deeec9b926cf
6
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.isCancelled()) { return; } Player player = event.getPlayer(); if (player.getGameMode().equals(GameMode.CREATIVE)) { if (!this.config.yml.getBoolean("Game Mode.Separate In...
e13c4f22-38ba-49ea-b2e0-647d8e83fb27
5
private String buildMacroCall() { // Assemble the file to get the available macros MacroStatement[] macros = new SyntaxAnalyser(editor.getSourceFile()).getMacroStatements(); if(macros.length == 0) { // No macros are available UIUtilities.showErrorDialog(this, "No...
46898836-1dfa-4674-b510-d5ba617f51d1
6
public static Tetromino spawnRandomTetromino() { double rand = Math.random(); if (rand > .86) return new SquareTetromino(); else if (rand > .72) return new LineTetromino(); else if (rand > .58) return new RightLTetromino(); else if (rand > .44) return new LeftLTetromino(); else if (rand > .30) ...
982555a5-ae09-42c8-a1cf-db1198628455
3
private void findNamesByTitle() { Integer[] aPos = perPos.toArray(new Integer[perPos.size()]); for(int p : aPos) { String before; int befPos; if(pFill.matcher(tokens.get(p-1)).matches()) { before = tokens.get(p-2); befPos = 2; } else { before = tokens.get(p-1); befPos = ...
aaf32288-177b-437f-9e6e-76ef33854a12
1
public void leaveQueues(User leavingUser){ Iterator<Entry<Integer, Queue<User>>> it = gameQueueMap.entrySet().iterator(); while(it.hasNext()){ it.next().getValue().remove(leavingUser); } }
6ea56f36-4238-483f-bb99-49a24f0a2481
3
@Override public ExecutionContext run(ExecutionContext context) throws InterpretationException { AbsValueNode temp = (AbsValueNode) getChildAt(this.getChildCount() - 1); assert(temp!=null); Value test = (temp.evaluate(context)); if (test.getType() != VariableType.BOOLEAN) ...
bbc83304-4f4b-48de-8f6c-affead7140d6
4
public void transmitFile(String src) { TextProcessor.spellcheckFile(src, "prepare_" + src); TextProcessor.compressFile("prepare_" + src, "transfer_" + src); initializeNetwork(); int delay = 0, time = 0; LinkedList<String> path = network.dijkstrasShortestPath("control", "device"); System.out.println("\nSt...
8830bf88-145b-4dbf-a4e8-b1de2541818c
0
@Override public void execute(VirtualMachine vm) { ((DebuggerVirtualMachine) vm).enterEnvironmentRecord(identifier, offset); }
2decbdef-3402-4b0f-9835-53c99fee082e
9
public ListNode mergeTwpLists(ListNode l1, ListNode l2) { ListNode head = null; ListNode n = null; if (l1 == null) { head = l2; return head; } if (l2 == null) { head = l1; return head; } while (...
aac1d540-cd6d-4e67-95f0-b01a508a13ab
8
private static String directUploadSession(InputStream is, OutputStream os) throws IOException, ClassNotFoundException{ //Wait for the downloader to put his session description on the stream int timeout = 100; while(is.available() < 10 && timeout > 0){ try { Thread.sleep(50);} catch (InterruptedException e)...
7840b7e3-a0fe-49ee-808f-cbb85cc9cfdd
5
void descendFileSystem(File startDir) throws IOException { log.fine(String.format("FileSub.searchFiles(%s)%n", startDir)); if (startDir.isDirectory()) { String name = startDir.getName(); for (String dir : IGNORE_DIRS) { if (dir.equals(name)) { log.finer("IGNORING " + startDir); return; } ...
6497e1af-76ce-4239-b87b-28fd1226749d
3
public List<Frame> getFramesForTargetLemma(String targetLemma){ //depricated List<Frame> result = new ArrayList<Frame>(); for(Frame frame: frames){ if(frame.getTargetLemmaIDref().equals(targetLemma)) result.add(frame); } if(result.size()>0) return result; return null; }
0e41a926-4a35-48a4-93dc-4ed8049e96f3
3
private ArrayList<File> searchTileFiles() { File dir = new File("assets/tiles"); String find = ".pbt"; File[] files = dir.listFiles(); ArrayList<File> matches = new ArrayList<File> (); if (files != null) { for (int i = 0; i < files.length; i++) { ...
985499c9-b5bd-4824-a59f-0952128a0795
8
@Override public Model getRotatedModel() { if (npcDefinition == null) return null; Model rotatedModel = getChildModel(); if (rotatedModel == null) return null; super.height = rotatedModel.modelHeight; if (super.graphicId != -1 && super.currentAnimationId != -1) { SpotAnimation spotAnimation = SpotAn...
34702282-e55a-4e48-8037-c06dc38b972a
7
private boolean checkToSetCodedContent(Element in, Component out) { // first look for coded content CodedContentCollection collector = new CodedContentCollection(); // String codedID = in.getAttribute("name"); if (in.getAttribute("radlex:id") != null && in.getAttribute("radlex:id") != "") { collector.add(in....
5d8c2ffa-92d1-423e-bb4f-952e1fdc6d19
3
@Override public void doAction(Player player, Grid grid) throws InvalidActionException { if (player.getRemainingTurns() <= 0) throw new InvalidActionException("The player has no turns left!"); Position currentPos = player.getPosition(); Position newPos = new Position(currentPos.getxCoordinate() - 1, curren...
3ecaaafb-d6b6-48bb-a092-297d43f32f64
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { FileModel file = historyFileListUtils.getFileAt(rowIndex); switch (columnIndex) { case 0: return file.getFrom().toString(); case 1: return file.getTo().toString(); case 2: return fi...
6faa508f-629e-4ed0-96ca-78968aed34f9
3
private byte[] padPassword(byte[] password) { if (password == null) { password = new byte[0]; } // Step 1: Pad or truncate the password string to exactly 32 bytes. If // the password string is more than 32 bytes long, use only its first 32 // bytes; if it is less th...
9672ec8a-cb13-4e97-8d83-710d7f0269e4
0
@Override public Object clone() { return new Rabin((HashSet<Integer>) states.clone(), (HashSet<Integer>) liveStates.clone(), new Integer(initialState), (HashSet<AcceptingPair>) acceptanceCondition.clone(), (HashSet<Transition>) transitionRelation.clone()); }
6bd0deef-3e67-4b3c-931b-ddbd9aadc213
5
public int readProp() throws ServerException { int port = 7070; if (log.isDebugEnabled()) log.debug("Method call"); Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("servConfig.properties"); prop.l...
3c66bc23-db05-4826-9f1a-51dd1770de1e
5
public static void main (String[] args) throws IOException{ char[] hexArray = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; // args[0] = "E:/1.txt"; File file = new File(args[0]); BufferedReader in = new BufferedReader(new FileReader(file)); String line; while ...
ac3d991a-4a8e-4039-bc1d-2aa3a818a642
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if((msg.amISource(mob)) &&(msg.tool()!=this) &&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_CHANNEL)) &&((CMath.bset(msg.sour...
5c3e9311-3e2c-41d5-b92f-319d755935c6
0
public int getX() { return x; }
7d0fb631-ef7d-400b-822f-d3012bcf1f83
6
@SuppressWarnings("unchecked") public void eval(EvalContext context) { context.logEntering("Comparaison " + operator); right.eval(context); Object rightB = context.pop(); context.log("Evaluating right operand: " + rightB); // left.eval(context); Objec...
41a616b9-6323-4c1e-a5d6-9eb55b6fa528
9
public ArrayList<Politica> listAll(Connection c) throws SQLException { String sql = "SELECT * FROM M_POLIROLL ORDER BY VCCODRUTINA ASC "; ArrayList<Politica> results = new ArrayList(); ResultSet result = null; PreparedStatement stm = null; try { stm = c.prepareStatem...
a8d8177b-7f7b-4ef4-bc1b-b9da65f7358a
4
public static void shiftMap(int position){ switch (position) { case UP: map.setOffsetY(-15); break; case DOWN: map.setOffsetY(15); break; case LEFT: map.setOffsetX(-20); break; case RIGHT: map.setOffsetX(20); break; } EntityManager.cleanUp(); }
324fb732-491d-4feb-85f3-037d58464b78
1
public String convert(HashMap<String, Integer> dv) { String result = "" + from.getId(); for (String name : dv.keySet()) { result += " " + name + ":" + dv.get(name); } return result + "\n"; }
38dd05ea-4d40-4a09-91dd-86a5848284df
3
public User login(String username, String password) { for (int i=0; i<members.size(); i++) if (members.get(i).getUsername().equals(username) && members.get(i).getPassword().equals(password)) return members.get(i); return null; }
45b9bd63-73ce-4e95-bba1-ef961a257438
5
public void rollBack() { clear(); if (excecuteHistory == MOVE_DOWN) { currentY--; } else if (excecuteHistory == MOVE_LEFT) { currentX++; } else if (excecuteHistory == MOVE_RIGHT) { currentX--; } else if (excecuteHistory == ROTATE_CLOCKWISE) { shape.rotate(false); } else if (excecuteHistory == RO...
fbcf69ef-4307-459c-91ca-4f4b376015c1
8
protected long skipBytes(long bytes) throws BasicPlayerException { long totalSkipped = 0; if (m_dataSource instanceof File) { log.info("Bytes to skip : " + bytes); int previousStatus = m_status; m_status = SEEKING; long skipped = 0; try { synchronized (m_audioInputStream) { notifyE...
d5b818da-e41d-4f6f-ab2f-fe38903d1e3c
4
public ArrayList<Libros> getByNombre(Libros l){ PreparedStatement ps; ArrayList<Libros> libros = new ArrayList<>(); try { ps = mycon.prepareStatement("SELECT * FROM Libros WHERE nombre LIKE ?"); ps.setString(1, "%"+l.getNombrelibro()+"%"); ResultSet rs = ps.ex...
5cf21e39-3ae4-4582-8b05-54caa49dd17a
9
public boolean willThisMoveCauseCheckOrEaten(int x, int y, int a, int b) { boolean causeCheck=false; v1Bobby enemy = new v1Bobby(this.getB(), !color); Point oldLocation= new Point(x,y); Point p4=new Point(a,b); boolean possibleMove=false; boolean dontLook= false; if(this.b[a][b].toString().charAt(1) != 'X...
eaea7905-bc7a-48ad-ad61-14829b0c954a
0
public InputManager(Component comp) { this.comp = comp; mouseLocation = new Point(); centerLocation = new Point(); // register key and mouse listeners comp.addKeyListener(this); comp.addMouseListener(this); comp.addMouseMotionListener(this); comp.addMouse...
df258637-874c-419f-96e4-64cabd542ada
0
public void automataTransitionChange(AutomataTransitionEvent e) { setDirty(); }
95fe5a46-5b96-416f-aa8d-8e1d01dcceac
7
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/xml; charset=UTF-8"); resp.setCharacterEncoding("UTF-8"); PrintWriter writer = new PrintWriter(new OutputStreamWriter( resp.getOutputStream(), "UTF-8"), true); writer.println("<?xml version...
98fcafb5-d48a-4922-acdd-5c312a9bd643
2
public static void printGamestats(ConcurrentLinkedQueue<AIConnection> globalClientsArg){ if(developerMode){ System.out.println("####################### GAME STATS: #######################"); for(AIConnection ai: globalClientsArg){ ai.printStats(); } System.out.println("###########################...
6a1d78ac-9dc9-48ab-881c-cfe2c8186faa
4
private void deleteBookingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteBookingButtonActionPerformed int reply = jOptionPane.showConfirmDialog(this, "Are you sure you want to delete this booking?", "Delete?", jOptionPane.YES_NO_OPTION); if (reply == jOptionPane.YES_OPTIO...
3916a813-9856-448c-9fd5-97c2b0aa2a6a
1
Pawn(int t, boolean w, int x, int y){ super(t,w,x,y); dist = 1; if (!white) { int[][] ex = {{1, 0}, {1, 1}, {1, -1}, {2, 0}}; moves = ex; } else { int[][] ex = {{-1, 0}, {-1, 1}, {-1, -1}, {-2, 0}}; moves = ex; } }
684cc02a-d806-4151-8e0b-f010dc02cc69
6
public static void main(String args[]) throws Exception { /* 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 det...
afa69395-376e-407f-b4ac-623114421cc0
6
public static void updateButtonBlock(Global global, EffectBlock block){ block.setBlockImg(global.getImageByName("block_btnDown")); Block door = block.getAffectedBlock(); Rectangle origPos = block.getAffectedOrigPos(); //find doorway block for (Block b : global.getCurrent().getCurrentVerse().getVerseBlocks(...
68b1d62a-be61-4907-8e7b-6d4fd37d1e44
9
public static void main(String[] args) throws IOException { APIKey = getAPIKey(); String[] arguments = {"masteries","chaosdusk","adc"}; if (args.length != 0) arguments = args; switch(arguments.length) { case 0: displayHel...
8bef4d38-2fdc-4313-8e36-85828df387d3
4
private static User deserialize(String serialized) { User user = new User(); int start = serialized.indexOf("name:"); int end = serialized.indexOf(",", start + 5); user.setName(serialized.substring(start + 5 ,end)); Logger.log("reading user's name: \"" + user.name + "\""); start = serialized.indexOf...
538bd9a6-7e8a-4cb5-9e97-7fe08974d794
5
public String getUsedEncodingName(TLanguageFile file) { String back = "ISO-8859-1" ; if (file != null) { // not WYSIWYG mode or the encoding is java utf with escape sequences if ( !settings.getSaveWYSIWYGmode() || ( TEncodingList.isJavaEncoding( file.getDefaultEncoding() ) ) ) ...
aff6e4ed-aed2-4f8c-ad7b-ed52a24df520
1
public String getCode(){ String str = ""; if(argumentListOpt!=null){ str += argumentListOpt.getCode(); } str += this.printLineNumber(true) + "push := " + String.valueOf(this.currentLineNumber + 2) + "\n"; str += this.printLineNumber(true) + "goto := " + identifier.getNewName() + "\n"; return str...
b7fd9ee0-da9b-4f3b-a748-6e7cfe416192
6
public void drawBanditInitial(Graphics g) { if(player.getBandit().getRoomCoords(player.getBandit().getArea())[0]==-1 ||player.getBandit().getRoomCoords(player.getBandit().getArea())[1]==-1) { int i = player.getBandit().getAdjacentGrid()[0]; int j = player.getBandit().getAdjacentGrid()[1]; if(i==0) { ...
6d859b02-a7be-4999-a6f2-efa22a4e0e6e
7
private void load(Mesh mesh) { int list = glGenLists(1); glNewList(list, GL_COMPILE); int type; if (mesh.getType() == Mesh.TRIAGLES) type = GL_TRIANGLES; else if (mesh.getType() == Mesh.QUADS) type = GL_QUADS; else throw new RuntimeException( "critical error, no typ given -> someone hacked som...
cb57292a-ebca-4d9f-8a38-19922b4265d4
9
@Override public StringBuilder getHelpList(String helpStr, Properties rHelpFile1, Properties rHelpFile2, MOB forMOB) { helpStr=helpStr.toUpperCase().trim(); if(helpStr.indexOf(' ')>=0) helpStr=helpStr.replace(' ','_'); final List<String> matches=new Vector<String>(); for(f...
2638c7af-5337-44b5-b4a0-fbc238e80e30
1
* @return the count of the instances of the given collection * * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public int countAllInstances_Cached(CycFort collection, CycObject mt) throws IOException, CycApi...
3f377cb3-6b6b-44c2-9f26-e3ba80fc7fe1
1
public boolean isSetForCommitting() { // TODO Auto-generated method stub return session != null || session.getTransaction().isActive(); }
a95ee75f-60a5-4cc6-b5f7-ae2ff596e8a8
8
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TimeSeriesDataItem)) { return false; } TimeSeriesDataItem timeSeriesDataItem = (TimeSeriesDataItem) o; if (this.period != null) { if (!this.period.equa...
b0118871-f2ae-4ee9-9b61-c8a05aa4b1af
7
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (averageGroundLevel < 0) { averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox); if (averageGroundLevel < 0) { ...
21c5797b-25c5-4563-b9b9-f519c4e379bf
9
void updateSubTree(double[][] A, edge nearEdge, node v, node root, node newNode, double dcoeff, direction d ) { edge sib; switch( d ) { case UP: //newNode is above the edge nearEdge A[v.index][nearEdge.head.index] = A[nearEdge.head.index][v.index]; A[newNode.index][nearEdge.head.index...
0d16b948-4d1d-40e5-b4d4-83c304451a5c
0
public Tiedostonkirjoittaja() { }
b0083e7a-b898-4fe5-8f05-dd5d6d145c37
7
Point3f getMin() { if (min == null) min = new Point3f(); if (list.isEmpty()) { min.set(0, 0, 0); return min; } Cuboid c = getCuboid(0); min.x = c.getMinX(); min.y = c.getMinY(); min.z = c.getMinZ(); synchronized (list) { int n = count(); if (n > 1) { for (int i = 1; i < n; i++) { ...
d5390f92-836f-456b-97fa-d10f27cfc7f0
4
public boolean experiment() { int sum = 0; for (int i = 0; i < diceScoreTracker.length; i++) { diceScoreTracker[i] = 1 + (int)(6 * Math.random()); /* Loop through current scores and check if any add up to 7 when compared to the newly inserted score */ /* With this method, the newly added value is c...
1578a3e7-6f73-438b-8073-b667f514614a
0
private void Stop(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Stop programmerThread.stop(); hidePanels(lastPane); }//GEN-LAST:event_Stop
902ffdbe-4e4d-45f9-8569-d49129806e70
5
@Override public void learn() { world.setData(Data.SHAPES[6]); network.learn(); int i=0; while (i < 100 && !Options.getOptions().getStopped()) { // recuperer un certain nombre de donnees int nbNew = (int)(Math.random() * world.getData().size()); double lx = Math.random(); double ...
4f6e80ac-fedd-4f4a-81ee-0282e4370b7b
1
public TimerTask getAlarm() { TimerTask task; if(repeating) { task = repeatingAlarm(); } else { task = singleAlarm(); } scheduledTask = task; return task; }
8de91e82-e7cf-4efb-8629-130ba1471550
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...
d22bec85-2f52-44df-90f8-3c338f9487fb
9
protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption) { init(); this.options = options; // an iterator for the command line tokens Iterator iter = Arrays.asList(arguments).iterator(); // process each command line token while (iter....
44891649-8ae6-461c-be93-74d9fa0f786e
5
public static void loadPreferences(File prefSet) { if (loadFrom == null){ try { loadFrom = prefSet; Scanner lineIter = new Scanner(prefSet); lineIter.useDelimiter(",\n?"); String flag = null; double value = 0; int i = 0; Preferences insert = new Preferences(); while (lineIter.hasNex...
54eb5bbc-fc23-4ed2-b7a8-3ee0c0f30fe1
0
@After public void tearDown() { }
b95cb2af-cf0e-49f4-8bb3-07d50b2809d0
0
public static String getString(byte [] src, int srcPos,int destPos,int length){ byte[] tmp=new byte[length]; System.arraycopy(src, srcPos, tmp, destPos, length); return (new String(tmp).trim()); }
ccc04ecb-f66a-4edc-b123-1fd9691d2341
0
public void setDoubleOptin(boolean doubleOptin) { this.doubleOptin = doubleOptin; }
ca02e375-0ba7-4f9a-964b-8898a251ad5e
3
private void convertToUserTime(ArrayList result, double userTimeZone) { if (result == null) { return; } double resTimeZone = resource_.getResourceTimeZone(); long[] array = null; long from = 0; try { // convert the start time of a loc...
27989e48-3566-4c4c-9280-05ef821d5fd3
1
*/ protected void repaintProxyRow(Row row) { repaint(getRowBounds(row)); for (OutlineProxy proxy : mProxies) { proxy.repaintProxy(proxy.getRowBounds(row)); } }
3628dce9-d403-4af8-9016-3f26e67fa048
0
private void newTournButtonActionPerformed(java.awt.event.ActionEvent evt) { worlds = new ArrayList<>(); brains = new ArrayList<>(); }
d3198915-621a-444d-ade7-6209c168f334
2
public void create(String user, String host) throws JSchException{ try{ // RFC 1964 Oid krb5=new Oid("1.2.840.113554.1.2.2"); // Kerberos Principal Name Form Oid principalName=new Oid("1.2.840.113554.1.2.2.1"); GSSManager mgr=GSSManager.getInstance(); GSSCredential crd=null; ...
7d1f0f2e-ebda-4caf-8bc8-f5f7b9461061
5
private void onCommand(String cmd) { String[] parts = cmd.split(" "); if(parts.length < 1) { return; } switch(parts[0]) { case "/help": output.println("Available commands:"); output.println("/help"); output.println("/start"); output.println("/list"); output.println("/kick"); break;...
30d5eb19-2eb2-42f5-80ab-7ff3b8ed592a
3
private void initializeLanguageMenuSelection() { Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "initializeLanguageMenuSelection"); String languageWanted = PropertiesManager.getInstance().getKey("language"); if (languageWanted != null) { switc...
e3d82a38-9af8-4f39-923c-0dd53cdbe03d
1
public void setOptstring(String optstring) { if (optstring.length() == 0) optstring = " "; this.optstring = optstring; }
c93938e1-73f5-461b-99cd-f49d3bf51c86
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
5c568c45-4018-4b84-bc22-6df754b1d172
9
public void travelTo(double x1, double y1, int speed) { // instantiate variables double x0, y0; // current position double theta1; // new heading double forwardError; // distance from destination coordinates double[] displacementVector = new double[2]; // vector connecting actual // position to...
8809b816-f1a2-44fa-ac54-0389b2862b3a
8
private void runPPD(ATMCell cell){ boolean cellDropped = false; double dropProbability = 0.0; if (cell.getData().equals("")) { this.dropSamePacketCell = false; } if (this.dropSamePacketCell == false) { if (outputBuffer.size() > this.startDropAt) { if (outputBuffer.size() < this.maximumBufferCe...
1082360c-be1d-4714-9491-fccb32d5e58e
4
private void removePlayer(Player plr) { if(plr.Privatechat != 2) { //PM System for(int i = 1; i < maxPlayers; i++) { if (players[i] == null || players[i].isActive == false) continue; players[i].pmupdate(plr.playerId, 0); } } // anything can be done here like unlinking this player structure from any ...
f5accbd9-494b-412e-88bb-ace2b08923ba
3
public BufferedImage getEffectImage(){ if((int)animation == 3){ animation =0.0f; if(!isLooping){ stop =true; } } if(!stop){ img = animImages[(int)animation]; animation += 0.33f; return img; }else{ img = stoppedImg; return img; } }
e7470bf9-2067-4fe7-886e-bd6f0eba56a1
5
private Object getNextItem(Object component, Object item, boolean recursive) { if (!recursive) { return get(item, ":next"); } Object next = get(item, ":comp"); if ((next == null) || !getBoolean(item, "expanded", true)) { while ((item != component) && ((next = get(item, ":next")) == null)) { item = getPa...
241cbdfa-fc3d-433a-9624-c408335b9b6c
5
public void gfxAll(int id, int Y, int X) { for (Player p : server.playerHandler.players) { if(p != null) { client person = (client)p; if((person.playerName != null || person.playerName != "null")) { if(person.distanceToPoint(X, Y) <= 60) { person.stillgfx2(id, Y, X); } } } } }
2d805b5f-30d8-4091-8198-3be44713da4f
8
public Packet packet() throws IOException { if(eos) return(null); if(strm == null) { strm = new StreamState(); page = in.page(); strm.init(page.serialno()); } Packet pkt = new Packet(); while(true) { int ret = strm.packetout(pkt); if(ret < 0) throw(new OggException()); /* ? */ ...
cacf10a2-62c3-4a96-b998-948ff7a8eeeb
0
public CrossJoinIterable(Iterable<T> first, Iterable<TInner> second, Joint<T, TInner, TResult> joint) { this._first = first; this._second = second; this._joint = joint; }
efb249d2-947f-4b0c-8e68-2e67a9afb867
2
public void update(GameContainer container, int delta) { boolean isOn = InputChecker.isInputDown(container, KeyBindings.P1_INPUT); if (!eventList.isEmpty() && eventList.get(0).isOn() == isOn) { eventList.get(0).pushLength(delta); } else { eventList.add(0, new RhythmEvent(isOn, delta)); } }
8f645cef-2153-4b8d-975a-efdd6e9444d2
5
public eNfa(List<State> states, List<String> symbols, List<Transition> transitions, State startingState, List<State> acceptableStates) { super(states, symbols, transitions, startingState, acceptableStates); this.states = states; this.symbols = symbols; this.transitions = transitions; this.startingState = s...
76e41eab-eaac-4780-b3fc-587e83d61009
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Server other = (Server) obj; if (id != other.id) return false; return true; }
9dad0696-dc2a-4632-91d0-9b59470b31a0
4
public void insert(TemperatureStatus t) { Object[] args=new Object[2]; args[0]=t.pv; args[1]=""; if (t.cooling) args[1]="cooling"; if (t.heating) args[1]="heating"; if (t.heating && t.cooling) args[1]="heating,cooling"; String sql="replace into pv set pv=?,output=?"; tp.u...
abd584d5-9721-4009-bcf4-72c8fcd64c18
8
public Boolean updatePosition() { Boolean retour = true; // Choix de la nouvelle position Integer[] mvt = model.move(new Neighborhood(this)); // Definition des variables pour la nouvelle position Integer[] nextPos = new Integer[3]; nextPos[0] = line + mvt[0]; nextPos[1] = colonne + mvt[1]; nextPos[2]...
b07ab30e-855c-48cd-8d84-ba19b5fef488
5
private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed Convenio f = new Convenio(); if(!(txCodigo.getText().equals(""))||(txCodigo.getText().equals(null))){ f.setCodigo(Integer.parseInt(txCodigo.getText())); } ...
db5a02ea-3ae9-47bc-a83b-4bb1761ba6ad
7
private void setMinMaxPoints(List<Vector> points) { int minX = points.get(0).getBlockX(); int minY = points.get(0).getBlockY(); int minZ = points.get(0).getBlockZ(); int maxX = minX; int maxY = minY; int maxZ = minZ; for (Vector v : points) { int x = v.getBlockX(); int y = v.getBlockY(); int z =...
9abfcf57-06f3-4e10-aefa-30edba87b0e7
3
public static void computePaths(Vertex source) { source.setMinDistance(0.); // Using PriorityQueue class with minDistance as a priority (see the comparator of Vertex) PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>(); vertexQueue.add(source); while (!vertexQueue.isEmpty()) { Ve...
2563c696-ece5-4800-a856-2bde50bf6d95
2
public void initialize() { String parameter = this.getParamString(); if(parameter.equals("")){ if(Configuration.dimX < Configuration.dimY){ radius = Configuration.dimX / 3.0; } else{ radius = Configuration.dimY / 3.0; } } else{ radius = Double.parseDouble(parameter); } oneStep = 36...
09647b35-31ca-4c9b-bf52-32b1920f0477
7
@Override public void onTrackerStateChanged(int trackerState) { trackeStateOK = false; String errorMessage = ""; if (trackerState == 0) trackeStateOK = true; else if (trackerState == 1) errorMessage = "Device not connected."; else if (trackerState == 2) errorMessage = "A firmware updated is require...
8c38a1f5-639e-416f-92cf-1e58821b7e24
7
public String combineStr(REPrimitiveFragment frag) { String ret = "["; for(int i = 0; i < chars.length; i++) { if(chars[i] && frag.chars[i]) { if(i == 91 - 32 ) ret += "\\["; else if(i == 93 - 32) ret += "\\]"; else if(i == 94 - 32) ret += "\\^"; else if(i == 92 - 32) ret += "\\\\"; els...
c159ff22-2221-4259-bada-6ea1e08337ae
6
public boolean hasUnaryInput() { if (left instanceof LvalExpression && ((LvalExpression) left).hasUnaryInput()) { return true; } if (middle instanceof LvalExpression && ((LvalExpression) middle).hasUnaryInput()) { return true; } if (right instanceof LvalExpression && ((LvalExpress...
e9ebd51f-6610-4f80-9322-c41fe0014692
4
public void testGraphWithMatrix() { long[][] graph = {{0, 1, 7, 1000, 1000}, {1, 0, 1000, 4, 1}, {7, 1000, 0, 1, 1000}, {1000, 4, 1, 0, 1}, {1000, 1, 1000, 1, 0}}; long[][] paths = new long[5][5]; Floyd.calculate(graph, paths); for (int i = 0; i < graph.length; i++) { for (in...
2f4e3940-8423-4f2e-8350-2368f618ba0f
8
private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) { int penalty = 0; int numSameBitCells = 0; int prevBit = -1; // Horizontal mode: // for (int i = 0; i < matrix.height(); ++i) { // for (int j = 0; j < matrix.width(); ++j) { // int bit = ma...
d0095fc8-cced-4170-8d3f-da0223cd1d05
8
public static void main(final String args[]) { System.out.println("Starting launcher"); EventQueue.invokeLater(new Runnable() { public void run() { System.out.println("Creating new instance"); instance = new LauncherMain(); System.out.println("...
ba5dcba3-052f-451d-9054-60c014a2ad19
2
public static void main(String[] args) { Thread thread1 = new Thread(new Runnable() { @Override public void run() { for (int i = 0; i < 5; i++) { System.out.println("Hello: " + i + " Thread: " + Thread.currentThread().getName()); t...