method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
23f40a4b-0815-444f-81ab-73821a04ea6a
5
public CheckResultMessage checkF01(int day) { int r1 = get(20, 5); int c1 = get(21, 5); int r2 = get(27, 5); int c2 = get(28, 5); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (0 != getValue(r1, c1 + day, 5).compareTo( ...
0a4b3d1d-18b3-4b93-bd49-a07eb8a640aa
8
public LsCommand execute() throws IOException { Path path = Paths.get(ls.getPath()); LsVisitor visitor = new LsVisitor(path, ls.getGlob()); Files.walkFileTree(path, Collections.EMPTY_SET, ls.getDepth(), visitor); this.listing = visitor.getListing(); // sort listing if(l...
4bb28f16-72a2-469c-b352-93c422828644
4
public boolean canMove(){ int rangee = -1; for(boolean bool[] : tetrominoes.get(tetrominoes.size()-1).getEmplacement().getCoordoneeJeu()){ rangee++; for(int x=0; x< coordonneJeu.getNombreColonne(); x++) if(true==bool[x]&& bool[x]== !coordonneJeu.IsEmpty(x, rangee)...
a4ee574d-f5f3-4b34-b83a-8233eebaa1c0
1
private void pause() { fallTimer.stop(); paused = true; this.add(resumeButton); this.remove(gameGrid); this.remove(holdGrid); for (int i = 0; i < QUEUE_SIZE; ++i) { this.remove(inQueueGrid[i]); } repaintGrid(); this.add(resumeButton); }
25a1c4fc-7b99-41cb-acab-e07f82b31a52
3
Manager() { LOGGER.log(Level.INFO, "Loading profiles."); profiles = FrolfUtil.loadProfiles(); currentProfile = null; try { LOGGER.log(Level.INFO, "Loading courses."); courses = FrolfUtil.loadCourseCatalog(); LOGGER.log(Level.INFO, "Loading discs."); discs = FrolfUtil.loadDisc...
48ca9523-596b-4b43-962c-73325cc65057
9
public static void main(String[] args) { // First we set up the BasicDataSource. // Normally this would be handled auto-magically by // an external configuration, but in this example we'll // do it manually. // System.out.println("Setting up data source."); DataSo...
13969357-9eea-4240-ab42-146a69b64068
6
private void onLeftReleased(){ if(selectedNode == null){ for(Node node : this.getNodes()){ double radiusSquared = node.size * node.size, dx = mouseX - node.position.x, dy = mouseY - node.position.y, distSquared; distSquared = dx * dx + dy * dy; if(distSquared <= radiusSquared){ selecte...
92b7f3b8-be85-4c75-a154-df081fcb6761
9
public void printTopWords(int k, String betaFile) { double loglikelihood = calculate_log_likelihood(); System.out.format("Final Log Likelihood %.3f\t", loglikelihood); String filePrefix = betaFile.replace("topWords.txt", ""); debugOutput(filePrefix); Arrays.fill(m_sstat, 0); System.out.println("print to...
c64e498c-8e39-4474-9b0f-9217a77ac9c5
0
public static Language getInstance() { return language; }
b8ba2874-d04a-40d3-8c96-e7f53bb800bd
0
@Override protected void fireEditingStopped() { super.fireEditingStopped(); }
9fde7372-fb27-4a04-9040-4ca387bc926c
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 72 // do, line 74 v_1 = cursor; lab0: do { // call mark_regions, line 74 if (!r_mark_regions()) { break lab0; } } while (false); cursor = v_1; // backwards, line 75 limit_backward = cursor; cursor = limit; //...
b73bf825-2080-4054-ba14-fbfc909fa5ce
0
public double getBalance(){ return this.balance; }
20771b71-936f-4b5d-9091-978cfdfe8963
1
public synchronized void open(Decoder decoder) throws JavaLayerException { if (!isOpen()) { this.decoder = decoder; openImpl(); setOpen(true); } }
9baada25-9e9b-4d31-9a03-8bd1d2e89300
2
public final String getCancelView() { // Default to successView if cancelView is invalid if (this.cancelView == null || this.cancelView.length() == 0) { return getSuccessView(); } return this.cancelView; }
e31c9a3a-91bd-4740-80b8-c7f1a89cd548
3
public static String multiLineToolTip(int len, String input) { String s = ""; int length = len; if (input == null) return ""; if (input.length() < length) return input; int i = 0; int lastSpace = 0; while (i + length < input.length()) { String temp = input.substring(i, i + length); lastSpace...
024cb234-8f75-463c-b5e4-481b20ce920a
3
public ArrayList<Assessoria> consultar(String id){ ArrayList<Assessoria> ass = new ArrayList<>(); try { if(id.equals("")){ sql="SELECT * FROM tb_assessoria;"; }else{ sql="SELECT * FROM tb_assessoria WHERE cod = '"+id+"';"; ...
36d6db5c-8c19-46b6-a695-5a7bcecd9537
9
public static void gerarArquivoRedeNeural(String nome, MultiLayerPerceptron rna, Double[] entradas) { try { FileWriter fileWriter = new FileWriter(nome); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); double discretizacao = 0.05; for (int i = 0; i < 20; i++) { rna.inicializarPesos...
8dfd438e-1e29-439d-8389-c289f0ce314d
1
public void play() { try { new Thread() { public void run() { clip.setFramePosition(0); clip.start(); } }.start(); } catch (Throwable e) { e.printStackTrace(); } }
9827a1b1-524a-48cc-a25f-af0d4ebead2c
6
@EventHandler public void IronGolemResistance(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.getIronGolemConfig().getDouble("IronG...
b72efdd5-a40b-4781-b736-69b995388cce
2
private void createFile(){ if ((nameTextField != null) && (pathFileTextField != null)){ algorythmFile = new AlgorythmFile( nameTextField.getText(), algoTypeComboBox.getSelectedItem().toString(), file ...
52af5a7b-0ebb-44f0-9e8b-297d5de7c583
8
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!par1World.isRemote) { if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) { par1World....
ae34acc8-99c9-46a1-b749-b02c9a4b2653
8
int classend(int poffset) { switch (p.luaByte(poffset++)) { case L_ESC: if (poffset == p.length()) { error("malformed pattern (ends with %)"); } return poffset + 1; case '[': if (p.luaByte(poffset) == '^') poffset++; do { if (poffset == p.length()) { error("malformed p...
ea68f1a7-9d16-42ce-986f-2bc6467006d0
3
public String Imprimir() { String impresion=""; for (int i=0; i < matriz.length; i++) { for (int j =0; j < matriz[0].length; j++) { if(i==j) { impresion +="X"; } else { ...
ef808f9c-2be4-4104-8469-9abed592b8a0
5
@Test public void evaluatePostfix6() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException { try { String whatItStartsAs = "23+59+2/3++952+-89*-+"; postfix.addLast("5"); postfix.addLast("9"); postfix.addLast("+"); ...
dda9f3b0-db52-41fb-b6eb-a0e82c197c5a
7
public int partition(T[] data, int length, int start, int end) { // TODO Auto-generated method stub if(data == null || length <=0 || start < 0 || end >= length){ throw new IndexOutOfBoundsException("argument error!"); } Random r = new Random(); //nextInt(0,n+1) create an int in [0, n+1) == [0, n]; int in...
c98db337-578e-4de5-a5b7-3b3c645a4955
1
public static void main(String[] args) { int length = Integer.parseInt(JOptionPane.showInputDialog("Input the Number (2k - 1)")); int intArray[][] = new int[length][length]; if (length % 2 != 0) { makeArray(intArray); JOptionPane.showMessageDialog(null, "Take a look at th...
7a831d3b-a617-4a71-a383-f3e508d031e8
0
public static void main(String[] args) { MyTargetTest myTarget = new MyTargetTest(); myTarget.target(); }
4bce0817-5a8c-40a9-bafc-c605add16047
8
public static synchronized String checkOneLink(URL linkURL) { // System.out.printf("LinkChecker.checkLink(%s)%n", linkURL); try { final String canonURLString = uc.canonicalize(linkURL.toString()); if (cache.contains(canonURLString)) return "(already checked)"; cache.add(canonURLString); linkURL = n...
88ede9d4-bb5a-4123-850d-177631fc9566
9
public String getBeforeIndex(byte type, int index) { if (index < 0 || index > getText().length() - 1) { return null; } switch (type) { case CHARACTER: if (index == 0) { return null; } return getText().substring(index - 1, index); case WORD: ...
f6211dd9-209b-4797-9c1f-25896b332754
9
public QuickCodePopupMenu(SourceFileEditor editor) { super("Quick Code"); this.editor = editor; // Construct Menu items); JMenu opCodes = new JMenu("Insert OpCode"); // OpCode menu items are auto-generated later on JMenu statements = new JMenu("Build...
7bdd11ac-2c66-4ba1-970f-2cada105a911
8
@Override public Object getValueAt(int row, int col) { Time_Sheet vo = vos.get(row); switch (col) { case 0: return vo.getPosition().getName(); case 1: return vo.getFireman().getFirstName() + " " + vo.getFireman().getLastName(); case...
4573fd5b-e6a0-4786-8c20-fa2b44819f75
0
public void doNewGame(){}
ea42fba5-f906-4808-8053-fe1ff44d0a93
9
private void send(OutputStream outputStream) { String mime = mimeType; SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US); gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT")); try { if (status == null) { ...
372f39ab-82ce-484e-8347-55d9855d847e
6
private double getMaxValue(Angle angle, double time, double timeStep, double epsilon, double delta, FirstOrderIntegrator integrator, double[] initialState) { double max = 0; double timeOfMax = 0; double t = timeStep; while (t ...
ea490414-cf44-4f53-8d11-6dc795ee3b10
3
private void handleAwayStatusResponse(int code) { boolean isAway = (code == RPL_NOWAWAY); if (serverEventsListener != null) serverEventsListener.awayStatusChanged(isAway); for (ChannelEventsListener listener : channelEventsListeners) listener.awayStatusChanged(isAway); ...
ca77b9f7-d538-40c0-acb1-934db1146579
0
public WorldListener(TotalPermissions p) { plugin = p; }
d2bd5f52-d596-44cf-8af6-aa2753223118
5
@Override public InputStream getInputStream() { try { boolean spawn=true; if(!this.downloading) { this.downloading=true; if(song.delay()==-1) spawn=false; if(song.save()) { OutputStream[] os=new OutputStream[2]; os[0]=this.out; os[1]=new FileOutputStream(song.fileName()); t...
6002466b-a3f3-444a-8788-234f70ecf998
6
public void setVertex1(final int x, final int y, final int z) { if (this.x1 != null && this.y1 != null && this.z1 != null && this.x1 == x && this.y1 == y && this.z1 == z) return; this.x1 = x; this.y1 = y; this.z1 = z; this.refresh(); }
fd0980cd-d951-42c2-8dd7-286a741d4e61
1
public void creeper(Boolean mode){ if (mode != null){ creeper = mode; }else{ creeper = true; } }
a5c1ee6f-558e-46c0-b5f1-3a833ebe8a21
9
public P335B() { Scanner sc = new Scanner(System.in); s = sc.next(); final int N = s.length(); markPrev = new int[101]; markCurr = new int[101]; for (int i = 0; i < 101; i++) { markPrev[i] = markCurr[i] = -1; } next = new ArrayList<Arr...
39f9c321-a29b-4207-9cb2-9c4cdb77ae9f
8
public static Graph wireScaleFreeBA( Graph g, int k, Random r ) { final int nodes = g.size(); if( nodes <= k ) return g; // edge i has ends (ends[2*i],ends[2*i+1]) int[] ends = new int[2*k*(nodes-k)]; // Add initial edges from k to 0,1,...,k-1 for(int i=0; i < k; i++) { g.setEdge(k,i); ends[2*i]=k; en...
214e0c8b-8bd7-4ceb-bf5f-dbd167207f54
5
int[] getCentromereSortOrder() { int[] centro; if (haplostruct.length==2) { //bivalent if (rand.nextBoolean()) centro = new int[] {0,0,1,1}; else centro = new int[] {1,1,0,0}; } else { //parallel multivalent (Quadrivalent ...
ceb18b11-dee7-4299-b41f-0ac8b75992d8
7
@Override public void paintBorder(Graphics g) { if (paintBorder) { Graphics2D g2 = (Graphics2D) g.create(); g2.setPaint(color); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ...
53cb8df7-e803-4f04-8552-ae2c68d4b59c
6
public boolean prayer() { if (playerLevel[playerPrayer] >= prayer[1]) { if (actionTimer == 0 && prayer[0] == 1 && playerEquipment[playerWeapon] >= 1) { //actionAmount++; prayer[0] = 2; } if (actionTimer == 0 && prayer[0] == 2) { deleteItem(prayer[4], prayer[5],...
c46e4014-efa2-4094-bc28-e94866c65fb5
1
@Override public void propertyChange(PropertyChangeEvent evt) { rosterTableModel.fireTableStructureChanged(); rosterTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); for (int i = 2; i < rosterTable.getColumnCount(); i++) rosterTable.getColumnModel().getColumn(i).setPreferredWidth(45); }
a8e81a56-3598-4ab4-a8c5-ffa596aeea03
1
public void persistCSVData(List<User> rawusers, List<Interest> interests, List<Availability> availabilities, Model model) throws Exception{ Map<Integer, UserData> users = persistAdresses(availabilities, persistInterests(interests, persistUsers(rawusers))); for (UserData user : users.values()) { ...
2dbce7b6-9b28-4d10-9f31-e134495828f3
0
public void deleteByKey(long pBlogId){ this.blogModelBS.deleteByKey(pBlogId); }
196d209c-eef8-4387-ae15-f7dd9735f1a5
3
private static int countMp3Files(File directory) throws IOException { int numMp3s = 0; for(File file : directory.listFiles()) { if (file.isDirectory()) { numMp3s += countMp3Files(file); } else if (file.getName().endsWith(".mp3")) { ...
71469853-afa3-4d45-99ce-b3d686718c43
8
public void run() { this.done = false; try { if (serverMode) { client = new Socket(objectatHost, objectatPort); StringWriter stringWriter = new StringWriter(); String eventXML = ""; while (!this.done) { } } if (clientMode) { this.client = new Socket(objectatHost, o...
48c3480b-8362-4096-bf01-61185591e721
2
public synchronized static void appendTextPane(Color color, String message, JTextPane box) { StyledDocument doc = box.getStyledDocument(); Style style = box.addStyle("style", null); /*if (color == null) { color = new Color(255, 255, 255); }*/ StyleConstants.setFor...
f61d1e41-f3da-40ad-a135-4b49f7530f50
7
public static char[] findLongestCommonSubstringUsingTries(char[] s1, char[] s2) { int[][] length = new int[s1.length][s2.length]; int maxLength = 0; int maxi=-1; for(int i=0;i<s1.length; i++){ for( int j=0; j< s2.length; j++) { // if the characters match ...
b43e044e-37d0-44b2-97da-9618f42d6f91
8
private static List<PositionEntity> getMovePositionsKing(final ChessBoardEntity b, final ChessmenEntity c) { List<PositionEntity> result = new ArrayList<PositionEntity>(); PositionEntity p = null; p = new PositionEntity(c.getPosition().getX() - 1, c.getPosition().getY() - 1); if (enablePosition(b, p)) { resu...
527faca6-417c-424b-b29d-8e466f6e087c
1
@Override public boolean isValid() { return data != null && fa.isValid(); }
857837f1-a455-4010-9da4-9dfd49b496a9
9
public static void main(String[] args) throws FileNotFoundException { //------------------------------------------------- // Generate Random strings + Write to file //------------------------------------------------- PrintStream diskWriter = new PrintStream(PASSWORD_DUMP_FILENAME); for (int kk = 1; kk <= ITEM...
5acfc67b-507c-448f-be37-b9a6c0bd2a70
8
public Set<ChessPiece> filterMoves(Set<ChessPiece> possibleMoves, ChessPiece[][] board) { ChessPiece[][] tempBoard = new ChessPiece[8][8]; Set<ChessPiece> checkedMoves = new HashSet<ChessPiece>(); //copy the board over piece by piece, to eliminate aliasing //also, find the coordinates of the selected piece ...
0ba6b0f8-0f6f-46a8-a8f1-215eb5c659f6
3
public void setCurrentPath(String relativePath){ File file = new File(ProjectMgr.getAssetsPath() ,relativePath); if(!file.exists()){return;} while(file.getParent() != null && !file.getParent().equals(ProjectMgr.getAssetsPath())){ file = file.getParentFile(); ...
c4a40ac0-b20b-4cc5-88a1-4d3198a4b444
9
public void put(String name, Scriptable start, Object value) { int info = findInstanceIdInfo(name); if (info != 0) { if (start == this && isSealed()) { throw Context.reportRuntimeError1("msg.modify.sealed", name); ...
7e611572-f9ce-4085-a700-3401854f15fe
9
private ArrayList<Value> convertInsertValuesType(Table tableDef, ArrayList<String> values) throws Error{ ArrayList<Value> valueList = new ArrayList<Value>(); ArrayList<Attribute> attrList = tableDef.getAttrList(); String tableName = tableDef.getTableName(); int attrSize = attrList.size(); if(attrSize != valu...
875bbb79-0d01-449f-bd0e-199ddfb42fd0
0
public void collide(Car other) { carPhysics.collide(other.carPhysics); }
0e6b2607-5c76-4212-acd8-99d5a4ab4274
5
public void setUpNeuron() throws Exception { List<Integer> weights = new ArrayList(Arrays.asList(new Integer[]{Integer.MAX_VALUE/2,Integer.MAX_VALUE/2})); n= new MyNeuron(weights, new IMyNeuronFunction<Integer>() { @Override public Integer process(List<Integer> inData...
2b657b42-02c5-4d31-b1fe-dfad9c6c436d
0
@Override public void focusGained(FocusEvent e) { recordRenderer(e.getComponent()); textArea.hasFocus = true; }
b7927d4b-5f7e-472d-a671-29fd0e9df3ed
3
@Override public boolean equals(Object object) { if (this == object) { return true; } if (object == null || this.getClass() != object.getClass()) { return false; } return this.uri.equals(((Equivalence) object).getUri()) ; }
55460164-39ae-481d-aed9-dfd0b46a8423
6
private static char[][] getMap(int mapNumber) throws FileNotFoundException, IOException{ /* this makes sure the numberformat is correct with numberlength changes*/ String mapNumberTransformation = "00" + Integer.toString(mapNumber); mapNumberTransformation = mapNumberTransformation....
c24bbe68-7bc5-4e7d-93fd-006214302a65
9
public static void update(MySQLObjectMapping updateObj) throws IllegalArgumentException, IllegalAccessException, ClassNotFoundException, SQLException { Class clazz = updateObj.getClass(); List<Field> ids = updateObj.getIdFields(); StringBuilder whereConditionBuilder = new Strin...
593f5ac8-b0d9-4081-a0f2-2596f5c7b065
3
@Override public void paintComponent(Graphics g) { super.paintComponent(g); int w = getWidth(); int h = getHeight(); g.setColor(selected ? Color.yellow : (color == Side.WHITE) ? DARKBROWN : LIGHTBROWN); g.fillOval(0, 0, w, h); g.setColor((color == Side...
93d95b1d-e664-4aca-9d13-db009caf0035
1
public void draw(Graphics g, ImageObserver observer) { if (image != null) g.drawImage(image, x, y, width, heigth, observer); }
0c84a82d-1fbc-4053-8391-d49684523857
2
public static String toStringBytes(byte[] octets){ String aRetourner = "["; for(int i = 0;i<octets.length;i++){ if (i == 0){ aRetourner += " "+octets[i]; }else{ aRetourner += ", "+octets[i]; } } aRetourner += "]"; return aRetourner; }
d56569cc-5df5-4650-b612-18f3634521f0
4
private static int[] resolveBounds(Rectangle in, boolean warp) { int x = Math.round((float)in.x / (float)32); int y = Math.round((float)in.y / (float)32); int width = Math.round((float)in.width / (float)32); int height = Math.round((float)in.height / (float)32); if (!warp) { ...
aeb8ab2a-d054-4958-a1ae-7cb95fd359b0
0
public ArrayList<String> getPicturePaths() { return PicturePaths; }
20684a63-c68c-4b7d-8fcf-be9367182a3c
7
static final boolean activate(CellRenderer self, Event event, Widget widget, String path, Rectangle backgroundArea, Rectangle cellArea, CellRendererState flags) { boolean result; if (self == null) { throw new IllegalArgumentException("self can't be null"); } if (event == nu...
75920df2-6d6e-4e0c-8c6c-1f72665ea8b9
9
private LegacyInstr decode_22(int word1) throws InvalidInstruction { // get value of bits logical[12:15] int value = (word1) & 0x0000F; switch ( value ) { case 0x00002: return decode_STPD_2(word1); case 0x0000F: return decode_PUSH_0(word1); case 0x0000D: retur...
e684d9c7-4acb-414e-a40e-f78a6d3dbd6d
4
public static int getSmallestShipNotDestroyed() { ArrayList<Integer> shipSizesLeft = new ArrayList<Integer>(); for(int size : BattleShipGame.shipSizes) shipSizesLeft.add(new Integer(size)); for(Ship ship : sunkShips) shipSizesLeft.remove(new Integer(ship.getSize())); int smallest = 10000; for(...
52d85e73-bcb3-4c54-9e5c-246ecabf6785
8
ArrayList<String> getGoldRanking(String query) { //int numResults = 100; ArrayList<String> gold; String queryTerms = query.replaceAll(" ", "+"); try{ FileInputStream streamIn = new FileInputStream(this.wikiDirectory +queryTerms +".ser"); ObjectInputStream objectinputstream = new ObjectInputStream(strea...
d15a6b9c-851a-4577-a98a-38f781785c6c
9
public int synthesis(Packet op){ Info vi=vd.vi; // first things first. Make sure decode is ready opb.readinit(op.packet_base, op.packet, op.bytes); // Check the packet type if(opb.read(1)!=0){ // Oops. This is not an audio data packet return (-1); } // read our mode and pre/...
e34e4f19-2f24-45cf-8a70-060ec9253df7
4
public static IpInfo getIpInfo(final String ipAddress) { IpInfo ipLookup = new IpInfo(); if (!IPAddressValidator.getInstance().validate(ipAddress)){ ipLookup.setErrorMsg("Invalid IP Address"); }else{ sortServicesByPriority(); try { for (int i ...
a49c28ce-e4f5-41ea-8ee5-a800912b499c
5
@Override public boolean equals(Object obj) { if (obj == this.value) return true; if (obj instanceof Value) { Value v = (Value) obj; return this.type == v.type && (this.value == v.value || (this.value != null && this.value.equals(v.value))); } else { ...
bf45df1c-38b8-4bd0-8dda-af3e7ce9b352
2
public void tick() { super.tick(); if (isWalking) { ref++; moveDir(getFacing()); if (ref == 16) { ref = 0; isWalking = false; setTextureRegion(sprites.getSprite(getFacing())); synchronized (this) { this.notifyAll(); } } } }
39453e41-d350-4c40-9cb2-5fcf4c81a7ef
9
public final static boolean isNumberFollowedByString(final String str) { if((str==null)||(str.length()<2)) return false; if(!Character.isDigit(str.charAt(0))) return false; int dex=1; for(;dex<str.length();dex++) if(Character.isLetter(str.charAt(dex))) break; else if(!Character.isDigit(str.c...
b539c859-ebe1-4b20-9dcf-81183eac8858
8
public void eat(int id, int slot) { if (c.duelRule[6]) { c.sendMessage("You may not eat in this duel."); return; } if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.constitution > 0) { c.getCombat().resetPlayerAttack(); c.attackTimer += 2; c.startAnimation(829); c.getItems().deleteItem(i...
0f33fb1a-06a9-498b-849c-b1cefb498de8
1
public Texture getTexture(String path) throws IOException { if (textures.containsKey(path)) { return textures.get(path); } else { Texture t = new Texture(getImageFromName(path)); textures.put(path, t); return t; } }
75a1cdde-232d-4c25-b315-d2c44082b554
3
@Override public void componentResized(ComponentEvent e) { Component comp = e.getComponent(); int width = comp.getWidth(); int height = comp.getHeight(); boolean resize = false; if (width < minWidth) { resize = true; width = minWidth; } if (height < minHeight) { resize = true; height...
5f750ad0-7683-411e-b374-ac2f9459abd5
2
public Weapon(Class<? extends T> projectileType, long coolDown, int maxAmmo) { this.projectileType = projectileType; lastShot = 0; this.coolDown = coolDown; this.maxAmmo = maxAmmo; this.currentAmmo = maxAmmo; try { ctor = getCtor(); } catch (SecurityEx...
039e573e-4a03-4ea3-a9de-7e31082a10c5
4
private Object spawnChoiceWindow(String title, String prompt, Object[] choices) { //This will create the dialogue window dialogSpawner = new JOptionPane(prompt, JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, choices, null); final JDialog dialog = dialogSpawner.createDialog(null, title); ...
7ea30749-29cb-4049-8e28-8446c26a9403
6
public static File criar(String tipoArquivo, String conteudo) throws Exception { if ( "apresentacao".equals(tipoArquivo) || "texto".equals(tipoArquivo) || "planilha".equals(tipoArquivo) ) { IDocumento documento = AbstractDocumento.factory(tipoArquivo, conteudo); return documento.criar(); ...
c5c69a20-2998-4e50-8180-c2400308cbcf
5
@Override public String toString() { StringBuffer sBuff = new StringBuffer(); if (octave < 0) { for(int i=0; i< (-1)*octave;i++) { sBuff.append('.'); } } if (swar != -1) { sBuff.append(swarLiterals[swar]); } if (octave > 0) { for(int i=0; i< octave;i++) { sBuff.append('.'); } } ...
1c62b447-17a7-408d-9bf5-ca94f8b6b0df
5
public boolean validate(byte[] piece_hashes, byte[] piece, int piece_index){ //Make sure we don't get an index out of bounds error if(piece_index != piece_hashes.length) return false; byte[] hashed_piece; MessageDigest create_hash = null; //The MessageDigest will use the SHA algorithm to create the hash...
8f63a0ee-c21e-40e6-a4df-66f1de7f1262
8
public int compareTo(DateTime aThat) { if (this == aThat) return EQUAL; ensureParsed(); aThat.ensureParsed(); ModelUtil.NullsGo nullsGo = ModelUtil.NullsGo.FIRST; int comparison = ModelUtil.comparePossiblyNull(this.fYear, aThat.fYear, nullsGo); if (comparison != EQUAL) return comparison; ...
85ded99b-7616-49bd-90a3-2c0e7eb5c858
6
public void paint(Graphics g, int yOffset) { removeDeadFlyUps(); g.setColor(Color.BLACK); int bottomEdge = 15 * flyups.size(); bottomEdge += (permanentFlyUp.equals(""))?0:15; float rgb = (bottomEdge <= (200 + yOffset)) ? 0.0F : 1.0F; g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14)); g.drawString(perman...
27c22944-03e9-492c-a839-d903474c1b94
4
private Class[] types(int[] dims, Class basetype) { int i = 0; while (dims[i] > -1) { i++; } if (debug) { System.out.println(" rank " + i); } Class[] c = new Class[i]; c[i - 1] = basetype; while (--i > 0) { c[i - 1] = Array.newInstance(c[i], 0).getClass(); } if (debug) { Sy...
5669990a-175c-4999-bd2c-b59def762bb4
0
@BeforeClass public static void setUpClass() { }
16bbf6f4-4c0e-4f04-98a9-2ab9d37d4a8e
3
int divideHelper(int a, int b) { if (a > b) return 0; if (a == b) return 1; // shift b to align a and compare with a int diff = bitDiff(a, b); if (a < (b << diff)) return (1 << diff) + divideHelper(a - (b << diff), b); diff--; ...
c0e04723-6699-4a43-96ed-ee6722429fe3
4
public String getMSISDNString(int position, boolean showAllHex) { byte[] MSISDN = null; String MSISDNString = ""; try { worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID())); MSISDN = worker.readRecord(position, worker.getResponse(worker.select(DatabaseOfEF....
457ee4ef-a347-4970-9d3e-634ce228b13d
5
private static boolean isConflictWithVenue(long startTime, long endTime, int frequency, long lastDay, long venueId, long exceptApptId, IsLegalExplain explain) { try { List<Appointment> aAppt = Appointment.findByVenue(venueId); for (Appointment iAppt : aAppt) { if (iAppt.id == exceptApptId) c...
c202fb80-0779-49c7-a95b-d1eef4610a21
2
private static void quantityOfProducts() { mapOfQuantityProducts = new HashMap<String, Integer>(); for (String entry : scanProducts) { if (mapOfQuantityProducts.containsKey(entry)) { mapOfQuantityProducts.put(entry, (mapOfQuantityProducts.get(entry) + 1)); } else { mapOfQuantityProducts.put(entry, 1);...
862f0509-25ed-4634-b66d-7141854311c9
5
public FlippingPuzzleDialog(final MainWindow mainWindow) { setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)...
b3a60072-ea68-41b0-b7a8-4c782479c29a
8
public static void main(String[] args) { int i, j; for(i=1; i<10; i++) { for(j=2; j<10; j++) { System.out.printf("%d*%d=%2d\t", j,i,i*j); } System.out.println(); } System.out.println();System.out.println(); for(i=0; i<10; i++) { for(j=0; j<10; j++) { System...
47ded58e-73b6-4f0a-b066-2870fed6f797
1
public static void newFile(String fileContent, String filePath, FileType fileType){ java.io.File file = new java.io.File(filePath + fileType.getType()); try { FileWriter fw = new FileWriter(file); fw.write(fileContent); fw.close(); } catch (IOException e) { log.error("Create file failed."); e.print...
7747b541-5d5d-458b-a8fb-bd3f0b5c645c
4
public Document separateDocument(DocumentView docView) { // Get the List that contains the DocView List<Object> curDocAndDocView = null; for (List<Object> value : this.docAndDocView.values()) { if (value.contains(docView)) { curDocAndDocView = value; } } // Get the Document from this List Document...
5172c6b8-b44b-4c28-b7bd-01c29e54cf4a
5
static Type resolveTypeVariable(Type context, Class<?> contextRawType, TypeVariable<?> unknown) { Class<?> declaredByRaw = declaringClassOf(unknown); // we can't reduce this further if (declaredByRaw == null) { return unknown; } Type declaredBy = getGenericSupertype(context, contextRawType, ...
8420ec1a-dfa6-4962-8ccc-85efbb0bd626
2
public static void changeTheme(String name) { GUITHEME[] t = GUITHEME.values(); for (int i = 0; i < t.length; i++) { if (t[i].name().equalsIgnoreCase(name)) theme = t[i]; } }