method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8aa65098-e445-4860-b3f3-9e83192e32e9
2
public JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = this.keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
79d06b78-b800-4883-9b07-b2f4fd287136
2
private String AddByBit(String str1, String str2) { StringBuffer sumBuffer = new StringBuffer(); for(int i = 0; i < str1.length(); ++i) { if(str1.charAt(i) == str2.charAt(i)) { sumBuffer.append("0"); } else { sumBuffer.append("1"); } } return sumBuffer.toString(); }
33cf01e0-8ca1-42f6-89d4-5266d6911ebe
3
public void printMetadataInfo() throws IOException { if (flac instanceof FlacOggFile) { FlacOggFile ogg = (FlacOggFile)flac; System.out.println("FLAC-in-Ogg, in stream " + ogg.getSid()); } else { System.out.println("FLAC Native"); } // Output The info...
e48790d4-195b-4b2c-821d-5a270792696f
3
public static void toggleMoveableInheritance(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleMov...
27b93586-ce56-40a8-a0e9-5b66ffb6de78
8
Point3f[] getFaceVertices(byte face) { if (faceVertices == null) { faceVertices = new Point3f[4]; for (int i = 0; i < 4; i++) faceVertices[i] = new Point3f(); } float x = Math.abs(corner.x); float y = Math.abs(corner.y); float z = Math.abs(corner.z); switch (face) { case FRONT: faceVertices[0...
5abc8056-171c-430e-89d0-114d04344c22
5
public SecuredMessageTriggerBean execute(SecuredMessageTriggerBean message) throws GranException { ArrayList<String> possibleHandlers = new ArrayList<String>(); List<String> users = KernelManager.getStep().getHandlerList(message.getMstatusId(), message.getTaskId()); for (String userId : users) ...
be5c05fe-6922-4f40-a2b9-022a88ed5899
6
public MapObject[] getCollisionObject(Rectangle rect) { List<MapObject> objects = new ArrayList<MapObject>(); // Iterate through the layers for (int i = 0; i < layers.size(); i++) { // Get the layer Layer layer = layers.get(i); // Is it an object group? if (layer instanceof ObjectGroup) { // We ...
b070acbd-3561-42bb-92f4-5a15e88e9a8f
5
public void analyzeInnerClasses(ProgressListener pl, double done, double scale) { double subScale = scale / innerComplexity; // If output should be immediate, we delay analyzation to output. // Note that this may break anonymous classes, but the user // has been warned. if ((Options.options & Options.OPTIO...
19ee5783-6b63-49ca-aae7-2ff70620e094
7
public static Rule_dirMethod parse(ParserContext context) { context.push("dirMethod"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); ...
246ef2a4-c010-4186-9624-9a82a04c31fd
7
@Override public void insert(String key) { totOps++; if (find(key)) return; if (isOverLoaded(numElements + 1)) increaseTable();// Increase table size if table will be overloaded. int hCode = hashCode.giveCode(key); int compKey = compressKey(hCode); totProb++; if (table[compKey] == null || table[...
5efca507-6905-45eb-9f57-64ea7210afbf
9
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: JButton button = (JButton) evt.getSource(); if ("启动评价".equals(button.getText())) { jButton4.setText("暂停评价"); flagComment = ...
598fa46c-1251-42cd-a524-310dcd415016
6
public void setSelectedItem(Object element) { if (element == null) { if (elementIndex != -1) { elementIndex = -1; fireContentsChanged(this, -1, -1); } } else if (element instanceof String) { for (int i=0; i<elementTypeStrings.length; i+...
d76ce37e-d36f-4e3b-84c7-a97d80bc4aa9
9
public void getTaskData(int pos, TaskDesc td, Task task) { if (task.taskMD.parent != null && task.numParentDataRecv < task.taskMD.parent.size()) { String data = requestData(task.taskId, task.taskMD.parent.get(pos), td, task.taskMD.dataSize.get(pos), task.taskMD.dataNameList.get(pos)); while (data != null &&...
a406f48d-b3e2-409c-a9cd-48c4001924ed
9
private void removeOldChildren() { Map<String, Object> attributes = component.getAttributes(); List<String> currentComponents = createdComponents; // Get the old list of created component ids and update the current list as a // component attribute Object oldValue; i...
ef6e291e-33a9-456b-9c9c-765c5255456d
8
public void addNotification(String[][] map, TrayPlugin trayplugin, int delay) { String title = "", subtitle = "", message = "", time = "", icon = ""; for(String[] values: map) { if(values[0].equals("title")) { title = values[1]; } else if(values[0].equals("subtitle")) { subtitle = values[1]; } e...
fcc1f271-ccab-4c0a-8781-cb3f55341f97
9
public int update() throws SQLException { StringBuilder sb = new StringBuilder(); if (commentLine != null) { sb.append("/* ").append(commentLine).append(" */"); } sb.append("update " + TABLENAME + " set "); int i = 1; List<Object> list = new ArrayList<Object>(); for (Fields hf : fieldValueMap.keySet())...
d38566d5-edf5-406f-be03-edde2752d8de
7
@Override public void paint(Graphics g) { Color colores[] = new Color[6]; colores[0] = Constantes.COLOR_CIC_0; colores[1] = Constantes.COLOR_CIC_1; colores[2] = Constantes.COLOR_CIC_2; colores[3] = Constantes.COLOR_CIC_3; colores[4] = Constantes.COLOR_CIC_4; colores[5] = Constantes.COLOR_CIC_5; super.pain...
55de1f10-4a77-4ff0-a53f-7841563ce785
2
@Override public boolean hitField(int x, int y) { Field tolook = getFields()[y][x]; if(tolook.getBattleState() == null) { if (tolook.getFieldState() == eFieldState.Empty) { tolook.setBattleState(eFieldBattleState.Missed); return false; ...
9ee358b3-9994-400b-b47b-2855d41ae6fa
5
@Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); // Controls for player 1 if(keyCode == KeyEvent.VK_W) { GameMaster.player.moveUp = true; } if(keyCode == KeyEvent.VK_S) { GameMaster.player.moveDown = true; } // Controls for player 2 if(keyCode == KeyEvent.VK_UP...
7285c9bf-a536-4e3f-91c9-7d387024e573
2
void setParameter(int position, Object value) { if (position >= 0 && position < values.length) { values[position] = value; } }
977f933f-6113-4c5b-b8df-205f3280c2ac
6
private String getPage(int page, Map<String, Object> map) { int factor = 5; int index = (page - 1) * factor; int listSize = map.size(); if (index > listSize) { return ""; } int upper = index + factor; if (upper >= listSize) { upper = listSi...
8123878b-87b8-4bf4-a19d-601de8709d36
6
private static void runTests(){ if(!initializationTests()) return; if(!insertTests()) return; if(!selectTests()) return; if(!updateTests()) return; if(!deletionTests()) return; if(!shutdownTests()) return; }
0b713a44-9c1d-4e9b-97e8-3bed6c24fd5b
3
public Habitat getHabitatByOwner(String owner) { for (Habitat h : getHabitats().values()) { if (h != null) if (h.getOwner().equalsIgnoreCase(owner)) return h; } return null; }
99cbc8f0-f7e5-4971-aaf0-5d7a271eb866
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; Path other = (Path) obj; if (endPoint == null) { if (other.endPoint != null) return false; } else if (!endPoint.equals(other.endPoint)) return false; if (startPoint ==...
150a9731-a480-492d-9c09-8a74dd946670
1
public static synchronized ConnectionPool getInstance() { if (instance == null) { instance = new ConnectionPool(); }//if return instance; }//getInstance
ede1051a-9b91-4b4f-8aae-ab7cab180e59
9
public static int size(TypeType type) { switch (type) { case DOUBLE: case LONG: return 2; case INT: case SHORT: case CHAR: case BYTE: case BOOLEAN: return 1; case REF: case...
4165302a-e3d3-4ccb-bf6c-a7db5f064b0a
3
public Dimension getPreferredSize() { int x = 0, y = 0; for (Iterator<ZElement> e = enumElements(); e.hasNext();) { MPDEntite o = (MPDEntite) e.next(); x = o.getX() + o.getWidth() > x ? o.getX() + o.getWidth() : x; y = o.getY() + o.getHeight() > y ? o.getY() + o.getHe...
06fc1e50-09ea-4a48-a835-72828d733115
6
private void setTotalRecord(Page<?> page, MappedStatement mappedStatement, Connection connection) { //获取对应的BoundSql,这个BoundSql其实跟我们利用StatementHandler获取到的BoundSql是同一个对象。 //delegate里面的boundSql也是通过mappedStatement.getBoundSql(paramObj)方法获取到的。 BoundSql boundSql = mappedStatement.getBoundSql(page);...
51a4f060-f334-46a0-9e18-7ddce798cc3e
6
public SolutionState solve(int timeLimit, int bound) { int n = graph.getNbVertices(); int minCost = graph.getMinArcCost(); int maxCost = graph.getMaxArcCost(); int[][] cost = graph.getCost(); next = new int[n]; Solver solver = new Solver(); // Create variables ...
d6292877-647f-4443-b779-0ed5ace7b2e1
3
public Monster(int x, int y, String name,int difficulty){ position = new Position(x, y); this.target = GameManager.getPlayer().get(0); //Novice if(difficulty==1){ power = new AtomicInteger(5); speed = new AtomicInteger(1); LIFE_MAX = 50; life = new AtomicInteger(50); } //Normal else if(diffi...
bd067fac-4030-41e4-b4c3-1dfeab270a23
2
private boolean goalReached() { if(position[0] == bestgoal[0] && position[1] == bestgoal[1]) { return(true); } else { return(false); } }
f97faca8-74ba-4978-860e-69c273523ecf
6
private static void method495(char arg0[]) { int off = 0; for (int chars = 0; chars < arg0.length; chars++) { if (Censor.method496(arg0[chars])) { arg0[off] = arg0[chars]; } else { arg0[off] = ' '; } if (off == 0 || arg0[off] != ' ' || arg0[off - 1] != ' ') { off++; } } for (int chars...
1872637c-9286-4413-aab2-09bfd5024ffd
2
public GuiTest() { addMenu(); // addToolbar(); addCenter(); addStatusbar(); makeVisible(); new Thread() { @Override public void run() { while (true) { setColor(); try { Thread.sleep(250); } catch (InterruptedException e) { e.printStackTrace(); } } } p...
16d42bc5-f6d4-470d-9b00-267e1a7f11f8
6
private static boolean collapseOK(Element e1, Element e2) { if (e1.getTagName() != e2.getTagName()) return false; NamedNodeMap nnm1 = e1.getAttributes(); NamedNodeMap nnm2 = e2.getAttributes(); if (nnm1.getLength() != nnm2.getLength()) return false; for (int i = 0; i < nnm1.getLe...
a4c6060a-fd22-4e15-bb0e-f6e9815b6eb3
3
public String displayContent() { String[] temp = this.content.split(" "); String toReturn = ""; for (int i = 0; i < temp.length; i++) { if (i % 20 != 0 || i == 0) { toReturn += temp[i] + " "; } else { toReturn += temp[i] + "\n"; ...
b32daadb-1208-4c1d-b675-392c3d0fd014
2
public static final ByteBuffer getInfoBytes(byte[] torrent_file_bytes) throws BencodingException { Object[] vals = decodeDictionary(torrent_file_bytes,0); if(vals.length != 3 || vals[2] == null) throw new BencodingException("Exception: No info bytes found!"); return (ByteBuffer)v...
a4ad71ed-007a-4c87-92bb-bcace7b1a029
3
public boolean play() { if (playing()) { return true; } for (int i=0; i<buffers.capacity(); i++) { if (!stream(buffers.get(i))) { return false; } } AL10.alSourceQueueBuffers(source.get(0), buffers); AL10.alSourcePlay(source.get(0)); return true; }
4dd8bf5e-81fc-46b1-97c0-53be26c7c603
5
public static Matrix getRotationMatrix(int axis, double angle) throws IndexOutOfBoundsException { if (axis < X_AXIS || axis > Z_AXIS) throw new IndexOutOfBoundsException(); double c = Math.cos(angle); double s = Math.sin(angle); Matrix rotate = Matrix.getIdentityMatrix(); switch (axis) { case X_AXI...
d06d72ab-4d7f-4ba9-9797-2ad32da46a80
5
private int validaDia( int d ) { if ( d > 0 && d <= diasPorMes[ mes ] ) return d; // se Fevereiro: Verifica se ano bissexto if ( mes == 2 && d == 29 && anoBissexto(ano) ) return d; System.out.println( "Dia " + d + " invalido. Colocado o dia 1." ); re...
145b449b-fcd1-4789-9684-680126b27f02
3
public static <T> T[] intern(T[] arr) { synchronized(ArrayIdentity.class) { if(cleanint++ > 100) { clean(); cleanint = 0; } } Entry<T> e = new Entry<T>(arr); synchronized(ArrayIdentity.class) { Entry<T> e2 = getcanon(e); T[] ret; if(e2 == null) { set.put(e, e); ret = arr; } els...
75eab7cc-b54d-416b-a613-830ce7d4a62a
5
private void lstKullaniciListesiValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstKullaniciListesiValueChanged String kulAdi = (String) lstKullaniciListesi.getSelectedValue(); Musteri m = (Musteri) mutlakkafe.MutlakKafe. mainCont.getMusteriCon...
f96e176e-a0b6-489a-8291-8193fdece3ed
0
public String getSessionId() { return sessionId; }
380a5cfd-6220-449b-b02f-18589a200a49
2
private int high(int startindex) { if (startindex == grades.length-1) { return grades[startindex]; } else { int highRest = high(startindex+1); if (grades[startindex] > highRest) { return grades[startindex]; } else { return highRest;...
fde455cd-7860-4583-81e4-4a9c94967787
1
@Override public String toString() { if(getDenominator() == 1){ return "" + getNumerator(); } return "" + getNumerator() + '/' + getDenominator(); }
c5bb8b2c-3e43-41c2-9fe0-9f78ac43b235
6
private int sameHandUpdated(ArrayList<Card> c, int recursion) { ArrayList<Card> cards_tmp = new ArrayList<Card>(); Card yourCard = c.get(0); if (recursion==1) { if (c.get(1).getValue()>yourCard.getValue()) yourCard = c.get(1); cards_tmp.add(yourCard); for (int i=2; i<c.size(); i++) cards_tmp....
c0cdafd5-c891-408b-94c8-e7f11f01af8d
4
public boolean createDirs() { boolean test = false; if (test || m_test) { System.out.println("FileManager :: createDirs() BEGIN"); } new File(getPath()).mkdirs(); if (test || m_test) { System.out.println("FileManager :: createDirs() END"); } return true; }
40da6e68-b90b-4b46-9935-93b521a2222a
9
public static void multipartUploadObejctByMultithreading(KS3Client client, InputStream inputstream, long offset, long length, String bucketName, String objectKey,String mimeType) throws Exception { // 要上传到文件至少要一个Part的大小 if (length < PART_SIZE) throw new IllegalArgumentException( "The object you are t...
905f5cf9-463c-41d3-a729-34df27db3678
6
ITransientMap doAssoc(Object key, Object val) { if (key == null) { if (this.nullValue != val) this.nullValue = val; if (!hasNull) { this.count++; this.hasNull = true; } return this; } // Box leafFlag = new Box(null); leafFlag.val = null; INode n = (root == null ? BitmapIndexedNode.EMPTY...
2a7a63b8-4cfd-495c-af35-17895fd3fdf6
4
@Override public double[] getData() { if (ptr != 0) { return null; } else { if (isConstant()) { if (length > getMaxSizeOf32bitArray()) return null; double[] out = new double[(int) length]; for (int i = 0; i < length; i++) { ...
35e9aa61-fb07-4042-acdb-6e3249c6397c
4
@Override public void sortArray() { this.arrayAccess = 0; this.comparisions = 0; T[] auxArray = array.clone(); for (int d = width - 1; d >= 0; d--) { count = new int[radix + 1]; for (T item : array) { count[keyMap.get(item) + 1]++; ...
d69f525a-4558-4370-9fdd-789dfa3424d7
2
public static ItemInfo itemByItem(ItemInfo item) { for (ItemInfo i : items) { if (item.equals(i)) { return i; } } return null; }
06628cf1-75b5-4eb4-b8b1-7cdb87c9923d
2
public static void main(String[] args) { int len = 10; Array<Integer> arr = new Array<Integer>(len); for (int i = 0; i < len; ++i) { arr.append(i); } System.out.println(arr); for (int i = 0; i < len; ++i) { System.out.println("Random #" + i + ": "...
f77bb0b2-df4f-400d-bcb9-2e0822b1528e
1
public List<Integer> getValues() { List<Integer> valuesList = new ArrayList<Integer>(); for(int i = 0; i < size; i++) { valuesList.addAll(map[i].getValues()); } return valuesList; }
e222093b-94fb-4359-808b-a215cc16071b
1
public String toString() { try { return this.toJSON().toString(4); } catch (JSONException e) { return "Error"; } }
7079ce18-47a4-42b0-a1de-cb3ece3f446f
2
public State completeWith(State other) { completeStylesWith(other); if (other != null) { description = StringUtils.defaultString(description, other.description); if(other.isDoubled()) markDoubled(); } return this; }
93b112be-0b8d-4ae8-8380-255baf202b30
7
private void enqueueParents(final SSAConstructionInfo consInfo) { final Set seen = new HashSet(); final Iterator iter = cfg.nodes().iterator(); while (iter.hasNext()) { final Block block = (Block) iter.next(); final Iterator e = consInfo.realsAtBlock(block).iterator(); while (e.hasNext()) { final...
7aa153d9-4961-4fd1-b772-46c1b921dcbb
7
public static Cons allSuperrelations(NamedDescription relation, boolean removeequivalentsP) { { MemoizationTable memoTable000 = null; Cons memoizedEntry000 = null; Stella_Object memoizedValue000 = null; if (Stella.$MEMOIZATION_ENABLEDp$) { memoTable000 = ((MemoizationTable)(Logic.SGT_LOGI...
d39a19d0-daab-4dc6-b57a-f8fc7cba1730
8
private void toggleDebugger(JMenuItem src, Class<?> listener) { Bot b = window.getActiveBot(); if (b != null) { HijackCanvas c = b.getCanvas(); boolean removed = false; if (c == null) { b.getLogger().log(new LogRecord(Level.SEVERE, "Error accessing canvas...")); return; } for (int i = 0; i < ...
f6e4c5cb-8265-470d-85b7-fa9213338360
2
private static void firstStrategy() { Semaphore MReading = new Semaphore(1); Semaphore MWriting = new Semaphore(1); int counter = 0; Random r = new Random(); while(true) { if(r.nextDouble() > 0.5) { Lecteur l = new Lecteur(MReading,MWriting,counter); l.run(); counter = l.counter; }...
dc400bfb-1f80-48ca-a590-56b0306f24e4
8
protected Object evaluateElement(Object current, Object next) throws UDFArgumentException { boolean lessThan = false; if (next==null) return current; if (current == null) return next; switch (elementOI.getPrimitiveCategory()) { case INT: lessThan = (((IntObjectInspector)element...
077a94f3-67b7-40cc-a260-2df1e04dfed7
3
public int getExperienceToLevel(int skill, int level) { if (level < 0 || level > 99) return -1; int experience = getExperience(skill); if (experience == -1) return -1; return EXPERIENCE_TABLE[level] - experience; }
b6f63f59-ec7f-436b-8759-5a1d05cb8622
9
public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) { // Start typing your Java solution below // DO NOT write main() function ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); if(root == null)return result; LinkedList<TreeNode> queue = new LinkedLi...
fedaead4-981d-4e7f-9ac8-7a15654cc5ad
1
private void recreateMesh() { Vertex[] vertexes = new Vertex[text.length() * 4]; int[] indices = new int[6 * text.length()]; float lastX = 0; for(int i=0; i<text.length(); i++){ Glyph glyph = font.getGlyph((int)text.charAt(i)); vertexes[0 + i*4] = new Vertex(...
4a291531-e679-48e5-8edc-c72453d48ec6
0
public void setId(String value) { this.id = value; }
df2f350e-5722-4ad9-9598-6c032b593496
9
public boolean checkPossible() { int[] horizontalMax = new int[myLawn.length]; int[] verticalMax = new int[myLawn[0].length]; for (int i = 0; i < myLawn.length; i++) { int max = 0; for (int j = 0; j < myLawn[0].length; j++) if (max < myLawn[i][j]) max = myLawn[i][j]; horizontalMax[i] = max; } ...
4459b018-7804-46f5-a7de-0134e1de2e91
3
*/ public void birthNewVictim(int i) { if (i % 5 == 0) { ArrayList <Ostrich> arrayList = new ArrayList<Ostrich>(); for (int index = 0; index < animalFactory.getQuantityOfVictims(); index++) { Ostrich ostrich = (Ostrich) animalFactory.createNewVictim(); ...
17dbde7a-2f16-4f0d-9b38-a8ba7f666b62
5
private void updateTabla(){ //** pido los datos a la tabla Object[][] vcta = this.getDatos(); //** se colocan los datos en la tabla DefaultTableModel datos = new DefaultTableModel(); tabla.setModel(datos); ...
f51063a4-bd69-4103-8bc0-8ce467ccc8e6
9
public int majorityNumber(List<Integer> nums) { // write your code int candicate1 = 0, candicate2 = 0, count1 = 0, count2 = 0; for (int i = 0; i < nums.size(); i++) { if (nums.get(i) == candicate1) { count1++; } else if (nums.get(i) == candicate2) { ...
f6505370-598b-4842-aec0-bc161faebbcc
2
@Override public long defier(String a, String b) { Player p1 = em.find(Player.class, a); Player p2 = em.find(Player.class, b); if (p2 != null && p1 != null) { Defi d = new Defi(p1, p2); em.persist(d); return d.getId(); } else { return 0...
4c12de52-340b-49d5-8e6f-999d4b1d8f33
6
public static void main(String[] args) { if (args.length > 0) { if (args[0].equalsIgnoreCase("load-database")) { System.out.println("Loading database..."); SqlFortune f = new SqlFortune(); f.createDb(); f.loadFromFiles(); System.out.println(f.getFortune()); System.out.println(f.getF...
4d890211-1fde-460c-8448-16c61ec2e201
3
public Class<?> getDataType() { if(superProperty == null) { if(dataType == null) { return null; } return dataType; } return superProperty.getDataType(); }
c0847c0a-2ed6-45e3-8bc4-c570f0e87001
5
@Override public boolean perform(final Context context) { // Example: /<command> off[ <Player>] OfflinePlayer target = Parser.parsePlayer(context, 1); if (target == null && context.sender instanceof OfflinePlayer) target = (OfflinePlayer) context.sender; if (target == null) { ...
aa669fb9-e0da-4ca2-bfeb-9da60a21132b
9
public List<Location> adjacentLocations(Location location) { assert location != null : "Null location passed to adjacentLocations"; // The list of locations to be returned. List<Location> locations = new LinkedList<>(); if (location != null) { int row = location.getRow(); ...
bf9e834d-2249-4e56-9098-bc38eb6017d7
4
public static void editPartDialog(Part p) { JPanel addPart = new JPanel(); JPanel input = new JPanel(new SpringLayout()); JLabel nameLabel = new JLabel("Name*"); JTextField name = new JTextField(p.name); JLabel quantLabel = new JLabel("Quantity"); SpinnerNumberModel quantMod = new SpinnerNumberModel(p.quant...
8565fdba-b54c-486c-b436-1d26927c4697
8
public static void main(String[] args) { ConsistentGlobalProblemSetInitialisation starter = new ConsistentGlobalProblemSetInitialisation(); starter.initLanguage(new char[] { '0', '1' }, 10, "(1(01*0)*1|0)*"); int solutionFoundCounter = 0; int noSolutionFound = 0; List<Long> cycleCount = new LinkedList<Long>(...
ec8aed8a-b153-4861-bfee-6d7160265ce0
6
public <T extends ActiveRecord> T createObject(ResultSet rs, Class<T> clazz, PropertyDescriptor[] props, int[] columnToProperty) throws SQLException { T object = newInstance(clazz); for (int i = 1; i < columnToProperty.length; i++) { if (columnToProperty[i] == -1) { continue; } PropertyDescript...
40143eec-60d3-4de0-ad41-3ceccee57ad2
0
public void setPassword(String password) { this.password = password; }
bbafbcaa-df59-47ec-97bf-64431da78b36
8
public static int deleteFileByScanPrefixFilter(String tablename, String rowPrifix) { HTableInterface table = null; int count = 0; try { table = getTable(tablename); Scan s = new Scan(); s.setFilter(new PrefixFilter(rowPrifix.getBytes())); ResultS...
372fbf51-3495-4d93-8024-25e7f2c9fffa
6
public void render() { counter++; if (counter % 100 == 0) xtime++; if (counter % 100 == 0) ytime++; for (int y = 0; y < height; y++) { if (ytime >= height) break; for (int x = 0; x < width; x++) { if (xtime >= width) break; pixels[xtime + ytime * width] = 0xff00ff; } } }
bcd121f2-d2ad-4f7d-aa39-69a833577c90
0
public void sign(String file, String encrypted_file) throws Exception { FileOutputStream PGP_file = new FileOutputStream(encrypted_file, true); SP sp = new SP(file, pub_exp, priv_exp, mod); sp.dump(PGP_file); //PGP_file.write((byte)0xDE); //PGP_file.write((byte)0xAD); PGP...
5c82945a-8154-46b3-8a6a-95fd40548ed6
8
public static String getEntityName(Class<?> clazz) { Annotation entityAnnotation = null; for (Annotation annotation : clazz.getAnnotations()) { Class<?> annotationClass = annotation.annotationType(); if (annotationClass.getName().equals("javax.persistence.Entity")) { entityAnnotation = annotation; } ...
8a389746-3338-46ee-95bc-640d76f40076
9
private final int getNextProbableNode(int y) { if (toVisit > 0) { int danglingUnvisited = -1; final double[] weights = new double[visited.length]; double columnSum = 0.0d; for (int i = 0; i < visited.length; i++) { ...
8083041e-a7d4-4c36-b3d5-59f050c9ae82
3
public JsonSettings() { String jsonData = ""; try { //TODO Find a better way to store the settings file FileInputStream settingsStream = new FileInputStream("/tmp/settings.json"); try (java.util.Scanner s = new java.util.Scanner(settingsStream)) { json...
1fb68b91-378c-449d-b205-d48d9b696c3a
0
public void setFunHabilitado(String funHabilitado) { this.funHabilitado = funHabilitado; }
a9d6280a-42ee-41d4-81bc-470d18a9a361
3
void assignBMEWeights( double[][] A ) { edge e; e = depthFirstTraverse(null); while (null != e) { if ( e.head.leaf() || e.tail.leaf() ) e.BalWFext(A); else e.BalWFint(A); e = depthFirstTraverse(e); } }
1cfcd5bd-0724-4dea-94ee-6bb9f0d78f70
1
@Override public void clear() { for (int i=0; i<filter.length; i++) { filter[i] = 0; } }
2b46d0e5-21c8-4729-b762-681c6188ff62
9
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { if(container.getInput().isKeyPressed(Keyboard.KEY_ESCAPE)){ game.enterState(MenuState.ID); } if(!b.isGameOver()){ TetrisRobot.findGhost(); totalDelta += delta; if(FacebookBoard.isFound()){ if(moved)...
f0d3aa26-8342-45de-b2ea-28bd37d9ec7e
1
public GT getGameTable() { if(gameTable.isSetUp) { return gameTable; } else { gameTable.setupTable(); return gameTable; } }
41b2fcc1-6652-49a2-90c0-440dd60b9145
1
public DataModule getDataModule(String moduleName) { if(!fragments.contains(moduleName)){ addModule(moduleName); } return NSpaceManager.getDataModule(moduleName); }
d723cd0e-89d1-4139-b919-ddc3c6095fee
4
public boolean isUpperTriagonal(){ boolean test = true; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ if(j<i && this.matrix[i][j]!=0.0D)test = false; } } return test; }
8cc02bd9-a1c4-41b9-8b23-db157cce5463
9
private void routeReplyReceived(RREP rrep, int senderNodeAddress) { //rrepRoutePrecursorAddress is an local int used to hold the next-hop address from the forward route int rrepRoutePrecursorAddress = -1; //Create route to previous node with unknown seqNum (neighbour) if(routeTableManager.createForwardRouteEnt...
e7184192-fd0b-4433-a0c4-e6415a2d5bbc
2
public ServerConnection(String server, int id, int tab) { serverid = id; servertab = tab; serverip = server; setName(Main.user); try { connect(server); } catch (IOException e) { Main.gui.tabs.get(tab).addMessage((e.getMessage())); } catch (IrcException e) { Main.gui.tabs.get(tab).addMe...
ecc062db-f55a-40d5-b0d0-37afe67fdb7e
9
public static void main(String[] a) throws IOException { Scanner s = new Scanner(new File(a[0])); while (s.hasNextLine()) { String[] arr1 = s.nextLine().split("\\|"); String sub = arr1[1].trim(); String[] arr2 = arr1[0].split(" "); // init Map<char[], String> map = new LinkedHashMap<char[], Strin...
f1c0316c-5135-458e-901a-b4625baba0b7
4
public void release(int x, int y) { if (amplitude.isActive()) { amplitude.release(); } else if (period.isActive()) { period.release(); } else if (amplitude2.isActive()) { amplitude2.release(); } else if (period2.isActive()) { period2.releas...
f688f69a-a9c9-4559-8305-fba5a87f403a
8
private void method98(Mobile mobile) { if (mobile.anInt1548 == Client.loopCycle || mobile.animationId == -1 || mobile.animationDelay != 0 || mobile.anInt1528 + 1 > Sequence.sequenceCache[mobile.animationId].getFrameLength(mobile.anInt1527)) { int i = mobile.anInt1548 - mobile.anInt1547; ...
fb6626d7-9ded-43fc-91e2-b99e1b55e3ef
7
public void atualizar(Material material) { jComboBoxEdicao.removeAllItems(); jComboBoxAnoPublicacao.removeAllItems(); jComboBoxAutor.removeAllItems(); jComboBoxEditora.removeAllItems(); jComboBoxCategoria.removeAllItems(); jComboBoxPublico.removeAllItems(); jCombo...
90b6f288-84a2-40ad-b3c1-9bc7ef23f3b9
0
public Destination destination(String s) { return new PDestination(s); }
644df8c0-2077-47a5-be86-26ea7448a9df
1
public void addAllShips() { for(int i = 0; i < BattleShipGame.shipSizes.length; i++) addShip(BattleShipGame.shipSizes[i]); updateNums(); }
f87030b2-ce9e-4720-b010-9e194e55fbc5
6
public void stateChanged(ChangeEvent e){ SpinnerModel hModel = HSelector.getModel(); SpinnerModel wModel = WSelector.getModel(); Integer hValue = this.getHSelectorValue(); Integer wValue = this.getWSelectorValue(); if (hModel instanceof SpinnerNumberModel || wModel instanceof SpinnerNumberModel){ if (hV...
52e280de-8c0f-41a3-8874-f742c218cce7
8
public int getGridX(int x, int y) { Insets myInsets = getInsets(); int x1 = myInsets.left; int y1 = myInsets.top; x = x - x1 - GRID_X; y = y - y1 - GRID_Y; if (x < 0) { //To the left of the grid return -1; } else if (y < 0) { //Above the grid return -1; } else if ((x % (INNER_CELL_...