method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b8e394d8-8490-47d4-8fcc-d8ef3d602bb8
6
public void setVoltageColor(Graphics g, double volts) { if (needsHighlight()) { g.setColor(selectColor); return; } if (!sim.isShowingVoltage()) { if (!sim.isShowingPowerDissipation()) // && !conductanceCheckItem.getState()) { g.setC...
d0c27d36-1668-4783-9dd5-e3fab31a6bdc
9
void resampleProcess() throws FileNotFoundException{ //Scan entries in the index java.util.Iterator<Entry<String, long[]>> iter = index.entrySet().iterator(); long conNo ; int evictCount=0; while(iter.hasNext()){ entryCount++; long meta[] = iter.next().getValue(); if(meta[0]<=threshold && evictCount < samp...
7b422544-c32b-4577-8e0f-07bcbe7d4ff0
5
public static void greyWriteImage(double[][] data){ //this takes and array of doubles between 0 and 1 and generates a grey scale image from them BufferedImage image = new BufferedImage(data.length,data[0].length, BufferedImage.TYPE_INT_RGB); for (int y = 0; y < data[0].length; y++) { ...
1750807b-a7b0-4de7-8219-68de0e4d7049
5
static void selection_sort(int num[]) { int pivot,min,pos=0; for (int i=0;i<num.length-1;i++) { pivot=num[i];min=num[i+1]; for (int j=i+1;j<num.length;j++) { if(num[j]<=min) { min=num[j]; pos=j; } } if(min<pivot) { temp=pivot; num[i]=min; num[pos]=temp; } ...
30e2aefb-8514-4df4-a178-fb50407f078b
2
public void addNewNPC(NPC npc, stream str, stream updateBlock) { int id = npc.npcId; npcInListBitmap[id >> 3] |= 1 << (id&7); // set the flag npcList[npcListSize++] = npc; str.writeBits(14, id); // client doesn't seem to like id=0 int z = npc.absY-absY; if(z < 0) z += 32; str.writeBits(5, z); // y co...
19b9c473-a32f-4621-93c0-f9121733f7d3
1
public Scores copy( ) { // create new Scores object Scores temp = new Scores(); // make it identical to 'this' object for (int i=0; i<grades.length; i++) { temp.grades[i] = grades[i]; } // return the copy return temp; }
227bc2b3-f275-4a9b-ab1b-d42ac80f603d
0
public Wall(int x,int y) { super(x,y); }
fcad5d0b-b1c7-47b5-af92-4a4ac01d702b
1
private void connect() { graph.addGraphListener( graphListener ); for( GraphItem item : items() ) { graphListener.itemAdded( graph, item ); } }
db815326-7d30-40f6-ba47-f0b6aa237d25
7
final static public void optionWriter(String attrib, String content) { File configf = new File(Start.sport, "config.txt"); String[] inhalt = null; boolean inside = false; if(configf.exists()) { try { inhalt = Textreader(configf); } catch (IOException e) {} for (int i=0; i<inhalt.l...
5ecae4b8-66a6-415b-9c63-9f334abe1f2d
4
public static void removeDupesHeadside(Vector someVector) { // we'll be storing census info here TreeSet censusTree = new TreeSet() ; if (censusTree == null) { return ; } // end if // grab the vector's starting size int size = someVector.size() ; // starting at the tail int position = size - ...
59f4d935-f1b3-401c-bf6d-89702775e06b
4
@Override public int compareTo(Interval i2) { // Start if (start > i2.start) return 1; if (start < i2.start) return -1; // End if (end > i2.end) return 1; if (end < i2.end) return -1; return 0; }
ac8da9de-b658-400b-865a-ddf35ec9e57d
7
public static List<Car> getFreeCars() throws LoginLogicException { List<Car> freeCars = new ArrayList<Car>(); Connection connection = null; try { connection = ConnectionPool.getInstance().takeConnection(); // ������������������ �������� ������������������ ���������� �� �������������� AbstractDAO<Car> ...
971290f6-e954-4b69-bcbb-ff09f1287b63
1
private String display() { String displayString = ""; if (data == null) { return displayString; } displayString += data.toString(); return displayString; }
31da3936-59dc-4945-ad51-c363b2ab24a7
8
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((cost == null) ? 0 : cost.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((partNumber == null) ? 0 : partNumber.hashCode()); result = prime * result ...
ee032ff5-e33f-4ff1-9251-5cb72f91069b
0
public FoodItem orderFoodItem(String foodItemName) { return getFoodItem(foodItemName); }
03345256-4720-4c9b-9665-d13f803f9fa8
4
public List<Integer> getShortedPath(Integer start, Integer stop) { dijkstra(start, stop); vertex.clear(); distance.clear(); Integer i = stop; ArrayList<Integer> path = new ArrayList<>(); while(i != start && i != null) { i = predecessors.get(i); if(i != null && !i.equals(start)){ path.add(i); }...
3ec2ba4f-7680-46ae-aef9-1665218b2ffa
4
public final BufferedImage loadImage(URL imageName) { if (imageName == null) throw new NullPointerException("AssetLoader.loadImage: NULL parameter supplied."); BufferedImage image = null; try { // Attempt to load the specified image and then create a compatible ...
f78fcbfd-71f0-4490-aff1-a206eaac4891
3
public boolean updateSongMetadata(MusicObject newEntry,MusicObject oldEntry) throws SQLException { if (connection == null) { connection = getConnection(); } if (updateSongStmt == null) { updateSongStmt = connection.prepareStatement("UPDATE org.MUSIC " + "SET song_name = ?, "+ "file_hash = ?,...
5c59c242-8ec1-4e17-895f-7e1d1b8d713a
4
public String makeMove(CardGame game) { if (boardIndexTo != -1) { switch (moveType) { case FROM_DECK: return makeDeckMove(game); case FROM_BOARD: return makeBoardMove(game); case FROM_PILE: re...
6e954a07-fcdc-4d61-9c07-a137cd6e5fa1
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Set<MOB> h=properTargets(mob,givenTarget,auto); if(h==null) { mob.tell(L("There doesn't appear to be anyone here worth scaring.")); return false; } if(!super.invoke(mob,commands,gi...
1eeb0f16-0f11-4bc5-8c84-b1695b2d1931
5
private void initNextItem(boolean advance) { if (this.endOfPage) { nextBlock = null; return; } if (advance) { if (!iterator.next(Level.BLOCK)) { this.endOfPage = true; return; } } try { ...
bfe51cb3-e172-46f2-b91e-2058c63367f6
9
public void addRecipe() { for (int i = 0; i < 4; i++) { GameRegistry.addRecipe( new ItemStack(DCsFenceSlab.fenceslabW, 6, i), new Object[]{" X ","XXX", Character.valueOf('X'), new ItemStack(Block.planks,1,i)}); } for (int i = 0; i < 8; i++) { I...
f8a5660f-d6a6-4d0a-afd5-080d2172eaf3
6
public static HashMap<String, File> prepareDictionaryFiles(String path){ File dir = new File(path); if (!dir.isDirectory()){ return null; } HashMap<String, File> map = new HashMap<String, File>(); File[] files = dir.listFiles(); for (File file : files){ if (!file.isFile()){ continue; }...
6f9a4ae9-7ae0-4d54-99ba-b766e72cf119
0
@BeforeClass public static void setUpClass() { }
ba6d6ca3-b886-4ba1-9521-a64ae20456f1
1
public void visit_ifgt(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
ade04504-a7fa-4c33-9f51-5256adc0ba35
2
private void isEqualToDate(final Object param, final Object value) { if (value instanceof Date) { if (!((Date) param).equals((Date) value)) { throw new IllegalStateException("Dates are not equal."); } } else { throw new IllegalArgumentException(); } }
859068b9-31a7-4371-a8fb-62046a465acb
2
public String getShortcutToolTip() { String tip = getToolTip(); KeyStroke stroke = getKey(); if (stroke == null) return tip; int index = findDominant(tip, stroke.getKeyChar()); if (index == -1) return tip + "(" + Character.toUpperCase(stroke.getKeyChar()) + ")"; return tip.substring(0, index) + "(" + ...
f89c6a55-2191-4159-aeca-82b12e0e7880
7
void rehashPostings(final int newSize) { final int newMask = newSize-1; RawPostingList[] newHash = new RawPostingList[newSize]; for(int i=0;i<postingsHashSize;i++) { RawPostingList p0 = postingsHash[i]; if (p0 != null) { int code; if (perThread.primary) { final int st...
d690e4a5-4161-4a41-9e06-d19f74479b09
3
private Integer calVer(String s) throws NumberFormatException { if (s.contains(".")) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { final Character c = s.charAt(i); if (Character.isLetterOrDigit(c)) { ...
8bcfd885-0e2e-4234-8b3c-841b5deb8f04
0
public void setCode(long value) { this._code = value; }
a640026f-5c2f-4203-ac83-4bca3cc42223
3
public void creaAutomataCerradura(int tipoCerradura) { try { if (tipoCerradura == 0) { System.out.println("Generando automata para cerradura epsilon..."); } else { System.out.println("Generando automata para cerradura positiva..."); } ...
d1f9db40-f086-476f-b971-40678e14e219
1
protected App() { if (Platform.isMacintosh()) { Application app = Application.getApplication(); app.setAboutHandler(AboutCommand.INSTANCE); app.setPreferencesHandler(PreferencesCommand.INSTANCE); app.setOpenFileHandler(OpenCommand.INSTANCE); app.setPrintFileHandler(PrintCommand.INSTANCE); app.setQui...
579f91cb-91e4-4945-b690-afc606eda76e
9
public ArrayList<Integer> spiralOrder(final List<List<Integer>> a) { ArrayList<Integer> result = new ArrayList<Integer>(); boolean left = true; boolean right = false; boolean top = false; boolean down = false; int lci = 0; int rci = a.get(0).size() -1; int tri = 0; int bri =...
234d552d-2600-45bf-894b-67641ff0571d
1
public void append(String fileName,String message){ try { BufferedWriter writer = new BufferedWriter(new FileWriter(fileName,true)); writer.write(message); writer.close(); }catch (java.io.IOException e) { this.plugin.logMessage("Unable to write to "+fileName+": "+e.getMessage()); } }
ccfb702c-1315-40b5-9e7c-4f026d69b29e
0
public static void main(String[] args) { System.out.println(Runtime.getRuntime().availableProcessors()); }
7e88155e-f4fe-4138-8363-c7f57f1719b8
1
public JPanel getMiscMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.misc; }
0d2f54a3-d247-4377-8fed-f06f30f7dc8d
2
public boolean femaleAgree() { if ((passion <= 80) && (this.previousAction != 3)) return true; return false; }
50a7110a-1910-4fdf-bf36-7a53394a5579
5
public void addFishes(Fishes fishes) { Iterator<Fish> ite = fishes.Iterator(); while (ite.hasNext()) { Fish fish = ite.next(); for (int i = 0; i < fishContainers.size(); i++) { if (fishContainers.get(i).getName().equals(fish.getName())) { if (fishContainers.get(i).getMin() <= fish.getLength() ...
72f29c01-79a7-42cb-8c03-4e4f23fed684
4
protected boolean in_grouping_b(char [] s, int min, int max) { if (cursor <= limit_backward) return false; char ch = current.charAt(cursor - 1); if (ch > max || ch < min) return false; ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false; cursor--; return true; }
907b77a4-5272-4cb2-aa4f-9b86f87a74cf
6
private static Controller getController(final String uri, final String method) throws GameServerException { if (uri.matches(LOGIN_SUFIX_PATTERN) && method.equals(GET_METHOD)) { return ApplicationContext.getLoginController(); } else if (uri.matches(POST_SCORE_PATTERN) && method.equals(POST_METHOD)) { r...
cd2c0c4e-0ba3-4175-8463-1ef09175c9d8
1
public void setzPhase(int startEinheiten) { while(startEinheiten > 0) { spieler1.einheitenSetzen(1, laenderGraph); wechsleSpieler(aktuellerSpieler); spieler2.einheitenSetzen(1, laenderGraph); wechsleSpieler(aktuellerSpieler); startEinheiten--; } }
a3830b58-73cd-414d-8137-fe7b7210804a
3
public static long removeAddress(Address address, long sessionID) throws SessionException { if (sessionID <= NO_SESSION_ID) { throw new SessionException("A valid session ID is required to remove an address", SessionException.SESSION_ID_REQUIRED); } Contact contact...
05dfc655-07e3-41d8-88e1-5279368485a7
5
private Iterator<Entry<String, String>> getTemplateLocations() { final Log log = getLog(); List<Resource> r = this.resources; //If no resources specified if (r == null) { final Resource resource = new Resource(); resource.source = new FileSet(); ...
6789b718-a5a9-42a0-89bd-950d9e11f591
4
public ContextFreeGrammar convertToContextFreeGrammar(Automaton automaton) { /** check if automaton is pda. */ if (!(automaton instanceof PushdownAutomaton)) throw new IllegalArgumentException( "automaton must be PushdownAutomaton"); if (!isInCorrectFormForConversion(automaton)) throw new IllegalArgum...
4f953608-ac28-4ff8-b9dc-3bcfc308da1d
4
private void submit(Schedule schedule, Teacher teacher) { String error = ""; if(schedule == null) { error += " - schedule \n"; } if(teacher.getId() <= 0) { error += " - teacher \n"; } if(schedule != null && teacher.getId() > 0){ //Component c = tabbedPane.getSelectedComponent(); this.group_...
c9f63ca5-a9d9-45f4-b084-72a01aa43dd8
9
public FullPalletTest() { ArrayList<CSIColor> list = new ArrayList<CSIColor>(); for (int i = 0; i < CSIColor.FULL_PALLET.length; i++) { list.add(CSIColor.FULL_PALLET[i]); } Collections.sort(list); try { mainInterface = new WSwingConsoleInterface("CSIColo...
87d0ae24-38fa-4c8d-8635-824684eb79a9
0
public void removeLoginListener(LoginListener listener){ loginListeners.remove(listener); }
7e9ac5d3-081e-4108-910b-c0ac81a8c66d
4
public void initializeServerWithPersistDataInServer() throws IOException, CubeXmlFileNotExistsException, DocumentException, CubeAlreadyExistsException, CorrespondingDimensionNotExistsException, SchemaAlreadyExistsException, CorrespondingSchemaNotExistsExceptio...
f3b14500-38cb-4cdd-8a26-923c75e72c1d
7
private Boolean checkType(String value, String dataType){ Boolean ret = false; if( "#int".equals(dataType)){ try{ Integer.parseInt(value); return true; }catch(NumberFormatException e) { return false; } }...
f38e9a57-2269-4820-85fe-e6acad0d60c9
3
public static void main(String[] args) { for (int i = 0; i < 10; i++) { Tourist person = new Tourist(); try { person.takeTour(); // if an exception is thrown from previous line, this next // instruction is not executed System.out.printf("Tourist %d say: This is cool%n", i + 1); } catch (TooHo...
cfad3346-8cb8-48b5-a354-8c8fed9f18e1
7
public static By parse(String elementLocator) throws InvalidSeleneseCommandArgumentException { String matched; for(ElementLocator locator : ElementLocator.values()) { if((matched = locator.find(elementLocator)) != null) { switch(locator) { case ID : return By.id(matched); case NAME : return By.na...
caeee4ef-10ee-43ca-9573-4b59fc3e2572
4
/* */ public void run() /* */ { /* */ while (true) /* */ { /* */ try { /* 157 */ Thread.sleep(17L); /* */ } catch (Exception e) { /* 159 */ e.printStackTrace(); /* */ } /* */ /* 162 */ for (int i = 0; i < landingboats.size(); i++) { /*...
68209e9b-a37d-4bb1-8fde-8378091c90ab
8
private Grammar trim(Production[] prods) { myVariableMap=new HashMap <String, String>(); char ch='A'; for (int i=0; i<prods.length; i++) { String lhs=prods[i].getLHS(); if (ch=='S' || ch=='T') { ch++; } int aa=lhs.indexOf("V("); while (aa>-1) { // System.out.println("in 1st "+lh...
171a36fe-a04b-4d17-a772-d121002dc178
7
private void handleEvents(int keyCode) { switch (applicationState.getState()) { case ApplicationState.MAIN_MENU: handleMainMenu(keyCode); break; case ApplicationState.HELP: case ApplicationState.ABOUT: ...
103dc4ef-b99c-450f-af54-74c8eb62930d
6
private void createNetwork(int inputs,int outputs){ if(currentSpecies==null){ if(net==null){ System.out.println("Neural Network created in net"); net=new SpeciationNeuralNetwork(history,inputs,outputs); if(net2==null) currentNetwork...
2eb2d592-b69d-43be-b95b-618f9e489054
7
public synchronized void close() { if (isClosed) { return; } isClosed = true; if (cycLeaseManager != null) { cycLeaseManager.interrupt(); } if (cycConnection != null) { cycConnection.close(); } if (areAPIRequestsLoggedToFile) { try { apiRequestLog.close();...
6af47eb4-4fe3-4d5b-a353-ef02e6720e5f
9
@SuppressWarnings("unchecked") void readGaussianBasis() throws Exception { Vector sdata = new Vector(); Vector gdata = new Vector(); atomCount = 0; gaussianCount = 0; int nGaussians = 0; shellCount = 0; String thisShell = "0"; String[] tokens; discardLinesUntilContains("SHELL TYPE PR...
d6ec4d16-3589-491f-b574-673b69fadae8
7
protected void onMouseClick(int var1, int var2, int var3) { if(var3 == 0) { for(var3 = 0; var3 < this.buttons.size(); ++var3) { Button var4; Button var7; if((var7 = var4 = (Button)this.buttons.get(var3)).active && var1 >= var7.x && var2 >= var7.y && var1 < var7.x + var...
d05deae4-40ff-4a5a-9e28-8f40960d2cd8
0
@Override public void setName(String name) { this.name = name; }
19000cf8-fa94-4a32-b4f7-c9fed3fa4263
1
public boolean replaceSubBlock(StructuredBlock oldBlock, StructuredBlock newBlock) { if (bodyBlock == oldBlock) bodyBlock = newBlock; else return false; return true; }
5d4a946d-f078-4b04-9d01-bad132d5c7f5
8
public void run() { try { boolean eos=false; byte[] buffer=new byte[8192]; while(!eos) { OggPage op=OggPage.create(source); synchronized (drainLock) { pageCache.add(op); } if(!op.isBos()) { ...
01571ee6-ae1e-4089-99cb-3ee7f261e8d6
4
public static String longToPlayerName(long l) { if (l <= 0L || l >= 0x5b5b57f8a98a5dd1L) { return null; } if (l % 37L == 0L) { return null; } int i = 0; char ac[] = new char[12]; while (l != 0L) { long l1 = l; l /= 37L; ac[11 - i++] = VALID_CHARS[(int)(l1 - l * 37L)]; } return new Strin...
45fa4381-6d7d-4d51-bb59-a6a684cd3a72
1
public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; }
33a68e5b-5932-43a6-b223-7e646907b95e
7
public DVConstraints dvConstraints() throws ConstraintException { final DVConstraints result = DataFactory.getInstance().createDVConstraints(); final Term term = getValue(); if (term.isVariable()) return result; final Functor functor = (Functor) term; if (functor.definitionDepth() == 0) { for (final Exp...
2590bb52-c2c5-4a46-9de0-581ae09a357d
3
public static void main(String[] args) { int sum = 0; for (int i = 1; i <= 1000; i++) { if (i % 3 == 0 || i % 5 == 0) { sum += i; } } System.out.println(sum); }
0e38b549-4ae1-464d-850b-6bdb0cbe5ad7
9
private void create() { shell = new Shell(SWT.APPLICATION_MODAL | SWT.CLOSE ); shell.setText("Project File Restore/Replace"); shell.setMinimumSize(450, 250); GridLayout layout = new GridLayout(1,false); shell.setLayout(layout); layout.horizontalSpacing = 5; layout.verticalSpacing = 5; layout.makeColu...
03223b89-9d28-494c-a697-3e7d321e1031
7
public void showTable() { waitlb1.setVisible(true); if (!l.isEmpty()) { if (r2.isSelected()) { if (tmpHead == null) { tmpHead = l.get(0); l.remove(0); } else if (l.get(0).equals(tmpHead)) { l.remove(0); } } else { if (tmpHead != null && !l.get(0).equals(tmpHead)) { l.add(0,...
c7be43ea-816b-4281-ab18-c281aeb1bdfb
9
public static int highestNumberPerimeter(int upperBound) { int perimeter = 1, a = 1, b = 1, c = 1, max = 0; int[] numberOfCombinations = new int[upperBound]; // Initialize the array to all zeros for (int i = 0; i < upperBound; i++) { numberOfCombinations[i] = 0; } ...
4a57b710-2fe4-4ee9-83db-ce4179360add
7
public static int encontrarMultiplosDe7(int[] v, int a, int b){ if (a == b) { if (v[a] % 7 == 0) return 1; else return 0; } else { if (a < b) { while (a < b) { if (v[a] % 7 == 0) return 1 + encontrarMultiplosDe7(v, a + 1, b); else return encontrarMultiplosDe7(v, a + 1, b); } } else { ...
efc41a7d-0241-4ff2-ada7-c6a40a3c847c
2
@Override public void run() { requestFocus(); Image image = new BufferedImage(800, 600, BufferedImage.TYPE_INT_ARGB); while(isRunning) { Graphics g = image.getGraphics(); g.drawImage(Images.background,0,0,null); level.render(g); g.dispose(); level.tick(input); try { g = getGra...
ca5c458a-91d5-4844-9382-9d3903e2795c
3
boolean releaseSystemKey(int keyValue){ try{ Robot r = new Robot(); r.keyRelease(keyValue); if( isShift==true ) shiftOff(); if( isCtrl==true ) ctrlOff(); return true; }catch(Exception e)...
faa5593f-2b57-4eb2-b896-334f6125e7e4
8
public void testAvailabe(int H, int V, int A) { // H&V number want be bls of // indH &indV A = index if ((this.indexH + H) >= 8 || (this.indexV + V) >= 8 || (this.indexV + V) < 0 || (this.indexH + H) < 0) { this.availableCells[A] = null; } else if (myBoard.bordaCell[this.indexH + H][this.indexV...
f1a1dfc5-a82c-4385-9dbb-77b849026d37
7
public boolean isXCollision(int x) { Point midpoint = getMidPoint(x, y, BOAT_WIDTH, BOAT_HEIGHT, rotation); int centreX = (int) midpoint.getX(); int centreY = (int) midpoint.getY(); //Color c = new Color(map.grass.getRGB(centreX, centreY)); if (centreX > 150 && centreX < 1050 && centreY > 0 && centreY < ma...
4902ae77-a719-48f6-9966-9d6d03872a5c
7
private Object getValueOfProperty(Object o, Method method, Field field) { // read! Object value = null; try { method.setAccessible(true); value = method.invoke(o, new Object[] {}); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } ...
ba16e366-2475-471c-aa4d-71909a374409
3
public String getTypeString(Type type) { if (type instanceof ArrayType) return getTypeString(((ArrayType) type).getElementType()) + "[]"; else if (type instanceof ClassInterfacesType) { ClassInfo clazz = ((ClassInterfacesType) type).getClassInfo(); return getClassString(clazz, Scope.CLASSNAME); } else if...
7715750d-3076-4e5a-b099-9597a6c4f2e0
9
public FenetreBuffersTailles(){ int jjj=0; System.out.println("tableauxxx"+ tableauxx.size()); //tableauxx.clear(); System.out.println("tableauxxxdddd"+ FenetreBuffersNumeros.getTableauTailles().size()); srids.clear(); System.out.println("srids"+ FenetreBuffersNumeros.getSrids().size()); System....
03cff19f-bd84-4930-9d2d-466a0c1abb7d
4
public static void arc(double x, double y, double r, double angle1, double angle2) { if (r < 0) throw new RuntimeException("arc radius can't be negative"); while (angle2 < angle1) angle2 += 360; double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2*r); doubl...
9578fa5d-82ce-4d27-84e5-65a60e246b46
5
private void assignActionsToButtons() { glGlun.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { updateButtonStates(); } public void removeUpdate(DocumentEvent e) { updateButtonStates(); } ...
2d7a3970-798f-44fa-b233-bc143d50434f
9
private void keepGettingFeatures(int count) { // If we're done, don't do anything else. if (count >= level) { return; } double data[]; int width = subImage.length; int height = subImage[0].length; // We're doing the same thing as above, but we're not working with a Raster anymore. double[][] firstPha...
0ce94d6d-4fe1-42ed-9b8b-c1a376977e53
8
@Test public void testAIWhatFinishLineWith2EnemyMarkInVosxodyawDiagonal() { Field field = new Field(); RulesOfGameAndLogic rog = new RulesOfGameAndLogic(field); field.eraseField(); int rand = (int)(Math.random()*2); int randINotSetCell = (int)(Math.random()*2); for (...
b9276a2f-b9db-4697-ac70-f9d8b0512d62
2
public static String formatNumber(int start) { DecimalFormat nf = new DecimalFormat("0.0"); double i = start; if(i >= 1000000) { return nf.format((i / 1000000)) + "m"; } if(i >= 1000) { return nf.format((i / 1000)) + "k"; } return ""+start; }
bd52f388-1915-49df-a5a9-f853a95660f0
5
public Tour Mate(Tour t){ ArrayList<City> temp = t.tour; Integer random = (int) (Math.random()*tour.size()); ArrayList<City> child = new ArrayList<City>(tour.subList(0, random)); for(int i=0;i<child.size();i++){ temp.remove(child.get(i)); } for(City c:temp){ if(c!=null){ child.add(c); } } ...
93d59ad1-e05f-4516-b595-d8dc84e0b746
6
public OperationExpression simplify() { if (((PrimitiveOperator) op).isComplexIDOfLeft()) { return new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP), left); } if (((PrimitiveOperator) op).isComplexNotOfLeft()) { return new UnaryOpExpression(new PrimitiveOp...
ca588b41-a558-4cc6-9a20-e49bef788a80
6
public ArrayList<String> load(String csvFile) { BufferedReader br = null; String line = ""; String csvSplitBy = ","; data = new ArrayList<String>(); String[] tempArray=null; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { tempArray=line.split(cs...
09d384ed-b3a8-4c55-983f-2249bca8db28
7
public void renderHealth(int x, int y, int xOffset, int yOffset) { x <<= 5; y <<= 5; x = (int) (((x + xOffset) - camera.getXOffset())); y = (int) (((y + yOffset) - camera.getYOffset())); x += 2; y += 36; int barWidth = 29; int barHeight = 4; int[] bg = new int[barWidth * barHeight]; // Render the...
7828b60f-1ab6-4a42-986c-4ecbfbf9c7bc
5
protected void calculateGlobalBest() { int best = 0; if(maximum){ for(int i = 0; i < fitness.size(); i++){ if(fitness.get(i) > fitness.get(best)){ best = i; } } }else{ for(int i = 0; i < fitness.size(); i++){ if(fitness.get(i) < fitness.get(best)){ best = i; } } } globalB...
a90f054f-a661-4b1a-b168-a189652ae317
3
public void hbasePreDispatch(List<Row> rows, List<StoreLoader<?>> rowLoaders, List<Increment> increments, List<StoreLoader<?>> incrementLoaders, byte[] familyName) { Put entityPutRow = new Put(getId().getKey().getBytes()); for (Map.Entry<Key, Data> column : getColumns().entrySet()) { entityPutRow.ad...
bbf5d113-a67f-44dc-9892-e169ea7fc32a
0
public static void main(String[] args) { Ex1 e1 = new Ex1(); System.out.println(e1); }
ef0df500-bb90-4c9c-81cc-a25affdb7083
3
public String addMessage() throws Exception { System.out.println("userName is " + userName); Connection conn = null; int addCount = 0; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(url, user, psw); if (!conn.isClosed()) System.out.println(...
c8d92d34-54a5-4c31-af21-67e8d999e32e
6
public void addBorder() { for (int i = 0; i < width(); i++) { for (int j = 0; j < height(); j++) { if (i == 0 || j == 0 || i == width() - 1 || j == height() - 1) maze[i][j] = 1; } } maze[1][0] = 0; maze[width() - 2][height() - 1] = 0; }
5cc3aad2-68ec-44bf-b661-f9a95758b95e
3
public Connection getConnection() { // System.out.println("-------- Mysql Connection Testing ------"); try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is MySQL Driver?"); e.printStackTrace(); ...
853829dc-0d8e-476b-ae9e-86b3ad79e781
2
public static int Str2Int(String str) { if (str == null || "".equals(str)) return 0; return Integer.parseInt(str); }
96075e21-c6ba-4705-bac1-37811e73f4b3
4
public static double[][] doubleSelectionSort(double[][] aa){ int index = 0; int lastIndex = -1; int n = aa[0].length; double holdx = 0.0D; double holdy = 0.0D; double[][] bb = new double[2][n]; for(int i=0; i<n; i++){ bb...
15435c92-e327-48af-8c4b-c84e98049128
3
public static Status getEnum(String value) { if (value == null) { throw new IllegalArgumentException(); } for (Status v : values()) { if (value.equalsIgnoreCase(v.getValue())) { return v; } } throw new IllegalArgumentException(); }
7eccd4bc-faa2-4a96-961b-0b27776be238
3
public void aumentarTiempoEnEspera() { if (numProcesos != 0) { for (int i = menorPrioridadNoVacia; i < listas.length; i++) { for (int j = 0; j < listas[i].size(); j++) { listas[i].get(j).aumentarTiempoEnEspera(); } } } }
a7caa2b1-5065-4b9e-a4ab-398272354733
6
public static String getTypeValById(Integer id) { switch (id) { case TYPE_DATE: return "dateval"; case TYPE_FLOAT: return "floatval"; case TYPE_INT: return "intval"; case TYPE_LIST: return "listval"; ...
2cc15810-061c-4d7e-b26e-194f05ae3165
4
public static void alteraContato(String nome, String novonome, String novoendereco, String novotel) throws FileNotFoundException, IOException { StringBuilder sb = new StringBuilder(); InputStream is = new FileInputStream("Contatos.txt"); PrintStream qs = new PrintStream("Auxiliar.txt"); ...
e5852df3-247c-4cf8-b2fe-b4af632413d9
4
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // CHANGE: The EJB is instantiated automatically // CourseModel model = CourseModelImpl.getInstance(); String path = request.getServletPath(); if (path....
182cfbd4-2684-474e-9d16-d6e9f1f493f8
0
public KeyInfoType getEncryptionKey() { return encryptionKey; }
fc25bc32-c196-4dfe-881d-3dda55fa6c42
6
public void Jouer() { afficherInfosDebutTour(); Joueur j; for(IndexJoueurCourant = 0; IndexJoueurCourant < this.joueurs.size(); IndexJoueurCourant++){ int nbdoble=1; j = this.joueurs.get(IndexJoueurCourant); j.avancer(); ...