method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
963afcf4-0c6d-45e7-b8d6-19c51a056148
6
private int locateSubToken( int mainTokenIndex, String tokenB, boolean caseSensitive ) { List<List<String>> sublist = this.params.get( mainTokenIndex ); for( int i = 0; i < sublist.size(); i++ ) { List<String> subsublist = sublist.get(i); //System.out.println( "subsublist["+mainTokenIndex+"]["+i+...
92e31881-d2db-4964-b206-368585544906
4
public static boolean isInBorder(Location center, Location l, int range) { int x = center.getBlockX(), z = center.getBlockZ(); int x1 = l.getBlockX(), z1 = l.getBlockZ(); if (x1 >= (x + range) || z1 >= (z + range) || x1 <= (x - range) || z1 <= (z - range)) { return false; } ...
00f0246c-1f7e-4e2b-8869-d7cf7ac586bc
7
void readFrequencies() throws Exception { int totalFrequencyCount = 0; while (true) { discardLinesUntilNonBlank(); int lineBaseFreqCount = totalFrequencyCount; ichNextParse = 16; int lineFreqCount; for (lineFreqCount = 0; lineFreqCount < 3; ++lineFreqCount) { float frequen...
c06b2cb1-daad-48b7-9304-a55f82389f62
9
void showdetail() { int max =0; ArrayList<Integer[]> scorelist0 = new ArrayList<Integer[]>(); ArrayList<Integer[]> scorelist1 = new ArrayList<Integer[]>(); for (int i=0; i<size*size-1; i++) { if (grid[i].value>max) { max = grid[i].value; ...
44d7fee7-c37d-4137-a410-b5d8d7d3c4eb
0
public boolean hasError() { return error; } // Used to check if there were errors parsing the file
7096879b-2a35-4816-b95f-90c02bdef6e9
0
public _5_Turtle(String name, Formatter f) { this.name = name; this.f = f; }
e923c930-e27d-4601-ac7c-21e90546367d
9
protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2) { super.renderEquippedItems(par1EntityLiving, par2); ItemStack var3 = par1EntityLiving.getHeldItem(); if (var3 != null) { GL11.glPushMatrix(); this.modelBipedMain.bipedRightArm.post...
f8ca7ec6-13af-4ece-ab72-bad044a9edb4
1
public static void insertAboveText(Node node, JoeTree tree, OutlineLayoutManager layout) { // Abort if node is not editable if (!node.isEditable()) { return; } Node newNode = new NodeImpl(tree,""); int newNodeIndex = node.currentIndex(); Node newNodeParent = node.getParent(); newNode.setDepth(nod...
ce443d59-ed22-45ea-aa27-b2018f4a50e2
6
public void addPoliceAtCanvasLocation(int canvasX, int canvasY) { // FIRST MAKE SURE THE ENTIRE INTERSECTION IS INSIDE THE LEVEL if ((canvasX - 17.5) < 0) return; if ((canvasY - 17.5) < 0) return; if ((canvasX + 17.5) > viewport.levelWidth) return; if ((canvasY + 17.5) > view...
efcd33f7-3a18-48da-9923-44c1801705a1
4
public final static boolean isWebAddress(String str) { for (String prefix : Arrays.asList(WEB_PREFIX)) { if (str != null && str.length() >= prefix.length() && str.toLowerCase().startsWith(prefix)) { return true; } } return false; }
b0e31901-1b6c-466f-9a9a-25b94ea1be8f
3
@Test public void testZipUnzipFolderContent(){ try { File testFolder = new File(this.getClass().getResource("/ziptest").toURI()); String testZipFilePath = testFolder.getParent()+ "/okapi.zip"; //Zip the content folder assertTrue(ZipUtils.zipFolder(testFolder, testZipFilePath)); File zippedFile = new F...
e8011c6d-8b5b-4c97-ba4f-a33f0a7c30f2
5
private final void method3712(Class318_Sub9_Sub2 class318_sub9_sub2, int i, int i_91_, int i_92_, int i_93_) { int i_94_ = ((Class318_Sub9_Sub2) class318_sub9_sub2).anInt8792; int i_95_ = i_93_; i_93_ <<= 1; if (i_94_ == -1) method3723(i, i_91_, i_92_, i_95_, ((Class318_Sub9_Sub2) class318_sub9_...
67d31395-1143-430e-8d77-f69d6fc8a65b
0
public <T2> Query<T2> ofType(final Class<T2> clazz) throws Exception { return this.where(new Predicate<T>(){ @Override public boolean evaluate(T obj) throws Exception { return clazz.isInstance(obj); }}).cast(clazz); }
428971a7-0531-45e4-afc1-55426333609c
4
double rate(Board board) { //count the holes and sum up the heights int mostHolesInAnyColumn = 0; for(int x=0; x<board.getWidth(); x++) { final int colHeight = board.getColumnHeight(x); int y = colHeight -2; int holes = 0; ...
75589163-0315-424a-9f60-558bff13a523
9
public void protokol(ServerClient activeclient) throws IOException { boolean shutdown = false; /** Determinates if the Client wants to disconnect */ while (!shutdown) { Msg nextCMD = activeclient.getSt().readMsg(activeclient.getClientsocket(), activeclient.getIn()); if (nextCMD.getId() == 'b') //// Bro...
b79a541f-ec89-481c-a357-7a94df1ef134
5
public void save(File target) throws IOException, Exception { try { connection.close(); } catch(Exception e) { throw new Exception(Localization.getInstance().get("databaseReleaseExceptionMessage") + " " + e); } if (Files.exists(target.toPath())) { try { Files.delete(target.toPath()); } catch (IO...
8bc419c1-55f6-43d7-9b2d-6ff8d962c3dd
0
@Basic @Column(name = "PRP_CANTIDAD") public Integer getPrpCantidad() { return prpCantidad; }
a39e2127-10c3-4283-8d52-bcb2b2cf65af
3
@Override public boolean riseLotPrice(Lot lot, User user, int newPrice) { long requestId = this.findFreeKey(this.riseLotPriceStatuses); MsgRiseLotPrice msg = new MsgRiseLotPrice(this.address, this.ms.getAddressService().getAccountService(),requestId,lot,user,newPrice); this.riseLotPriceStatu...
33f17a36-218b-4101-9207-68964e27c2c8
5
public static int getPlayersCountInRadius(int range, L2Character npc, boolean invisible) { int count = 0; for (L2PcInstance player : npc.getKnownList().getKnownType(L2PcInstance.class)) { if (player.isDead()) continue; if (!invisible && player.getAppearance().getInvisible()) continue; if...
a2e361f4-7f05-4b29-ace0-e8d8487ca5fc
3
private void addc(boolean left, String c) { int l = value.length(); int n = fsize-l; if(n>0) { String s = new String(new char[n]).replace("\0", c); value = (left ? s+value : value+s); } else if(n<0) value=value.substring(-n); }
e43331d9-873c-455e-8efc-5c8804d0976a
8
public int fightAgainst(SunburnShip enemy) { int roundCount = 1; Logger logger = Logger.getLogger(SunburnShip.class.getName()); while(!isDestroyed() && !enemy.isDestroyed() && drivesLeft() && enemy.drivesLeft()) { if(roundCount > 100) { logger.info("...
40116c2b-df48-4197-812c-726a28e42dae
2
@Override public Champion getElementAt (int i) { if (getSize() == 0) return null; return (filter != null) ? source.getElementAt (displayedElements.get (i)) : source.getElementAt (i); }
7088c391-9872-4cf8-a9b7-c2558f61f995
6
private boolean loop(){ try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } if(socket.isConnected()){ return true; }else{ return false; } }
06dd5de5-b53d-4748-8d29-d8585a075e08
0
@Override public void connecter() throws ClassNotFoundException, SQLException { Class.forName(this.getPiloteJdbc()); setConnexion(DriverManager.getConnection(this.getProtocoleJdbc() + this.getServeurBd() + this.getNomBd(), this.getLoginSgbd(), this.getMdpSgbd())); getConnexion().setAutoCommi...
8be870dc-35cb-4577-b414-6893fdf91312
4
public void setJointAnimation( String jointName, String animName, float progress ) { final int jID = model.jointID(jointName) ; if (jID == -1) return ;// I.complain("No Such Joint: "+jointName) ; final Model.AnimRange range = rangeFor(animName) ; if (range == null) return ;// I.complain("No such a...
2317d8af-b774-4bbb-a5aa-ce67fc39bc06
3
private JTable buildTable() { String[] columnNames = { "Count #", "min [s]", "max [s]", "total [s]", "avg [s]", "funktion" }; List<Object[]> dataList = new ArrayList<Object[]>(); int columnWitdh = 0; for (String key : profileLogParser.getMap().keySet()) { ProfileStatistic profileStatistic = profileLogP...
0b748a21-8529-496a-af04-5bf1484d5e60
0
public void setOutputNeuron(Neuron n) { outputNeuron = n; }
8e0411ec-c0f6-4f34-9aeb-f7107975183f
6
public void setActions(Action add, Action remove, Action update) { if (addAction != null) addButton.removeActionListener(addAction); if (removeAction != null) removeButton.removeActionListener(removeAction); if (updateAction != null) { addButton.removeAction...
084da516-f71c-461f-b90c-067fb1a8bf35
6
private void mergeAsTable( FragList fl, ArrayList<Version> sigla, ArrayList<Group> groups, BitSet constraint ) throws Exception { BitSet bs1 = getShared(); bs1.and( constraint ); BitSet bs2 = fl.getShared(); bs2.and( constraint ); Utils.ensureExclusivity( bs1, bs2 );...
5bb9b14a-7efc-43e1-a674-ce55b73a915a
5
public int jump(int[] A) { if (A.length <= 1) return 0; int[] f = new int[A.length]; f[0] = 0; f[1] = A[0]; int t = 1; int j = 0; while (f[t] < A.length - 1) { t++; f[t] = f[t - 1] + A[f[t - 1]]; int i = j + 1; while (i <= f[t - 1] && f[t] < A.length - 1) { if (A[i] + i > f[t]) ...
8b5df7b3-5377-4d5f-aa52-9d6b8e9cf704
1
private void updatePersonalBest(int row){ for(int k = 0; k < position[row].length; k++){ personalBest[row][k] = position[row][k]; } }
7e8ce904-3416-4d96-963b-977aac0030e8
4
public Matrix timesbyelement(Matrix B) { Matrix A = this; if (A.M != B.M && A.N != B.N) { throw new RuntimeException("Unable to do element matrix multiplication."); } Matrix C = new Matrix(A.M, A.N); for (int i = 0; i < C.M; i++) { for (int j = 0; j < C.N;...
0e76793a-9b33-4251-b20a-17f0eb3548a8
2
public void render(Graphics2D g) { if (!alive) { return; } Image sprite = ResourceResolver.getResourceResolver().resolveResource("/player.png"); AffineTransform af = new AffineTransform(); af.rotate(getDirection(), getWidth() / 2, getHeight() / 2); af.transla...
82b79849-b83e-403a-9c91-8d58665af064
3
public static void rename(String oldname, String newname) { try { File file = new File(oldname); if (!file.exists()) { throw new FileNotFoundException("the old file is not exist!"); } File newFile = new File(newname); if (newFile.exists()) { throw new IllegalStateException("the new file is ex...
27998da0-a5f6-46bf-90ab-f411af88efaf
5
public BinaryNode getSuccessor() { if(hasChildren()){ if(getLeft() == null && getRight() != null) return getRight(); else if(getLeft() != null && getRight() == null) return getLeft(); else // the two children case return getRight().getLeftmostNode(); } return null; }
9a5ac5f5-bbf6-41c9-a194-d40ced1904d0
4
protected void mainTimer() { if (hasSomebodyWon()) { somebodyWon(); } updatePowerUps(); updateBall(); updatePaddles(); if (isBlackHole) { ball.useGravity(blackHole); for (PowerUp p : powerUpList) { p.useGravity(blackHo...
c6a89f6f-2ee8-40d5-b204-21c3e2e9e1bc
2
@Override public ArrayList<Object> show(int id) { conn = new SQLconnect().getConnection(); ArrayList<Object> tns = new ArrayList<Object>(); try { String sql = "select * from timenodes where display = 'true' and time_owner = " + id; Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的St...
555519b3-ef3a-44fc-bea1-89b52790f773
4
public FileAttribute(String fileName, int fileSize) throws ParameterException { // check for errors in the input if (fileName == null || fileName.length() == 0) { throw new ParameterException( "FileAttribute(): Error - invalid file name."); ...
9b9ed5e1-7e52-4cf5-b51a-4df9dcae0eea
1
public static float dot(float[] a, float[] b){ float val = 0; for (int i = 0 ; i < a.length; i++){ val += a[i] * b[i]; } return val; }
ad28dd2e-457a-4a49-b5fc-089782be29d5
5
@Override /* * (non-Javadoc) * @see java.lang.Runnable#run() */ public void run() { while (true) { try { Order deliverOrder= this._deliverBlockingQueue.take(); if (deliverOrder == Management.cyanide) break; logAsBeingDelivered(deliverOrder.getID()); long timeToDeliverOneWay= calculateD...
664e984c-3a16-4059-ac72-be6087b0c44a
6
public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); double[] x = new double[func.length]; //Начальное приближение System.out.println("Введите x0:"); for (int i = 0; i < x.length; i++) { ...
f2f52cb1-1d96-4e31-9133-7e4f74f64653
4
public int countClasses(int depth, String packageName) { if (depth++ >= MAX_PACKAGE_LEVEL) return 0; int number = 0; String prefix = packageName.length() == 0 ? "" : packageName + "."; Enumeration enum__ = ClassInfo.getClassesAndPackages(packageName); while (enum__.hasMoreElements()) { // insert sorted ...
c4254df6-1b46-485b-aa99-db6bd2b878c6
0
private void connectToServer(final ChannelHandler sendRequest) throws Exception { // 这个代码是从Netty官网抄来的,暂时还不知道为什么要这么做! ChannelFactory factory = new NioClientSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()); ClientBootstrap bootstrap = new ClientBootstrap(fac...
ea266eec-af8b-466c-ab94-dffb654ee684
7
private Element recursiveParse(Layer l, Element currentParent) throws Exception { // parent of current layer Element e = parseLayer(l); LinkedList<Element> children = new LinkedList<Element>(); document.addCSSLine(e.getSelector()); for(int x = 0; x < l.getLayersCount(); x++) { // traverse children ...
6e8e851c-575b-4c42-83e5-a434d92ffec4
6
public void draw() { Zen.drawText(name, x-10, y-15); Zen.setColor(0, 0, 155); if (direction == 0 || direction == 2) Zen.fillRect(x-10, y-15, 20, 30); else Zen.fillRect(x-15, y-10, 30, 20); Zen.setColor(0,0,0); if(direction ==0 || direction ==2) Zen.fillRect(x-2, y-(2-direction)*10, 4, 20); if(direction ==1...
2962385b-3f53-403b-b1a4-6957c3dafd53
3
public static Announcement getAnnouncementByXMLElem(XMLElement root) { String title = new String("Untitled"); String content = new String("This announcement has no content."); for (int i = 0; i < root.childList.size(); i++) { XMLElement elem = root.childList.get(i); if (elem.name.equals("title")) { titl...
4396f7fc-a4c5-4bfb-bd77-95ffecf6fff1
2
public int Minimum(TreeNode root){ if(root == null) return -1; TreeNode current = root; while(current.left != null){ current = current.left; } return current.val; }
d67d79a3-b029-4242-981a-4a9ad0344788
9
private void calculateLowerTotal() { int lowerTotal = 0; for (ScoreCardCategories d: ScoreCardCategories.values()) { if (d==ScoreCardCategories.THREEOFAKIND || d==ScoreCardCategories.FOUROFAKIND ||d == ScoreCardCategories.FULLHOUSE || d==ScoreCardCategories.SMALLSTRAIGHT || d==ScoreCardCategories.LARGESTRAIGHT |...
1d26fa7a-11b8-400a-b9b5-35c5988c53b6
6
public void handleInput() { if (Keys.isPressed(Keys.ESCAPE)) gsm.setPaused(true); if (player.getHealth() == 0) return; player.setUp(Keys.keyState[Keys.UP]); player.setDown(Keys.keyState[Keys.DOWN]); player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]); player.setRight(Keys.keyState[Keys.R...
de5b6173-ab30-4aba-90b3-a2440c0f0d61
7
private void setDataBasedOnTag(String part, SimFile accumulator) { switch (getTag(part)) { case "#TITLE": accumulator.setTitle(stripTag(part)); break; case "#SUBTITLE": accumulator.setSubtitle(stripTag(part)); break; case "#ARTIST": accumulator.setArtist(stripTag(part)); break; case "#CREDIT...
c815f15a-cfa1-4626-b77d-02df28b8bd32
5
public void setUsersOnTask() { for (int i = 0; i < tasks.size(); i++) { for (int j = 0; j < tsotList.size(); j++) { if (tasks.get(i).getTaskID() == tsotList.get(j).getTaskID()) { // Run through userList to find the userObject for (int k = 0; k ...
37300d35-7ee5-41a9-b50a-474b7b4cb493
1
public void Update(int DELTA , int xOffset , int yOffset) { for(int i = 0 ; i < this.tileSet.size() ; i++ ) { this.tileSet.get(i).update(DELTA); } this.xOffset = xOffset; this.yOffset = yOffset; }
b522d2d0-10e6-4bea-80bd-8717983b423c
2
public int connectRopes(int[] ropePieces){ List<Integer> unsortedList = new ArrayList<Integer>(); for(int i=0; i<ropePieces.length; i++){ unsortedList.add(ropePieces[i]); } //Sort lengths is ascending order Collections.sort(unsortedList); int cost = 0; while(unsortedList.size() > 1){ int combinedRop...
743cacf1-fe1d-4c2d-908a-70efc4f606a3
3
@Override public boolean accept(File f){ if (f.isDirectory()) return true; if (f.getName().endsWith(".xml") || (f.getName().endsWith(".jff"))) return true; return false; }
7ea993bf-4576-4433-85d8-b52186bd4c49
7
public void onEnable() { YamlConfiguration config = (YamlConfiguration) this.getConfig(); PluginDescriptionFile pdfFile = this.getDescription(); //Write the default configuration stored new File(maindir).mkdir(); createDefaultConfiguration("config.yml"); String channelName = config.getString("channel", "...
0c741605-4f73-4b0f-9589-b537b5fcdda1
6
public void initFromXML( Element node, String workDir, String projectDir ) { clear(); NodeList nList = node.getElementsByTagName("default") ; TLanguageFile dummy ; // default entry found if (nList != null) { if (nList.getLength() > 0) { dummy = initSingle( (Element) nList...
d59ad62a-b64a-4384-81d1-160c40f6f1cf
4
private String diager(int pointer) { String diag = ""; switch (pointer) { case 0: { for (int i = 0; i < EngineField.sizeField; i++) { diag = diag + EngineField.f1.get(EngineField.sizeField - 1 - i).get(i); } break; ...
9280e49b-dd2b-4074-b1a8-d7bb5914dc83
1
public void Traversal(TreeNode root, Vector<Integer> v){ if(root == null) return; else{ Traversal(root.left,v); v.add(root.val); Traversal(root.right,v); } }
fb6c2f2a-a671-4c27-b9b9-1bc21bfb9f31
0
protected String[] getViewChoices() { return new String[] { "Noninverted Tree", "Derivation Table" }; }
c2e90750-bf7c-4dee-b2cb-4a6335c503a3
0
public PdbSPReaderWriter () { super() ; // in case we ever do native interface code to hide some details .... // if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbSPReaderWriter:constructor:DLL is loaded? " + bNativeInterfaceCodeLoaded); } // if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\t...
875f5b5c-3f32-421b-b3d9-e21218149579
1
public static final String getPropertyOrEnvironmentSetting(String key) { String value = System.getProperty(key); if (value == null) { value = System.getenv(key); } return value; }
9b226709-9695-46b3-945b-fbb5ab5ac92d
4
@RequestMapping(method = RequestMethod.GET) public ModelAndView indexView(HttpServletRequest paramHttpServletRequest, @RequestParam(value = "success", required=false) Boolean successRedirectAttr) { ModelAndView modelAndView = new ModelAndView(); if (isAuthenticated(paramHttpServletRequest)) { modelAndView.a...
5cbad02b-b365-464c-9d80-cf035e76a12b
7
public double minDataDLIfDeleted(int index, double expFPRate, boolean checkErr){ //System.out.println("!!!Enter without: "); double[] rulesetStat = new double[6]; // Stats of ruleset if deleted int more = m_Ruleset.size() - 1 - index; // How many rules after? FastVector indexPlus = new FastVector...
60e350b6-2443-421d-8ceb-e7b086c436d6
8
public void compAi(int battle) { if (battle == 1) { ai = r.nextInt(2); } if (GameFile.enemy1MoveSet[ai].equals("Tackle")) { // Changed base atk of tackle from 50 to 40 enemyAtkPower = 40; enemyAtkType = "Normal"; } else if (GameFile.enemy1MoveSet[ai].equals("Growl") || GameFile.enemy1MoveSet[a...
7b009587-a949-4aeb-b7fb-24c6a4c51115
2
public void ClientDisconnected(int clientId) { gameController.Print("Server: Client " + clientId + " has been Disconnected."); for(int i = 0; i < clientFramework.size(); i++) { if(clientFramework.get(i).clientId == clientId) { clientFramework.remove(clientId); } } }
36dd4318-ecef-4504-8571-c186f438c6c3
9
private ArrayList<StringResource> createStringResources(File file) { try { FileInputStream fis = new FileInputStream(file); XSSFWorkbook wb = new XSSFWorkbook(fis); Sheet sheet = wb.getSheetAt(0); ArrayList<StringResource> stringResources = new ArrayList<StringResource>(); boolean headersRead = false;...
392eba2b-cb38-4066-b555-56932d227ca8
5
private Object handleData(Object tos) { if (tos instanceof Generator && ((Generator)tos).getGeneratorData() == null) { GeneratorData generatorData = new GeneratorData(); ((Generator)tos).setGeneratorData(generatorData); return generatorData; } else if (tos instanceof SourceC...
a4726cd0-4e42-4322-8ffb-a9aa0860007a
7
private void destroyPlayer(Player pl) { //destroy players if (!pl.living) return; if (x > pl.x - BOX_SIZE * 2 + 5 && x < pl.x + BOX_SIZE * 2 - 5 && pl.y == y) { pl.die(); return; } if (y > pl.y - BOX_SIZE * 2 + 5 && y < pl.y + BOX_SIZE * 2 - 5 && pl.x == ...
ec51c34d-a88b-4988-b9c6-a88d9b13c30e
3
public static Direction getRandom() { double d = Math.random(); if (d > 0.75) return NORTH; else if (d > 0.5) return SOUTH; else if (d > 0.25) return EAST; else return WEST; }
0e2a573b-5958-45fd-a8c5-6c9cdbbd140a
4
static public OutputChannels fromInt(int code) { switch (code) { case LEFT_CHANNEL: return LEFT; case RIGHT_CHANNEL: return RIGHT; case BOTH_CHANNELS: return BOTH; case DOWNMIX_CHANNELS: return DOWNMIX; default: throw new IllegalArgumentException("Invalid channel code: "+code); } }
3cadca17-3671-4b57-8091-60fcb69b38fc
8
public void newlotcreatorforl3(int lotno){ boolean val = true; while(val){ int what=0; System.out.println("what do you want to do?"); System.out.println("1)Add new car"); System.out.println("2)add new car at some specific position"); System.out.println("3)remove car"); System.out.println("4)get number o...
fcc42e1a-fae5-449e-964b-224f5427e146
6
public DefaultListCellRenderer createListCellRenderer(final Class classe, final String metodo) { DefaultListCellRenderer dlcr = new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSele...
e7ee6b8b-8c6c-48f8-9fca-423d3c9fdb3c
8
@SuppressWarnings("unchecked") private void writeToAnyColumnField(Field field, T object, Cell cell, String columnName) { try { field.setAccessible(true); Object value = readValueFromCell(cell); if (value != null) { AnyColumn annotation = field.getAnnotation(AnyColumn.class); if (...
fe74d8d5-02ef-4e6c-bfa4-bfa63f8adf1d
6
public void keyPressed(KeyEvent e) { // stage 5 if (e.getKeyChar() == 'N' || e.getKeyChar() == 'n') reset(); // stage 10 if (e.getKeyChar() == 's' || e.getKeyChar() == 'S') writeToFile(); // stage 11 if (e.getKeyChar() == 'l' || e.getKeyChar() == 'L') loadFromFile(); repaint(); }
ca8c4f4c-d75b-4d7d-862b-515200ed5eff
8
public void update() { switch (status) { case GOING: changeSpeed(); move(direction); if (hasArrived()) { stop(); setPosition(route.getEndRoute().getPosition()); setStatus(TransportStatus.DELIV...
18ce55a8-a9fd-41d2-a567-0708213ba91e
5
public void sortDyes(){ Vector<DyeParent> newDyes=new Vector<DyeParent>(); Vector<DyeParent> newLakks =new Vector<DyeParent>(); Vector<DyeParent> newMetals=new Vector<DyeParent>(); Vector<DyeParent> newFluos=new Vector<DyeParent>(); for(int i=0;i<PPC.calcObj.getAllDyeTypes().siz...
8968c271-32f4-4e7b-8663-bab63604e97b
7
public static String doHttpRequest(String uri, Cons options) { { PropertyList proplist = Stella_Object.vetOptions(options, Stella.getQuotedTree("((:METHOD :HEADERS :CONTENT) \"/HTTP\")", "/HTTP")); Keyword method = ((Keyword)(proplist.lookupWithDefault(Http.KWD_METHOD, Http.KWD_GET))); Dictionary header...
2d572c1d-c74c-4676-8ee4-dff0c513f86f
8
public final void createNewPopulation() { ArrayList<Chromosome> newPopulation = new ArrayList<Chromosome>(); //setupRouletteWheel(); for(int i = 0; i < populationSize / 2; i++) { Chromosome firstParent = selectParentTournament(); Chromosome secondParent = selectP...
2a95d212-45a3-4040-a61b-1f55f53671b8
0
public void setInjector( Injector injector ) { this.injector = injector; }
4fca5835-2ccc-40a0-845c-b9f2c4b522bf
2
@Test public void insertTest(){ long start = System.currentTimeMillis(); for (int i = 0; i < 100000; i++){ heap.insert(i); } long end = System.currentTimeMillis(); System.out.println("Time spent inserting 100 000: " + (end-start)*1.0 + "ms."); lo...
027a41da-3fb8-479f-b44b-fcbe81038887
7
public Wave34(){ super(); MobBuilder m = super.mobBuilder; for(int i = 0; i < 1500; i++){ if(i % 17 == 0) add(m.buildMob(MobID.TENTACRUEL)); else if(i % 6 == 0) add(m.buildMob(MobID.HORSEA)); else if(i % 5 == 0) add(m.buildMob(MobID.TENTACOOL)); else if(i % 4 == 0) add(m.buildMob(MobID...
a0779ce3-5630-4b36-a290-00d8c02e0a19
4
public Player getPlayer1() { boolean test = false; if (test || m_test) { System.out.println("FileManager :: getPlayer1() BEGIN"); } if (test || m_test) { System.out.println("FileManager :: getPlayer1() END"); } return m_player1; }
daf407f1-b543-4a38-b7e9-15c3d062a3cb
6
public int findHoleNum(){ int holes = 0; for(int col = 0; col<board.getWidth(); col++){ int lowestRowFilled = 20; for(int row = board.getLength()-1; row>=0; row--){ if(board.getValue(row, col)!=0){ if(row<lowestRowFilled){ lowestRowFilled = row; } } } for(int row = board.getLengt...
82613656-f4e4-4a52-b751-ff68a1d7003c
4
public void render() { final boolean isLightingEnabled = glIsEnabled(GL_LIGHTING); if (isLightingEnabled) glDisable(GL_LIGHTING); for (Text t : texts) { final float alpha = t.isDoFade() ? ((float) t.getLife() - (float) t .getAge()) / (float) t.getLife() : 1.0f; glColor4f(1.0f, 1.0f, 1.0f, alpha); ...
d4944ffb-b6f2-404b-a584-351e7f9de057
0
public void glSetup2D() { initGL(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0, this.window.getOrthoWidth(), this.window.getOrthoHeight(), 0.0, orthoZNear, orthoZFar); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT |...
e0573679-3232-40e3-b02e-70c1f10e0c7e
7
@Override @SuppressWarnings({ "unchecked", "nls" }) protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder enc) { // Call the initialization of the super type super.initialize(type, oldInstance, newInstance, enc); Map map = (Map) oldInstance; Set keySet = map.keySet();...
0ba12545-ad35-46de-a1b3-5fdd7020f0b5
4
static public OutputChannels fromInt(int code) { switch (code) { case LEFT_CHANNEL: return LEFT; case RIGHT_CHANNEL: return RIGHT; case BOTH_CHANNELS: return BOTH; case DOWNMIX_CHANNELS: return DOWNMIX; default: throw new IllegalArgumentException("Invalid channel code: "+code); } }
eec901bb-d83a-4cc0-b560-521fd8322fb9
7
public boolean fireballCollideCheck(Fireball fireball) { if (deadTime != 0) return false; float xD = fireball.x - x; float yD = fireball.y - y; if (xD > -16 && xD < 16) { if (yD > -height && yD < fireball.height) { if (facing!=0) retu...
4fae9310-a055-424e-972d-0c96c91597a7
4
@Override public int compareTo(Individual o) { if (o == null) { throw new NullPointerException("o can't be null"); } if (this == o) { return 0; } if (this.getEvaluation() > o.getEvaluation()) { return 1; } else if (this.getEvaluati...
c9277492-09ee-4749-a0a0-5bca4fdc2fb4
4
public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch...
6b0be8ba-da85-41ca-9f41-f879bf3cd40f
0
public void exitFunction() { environmentStack.pop(); }
26bfa7c2-8654-4258-9846-3150ecb600ad
7
public ArrayList<LinkedList<BTnode>> printLevel() { int level = 0; int i; BTnode temp; ArrayList<LinkedList<BTnode>> result = new ArrayList<LinkedList<BTnode>>(); LinkedList<BTnode> list = new LinkedList<BTnode>(); if(root == null) { return result; } list.add(root); result.add(level, l...
9030a76a-2d19-4ac0-bcd7-8f3475b465a3
7
@Override public Success<Statement> parse(String s, int p) { // Parse the type. Success<Type> resType = TypeParser.singleton.parse(s, p); if (resType == null) return null; p = resType.rem; p = optWS(s, p); // Parse each name=expression pair. (Some express...
651eb546-af3e-4aeb-b8ca-b1943e45f340
0
@BeforeClass public static void setUpClass() { }
0660ac81-0591-47a8-91c6-227cbef0e43a
8
@Override public void executeMsg(Environmental host, CMMsg msg) { if(host instanceof MOB) { final MOB myChar=(MOB)host; if(msg.amISource(myChar) &&(msg.tool() instanceof Ability) &&(!myChar.isMonster()) &&(msg.sourceMinor()==CMMsg.TYP_PREINVOKE) &&(myChar.isMine(msg.tool())) &&(myChar.charSta...
1a1c2e06-aee8-4034-b95b-392fd5d56d0b
7
private static int count(int[][] A){ if(A.length % 2 != 0) return A.length; if(A.length == 1) return 1; for(int i=0;i<A.length/2;i++){ for(int j=0;j<A[0].length;j++){ if(A[i][j] != A[A.length-1-i][j]) return A.length; } } int[][] a = new int[A.length/2][A[0].length]; for(int i=0;i<A.length/2;i+...
a65690d5-a4f3-41e4-99d8-0a08f7d20ba6
7
public static String Salaus(String s) { int indeksi = 0; char kirjain = ' '; String hexString = ""; for (int i = 0; i < s.length(); i++) { kirjain = s.charAt(i); indeksi = k.indexOf(kirjain); if (kirjain == '!' || kirjain == '.' || kirjain == ',' || ...
f3fc8687-d3fd-43f2-bf37-da8a4adb89fb
3
public long theMinCars(int treeHeight) { long a[] = new long[treeHeight + 2]; a[0] = 1; a[1] = 1; if(treeHeight == 0||treeHeight == 1){ return a[treeHeight]; } for(int i = 2;i <= treeHeight;i++){ a[i] = a[i - 1] + 2 * a[i - 2]; } return a[treeHeight]; }
cc976edb-23f5-4b4c-aebb-ff186683138b
8
protected static List<ItemCraftor> getCraftingSkills() { if(craftingSkills.size()==0) { final Vector<Ability> V=new Vector<Ability>(); for(final Enumeration<Ability> e=CMClass.abilities();e.hasMoreElements();) { final Ability A=e.nextElement(); if(A instanceof ItemCraftor) V.addElement((ItemC...
c7bff3eb-82cc-4cc9-9b73-4b97d7ad3ffa
4
public void saveCurrentScoreBoard() throws IOException{ //Carregando o Score Table do arquivo: File temp = null; try{ temp = new File("ScoreBoard.txt"); //Se o arquivo não existe, criando o mesmo: if(temp.exists()){ //Apagando...