method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
79a52a7a-987d-4c1c-b074-ca15e0924f2b
9
@Override public void spring(MOB target) { if((target!=invoker())&&(target.location()!=null)) { if((doesSaveVsTraps(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))) target.location().show(target,null,null,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> avoid(s) setting off a no...
f39c890b-7f61-48c1-a60a-b7e5383e4287
0
@Test public void hahmoPutoaaAlkeellisesti() { int hahmonKoordinaattiAlussa = pe.getY(); pe.eksistoi(); assertTrue("Hahmo ei liikkunut alaspäin!", pe.getY() > hahmonKoordinaattiAlussa); }
067539e8-ac52-49a7-8600-494ab223533f
9
public void mouseDragged(MouseEvent e) { //this item panel is the head item so just return //we can't move the head item if (getItemPanel().previousItem == null) { return; } Point loc = e.getPoint(); SwingUtilities.convertPointToSc...
0e6ccd1f-d71f-4d58-99c1-f8ee134d1b07
4
public void init() throws Throwable{ StringBuilder action = new StringBuilder(); String str = null; do{ // Converte a string pra um char action.append(str); char word[] = new char[str.length()]; word = action.toString().toCharArray(); switch (word[0]) { case 'i': // Instrução para in...
4e0c3faa-f24c-46ad-831f-79e812973280
5
public boolean divide() { int regionHeight = y2 - y1; int regionWidth = x2 - x1; // Millä tavalla alue voidaan jakaa? boolean canDivHor = regionHeight >= REGION_MIN_SIZE * 2; boolean canDivVer = regionWidth >= REGION_MIN_SIZE * 2; // Jos alue on liia...
29addbd1-76df-4f26-8764-52aaf5db81cc
3
public String getImageForStyle(Map<String, Object> style) { String filename = mxUtils.getString(style, mxConstants.STYLE_IMAGE); if (filename != null && !filename.startsWith("/") && !filename.startsWith("file:/")) { filename = imageBasePath + filename; } return filename; }
8594324b-02c0-4db3-873f-931774d9f411
4
private Dimension findDimension(String dimensionName, SortedSet<Dimension> dimensions) throws CorrespondingDimensionNotExistsException { if (null == dimensionName || "".equals(dimensionName)) { throw new CorrespondingDimensionNotExistsException(); ...
4958c227-7a55-47f8-a42b-e0bb4d8a3031
8
public boolean func_77648_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par7 == 0) { return false; } if (par7 == 1) { return false; ...
2932e262-fdd9-4a4b-901e-470e27e83bbb
7
@Override public void takeInfo(InfoPacket info) throws Exception { super.takeSuperInfo(info); Iterator<Pair<?>> i = info.namedValues.iterator(); Pair<?> pair = null; Label label = null; while(i.hasNext()){ pair = i.next(); label = pair.getLabel(); switch (label){ case temp: setTemperature((Do...
3642ccd1-68f4-4c5a-9f7f-36880deb5384
9
public static Cons javaTranslateNormalMethodCall(Symbol methodname, Surrogate classtype, Cons allargs) { { Slot slot = Stella_Class.lookupSlot(((Stella_Class)(classtype.surrogateValue)), methodname); MethodSlot methodslot = (((slot != null) && Stella_Object.isaP(slot, Stella.SGT_STELLA_METHOD_SLOT))...
81fdf116-e989-4067-9da4-e3597e900bdf
8
private void initialize() { setupApplicationLocalData(); resetLastWindowState(); setMargin(); JPanel maincontainer = new JPanel(new BorderLayout()); /* * top panel */ JPanel top = new JPanel(new GridLayout(3, 8)); initComboBoxes(); // OLDDATA file_input_old.setRenderer(new FileNameListCellR...
b8b53aa6-1698-4e68-a256-b2795ec459d4
6
@Override public boolean equals(Object other) { if(other == null) { return false; } if(other == this) { return true; } byte[] hashedpw = null; if(other instanceof HashedPassword) { hashedpw = ((HashedPassword) other).getHashedPassword(); } else if (other instanceof byte[]) { hashedpw ...
cd432d92-69f5-45fb-89ca-8760b4d6c3e3
1
public int getLeapAmount(long millis) { return isLeap(millis) ? 1 : 0; }
7d191276-fb0b-457f-a32d-b5cd8ae79b76
9
public void read(IntReader reader) throws IOException { mChunkSize = reader.readInt(); mStringsCount = reader.readInt(); mStylesCount = reader.readInt(); mEncoder = reader.readInt();//utf-8 or uft16 mStrBlockOffset =reader.readInt(); mStyBlockOffset =reader.readInt(); if(mStringsCount >...
8f07c40c-7a38-4d7b-ac51-535ecf3095fd
6
private static Platform getPlatform() { if(m_os == null) { String os = System.getProperty("os.name").toLowerCase(); m_os = Platform.unsupported; if(os.indexOf("win") >= 0) m_os = Platform.Windows; // Windows if(os.indexOf("mac") >= 0) m_os = Platform.Mac; // Mac if(os.indexOf("nux") >= 0) m_o...
3f8d822c-e47f-45ef-b66f-98271a0350cb
0
public void setSide(int s) { side = s; }
034650c3-92a9-41bd-a71b-2f35728cb2e0
2
public boolean setRole(int role) { if (role != ROLE_SERVER || role != ROLE_CLIENT) { this.role = role; saveToFile(); return true; } return false; }
4f42fd96-08a8-4fec-90f3-49f673e7df70
6
public void init(Sag sag) { setSag(sag); cpr_textField.setText(this.sag.getPerson().getCpr()); cpr_textField.setEnabled(false); sagssted_textField.setText(this.sag.getSagsSted()); fornavn_textField.setText(this.sag.getPerson().getFornavn()); fornavn_textField.setEnable...
4b07b5b3-e0bb-4f49-aad8-93bff48f9adc
9
private boolean gotoNextValidMatrixCell() { do { dz++; if(dz > 2) { dz = 0; dy++; } if(dy > 2) { dy = 0; dx++; } if(dx > 2) { return false; // we have visited all neighboring matrix cells } } while(ox + dx < 0 || oy + dy < 0 || oz + dz < 0 || ox + dx >= numX || oy ...
5889be48-a1c9-4ddd-b7ed-7a482e0d2a21
0
public Position getDestination(){ return new Position(start.getY() + vertical, start.getX() + horizontal); }
9e72839c-71b2-4b0a-a1b8-8f8ad22ec3c8
3
public void readTable(Map table) { Identifier rep = getRepresentative(); if (!rep.wasAliased) { String newAlias = (String) table.get(getFullName()); if (newAlias != null) { rep.wasAliased = true; rep.setAlias(newAlias); } } for (Iterator i = getChilds(); i.hasNext();) ((Identifier) i.next())...
fa2719c8-cd35-41ed-b7ef-614c25c22f0c
0
public CrossJoinIterator(Iterable<T> first, Iterable<TInner> second, Joint<T, TInner, TResult> joint) { this._first = first.iterator(); this._second = second; this._joint = joint; }
b48c6fb4-b30a-479e-be01-ebe554eb02bb
7
private int checkDay(int testDay) { if(testDay > 0 && testDay <= daysPerMonth[month]) return testDay; if(month == 2 && testDay == 29 && (year %400 == 0 || (year % 4 == 0 && year %100 != 0))) return testDay; throw new IllegalArgumentException( ...
e6edcb78-522d-4770-a73f-7aadea32359e
8
private String csvEncode(String text) { if(text==null) return "null"; String encoded=""; boolean hasSpecialChar=false; int length=text.length(); if (length>0) { for(int i=0;i<length;i++) { char ch=text.charAt(i); if(ch==',' || ch=='"') { hasSpecialChar=true; continue; } } ...
27223cac-c971-44e6-b35f-11821ddcefbe
9
@Override public PackageDoc containingPackage() { PackageDocImpl p = env.getPackageDoc(tsym.packge()); if (p.setDocPath == false) { FileObject docPath; try { Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? St...
eabf70f1-ff4a-4ec7-bc3f-e599de50c888
7
public ArrayList<String> cbEncarregado() throws SQLException { ArrayList<String> Encaregado = new ArrayList<>(); Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; try { conexao = BancoDadosUtil.getConnection(); coma...
0d54c539-f1f0-4e9e-b3df-65f72aa4fa54
7
public void decrypt(InputStream in, OutputStream out) throws IOException { byte inbuf[] = new byte[8]; byte outbuf[] = new byte[8]; byte tmpbuf[] = new byte[8]; byte tmp[]; boolean done = false; int n = readn(in, inbuf, 8); while (n == 8) { tmp = tmpbuf; tmpbuf = outbuf; outbuf = tmp; n ...
3a25f226-2e50-4e51-a784-c3b1a77569ea
3
private static int[] sumOfBinaryString(String binary) { char[] bin = binary.toCharArray(); int[] derp = new int[bin.length]; for (int i = 0; i < bin.length; i++) { if (bin[i] == '0') { derp[i] = 0; } else if (bin[i] == '1') { derp[i] = binary(bin.length - i - 1); } else { throw new NullPoint...
0245ee80-a186-4b7f-b315-4277fef5cb81
9
private void reportTypeChanged(){ hideSelectors(); option = current.isSelected() ? 6 : group.isSelected() ? 2 : teacher.isSelected() ? 3 : daycare.isSelected() ? 4 : club.isSelected() ? 5 :7; switch(option){ case 2: fillGroupSelector(); ...
32083600-0010-44c4-b7a4-0fbbfee09a9f
2
public void fireWeaponListener(long id) { GameActor actor = mainLogic.getActor(id); if(actor != null) { WeaponsComponent wc = (WeaponsComponent)actor.getComponent("WeaponsComponent"); if(wc != null) { wc.fire(); } } }
d44f41c2-0425-4a1d-902e-d536b90e0476
9
private Collection createList() throws IOException { Collection list = null; if (_type == null) list = new ArrayList(); else if (! _type.isInterface()) { try { list = (Collection) _type.newInstance(); } catch (Exception e) { } } if (list != null) { } ...
ecde2b59-214c-408c-b972-4f2fe5fa9ded
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...
aa501010-7ae4-437e-addf-268bfb8a3904
8
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof HighLowRenderer)) { return false; } HighLowRenderer that = (HighLowRenderer) obj; if (this.drawOpenTicks != that.drawOpenTicks) { r...
d57a3385-b443-4eee-9abc-3f9d40a6b7b3
5
public boolean update(Client client) { //Получаем текущий обьект по usersId int usersId = client.getUsersId(); Client curClient; if ((curClient = getByUsersId(usersId)) == null) { //Если обьекта не существует - обновлять нечего return false; } else { ...
71d747ed-119e-4179-a0f9-f41e6e2290a4
3
private void rotate() { if (isOpen()) { crossRotate.setFromAngle(0); crossRotate.setToAngle(radialMenu.getOptions().isSimpleMode() ? -45 : -135); } else { crossRotate.setFromAngle(radialMenu.getOptions().isSimpleMode() ? -45 : -135); crossRotate.setToAngle...
e4b857a3-b99a-479f-97ec-e165889a5bcf
3
@Override public void handleCollision(Actor other) { // Don't collide with our siblings if(other instanceof FlakShell && ((FlakShell) other).parentId.equals(getParentId())) return; // Don't shoot our parents if (parentId.equals(other.getId())) return; ...
749667b5-8ce4-4212-be3a-bec53d928fd5
9
private Header readHeader(DataInputStream ins) { Header out = new Header(); try { byte[] oldInput = new byte[3]; oldInput[0]=0; oldInput[1]=0; oldInput[2]=0; byte input = 0; input = ins.readByte(); int bufferSize = 0; ...
7e17d448-514a-4597-9fab-7f4cf34df9cc
0
public void setNumber(String value) { this._numer = value; }
9a188783-3b1e-4b8f-9d7e-308bcba6c77c
6
public Query<T> reverse() { if(this._source instanceof ArrayIterable<?>) { ArrayReverseIterable rs = new ArrayReverseIterable(((ArrayIterable<T>)this._source).getSource()); return new Query<T>(rs); } else if ((this._source instanceof List<?>) && (this._source instanceof RandomAccess)) { return new Q...
1e3da6b4-e671-4284-bf4d-7abe2d48bc6e
6
public static List<Integer> search(String text, String pattern){ //only searches for upper case letters text = text.toUpperCase(); pattern = pattern.toUpperCase(); List<Integer> response = new ArrayList<>(); HashSet<Character> dedup = new HashSet<>(); for( int i = 0; i< ...
02abb502-ff0b-45bd-b28f-00bff42506e7
2
private boolean containsVariable(String name) { for (VariableInformation var : variableList) if (var.name.equals(name)) return true; return false; }
3129232a-7f79-44c1-b6ff-bfc5f1c1789e
3
public static void update() { ArrayList<AppWindow> windows = AppWindow.getAllWindows(); Collections.sort(windows); for (AppWindow window : windows) { JMenu windowMenu = StdMenuBar.findMenuByName(window.getJMenuBar(), NAME); if (windowMenu != null) { windowMenu.removeAll(); for (AppWindow one : windo...
be10b542-09fc-44df-bfe1-99b48ea06c00
1
public boolean distributionStrategy(int[] bowl) { predictDistribution(); double expectedScore = calculateExpectedScore(); // Take a bowl greater than your expected score based on the distribution if (bowlScore(bowl) > expectedScore + calculateThreshold()) return true; ...
1259b3b6-2f05-413a-ac62-5a618c9fdedc
0
public SignatureType createSignatureType() { return new SignatureType(); }
ecf804fc-b070-4b45-9aca-e29125ff8723
9
public State_Sense(String[] tokens) { super(E_Instruction.SENSE); if (tokens.length == 5 || tokens.length == 6) { // Variable number of tokens! senseDir = tokenToSenseDirection(tokens[1]); state1 = tokenToState(tokens[2]); state2 = tokenToState(tokens[3]); condition = tokenToCondition(tokens[4]); ...
1a46fa27-1689-45fd-9548-beda35ab6fbc
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Developer) { Developer other = (Developer) obj; return Objects.equals(firstName, other.firstName) && Objects.equals(lastName, other.lastName) && Objects.equals(age, other.age) && Objects.e...
80dac2ab-437e-47cc-ad05-7ea9833b0656
3
static void checkClassSignature(final String signature) { // ClassSignature: // FormalTypeParameters? ClassTypeSignature ClassTypeSignature* int pos = 0; if (getChar(signature, 0) == '<') { pos = checkFormalTypeParameters(signature, pos); } pos = checkClassTypeSignature(signature, pos); while (getChar...
c290987c-9a30-4b6e-9092-9da6bc7f4cef
9
void updateFrom(int sender) { int changes = 0; for (int level=0; level<maxLevel; level++) { for (int zip=0; zip<maxOrder; zip++) { int[] offer = station[sender].promise[level]; if (offer[zip] != 0) { // known region if (off...
46371f0e-fa40-40d0-9963-dfc27db90aa5
1
public boolean isArityAvailiable(int a) { return a >= lowBoundArity && a <= highBoundArity; }
751e16a3-dde1-44cf-ac7d-68bb29f04a34
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TStok other = (TStok) obj; if (!Objects.equals(this.itemCode, other.itemCode)) { return false...
82ac8f53-78ac-4aac-8ef2-9faa37de9d47
1
public List<User> getAllUsers() { List<User> users = null; try { beginTransaction(); users = session.createCriteria(User.class).list(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { closeSession(); } return users; }
6463ac5e-20be-4690-bdf9-ec7c1608ee2c
4
@Override public void update(String msg) { char ch = msg.charAt(0); int i = Integer.valueOf(String.valueOf(ch)); switch (i) { case 1: System.out.println(getClass().getName() + "说:天籁啊,真是!"); break; case 2: System.out.prin...
d49f20fc-90c5-4c66-ae88-8a69a480be2b
2
public void resume() { if (!paused) { play(); return; } paused = false; synchronized (player) { if (player != null) { player.notify(); } } setGain(oldGain); }
db2c4ef7-3931-4faa-9893-06f753d39e69
8
private void method98(Entity entity) { if(entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527)) { int i = entity.anInt1548 - entity.anInt1547; int j = loopCycle - entity.anInt1547; int k = entity.anIn...
d50c140c-b82f-4806-bbcd-4c980bcbefa5
5
private void mergeParts(int lowerIndex, int middle, int higherIndex) { for (int i = lowerIndex; i <= higherIndex; i++) { tempMergArr[i] = array[i]; } int i = lowerIndex; int j = middle + 1; int k = lowerIndex; while (i <= middle && j <= higherIndex) { if (tempMergArr[i] <= tempMergArr[j]) { array[...
f5155c66-f441-48d2-b9f7-38ab9812d217
1
public SubmissionView(int mode, final ClientView cv, SubmissionTableModel model) { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JScrollPane scrollPane = new JScrollPane(); // If client if (mode == AS_CLIENT) { // Show submit button btnSubmitCode = new JButton("Submit Code"); btnSubmitCode.add...
d39fe73f-a8d8-4743-a1e8-e47535c2edda
8
static void initializePlatform(){ OperatingSystem os = OSDetector.detectOS(); if (os.equals(OperatingSystem.WINDOWS)) platform = new WindowsCommands(); else if (os.equals(OperatingSystem.MAC_OS)) platform = new MacOSCommands(); else if (os.equals(OperatingSystem.LINUX_GNOME))...
515bdef8-c838-4592-8834-b96e3a201cae
2
private void writeFrameType(final Object type) { if (type instanceof String) { stackMap.putByte(7).putShort(cw.newClass((String) type)); } else if (type instanceof Integer) { stackMap.putByte(((Integer) type).intValue()); } else { stackMap.putByte(8).putShort(((Label) type).position); } }
1c7765de-fe3f-4a6d-a3a1-6ac02ace5620
7
public void fish() { if (!Players.getLocal().isMoving() && Players.getLocal().getAnimation() != 621) { Time.sleep(1000); if (!Players.getLocal().isMoving() && Players.getLocal().getAnimation() != 621) { status = "Fishing"; NPC bob = NPCs.getNearest(327); if (bob.isOnScreen()) { bob.int...
cafd2760-c68f-4507-98dc-8062f28f41e2
1
public static DBConnectionProperties getInstance() throws IOException { if (instance == null) { instance = new DBConnectionProperties(); } return instance; }
feaf7305-f8b3-4f9c-aa24-bf5af52e4177
4
private void writeToStream(String message) { if (!sock.isConnected() || sock.isClosed() || out == null) return; byte[] sizeinfo = new byte[4]; byte[] data = message.getBytes(); ByteBuffer bb = ByteBuffer.allocate(sizeinfo.length); bb.putInt(message.getBytes().length); try { out.w...
80bf0104-ae0d-484e-9e57-75b3c761063e
4
public void adicionaPreferenciaDisciplina(Disciplina d, int nivelPreferencia) throws PreferenciaInvalidaException { switch (nivelPreferencia) { case 1: this.listaDisciplinasP1.add(d); break; case 2: this.listaDisciplinasP2.add(d); break; case 3: this.listaDisciplinasP3.add(d); break; case...
9e5b2ff7-5ad3-4c18-a582-31d4b078d7d3
9
public static Collection<Method> getDeclaredMethods(Class<?> clazz) { Reference<Collection<Method>> ref = declaredMethods.get(clazz); Collection<Method> list; if (ref != null) { list = ref.get(); if (list != null) return list; } Map<Signatu...
77612b30-d2de-4dcf-955d-60f4d167ad9b
6
private static void doQuery() { try { String databaseName = "mytest"; for(int i = 0; i < 100; ++i) { IMySQLConnection conn = MySQLService.getConnection(databaseName); if(conn == null) { System.out.println("conn == null"); } for(int j = 0; j < 100; ++j) { conn.executeQuery("S...
2e788072-97f6-49fa-becc-9405cf233b8a
3
public static void main(String[] args) { // TODO Auto-generated method stub String start = "qa"; String end = "sq"; String[] dicts = { "si", "go", "se", "cm", "so", "ph", "mt", "db", "mb", "sb", "kr", "ln", "tm", "le", "av", "sm", "ar", "ci", "ca", "br", "ti", "ba", "to", "ra", "fa", "yo", "ow", "sn", ...
37c93916-b6e0-4c9f-933e-8bffbb90139e
3
public void preprocess() { File file = new File(path); BufferedReader reader; try { reader = new BufferedReader(new FileReader(file)); String line; while((line = reader.readLine()) != null) { String word = line.toLowerCase(); m...
5c08b1f6-1ad7-4f66-a2c9-96c5c8907e29
0
public float getSaldo() { return saldo; }
bb8278ef-157d-483d-bf38-58cc3bbe3cf8
0
public static byte[] encryptHMAC(byte[] data, String key) throws IOException, NoSuchAlgorithmException, InvalidKeyException { SecretKey secretKey = new SecretKeySpec(base64Decoder(key), KEY_MAC); Mac mac = Mac.getInstance(secretKey.getAlgorithm()); mac.init(secretKey); return mac.doFinal(data); }
89182ab6-1861-4c9b-a2a8-b52368a2f8d1
0
public void pause() {isPaused = true;}
a11ecc2d-97ab-4ace-9436-d3c523c146da
1
public boolean retirar(float cantidad) { if(cantidad+cantidad*this.penalizacion<=saldo){ saldo-=cantidad+cantidad*this.penalizacion; return true; }else{ return false; } }
a1fd2f32-4d2e-4deb-8897-c5778966cc50
1
public static ArrondissementVilleDAO getInstance(Connection conn) { if (instance == null) { instance = new ArrondissementVilleDAO(conn); } return instance; }
b0be5a84-fa4e-4bc1-8828-1f0c2c8f58e5
6
public void playSound(int i) { if (Settings.GLOBAL_SOUND) { if (i == 0) { sound = Gdx.audio.newSound(Gdx.files.internal("data/big_shot.mp3")); thread.run(); } if (i == 1) { sound = Gdx.audio.newSound(Gdx.files.internal("data/exp...
e5b57c9d-dd43-4040-825c-19b8ebf335d5
8
public LinkedList<Personnage> calculerCibles(int x, int y, int portee){ LinkedList<Personnage> res = new LinkedList<Personnage>(); // stocke le résultat final // On inspecte la verticale et l'horizontale, en ne regardant pas la case où l'on se trouve // à gauche de la case for(int i=(x-portee); i<x; i++){ if...
9960e52c-9a1e-4f56-8724-bc070b377764
4
private void splitPlayerHashMap(GameData gameData) { if (gameData != null && gameData.playerData != null) { String[] keys = new String[]{""}; StringBuilder[] sb = new StringBuilder[4]; sb[0] = new StringBuilder(); sb[1] = new StringBuilder(); sb[2] =...
b4f5b1d6-6616-4671-965c-d2dd547c52c2
0
public void setServer(String server){ this.Server = server; }
768e1439-5e46-4bda-a415-609f6a107c8d
3
public void process(String fName) throws FileNotFoundException, IOException{ System.out.println("Starting to sum up reads for transcripts in " + fName); System.out.println("Writing output to " + fName.replace(".txt", "_out.txt")); BufferedReader exCounts=new BufferedReader(new FileReader(fName))...
5f6b3ab6-3c1f-49eb-bb8f-65ff5958f90b
2
public void mutate() { if(bestVariation==null || baseGenome.getTotalOverlaps()<bestVariation.getTotalOverlaps()){ Logger.log("Found new best "+baseGenome.getTotalOverlaps()); bestVariation = baseGenome.clone(); } //double quality = baseGenome.getTotalOverlaps(); baseGenome.mutate(); // Only accept mutat...
7d02c42e-2a06-4b96-8e3d-ecf50f31fad2
6
public ArrayList<City> getNeighbours(City city) { int index = getIndex(city); if (index < 0) { return null; } ArrayList<City> list = new ArrayList<>(); for (int i = 0; i < edges.length; i++) { for (int x = 0; x < edges[i].length; i++) { if ...
62ad24a0-cebe-435f-b24d-88c3fe6fbf07
0
@Override public String getDesc() { return "SonicBlow"; }
a7d8a9cf-193d-4e92-b327-9648991c4461
1
public static void storeNewParis(ParisModel paris) { if(!hasParisForUserAndSchedule(paris.getParis_userId(),paris.getParis_schedId())){ UserModel user = getUser(paris.getParis_userId()); user.addUserPoint(-paris.getBet()); storeUser(user); storeParis(paris); } }
73b33b1d-33cf-48e9-aca9-2599ede02e6c
5
private void doAction() { if (action == editor.getOpenItem()) this.doOpenItem(); if (action == editor.getNewItem()) this.doNewItem(); if (action == editor.getSaveItem()) this.doSaveItem(); if (action == editor.getSaveAsItem()) this.doSaveAsItem(); if (action == editor.getOpenFold...
50e71fa2-0b61-43ed-b6b0-4710eb60c9ce
2
public void setDirty(final boolean isDirty) { if (this.isDeleted) { final String s = "Cannot change a field once it has been marked " + "for deletion"; throw new IllegalStateException(s); } this.isDirty = isDirty; if (isDirty == true) { this.editor.setDirty(true); } }
59b5dcef-9df9-4ba3-8c4e-368c1a4671f6
5
@SuppressWarnings ("unchecked") protected final GEntry removeEntry(final GKey key, final boolean verifyLength) { if (this._size_ == 0) return null; final Object[] table = this._table_; final int hash = this.getKeyHash(key); final int index = this.getIndex(hash, table.length); GEntry item = (GEntry)table[inde...
eb41179c-9cf6-405f-9259-e4bb5dafbeca
0
public int getBitsPerPixel() { return bitsPerPixel; }
f505a53f-6d7a-4efc-8ba9-6cc8b5a0cb0e
4
public static void main(String[] args) { Graph G = null; try { G = new Graph(new In(args[0])); } catch (Exception e) { System.out.println(e); System.exit(1); } int s = Integer.parseInt(args[1]); ISearch search = new SearchWQU(G, s); for (int v = 0; v < G.V(); v++) if (search.marked(v)...
a093a821-0ef2-4a1a-8182-1cb924393f43
7
public void check_reductions() throws internal_error { parse_action act; production prod; /* tabulate reductions -- look at every table entry */ for (int row = 0; row < num_states(); row++) { for (int col = 0; col < under_state[row].size(); col++) { /* look at the acti...
254f125f-dba1-41b8-bf4d-be3de8728eaf
2
private void testWrite(){ String f_name = this.path + Params.nTests + ".txt"; long startTime = 0; long endTime = 0; File f = new File(f_name); FileOutputStream fout = null; try{ fout = new FileOutputStream(f); byte[] buf = new byte[Params.packSize * Params.nPacks]; for(int i = ...
5157452d-efe4-4524-801b-5b3b1a8cdd27
6
public void apply(Signature signature) { ArrayList<Point> points = signature.getPoints(); int n = points.size(); /* Compute speed for each points except first and last one */ ArrayList<Double> speeds = new ArrayList<Double>(); speeds.add(0.); // Add first speed to maintain indexes for (int i = 1; i < n -...
e2193ba6-0094-4ed5-a204-dc5f59dafe69
5
protected void printWordTopicDistribution(_Doc d, File wordTopicDistributionFolder, int k) { _ParentDoc4DCM pDoc = (_ParentDoc4DCM) d; String wordTopicDistributionFile = pDoc.getName() + ".txt"; try { PrintWriter pw = new PrintWriter(new File( wordTopicDistributionFolder, wordTopicDistributionFile)); ...
d3cb4967-6d4d-4b04-8c7d-184acfb4302c
9
@Override public int classDurationModifier(MOB myChar, Ability skill, int duration) { if(myChar==null) return duration; if((((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_CRAFTINGSKILL) ||((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_BUILDINGSKILL))...
a05897bf-a677-4095-b53a-771c8f7c88bb
3
public DAO_Configuration() { SAXBuilder sxb = new SAXBuilder(); try { //On crée un nouveau document JDOM avec en argument le fichier XML File f = new File(path); File dossier = new File("stockage"); if (!dossier.exists()) { ...
17320643-9a3b-4f56-9c33-c99d668ea104
3
@SuppressWarnings("static-access") private void ROUND9() { enemises.clear(); System.out.println("Round9!!!!!!"); for (int i = 0; i < level.getWidth(); i++) { for (int j = 0; j < level.getHeight(); j++) { if ((level.getPixel(i, j) & 0x0000FF) == 2) { ...
4c84bd68-6cf7-45df-93ec-2514c1a0fc93
5
public Dude getNearestDude(Tile tile) { int x = tile.getX(); int y = tile.getY(); int bestSquaredDistance = Integer.MAX_VALUE; Dude bestStructure = null; for (Dude d : allDudes) { if(d.getClass() != Dude.class) continue; if(d.hasTask()) continue; int squaredDistance = (d.getX() - x) * (d.get...
79440049-e32f-4b25-88f7-5ed56cb7e807
9
public Object getProperty(String name, Object opNode) { validate(name, opNode); if(opNode instanceof RenderedOp && name.equalsIgnoreCase("roi")) { RenderedOp op = (RenderedOp)opNode; ParameterBlock pb = op.getParameterBlock(); ...
61159aab-2f8d-4b3d-95f7-c80e0afbef49
7
private void createMap() { int c; String s = ""; for(int i = 0; i < width; i++) { for(int j = 0; j < height; j++) { mapView[i][j] = new JLabel(); c = gameMap[i][j]; if(c == 0) ...
601fd166-8bb4-4f99-ac2e-2ba28160119a
6
@Override public void Update(long gameTime) { for (Sprite sprite : _sprites) { sprite.Update(gameTime); } _weapon.Update(gameTime); InputManager input = InputManager.getInstance(); if (input.isKeyDown(KeyEvent.VK_Q)) { jaune.setX(jaune.getX() - 1);...
783bf26b-a121-4e78-945e-991c3c99aaab
9
public static Stella_Object inferPredicateFromOperatorAndTypes(Stella_Object operator, List types) { { Surrogate testValue000 = Stella_Object.safePrimaryType(operator); if (Surrogate.subtypeOfSurrogateP(testValue000)) { { Surrogate operator000 = ((Surrogate)(operator)); if (Stella_Object.i...
bb0cd34f-0f74-437d-a335-ad2a8d61fd1c
6
@Override public int read() throws IOException { int result = (length == next) ? -1 : string.charAt(next++); if (result <= 13) { switch (result) { case 13: column = 0; line++; int c = (length == next) ? -1 : string.charAt(next); if (c == 10) { next++; } return ...
9c80007a-e47d-4d77-997d-48b75520a29d
0
@Test public void testLayers() { BeerRequest beerRequest = new BeerRequest(); beerRequest.setName("cruzcampo"); beerRequest.setDescription("standard spanish pilsner style beer"); BarController barController = AppContext.getService(BarController.class); BeerResponse firstRespo...
843ffbd1-36e3-4bb2-849e-eedd118d7c0e
2
public void Render(GameObject object) { if (GetMainCamera() == null) System.err.println("Error! Main camera not found. This is very very big bug, and game will crash."); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); object.RenderAll(m_forwardAmbient, this); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_...