method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0ab7140f-a610-4d4a-9ff8-808335f2aa94
2
public static List<Laureate> filterByGender(List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<Laureate>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner.getGender())) { ...
235dd8e9-4d8a-45b1-9dde-85053f4e57e6
9
public int[] getButtonCoordinates(int personIndex, int id){ int[] result = new int[4]; int toneIndex = player.getHeight(); double xFactor = 0.9; double yFactor = 0.9; int colIndex = 0; int i = 3; int j = 4; switch(id) { case 0: colIndex = 2; break; case 1: colIndex = 10; break; case 2: case 3: ...
65f54f11-56e7-4a34-8043-840743846c03
6
private static final String esc(final String str) { StringBuffer sb = new StringBuffer(str.length()); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); switch (ch) { case '&': sb.append("&amp;"); ...
6f5af803-de35-4962-9d8f-2b6efdbcfca9
5
public static void main(String[] args) { String dataFile = DEFAULT_DATA_FILE; int trainingExamples = DEFAULT_TRAINING_EXAMPLES; for(int i = 0; i + 1 < args.length; i += 2) { if(args[i].equals("-f")) { dataFile = args[i + 1]; } else if(args[i].equals("-e")) { trainingExample...
2091ec62-e959-43de-ba86-b433159b9371
6
public void add(String key) { if(key.equals("Water")) { add("Water1"); add("Water2"); return; } try { if (!images.containsKey(key)) { BufferedImage img = ImageIO.read(new FileInputStream( "Assets/EnvironmentTiles/" + key + ".png")); images.put(key, img); int r = 0; int g = 0; ...
235dced4-5e77-4baa-91f3-fa8896e3a804
0
public Author() { super(""); int cols = 6; String names = "<html>"; names += "<p align=\"center\">ѧϢϵͳ(030914)<p>"; names += "<table align=\"center\">"; names += "<tr><td align=\"center\" colspan=\"" + cols + "\">" + "" + "</td></tr>"; names += "<tr>" + "<td align=\"center\" colspan=\"" + cols / 3 +...
7eb0d718-fbf6-41e2-8be4-ae8eeb919ee6
3
private void fillInStaffOnProjectList(int projectID){ listOfUsers.clear(); if (projectID >=1) { try{ ResultSet staffOnProjectResultSet = null; Statement staff; staff = connection.createStatement(); staffOnProjectResultSe...
27faaae8-8df1-477b-a48b-afbda05f8ac2
4
public static void main(String[] args) throws TwitterException, IOException { final TwitterStream twitterStream = new TwitterStreamFactory( getConfiguration()).getInstance(); StatusListener listener = new StatusListener() { FileOutputStream fout = new FileOutputStream( "./Status/status @ " + Sys...
effe328a-cb8b-47b4-87b7-8a0f139fc6e0
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AssignmentNode other = (AssignmentNode) obj; if (selector == null) { if (...
edb8dddf-0b1a-4751-b7db-f27cfdeb83a2
5
private int getPrimaryDoubleTeamer(int positionToBlock) { int positionNumber=0; switch(positionToBlock) { case 0: //LDE positionNumber=2; break; case 2: //LDT positionNumber=3; break; case 4: //NT positionNumber=4; break; case...
2df4ea27-1e54-4cac-8e19-9ad57c438e93
9
public ArrayList<Business> search(String term, String location) { StickyWebResponse response = null; try { term = term.toLowerCase(); location = location.toLowerCase(); StickyWebRequest request = searchRequest(term, location); ArrayList<Business> result = new ArrayList<Business>(); response = reques...
a58ad0f1-1bf6-4cce-b506-d3b9b9b4e098
0
private static Boolean Check(){ return true; }
3a3ff736-e7da-42ee-a4ff-9ad67f6bfa9f
3
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.pickaxe) { if (player.payStamina(6 - tool.level)) { hurt(level, xt, yt, 1); return true; } } } retur...
1c49e68c-799d-40f2-bdf6-901d26539cc0
1
protected Element createTransitionElement(Document document, Transition transition) { // Start the creation of the transition. Element te = createElement(document, TRANSITION_NAME, null, null); // Encode the from state. te.appendChild(createElement(document, TRANSITION_FROM_NAME, null, "" + transition.ge...
b258135b-d348-47a2-9b4c-150e3fb31a65
8
@Override protected void _run() { if(ALBasicServerConf.getInstance().getCheckMutex()) { //获得当前线程ID long threadID = Thread.currentThread().getId(); _m_tmrThreadMutexMgr = ALThreadManager.getInstance().regThread(threadID); //注册失败直接返回,不进行...
b1a89f03-3222-4b46-bf16-7cb039f75755
1
public void setGetDeviceInfo(boolean newVal) { getDeviceInfo = newVal; if (getDeviceInfo) { getBatteryInfo(); getRootInfo(); getCPUUsage(); } }
01770e09-e3d7-4129-9924-7769d26d39b9
3
public Command(String command, String... aliases) { key = command; for(String alias : aliases) { if(alias != null && alias.length() > 0) { dynamicAliases.add(alias); } } allAliases = dynamicAliases.toArray(new String[dynamicAliases.size()]); }
283eca76-7ef6-4388-b7a5-8dc8bc69cb41
3
@WebMethod(operationName = "ReadTracking") public ArrayList<Tracking> ReadTracking(@WebParam(name = "track_id") String track_id) { Tracking track = new Tracking(); ArrayList<Tracking> tracks = new ArrayList<Tracking>(); ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>(...
49433a72-1b78-4112-ac56-3b9568caefd8
9
public static byte[] toArray (String s) { // remove all non-Base64 characters from string. int strSize = s.length(); for (int n = 0; n < strSize; n++) { char ch = s.charAt (n); if (charset.indexOf (ch) == -1) { s = s.substring (0, n) + s.substring (n+1); strSize--; n--; } } // check le...
8f71b5d1-e929-4d15-a80e-b7d77f8bdca5
7
private void drawSelection(Graphics g) { if (selX != -1 && selY != -1) { // there is a selection // set the color if (add == null) { g.setColor(new Color(255, 255, 0, 128)); // yellow } else if (add) { g.setColor(new Color(0, 255, 0, 128)); // green } else { // add = false g.setColor(new Colo...
f585ae9f-c4dc-47f0-af14-091ab14a89d6
8
public static void main( String[] args ) { Scanner S = new Scanner(System.in); Injector inject = Guice.createInjector(new ServiceModule()); Service Cl = inject.getInstance(Service.class); Cl.add("Ross"); Cl.add("Dan"); Cl.add("Arin"); Cl.add("Barry"); ...
776914a3-4813-4b93-a644-dc7faeaa41e4
5
private int readNextNonWhitespaceChar(J_PositionTrackingPushbackReader var1) throws IOException { boolean var3 = false; int var2; do { var2 = var1.read(); switch(var2) { case 9: case 10: case 13: case 32: break; default: ...
0399987e-afbe-47da-b121-4e7ef4b8abd5
1
@Test public void PelaajanAlkusijaintiKunVirheellinenRivi() { ArrayList<String> rivit = new ArrayList(); rivit.add("P2klrejteagasd"); TasonLuonti tl = new TasonLuonti(rivit); Taso ta = tl.getTaso(); assertTrue("Pelaajan alkusijainti oli väärä" + ta.getPelaajan...
c9f84960-b480-420d-a06c-80440f95f745
0
public LightingBodyArmor() { this.name = Constants.LIGHING_BODY_ARMOR; this.defenseScore = 10; this.money = 300; }
a3d3df2f-6f9c-46c2-9d1d-70f3b213ceb6
8
private static HashMap parseCommandLine(String args[]) { HashMap hash = new HashMap(); for (int i=0; i < args.length; i++) { String arg = args[i]; if(args[i].startsWith("-")) { if(arg.equals("-port")) hash.put("PORT", Integer.parse...
49a98908-d3b5-4473-9199-db9d77647983
7
public XMLNode getNode(String s, LinkedList linkedlist, int i) { if(linkedlist == null) return null; for(ListIterator listiterator = linkedlist.listIterator(0); listiterator.hasNext();) { XMLNode xmlnode = (XMLNode)listiterator.next(); if(xmlnode != null) ...
d23d8fed-de10-48de-ae74-92befd5fb4f5
1
public RabinKarp(String pattern) { this.pattern = pattern; R = 25; M = pattern.length(); Q = longRandomPrime(); // pre-compute R^(M-1) % Q for use in removing leading digit RM = 1; for (int i = 1; i <= M-1; i++) RM = (RM * R) % Q; patternHash = hash(pattern, M); }
c6668a2d-dec1-4c9d-a4dd-776af3217607
4
public void setVisible(boolean b) { boolean radioButtonsAllowed = true; Boolean z = (Boolean) getClientProperty(MODE_CONTROLS_VISIBLE_PROPERTY); if (z != null) { radioButtonsAllowed = z.booleanValue(); } this.radioButton.setVisible(b && radioB...
c8d29671-697b-4ccc-89ba-8a74838ff9bf
1
static public Game getInstance() { if (instance == null) { instance = new Game(); logger.info("Game instance created."); } return instance; }
c69b7aa2-520b-400d-807a-baf5131f553e
7
private void walkToBank() { if (Util.inAuburyShop() && !Players.getLocal().isMoving()) { SceneObject door = SceneEntities.getAt(Util.auburyDoor); System.out.println(door); if (door != null && door.getId() == Util.closedDoor) { if (door.interact("Open")) { int time = 0; while (SceneEntities.getA...
81e24d4e-6592-41c8-8105-d87b74bc673b
2
public final static boolean isInt(String value) { if (isEmpty(value)) return false; try { Integer.parseInt(value); } catch (NumberFormatException e) { return false; } return true; }
c6d711d6-d845-4a95-bb27-ef394e908f21
8
public boolean removeDirectory(File directory) { if (directory == null) return false; if (!directory.exists()) return true; if (!directory.isDirectory()) return false; String[] list = directory.list(); // Some JVMs return null for File.list() when the // directory is empty. ...
4e8f160c-037f-4052-b0bd-e630e6b86992
3
public String remove(final String key) { if (deleted.get().contains(key)) { return null; } String result = null; if (diff.get().containsKey(key)) { result = diff.get().get(key); diff.get().remove(key); deleted.get().add(key); ...
e459a4b3-6a53-4251-b76e-0ec1d7a145c9
4
public static Mask buildKirshMask(Direction d) { switch (d) { case HORIZONTAL: double[][] dValues = { { 5, -3, -3 }, { 5, 0, -3 }, { 5, -3, -3 } }; return new Mask(dValues); case VERTICAL: double[][] aValues = { { 5, 5, 5 }, { -3, 0, -3 }, { -3, -3, -3 } }; return new Mask(aValues); case DIAGONAL: ...
3c46dc51-7fbd-4a44-8d90-c33394b14df1
4
private static ArrayList<Integer> readIntegerArrayFromFile() { ArrayList<Integer> integerArray = new ArrayList<Integer>(); FileInputStream fstream = null; try { fstream = new FileInputStream("Median.txt"); // Get the object of DataIn...
0f403ff9-c247-47be-a6f8-f6081cbb7b9b
6
public nameList addNameNoSave(String x) { if(x.equals("") || x.equals("null")) return null; nameList temp = head; while(!(temp==null)) { if(temp.getName() != null) if(temp.getName().equals(x)) return temp; temp = temp.getNext(); } tail = new nameList(x,tail); if(head == null) head =...
5a904fff-adce-4425-be10-621a889e5ecc
9
public static void main(String[] args) { StaticAnalysis staticAnalysis; String fileName = ""; int thresholdSupport = T_SUPPORT_DEFAULT; double thresholdConfidence = T_CONFIDENCE_DEFAULT / 100; String parseType = INTRA_PARSE_TYPE; if (args.length > 0) { int i = 0; while (i < args.length) { switch ...
8cf71c0d-ccd1-45ef-a427-1e792b9693f3
7
public Set<LocString> getStringsInScope(double x, double y, double z, double width, double length, double height) { double mX = x + width; double mY = y + length; double mZ = z + height; Set<LocString> toRet = new HashSet<LocString>(); for(LocString locString : getStrings()) { ...
02372fa1-a5d1-4f5a-9db7-5a4ecb16b0c7
4
public boolean setHidden(boolean hidden) { Connection conn = null; PreparedStatement ps = null; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("UPDATE " + Constants.SQLTable + " SET hidden = ? WHERE username = ?"); ps.setBoolean(1, hidden); ps....
bff23af8-63de-4068-a64b-167d86224fce
8
@SuppressWarnings({"unchecked"}) public static <T> Class<? extends T>[] getClassesInPackageExtending(JarFile jarFile, String packageName, Class<T> sCls) throws ClassNotFoundException { notNull(jarFile, "JarFile jarFile"); notNull(packageName, "String packageName"); notEmpty(packageName, "Str...
eaab4a08-2eb9-4f20-b01b-1b8ef047040f
7
private static int runToNextInputFrameHiLoLimit(int limit) { int joypadInputFirst = Math.min(curGb.rom.readJoypadInputHi, curGb.rom.readJoypadInputLo); int joypadInputLast = Math.max(curGb.rom.readJoypadInputHi, curGb.rom.readJoypadInputLo); if (!curGb.onFrameBoundaries) curGb.step(); // end unfinish...
2f663f85-e194-4e5a-a4fe-43e1f953fcdf
5
public void run() { lTiempoActual = System.currentTimeMillis(); lTiempoInic = System.currentTimeMillis(); while (iVidas > 0) { if(!bInstrucJ && !bPausa) { // el juego se para si se pausa o se // muestran las onstrucciones checaColi...
92125a90-8016-4ffa-834e-b0a0fb93f621
3
public ChatChannel[] getAllPublicChannels(){ ChatChannel[] channels = null; try { Socket chatSocket = new Socket(SERVER_ADDRESS_LOGIN, CHAT_PORT); chatSocket.setSoTimeout(TIMEOUT); OutputStream outputStream = chatSocket.getOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputS...
8b00aa95-745d-4396-b8de-9edf2bc99996
2
public static Date DateParse(String str){ if(MyStringUtil.isBlank(str)){ return null; } try{ return format.parse(str); }catch(Exception e){ e.printStackTrace(); } return null; }
53d357f2-9ed4-45fa-9eb1-84b405d684c1
3
private JPanel makeHistoryPanel() { // mother Panel JPanel historyPanel = new JPanel (); historyPanel.setLayout (new BorderLayout ()); // Button Panel continueButton = new JButton (CONTINUE_BUTTON_TEXT); undoUntilButton = new JButton (UNDO_UNTIL_BUTTON_TEXT); undoButton = new JButton (UNDO_B...
5b8b2578-572d-4062-a2df-3f11ee79d204
1
public static boolean isSimilar(String a, String b, int similarityAcceptError) { a = Normalizer.normalize(a, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase(); b = Normalizer.normalize(b, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase(); if (a.equals(b)) return true; return l...
2995c43e-1f00-414a-b4b5-b1e44a892cc4
2
void update(final Controller controller) { if (name.contains("ps3")) { stickRight.valueX = controller.getAxisValue(1); stickRight.valueY = controller.getAxisValue(0); stickLeft.valueX = controller.getAxisValue(3); stickLeft.valueY = controller.getAxisValue(2); } else { stickLeft.valueX = controller.g...
358526a3-67f3-4df0-982a-eb91f65de0ef
5
public boolean isNameChar(int token) { return (isLetter(token) || isDigit(token) || token == '.' || token == '-' || token == '_' || token == ':'); }
844e1cd6-3182-4203-ad7a-bb599f103b2f
1
public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { computeSVUID = (access & Opcodes.ACC_INTERFACE) == 0; if (computeSVUID) { this.name = n...
7c06b37b-ae76-46a3-ba7a-87929b27f662
6
public static void main(String[] args){ Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); StringBuilder s = new StringBuilder(16); String [][] a = new String[4][4]; String [][] b = new String[4][4]; for (int i = 0 ; i < 4 ; i++) ...
e9f205f7-4bc1-4773-99ff-ff97cef941f3
1
public static void main(String[] args) { List<? extends Chewable> list1 = new ArrayList<Meat>(); // Line 16 List<Chewable> list2 = new ArrayList<Chewable>(); // Line 17 List<Meat> list3 = new ArrayList<Meat>(); // Line 18 list1 = printSize(list1); // Line 20 //list2 =printSize(list2); // commented becaus...
4e227338-8e53-48b2-8c0a-1282e050a475
0
public static void main(String[] args) { // TODO code application logic here }
13038732-31df-4929-b4d2-cdd7db7b0dbc
5
Field getField(LuaValue key) { if (fields == null) { Map m = new HashMap(); Field[] f = ((Class) m_instance).getFields(); for (int i = 0; i < f.length; i++) { Field fi = f[i]; if (Modifier.isPublic(fi.getModifiers())) { m.put(LuaValue.valueOf(fi.getName()), fi); try { if (!fi.isAccess...
eadef193-9083-4703-ac73-96387ac720ee
5
private ArrayList<String> getDifferentVariable(String str1, String str2) { ArrayList <String> result=new ArrayList <String>(); char[] char1=str1.toCharArray(); char[] char2=str2.toCharArray(); int index=0; boolean breakOut=false; for (int i=0; i<char1.length; i++) { // //System.out.println("index = ...
8e94b96e-4f95-4b84-8b20-94d740aaca97
6
@Override public boolean checkReception(Reception reception) { if (reception == null) { throw new IllegalArgumentException(); } Date openDate = reception.getOpenDate(); if (openDate == null) {// если время принятия не задано - не удовлетворяет return false; } if (fromDate != null && openDate.bef...
e10e0ac8-12c8-4eb4-97e4-14bce31e7b01
8
@Override public void actionPerformed(ActionEvent e) { Object parent = e.getSource(); if (parent instanceof JMenuItem) { JMenuItem button = (JMenuItem) parent; String name = button.getText (); if (name.equals("New Game")) { GraphicUI.this.reset (); } else if (name.equal...
bd3d13d5-c462-43b9-9fb6-f9532691c109
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...
eba13c71-67dc-414a-8ed4-48ba6bfbb85b
8
private void repositionHand(Player p) { PlayerCardsRange curCardRanges = playerIndices[p.getPlayerId()]; List<Card> hand = p.getHand(); List<CardEntity> moved = new ArrayList<CardEntity>(hand.size()); int delta; cardsWriteLock.lock(); try { CardRange[] sublists = { curCardRanges.getHandRange(), drawDeckE...
2d300ea8-c71c-4669-9bff-bc1e21e83d32
1
public ForceField(Grid grid, ForceFieldConnection forceFieldConnection) { super(grid, 2); if (forceFieldConnection == null) throw new IllegalArgumentException("The given ForceFieldConnection is invalid!"); this.forceFieldConnection = forceFieldConnection; }
169b6201-8f62-4460-9b41-cea9258b4d14
0
protected int getBestHeight() { return Math.max(getPreferredSize().height, bestHeightComparison); }
ccb56069-3c1f-4b9a-a1c7-ed4a0ea852cb
3
@SuppressWarnings("unchecked") private static final byte[] encodeList(ArrayList list) throws BencodingException { byte[][] list_segments = new byte[list.size()][]; for(int i = 0; i < list_segments.length;i++) { list_segments[i] = encode(list.get(i)); } int total_...
d8db8e63-1009-4920-9bb3-102a3afd501a
0
public String getName() { return name; }
8b792de0-4347-454b-988c-471c0583d956
2
public Array<Letter> giveACombination(float numberOfLetters) { //The letters available are shuffled and the first numberOfLetter elements are popped from //the array. If the are not enough lettersAvailable, the array is initialized again Array<Letter> combination = new Array<Letter>(); Array<Letter> lettersAvai...
dbc1b868-86d8-4d68-9d45-8fb71f16d6f8
7
public static void main(String[] args) { System.out.println("creaing ObjectCache with size 5"); ObjectCache oc = new ObjectCache(5); try { String k = ""; String v = ""; for(int i = 0; i < 16; i++) { if(i == 3|| i == 4 || i == 8 || i == 9) { k = "key" + Pad.pad("" + (i - 2), "0", -3); ...
50b112d4-bc7e-414f-8175-46023520d3a2
0
@Override public void onEnable() { this.saveDefaultConfig(); getCommand("qcreate").setExecutor(new CmdCreateExecutor(this)); getCommand("qlist").setExecutor(new CmdListExecutor(this)); getCommand("qadd").setExecutor(new CmdAddExecutor(this)); getCommand("qremove").setExecutor(new CmdRemoveExecutor(this...
9bdd1051-d1b1-49dd-b118-84fbd765df0f
0
public static void main(String[] args) { int a = 0, b = 1; System.out.println(a == b); // false System.out.println(a != b); // true System.out.println(a < b); // true System.out.println(a <= b); // true System.out.println(a >= b); // false }
1a7a879f-d123-4c3d-85dc-8fbf36a691e3
6
@Override public Object getValueAt(int rowIndex, int columnIndex) { if (columnIndex < 0 || columnIndex >= COL_NAMES.length || rowIndex < 0 || rowIndex >= propNames.length) { return null; } if (columnIndex == 0) { return propNames[rowIndex]; } if (columnIndex == 1) { return props.get(propNames...
22e82219-70c4-4b8e-9815-e80ccbb87852
2
public void fireAdjustmentValueChanged(int id, int type, int value) { // System.out.println("fireAdjustmentValueChanged: id = " + id + ", type = " + type + ", value = " + value); if (!getValueIsAdjusting() && value != mValue) { mValue = value; mParent.fireScrollEvent(new AdjustmentEvent(this, Adjustm...
92e8ada7-70a3-4a06-b47b-0b86e8ebf950
6
public void running() throws IllegalArgumentException, IOException, UnsupportedAudioFileException, ProgramEndedException { System.out.print("Ist-Satz:"); while(true){ try{ switch(nextState) { case 1: s1(); break; case 2: s2(); break; case 3: s3(); break; case 4: s4()...
6feff10a-d868-48f9-a570-1dc4bd62e996
8
public void memoryShortageTest() throws InterruptedException, ExecutionException { logger.info("memory shortage test"); final AtomicInteger id = new AtomicInteger(); long maxMemory = Runtime.getRuntime().maxMemory(); final int weight = (int) (maxMemory / cacheSize) ; final long start = System.currentTimeMill...
21d219d1-2668-4f07-a824-3f5750a07c36
8
public int canCombine(CombineableOperator combOp) { // GlobalOptions.err.println("Try to combine "+e+" into "+this); if (combOp.getLValue() instanceof LocalStoreOperator && ((Operator) combOp).getFreeOperandCount() == 0) { // Special case for locals created on inlining methods, which may // combine everyw...
f8558ee8-08f7-43cf-a333-841502f1795b
7
private void aprioriGen(ArrayList<NonDuplicateArrayList<String>> frequentItemSet, HashMap<NonDuplicateArrayList<String>, Integer> candidates, int iteration){ candidates.clear(); for (int i = 0; i < frequentItemSet.size(); i++){ for (int j = i + 1; j < frequentItemSet.size(); j++){ // NonDuplic...
ec97ee77-e539-4687-b3b9-d114132f576b
2
public boolean validate() throws IOException { this.valid = false; try { logger.trace("Validating piece#" + this.index + " off: " + this.offset + " len: " + this.length); ByteBuffer buffer = this.bucket.read(this.offset, this.length); if (buffer.remaining() == this.length) { byte[] data = new byte[thi...
46f2e908-8074-47a8-b42c-71c28b99fca6
4
private String getEntityNameOfProperty(int row) { MeriseModule meriseModule = (MeriseModule)Main.getModule("MERISE"); for(Iterator<ZElement> e = meriseModule.getMCDComponent().enumElements(); e.hasNext();) { MCDObjet o = (MCDObjet)e.next(); for (int i = 0; i < o.sizeInformat...
ee05845b-c74c-4c35-94c8-af655c3c624c
2
@Override public int matches( byte[] sequenceA, int indexA, byte[] sequenceB, int indexB, int count ) { for (int i = 0; i < count; i++) { if (sequenceA[indexA + i] != sequenceB[indexB + i]) { return i; } } return count; }
042f1be1-1a23-49b8-a326-efe7497b5db0
6
public void checkCol() { //check player first for(int i = 0; i<numEnemy; i++) p1.checkCollision(enemy[i].row, enemy[i].column); if(!p1.alive) { lp.lives--; lp.updateLabels(); gameOver = lp.lives<=0; if(!gameOver) reset(); else repaint(); } //check the enemies against themselves ...
1dcf6fe3-8019-4507-a89e-25f9b483a35f
3
@Override public byte[] receive(long timeout, int byteCount) throws IOException { open(); SerialPort p = getSerialPort(); if (byteCount>0) { try { p.enableReceiveThreshold(byteCount); } catch (UnsupportedCommOperationException ex) { thr...
357c9f38-79a3-4cfd-b745-44da5f69e8d9
5
public static ArrayList<Rate> getAllRates(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Rate> rateList = new ArrayList<Rate>();...
1adafdee-0b0b-492d-9b93-59f0c54a0b8f
5
public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (Il...
0e30c0b3-2422-4646-a008-8f2d0e5f0e52
1
public static void updateActionType(int idactiontype, String typelibelle) throws SQLException { String query = ""; try { query = " UPDATE ACTION_TYPE SET TYP_LIB=? where ID_ACTION_TYPE=? "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement(query); ...
df645f63-87ca-4f57-831e-fac313810564
2
public void paintComponent(Graphics g) { super.paintComponent(g); if (transformNeedsReform) reformTransform(new Rectangle(getSize())); g.setColor(java.awt.Color.white); g.fillRect(0, 0, getSize().width, getSize().height); Graphics2D g2 = (Graphics2D) g; g2.transform(transform); drawer.drawAutomaton...
5200b0f6-c941-45db-a8e8-75d445f5b21c
7
public void parseLine(String l) { StringList t = new StringList(l); try { if (l == null) { log.debug("SwitchBoardServerIncoming - parseLine : null line received :-/"); } if (l.startsWith("CAL")) { t...
859f26a8-8867-4742-b622-01cd463841ab
7
public double weightedStandardError_of_ComplexRealParts() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean hold2 = Stat.nEffOptionS; if (nEffReset) { if (nEffOptionI) { Stat.nEf...
b3922722-f16b-44cb-beca-2b02c6c84694
0
public int getTotalNumberOfMatches() {return totalNumberOfMatches;}
38c33695-ed53-40f8-b76f-1ebc790d163f
2
public static void handleHelloMethod(HTSMsg msg, HTSPServerConnection conn) throws IOException{ Collection<String> requiredFields = Arrays.asList(new String[]{"htspversion","clientname","clientversion"}); if(((Number) msg.get("htspversion")).longValue()==1){ requiredFields = Arrays.asList(new String[]{"htspversi...
087d0ffa-6111-4df3-9b47-bc4e397c1bb0
7
@Override public void init(GameContainer gc) throws SlickException { spriteSheet = new TileSpriteSheet("res/tileset.jpg", TILE_SIZE); map = new TileMap(); map.fillBackgroundLayer(spriteSheet.getTileSprite(1, 0), 20, 15); TileMapLayer firstLayer = new TileMapLayer(1, "Platforms"); map.addLayer(firstLayer); ...
d085754a-50e2-4cb2-aa55-b8ec4927f911
5
@Override public String resetPerson(PersonInterface person) { String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); /* save all arguments into an array */ Object[] args = new Object[]{person}; Class<?>[] argsType = new Class<?>[]{PersonInterface.class}; String ret = null; try { ...
6f2d5fbf-bbf6-4211-8c21-230099acff1e
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TermOfGrant other = (TermOfGrant) obj; if (endDate == null) { if (other.e...
555c3574-d132-4203-8ef8-3cb525c6e6c0
2
public ArrayList<String> movieTheatresToList(){ ArrayList<String> temp = new ArrayList<>(); for (Cine movieTheatre : movieTheatres) { temp.add(movieTheatre.getName()); }//TODO idk what is this! for (Theatre theatre : theatres) { temp.add(theatre.getName()); ...
9484fcea-4357-47ea-b709-2446150e13c2
2
private void startTransfer() { SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { while (progress < 100) { if (progress > 20) { status = StatusMessages.transferInProgress; GUI.repaintUserTable(); } } re...
4b5f4892-0f1f-4a6f-9f05-23245bbee395
0
public static void main(String[] args) { System.out.println("Hunt the Wumpus!"); //PrintControls(); new WumpusGUI().setVisible(true); }
190de0e4-e185-4770-82eb-b6d2e6c2800f
5
public boolean shouldMirror(int segX, int segY, int pos) { if (segX != segY) return true; if (pos == 0 && getSegment(segX + 1, segY + 1) == null) return false; if (pos == 4 && getSegment(segX - 1, segY - 1) == null) return false; return true; }
45df2707-c69c-4998-bd81-a6a1e580de15
3
public String login() { session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false); if (verificarUser(this.nome,this.senha)) { System.out.println("IF"); if (session == null) { session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true...
883fabcd-69fb-44cf-9fb4-36a999f74594
2
public void visitEnum(final String name, final String desc, final String value) { checkEnd(); checkName(name); CheckMethodAdapter.checkDesc(desc, false); if (value == null) { throw new IllegalArgumentException("Invalid enum value"); } if (av != null) { av.visitEnum(name, desc, value); } }
559a016c-79fb-4e7d-be4a-16d75a480d68
7
public List<Produto> buscar(Produto filtro) { try { String sql = "select * from Produto "; String where = ""; if (filtro.getNome().length() > 0) { where = "nome like '%" + filtro.getNome() + "%'"; } if (filtro.getCodProduto() > 0) { ...
f21bb3e5-8c30-4969-9671-82113f105a1f
8
@Override public Permutation run() { List<Permutation> units = new ArrayList<>(unitNum); int n = task.getN(); for (int i = 0; i < unitNum; i++) { Permutation perm = new Permutation(n); perm.setFitness(-function.getValue(perm)); units.add(perm); } while (subPopNum > 0) { Permutation best = Collect...
312dea4b-7545-4b0c-8413-4fac08532de8
5
private Node balance(Node h) { assert (h != null); if (isRed(h.right)) h = rotateLeft(h); if (isRed(h.left) && isRed(h.left.left)) h = rotateRight(h); if (isRed(h.left) && isRed(h.right)) flipColors(h); h.N = size(h.left) + size(h.right) + 1; re...
53b1ae8e-06c1-400b-8af3-52ab2f87bd4f
8
public Hashtable<String, String> prepareParams() { Hashtable<String, String> htResult = new Hashtable<String, String>(); if(this.mOAuthVerifier != null && !this.mOAuthVerifier.equals("")) { htResult.put("oauth_verifier", this.mOAuthVerifier); } if(this.mXAuthMode != null && !this.mXAuthMode.eq...
7076fb0e-8b90-4c04-8e53-a820ae856ff0
6
private void impactAttack(){ // make a circle out of projectiles if(inUse == false){ impact(range, speed); if(skillEffects.isEmpty()) inUse = !inUse; if(hasEffect(SkillEffect.DOUBLE)) timer = time + 5; } else if(inUse == true){ if(hasEffect(SkillEffect.DOUBLE) && time == timer){ impact(range,...
f99ae4aa-d6fb-41ac-9cf8-dd95d4140e44
0
public String getHeading() { return heading; }