method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
195c009c-16bf-414e-b6ff-7c161735f98f
8
public void calcular(boolean diagonales) { nodosEvaluados= new HashSet<>(); //set de nodos evaluados PriorityQueue<Nodo> nodosPorEvaluar = new PriorityQueue<>();//set de nodos por evaluar, contiene inicialmente al nodo inicial inicio.setFuncionG(0); //costo desde el inicio hasta el mejor c...
d3781a3b-5b5c-4508-8c9e-cddeb19f2bc6
0
public void initUndoKeeper(){ myKeeper = new UndoKeeper(getAutomaton()); }
35689029-58d4-41b7-9c74-c589b75af3a0
3
@Override public DisplayState getDisplayState() { File stateFile = new File(directory, ".displaystate"); if(stateFile.exists()) try { return (DisplayState)DisplayState.deSerialize(stateFile.getPath()); } catch (IOException ex) { Logger...
999f9d61-b8e5-4d73-9797-19c2bd2bc669
1
private static void drawCircle(double x, double y, double radius){ //filled circle double x1,y1,x2,y2; double angle; GL11.glColor3f(0.7f, 0.7f, 0.7f); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex2d(x,y); for (angle=1.0f;angle<361.0f;angle+=0.2) { x2 = x+Math.sin(a...
43cf591f-b543-4dc6-936d-92272099a09e
2
public String byte2hex(byte[] b) { String hs = ""; String stmp = ""; for (int i = 0; i < b.length; i++) { stmp = Integer.toHexString(b[i] & 0xFF); if (stmp.length() == 1) { hs += "0" + stmp; } else { hs += stmp; } } return hs.toUpperCase(); }
4c3c581f-b27b-4025-a3c2-598fb839f14a
5
public void enqueueMessage(int queueId, Message message) throws MessageEnqueueException, MessageEnqueueSenderDoesNotExistException, MessageEnqueueQueueDoesNotExistException { try { _out.writeInt(20 + message.getMessage().getBytes().length); //Size _out.writeInt(Response.MSG_QUEUE_ENQUEU...
a2588354-0cf0-4e4a-b4c6-b0c25c85a179
3
@Override public String makeMove(CardGame game, CardPanel panel) { List<List<Card>> board = game.getBoard(); List<Card> pack = game.getPack(); Stack<Card> deck = game.getDeck(); game.setCanAddToDeckFromBoard(false); for (int j = 0; j < 12; j++) { //Want them all...
ca4b2078-ce82-4e91-adb4-34e46048799c
4
public String getRunButtonImageName() { if(Configuration.handleEmptyEventQueue && Configuration.asynchronousMode) { if(appConfig.guiRunOperationIsLimited) { return "refillrun.gif"; } else { return "refillrunforever.gif"; } } else { if(appConfig.guiRunOperationIsLimited) { return "run.gif"; ...
ab1b6515-7f1c-4794-adb2-98cb9f5b9f78
7
static public Spell getLightningSpell(int i) { switch (i) { default: case 0: return new Lightning(); case 1: return new LightningStorm(); case 2: return new LightningBall(); case 3: ...
68096c7c-47d3-4a05-9e30-ef804f7212c5
3
@Override public boolean createUser(String login, String password, String firstName, String lastName, String passportInfo) { //заполнение sql скрипта Map<String, Object> pageVariables = dataToKey(new String [] { "login", "password", "firstName", "lastName", "passportInfo" }, login, ...
e53c1759-c42f-43d3-af9a-735566772691
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mediaName == null) ? 0 : mediaName.hashCode()); result = prime * result + ((date == null) ? 0 : date.get(Calendar.MONTH)); result = prime * result + ((date == null) ? 0 : date....
a1f6cbd4-80cd-4e3b-89d7-cc284e11a047
4
private void doHandshake() throws IOException { // C0 byte C0 = 0x03; out.write(C0); // C1 long timestampC1 = System.currentTimeMillis(); byte[] randC1 = new byte[1528]; rand.nextBytes(randC1); out.writeInt((int)timestampC1); out.writeInt(0); out.write(randC1, 0, 1528); out.flush(); // S0 ...
9bf4a451-af9a-4e6d-8940-e630517fe964
5
public void run(String arg) { if (IJ.versionLessThan("1.37f")) return; int[] wList = WindowManager.getIDList(); // 1 - Obtain the currently active image if necessary: // 2 - Ask for parameters: boolean whiteParticles =Prefs.blackBackground, connect4=false; GenericDialog gd = new GenericD...
e3e48b80-ab11-4b8e-a413-a1de2716ed8d
2
@Override public void setValueAt(Object value, int row, int column) { Variable variableToChange = variableList.get(row); if (column == 1) { variableToChange.setReplacementName((String)value); } else if (column == 2) { variableToChange.setObfuscate((Boolean)value); } }
c2aca5b5-e7b8-428c-a95a-12dc68d193b8
5
public boolean start() { if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } try { IJobProcessingService stub = (IJobProcessingService) UnicastRemoteObject .exportObject(this, 0); // LocateRegistry.getRegistry(JobUtility.getPort()); registry = LocateReg...
1b8ceafd-7bd7-45a7-8e6e-08f036b9fc31
7
public void update(GameContainer gcan, StateBasedGame state, int dtime) throws SlickException { a.update(); b.update(); c.update(); d.update(); e.update(); f.update(); gb.update(); if(b.activated()) { SessionSettings.ingame = true; state.enterState(1, new FadeOutTransition(Color.black, 250),...
a809a2b9-9a96-44df-a1f7-301828a95528
8
public final List<Pair<Integer, String>> getAllItems() { if (itemNameCache.size() != 0) { return itemNameCache; } final List<Pair<Integer, String>> itemPairs = new ArrayList<Pair<Integer, String>>(); MapleData itemsData; itemsData = stringData.getData("Cash.img"); ...
a9b65094-feb4-473c-9c01-1325d7e3a315
7
public String longestCommonSubstring(String s, String t) { int[][] matrix = new int[s.length()][t.length()]; int maxLen = 0; int lastSubStart = 0; int currentSubStart = 0; StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { for (int j = 0; j < t.length(); j++) { if (s.charA...
9bd77e0d-c77d-4d88-a9be-c32566535254
5
@Override public void run() { for (Citation c : citations.getCitations()) { io.println(c.getId() + ": " + c.getTitle()); } Integer command = -5; try { command = io.getInteger("Give id of the article to tag (or -1 to cancel): "); } catc...
0dc6ca12-3af8-4df0-8275-575d08b869a7
0
private static void prepareMenu() { menu = new HashMap<Integer, String>(); menu.put(1, "Coffee"); menu.put(2, "Tea"); menu.put(3, "Lemonade"); menu.put(4, "GrilledSandwich"); menu.put(5, "PeanutButterSandwich"); menu.put(6, "CheeseSandwich"); }
067587b9-89db-425f-9989-72ff5883f889
0
public int getFirewallId2() { return firewallId2; }
02bfaa6b-e884-4dd2-bfe6-9a23979cb3f6
6
public void map() { //points is start, controls, end double[][][] V = new double[points.length-1][intervals+1][2]; for (int c = 0; c < V.length; c++) { for (int i = 0; i < V[c].length; i++) { V[c][i][0] = (1 - (double)i/intervals)*points[c][0] + ((double)i/intervals)*points[c+1][0]; V[c][i][1] = ...
881256b4-7722-4a60-8bee-969f1af0a2c8
4
public void resetAllGameActions() { for (int i=0; i<keyActions.length; i++) { if (keyActions[i] != null) { keyActions[i].reset(); } } for (int i=0; i<mouseActions.length; i++) { if (mouseActions[i] != null) { mouseActions[i].re...
bbb481e3-0fa3-4bc9-8914-64ade3aa2e57
2
private void mouseHelper(int codeNeg, int codePos, int amount) { GameAction gameAction; if (amount < 0) { gameAction = mouseActions[codeNeg]; } else { gameAction = mouseActions[codePos]; } if (gameAction != null) { gameActio...
1efc79f9-299a-498b-93d4-b516c6edbd53
7
public ArrayList subledger1(String type, String loanid, float amount) { //get all details subledger needs arrayTemp= new ArrayList(); String query = "select * from loan_dtl where loanid="+loanid+" and amordate between to_date('"+startDate.substring(0, 10) +"','yyyy-mm-dd') and to_date('"+endD...
d423c504-ccfe-43d5-9210-17689d1ce2b9
8
private void byAttribute() { TokenQueue cq = new TokenQueue(tq.chompBalanced('[', ']')); // content queue String key = cq.consumeToAny(AttributeEvals); // eq, not, start, end, contain, match, (no val) Validate.notEmpty(key); cq.consumeWhitespace(); if (cq.isEmpty()) { ...
9435c868-10fa-4f4f-9b92-dc83306c6a77
2
public boolean isMoreOuterThan(ClassDeclarer declarer) { ClassDeclarer ancestor = declarer; while (ancestor != null) { if (ancestor == this) return true; ancestor = ancestor.getParent(); } return false; }
ab00ce28-7cd4-405c-a5ed-556d591b0684
7
public void run() throws IOException, NoSuchAlgorithmException, InvalidPvidException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException { try{ //Displaying choices that the voter has Voter.displayMainMenu(); System.out.println("Please enter your choice"); int ...
3d66ae4c-933a-40ba-9c27-215a7f65b245
7
public static ByteBuffer outputBufferFrom(final Object object) throws IOException { if (object instanceof ByteBuffer) return (ByteBuffer)object; if (object instanceof File) return IO._outputBufferFrom_((File)object); if (object instanceof FileChannel) return IO._outputBufferFrom_((FileChannel)object); if (objec...
ac7d58fd-e9b0-4ca6-955a-7f9316b23541
7
@EventHandler public void GhastMiningFatigue(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Min...
a727f803-8270-434a-ae36-844eb460f595
4
private void permuteHelper(int size, int usedIndex) { if (size == k) { ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < ans.length; i++) { list.add(ans[i]); } result.add(list); return; } for (int ...
a61261b9-cf95-451a-8f4c-d42eab2636b1
1
public Iterator<Integer> calculateWinningScores(int numberOfTurns){ int numberOfScores = (numberOfTurns%2==0)? (numberOfTurns/2):((numberOfTurns/2) -1); ArrayList<Integer> scores = new ArrayList<Integer>(); int multiplier = -1; return scores.iterator(); }
af8a3655-8a91-4d9d-a809-f101ab37e70c
1
public void deplacementDroite() { if (!pause) { plateau.updatePosition(1, 0); updateObservers(); } }
51b3e2bc-3d7a-4d2d-895e-2a16031e6354
0
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "KA-Nonce", scope = AgreementMethodType.class) public JAXBElement<byte[]> createAgreementMethodTypeKANonce(byte[] value) { return new JAXBElement<byte[]>(_AgreementMethodTypeKANonce_QNAME, byte[].class, AgreementMethodType.class, ((byte...
95d1623c-3aed-4982-bac9-e4bb4c2019c1
9
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode reNode = new ListNode(0); ListNode tail = reNode; int carry = 0; while(l1 != null || l2 != null){ ListNode temp = new ListNode((carry+(l1 == null?0:l1.val)+(l2==null?0:l2.val))%10); carry = (carry...
ba6f84aa-cde7-4ba3-baa3-afd550366a09
0
public static void testVerifierLoginMdp(){ EntityManager em; boolean resultat; String nomVisiteur; String mdpVisiteur; System.out.println("\nDEBUT DES TESTS"); // Instanciation du gestionnaire d'entités (contexte de persistance) em = EntityManagerFactorySingleton...
a0ec6faf-cf61-45a0-af83-8a8cafe5fbbf
3
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, Exception { //retardo debug // try { // Thread.sleep(80); // } catch (InterruptedException ex) { // Thread.currentThread().interrupt(); //...
20f4d8a8-06be-4a08-8df3-804949c5979b
9
void init(byte[] input, int windowStart, int from, int to) { int[] hashVal = this.hashVal; int[] head = this.head; int[] same = this.same; int[] prev = this.prev; int[] hashVal2 = this.hashVal2; int[] head2 = this.head2; int[] prev2 = this.prev2; System.a...
9160ff6e-77a6-4ef7-8c9e-ad40ef2c18f1
9
@Override public void unInvoke() { // undo the affects of this spell if((affected!=null)&&(canBeUninvoked())) { if(affected instanceof Room) { final Room room=(Room)affected; room.showHappens(CMMsg.MSG_OK_VISUAL, L("Time starts moving again...")); if(invoker!=null) { final Ability me=...
08afdd32-5047-41e7-92f0-a51339c2f5e4
6
private void loadMap(String filename) throws IOException { ArrayList lines = new ArrayList(); int width = 0; int height = 0; BufferedReader reader = new BufferedReader(new FileReader(filename)); while(true){ String line = reader.readLine(); if(line == null){ reader.close(); break; } if ...
eb99320e-86e7-44ba-bc02-7ed3c73051fa
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': builder.append('\\'); builder.append(chr); break; ...
f09494f2-873d-4b45-a922-c228bf954607
2
@Test public void testGetTransaction() { Gateway beanstream = new Gateway("v1", 300200578, "4BaD82D9197b4cc4b70a221911eE9f70", // payments API passcode "D97D3BE1EE964A6193D17A571D9FBC80", // profiles API passcode "4e6Ff318bee64EA391609de89aD4CF5d");// reporti...
cb2d5c43-6768-43d9-ae41-f82802c4258c
5
@Override public void mouseDragged(MouseEvent e) { this.diagramPanel.setMoveHandCursor(); if (SwingUtilities.isLeftMouseButton(e)&&e.isControlDown()) { int scrollPositionX = this.diagramScrollPane.getViewport().getViewPosition().x; int scrollPositionY = this.diagramScrollPane...
2795a971-4a4e-4c3a-97ad-43d911b43a1c
1
private JLabel getJLabel1() { if (jLabel1 == null) { jLabel1 = new JLabel(); jLabel1.setText("seporator:"); } return jLabel1; }
2a5fade9-2c61-4eb1-a18d-93d0cf0effea
5
public void update(Graphics g) { // setup the graphics environment Graphics2D g2 = (Graphics2D)g; if (manager.antialiasing) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); ...
863b9780-369f-4ffa-b306-5d606cf71b2b
4
public ServerController() { this.observers = new LinkedList<IClientObserver>(); game = new Game(); CallHandler callHandler = new CallHandler(); try { callHandler.registerGlobal(IServerObserver.class, this); this.addServerListener(new MyServerListener()...
a64629d9-f49a-491f-bce2-f946b49a18ec
1
public void setHealth(double health) { if(health < 0) this.health = 0; else this.health = health; }
6d208909-440b-41df-a30e-3df4a8898b6f
3
public void actualiza() { long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual; granada.avanza(); if (canasta.getMoveLeft()) { canasta.setPosX(canasta.getPosX() - 6); } if (canasta.getMoveRight()) { canasta.setPo...
1eef34d7-3e5a-4d9d-853b-7a830bf6ba7c
2
public void writeNumbers (int pTamano) { JSONObject obj = new JSONObject(); JSONArray list = new JSONArray(); for(int i = 0 ; i < pTamano; i++){ int ram = (int) (Math.random() * 100000); list.add(ram + ""); } obj.put("Tags", list); try { ...
760aae87-9586-4581-a661-e5dd04258299
7
public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException { super.initialize(flowChartinstance, chartItemSpecification); for (String key : chartItemSpecification.getChartItemAttributes().keySet()) { if (key.equals("id")) { idName...
05dc64a6-cd65-4cb6-9ed5-9db69dcbc0be
3
public ComplexMatrix getABCDmatrix(){ if(this.segmentLength==-1)throw new IllegalArgumentException("No distance along the line as been entered"); if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){ this.generalABCDmatrix = this.getIdealABCDmatrix(); } e...
4b81f2e4-e574-4a79-92b9-11d276197551
3
public static boolean readBoolean() { String line = null; try { BufferedReader is = new BufferedReader(new InputStreamReader( System.in)); line = is.readLine(); } catch (NumberFormatException ex) { System.err.println("Not a valid number: " ...
fa5465e8-3c27-46c0-a41e-7afe19f4ecb2
1
public void placeObjectOnBoard(Placeable object) { if (isValidPositions(object)) { setPriority(object); } }
11307c85-8bce-497d-b5ca-2688dce785bb
1
public void testConstructor_ObjectStringEx2() throws Throwable { try { new YearMonth("T10:20:30.040+14:00"); fail(); } catch (IllegalArgumentException ex) { // expected } }
d520b77a-2ce9-4d0c-ac51-efcdb0ff1dda
4
public static void main(String args[]){ int[] reactantsA = {43, 18}; int[] productsA = {4, 52, 1}; int[] reactantsB = {12, 18}; int[] productsB = {6, 1, 52}; int[] reactantsC = {18, 43}; int[] productsC = {52, 4, 1}; int[] reactantsD = {18, 43}; int[] productsD = {52,...
61ff8cbf-17a7-42f6-84b4-5289fe535b96
9
public void handleConf(CSTAEvent event) { if ((event == null) || (event.getEventHeader().getEventClass() != 5) || (event.getEventHeader().getEventType() != this.pdu)) { return; } if (this.pdu == 28) { boolean enable = ((CSTAQueryMwiConfEvent) event.getEvent()) .isMessages(); if ((event.getPrivD...
a37424ef-7aa1-4c15-8b6a-62702360345d
1
public static JIPMainWindow getInstance() { if (instance_ == null) instance_ = new JIPMainWindow(); return instance_; }
0c138ff1-adcd-4160-9eb1-fbfddf40f377
2
public Map toMap(){ Map<String,Object> root = new HashMap<String,Object>(); // for(String key : sys_properties.stringPropertyNames()){ // String value = sys_properties.getProperty(key); // if(key.contains(".")){ // parseComplexKey(key,root,parseValue(value)); // ...
8d5d9a77-f9a7-464d-ba01-3da1f971e295
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Leerling other = (Leerling) obj; if (leerjaar != other.leerjaar) return false; if (leerlingNaam == null) { if (other.leerlingNaam != null) return ...
962471f1-5620-4e8c-bd1c-971aa2982e67
2
public void alimentaTabela(String SQL){ ArrayList dados = new ArrayList(); String [] Colunas = new String[]{"ID","Nome","CPF","RG","CNH","Cat","Contato","Parent","Telefone","Tel2","TeleContato"}; conecta.executaSQL(SQL); try { conecta.rs....
1c96ebbb-3cc6-4cdc-99ae-8f2514475d2f
7
@Override public boolean equals(Object o) { if (o == null) return false; if (!(o instanceof Pair)) return false; Pair<?, ?> pairo = (Pair<?, ?>) o; return this.left.equals(pairo.getLeft()) && this.right.equals(pairo.getRight()); }
63de0948-a951-4950-b81a-f10088859261
2
public IRCResponse getResponseByNumber(int number){ for(IRCResponse response: IRCResponse.values()){ if (number == response.getNumeric()) return response; } return null; }
27b4b9cd-d247-46e1-9090-98cf92463941
7
private void parseVersionNumbers(XMLEventReader xmlReader) throws XMLStreamException { CompareVersionNumbers versionNumberComparator = new CompareVersionNumbers(); while (xmlReader.hasNext()) { XMLEvent = xmlReader.nextEvent(); if (XMLEvent.isStartElement()) { ...
45872df4-e006-4510-ae8d-f05092e59788
0
public boolean isBlocked(Account account){ return account.isBlocked(); }
c268d952-4809-4087-853c-b6716aac743d
6
@EventHandler(priority = EventPriority.HIGHEST) public void onBreak(BlockBreakEvent e) { long time = System.nanoTime(); if (BlockTools.isSign(e.getBlock())) { this.plugin.getLoggerUtility().log("Block is sign", LoggerUtility.Level.DEBUG); if (((Sign) e.getBlock().getState()).getLine(0).equalsIgnoreCase("[" +...
2b2880ee-33c7-455d-9519-c667841694cc
3
@Override public String toString() { return "ImageMap [" + (name != null ? "name=" + name + ", " : "") + (src != null ? "src=" + src + ", " : "") + (dimension != null ? "dimension=" + dimension + ", " : "") + "]"; }
67dc0d81-5fdc-4abb-a850-157c43236bbd
0
@Id @Column(name = "FUN_CEDULA") public Long getFunCedula() { return funCedula; }
bb630e91-79ea-4d7d-a03a-948083f19569
7
private static BufferedImage delegateRendering(Algebra algebra) { if(algebra instanceof Equation) return renderEquation((Equation)algebra); else { BufferedImage rendered = null; if(algebra instanceof Expression) rendered = renderExpression((Expression)algebra); else if(algebra instanceof Term) rendered = r...
af935d59-e638-4d4b-b2e1-00d17866d5de
4
public static int romanToInt(String s) { Character[] metric = {'I','V','X','L','C','D','M'}; int[] a = {1,5,10,50,100,500,1000}; Map<Character, Integer> smap = new HashMap<Character, Integer>(); for (int i = 0; i < metric.length; i++) { smap.put(metric[i], a[i]); } int res = 0; for (int i = 0; i < s.le...
fbeb2ad5-5f21-4ac5-9c27-d8e4fdc339b2
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Main frame = new Main(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
35e52b55-c108-4afa-b507-8fe6e0371b9f
5
public PolyLinje[] sortPolylinjer(PolyLinje[] randomPolylinje) throws NullPointerException { int antalGula = 0; // Räknar antalet gula Polylinjer av dem slump- // mässigt genererade. for(int i = 0; i < randomPolylinje.length; i++) { if(randomPolylinje[i].getFarg() == "gul") { antalGula++; } ...
0d87280b-2306-4361-b1be-bc3231fa1216
3
public static List<Field> outVars(Class<?> comp) { List<Field> f = new ArrayList<Field>(); for (Field field : comp.getFields()) { Out out = field.getAnnotation(Out.class); if (out != null) { f.add(field); } } return f; }
dd4c5e96-bbb4-42a4-a117-0ee5495eb441
2
public void setComponents(double[][] values) { for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) m[i][j] = values[i][j]; }
3bd09df9-94e5-4760-9129-346cd2684703
5
public List<Event> getPickingInfo(String picikingId) { List<Event> events = new ArrayList<Event>(); for (Event e : eventLog) { EventType type = e.getEventType(); String picId = splitMetaData(e.getMetaData())[0]; if (picId.equals(picikingId)) { if (type == EventType.NEW_PICKING || type == EventT...
84ba0708-0114-47fa-b12e-b69b71251829
6
private boolean checkSetting() { if (DoSetting.tmpUserName.getText().isEmpty()) return false; if (new String(DoSetting.tmpPassWord.getPassword()).isEmpty()) return false; if (DoSetting.tmpKeyPath.getText().isEmpty()) return false; if (DoSetting.tmpHostName.getText().isEmpty()) return false; if (Do...
bf316a8e-e995-414f-928e-f311882af6da
1
protected void demo17() throws IOException, UnknownHostException, CycApiException { if (cycAccess.isOpenCyc()) { Log.current.println("\nThis demo is not available in OpenCyc"); } else { Log.current.println("Demonstrating usage of the generateDisambiguationPhraseAndTypes api function.\n"); ...
bcc955a9-ae7c-463c-befd-43a80b92f585
7
public void save() { try { File file = new File(this.absoluteFileName); DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setNamespaceAware(true); Document document = factory.newDocumentBuilder().newDocument(); Element unisensElement = this.createElement(document)...
1d61ccb3-07ca-4010-9f14-3aa3a16eea81
6
protected void appendImage(String text) { String[] link=split(text, '|'); URI uri=null; try { // validate URI uri=new URI(link[0].trim()); } catch (URISyntaxException e) { } if (uri!=null && uri.isAbsolute() && !uri.isOpaque()) { String alt=escapeHTML(unescapeHTML(link.length>=2 ...
01f1c4fc-6a99-47cf-90f3-46f90cb82760
0
public int getPort() { return this.port; }
2ccbf809-0938-4f76-9fce-c694ff664ada
7
@Override public void run() { while (true) { player.update(); currentSprite = anim.getImage(); if (playerState == PlayerState.Combat) { if (!player.getLocation().combat(player)){ playerState = PlayerState.Dead; } else playerState = PlayerState.Alive; } else if (player.getLocation().is...
aac7a0e2-8f35-4afa-bb74-18caa1c17fe5
9
public int NumberParser(String str){ // Parses valid number for different formats from Strings // used for parsing numerical arguments like immediate values and // address jumps and memory initializations int x=0; String temp=""; if(str.length()>2) temp=str.subs...
fd172173-7615-456b-846c-33eb7c38236c
5
public boolean equals( Object other ) { Match m = ((Match)other); if ( m.length == this.length && this.data != null && ((Match)other).data != null ) { for ( int i=0;i<length;i++ ) { if ( m.data[i] != this.data[i] ) return false; } return true; } return false; }
b46fe9bb-6947-4c9e-a3af-a65c0839b09a
3
public Icon loadIconIfNonEmpty(String url) { if (url != null && !url.isEmpty()) { try { return ImageSupporter.loadImageIcon(url); } catch (MalformedURLException ignored) {} } return null; }
e1d5cff8-f9da-427b-807c-2e2d28203834
4
public static void testVersion(boolean testIfEnabled, boolean displayIfVersionMatch) { displayIfOK = displayIfVersionMatch; if(isRunning) { return; } if(testIfEnabled) { if(!AppConfig.getAppConfig().checkForSinalgoUpdate) { return; } long last = AppConfig.getAppConfig().timeStampOfLastUpdateChec...
9b9c7685-ab44-4c81-9d91-d8a95dd12005
1
public static void main(String[] args) { int a = 3; int c = 0; /** * if b = 0; * Exception in thread "main" java.lang.ArithmeticException: / by zero * at exceptionTest.ExceptionTest.main(ExceptionTest.java:10) */ try{ int b = 0; System.out.println("From Main Before!"); c = a / b; } ...
6f3ddff9-4bad-477a-8d01-f9ef81caeb57
1
public void saveCache() throws IOException { if (xmlFile != null) synchronized (doc) { try (OutputStream outStream = Files.newOutputStream(xmlFile)) { outputter.output(doc, outStream); } } }
7a72a744-16be-4c6b-aac7-b339cd9dd47a
7
public boolean chooseOptionFromMenu() { int userChoice= Program.getUserInput(); if (userChoice == 1) { Program.displayBookList(); } else if (userChoice == 2) { user.reserveBook(); } else if (userChoice == 3) { if (User.loggedIn()) { ...
702a36e8-be8c-4eff-921b-edc58da1d487
1
protected synchronized WebPage processHtml(final String url, final int depth) // throws ParserException, Exception { this.cobweb.addSearchedSites(url); // Parser parser = new Parser(); parser.setURL(url); URLConnection uc = parser.getConnection(); uc.connect(); // WebPage wp = new WebPage(); wp.setDe...
65be74db-39ef-46f4-acc6-a63a172750f8
7
private void setupKeys(EntityRegistry registry) { // for (Field f : keyRegistry.getDeclaredFields()) { // FieldId ann = f.getAnnotation(FieldId.class); // if (ann != null) { // Object okey; // try { // okey = f.get(TKey.class); // ...
0920393b-c966-4b05-a6bd-1fbd4d36f9d4
4
@Override public boolean equals(Object obj) { if (!(obj instanceof ByteOrderMark)) { return false; } ByteOrderMark bom = (ByteOrderMark)obj; if (bytes.length != bom.length()) { return false; } for (int i = 0; i < bytes.length; i++) { ...
46e17d4c-3e27-4813-a530-d409e49eaa53
0
public void SetNumebrOfPackets(int packets) { NumberOfPackets = packets; //UDarray = new int[NumberOfPackets]; }
0a70e7bf-4206-486a-be71-466f71121877
3
public void mouseMoved(MouseEvent e) // used to show where the piece will be placed { for (Square[] a : squares) { for (Square s : a) { if (s.rect.contains(e.getPoint())) { x = s.x + 40; y = s.y + 40; } } } }
66b3b685-6576-43b5-aa63-d2251a75e7aa
8
private boolean importFile() { File lastFile = fileChooser.getSelectedFile(); boolean success = false; final Frame frame = JOptionPane.getFrameForComponent(this); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilters(new String[] { "html", "txt" }); fileChooser.setDialogType(JFi...
16fb9ec4-8d68-4e5f-9564-67cf486161b2
3
private void printBoard(Board board, Engine engine) { //System.out.println("Current Board:"); // Print Header System.out.println(" X "); System.out.println(" 0|1|2"); // Iterate over the rows, y. for (int y=0; y<3; y++) { ...
b0f60c2e-6ca9-454a-94e8-5066b6d18246
9
public void loadFromObject() { try { if (cls==null) return; for (int i=0; i<fields.size(); i++) { String fieldname = (String)fields.get(i); String fieldtype = (String)fieldtypes.get(fieldname); //System.out.println("<field "+fieldname+" "+fieldvalue); if (fieldtype.equals("key") || fieldtype.equals(...
f5a28d17-70ab-4f1c-9817-c4fea3d722ed
3
@Override public void registerToken(NotificationToken token) { String logData = ""; if (token.getType() == null) { // result logData += "Result of access request:\n"; logData += "Time: "+token.getTimestamp()+"\n"; logData += "Controller: "+token.getController()+"\n"; logData += "AccessPoint: "+token.ge...
c807f096-ac10-4317-9c6d-29af76da51a2
0
public void setjTextFieldMotifVis(JTextField jTextFieldMotifVis) { this.jTextFieldMotifVis = jTextFieldMotifVis; }
7dd7fb13-eb5f-4122-a20a-2acfc5a0f698
5
private void constraint_31A() throws IOException { for (int k = 1; k <= NUM_VARS; k++) { for (int m = 1; m <= SQUARE_SIZE; m += 3) { for (int n = 1; n <= SQUARE_SIZE; n += 3) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { ...
d347e311-37dd-4608-a7fa-34626447ba36
4
private static String[] getInitialData() { File file = new File(INPUT_FILE_NAME); if (!file.exists()) { return InitialDataGeneratorHelper. generateInitialData(DEFAULT_TOWERS_NUMBER, DEFAULT_CALLS_NUMBER); } String[] result = new String[2]; try (Bu...
5d73e794-1bdd-43be-a352-f0e6d1f9c35d
3
private void initialize(Header header) throws DecoderException { // REVIEW: allow customizable scale factor float scalefactor = 32700.0f; int mode = header.mode(); int layer = header.layer(); int channels = mode==Header.SINGLE_CHANNEL ? 1 : 2; // set up output buffer if not set up by client....