method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3ac31159-cef5-459d-8001-0af317766b66 | 9 | public static void oldVisualizer(String file_name) {
int days = 4; //days in the data
int frame_width = 800;
int frame_height = 480;
JFrame frame=new JFrame("CS 498 Data");
frame.setSize(frame_width,frame_height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JCanvas canvas=new JCanvas();
fram... |
5f62c40f-28f1-4d51-b196-2e82064bf198 | 5 | public ListNode swapPairs2(ListNode head) {
if (head == null || head.next == null)
return head;
ListNode pre = null;
ListNode ppre = null;
ListNode p = head;
boolean change = true;
while (p.next != null) {
ppre = pre;
pre = p;
p = p.next;
if (change) {
if (pre == head) {
head = p;
... |
29677ea3-31df-4dea-b016-8a1bbb49ac85 | 3 | private void dijkstra(int source, int[] dist, HashMap<Integer, HashMap<Integer, Integer>> g){
dist[source]=0;
PriorityQueue<NodeWithDist> q = new PriorityQueue<NodeWithDist>();
q.add(new NodeWithDist(source, dist[source]));
while(!q.isEmpty()){
int node = q.poll().node;
for(int neighbor:g.get(node).keySet... |
31089e23-3c86-46bb-bc80-9b8ae4532b6c | 1 | private void addTable() {
tableModel = new DefaultTableModel(new String[] { "id", "czas domyslny",
"domyslne punkty", "nazwa" }, 0);
table = new JTable(tableModel);
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
JTable target = ... |
a11d4585-ac4e-4952-afdd-8487ce6ff5c0 | 6 | public Character getPlayerCharacter(String info)
{
String[] parsedInstructions = info.split(" ");
if(parsedInstructions[0].compareTo("Player") != 0)
{
System.out.println("Error: Incorrect Player Character creation syntax");
return null;
}
Character c;
if(parsedInstructions.length == 3)
{
//c = ... |
7043d327-bd2c-4f3a-a189-a727d942f54e | 9 | private static void loadOrganizationFromFile() {
// get filename from user.
System.out.print("\nEnter the filename used (q to exit): ");
String filename = user_input.nextLine();
File file = new File(filename);
String[] path = filename.split("/");
String orgName = path[path.length - 1]; // get name of ... |
bfbc968f-fc57-46d5-89a0-6f14c21a352c | 7 | public double[][] LUDecomposition(double[][] matrix) {
int n = matrix.length;
// Luodaan ja alustetaan matriisit L ja U.
double[][] matrixL = new double[n][n];
double[][] matrixU = new double[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
... |
d0bd9ab7-6de3-44e3-a0a9-b19c9fe117e6 | 5 | public void generateImage() {
int image_width, image_height;
try {
//Get the dimensions of the screen in order to determine how large to render the image
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
//Define the width and height of the image
... |
55967491-819e-42a3-8b8b-d1d88a448f5f | 1 | public synchronized void deleteWay(int pos, long wayId){
if (poligons.size()>pos)
ways.get(pos).remove(wayId);
} |
17fd3c38-e180-494c-8b8a-c0e99247dcd0 | 5 | private void resetAll()
{
clear();
try
{
System.out.println("CAUTION!");
System.out.println("If continuing with resetting, all groups and matches will be deleted!");
System.out.println("Do you want to continue? Y/N");
Scanner sc = new Scanner(... |
10cf84bd-5eef-4454-8b19-564e22f167cd | 3 | public static boolean inGrid(int x, int y)
{
return x >= xOff && y >= yOff && x < fieldWidth + xOff && y < fieldHeight + yOff;
} |
be119605-5a74-4cd7-99b0-e20fb6cdb874 | 8 | static public double incompleteGammaComplement(double a, double x) throws ArithmeticException {
double ans, ax, c, yc, r, t, y, z;
double pk, pkm1, pkm2, qk, qkm1, qkm2;
if (x <= 0 || a <= 0) {
return 1.0;
}
if (x < 1.0 || x < a) {
return 1.0 - incomplet... |
57f08a06-5b3c-4382-925a-2b1271577ee5 | 9 | public int getFloorValue(int[] arr, int start, int end, int number) {
// base case
if (start > end) {
return -1;
}
// if number less than start, no number found
if (number < arr[start]) {
return -1;
}
// if number is greater than end index number ,return last number
if (number >= arr[end]) {
re... |
f92f5480-e9e9-4fc3-ab34-1b0bb28e9897 | 9 | private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_... |
ed79dcd3-2df4-4605-803a-45d7ef074de3 | 9 | public int stochRsiLookback( int optInTimePeriod,
int optInFastK_Period,
int optInFastD_Period,
MAType optInFastD_MAType )
{
int retValue;
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePerio... |
c2b9c906-70da-49db-9865-e3e20742df40 | 0 | @Override
protected DataOut doInBackground() throws Exception {
return runTest();
} |
9dda6340-bdf4-4178-a70d-e72bf9202796 | 8 | @Override
public Success<Expression> parse(String s, int p) {
Success<Expression> resBase = AtomParser.singleton.parse(s, p);
if (resBase == null)
return null;
Expression exp = resBase.value;
p = resBase.rem;
p = optWS(s, p);
// Parse any invocations.
... |
4f63adef-570f-46fc-b926-69434fe106b9 | 5 | @Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if (command.equals("Save")) {
Contact contact = createContact();
if (!contact.getFirstName().equals("")){
this.contacts.add(contact);
this.gui.clearFields();
} else {
JOptionPane.showMessageDialog(nul... |
333d536b-549a-42ca-a29a-da820552d56b | 5 | private boolean transmitPacket(byte[] buf, int j) {
int i = 0;
boolean packet_sent = false;
DatagramPacket ack_dtg = new DatagramPacket(new byte[1024], 1024);
while (i < 3 || packet_sent) {
DATAPacket data_packet = new DATAPacket(buf, this.getIp(), this.getPort_dest(), j);
... |
4fa72ca5-4add-49c0-b126-721652744844 | 6 | public void registerEffect(MapleStatEffect effect, long starttime, ScheduledFuture<?> schedule) {
if (effect.isHide()) {
this.hidden = true;
getClient().getSession().write(MaplePacketCreator.sendGMOperation(16, 1));
getMap().broadcastMessage(this, MaplePacketCreator.removePla... |
b6843931-0cd8-44a7-9956-b0e333ba523b | 9 | private void jBtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtGravarActionPerformed
if (jTextFieldCdForma.getText().equals("")) {
JOptionPane.showMessageDialog(null, "A forma de pagamento é obrigatória!");
jTextFieldCdForma.grabFocus();
} else if (jT... |
019a54fc-4ab9-4e24-a348-30e463ac0a64 | 4 | public void testSwarm(File file){
System.out.println("shit");
swarm.setNumberOfParticles(numberOfParticles);
System.out.println(haltingCriteria.size());
int counter = 0;
for(int i = 0; i < haltingCriteria.size(); i++){
swarm.setHaltingCriteria(haltingCriteria.get(i));
System.out.println("halt");
coun... |
8f63930c-03c0-420c-9970-8f6fb4c44421 | 2 | private boolean equals(byte[] a1, int offs1, byte[] a2, int offs2, int num) {
while (num-- > 0) {
if (a1[offs1++] != a2[offs2++]) {
return false;
}
}
return true;
} |
02e1b055-2e55-4e12-b377-53ca2f45d725 | 5 | public void run(){
while(flag){
second++;
if(second==60){
second= 0;
minute++;
}
if(minute==60){
minute= 0;
hour++;
}
if(hour==24){
hour= 0;
}
... |
d0a8f904-706c-43d4-a31b-bf81962f13a1 | 1 | public List<Bill> findBillsByHousehold(Household household)
throws BillNotFoundException {
Set<Bill> bills = household.getBills();
List<Bill> result = new ArrayList<Bill>();
if (bills.size() == 0) {
throw new BillNotFoundException(household, "Bill");
}
result.addAll(bills);
Collections.sort(result);
... |
3bee5b3a-f6db-4fbf-9e23-f5ed79be6ab6 | 4 | public void init() {
String colorstr = getParameter("pagecolor");
if (colorstr == null)
colorstr = "ffffff";
this.pageColor = new Color(Integer.parseInt(colorstr, 16));
colorstr = getParameter("bgcolor");
if (colorstr != null)
setBackground(new Color(Integer.parseInt(colorstr, 16)));
String cp = getPa... |
fb5bae6a-1c8f-4afc-98ba-fb37b49356f8 | 6 | private void randomFood() {
FoodList listOfFood = null;
try {
ObjectInputStream listIn = new ObjectInputStream(new FileInputStream(new File("foodList.dat")));
listOfFood = (FoodList) listIn.readObject();
listIn.close();
} catch (FileNotFoundException e) {
System.err.println("Food List ... |
7ac3acac-d38f-48fd-ae8c-112655ad70f6 | 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... |
c8074df1-1c54-4217-8eca-8917c894e665 | 7 | private Vector<String> loadTableEntry(final SettingsData settingsData) {
Vector<String> v = new Vector<String>();
v.add(settingsData.getModuleName());
AttributeGroup atg = settingsData.getAttributeGroup();
if(atg != null) {
v.add(atg.getNameOrPidOrId());
}
else {
v.add("");
}
Aspect asp = settings... |
7d53a4e6-44f5-4fec-a9f4-e5d0ab280917 | 0 | public ArrayList<String> getTechTitles() {
return TechTitles;
} |
244e61c8-1c26-452b-b1fc-47ef929b8f4a | 9 | public static ArrayList<String[]> cars() {
String JDBC_DRIVER = "com.mysql.jdbc.Driver";
String DB_URL = "jdbc:mysql://localhost:1234/cars";
// Database credentials
String USER = "root";
String PASS = "wps14042";
Set<String> data = new HashSet<String>();
ArrayList<String[]> data2 = new ArrayList<Str... |
eea44124-d7b8-4495-9092-6292b421f400 | 3 | public void setNumeroInt(TNumeroInt node)
{
if(this._numeroInt_ != null)
{
this._numeroInt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.par... |
2e31d05a-c74a-49fb-97eb-bec09cd96e9d | 8 | public List<ReportEntry> getReport(Long from, Long to) {
if (from == null) {
throw new IllegalArgumentException("report start date cannot be null");
}
if (to == null) {
throw new IllegalArgumentException("report end date cannot be null");
}
if (to < fro... |
2197dfc7-d3eb-4fbb-b421-3d9e457cdc63 | 1 | public static void stringInDetail(String s) {
System.out.println(s + " length: " + s.length());
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
System.out.printf("i : %2d \u202B%c\u202B \u202B%4X\u202B \n", i, s.charAt(i), (int) c);// Character.getNumericValue(c)
... |
c630d1e2-21f7-474e-b034-7b121e6de114 | 5 | private boolean validarCampos (){
boolean validos = true;
if (jTextField3.getText().equals("")){
jTextField3.requestFocus();
msj_Error("Ingrese una Razon Social.");
validos=false;
}
else{
if (!control_f .isFechaValida(campoFecha.ge... |
c1c7c84c-c55e-4429-b63e-1a67dd5ff5a9 | 0 | @Override
public void addClientConnectEventListener(ConnectListener listener) {
connectEventListenerList.add(ConnectListener.class, listener);
} |
731d92e8-f210-4f7d-ae28-5d272c838462 | 1 | protected void addDocumentEnd() {
try {
h.endDocument();
} catch (SAXException ex) {
throw new RuntimeException(ex.toString());
}
} |
59e64601-c545-47b2-a40e-68dea7ea76e2 | 4 | public static Aikaslotti haeAikaslottiIdlla(int id) throws NamingException, SQLException {
Yhteys tietokanta = new Yhteys();
Connection yhteys = tietokanta.getYhteys();
String sql = "SELECT * FROM Aikaslotti WHERE id = ?";
PreparedStatement kysely = yhteys.prepareStatement(sql);
... |
2fef74c1-2cb3-450e-9d7d-94d5d56092f0 | 6 | void printSprite()
{
//Get the current sprite path
NodeList listOfMovesSprites = sprites_doc.getElementsByTagName("Move");
boolean sprite_found=false;
for(int s=0; s<listOfMovesSprites.getLength() ; s++)
{
Node move_node = listOfMovesSprites.item(s);
Element move_element = (El... |
b60400b9-f971-4647-96c1-459d46d4e28c | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
int i = 0;
int numPalabras = 0;
String texto = textArea.getText();
texto += " ";
if(texto.length() > 0) {
do {
if(texto.charAt(i) != ' ' &... |
2f9fbf93-a0ec-404b-8355-0760f5014dfd | 6 | protected void rotateLeft(Node<T> node) {
Position parentPosition = null;
Node<T> parent = node.parent;
if (parent != null) {
if (node.equals(parent.lesser)) {
// Lesser
parentPosition = Position.LEFT;
} else {
// Greater
... |
4acf36d2-eb18-4b16-bdc1-b6065f69613c | 6 | public AboutDialog()
{
contentPane.setBorder(DefaultUIProvider.getDefaultEmptyEtchedBorder());
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
try
{
aboutTextPane.setPage(getClass().getResource("/config/about.html"))... |
9a8d80f8-930a-4f4d-b662-3ac7801e6106 | 1 | private static Calendar convertToCalendar(String value, int killId) {
Calendar output;
try {
int year = Integer.parseInt(value.substring(0, 4));
int month = Integer.parseInt(value.substring(5, 7)) - 1;
int day = Integer.parseInt(value.substring(8, 10));
int hour = Integer.parseInt(value.substring(11, 13... |
fa7594fe-da93-4cc4-8e78-7ec62973940e | 9 | public static Predicate.Op getOp(String s) throws simpledb.ParsingException {
if (s.equals("="))
return Predicate.Op.EQUALS;
if (s.equals(">"))
return Predicate.Op.GREATER_THAN;
if (s.equals(">="))
return Predicate.Op.GREATER_THAN_OR_EQ;
if (s.equals("<"))
return Predicate.Op.LES... |
d4399e7b-f71a-4e78-987a-479d5770d36b | 5 | @Override
public void run() {
myThread = Thread.currentThread();
log.debug("SystemThread: thread starting");
watchdog.start();
synchronized (this) {
state = recalcMode();
// Bring up the OCP Links
for (Link link : ... |
553bb775-9ed3-44f5-82c4-97f9b3ecfa47 | 3 | public static void Kuhn(Graph input) {
input.setState(States.ARR_ADJ);
Log.print(Log.system, "Kuhn algorithm:");
// init
int n = input.getNodeCountFirstPartite();
int k = input.getVertexCount() - n;
mt = new int[k];
used = new boolean[n];
Arrays.fill(mt, -1);
for (int i = 0; i < n; i++) {
Arrays.... |
82bcf8ed-1084-4bb3-9e37-1c018f02e309 | 4 | public String getColumnName(int columnIndex)
{
// Devuelve el nombre de cada columna. Este texto aparecerá en la
// cabecera de la tabla.
switch (columnIndex)
{
case 0:
return "PID";
case 1:
return "PD";
case 2:
... |
cd879c48-0c66-450d-9bd1-dad923c6cc76 | 2 | private void relaxDriveTime(Edge e, Node prevNode)
{
Node nextNode;
if (prevNode.equals(e.getFromNode()))
{
nextNode = e.getToNode();
} else
{
nextNode = e.getFromNode();
}
double g_Score = prevNode.getDistTo() + e.getWeight();
if (g_Score < nextNode.getDistTo())
{
edgeTo.put(nextNode, e);... |
fb6aa05d-39f2-416a-aab4-547174450c1e | 0 | public int diferencaEmSegundos(Tempo t) {
return Math.abs(segundos() - t.segundos());
} |
568eabd3-4106-4e00-b604-7847346ef03d | 2 | public void init(byte player_mode){
players = new Player[2];
boolean hasP1 = (player_mode & PLAYER_MODE_P1_ONLY)==PLAYER_MODE_P1_ONLY;
boolean hasP2 = (player_mode & PLAYER_MODE_P2_ONLY)==PLAYER_MODE_P2_ONLY;
if (hasP1) players[PLAYER_ID_P1] = new Player(PLAYER_ID_P1);
if (hasP2) players[PLAYER_ID_P2] = new P... |
b5242b8f-5b28-4500-ad2b-06e5e5eb1bf6 | 5 | private int waehleZeile() {
int zahl = 0;
while (zahl < 1 || zahl > 16) {
try {
zahl = scan.nextInt();
} catch (InputMismatchException e) {
GamePrinter.printEingabeFehler();
scan.nextLine();
return waehleZeile();
}
if (zahl < 1 || zahl > 16) {
GamePrinter.printEingabeFehler();
}
... |
615c612c-c746-4431-893c-0f5cfc1df92c | 8 | public ArrayList<Processo> Consultar(String situacao){
//("") - Pesquisa sem precisar de id.
ArrayList<Processo> processos = new ArrayList();
try {
if(situacao.equals("")){
String sql = "SELECT * FROM tb_processo";
ConsultarSQL(sql,true);
... |
82a27882-247a-4d5e-b789-f832a0e6ffa6 | 9 | public void render3(Graphics g)
{
if(window != null)
{
window.render(g);
}
else if(cX >= 0 && cY >= 0 && cX < Game.fieldWidth && cY < Game.fieldHeight) //Highlights the grid that the mouse is hovering over
{
g.setColor(selectColor);
g.fillR... |
aaefd277-3d05-481c-8893-5568a3a6f9a6 | 4 | public Enemy(int startX) throws SlickException{
// Initialises things.
this.startX = startX;
location = new Ellipse2D.Float((float)startX, (float)0,10,10);
location.setFrame((float)startX, 0, 10, 10);
// Sets the speed based on difficulty.
if(Settings.difficulty == 4){speed = 5;}
... |
d058f3df-3506-4b43-9e66-3bb80d63b78b | 1 | public String getIsSortByName() {
if(sortByName){ return "true";} else{
return "false";}
} |
5dd8cbbe-09d8-4bb7-83bf-9af04e07876d | 6 | public static void main(String[] args) throws SQLException {
File file = new File(HOSPITALOUT);
conn = DriverManager.getConnection("jdbc:derby://localhost:1527/hospital", "sa", "sa");
dao = new PatientDAOJdbc(conn);
List<Patient> list = dao.findAll();
... |
134034c8-e253-436e-879c-1c147d698303 | 7 | private static byte[] readClass(final InputStream is) throws IOException {
if (is == null)
throw new IOException("Class not found");
try {
byte[] b = new byte[is.available()];
int len = 0;
while (true) {
int n = is.read(b, len,... |
7ff8dc52-66de-48c3-babf-04c1f51d89a6 | 4 | @Override
public void execute(CommandSender sender, String[] args) {
if (args.length == 0) {
sender.sendMessage(new TextComponent(ChatColor.RED + "Usage: /say <message ...>"));
return;
}
StringBuilder msg = new StringBuilder();
for (String a : args) msg.append... |
ef113437-9d64-4356-9c32-4d949a2bf88a | 6 | private String getPOS(String label) {
if (ADJECT.contains(label)) {
return "ADJECT";
}
else if (DET.contains(label)) {
return "DET";
}
else if (PREP.contains(label)) {
return "PREP";
}
else if (NOUNS.contains(label)) {
... |
67cc906f-e1c1-443b-80ce-fddeb0ffc374 | 0 | public Sound(String path) throws Exception {
InputStream in = new FileInputStream(path);
// create an audiostream from the inputstream
AudioStream audioStream = new AudioStream(in);
// play the audio clip with the audioplayer class
AudioPlayer.player.start(audioStream);
} |
e1219abb-d9ad-4735-971d-3aadbc02a6ab | 4 | public static void main(String[] args) {
int turn = -1;
Player[] players = {null, null};
Scanner in = new Scanner(System.in);
// set the number of games
System.out.println("Input the number of games to be played:");
turn = in.nextInt();
// set player objects
for (int i = 0; i < players.length... |
a14b07ca-aba8-4ba9-9d02-badba854171c | 4 | private Transition createOpenAnimation(final RadialMenuItem newSelectedItem) {
// Children slide animation
final List<RadialMenuItem> children = itemToValues.get(newSelectedItem);
double startAngleEnd = 0;
final double startAngleBegin = newSelectedItem.getStartAngle();
final ParallelTransition transition = new P... |
715beed4-334e-4187-bb93-0c7f87a76b30 | 9 | public ItemSelectorDialog(LegendaryCardMakerFrame parent)
{
super(parent);
setSize(400, 500);
setTitle("Select Items");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
checklist = new JCheckList<LegendaryItem>();
for (Hero h : LegendaryCardMakerFrame.lcmf.lcm.heroes)
{
checklist.add... |
d7c4d171-72ca-4103-bd9a-90611bbcee89 | 9 | public static int computeStoredBoundOnRoleset(NamedDescription relation, Stella_Object instance, Keyword lowerorupper) {
{ Skolem roleset = NamedDescription.getRolesetOf(relation, instance);
Stella_Object cardinality = null;
edu.isi.powerloom.pl_kernel_kb.IntervalCache intervalcache = null;
Stella... |
3bc16ae7-f458-4d4e-a815-9ddf9ea4a17e | 0 | public VueConnexion getVue() {
return vue;
} |
aed0236d-5af1-4a29-ae9e-8e27e9d591d2 | 1 | public static TreeMap<String, Integer> getShiptypesNameOccurrence(
ArrayList<Kill> killBoard, String attribute) {
ItemIdList.getInstance();
TreeMap<Integer, Integer> intermediary = getShiptypesIDOccurrence(
killBoard, attribute);
TreeMap<String, Integer> result = new TreeMap<String, Integer>();
Iterator<... |
e7cba36a-62e8-462d-869c-62f3f7df7a14 | 8 | private static void writeSetPrimitiveBeanPropertyFromArray(final Class cl,
final CodeVisitor mw,
final Method setter,
final Class returnT... |
ada35e83-97c8-48b1-8241-05325c97d4b0 | 5 | boolean leaf()
{
int count = 0;
if ( null != parentEdge)
count++;
if ( null != leftEdge)
count++;
if ( null != rightEdge)
count++;
if ( null != middleEdge)
count++;
if ( count > 1 )
return false;
return true;
} |
fcdb24b9-3d47-46d6-8a8f-1047c35afb5f | 0 | public int getDlc() {
return dlc;
} |
67b52158-a86d-4339-bdf0-cc734ae67307 | 5 | public void walk(String path, FilenameFilter filter)
{
File root = new File(path);
File[] list = root.listFiles();
if (list == null)
return;
for (File f : list)
{
if (f.isDirectory())
{
walk(f.getAbsolutePath(), filter);
// System.out.println("Dir:" + f.getAbsoluteFile());
}
else
{... |
2115f26a-05ce-4696-8abd-24c043ed1931 | 9 | public void createGenFile( GenKbAuthorization Authorization,
GenKbGenFileBuff Buff )
{
GenKbGenItemPKey pkey = schema.getFactoryGenItem().newPKey();
pkey.setClassCode( Buff.getClassCode() );
pkey.setRequiredCartridgeId( Buff.getRequiredCartridgeId() );
pkey.setRequiredItemId( Buff.getRequiredItemId() );
... |
13960880-552d-40ed-a83d-0a37e1433a9b | 2 | public static HashMap<String, byte[]> unpackZip(byte[] data) throws IOException {
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
ZipInputStream zipInputStream = new ZipInputStream(inputStream);
HashMap<String, byte[]> zipData = new HashMap<>();
... |
af8c6543-6f4a-4b4e-877b-93048a1a2851 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DictionaryInfo that = (DictionaryInfo) o;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
... |
b72e19bc-3177-4883-97b8-5d07ecf8c01b | 8 | public void preferenceToLongerPaths()
{
Comparator<Route> comp = new Comparator<Route>() {
@Override
public int compare(Route o1, Route o2) {
// TODO Auto-generated method stub
if(o1.getRouteTravelTime() > o2.getRouteTravelTime())
{
return -1;
}
return 1;
}
};
Route.setTotalHop... |
3a3f4c3d-e27a-462a-97cc-a53a69e57338 | 0 | public String next() {
current++;
return "'prefix" + (current - 1) + "'";
} |
1604c128-ba42-4462-abf1-4edd9fc117cf | 4 | public void createTask( String id,
String name,
String date,
String status,
String required,
String description,
String attendants) throws JAXBException, IOException{
//Probind that the data is comming correctly
/*System.out.println( "Id: "+id+
"Name: "+name+
... |
9b764dac-d8f3-4cee-80aa-2dbd240e52d1 | 0 | public static String escapeHTML(String text) {
text = StringTools.replace(text,"&","&");
text = StringTools.replace(text,"<","<");
text = StringTools.replace(text,">",">");
text = StringTools.replace(text,"\"",""");
return text;
} |
6e874be0-10c8-4091-9536-337d658a7563 | 5 | @Override
public final boolean shouldSpawn() {
if (mobTime < 0) {
return false;
}
// regular spawnpoints should spawn a maximum of 3 monsters; immobile spawnpoints or spawnpoints with mobtime a
// maximum of 1
if (((mobTime != 0 || immobile) && spawnedMonsters.get() > 0) || spawnedMonsters.get() > 1) {
... |
cb6c6c92-bc5c-49f9-968a-e0fe92707269 | 7 | public Color getColor() {
switch(type) {
case COPPER:
return new Color(219, 63, 45);
case ALUMINUM:
return new Color(134, 134, 134);
case SILVER:
return new Color(180, 180, 180);
case GOLD:
return Color.YELLOW;
case BISMUTH:
return new Color(242, 242, 242);
case PLATINUM:
return new Colo... |
72aacc4c-ef09-4f87-8961-0fa1353640a2 | 1 | @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("HashtableNaive {\n");
for (int i = 0; i < currentSize; i++) {
sb.append(" " + keys[i] + " => " + values[i] + "\n");
}
sb.append("}");
return sb.toString();
} |
49704356-39eb-4bd8-bfcb-b4c3df7bb26a | 0 | @Override public void finishPopulate()
{
} |
f3c8f179-fba2-4ee4-b4d5-04b595e846bc | 9 | @org.junit.Test
public void testSerialiseInt()
{
for (int size = 1; size <= 8; size++) {
int[] numvals = new int[]{0, 10, 127, 128, 255};
for (int idx = 0; idx != numvals.length; idx++) {
byte[] barr = ByteOps.encodeInt(numvals[idx], size);
int val = ByteOps.decodeInt(barr, 0, size);
org.junit.Ass... |
3540c5e6-39e6-4add-b917-7f4ede491ab4 | 3 | public static boolean segmentSuportSeparatesPoints(Segment s, Point P, Point Q) {
Point v1 = getVectorFromTo(P, s.P);
Point u1 = getVectorFromTo(P, s.Q);
Point v2 = getVectorFromTo(Q, s.P);
Point u2 = getVectorFromTo(Q, s.Q);
double prodV1U1 = crossProd(v1, u1);
double prodV2U2 = crossProd(v2, u2);
return... |
0d3ae3be-489f-4a45-b17f-5f691b2164bc | 2 | @Override
public void parse() {
appendURL();
String result = WebUtils.source(url.toString());
result = result.substring(0, result.indexOf("]]"));
String split[] = result.split("],\\[");
StringBuilder builder = new StringBuilder();
for(String sub : split){
String[... |
771b6297-8261-4667-b081-779e21fccc25 | 3 | public void setOption(String option, Collection values) {
if (option.startsWith("keywords")) {
keywords = (String[]) values.toArray(new String[values.size()]);
} else if (option.startsWith("backup")) {
if (values.size() != 1)
throw new IllegalArgumentException("Only one backup is allowed");
backup = (R... |
a67f1de9-c5fe-4a03-83fe-9a495f8357b3 | 6 | public void printNthFromLast(Node root, int n) {
int i = n;
if (root == null) {
return;
}
if (i > size(root)) {
System.out.println("Not enough elements");
return;
}
Node node = root;
Node nodeback = root;
while ((node.getLink() != null) && (--i > 0)) {
node = node.getLink();
}
if (n... |
64a88b6a-4372-44f5-9308-4bef59489080 | 4 | public double MacroPrecision() {
if (computed == 0) countStuff();
double mprec = 0;
for (int i=0; i<catnum; i++) {
if ((tp[i] != 0) && (tp[i]+fp[i] != 0))
mprec += tp[i]/(tp[i]+fp[i]);
}
... |
ea96b77e-5038-48aa-8da0-3c57cc13ec04 | 7 | protected void drawHighlightedNodes(Graphics2D g2d, DrawableNode root) {
nodeStack.clear();
nodeStack.push(root);
g2d.setColor(highlightColor);
while(!nodeStack.isEmpty()) {
DrawableNode n = nodeStack.pop();
int x = translateTreeToPixelX(n.getX());
int y = translateTreeToPixelY(n.getY());
if... |
3c7fb8bd-7366-426a-842f-002c1b353c63 | 8 | private static void countTodoAndFixmes(File directory) throws IOException {
for (File file : directory.listFiles()) {
if (file.isDirectory()) {
countTodoAndFixmes(file);
} else {
for (String currentEnding : CONFIG.getFileEndingsToCheck()) {
... |
263c0af6-bdbd-4f05-a7f8-3c79c82232ed | 4 | public AutoApagadoManager(){
// Use an appropriate Look and Feel
try {
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
UIManager.setLookAndFeel(UIManager.getCross... |
b68181cc-cf44-4669-9c74-23d2d0c983f3 | 2 | private Boolean setupEconomy()
{
if( getServer().getPluginManager().getPlugin("Vault") != null ) {
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
economy ... |
a023e969-717c-40f8-8687-e91405f3feb1 | 8 | public boolean run() {
sendEvent(new GameEvent(this, "RunFrame"));
for (int snakeArrayPos = activeSnakeList.size() -1;snakeArrayPos >= 0; snakeArrayPos--) {
Snake snake = activeSnakeList.get(snakeArrayPos);
snake.sendEvent(new GameEvent(snake, "RunFrame"));
Vector2d s... |
0185a116-dec2-440c-84da-14db54b59ed6 | 6 | public void writeNewScore()
{
FileWriter fw = null;
try {
fw = new FileWriter(file);
String str ="" + best;
fw.write(str);
fw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally {
try {
if (fw != null)
fw.... |
bac21538-8bd7-463f-ba7a-10d8cab848b7 | 1 | public boolean saveToFile(String Path){
try {
FileWriter f = new FileWriter(Path);
f.write(this.toString());
f.close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
} |
8ee2cf0f-e5df-4502-ae51-d72b49a0d0d2 | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
a89ac555-3b4d-4a48-8487-e8b26b7e669a | 4 | protected void calculeReveilsTerminaisons(List<Tache> taches, Simulation environnement) {
for (Tache tache : taches) {
int reveil = tache.getRi();
environnement.addEvent(new Event(reveil, KIWI_INSTRUCTIONS.START_LINE, tache));
environnement.addEvent(new Event(reveil, KIWI_INSTRUCTIONS.START, tache));
... |
167b5821-d0ff-4c20-a444-fd86ec76e11d | 3 | public static void main(String[] args) {
MyWorkerThreadFactory factory=new MyWorkerThreadFactory();
ForkJoinPool pool=new ForkJoinPool(4, factory, null, false);
int array[]=new int[100000];
for (int i=0; i<array.length; i++){
array[i]=1;
}
MyRecursiveTask task... |
6262f656-4cd0-44d7-b182-40335cc99511 | 5 | @Override
public boolean setAllOffline() {
FileWriter writer = null;
try {
BufferedReader reader = new BufferedReader(new FileReader(new File(OnlineUsers.directory+OnlineUsers.flatfileData)));
String line = "";
StringBuilder toSave = new StringBuilder();
while ((line = reader.readLine()) != null) {
... |
fc20012d-8f84-4704-aad2-6bd44eda52e8 | 0 | public String getDepartmentName() {
return departmentName;
} |
a9e47990-4b71-4049-a7a8-09ea9538518d | 7 | protected void setup() {
int segundo = 5;
//comportamento para solicitar ao diretório falicitador por algum motoboy disponível para entregar a pizza
addBehaviour(new TickerBehaviour(this, segundo*1000)
{
protected void onTick()
{
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.