method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
323b41c6-9d1c-436a-bb68-16feff567c6b
9
public long asLong() { try { if (isNull()) { return 0; } else if (isLong()) { return ((Long) value).longValue(); } else if (isString()) { String s = (String) value; s=s.replaceAll(",",""); return Long.valueOf(s).longValue(); } else if (isShort()) { return (...
b5a73fd6-3f7d-4cec-aa48-e8f9c101d6de
0
public void setThreadState(int id, boolean state) { threadStates[id] = state; }
2ace282b-0193-4bfb-92df-5aae987f7492
2
@Test public final void testIterator() { Iterator<SpatialTree<Sphere>> it; SpatialTree<Sphere> tree = new SpatialTree<Sphere>(objects); int count = 0; it = tree.leafInterator(); while (it.hasNext()) { for (Sphere s : it.next()) { assertTrue(s ins...
89f9658d-8be1-4489-815d-c06f8b9586ff
1
private void selectUnit(int x, int y) throws GameFieldException { if (model.isAvailableUnit(x, y)) { selectSquare(x, y); selectedSquares = model.getAccessibleSquares(x, y); } }
4dd90636-ad14-41f6-9a93-49ea26858d26
3
public Sound(String soundFile) { try { File file = new File("Sounds\\" + soundFile + ".mid"); soundClip = AudioSystem.getClip(); soundClip.open(AudioSystem.getAudioInputStream(file)); } catch (LineUnavailableException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOExcep...
4c763c98-e8c6-4fca-aad7-4eaf8ba569a2
4
public void extractConfig(final String resource, final boolean replace) { final File config = new File(this.getDataFolder(), resource); if (config.exists() && !replace) return; this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin...
d1cb39fc-558d-4354-b20c-c48dde9df28b
0
public ActiveTestThread(Server serversim){ this.server = serversim; }
89ef3233-c7ff-4286-812a-df8989b46ca5
7
private void processScreenBlt(RdpPacket_Localised data, ScreenBltOrder screenblt, int present, boolean delta) { if ((present & 0x01) != 0) screenblt.setX(setCoordinate(data, screenblt.getX(), delta)); if ((present & 0x02) != 0) screenblt.setY(setCoordinate(data, screenblt.getY(), delta)); if ((present & ...
67641539-7ce0-441c-872c-e3599cf9ba81
8
private String formatHistory(String history) { String[] lines = history.split("\\r?\\n"); String[] fields; String result = "<table class=\"history\"><thead>"; for (Integer i=0; i<lines.length; i++) { String line = lines[i].trim(); if (line.matches("(\\-+[\\s\\t]*\\|?[\\s\\t]*)+")) { ...
fdaf0dcc-1bc6-4735-936c-ec7090683b89
7
@Override public void run() { try { pushStatusToTaskTracker(); //called once reducer.setup(); // Shuffle int count = 0; if(lookUpJobTracker()){ MapJobsStatus status; status = getJobTrackerServiceProvider().reportMapStatus(taskID); while(!status.equals(...
c30730f1-e191-4846-a665-4fe2c79c57dc
9
@Override public void run(int interfaceId, int componentId) { if (stage == -1) { sendEntityDialogue(SEND_2_TEXT_CHAT, new String[] { player.getDisplayName(), "Hey! ", "Can you help me out?" }, IS_PLAYER, player.getIndex(), 9827); stage = 1; } else if (stage == 1) { sendEntityDialogue(SEND...
55be4865-b5f2-490b-8c81-0392ab7eaa49
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
73fc0da2-9003-496b-9c0e-ac3734134796
3
private static void writeCleanFile(){ try{ writer = new FileWriter("MegaDictionary.txt"); } catch(IOException e){ System.err.println("New File Could Not Be Initialised For Writing"); } for(int i = 0; i<words.size(); i++){ String toWrite = (words.get(i)); char[] write = toWrite.toCharArray(); ...
2fcb03f3-7cea-446b-a422-2259572793ed
2
public static float clampFloat(float value, float min, float max) { return (value < min) ? min : (value > max) ? max : value; }
323e647b-3862-482b-bb9f-af2a0aa1bb40
2
public boolean hasNextInt() { if(hasNext()) try { Integer.parseInt(token); return true; } catch(Exception e) { return false; } else return false; }
faebd682-151c-43c1-9b42-a46a70cbaedf
9
private boolean crossingInternal(Point2D.Double direction1, Point2D.Double direction2) { if (angles.size() < 2) { return false; } final double angle1 = convertAngle(getAngle(new Line2D.Double(center, direction1))); final double angle2 = convertAngle(getAngle(new Line2D.Double(center, direction2))); Double...
29d485bd-7f19-4ba4-b288-3ad2dc7a1c3a
0
public SplashScreen(int d) { duration = d; }
3d61f2ed-7e31-41d1-a35a-9e8947d34089
7
public void checkFields(LYNXsys system) { // method to check textfields before adding book if (!(getBookTitle().getTextField().getText().equals("")) && //check if ALL fields are provided !(getAuthorFirstName().getTextField().getText().equals("")) && !(getAuthorLastName().getTextField().getText().equals("")) &&...
4bc7fcd3-07ec-4628-a35e-89bc1cbbc0c1
4
public static void keyPressed(String key) { switch(key) { case "escape": escape(); break; case "enter": enter(); break; case "space": space(); break; } switch(Main.Screen) { case "inGame": Main.inGameManager.keyPressed(key); break; } }
7c2bd899-da64-41b4-ba2c-dda9e67bce0b
0
public String getPackageName() { return this.packageName; }
c23e01ef-bed4-4e9e-a2a5-517a7a81287e
9
protected boolean validateHeader(byte[] header){ if(header.length != 16){ System.err.println("Invalid header. Not 16 bytes???"); return false; } // Now we validate the Header based on this document: http://nesdev.parodius.com/neshdr20.txt // Bytes: // 0 = 0x4E (charcter...
7b05d102-a9b9-418e-8637-5df11312b3ca
1
public com.babyduncan.thrift.model.Book recv_getBook() throws org.apache.thrift.TException { getBook_result result = new getBook_result(); receiveBase(result, "getBook"); if (result.isSetSuccess()) { return result.success; } throw new org.apache.thrift.TApplicationException(org...
3851d954-c8ac-42f2-8e78-9f8271909a0c
1
@Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String uri = req.getRequestURI(); if (uri.contains("/resources/")) { super.doGet(req, res); } else { processRequest(req, res); ...
60f47b92-6731-4fda-97c7-09254634bd3f
7
private boolean processArguments(final String[] args) throws CommandException { log.debug("processing arguments: " + Strings.join(args, ",")); if (args.length == 0) { throw new CommandException("Command requires arguments"); } String sopts = "-:"; LongOpt[] lopts ...
d4dbfec2-7063-429d-9ae1-b421fe8d675a
4
public static int[] createHashes(byte[] data, int hashes) { int[] result = new int[hashes]; int k = 0; byte salt = 0; while (k < hashes) { byte[] digest; synchronized (digestFunction) { digestFunction.update(salt); salt++; ...
0a8c638c-bc48-4f45-9cf2-695971279b33
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { Delivery delivery = deliveries.get(rowIndex); Item item = delivery.getItem(); if (columnIndex == NUMBER) { return item.getNumber(); } else if (columnIndex == TYPE) { return item.getModel().get...
96cc7bce-bca4-48d6-9601-80b7d4cf30be
8
@Override public void tick(ControlleurObjets controlleur) { if(++timer >= 3){ frame++; timer = 0; } if(frame >= 4 && exploding == false) { frame = 0; } else if (exploding && frame == 3) { try { jeu.gameOver(); ...
e63df043-a7ff-4eb2-aae1-01721bea2e95
6
public boolean loadSingleImage(String fnm, String name, float transperancy, short red, short green, short blue) { if (name.equals("")) { name = getPrefix(fnm); } if (imagesMap.containsKey(name)) { EIError.debugMsg("Error: " + name + "already used", EIError.ErrorLevel.Err...
b3de7ff2-ef13-4343-bdc5-400711852ba4
6
@EventHandler public void EnderDragonInvisibility(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.getEnderDragonConfig().getDouble(...
0434a084-7ef0-4027-af8a-e3b5bff3dbb1
8
public Vertex[] pathDFS(Vertex source, Vertex target) { if (graph.containsKey(source) && graph.containsKey(target)) { Graph tree = new Graph(); Stack<Vertex> S = new Stack<Vertex>(); S.push(source); source.setVisited(true); boolean pathFound = false; ...
88929643-65a1-497c-9e1e-cd40f6e5e8a4
4
public static ArrayList<bConsulta> getListaProdData(String dt1, String arg_gmp) throws SQLException, ClassNotFoundException { ArrayList<bConsulta> sts = new ArrayList<bConsulta>(); Connection conPol = conMgr.getConnection("PD"); if (conPol == null) { throw new SQLException("Numero Ma...
9f2437fd-bd71-44b3-a1d4-80bf2bdce2a5
9
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbSecAppByUJEEMountIdxKey ) { GenKbSecAppByUJEEMountIdxKey rhs = (GenKbSecAppByUJEEMountIdxKey)obj; if( getRequiredClusterId() < rhs.getRequiredClusterId() ) { return( -1 ); } else if( getRequired...
dbb9aab7-56ba-4de1-a27f-4eab2fe8679b
7
public void cutSelection() { if (selected) { copySelection(); if (wave.length() - (selectEnd - selectStart + 1) <= 0) { wave = null; selectNone(); observer.waveCanvasEvent (this, NULL); } else { double[] s = wave.getWave(); double[] d = new double [wave.length() - (select...
3549680b-d64a-4f79-bbdf-cd70cb240e66
8
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (this.averageGroundLevel < 0) { this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); if (this.averageGroundLevel < 0...
60844a2a-0f30-461c-bafc-0ec28e66c69f
2
private int pickGene() { double selector = Math.abs(random.nextDouble())%fitnessSum;//random number between 0 and fitnessSum int j = 0; double count = fitnesses[j]; while(count < selector && j<fitnesses.length-1){ count += fitnesses[++j]; } return j; }
20833b95-64e2-417d-b5eb-e9dbc5b42aeb
2
@Override public Combinaison obtenirCombinaison() { Pion[] pions = new Pion[Mastermind.NOMBRE_DE_PIONS_A_DECOUVRIR_PAR_DEFAUT] ; while(!(this.combinaisonValidee)) { System.out.println("Veuillez validé la combinaison"); } for(int numeroPion = 0 ; numeroPion < Mastermind.NOMBRE_DE_PIONS_A_DECOUVRIR_P...
9ebdfa66-b9e3-474b-a15d-2842c2d217d8
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CToJavaMessage other = (CToJavaMessage) obj; if (this.Z != other.Z) { return false; }...
87a07274-d969-4211-af88-81fad419957e
5
public Record parseDiscogRelease(int id) throws IOException { URL url = new URL(base.replace("ID", "" + id)); try { // System.err.println(url); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.addRequestProperty("Accept-Encoding", "gzip"); uc.a...
026ab94d-0251-4f77-be60-515f2b444170
1
public boolean isLambdaTransition(Transition transition) { MealyTransition t = (MealyTransition) transition; if(t.getLabel().equals(LAMBDA)) return true; else return false; }
29d23389-208c-4ded-96d5-12dd87a3ced0
2
public void activateDialogs() { if(currentDialogBox == null && dialogQueue.size() > 0) checkDialogs(); }
c425d7f4-6dcf-4001-966a-21983ae0ea87
1
public void start() { Timer timer = new Timer(10, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { long duration = System.currentTimeMillis() - startTime; progress = (double) duration / (double) runTime; if (progress > 1f) { progress = 1f; ((Timer) e.getSource(...
f092a3b0-8e27-407c-92be-53fcbc568a72
9
@Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { if (!(msg instanceof Frame)) { return msg; } else if (msg instanceof HeartBeatFrame) { return ChannelBuffers.wrappedBuffer(new byte[] { '\n' }); } Frame frame = (Frame) msg; // COMMAND Strin...
90dac60a-c6f4-454f-85d2-f67eadeca794
4
public static String removeNonLiteralSpaces(String toRemove) { char[] chars = toRemove.toCharArray(); toRemove = ""; boolean inQuotes = false; for(char c : chars) { if(c == '"') { inQuotes = !inQuotes; } if(!inQuotes) { ...
4326683f-cf32-4191-ae7d-86b4ecd593a3
8
public void liblinear_predict_with_kbestlist(Model model, FeatureNode[] x, KBestList kBestList) throws MaltChainedException { int i; final int nr_class = model.getNrClass(); final double[] dec_values = new double[nr_class]; Linear.predictValues(model, x, dec_values); final int[] labels = model.getLabels(); ...
fd34df52-b57d-4e76-87f6-183ff77eb143
7
public static boolean fileprocess(String downloadpath, String filepath, String sn){ int errorcode=0;// print error code in the final output file; int errornum = 3; String result="PASS"; File downloadfile = new File(downloadpath+"\\factory_image_version.txt"); File outputfile = new File(filepath); ...
633ba2be-a6b9-4efc-9b8d-a03b33378736
2
public void dump() { log.debug( "Dumping out PackageManager structure" ); Enumeration pts = this.getPackageTypes(); while ( pts.hasMoreElements() ) { //get the current package and print it. PackageType current = (PackageType) pts.nextElement(); ...
0d78f7a9-4865-45ad-9909-51f01cb9b643
8
public void inicializar(int i,final Player enemy) { this.enemy=enemy; this.posicionesMapa = new JLabel[mNumeroDeFilas][mNumeroDeColumnas]; for( int columna = 0 ; columna < this.mNumeroDeFilas ; columna ++ ) { for( int fila = 0 ; fila < this.mNumeroDeColumnas ; fila ++ ) { ...
8c531a82-2b47-4da3-9b50-e31e3de1738d
3
public ArrayList<Test>parse(String testFile){ try{ String path = getClass().getResource ("/" + testFile).getFile(); InputStream is = getClass().getResourceAsStream("/" + testFile); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is)); ...
9e270e99-6716-4fd5-bc85-a46ef8c08ed0
2
public void createWeapon(Node node) { Node n = node.getFirstChild(); while(n != null) { if(n.getNodeType() == Node.ELEMENT_NODE) { selectWeapon(n.getNodeName()); weapon.createFromXML(n.getChildNodes()); } n = n.getNextSibling()...
6c0cb347-9f17-4d29-8cf9-83f2beb51976
3
private static void sobelFile(String filename, int numIterations, boolean rle) { System.out.println("Reading image file " + filename); PixImage image = ImageUtils.readTIFFPix(filename); PixImage blurred = image; if (numIterations > 0) { System.out.println("Blurring image file."); blurred = image.boxBl...
20a72985-4ca7-4edc-8541-5150b50821fa
3
@Override public void startTrade() { if(presenter.isPlayersTurn()) { getTradeOverlay().setStateMessage("set the trade you want to make"); getTradeOverlay().setResourceSelectionEnabled(true); getTradeOverlay().setPlayerSelectionEnabled(false); getTradeOverlay().setTradeEnabled(false); Player player =...
73b18d5c-b6b1-4409-b6b5-fcc69596288b
6
public void initFromXML( Element node ) { NodeList nList = node.getElementsByTagName("replacespace") ; Element elem = null ; // a settings entry was found if (nList != null) { if (nList.getLength() > 0) { elem = (Element) nList.item(0) ; Boolean bool = new Boolean( ele...
e0dd8b2e-fab2-4f15-b172-6b0bb73ea0e7
1
public static <T> Collection<T> shuffleCopyOfCollection(Collection<T> original) { ArrayList<T> shuffled = new ArrayList<> (); ArrayList<T> originalCopy = new ArrayList<> (original); while ( !originalCopy.isEmpty ()) { int next = Randomiser.randIntBetween (0, originalCopy.size ()); shuffled.add (original...
d9091ec7-8052-4e07-8a84-5b7d69cc2336
3
public void muestraVariable(String archivo) throws FileNotFoundException, IOException { File var = new File(archivo); RandomAccessFile raf = new RandomAccessFile(archivo, "rw"); String temp = ""; while(raf.length() > raf.getFilePointer()) { ...
19233bb6-65bd-4a04-a89d-02ce9b693f21
3
public synchronized boolean shot(Position position){ if ((position.getX() <= this.getXLength()) || (position.getY() <= this.getYLength())) return false; if (field[position.getX()][position.getY()] != null) { return field[position.getX()][position.getY()].fired(); } return fal...
0b8f9938-9379-4179-b46a-6e7c38406f0d
6
public void changePosition(Player player, ArrayList <Monster> monsters) { Rectangle newPosition = new Rectangle( position.x + direction.x, position.y + direction.y, WIDTH, HEIGHT); // If I'm hitting a player, tell him and then get set to die if (newPosition.intersects(player.getBox())) { pla...
0153184f-c4cc-41fb-8b48-e37745e829cf
7
public final MapleCharacter killBy(final MapleCharacter killer) { int totalBaseExp = (int) (Math.min(Integer.MAX_VALUE, (getMobExp() * (killer.getLevel() <= 10 ? 1 : killer.getClient().getChannelServer().getExpRate())))); AttackerEntry highest = null; int highdamage = 0; for (final AttackerEntry attackEntry : attac...
4271152e-2b1c-43cd-af1b-05c6c11b0556
5
private void initMovementAndBackground() { maxXMovement = level.getWidth() * level.getTileSize() - GamePanel.WIDTH; maxYMovement = level.getHeight() * level.getTileSize() - GamePanel.HEIGHT; xMovement = player.getxPos() - (GamePanel.WIDTH / 2); yMovement = player.getxPos() - (GamePanel.HEIGHT / 2); if (xMovem...
6cab5007-7b93-4043-97d2-f073aaa0cc3b
3
public void count(Pet pet){ for(java.util.Map.Entry<Class<? extends Pet>, Integer> pair: this.entrySet()) if(pair.getKey().isInstance(pet)) put(pair.getKey(),pair.getValue() + 1); }
a8c3edee-cd2a-476c-9b8a-91e23cb5ee72
5
@Override public ResultSet query(String query) { Statement statement = null; ResultSet result = null; try { connection = this.open(); statement = connection.createStatement(); switch (this.getStatement(query)) { case SELECT: result = statement.executeQuery(query); return result; ...
cf8e7f3d-3b1f-490d-aee1-0146e549b20a
3
public String RGBtoHEX(int r, int g, int b) { final int MIN_LENGTH = 2; String red = Integer.toHexString(r); //String.format("%02", red); if (red.length() < MIN_LENGTH) { red = "0" + red; } String green = Integer.toHexString(g); //String.format("%02", green); if (green.length() < MIN_LENGTH) { gre...
570b321c-9aee-4538-ae20-910f888618ea
6
public void conecta() throws SerialPortTimeoutException{ String mac = red.obtenerDireccionMac(); String fecha = f.obtenerFecha(); SerialPort serialPort = new SerialPort("/dev/ttyACM0"); int temp = 1; try { System.out.println("Port opened: " + serialPort.openPort()); ...
f1ff9616-cbc4-4295-85fc-c62f1a53fc1f
2
public static void makeRandomDouble(Matrix matrix) throws MatrixIndexOutOfBoundsException { int rows = matrix.getRowsCount(); int cols = matrix.getColsCount(); double temp = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { // fill with ran...
6838cba1-45dc-49e8-b829-20dc56cafead
7
public TreeElement fillTree(String expression) throws WrongStructure, IncorrectSymbol, ImpossibleAction{ if (isComponent(expression.charAt(counter))) { counterUp(); TreeElement currentOperation = new Operation(expression.charAt(counter)); counterUp(); if (isCompon...
b113761e-b962-4d6a-9cf2-f115be779cf4
3
public static String deviceIdToMac(String deviceId) { if (deviceId.length() != 20) { return ""; } String macStr = deviceId.substring(8, 20); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 12; i++) { sb.append(macStr.charAt(i)); if (i % 2 == 1) { sb.append(":"); } } sb.deleteCh...
93a35973-f02f-46ac-8b8a-1a9ede0b474a
4
public static int sample(double[] probs, int T) { // roulette sampling double []pt = new double[T]; //System.out.print(p[0]); pt[0] = probs[0]; for (int i = 1; i < T; i++) { pt[i] = probs[i] + pt[i-1]; // System.out.print(" " + pt[i]); } // System.out.println(); // scaled sample because of unnor...
45d10546-6eee-4e20-b6ba-32beeddff571
6
private void anchorNode(Node node) { if (this.anchors.containsKey(node)) { String anchor = this.anchors.get(node); if (null == anchor) { anchor = generateAnchor(); this.anchors.put(node, anchor); } } else { this.anchors.put(...
74f02849-2202-4dca-a180-6678e33e721f
8
public void command(CommandSender sender, Player player, String[] cmd){ // // GETS THE STRING TO REFER TO TO GET THE COMMAND // if(cmd[0].equalsIgnoreCase("add")){ // CHECKS IF THE PLAYER IS ALREADY IN THE PROCESS OF ADDING A COMMAND i...
9959f49d-9938-47d1-a93b-96cfa5840ec3
7
protected final int shiftKeys(int pos) { // Shift entries with the same hash. int last, slot; for (;;) { pos = ((last = pos) + 1) & mask; while (used[pos]) { slot = (it.unimi.dsi.fastutil.HashCommon .murmurHash3((key[pos]))) & mask; if (last <= pos ? last >= slot || slot > pos : last >= slot ...
2cece50d-bc88-40bd-80ce-973c90c88d2c
4
private String cipher_digraph(String pl,HashMap<Character,Pair<Integer> > h1, HashMap<Character,Pair<Integer>> h2, HashMap<Character,Pair<Integer>> h3) { assert(pl.length()==2); StringBuilder sb=new StringBuilder(); char c1=pl.charAt(0); char c2=pl.charAt(1); if(c1=='J') { c1='I'; } if...
38b2784c-3e6a-4bd7-bcc7-f37afbd8703e
4
protected synchronized void processEvent(Sim_event ev) { switch ( ev.get_tag() ) { case GridSimTags.PKT_FORWARD: case GridSimTags.JUNK_PKT: processNetPacket(ev, ev.get_tag()); break; case GridSimTags.ROUTER_AD: rece...
f83e71a2-5e0b-40aa-b349-0ea10549b884
9
protected boolean isIOLogic(PrimitiveType type) { return ((type == PrimitiveType.ILOGIC) || (type == PrimitiveType.ILOGIC2) || (type == PrimitiveType.ILOGICE1) || (type == PrimitiveType.ILOGICE2) || (type == PrimitiveType.ILOGICE3) || (type == PrimitiveType.OLOGIC) || (type == PrimitiveType.OL...
19087d13-2f6d-4063-8fb4-c9cd75d4e18c
0
@Override protected EntityManager getEntityManager() { return em; }
c4040e29-7571-4da1-8b34-297993d75355
0
public void incrementInvalidRxCount() { invalidRxPackets++; setChanged(); notifyObservers(); }
cce5a9ae-0bf9-4a66-878a-88a3110313c0
7
private void sarsa(int reward, Weights weights, double x_i[], double[] x_ip1) { // Set some local variables. double[] w = weights.getWeights(); double wx = 0.0f; double sig = 0.0f; // Compute y_i. double wxp1 = 0.0f; for (int j = 0; j < FeatureExplorer.getNumFeatures(); j++) wxp1 += w[j] * x_ip1[j]; d...
e9a1a331-9dca-4fc9-b668-06d05dcfa277
9
public P2PManager() { addListener(new ActionListener() { @Override protected TaskAction getListenAction() { return TaskAction.FETCHUSER_PROCESS; } @Override protected void onAction(HashMap<String, String> params) { if(p...
23970416-c0d6-4d2a-b398-f242d8e3428c
3
private void evalCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_evalCancelButtonActionPerformed if (isRunning == true) { try { interactor.cancelLastCommand(); } catch (Exception e) { } setGUIToIdleMode(); } else { setGUIToRunningMode(); new Thread() { ...
6eb0ce5f-62eb-4f31-83db-659d0581dea8
2
public String getValue(int place) { ListElement current = head; if (place <= count) { for (int i = 1; i < place; i++) { current = current.next(); } return current.getValue(); } else { return "error"; } }
ecb3752e-0a46-4a04-8453-24dd8b1daa53
2
@Test public void executeScenario() throws UnknownHostException { logger_.info("[Repair Scenario 5 Start] Peer on \"1\" repairs subtree on \"0\""); Injector injector = ScenarioSharedState.getInjector(); localPeerContextInit(injector); LocalPeerContext context = injector.getInstance(...
d4495765-f6dc-4a2a-a2f4-ca5c4a1ab230
8
private void goalieBehaviour(){ final int REACTION_DISTANCE = 20; final int HOME_DISTANCE = 5; //the first state has the goalie wait in goal but constantly look for the ball if(playerState == 0){ turnTowardBall(); //the goalie state changes when the ball moves to...
481993d1-49af-4d29-95c0-7241cef9c750
4
public static void initconfigration() { if(driver == null){ if(Constants.browser.equals("firefox")){ driver = new FirefoxDriver(); } else if(Constants.browser.equals("ie")){ System.setProperty("webdriver.ie.driver", "IEDriverServer.exe"); driver = new Inter...
7f5869f1-b440-4f44-8562-c08acbe89192
3
public void run() { if (player.getLocation().getBlockX() != pX || player.getLocation().getBlockY() != pY || player.getLocation().getBlockZ() != pZ) { plugin.sendMessage(player,GRAY+F("recallingToLifestone", GREEN + Config.recallDelay + GRAY)); //plugin.sendMessage(player, GRAY+L("movedTooFarAttunementFailed"...
327d45a7-59e1-430d-805b-80a00cb7298b
1
public static void skip10Lines(){ int count=0; if(count<10) skip10Lines(); }
f11345f1-f382-42ed-82f7-2801df7fc312
0
private Set<Card> threeFoursWithFlush() { return convertToCardSet("3D,6D,2D,4S,4D,4C,9D"); }
01610aba-6f75-4d21-bfed-29912d5c83ea
1
public static LookManager getInstance(){ if(instance == null){ instance = new LookManager(); } return instance; }
6e656494-7bb3-410e-acc6-6131371c47de
8
public Set<Map.Entry<Float,Double>> entrySet() { return new AbstractSet<Map.Entry<Float,Double>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TFloatDoubleMapDecorator.this.isEmpty(); } ...
c1828e93-67f1-47a7-a3f5-618ef7992313
6
public String build(Request request, HttpClient client) throws Exception { String query = DDG_API_URL + "q=" + this.escape(request.getQuery()); if (request.isStandard()) { query += ARG_STD; } else { query +=(request.isNoHtml()) ? AMP + ARG_NO_HTML : ""; //query += AMP + ((request.isNoRedirect()) ? ...
4f0f846b-94f3-4a4f-b2d4-0a848111ea34
5
@Override public void validate() { if (platform == null) { addActionError("Please Select Platorm"); } if (location == null) { addActionError("Please Select Location"); } if (iphone.equals("Please select")) { addActionError("Please Sele...
79508424-f00e-4e6b-aa0d-d68fa0011651
1
public static MapLoader getInstance(){ if(instance == null){ instance = new MapLoader(); } return instance; }
ad78cceb-7b49-4797-b0a2-913bcfc1c35e
2
public static void main(String[] args) { int[] dims = new int[]{4,40,20}; Object array = Array.newInstance(Integer.TYPE, dims); Class<?> classType = array.getClass().getComponentType(); System.out.println(classType); Object arrayObj = Array.get(array, 2); Class<?> cla...
1ba6cf83-52cf-4173-9d8f-2fcb3069c98e
9
public Document braceMatch(String pennTree) throws ParserConfigurationException { ArrayList<Integer> contentTree = new ArrayList<Integer>(); ArrayList<Element> nodes = new ArrayList<Element>(); DocumentBuilderFactory domFactory = DocumentBuilderFactory .newInstance(); domFactory.setNamespaceAware(true); ...
5a19a46e-b427-45ec-b6cc-c6df87349f05
7
public static Double transmittance(Double transmittance, Double molarAbsorbtivity, Double cuvetteWidth, Double concentration) { boolean[] nulls = new boolean[4]; nulls[0] = (transmittance == null); nulls[1] = (molarAbsorbtivity == null); nulls[2] = (cuvetteWidth == null); nulls[3] = (concentration == null); ...
23fff024-f6f7-4382-9d67-d04a88e6793c
6
public static UUID mint(int ver, String node, String ns) throws UUIDException, Exception { /* Create a new UUID based on provided data. */ switch (ver) { case 0: case 1: throw new UUIDException("Unimplemented"); // return new UUID(mintTime(node)); case 2: // Version 2 is not supported throw new...
bb03910f-2913-4f20-8bc2-43f3f524225e
5
public static boolean addStation(ObjectOutputStream toServer, ObjectInputStream fromServer, Scanner scanner) throws IOException, ClassNotFoundException { log.debug("Start \"addStation\" method"); List<String> listAllStation = PassengerHomePageHelper.listStations(toServer, fromServer); String sta...
5d50bf53-aea0-4ed4-b7e5-b541e692d374
8
protected void parseEndTag() { // 1. read name (skipping the </ part) int i; for (i = position + 2; i < text.length(); i++) { char c = text.charAt(i); if (Character.isSpaceChar(c) || c == '>') { break; } } String tagName = text.substring(position + 2, i).toLowerCase(); ...
940a812d-388c-45d9-ae74-c6985d398e84
6
void creatingGui() { m_window = new JFrame("Othello"); m_window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); m_window.setLayout(new GridBagLayout()); m_window.getContentPane().setBackground(Color.GREEN); GridBagConstraints c = new GridBagConstraints(); m_window.setIconImage(new ImageIcon(this.getCl...
de7dc2b3-fbb7-4c99-a64c-ecb0e2f3caeb
7
public SmashServer(SmashGame gamer, Map map){ this.game=gamer; game.init(map, this); instance = this; try { setServer(new ServerSocket(328)); } catch (IOException e) { e.printStackTrace(); } new Thread(new Runnable(){ @Override public void run() { while(getMAX_PLAYERS()==10) try { ...
1c8a72c2-242e-468a-aa09-230b2b195e03
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperty") public JAXBElement<SignaturePropertyType> createSignatureProperty(SignaturePropertyType value) { return new JAXBElement<SignaturePropertyType>(_SignatureProperty_QNAME, SignaturePropertyType.class, null, value); ...
1c9ce9f3-e3e6-4cf5-85cf-7dbd418bb1ad
2
private static String DataToStiring(classifiedData Data){ String out = ""; //Add Cedd data int i = 0; for(i = 0; i < Data.getCEDDData().length; i++){ out = out + Data.getCEDDData()[i] + ","; } // System.out.println("CEDD data added for image " + Data.getImgName() + " is: " + i); //Add FCTH dat...
bb40c6de-b27e-4718-a0c9-d4f416e1c28e
7
private String showToUser(ArrayList<TaskData> taskToShow) { String text = ""; SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); SimpleDateFormat f = new SimpleDateFormat("EEE, d MMM yyyy HH:mm"); int i = 1; for (TaskData t : taskToShow) { text += i + ": "; text += t.getContent(); ...