method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
864346c4-5422-494f-840d-23d6665157f6
4
protected Injector createInjector() throws Exception { // Extract the modules classes WithModules wm = this.getTestClass().getJavaClass() .getAnnotation(WithModules.class); Class<? extends Module>[] moduleClasses = wm.value(); // Instantiate the modules Module[] modules = new Module[moduleClasses.length]...
3a3c2711-699e-4801-af88-e90eefd0a10e
9
public static void mapClasses(int numClusters, int lev, int[][] counts, int[] clusterTotals, double[] current, double[] best, int error) { // leaf if (lev == numClusters) { if (error < best[numClusters]) { best[numClusters] = error; ...
66ebe9b4-8ecd-4022-81c8-f91012e22f6d
6
private byte[] getIV() { if (algName.equals("Blowfish")) { return IV; } else if (algName.equals("DES")) { return IV; } else if (algName.equals("TripleDES")) { return IV; } else if (algName.equals("AES")) { byte res[] = new byte[16]; ...
7efbe468-a311-44f2-af4f-611e91bcbcca
5
private static ContentType TranslateContentTypeToEnum(String contentType){ switch(contentType){ case "application/rdf+xml": return ContentType.RDF; case "application/x-turtle": return ContentType.TURTLE; case "text/turtle": return ContentType.TURTLE; case "text/plain": return ContentType.NT; cas...
2f6f1777-35a8-494b-9822-5be270797663
0
private DefaultSameAsServiceFactory() { // prevents this class instantiation }
57a4e4ed-0e29-4109-ab10-77a7256c58c1
3
public DomainVisitor(final String baseUrl, final ContentVisitor visitor) { this.visitor = visitor; if ((baseUrl == null) || (baseUrl.trim().length() == 0)) { throw new IllegalArgumentException("baseUrl cannot be null or empty"); } Matcher matcher = Pattern.compile("(http://[^...
2f9fb074-7dae-440f-98a5-466f84b15827
7
public void loadIndexRatesTsv(Reader input) { SortedMap<String, SortedMap<Integer, Double>> historicRates = new TreeMap<String, SortedMap<Integer, Double>>(); Set<String> unmappedLchIndices = new TreeSet<String>(); try { CSVReader reader = new CSVReader(input, '\t'); reader.readNext(); // dump h...
6e6a259a-063e-4e23-a5a8-41e132c44a10
6
public int getCombatLevel() { int attack = getLevelForXp(0); int defence = getLevelForXp(1); int strength = getLevelForXp(2); int hp = getLevelForXp(3); int prayer = getLevelForXp(5); int ranged = getLevelForXp(4); int magic = getLevelForXp(6); int combatLevel = 3; combatLevel = (int) ((defence + hp +...
4e6dbd33-f7cb-4fe7-9262-ea60457cdd73
3
public boolean isKnown(Long id, Object obj) { List<Object> list = idBuffer.get(id); if(list != null) { for(Object o:list) { if(o == obj) { return true; } } } return false; }
22f481ba-3c91-432a-8257-abac63b97240
8
protected void passGame(int ex, int ey, GoBoard gb) { int px = gb.getPx(); int py = gb.getPy(); int pw = gb.getPw(); int ph = gb.getPh(); if (ex > px && ex < px + pw) { if (ey > py && ey < py + ph) { if (gb.getTurn() == 1) { gb.set...
8dee1878-0a50-4454-8fb1-24abee403e1e
4
private int searchAccount(String type){ int cant=0; for(CuentaBancaria temp: cuentas){ if(temp!=null && temp.validarTypeAccount(type) && temp.isActiva()){ cant++; } } return cant; }
210af0c5-9492-47b5-9409-5593fc31ae3c
6
public Number evaluate(RNG rng, VariableResolver resolver) { Stack<Number> evaluation = new Stack<Number>(); @SuppressWarnings("unchecked") LinkedList<ALEQueueElement> postCopy = (LinkedList<ALEQueueElement>) postfix.clone(); while(!postCopy.isEmpty()) { ALEQueueElement element = postCopy.poll(); if (e...
6ab62ef8-479c-411e-aca3-29ebc531a34c
6
public void Throw() { do { value = 0; for(int i = 0; i < numOfDice; i++) { int random = (int)(Math.random() * 6 +1); value += random; if(DEBUG) JOptionPane.showMessageDialog(null, random); } numOfThrows++; } while (!((even && Value() % 2 == 0) || (!even && Value() % 2 != 0)))...
cdbe68de-1b6b-443d-8ad8-7eca0b6137f3
3
private int getIndex(String[] fields, String key) { int i = 0; while (i < fields.length && !fields[i].equalsIgnoreCase(key)) { i++; } if (i >= fields.length) // wasn't found return -1; else return i; }
49a749af-c9e5-46b9-942a-343b517b149b
1
private void initialConfigCheck(){ if(!(new File(this.getDataFolder(),"config.yml").exists())){ this.logMessage("Saving default configuration file."); this.saveDefaultConfig(); } }
0437ccdc-d46d-4b5a-ba6b-c7116592d0ac
6
public Direction getMove(Simulation sim){ // increment EV expectedValue.addZatrix(INCREMENTING_FUNCTION); //reset current cell's EV expectedValue.setElement(sim.getRow(), sim.getColumn(), DrivingRange.PICK_UP_RATE * expectedValue.getElement(sim.getRow(), sim.getColumn())); // find max from adjacent c...
1efe6803-4231-435b-ab05-5d95d5a865c7
3
private List<Character> readTypes() { // the next byte should be a ',' if (bytes[streamPosition] != 0x2C) { return null; } streamPosition++; // find out how long the list of types is int typesLen = lengthOfCurrentString(); if (0 == typesLen) { return null; } // read in the types List<Characte...
c7fc1ba4-3fee-4072-9cdf-9207014df727
8
public void startSearchTweetsDate(String[] keywords, int size){ String[] anos = new String[] {"2014"}; int numAnos = 1; String[] meses = new String[] {"04"}; int numMeses = 1; String[] dias = new String[] {"01","02","03","04","05","06","07","08"}; int numDias = 8; Twitter twitter = TwitterFactory.ge...
72bc699b-37cb-480c-94cb-883e1aae88b7
2
public static void main(String[] args) { final IntegerWrapper wrapper = new IntegerWrapper(); for (int i = 0; i < 1000; i++) { Thread thread = new Thread() { public void run() { try { Thread.sleep(50); } catch (InterruptedException e) { } wrapper.i++; } }; thread.start();...
9ea1e783-65f4-47db-a481-e18f1ab1ca7a
8
public void printPage(String size) { double width = 0.0; double height = 0.0; double margin = 0.0; PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); try{ PrinterJob pj = PrinterJob.getPrinterJob(); if (pj.printDialog()) { ...
b9211e32-2d89-4643-8847-2d57832f62a9
3
private List<Point> findMaxima(ImageProcessor smoothed){ // smoothed.setRoi(40, 40, smoothed.getWidth()-2*40, smoothed.getHeight()-2*40); MaximumFinder maxFind = new MaximumFinder(); ByteProcessor maximas = maxFind.findMaxima(smoothed, 0.0, ImageProcessor.NO_THRESHOLD, MaximumFinder.SINGLE_POINTS, false, false); ...
deaa319d-24e9-4da6-8fea-fff7fa368692
4
public static Object readObject(String filename) { ObjectInputStream in = null; Object result = null; try { in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(filename))); result = in.readObject(); } catch (FileNotFoundException e) { } catch (Exception e) { e.printStackTrace(); ...
9606ab4b-0be7-4996-ad95-8af5e27d163b
7
protected Comparator getComparator(int column) { Class columnType = tableModel.getColumnClass(column); Comparator comparator = (Comparator) columnComparators.get(columnType); // カラム名取得(カラム名によってソートcomparatorを切り替える) String columnName = tableModel.getColumnName(column); if ...
ce4920ae-ca2b-4b33-8c6d-e43984b83d66
9
public void calculateDerived() { xStats.calculateDerived(); yStats.calculateDerived(); differencesStats.calculateDerived(); correlation = Double.NaN; if (!Double.isNaN(xStats.stdDev) && !Double.isNaN(yStats.stdDev) && !Utils.eq(xStats.stdDev, 0)) { double slope = (xySum - xStats.sum * yStat...
676f067c-a3a2-4d1d-9a7e-a723ade5b883
8
@Test public void testDeleteMiddleNode3() throws Exception { head = new LinkedListNode(1).addNode(new LinkedListNode(2)).addNode(new LinkedListNode(3)).addNode(new LinkedListNode(4)).addNode(new LinkedListNode(5)); LinkedListNode middleNode = new LinkedListNode(8); head.addNode(new LinkedLis...
7d92b2ea-b6fa-4a3b-9e2d-82719c42284d
4
public Tile cross(Tile currentTile, Character crosser){ if (crosser == null || currentTile == null){ throw new IllegalArgumentException("currentTile and crosser cannot be null"); } if (!crosser.equals(currentTile.getCharacter())){ throw new IllegalArgumentException("The given character must be on the given ...
e7928e01-d1b1-468b-b8de-a4ac2f15156c
0
public int getS2() { return this.state2; }
1d2df894-d622-41e4-b6e2-920ad0bded4f
5
@Test public void puolisojaJaAvecejaOnOikeaMaara() { int avecMaara = 0; int pareja = 0; int puolisoMaara = 0; int puolisoja = 0; for (Sitsaaja sitsaaja : sitsit.getSitsaajat()) { if(sitsaaja.avecIsSet()) { avecMaara++; if(sitsaaja.g...
5e51c52d-a04b-4c1d-af63-039d61f37da0
2
public String toString() { String s="Current batch queue\n"+ "Name\t\tID\tStatus\tRunTime\tPriority Arguments\n"; Process p = peek(); if(p == null) return s; while(p!=null){ s = s + p.toString() + "\n"; p = p.next; } return s; }
e80569f5-f5b9-430b-8fb6-0739ff6c827c
0
public VertexColor getColor() { return color; }
e196e6ed-96dd-49d7-8c1e-973642749581
2
static void restart() { for(int i=0;i<pad.length;i++) { for(int l=0;l<pad[i].length;l++) { pad[i][l].dye(defColor); } } player=0; moves=0; console.setText(""); }
385988e8-7b52-4594-8040-98e7304a175c
7
public int maximalRectangle(char[][] matrix) { int m = matrix.length; if (m == 0) return 0; int n = matrix[0].length; int[][] arr = new int[m][n]; for (int j = 0; j < n; j++) if (matrix[0][j] == '1') arr[0][j] = 1; for (int i = 1;...
161054f2-bee7-49b7-aa6d-4b936ead0f1b
2
public GeneticOutput() { super("Algoritmo Genetico"); initComponents(); s = gc.generateRandomSchedule(2, 3, 5, 6); sched = gc.printScheme(0, 0, s); for (RoomOutput[] sched1 : sched) { for (int m = 0; m<sched[0].length; m++) { add(sched1[...
ffbe7b76-ba95-4083-85c9-1ce271bd6897
5
public ArrayList stepConfiguration(Configuration config) { ArrayList list = new ArrayList(); PDAConfiguration configuration = (PDAConfiguration) config; /** get all information from configuration. */ String unprocessedInput = configuration.getUnprocessedInput(); String totalInput = configuration.getInput(); ...
8be8b726-ddd5-4655-97bb-10f8bd5d41b8
1
@Override public Object getCellEditorValue() { if (isPushed) { doEditing(); } isPushed = false; return new String("x"); }
4a4c2420-b552-4df5-89cb-572589e39840
0
public void setTimedTask( TimedTask timedTask ) { this.timedTask = timedTask; }
411e0f1d-76a5-4867-8ad8-03953e07fd88
5
private HashMap<Integer, Integer> getIntervalFrequencies(LinkedList<Integer> list, int n) { HashMap<Integer, Integer> frequenciesHashMap = new HashMap<Integer, Integer>(); HashMap<String, Integer> stringPositionMap = new HashMap<String, Integer>(); for (int listPosition = 0; listPosition < list.size(); lis...
3c063d5b-b447-4458-a08d-dfa004d19234
8
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y) { if(! isVisible) { return; } else if(isEnabled) { if(isPressed) { if(pressedIcon != null) { pressedIcon.paintIcon(c, g, x, y); } else { defaultIcon.paintIcon(c, g, x + 1, y + 1); } } else if(isRollover) { ...
147d1f15-4dce-451f-b562-795648dc227d
5
private int getScoreIncrement(int redCount, int blackCount, char player) { if (redCount == blackCount) { if (player == Board.MARK_RED) { return -1; } return 1; } else if (redCount < blackCount) { if (player == Board.MARK_RED) { ...
51c46fc1-4b76-44a0-a363-f45a88ad7e8b
9
private RouteModel getFittingRoute(ArrayList<RouteModel> routeList, UserModel userModel) { float comf = userModel.getComfortPreference(); float sust = userModel.getSustainabilityPreference(); float time = userModel.getTimePreference(); float cost = userModel.getCostsPreference(); if (comf > sust && comf > ti...
609f7eab-5833-4bfa-82ce-e277fac532b4
8
public Class<?> findClass(String name) throws ClassNotFoundException { try { CtClass cc = pool.get(name); // remove final modifier from the class if (Modifier.isFinal(cc.getModifiers())) { cc.setModifiers(cc.getModifiers() & ~Modifier.FINAL); } // remove final modifiers from all methods ...
80fe5950-7491-41d4-8052-e46c40c848bb
4
public void addBattery(int batteryNum, float voltage) { if (batteries == null) { batteries.add(new BatteryData(batteryNum, voltage)); } else { int i = 0; for(BatteryData bd: batteries) { if(bd.getBatteryNum() < ba...
f0744076-2011-48e5-9cf1-5f50015c3937
1
public static void setBearCreationProbability(double BEAR_CREATION_PROBABILITY) { if (BEAR_CREATION_PROBABILITY >= 0) Simulator.BEAR_CREATION_PROBABILITY = BEAR_CREATION_PROBABILITY; }
b7b0e5b0-e06a-40c5-af2a-e25bab91d639
7
private void getSimpleLinks(String url) { //if not already visited if (!linkHandler.visited(url)) { try { URL uriLink = new URL(url); Parser parser = new Parser(uriLink.openConnection()); NodeList list = parser.extractAllNodesThatMatch(new Node...
372538d9-b2cc-4e78-b237-207aea995890
1
private Item newString(final String value) { key2.set(STR, value, null, null); Item result = get(key2); if (result == null) { pool.put12(STR, newUTF8(value)); result = new Item(index++, key2); put(result); } return result; }
00fec362-5e0a-4e0f-97e1-0eba8dc3f4c8
5
@Override public void start(final Stage primaryStage) throws Exception { final Group container = new Group(); final Scene scene = new Scene(container, Color.TRANSPARENT); primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(final WindowEvent event) { System.ex...
14d01b0e-2286-48e1-954c-74be00d74b02
1
public GameStateManager() { // Music.init(); gameStates = new GameState[NUMGAMESTATES]; CustomFont.maximilien = CustomFont.load("/Fonts/maximilien.TTF"); GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); String[] fontFamilies = ge.getAvailableFontFamilyNames(); for (String ...
f7344f99-ae94-4230-852d-d225a86dc93a
0
public static int getNextTimerId() { return timerid++; }
77014135-7c9e-40e4-945a-871070f3a444
9
public void act() { if (!dead) { getLocation(); animation(); damageDetection(); if (moveUp && y < groundHeight && !abilityR && !abilityH && !hurt) { y += 3; } } else { if (max...
4061d763-ac25-4145-b8c0-46abe8313ab7
7
@Override protected boolean checkXObstacle(CommonObject so, double time) { return (((this.currentCoord.getX() + this.currentWidth + currentHorizontalSpeed * time >= so.getCurrentCoordinates().getX() && currentHorizontalSpeed > 0 && this.currentCoord.getX() <= so.getCurrentCoordinates().getX(...
17a9d22e-8565-490a-9fca-9b07ce2e1a18
7
@Override public void run() { plugin.info("Generating files..."); Plugin[] pluginList = plugin.getServer().getPluginManager().getPlugins(); plugin.debug("Retrieving permission nodes..."); try { PrintWriter printWriter1 = new PrintWriter(new FileWriter(plugin.permissionNodes)); PrintWriter printWriter2 =...
0c0d3240-65c4-4134-8dc0-d1c10f6ad1bf
8
private void foreach(Ant ant) { Direction direction; Position base = getBase(ant); if(ant.getHealth() < 3) { direction = tomtom.navigate(ant.getX(), ant.getY(), base.getX(), base.getY()); } else { if (!ant.isSweet()) { if (freeSugar.isEmpty()) { direction = tomtom.navigate(ant.getX(), ant.getY...
18aae51c-7a92-4f65-b620-a3b9b48bb6db
0
public List<String> getChannels(){ return Channels; }
81eeb473-9550-46de-a6de-0a7d308331e8
5
public static VRP newVRPFromFile(String path) throws Exception { BufferedReader r = new BufferedReader(new FileReader(path)); /* node count */ int nodeCount = Integer.parseInt(skipComments(r)); Integer [] demands = new Integer[nodeCount]; double[] x = new double[nodeCount]; ...
a4c4f89c-255a-4bd9-b655-b354e75b15d0
0
public static FileDataBase getFileBase(){ return fileBase; }
ae3c1d65-fca6-4fec-8df9-9468c9a6ee24
1
private boolean jj_3_54() { if (jj_3R_62()) return true; return false; }
645618b7-2dc7-419d-a1aa-0f8e3921bb45
7
public static MapaElectrico fromElement(Node tuberias, Mapa mapa, Dinero d) throws NoSeCumplenLosRequisitosException, FondosInsuficientesException, CoordenadaInvalidaException, SuperficieInvalidaParaConstruir { MapaElectrico mapaElectrico = new MapaElectrico(mapa); NodeList hijosDeRed = tuberias.getChildN...
0d450b9f-e426-44e6-8c8d-826052aeeb04
9
public static void main(String[] args) { long start = System.currentTimeMillis(); byte [] sol = new byte[1000000]; int count = 0, tmp = 0; int result = 0; ArrayList<Integer> chain = new ArrayList<>(); for(int i = 0; i < sol.length; i++) sol[i...
c8389221-d052-49c1-978e-fc6898b8addd
8
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { config = plugin.getConfig(); if (commandLabel.equalsIgnoreCase("Eventcreate")) { if (args.length == 2){ if (sender instanceof Player) { if (sender.hasPermission("EventManager.ECreate")){ String Event ...
52206981-196f-4de7-9173-36c7d359746a
5
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (airConditioned ? 1231 : 1237); result = prime * result + (automaticTransmission ? 1231 : 1237); result = prime * result + category; result = prime * result + (int) (departureDate ^ (departureDate >>> 32)); result ...
8c692d79-4114-4385-99e3-799fd2977668
8
public void playHand(Deck deck) { boolean bust = false; while (!bust) { print.print(this.getName() + "'s hand."); if (this.getHand().getPoints() > 21) { print.print("HOUSE BUST!"); //dialogue.append("\nHOUSE BUST!"); bust = true; } else if (((this.getHand().getPoints() >= 17) && !this....
b990cfff-5857-4b1c-bf15-4914880aa661
8
boolean isSystemObjectProcessable(SystemObjectProperties property, SystemObject systemObject) { final SystemObjectType propertyType = getType(property.getType()); // Typ vergleichen if(propertyType != systemObject.getType()) { return false; } final ConfigurationConfigurationObject configProperty = (Config...
d3930749-8ee3-446d-bcb5-971d68cb6f99
7
public void remove(String key) { // найти вершину с таким ключом Node node = getNode(key); if (node != null) { // если вершина не имеет сыновей if (hasNoChild(node)) { // просто удалить вершину removeNode(node); } else if (hasOneChild(node)) { // если вершина имеет ...
9dcccb72-7816-4af3-ac9f-884b5617f4a2
8
void getData(Buffer buf){ setRecipient(buf.getInt()); setRemoteWindowSize(buf.getUInt()); setRemotePacketSize(buf.getInt()); byte[] addr=buf.getString(); int port=buf.getInt(); byte[] orgaddr=buf.getString(); int orgport=buf.getInt(); /* System.err.println("addr: "+Util.byte2str(add...
a9cc9e20-c075-46eb-a9c1-cd4920e63dd6
2
public static boolean writeBinFile(String filePath, String file) { char[] fileChars = file.toCharArray(); byte[] fileBytes = new byte[fileChars.length]; for(int i=0; i<fileChars.length; i++) { fileBytes[i] = (byte)(int)fileChars[i]; } FileOutputStream outStream; try { outStream = new FileOutputSt...
fb0b62cd-d3fc-4b90-a907-d5fd2ffdb629
0
private PrivateStaticFieldSingleton () {};
c3d79e07-24ea-4c53-9715-7b01ae8fbe43
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
efb4b123-1433-4699-8b5c-7aae4a0af07a
1
public void deleteRow(String peopleName) { if (peopleName.equals((String) tableModel.getValueAt(selectedRow, 3))) { tableModel.deleteRow(selectedRow); } }
6bb39ff4-f66b-410e-bc78-ce2a98fb5c11
6
private boolean checkDiagonalMove(int startRow, int startCol, int endRow, int endCol) { // Move must be according to number of pieces in the line of action if (Math.abs(endRow - startRow) != getNumPiecesInDiagonal(startRow, startCol, endRow, endCol)) { return false; } // Check movement in which Horiz...
71a6f674-eae4-47b6-bbaa-a8c3b86c5823
0
public void doAction(){}
b86c1439-63d3-4c79-80e5-63f50166dc86
6
private void copyRGBtoABGR(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
a16e8a57-0f4c-4e42-9f29-7dd6fe092025
6
private void genTajnB() { if (klientB == null || klientB.kluczPrywatny == null) { JOptionPane.showMessageDialog(null, "Naley wygenerowa klucz prywatny uytkownika B.", "Bd", JOptionPane.ERROR_MESSAGE); } else if (klientB.kluczPublicznyB == null) { JOptionPane.showMessageDialog(null, "Naley obliczy klucz publ...
ce2ab135-4352-4583-9389-e6bcfa1cb1fe
7
private void setFieldWidth() { int firstPos = pos; fieldWidth = 0; fieldWidthSet = false; if ((pos < fmt.length()) && (fmt.charAt(pos)=='*')) { pos++; if (!setFieldWidthArgPosition()) { variableFieldWidth = true; fieldWidthSet = true; } } ...
e9abb001-5d76-4e56-a1fc-7cd04e33860e
9
public static int solution(int[] A) { int length = A.length; Set<Integer> numbers = new HashSet<>(); int min = Integer.MAX_VALUE; // Get Minimum positive number first. for (int i = 0; i < length; i++) { if (A[i] >= 1) { numbers.add(A[i]); if (A[i] < min) { min = A[i]; } } } if (m...
81ad1d4d-f78a-4cb5-983b-4681f1e034a6
4
public Status getButtonStatus(int i, int j) { if (i < size && i >= 0 && j >= 0 && j < size) { return status[i][j]; } else { return Status.UNDEFINED; } }
99a0a94b-577e-49f7-a15f-bd8cfa6b3768
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) { ...
1150da74-7528-40e6-be1d-9e42b9b98b1c
4
public Tile[][]changeX(Tile[][] piece, int offset) { for (int i = 0; piece != null && i < piece.length; i++) for (int j = 0; j < piece[i].length; j++) { if (piece[i][j] != null) ...
ee9ede61-487f-44e7-8fba-d684c810c841
1
public int reserveConstant(Object c) { if (c instanceof String) { return putIndexed(STRING, c, -1, 0); } else { return putConstant(c); } }
c896cd2d-8541-4b91-a3ca-6a02300d385a
6
public void mouseDragged(MouseEvent event) { if (event.getModifiers() == event.BUTTON1_MASK || event.isControlDown() || event.isShiftDown()) { if (controller.isPassibleDragged() && controller.isObject(event.getPoint())) { controller.setDragged(true); } if (controller.isDragged()) { controlle...
f434f745-254d-41bb-92e1-ff08332baa12
4
public void isTwoFromStation(Block b){ Block s, next; s = b; double distance = 0; if(s.isStation()) { int a = s.getPrevBlockId(); s = trackObject.getBlock(a); } next =...
c526c82c-278d-4834-8e57-3d77e68a3dee
3
public int getSize() { switch (this.type) { case CONST: case CONST_DEREF: case GPR_RELATIVE_DEREF: return 1; default: return 0; } }
2a4388b9-c2da-49df-ae39-c51295adc377
2
public void kill() { if (pr != null) pr.destroy(); if (debug) Gpr.debug("Process was killed"); }
0a8672c3-bec5-48ac-b461-fa9a18b74aa2
2
private void addStraight(int end) { if (intervalLengthLongerThanSmax(end)) { System.out.println("TODO: Restricted section too long, no possible solutions!"); } else { if (restricted.isSelected()) road.addStraightSection(end, false); else road.addStraightSection(end, true); updateList(); } }
acdc9137-84c3-4f1b-b4e8-47e8e6a59e7d
4
private void advance() { while(hasNext() && !st.hasMoreTokens()) try { line = br.readLine(); st = new StringTokenizer(line); } catch(Exception e) { eof = true; } if(eo...
ca937c44-ba3b-4c67-bbcf-0b1ad3b664dd
4
public void actionPerformed(ActionEvent e) { time++; // Once a second, if we are placing a peice, move it down if (game.getState() == game.GAMEOVER_VICTORY) { JOptionPane.showMessageDialog(this, "A WINNER IS YOU!"); System.exit(0); } if (game.getState() == game.GAMEOVER_FAILURE) { JOptionPane.s...
421a6fbe-e88c-41df-a506-ac9a133092e9
3
public short initialize(final String config_path, Object config) { MsgDumperCmnDef.WriteDebugSyslog(__FILE__(), __LINE__(), "Initialize the MsgDumperLog object......"); //Parse the config file first short ret = parse_config(config_path, "log"); if (MsgDumperCmnDef.CheckMsgDumperFailure(ret)) return ret; // ...
5a8de061-d103-4995-b538-6c8fded6f61a
9
public static void fiveprime() { for(int d1=0; d1<10; d1++) { for(int d2=0; d2<10; d2++) { for(int d3=0; d3<10; d3++) { for(int d4=0; d4<10; d4++) { for(int d5=0; d5<4; d5++) { int test = d1 + 10*d2 + 100*d3 + 1000*d4 + 10000*prime[d5]; int test2 = (test - d1)/10; int test3 = (t...
6efc31e5-cbf8-4c08-a36c-54e49b506cdf
5
private void checkSections(SectionType type) { if (!textSections.containsKey(type)) { if (type.toString().contains("HEADER")) { textSections.put(type, new SingleRowSection(25)); } else if (type.toString().contains("PERSONAL") || type.toString().contains("TITLE")) { textSections.put(type, new Single...
74dd55af-ede2-4806-a1f2-345faad2a3ad
6
public String printBoard() { String retStr = "| "; retStr += board.get(13); if (board.get(13) < 10) retStr += " | "; else retStr += "| "; for (int i = 12; i > 6; i--) { retStr += board.get(i); if (board.get(i) < 10) retStr += " | "; else retStr += "| "; } retStr += " |"; retStr +=...
7a280a1f-3ba1-4608-9e6a-b38f6f8050ac
0
@Override protected Map<String, Object> getSaveData() { Map<String, Object> mappings = super.getSaveData(); mappings.put("groups", groups); return mappings; }
56cd7383-cb0c-4d73-992c-eb0f1710a64d
7
public void backPropagate(){ //ошибка выходного слоя for(int out = 0; out < OUTPUT; out++){ erro[out] = (target[out] - actual[out])* sigmoidDerivative(actual[out]); } //ошибка скрытого слоя for(int hid = 0; hid < HIDDEN; hid++){ errh[hid]...
7971cc39-e148-4d80-a15f-87788b86556a
2
public void makeMove(int fromX, int fromY, int toX, int toY) throws GameFieldException { // Move move = new Move(fromX, fromY, toX, toY); UnitModel unitToMove = field.getUnit(fromX, fromY); if (unitToMove.getTeam() != currentTeamTurn) { return; } if (!field.canMove(fromX, fromY, toX, toY)) { return; ...
b06ac0c3-4fca-4aaa-8488-5c99b23e1475
0
public String getDisplayName() { return displayName; }
1ff3908c-b48c-4a9f-86d0-ede350992c01
1
public boolean isEnabled() { return comp.isEnabled() && comp.getSelectedText()!=null; }
5fc58867-dd1d-433f-85db-09255210e73d
3
public int Expect(String Data, int NumBytes ) { byte target = 0; int cnt = 0; try { while ((NumBytes--) != 0) { target = file.readByte(); if (target != Data.charAt(cnt++)) return DDC_FILE_ERROR; } } catch (IOException ioe) { return DDC_FILE_ERRO...
5997c6a5-7e1e-48b2-a88c-d2b587036f00
3
static List<Card> checkStrait(List<Card> cards) { boolean skipIter; Card temp; skipIter = true; temp = cards.get(0); Collections.sort(cards, new ValueComparator()); for (Card card: cards) { // skip first iteration if (skipIter == true) { ...
0b24c7c9-a947-4714-b559-7581a23bf6cf
0
public Map placeNodes(TreeModel tree, NodeDrawer drawer) { HashMap nodeToPoint = new HashMap(); int[] width = Trees.width(tree); TreeNode[] leaves = Trees.leaves(tree); int depth = Trees.depth(tree); setPoints((TreeNode) tree.getRoot(), depth, 0, leaves.length, new int[] { 0 }, nodeToPoint); return node...
9e274876-58b0-4ce4-ad86-10205979e638
4
public static int characterSize(int character) throws JSONException { if (character < 0 || character > 0x10FFFF) { throw new JSONException("Bad character " + character); } return character <= 0x7F ? 1 : character <= 0x3FFF ? 2 : 3; }
44f77e03-c878-43a6-96b6-9b77343eaf32
6
public static void main(String[] args) throws Exception { tr = new ConcurrentHashMap<Long, UserNode>(); File urlsDir = new File(urlsDirName); File[] urlFiles = urlsDir.listFiles(); System.out.println("Number of Files " + urlFiles.length); for (int i = 0; i < urlFiles.length; i++) { System.out.println(urlFi...
00906096-e2af-4ce3-9c96-48add5baaee5
6
public synchronized void actionPerformed(ActionEvent e) { Object target = e.getSource(); // /#endif if (target == startButton) { // /#ifdef AWT10 // / startButton.disable(); // /#else startButton.setEnabled(false); // /#endif decompileThread = new Thread(this); sourcecodeArea.setText("Please...