method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ad14ee9c-3d8c-46e1-b820-fa3f6e3c944d
2
public int getInt(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONException("JSONArray[" ...
eec73fef-270e-4c2f-96ff-b5c1f18336f0
4
private static int scoreMove(Board bd, Move m, int myColor, int oppColor, int currDepth, int maxDepth, int cutoff){ int retVal; if (currDepth >= maxDepth) { if(currDepth % 2 == 0){ //this means we are at a depth where we must eval for an opponent Move retVal = evaluate(bd, m, oppColor); // ev...
ed9b9403-7010-4438-8df4-2dc261ac25ce
9
@Override public void spring(MOB target) { if(target.location()!=null) { if((!invoker().mayIFight(target)) ||(isLocalExempt(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target)) ||(target==invoker()) ||(doesSaveVsTraps(target))) target.location().show(target,null,null,CMMs...
0c052e98-e501-44f8-9746-57efb6478d7b
0
@Override public void actionPerformed(ActionEvent e) { saveOutlinerDocument((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched()); }
eac9e775-956f-4a47-aac6-3a76b29b4b05
6
private void fillParameters(ServletRequest request, ParameterGraph parameterGraph) { for (Parameter para : parameterGraph.getParameters()) { if (para instanceof SimpleParameter) { SimpleParameter simpleParameter = (SimpleParameter) para; String[] values = request.getP...
e3c90747-e6b6-47a7-b538-118d2d15988c
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...
057d3c38-6f9a-4e16-b124-c19df0ed8143
6
@Override protected void sort(int[] a) { while (true) { boolean swapped = false; for (int i = 1; i < a.length; i++) { if (a[i - 1] > a[i]) { swap(i - 1, i); swapped = true; } } for (int ...
b7d5045d-48f3-4058-8735-976ce3f6f556
4
public void copyToPencilMode() { int i = 0, j = 0; for(i = 0; i < 9; i++) { for(j = 0; j < 9; j++) { if((pencilEntries[i][j].isEditable()) && (pencilEntries[i][j].getText().equals(""))) { pencilEntries[i][j].setText(entries[i][j].getText()); } } } }
27b2c120-9277-426a-9d24-6d810da8c15f
0
static void logException(Exception e) { StringWriter trace = new StringWriter(); e.printStackTrace(new PrintWriter(trace)); logger.severe(trace.toString()); }
ffcd869f-3e03-4fc8-99b7-55daf9a14fe2
4
@EventHandler public void onPlayerDeath(PlayerDeathEvent e) { Player player = e.getEntity(); HatPlayer hatPlayer = HatPlayerManager.getHatPlayer(player); for (ItemStack item : e.getDrops()) { if (item.equals(ItemStackUtil.getHatItem())) { e.getDrops().remove(item); break; } } for (ItemStack i...
69834312-9441-4506-a284-5d7f48e88adf
1
private Error cleanModel() { try { FileUtil.deleteDirectory(Constants.PROGRAM_TMP_PATH); } catch (IOException e) { LOGGER.warn("Dir opened by user?", e); } return createTemporaryData(); }
73b426c2-7579-40c1-a23b-330df5e8f733
4
private void saveArrangement() { try { FileChooser f = new FileChooser(); f.setInitialDirectory(new File(System.getProperty("user.dir"))); f.setInitialFileName(controller.getNameTextField().getText() + ".txt"); f.getExtensionFilters().addAll( ...
e125aed6-af3c-423d-b014-b34dc195f6d6
8
protected void toXMLImpl(XMLStreamWriter out, Player player, boolean showAll, boolean toSavedGame) throws XMLStreamException { // Start element: out.writeStartElement(getXMLElementTagName()); if (toSavedGame && !showAll) { throw new IllegalArgume...
b1632ad3-32e7-48e7-b73a-afdd73396988
1
@Override public void mouseClick(int X, int Y) { if(this.getMouseListener() != null) { this.getMouseListener().MouseClick(this); } }
aea0b084-a279-4d78-8543-31da309d17e4
7
private void rightPossibleMoves(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if(x1 >= 0 && x1 < 7) { boolean pieceNotFound = true; for (int i = x1 + 1; pieceNotFound && (i < maxWidth) && (board.getChessBoardSquare(i, y1).getPiece().getPieceColo...
f8235e88-adf2-4288-bef4-674024b6df91
6
private void checkprepBridge() { // TODO Auto-generated method stub if(client_bridge.isCreateAttackUnitRequest()){ } if(client_bridge.isCreateUnitRequest()){ if(player.canCreateUnit(client_bridge.getId())){ control.addUnit(client_bridge.getId(), client_bridge.getX(), client_bridge.getY(), 0); pla...
d2bbe03a-f056-475f-bf5b-fcd7539be1fe
7
public Response runApplication(Request request, ApplicationDescriptionHandler adh) { try { String domainName = String.valueOf(request.getHeaders().get(RequestKeys.HOST_NAME.getValue()).getValue()); // first check if this domain name is serving if (adh.domainExists(domainName)...
d6807a4d-3c19-4d90-b734-91e52ea018cd
1
public static boolean Modificar2(Object o) { Transaction t = cx.beginTransaction(); try { cx.update(o); t.commit(); cx.flush(); return true; } catch (Exception e) { System.out.println("no se modifico"); t.rollback(); ...
9eacd1b3-b983-470e-9186-8d0fa0fea413
1
static public void stop(String name) { //destroy if component if (states.get(name) instanceof GameStateComponent) { ((GameStateComponent) states.get(name)).destroy(); } }
d2cbf2fa-9680-426f-90ba-1d9141efd976
8
public String processInput(String InputLine) { if (state == WAITING) { tgrep = new TestGrepProtocol("client"); cmdOut = "test"; state = SEND_FILE; tgrep.processInput(cmdOut); return cmdOut; } else if (state == SEND_FILE) { try { if ((cmdOut = read.readLine()) != null) { tgrep.process...
a53a828a-d10b-4db8-aafc-87344058a8d3
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; int levelDiff=target.phyStats().level()-(mob.phyStats().level()+(2*getXLEVELLevel(mob))); if(levelDif...
820bf985-4c43-4fec-b106-43366ed294ca
9
private DBObject createDBEventFinderByMonth(String ownerID, Date date) { BasicDBObject obj = new BasicDBObject(); if (ownerID != null && ownerID.length() > 0) obj.append(OWNER_ID, ownerID); if (date != null) { if (year.format(date) != null && year.format(date).length() > 0) { obj.append(YEAR, Integ...
a349f8ba-0685-46d4-afe6-9dc5ba4d47ba
1
public List<Integer> getNewsFeed(int userId) { List<Integer> result= recentFeedMap.get(userId); if(result==null) result=new ArrayList<>(); return result; }
e9be06c9-7bd1-4cbb-89ae-5863f6aa026f
7
@Override public void write(JustClass justClass) { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { db = dbFactory.newDocumentBuilder(); doc = db.newDocument(); Element rootElement = doc.createElement(CLASS_ELEMENT); // constants Element...
8d03c740-45ec-4c19-9fc7-63b61a83c2da
2
public void insertarCliente(Cliente c){ try { Statement comando=connection.createStatement(); int especial = 0; if(c.isEspecial()){ especial = 1; } System.out.println(especial); /*System.out.println("INSERT INTO Cliente" + ...
d1f53eaa-02a3-48de-b393-e745178785f8
4
public MapToolkitPanel() { addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { int mx = e.getX(), my = e.getY(); //int x, y; x = (mx - 16) / 8; y = (my - 16) / 8; if (x>=0 && x<27 && y>=0 && y<27 ){ System.out.println("x="+x+", y="+y); ...
e8ed277f-d91d-4e8d-a324-4b865b9a2c65
8
public GUIDisplay(ISearchSpace searchSpace) { super(searchSpace); displaySearchSpace(new Object()); /* the frame configuration */ super.setTitle("AStar Optimal Path"); super.setSize(400, 500); super.setLocationRelativeTo(null); super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); super.setVisible...
6282fad6-32e9-49f3-9f5c-2ab61793425e
4
public boolean isStraight() { boolean retBoo = false; if (_cards.size() >= 5) { ArrayList<Card> temp = insertionSort( _cards ); int count = 0; for (int i = 1; i < temp.size(); i++) { if (temp.get(i).getValue() == temp.get(i-1).getValue()+1) count++; else count = 0; } if (coun...
796888c8-a428-4a31-9cd5-4de8f2ee7e20
1
@Override public String toString () { if ( isConnected() ) return "AFUNIXSocket[fd=" + this.impl.getFD() + ";path=" + this.addr.getSocketFile() + "]"; return "AFUNIXSocket[unconnected]"; }
9a55dd06-d110-479e-a193-d6f91e4f2636
3
@Override public void serialize(Buffer buf) { buf.writeUShort(finishedQuestsIds.length); for (short entry : finishedQuestsIds) { buf.writeShort(entry); } buf.writeUShort(finishedQuestsCounts.length); for (short entry : finishedQuestsCounts) { buf.write...
9362b180-22e8-43f7-b325-8f037e6a9e08
4
@Override public void keyTyped(KeyEvent e) { Character car = e.getKeyChar(); if (Character.isLetterOrDigit(car) || car.equals('\t') || car.equals('\n') || car.equals(' ')) { String s = Character.toString(car); UserInterface.getInstance().setInsertion(s); executeCo...
d2655986-7402-412f-9e35-ae1c2d096ed6
4
@Override protected void addHandled(Handled h) { // Can only add drawables if (!(h instanceof Drawable)) return; Drawable d = (Drawable) h; // If the depth sorting is on, finds the spot for the object if (this.usesDepth) { int index = 0; while (index < getHandledNumber() - 1) { /...
92d01305-5b78-4ade-a0aa-8976000358b6
7
private void displayDUFrame(XHSIInstrument window, boolean display) { // if ( window.du.enabled() ) { switch (window.get_index()) { case XHSIInstrument.EMPTY_ID : ((EmptyComponent)window.components).forceReconfig(); break; case...
9720eb6c-a970-4e18-addf-268d7e44760f
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
549b6642-8be7-44dd-b0d7-f58d3c05e75b
3
private void IndexOutOfBound(int givenIndex) { if (this.isempty() || givenIndex > this.length - 1 || givenIndex < 0) throw new IndexOutOfBoundsException( "Given index is bigger than List max length!"); }
0b0f7786-527d-4df3-9075-ceccc0e6b5c6
0
@Test @TestLink(externalId = "ASSUMPTION_FAILED") public void testFailingAssumption() { assumeThat(0, is(1)); }
e1f97239-23c9-49be-89d5-d108cd23a2e8
3
@Override public void caseAStmtsStmt(AStmtsStmt node) { inAStmtsStmt(node); if(node.getRM() != null) { node.getRM().apply(this); } if(node.getStmt() != null) { node.getStmt().apply(this); } if(node.getLM() != null) {...
af9cb970-4e82-460b-8642-57a8cb58d628
3
@Override protected void checkType() { for (int x = 0; x < getWidth(); x++) { for (int y = 0; y < getHeight(); y++) { if (saturation.getPixel(x, y) != 0) { type = ImageType.COLOR; return; } } } type = ImageType.GREYSCALE; }
d60edd2b-cc8b-4608-83b0-f7e11801d379
0
public CheckResultMessage checkL4(int day) { return checkReport.checkL4(day); }
f12ca85f-8c56-4a7b-b458-042967732005
2
public Teleport(TileMap tm) { super(tm); facingRight = true; width = height = 40; cwidth = 20; cheight = 40; try { BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/Level/Teleport.gif")); sprites = new BufferedImage[9]; for (int i = 0; i < sprites.length; i++) { ...
32eefc70-c70f-440b-b174-d4a71205d280
9
public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) { ArrayList<ArrayList<Integer>> out = new ArrayList<ArrayList<Integer>>(); if (root == null) return out; ValPack p = new ValPack(); p.node = root; p.level = 0; LinkedList<...
b478fb49-4e3a-4266-8672-8e19b63589fa
9
public int migrate() { int numMigrations = 0; for (Agent a : agents) { if (Math.abs(a.getOpinion() - a.getGroup().getavg()) > this.Constants._epsilon || a.getGroup().getAgents().size() < Constants.minAgents) { boolean changed = false; Group holdG = null; double probRoll = gen.nextDouble(); a...
ed530716-94c4-4bc8-93b5-aaf0101460db
6
public static void Add(int workflowID, Parameter param, Result lift, Result drag) throws Exception { if(userID == -1) { throw new Exception("ADD_ERROR_UNKNOWN_USER"); } else { //try (Connection con = DriverManager.getConnection(url + dbname, dblogin, d...
0462acff-58fe-4518-9daf-524bf36baad4
0
public DefaultCharacter() { super(); } // End DVC
4b329a53-3967-45aa-a50c-dcccbfd5d0dd
0
public ClientManager(AprilonIrc plugin){ Parent = plugin; }
d8869fd4-1f3c-4848-bbaf-1d0368b5bd9e
7
public void saveSRTFile() { if (_generalPanel.getInputField().equals("")) { JOptionPane .showMessageDialog( null, "No source file has been selected. Please select a file in the General tab to save SRT."); return; } String outtext; File inputMedia = new File(_generalPanel.getInputField()...
f3127d07-666c-46a4-8610-71184f1405b4
0
public int[] getBounds() { return recognizer.bounds; }
940b337e-0652-466d-adc7-eebd3601b270
4
public static double exponentialInverseCDF(double mu, double sigma, double prob) { if (prob < 0.0 || prob > 1.0) throw new IllegalArgumentException("Entered cdf value, " + prob + ", must lie between 0 and 1 inclusive"); double icdf = 0.0D; if (prob == 0.0) { icdf = mu; } else { if (prob == 1.0) { icd...
0c3e6861-33c0-4d44-aa61-02609e9aab58
4
private double[][] multiplyMatrices(double[][] L, double[][] R) { int m = L[0].length; int n = R[1].length; // Matrices must have agreeing inner dimensions if (L[0].length != R.length) { throw new IllegalArgumentException(); } // Initialize return matrix ...
e158498a-0d8a-4dd3-8e11-3c62dd8341d4
9
private static TypeEnum getType(String type) throws Exception { if ("boolean".equals(type)) { return TypeEnum.BOOLEAN; } else if ("short".equals(type)) { return TypeEnum.SHORTINT; } else if ("int".equals(type)) { return TypeEnum.INT; } else if ("bigint".equals(type)) { return TypeEnum.BIGINT; } el...
a5018479-1e77-44fc-9ff4-c91df2f47f95
1
@Override public JSONObject getValueForOutput() { try { return this.venue.toJson(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return new JSONObject(); } }
493fbe76-daee-448b-89ed-1d4483afed96
2
public int searchNodePosition(GraphNode<T> pgraphNode) {//return the actual position of the node in the parameter for (int i = 0; i < graph_nodes.getLength(); i++) { if (pgraphNode.equals(graph_nodes.get(i))) {//if param is equal to node in list. return i; } } ...
2d825cfb-c45c-4c3b-bf67-f1ba3e588d7b
1
@Override public final Vector<Integer> hash(final K key) { long k = ktol(key); final Vector<Integer> hashs = new Vector<Integer>(this.getNum()); for (int n=0; n<this.getNum(); n++) hashs.add(hashfn(k,n)); return hashs; }
d2b728fd-09ea-4748-b94d-0986637c9e3c
5
private void exportSpritePlacements(File f) { Map<Integer, Map<Integer, List<Map<String, Integer>>>> spritesMap = new HashMap<Integer, Map<Integer, List<Map<String, Integer>>>>(); int x, y = 0; for (List<SpriteEntry>[] row : spriteAreas) { Map<Integer, List<Map<String, Integer>>> rowOut = new HashMap<Integ...
24cbdc94-c5df-460e-9a06-ca84be792be3
6
public static void loadSQL(String path) throws SQLException, IOException { // Analyseur de fichier Scanner scanner = null; Connection connexion = null; Statement ordre = null; try { scanner = new Scanner(new File(path)); // Le delimiteur de blocs sera le p...
f822d13e-2ce6-4b9d-ad05-6d5159a640a7
8
public static Mesh LoadMesh(String fileName) { String[] splitArray = fileName.split("\\."); String ext = splitArray[splitArray.length - 1]; if (!ext.equals("obj")) { System.err.println("Error: File format not supported for mesh data " + ext); new Exception().printStackTrace(); System.exit(-1); } ...
95af99e8-bda2-437a-bcb1-f40db40a0a42
3
final public void Or_operator() throws ParseException { /*@bgen(jjtree) Or_operator */ SimpleNode jjtn000 = new SimpleNode(JJTOR_OPERATOR); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { if (jj_2_71(3)) { jj_consume_token...
41016e7b-2700-4e51-9c95-91a7bf5782f0
2
public static String getFolderPath(String path) { if (StringUtil.isEmpty(path)) return null; path = path.replace("\\", "/"); if (path.lastIndexOf("/") > -1) return path.substring(0, path.lastIndexOf("/") + 1); return path; }
055a13e7-c271-43a4-8487-f948c07188a5
2
public ParserThread(InputStreamReader input, int totalChars, InputStreamReader dictionary, int totalDictionaryChars, OutputStreamWriter output, UI ui, String languageCharacters, String additionalInnerCharacters, int maxWords) { mUi = ui; mInput = input; mTotalChars = totalChars; mInputDictionary = dictionary; ...
b3b91eb0-e9a6-481e-b850-5c937a2ac1d1
2
public static void main(String[] args) { char again; int n,m; do{ print("Enter the dimensions of the matrices: "); n = scan.nextInt(); m = scan.nextInt(); double[][] matrix1 = new double[n][m]; double[][] matrix2 = new double[n][m]; print("Enter the data for the first matrix: \n")...
aa8efa1a-4940-4af4-b18d-c149010c19a4
2
private static Map<Integer,Integer> initMap(int []s){ Map<Integer,Integer> mp = new HashMap<Integer,Integer>(s.length); for(int value:s){ if (mp.containsKey(value)) mp.remove(value); else mp.put(value, 1); } return mp; }
cceb1b05-08f7-4145-8ffd-f64f9177dc47
1
private void risuemPodpisiPodLiniei(GC gc, int x, int y) { double step = (int) Math.sqrt(LastModelingTime + 0.0); for (double i = 0; i <= LastModelingTime; i += step) { int currentPosition = (int)i; // координата х сhertocka(gc, currentPosition + x, y,...
0a234623-2716-4bf0-900c-b1075f75f161
1
@Override public String get(Object key) { Object val = super.get(key.toString()); return resolve(val != null ? val.toString() : null); }
1825b148-7ac5-4e7a-a286-84a39b5916c1
9
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...
cf2b17d6-575c-4c60-9fee-7aa8ac4d7771
7
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { if(!(target instanceof MOB)) return Ability.QUALITY_INDIFFERENT; final Room R=mob.location(); if(R!=null) { if((R.domainType()!=Room.DOMAIN_INDOORS_CAVE) &&(R.domainType()!=Room.DOMAIN_OUTDOORS_MOUNTAINS) &...
c958acbc-d677-4c00-91f8-4c240bc1e1d2
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
a48f8820-0216-4106-9a59-f2eb8b989c06
0
public void setFoo2(T2 foo2) { this.foo2 = foo2; }
4b8be337-3dc0-425c-bec8-11c16863831b
0
@PreDestroy public void destroy() { this.blogLabel = null; this.blogContent = null; this.blogCreatedDate = null; System.out.println("PreDestroy"); }
a309b02c-4c81-4d77-a560-94ff41b938c3
2
public int maxProfit4(int[] prices) { // can also get least lost int maxp = prices[1] - prices[0]; int diff = maxp; for (int i = 1; i < prices.length - 1; i++) { if (diff >= 0) diff += prices[i + 1] - prices[i]; else diff = prices[i + 1] - prices[i]; maxp = Math.max(diff, maxp); } return maxp...
0799dc4a-d245-4dd6-b37e-36e797542aca
0
public Point getDirection() { return new Point(previousGlied.x - x, previousGlied.y - y); }
83283031-99dd-40a1-8c38-60aa2ef84b7d
4
private void populateDictionary(String filename) throws IOException, SAXException, ParserConfigurationException { roots = new ArrayList<>(); SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(new File(filename), new DefaultHandler() { boolean inWord; ...
70af64ce-d090-42e4-ad75-474de4af8de7
4
private void updateArchiveFile(Vector stuList){ File file = new File( "/Users/Shelley/Documents/DiningHallSeating/DHS/DiningHallSeating/Data/" + "Students0910.txt"); FileInputStream fis = null; try { fis = new FileInputStream(file); //regular expression (it matches one or more whitespace...
cd7c214e-789b-4e2d-92e4-2d5b3cb379bb
8
protected void process() { double[] clusterAssignments; int i; double[] values; int j; int[] classAssignments; clusterAssignments = m_Evaluation.getClusterAssignments(); classAssignments = null; if (m_Instances.classIndex() >= 0) { classAssignments = m_Evaluation.g...
cce1fdb9-9c69-4044-95ec-5dabdcb6e44e
5
public void verify(char[] password) { if (!isMasked() || payload == null) { return; } IMac m = null; try { m = getMac(password); } catch (Exception x) { throw new IllegalArgumentException(x.toString()); } m.update(payload, 0, payload.length - m.macSi...
a531c3de-f589-4041-bc60-0fdff0fbc9db
2
static public String[] listFiles(String inputdir) { File dir = new File(inputdir); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i = 0; i < children.length; i++) { // Get filename of file or directory String filename =...
4dcd0d1f-ac77-421d-8f39-52eef0dabc6a
5
private void drawBeastRadius(GOut g) { String name; g.chcolor(255, 0, 0, 96); synchronized (glob.oc) { for (Gob tg : glob.oc) { name = tg.resname(); if ((tg.sc != null) && (name.indexOf("/cdv") < 0) && ((name.indexOf("kritter/boar") >= 0) || (name .indexOf("kritter/bear") >= 0))) { ...
eb48180e-104c-46ca-b1d9-75735c82b228
4
public static int sync_header(byte [] stream){ int offset = 0; for(; offset < stream.length; offset++) if(stream[offset] == -1 && ((stream[offset+1] & 0xf0) >>> 4) == 0xf && (stream[offset+1]&0xf ) != 0xf) break; retur...
fa6f8c26-a791-468e-91d0-f6681c09cdfa
7
protected static float combatPriority( Actor actor, Actor enemy, float winReward, float lossCost, boolean report ) { if (actor == enemy) return 0 ; if (report) I.say(" Basic combat reward/cost: "+winReward+"/"+lossCost) ; float danger = Retreat.dangerAtSpot(enemy, actor, enemy) ; final float...
f0893f1b-e82f-4d68-8975-7fe1db564104
7
@EventHandler(priority = EventPriority.HIGH) private void onPlayerInteract_Func(PlayerInteractEvent event) { Player player = event.getPlayer(); if (plugin.getConfig().getBoolean("enable-clubs")) { if (GcCommands.Golfing.containsKey(player)) { if (GcCommands.Golfing.get(player)) { if (event.getAction()...
a64cfaa0-8bc3-4027-9716-02057593a04a
8
private void createDonutModel() { donutModel = new DonutChartModel(); Map<String, Number> circle1 = new LinkedHashMap<String, Number>(); setPriority("notice"); setHost("root.intt.tn"); if(getfacilityByHost().size()!=0) circle1.put("notice", getfacilityByHost().size()); setPriority("emerg"); setHo...
a1f38319-b392-4973-9b52-6c1744e3085a
0
@Before public void setUp() throws Exception { this.service = DefaultSameAsServiceFactory.createNew(); }
1611cadf-d829-4f01-8a13-603c6f08daba
3
public BranchGroup createSceneGraph() { BranchGroup root = new BranchGroup(); transformGroup = new TransformGroup(); transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); root.addChild(transformGroup); Block cube = new Block(0.1, transformGroup); transformGroup2 = new TransformGroup(); tr...
fda8625b-7feb-417d-b430-4f7972923f8b
1
protected void setupCombo(JComboBox<?> combo, String tooltip) { combo.setOpaque(false); combo.setToolTipText(tooltip); add(combo); }
cd75f46f-6229-4285-92b2-b46a1515b7a9
8
private void addCurrent_drawHighlight_rememberCaret() { strs.add(current); if (selectingPivot != -1) { int minC = Math.min(selectingPivot, caret); int maxC = Math.max(selectingPivot, caret); if (maxC > count && minC...
27008d3c-eca9-45c7-93a1-98348d735f1a
2
public static double gammaMean(double mu, double beta, double gamma) { if (beta <= 0.0D) throw new IllegalArgumentException("The scale parameter, " + beta + "must be greater than zero"); if (gamma <= 0.0D) throw new IllegalArgumentException("The shape parameter, " + gamma + "must be greater than zero"); return ga...
f0ff57ee-6883-456c-a35e-e3e843963b86
0
public IntBTNode(int initialData, IntBTNode initialLeft, IntBTNode initialRight) { numOfInstace++; data = initialData; left = initialLeft; right = initialRight; System.out.println(" initialData = " + initialData + "\n numOfInstance = " + numOfInstace); }
ab98a912-a4cc-4658-95ff-4f6fbac8124f
0
public int getPort() { return port; }
8db23af6-38ce-4544-80ee-1cd6284984e8
9
protected void intLoop(RasterAccessor src, RasterAccessor dst, int filterSize) { int dwidth = dst.getWidth(); int dheight = dst.getHeight(); int dnumBands = dst.getNumBands(); int dstDataArrays[][] = dst.getIntDataArrays(); ...
53b42e9b-2be1-47d7-b5a9-fc49e70d7825
6
private ListNode merge(ListNode left, ListNode right) { ListNode result = new ListNode(0); ListNode position = result; int lVal = 0; int rVal = 0; while(null != left || null != right) { if(left != null) { lVal = left.val; }else{ lVal = Integer.MAX_VAL...
1bcf39be-4f7d-4363-99f4-3324edddf14d
5
private TreeMap<Float, Float> makeAverageListFromPricePair( TreeMap<Float, java.awt.geom.Point2D.Float> priceByDate, int id, int neighborsToCount) { //ensure values for start/end points TreeMap<Float, Float> pts = makeListFromPricePair(priceByDate,id) ; ArrayList<Float> days = new ArrayList<Float>(priceB...
a4106a87-419c-41a0-8074-21b30ec2735f
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ImmutableProperties other = (ImmutableProperties) obj; if (map == null) { if (other.map != null) return false; } else if (!map.equals(ot...
0a2fa397-366d-4cd3-8f6a-4f21295a8fa0
0
public VueAbstrait(CtrlAbstrait ctrl){ this.controleur=ctrl; }
f23dda33-ed3b-4c6a-bae4-b84fc99aefb0
9
@Override public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException { if(!mapCreated){ g.setColor(Color.gray); g.drawString("setup map [ ]", 600, 300); }else{ g.setColor(Color.white); g.drawString("setup map [x]", 600, 300); } if(!musicLoaded){ g....
3afecb00-ccf5-4c21-aa75-d0a9ef5e95b1
3
private String tallennaURL(HttpServletRequest request) { // otetaan talteen miltä sivulta pyyntö tuli, että käyttäjä voidaan // palauttaa myös takaisin samalle sivulle String url = request.getHeader("Referer"); // tarkistetaan sisältääkö url menu- tai juoma-sivun ja removed parametrin boolean pizza = url....
803c3ec5-95ba-46bb-aa51-3795e5d7a621
8
public void fileCp(String src, String dest) { FileReader fr = null; FileWriter fw = null; BufferedReader br = null; BufferedWriter bw = null; String tmp = ""; try { fr = new FileReader(src); fw = new FileWriter(dest); br = new BufferedReader(fr); bw = new BufferedWriter(fw); while ((tmp = br...
d4b79c59-a089-465e-ac7d-82264f9cb12f
0
public void setArrivalTime(Period value) { this._arrivalTime = value; }
62e665cd-28fc-4bcc-af1f-a07f16574686
1
public static void handleServer(String address) { MainWindow window = MainWindow.getInstance(); try { window.createServerTab( ConnectionDetails.fromAddress(address) ); clearInput(); } catch (Exception e) { MessageDialog.error("Chyba aplikace", "Připojení nelze...
86bc0199-f36e-4c16-adfb-820065cb1bc2
6
private static void inventoryMenu() { int choice = 0; String name = ""; Item item; while(choice != 4) { System.out.println("Please choose what you would like to do.\n" + "1). List everything in your inventory\n" + "2). Sell item from inventory\n" + "3). Equip Item from inventory **TODO:\n" ...
9d90e408-ff93-4882-bf96-ed312127a81c
5
public static void main(String[] args) { try { Display.setDisplayMode(new DisplayMode(480, 360)); Display.setTitle("CoffeeBlocks"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); Display.destroy(); System.exit(0); } shaderProgram = loadShaders("texture"); translationM...
91c3e5be-c3eb-4312-adcc-b90550b26b32
0
@Before public void setUp() throws Exception { this.terminal = new POSTerminal(); this.terminal.setPricing('A',1,1.25f); this.terminal.setPricing('A',3,3f); this.terminal.setPricing('B',1,4.25f); this.terminal.setPricing('C',1,1f); this.terminal.setPricing('C',6,5f); this.terminal.setPricing('D',1,0.75f)...