method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e6b97fba-0674-4a79-a3a6-7d2d5929e9cb | 4 | @Override
public void keyPressed(KeyEvent e)
{
// 37 venstre
// 39 højre
// 38 op
// 40 ned
if(e.getKeyCode() == 37 || e.getKeyCode() == 38) // positive
ClientApp.getClientApp().movePlayerPositive();
if(e.getKeyCode() == 39 || e.getKeyCode() == 40) // negative
ClientApp.getClientApp().movePlayerNega... |
2f4751bf-0e41-4817-8e98-40e1046fbd26 | 1 | @Override
public void onEvent(Event event) {
// If this event happens to be a ScannedRobotEvent...
if (event instanceof ScannedRobotEvent) {
onScannedRobot((ScannedRobotEvent) event);
}
} |
8a72c30c-c645-4fc4-a413-e026fe5f883a | 9 | public int buscaBinaria (String fragmento) {
Node<Contact> nodo = this.sortList.getHead();
List<Contact> lista = new ArrayList<Contact>();
Contact encontrou = null;
int comparacoes = 0;
while (nodo != null) {
lista.add(nodo.getData());
nodo = nodo... |
8a89f26a-c394-494e-9966-2e276ec1fb17 | 3 | public Object get_swizzler(final int vn) {
final Iterator iter = IndStore.values().iterator();
while (iter.hasNext()) {
final Swizzler swz = (Swizzler) iter.next();
if ((swz.target().valueNumber() == vn)
|| (swz.ind_var().valueNumber() == vn)) {
return swz;
}
}
return null;
} |
0f12ca33-c149-4d08-893b-61f0ba1ba460 | 9 | public static void main(String[] args) {
int ran=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el rango del vector"));
int[] arreglo=new int[ran];
for (int i = 0; i < arreglo.length; i++) {
int numero=Integer.parseInt(JOptionPane.showInputDialog(... |
167974cb-c142-4dc0-9ee4-08982ce8f0ba | 7 | public boolean isValid() {
boolean okay = true;
// System.out.println("Horizontal? : " + horizontal);
int checkIter = shipSize;
if (shipSize == 1) {
checkIter = 3;
}
// System.out.println("checkIter: " + checkIter);
if (horizontal == false) {
int yCoor = ship.getY();
// System.out.println("Chec... |
f36772bf-7053-45d8-9476-2762aa254e95 | 2 | public boolean filter(Reaction R, int option, int arg ){
boolean result = false;
switch(option){
case 0:
if(R.getCount() > arg){
result = true;
}
break;
}
return result;
} |
2daed0a0-6f5a-455d-a022-1941eb5e0274 | 0 | public void setInterpolatorModel(InterpolatorModel interpolatorModel) {
this.interpolatorModel = interpolatorModel;
} |
7ce1f432-f7dd-48d2-aa64-d845d65141df | 7 | private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... |
c7958331-dd4d-4472-9112-8494b8800f7c | 0 | public double getMarkerWidth()
{
return markerRect.getWidthCoordinates();
} |
2fbbf6e5-6638-4518-b779-21529d906ad5 | 6 | public void setState(State s) {
switch (s) {
case COVERED:
setIcon(Icon.COVERED.image);
break;
case FLAGGED:
setIcon(Icon.FLAG.image);
break;
case QUESTIONED:
setIcon(Icon.QUESTION.image);
... |
0ec8f4f4-c711-435b-9fc7-c58f6e740f52 | 9 | public static List<Class<?>> getAllInterfaces(Class<?> c)
{
ArrayList<Class<?>> res = new ArrayList<Class<?>>();
if (c != null)
{
if (c.isInterface())
{
res.add(c);
}
Class<?>[] interfaces = c.getInterfaces();
for (Class<?> intf : interfaces)
{
res.addAll(getAllInterfaces(intf));
}
... |
96acaab9-fac7-43d3-a9fd-1b9d665f2855 | 3 | public void drawRoute(Graphics g) {
Graphics2D routeUI = (Graphics2D) g;
//routeUI.setBackground(Color.WHITE);
boolean first = true;
int counter = 0;
int test = r.size()-1;
for (Knooppunt eenKnooppunt : this.r) {
if (first == true) {
routeUI.... |
963b0136-50dc-49dc-955d-2963756258f9 | 3 | public void disconnected(Connection con){
if(client_connected && con.getID() == conID){
//start broadcasting
if(bcast_enabled){
bcast = new Broadcaster();
new Thread(bcast).start();
}
client_ip = "---.---.---.---";
client_connected = false;
conID = 0;
changedStatus();
c... |
627b20d5-89e8-4dc9-a460-3660dba33ba4 | 6 | private void copyRGBtoABGR(ByteBuffer buffer, byte[] curLine) {
if(transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for(int i = 1, n = curLine.length; i < n; i ... |
1db20700-cb18-4b05-8bc0-d4bc6bf82f02 | 6 | public String print() {
switch(type) {
case REGISTER:
case VREGISTER:
return value_register.name();
case IMMEDIATE4:
case IMMEDIATE8:
return "" + value_immediate;
case LABEL:
return value_label;
... |
8d1f8112-d9e3-49be-abdc-72e3d2b49c60 | 0 | public String getTitel() {
return titel;
} |
1e9a5d8d-ab53-46ac-8885-e4ccf8ac1f5b | 8 | @Override
public void run() {
DisconnectCause disconnectCause = DisconnectCause.OTHER;
try {
while (true) {
Object msg = null;
try {
msg = queue.take();... |
68fd5c55-15ec-4672-96ec-02a781d0c87b | 0 | public void setDisciplina(String sigla, String designacao, Tempo horasteoricas, Tempo horaspraticas) {
setSigla(sigla);
setDesignacao(designacao);
setHorasteoricas(horasteoricas);
setHoraspraticas(horaspraticas);
} |
3a040889-e9ec-41ff-8bc1-7f7ddb220db7 | 3 | private HashSet<String> getStopwords(HashSet<String> stopHash, String file){
try{
FileReader fReader = new FileReader(file);
BufferedReader bReader = new BufferedReader(fReader);
String line = null;
while((line = bReader.readLine().trim()) == null){
if(stopHash.contains(line)){
continue;
}
... |
0873d84a-6dd2-4b1d-bc14-bf47befe25a6 | 4 | public boolean go(String loginUser, String loginPass)
{
try {
st = con.createStatement();
prepState = con.prepareStatement("SELECT * FROM register WHERE Username = ? AND Password = ?");
prepState.setString(1,loginUser);
prepState.setString(2,loginPass);
ResultSet rs = prepState.executeQuery();
... |
f5deb618-ae39-4689-93dd-9752f8d20750 | 2 | public void addLload(int n) {
if (n < 4)
addOpcode(30 + n); // lload_<n>
else if (n < 0x100) {
addOpcode(LLOAD); // lload
add(n);
}
else {
addOpcode(WIDE);
addOpcode(LLOAD);
addIndex(n);
}
... |
aaa946d5-aded-4fd4-bdc5-9c1d96e89b87 | 3 | public void addPattern(String pattern) {
for (int i = 0; i < pattern.length(); i++) {
if (pattern.charAt(i) == '*') {
restarts.add(true);
} else if (pattern.charAt(i) == '.') {
restarts.add(false);
}
}
} |
c2dc4220-9958-42ed-85d6-921cdac10d1f | 6 | @EventHandler
public void SnowmanSlow(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.getsnowgolemConfig().getDouble("Snowman.Slow.... |
0a1cf78b-bbe4-4240-b41d-a68fe9e582fb | 3 | public static void town(Character character, Scanner console) throws FileNotFoundException{
System.out.print("Where would you like to go? Shop, Inn, or Quest: ");
String location = console.nextLine();
if(location.toLowerCase().equals("shop")) {
shop(character, console);
} else if(location.toLowerCase().equal... |
3eca206f-dd9b-4779-b311-5e140f4c7482 | 8 | public ModelAndView PostURIParser(HttpServletRequest request, HttpServletResponse response)
{
String URI = request.getRequestURI();
ModelAndView MAV = null;
Matcher match = this.P.matcher(URI);//threads
Matcher match2 = this.P2.matcher(URI);//create
Matcher match3 = this.P3.m... |
b086ae6e-f70b-43f1-a4df-fe71e539ed34 | 7 | public void setup(boolean isCallDuringRun) throws Exception {
System.out.println("Simulation setup started");
Vector<Installation> insts = setupScenario();
if (insts == null)
throw new Exception("No installations defined for the current scenario.");
if (simulationWorld == null)
throw new Exception... |
5710cdb3-0c22-40c1-8cf5-5f1f217beb08 | 6 | private void refresh(){
if (win){
bg = draw;
draw.setColor (Color.BLACK);
draw.fill();
draw.setFont (new Font ("Times New Roman", 1, 70));
draw.setColor (Color.WHITE);
draw.drawString ("Congratulations", 270, 200);
... |
164296a6-742a-431e-8a32-640afc46f190 | 3 | public void doGet(HttpServletRequest request, HttpServletResponse response) {
logger.finest("get request: " + request.toString());
/**
* Sanity checking -- does this request have a key?
*/
if (request.getParameter(CommunityConstants.BASE64_PUBLIC_KEY) == null) {
logger.warning("GET request with no key... |
77c47095-11d1-478f-9e7f-c4506dedd957 | 3 | @Override
public void doCharacterCollision(ArrayList<Collision> collisions, StageObject stageObject) {
if (stageObject instanceof Tube || stageObject instanceof Enemy || stageObject instanceof Cube) {
setAlive(false);
}
} |
e4febd7d-431b-4651-9a3b-972c349d8c6d | 0 | public int getDepartment() {
return department;
} |
b984d903-11d1-48f3-b991-12644595771e | 0 | @Test
public void addingEdgeBetweenVerticesOnlyAddsOneEdge() {
Vertex a = new Vertex(0);
Vertex b = new Vertex(1);
Edge e = new Edge(a, b);
g.addVertex(a);
g.addVertex(b);
g.addEdge(a, b, 1);
assertEquals(1, g.getEdges().getSize());
} |
1651d3e4-d49e-4a5f-9df3-a3df32df8fb4 | 0 | @SuppressWarnings("rawtypes")
public Validator getValidator() {
return validator;
} |
e4e1f699-e484-4563-a15c-7135a2793741 | 3 | private void parseStyleSheets() {
if (config.has("stylesheets"))
{
for(JsonElement el: config.get("stylesheets").getAsJsonArray()) {
try {
styleSheets.add(new URL(base, el.getAsString()).toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
} |
76166903-3e5c-4d7e-9bd3-b32df65377f9 | 5 | @Override
public void keyTyped(final KeyEvent event) {
if (event.getSource().equals(myName)) {
myNameChanged = true;
}
if (event.getSource().equals(tfAddress)) {
tfAddressChanged = true;
}
if (event.getSource().equals(tfPort)) {
tfPortChanged = true;
}
if (myNameChanged && !connected) {
bCo... |
c756aa99-390e-44c7-b61f-ecd6918074c6 | 9 | public void initClinicalsSurvival(){
//have a "load (String/Double) Column" method?
allPatients = new String[this.clinicalValues.size()];
for (int k=0; k<this.clinicalValues.size(); k++){
allPatients[k]=this.clinicalValues.get(k)[0];
}
status = new boolean[this.clinicalValues.size()];
for (int k=0; k... |
452e466c-c1f4-4889-9d73-b6bf10341818 | 7 | public void saveData() {
log.debug("Saving ControllerBlock data");
String dump = "# v4";
for (Iterator<CBlock> i = blocks.iterator(); i.hasNext(); ) {
CBlock cblock = i.next();
dump += "\n" + cblock.serialize();
}
try {
Writer out = new OutputStreamWriter(new FileOutputStream(this.getDataFolder() + "... |
1131b462-db18-47a2-b16f-c1aab51f6067 | 4 | public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... |
b934c82f-9857-4199-8acf-7ec12fa7f8ac | 1 | public void analyze() {
String type = getType();
int index = type.indexOf('L');
if (index != -1) {
int end = type.indexOf(';', index);
Main.getClassBundle().reachableClass(
type.substring(index + 1, end).replace('/', '.'));
}
} |
c4afc889-e680-4944-834b-088fb73d596e | 4 | private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalculateActionPerformed
// TODO add your handling code here:
//Declare variables
double length = 0;
double width = 0;
double height = 0;
double radius = 0;
doubl... |
4464f7cf-6f2b-4339-b6e0-6a20de188fdd | 4 | public int cdlEveningStarLookback( double optInPenetration )
{
if( optInPenetration == (-4e+37) )
optInPenetration = 3.000000e-1;
else if( (optInPenetration < 0.000000e+0) || (optInPenetration > 3.000000e+37) )
return -1;
return ((( (this.candleSettings[CandleSettingType.BodyShort... |
36115cc2-1901-40d8-8fdd-f1660450eed4 | 2 | public static void main(String args[]) {
Counter counter = new Counter();
for (int i = 0; i < 100; i++) {
Increaser increaserTask = new Increaser(counter);
Thread t = new Thread(increaserTask);
t.start();
synchronized(t){
try{
... |
2e8c6d37-f970-45af-b294-a26a9c37a2c8 | 5 | public void loadPokemonImages()
{
for (int i = 0; i < 6; i++)
{
if (partyPokemon[i] != null)
{
String pokemonType = partyPokemon[i].species.toString();
char a;
if(pokemonType.equalsIgnoreCase("Mr_Mime"))
pokemonType="Mr_Mime";
else if(pokemonType.equalsIgnoreCase("Nidoran_M"))
... |
d22e8c0c-e10f-4bf4-85ac-a3e5dd8ecbaf | 3 | public boolean exists(String value) {
if (!isEmpty()) {
ListElement current = head;
while (current != tail.next()) {
if (current.getValue().equals(value)) {
return true;
}
current = current.next();
}
... |
cc5fce75-dd9f-493f-8e3a-c9616546e58e | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Encaminhamento other = (Encaminhamento) obj;
if (!Objects.equals(this.idEncaminhamento, other.idEncaminha... |
48aebc79-6abf-4b7b-9ab7-332cc6663960 | 4 | private void runTasks() {
final Iterator<BlockData> it = blockUpdates.iterator();
final BukkitRunnable t = this;
while(it.hasNext()) {
new BukkitRunnable() {
public void run() {
synchronized(t) {
for(int i = 0; i < 4096; ++i... |
b64aed7d-f2cd-41fd-909f-e1b19497c5f3 | 1 | public void testPlus_int() {
Hours test2 = Hours.hours(2);
Hours result = test2.plus(3);
assertEquals(2, test2.getHours());
assertEquals(5, result.getHours());
assertEquals(1, Hours.ONE.plus(0).getHours());
try {
Hours.MAX_VALUE.plus(1);
... |
7a26d861-798f-448d-a916-6516f0984482 | 2 | public String toString()
{
String s = new String();
s += V() + " vertices " + E() + " edges\n";
for (int v = 0; v < V(); v++)
{
s += v + ": ";
for (WeightedDirectedEdge e : adj[v])
s += e + ", ";
s += "\n";
}
return s;
} |
49353229-114a-482f-859c-db0a58be3471 | 6 | private void initData() {
if (DataFlowControler.getCurrentEvent().getArrangement() != null) {
HallArrangement hallarr;
if(DataFlowControler.getCurrentEvent().getArrangement().getBannersType() != null) {
styles.setSelectedItem(DataFlowControler.getCurrentEvent().getArrangement().getType());
ArrayList<St... |
54572604-5dd1-4708-8dec-f3d12305574c | 4 | boolean bounding_box_collision(int b1_x, int b1_y, int b1_w, int b1_h, int b2_x, int b2_y, int b2_w, int b2_h)
{
if ((b1_x > b2_x + b2_w - 1) || // is b1 on the right side of b2?
(b1_y > b2_y + b2_h - 1) || // is b1 under b2?
(b2_x > b1_x + b1_w - 1) || // is b2 on the right side of b1?
... |
18b3b1e8-b2b4-4c51-b567-8eb6cf2efc1f | 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... |
304e1328-9a39-4c0e-ae77-f7bc5d0761b4 | 0 | public MealyStepByStateSimulator(Automaton automaton)
{
super(automaton);
} |
25ab12b2-0f35-4eb2-933f-f56751b476fd | 9 | public static double chiVal(double [][] matrix, boolean useYates) {
int df, nrows, ncols, row, col;
double[] rtotal, ctotal;
double expect = 0, chival = 0, n = 0;
boolean yates = true;
nrows = matrix.length;
ncols = matrix[0].length;
rtotal = new double [nrows];
ctotal = new do... |
634553b3-5d11-4f26-8471-008b2a5b1a94 | 5 | private void actualizarTabla()
{
actualizarPagina();
List<Sesion> list = new HibernateTransaction<List<Sesion>>() {
@Override
public List<Sesion> run()
{
Criteria query = session.createCriteria(Sesion.class)
... |
bc4649fe-e06c-4765-bb7c-aa809c91ebc8 | 0 | private void doInit() throws Exception {
//..
//..here may be execute remoteServerCall.setMaxCallCount(???);
//..
remoteServerCall.setIdleTimeout(idleTimeout);
remoteServerCall.init();
remoteServerCall.addServerExceptionListener(new IExceptionListener() {
@Override
public boole... |
a5e8db30-9e4b-4f8a-9414-081cf42705cf | 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 &&
... |
9a4978df-a0b9-484f-a05f-5f62e50b561b | 1 | @Override
public int hashCounter(String line, int hashLength) {
int currentHash = line.charAt(0);
for (int i = 1; i < line.length(); i++) {
currentHash = currentHash * simpleNumber + line.charAt(i);
}
return Math.abs(currentHash % hashLength);
} |
4574ce46-67c5-4f19-8bbd-8185bc8daf9d | 4 | public static byte[] mapleEncrypt(byte[] data) {
for (int j = 0; j < 6; j++) {
byte remember = 0;
byte dataLength = (byte) (data.length & 0xFF);
if (j % 2 == 0) {
for (int i = 0; i < data.length; i++) {
byte cur = data[i];
cur = ByteTool.rollLeft(cur, 3);
cur += dataLength;
cur ^= rem... |
467f68d0-b76f-4403-9ae8-81ea155489d1 | 5 | @Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (category != null ? category.hashCode() : 0);
result = 31 * result + (key != null ? key.hashCode() : 0);
result = 31 * result + (value != null ? value.hashCode() : 0);
result... |
e08542f0-7f9d-491a-8797-a66dc52d6074 | 2 | public Membre rechercherMembrePseudo(String pseudo){
for(Membre m : listeMembres){
if(pseudo.trim().equalsIgnoreCase((m.getPseudo())))
return m;
}
return null;
} |
36b70125-f905-4c13-b65d-e78b1be8624c | 5 | @Override
public void draw(Mesh mesh) {
if (mesh.isLoaded()) {
if (mesh.hasShader() && settings.r_useshader)
glUseProgram(mesh.getShader().getShaderProgram());
glCallList(mesh.getId());
if (mesh.hasShader() && settings.r_useshader)
glUseProgram(0);
}
} |
d5081d61-6e15-414a-93c6-40dc58d5a547 | 9 | public static Point addition(Point p, Point q){
Point r = new Point();
BigInteger lambda = BigInteger.ZERO;
if(!(p.getX().equals(q.getX()))){
lambda = (p.getY().subtract(q.getY()).mod(Main.ellipticCurve.getP())).multiply((p.getX().subtract(q.getX()).mod(Main.ellipticCurve.getP())).modInverse(Main.elliptic... |
e3e84eb5-a318-4d9b-bde2-7d7a9b99dabe | 5 | public static int randomSlot(int slot,int max,int min){
max = max+1;
if(slot==0){
return (int)(Math.random()*(max-min));
}
int randomMax = (slot*(slot+1))/2;
int rand = (int)(Math.random()*randomMax);
int check = 0;
int i=0;
for(i=1;i<=slot;i++){
check+=i;
if(check>rand){
break;
}
}
... |
be6fc988-3c84-4862-8bbe-1d09b6a9eea1 | 2 | public TreeNode sortedListToBST(ListNode head) {
if(head ==null)
return null;
//convet to a array;
Vector<Integer> v = new Vector<Integer>();
while(head != null){
v.add(head.val);
head = head.next;
}
return buildTree(v ,0, v.size()-1);
... |
5bf640fa-b397-4e11-95ee-fc425e4f64e0 | 9 | @Override
public void actionPerformed(ActionEvent e) {
BmTestManager bmTestManager = BmTestManager.getInstance();
String userKey = bmTestManager.getUserKey();
if (userKey == null || userKey.isEmpty()) {
JMeterUtils.reportErrorToUser("Please enter user key", "No user key");
... |
d9818ec7-cf2f-4300-9025-21b8912a6325 | 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... |
9c4fb097-71db-40e5-b7a2-5aa75aa8427a | 6 | public CE_Frame(String choose) {
this.choose = choose;
/* 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.
* ... |
f00d5527-d861-4bde-ac6d-74a0a7d3ce9e | 2 | public static void writeToFile( String fileName, String content ) {
File file = new File( fileName );
file = new File( file.getParent() );
if ( !file.exists() )
file.mkdirs();
try {
PrintWriter pw = new PrintWriter( fileName );
pw.write( content );
... |
33257b31-546c-4bf4-a7f1-2dc32fe720cb | 4 | public void CommandExecute() throws Exception {
// TODO Remove popups.
try {
_fileOps = new File_Ops(_clientSaveDirectory, _zipSaveDir);
int cmd = _db.GetCommand(_devID);
System.out.println("Command #" + cmd);
switch (cmd) {
case 1:
// Back up
_fileOps.GenerateFileList(new File(_clientSaveDi... |
21940216-9840-4360-9d6c-5d01618c4734 | 3 | private void updatePlatterQuantities(int[] platter, int round) {
for (int i=0; i < platter.length; i++) {
if (round == FIRST) {
platter[i] -= r0_seen_fruit[i];
}
else {
platter[i] -= r1_seen_fruit[i];
}
if (platter[i] < ... |
a25ac912-3708-441c-999a-db0e9a7151a5 | 6 | private List<Class<?>> getAllInterfaceFromClassList(List<Class<?>> classes) {
List<Class<?>> list = new ArrayList<Class<?>>();
for(Class<?> cl: classes){
list.addAll(Arrays.asList(cl.getInterfaces()));
}
return list;
} |
12f4639f-f84d-4cae-879e-bfabea03a3f4 | 7 | @SuppressWarnings("unchecked")
public SumResult<T> extendedDensity(double p) {
T emptyTarget = (T) _bins.first().getTarget().init();
double countDensity;
T targetDensity;
Bin<T> exact = _bins.get(p);
if (p < _minimum || p > _maximum) {
countDensity = 0;
targetDensity = (T) emptyTarget... |
59a53184-12cf-49fc-ad78-f260400fe14b | 9 | public void extractFeatures(InputStream in, String name, Updater updater)
throws Exception {
// Pre-process the recording and extract the samples from the audio
this.updater = updater;
double[] samples = preProcessRecording(in, name);
if(cancel.isCancel()){
throw new ExplicitCancel("Killed after loading d... |
cfff1e86-3ba3-4d99-b282-3b3b89e7603d | 7 | 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... |
d446e535-c313-4c9d-a4c2-f3d3361b86bb | 8 | public void run()
{
while (true)
{
if (++ticket >= setMax)
{
ticket = 1;
}
DSSUpdater.setHighLight(ticket);
if(++ticket == 4 ||ticket == 5 ||ticket == 6 ||ticket == 7 ||ticket == 8 ||ticket == 9)
{
DSSUpdater.setHighPath(ticket);
}
repaint();
... |
5b34fde9-97bd-40f4-9c4d-53b59cadde27 | 5 | public HashMap<String, ArrayList<String>> getCities(String code) throws IOException{
countryCities = new HashMap<String, ArrayList<String>>();
BufferedReader reader = new BufferedReader(new FileReader("src/cities15000.txt"));
String line = null;
String cityName;
String countCode;
while ((line = reader.readL... |
17a39074-39aa-4351-a861-be67a8f2fe17 | 5 | private boolean versionCheck(String title)
{
if (this.type != UpdateType.NO_VERSION_CHECK)
{
if (title.split(delimiter).length == 2)
{
final String localVersion = this.plugin.getDescription().getVersion();
final String remoteVe... |
016e0300-6646-4bc3-a4ed-7b0a6904e286 | 8 | public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
try
{
UserBean prueba= new UserBean();
UserBean user;
String rutForm =request.getParameter("rut");
rutForm.replaceAll("\\.", "");
int rut = Integer.... |
540c35c9-6724-4051-80a9-ab7648d52a40 | 3 | public static void precal() {
int root, child, lim = (1 << 19);
a = new int[lim + 1];
v = new boolean[lim + 1];
lim *= 2;
for (int i = 1; i < a.length; i++) {
root = child = 1;
while (child * 2 < lim) {
child *= 2;
if (v[root])
child++;
v[root] = !v[root];
root = child;
}
a[i]... |
aacdca04-44f6-4058-be6f-193089c106c6 | 2 | public Class<?> getColumnClass(int columnIndex) {
if (temporaryColumnClass != null)
return temporaryColumnClass;
else
return getColumn(columnIndex).getClass();
} |
338402ae-63e0-4d91-acce-ecdbb6fb996d | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Cart)) {
return false;
}
Cart other = (Cart) object;
if ((this.recordid == null && other.recordid != null) || (... |
6cab004d-6a86-4ba3-8b2b-803beeff73df | 6 | public void obliviousSend(int sendTo, BigInteger M_0, BigInteger M_1) {
System.out.println("Oblivious Transfer");
// Hard coded messages M_0 and M_1
BigInteger[] M = new BigInteger[2];
M[0] = M_0;
M[1] = M_1;
if (betray) {
M[1] = M[0];
}
// Hard coded ElGamal
BigInteger p_A ... |
3e5c5d33-805f-450f-9a01-77afa3f2f9c7 | 8 | public void addButtons()
{
b3.setPreferredSize(new Dimension(500,100));
b3.setText(months[monthTracker]);
b3.setBackground(Color.white);
b3.addActionListener(this);
b3.setToolTipText("Month Summary");
int cr=0;
for(int r=0;r<6;r++)
{
for(int l=0;l<7;l++)
{
int k=0;
if(dateDay[dateDayIndex]==1 &&... |
37fab733-616c-4e7e-8caa-c472ec4cd150 | 1 | public void testFactory_fromCalendarFields_null() throws Exception {
try {
LocalDate.fromCalendarFields((Calendar) null);
fail();
} catch (IllegalArgumentException ex) {}
} |
cc028b82-dac5-42da-9864-c25f3b6f3432 | 7 | public static int floodFill(int r, int c) {
int area = 1;
for (int i = 0; i < dir.length; i++)
if (r + dir[i][0] >= 0 && r + dir[i][0] < size
&& c + dir[i][1] >= 0 && c + dir[i][1] < size
&& !used[r + dir[i][0]][c + dir[i][1]]
&& map[r + dir[i][0]][c + dir[i][1]] == 'W') {
used[r + dir[i][0]][... |
1217f150-4ed0-4906-a602-3148c2ecf432 | 0 | @Override
public String getDesc() {
return "MagicCrasher";
} |
04ed60d9-01f5-4f0d-a6e2-98da99b66631 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ManagerOperator frame = new ManagerOperator();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
fe7db8a2-6964-4f99-b175-19cf1892b145 | 2 | private double dotProduct(double[] a, double[] b)
throws ClusterException {
int size = a.length;
if(size != b.length)
throw new ClusterException("Can't compute dot product on different size matrices!");
double result= 0;
for (int i=0; i<size; ++i)
result += (a[i]*b[i]);
return result;
} |
649aeba5-8f31-4714-92b1-d8c4d42c8a68 | 2 | protected Set<String> filterRawInput(String rawInput) {
Set<String> outputList = new HashSet<String>();
List<String> inputList = new RawInputExtractor().extractWordList(rawInput);
for (String s : inputList)
{
if (this.validFoodFilter.isValidFood(s))
{
outputList.add(s);
}
}
return outputList;
... |
eb21f513-5d33-4000-aef5-8d24157bb34e | 2 | public void visit_ret(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 1 > maxLocals) {
maxLocals = index + 1;
}
if (index < 256) {
addOpcode(Opcode.opc_ret);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
addByte(Opcode.opc_ret);
addS... |
da74ffa5-72ae-4d46-921e-b2de9cb90f2f | 7 | public ListNode add(ListNode l1, ListNode l2)
{
ListNode c1 = l1;
ListNode c2 = l2;
ListNode dummy = new ListNode(-1);
ListNode c3 = dummy;
int carry = 0;
while(c1!=null || c2!=null || carry>0)
{
int x = (c1==null?0:c1.val) + (c2==null?0:c2.val) + carry;
ListNode t = new ListNode(x%10);
carr... |
338b7ca1-b518-4b48-9929-9aa785a35fcd | 0 | @Override
public void onApplicationEvent(MyCustomEventApplicationEvent myCustomEventApplicationEvent) {
listener.receive(myCustomEventApplicationEvent.getMyCustomEvent());
} |
2e1a59bc-7013-4d08-bf1b-af256bf7f55f | 6 | private boolean wincheck4() {
for (int column = THREE; column < gv.getColSize(); column++) {
for (int row = 0; row < (gv.getRowSize()-THREE); row++) {
if (cells[row][column].getValue() != 0
&& cells[row][column].getValue() == cells[row + 1][column - 1]
... |
cb4d8e3f-e78b-47e2-a470-43e4d43ff6d2 | 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... |
8519a605-e007-436b-999f-a2895190c9bd | 1 | public static boolean WritePrefix(String hostname, String prefix)
{
Prefixes.add(hostname + " " + prefix);
try
{
BufferedWriter writer = new BufferedWriter(new FileWriter(PrefixesFile, true));
writer.write(hostname + " " + prefix + "\r\n");
writer.close();... |
6f03ac99-7fc9-43d7-8d0e-89a7ab51fdae | 6 | void print(Node t, int n, boolean p)
{
if (p)
{
t.getCar().print(n, true);
if (t.getCdr().isPair() && (t.getCdr().getCdr() != null))
{
System.out.print(" ");
t.getCdr().getCar().print(n, true);
t.getCdr().getCdr().p... |
dc153c63-d055-42a6-aa62-cbf081147d5a | 7 | public static String arrayToString(Object array) {
String result;
int dimensions;
int i;
result = "";
dimensions = getArrayDimensions(array);
if (dimensions == 0) {
result = "null";
} else if (dimensions == 1) {
for (i = 0; i < Array.getL... |
e4a85a8c-a492-4a67-b7dc-ef417e60cf36 | 2 | public static final void remove(Path path, boolean includeRootDir) {
try {
Files.walkFileTree(path, new RecursiveDirectoryRemover(includeRootDir ? null : path));
} catch (IOException exception) {
Log.error(exception);
}
} |
bc0ca312-35d2-46b3-9807-efe4d91dde79 | 6 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Score other = (Score) obj;
if (!Objects.equals(this._pseudo, other._pseudo)) {
return false;
... |
eb18c633-eb2b-47a8-8cc8-c205cd46f1b9 | 7 | private void createSpelprojekt() {
String sid = "";
Anstalld a = (Anstalld) cbProjektledare.getSelectedItem(); // fetch Anstalld object from combobox
int aid = a.getAid();
try {
sid = DB.getAutoIncrement("spelprojekt", "sid");
newsid = Integer.parseInt(sid);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.