method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
85c46205-3cb0-47a7-864b-bb5525d27b20 | 0 | public void mend()
{
} |
4a45dda0-5c8f-4b5e-a1a0-1ad1bbd2f398 | 7 | public SplashPicture(String pathToFile) {
BufferedImage bimg = null;
try {
bimg = ImageIO.read(new File(pathToFile));
img = new ImageIcon(bimg).getImage();
} catch (Exception e) {
}
if (img == null || bimg == null) {
try {
bimg = ImageIO.read(new File("/splash.png"));
img = new ImageIcon(bi... |
ca935443-78b7-4a09-baf9-3186a69ca28a | 2 | public ResultSet checkDoctor(String doctor_info) {
try {
// checking whether the user enters employee no or doctor name
if (Helper.isInteger(doctor_info)) {
String selectDoctorByNoQuery = "SELECT * FROM DOCTOR WHERE employee_no = "
+ Integer.parseInt(doctor_info);
rs = stmt.executeQuery(selectDoct... |
99fab762-2789-4307-983d-3c504ec449d2 | 5 | private boolean _uacExists(String target) {
Connection conn = null;
int count = 0;
try {
//Class.forName("com.mysql.jdbc.Driver").newInstance();
String usern = "ultracam";
String passw = "nogales";
String url = "jdbc:mysql://" + UAC_DATABASE_HOST + "/uac";
conn = DriverManager.getConnection(url,use... |
d0df30b3-8a77-4723-9435-c56a2ef5d14d | 5 | private void processHeaders(HttpURLConnection conn) throws Exception{
headers = new HashMap<String, String>();
cookies = new HashMap<String, String>();
//=================================
//get headers, cookies, etc.
for (int i=0; ; i++) {
//get headers from header field
String headerName = conn.... |
d8f6229a-e0fc-420b-81ea-6d9652129278 | 3 | public void plusBonusScore(PinCount knockOverCount) {
Integer knockOverPinCount = knockOverCount.intValue();
if (getScoreStatus() == ScoreStatus.NEXT_BALL) {
score += knockOverPinCount;
}
if (scoreStatus == ScoreStatus.NEXT_TWO_BALL) {
scoreStatus = ScoreStatus.NEXT_BALL;
} else if (scoreStatus == Sco... |
3d0a118b-fac1-4304-9b8e-02ddbe5eccc8 | 1 | public boolean isWithinCastlePixelPos(Enemy currentEnemy) {
if ( isWithinCastle(getPosOnGrid(currentEnemy.getCenterOfObject()))) {
return true;
}
return false;
} |
ff072b07-21e1-4e81-ae93-03f6ef54e32c | 2 | public static Codec[] makeFilters() {
// Set up the file filters.
Universe.CHOOSER.resetChoosableFileFilters();
List decoders = Universe.CODEC_REGISTRY.getDecoders();
Iterator it = decoders.iterator();
while (it.hasNext())
Universe.CHOOSER.addChoosableFileFilter((FileFilter) it.next());
Universe.CHOOSER.... |
72f92c11-e5ac-44d0-8d6a-e8c4ec5ba968 | 0 | public void scrub() {
append(" Detergent.scrub()");
super.scrub(); // Call base-class version
} |
83c5b948-b8fa-4733-8c63-b912ee659c1c | 9 | public String convert(String s, int nRows) {
if(nRows<=1){
return s;
}
int len = s.length();
String[] temp = new String[nRows];
for (int i =0;i<nRows;i++)
temp[i] = "";
int size = 2*(nRows-1);
for(int i=0;i<nRows;i++){
for (int ... |
44ec06aa-398c-4d89-90e6-83f183b6b646 | 4 | private void setCodeAndMessage( int code, String m ) throws InvalidDataException {
if( m == null ) {
m = "";
}
// CloseFrame.TLS_ERROR is not allowed to be transfered over the wire
if( code == CloseFrame.TLS_ERROR ) {
code = CloseFrame.NOCODE;
m = "";
}
if( code == CloseFrame.NOCODE ) {
if( 0 < ... |
afbcdf45-2b0f-4aa3-b025-e0320e753f0d | 9 | private boolean checkForErrors(DatagramPacket packet, int expectedtype, DatagramSocket socket){
DatagramPacket err = null;
boolean goodPacket = true;
if(packet.getData()[1] == 5){
System.out.println(ExtractErrorMsg(packet));
return false;
}
if(packet.getData()[0] != 0){
... |
948467f9-b17f-425c-91b1-38534a351f3e | 9 | public void update() {
if (timer > 10000) {
Random rand = new Random();
boolean ok = false;
while(!ok)
{
int randomInt = rand.nextInt(100);
if (randomInt <= pbedroom1)
{
room = map.getRooms().get(0);
if(room.getHumans() == 0)
ok = true;
}
else if (randomInt <= pbedroom2... |
e97d6915-3808-4183-8028-9308f85ac8ff | 8 | public boolean check(int dir, int cnt) {
cnt++;
if((dir<0)) dir=7;
if((dir>7)) dir=0;
Coordinate Coo = ausDirzuCoo(dir); // Diese Methode �berpr�ft anhand der Richtung, die �bergeben wird, die n�chste Koordinate und schaut,
if(checkFreePosition(Coo.getXCoordinate(),Coo.getYCoordinate())){ // ob di... |
777b8189-5c7a-4a79-8ca7-29a6495f5512 | 8 | public static Timing fromLineIndexAndMeasureSize(int lineIndex, int numberLinesInMeasure) {
int length;
if (lineIndex != 0) {
int gcd = getGCD(numberLinesInMeasure, lineIndex);
length = numberLinesInMeasure / gcd;
} else {
return Timing.L1ST;
}
switch(length) {
case 8:
return Timing.L8TH;
cas... |
36e3fc60-72d3-45ae-ba7d-d0c9308c456b | 1 | @SuppressWarnings("deprecation")
public void testIsContiguous_RP() {
YearMonthDay ymd = new YearMonthDay(2005, 6, 9);
assertEquals(true, DateTimeUtils.isContiguous(ymd));
TimeOfDay tod = new TimeOfDay(12, 20, 30, 0);
assertEquals(true, DateTimeUtils.isContiguous(tod));
Partia... |
e8eb845f-7795-4f93-be2a-e95be781893c | 8 | private static String getFullMachineID() throws Exception
{
String MachineID = null;
String localIP=null;
String timestamp=null;
try{
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()){
NetworkInterface current = interfaces.next... |
d9611cc5-85fb-4eb8-97b1-b29836dd72fd | 7 | @Override
public boolean find(E d) {
if(list == null)
return false;
if (list.data.compareTo(d) == 0) {
return true;
} else if (list.data.compareTo(d) < 0) {
while (list.next != null) {
list = list.next;
if (list.data.compareTo(d) == 0) {
return true;
}
}
} else {
while (li... |
6f2fd893-4b3e-4500-97c9-1de20a69c05d | 7 | public About(){
// anti-aliasing on
System.setProperty("awt.useSystemAAFontSettings", "on");
editorPane = new JEditorPane();
editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
editorPane.setFont(new Font("Arial", Font.BOLD, 13));
editorPane.setPreferredSize... |
8849f467-8484-4a57-9bf0-7c5099899c15 | 0 | public DarkSnakeLord(int room) {
super(new FrostDiver(), new DarkBreath(), 83.00*room, 164.00*room, 80.00*room, 2.0*room, 70.0*room, 62.0*room, "Dark Snake Lord");
} // End DVC |
bb36e832-bf29-4db2-863d-8f7a9927b64c | 5 | static final byte[] method850(boolean flag, Object obj, int i) {
if (obj == null) {
return null;
}
if (obj instanceof byte[]) {
byte abyte0[] = (byte[]) obj;
if (!flag) {
return abyte0;
} else {
return Class52.method... |
c9784575-baa7-4696-bcb5-8dc2dd257326 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&((msg.sourceMinor()==CMMsg.TYP_DEATH)
||(msg.sourceMinor()==CMMsg.TYP_QUIT)
||(msg.sourceMinor()==CMMsg.TYP_RECALL)
||(msg.sourceMinor()... |
a5d1780d-7f00-4b2e-9d8b-b5ad0b3c8bee | 8 | public void setSuccessors() {
for(String key1: this.getActiveKeys()) {
long min = 10000007L;
long max = 0L;
long temp = 10000007L;
String result = "";
for(String key: this.getActiveKeys()) {
if(!this.getMember(key).isDeletable()) {
if(getHashValue(key) < min) {
min = getHashValue(key);
... |
ff2347ac-1253-4a4e-9b60-55a02662475d | 6 | public void save() {
switches = "@Switch:";
if(rdbtnA.isSelected()) {
switches += "a:";
} else if(rdbtnB.isSelected()) {
switches += "b:";
} else if(rdbtnC.isSelected()) {
switches += "c:";
} else if(rdbtnD.isSelected()) {
switches += "d:";
}
if(rdbtnEnable.isSelected()) {
switches += "t... |
ee244b0f-1bd1-4510-a951-f0db63e8f373 | 7 | public static JavaScriptObject getJsObj(NameValuePair[] nameValuePairs) {
JavaScriptObject paramObj = JsoHelper.createObject();
if (nameValuePairs == null)
return paramObj;
for (int i = 0; i < nameValuePairs.length; i++) {
NameValuePair param = nameValuePairs[i];
switch (param.getType()) {
case STRIN... |
7d2fb737-1812-4afa-942c-aabf4b79782e | 4 | @Override
public void render(GameContainer container, Graphics g) {
switch (side) {
case TOP:
g.setColor(Color.red);
break;
case LEFT:
g.setColor(Color.green);
break;
case BOTTOM:
g.setColor(Color.blue);
break;
case RIGHT:
g.setColor(Color.yellow);
break;
}
g.fill(new Rectangle... |
39c1bdf6-4ca9-497c-ae21-a27ef40bb969 | 1 | @Test
public void TestImage()
{
MarketSession session = new MarketSession();
session.login("antoine.souchet@gmail.com", "coucou2031");
//v2:com.sg.js.Doubles:1:3
//-7934792861962808905
GetImageRequest imgReq = GetImageRequest.newBuilder().setAppId("8885807488756673114")
... |
2adf8772-8a00-4c60-ab50-f75f304587d4 | 1 | private void Slowdown(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Slowdown
if (currSpeed > 1)
{
--currSpeed;
world.setSpeed(currSpeed);
speedCounter.setText("Speed: " + currSpeed);
}
}//GEN-LAST:event_Slowdown |
0c416f7f-b270-4054-8df2-e4cf13e8a255 | 7 | private Word checkConnector(int begin, int end) {
if (end == -1) { // check connector on the left
if (!currSen.connector.isEmpty()) {
for (Word w : currSen.connector) {
int pos = WPos2Chunk(w.pos);
if (pos == begin || pos - 1 == begin) {
... |
8cc0363a-e198-468c-a1d6-3522d1dc56a8 | 7 | private static void readProperties(NodeList children, Properties props) {
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if ("property".equalsIgnoreCase(child.getNodeName())) {
final String key = getAttributeValue(child, "name");
... |
6bf3b140-cd36-4916-a743-0bb1d6cd1503 | 0 | public void stop() {
stop = true;
sock.close();
} |
3ad57750-04d7-4bc1-af9a-eaa1441f2844 | 6 | public Facelet getFace(Face face) {
switch(face) {
case FRONT:
return getFrontFace();
case LEFT:
return getLeftFace();
case RIGHT:
return getRightFace();
case BOTTOM:
return getBottomFace();
case TOP:
return getTopFace();
case BACK:
return getBackFace();
}
return Facelet.... |
a84998f4-359a-4f2a-92b8-bd949d6f0f22 | 8 | public int[] maxSlidingWindow(int[] nums, int k) {
if (nums == null || nums.length == 0 || nums.length < k) {
return new int[0];
}
int[] result = new int[nums.length - k + 1];
ArrayDeque<Integer> deque = new ArrayDeque<Integer>();
for (int i = 0; i < nums.length; i++) {
while (!deque.isEmpty() ... |
22e63aba-4c17-4c12-a015-2e364ff5ba1f | 7 | public ListNode partition(ListNode head, int x) {
ListNode smallerHead = null, smallerTail = null, biggerHead = null, biggerTail = null;
while (head != null) {
int val = head.val;
if (val < x) {
if (smallerHead == null) {
smallerHead = head;
... |
364f1eeb-61b8-401d-94dc-7785f6eb23c7 | 3 | public int reverse(int x) {
if (x == Integer.MIN_VALUE)
throw new NumberFormatException("Can not revese" + x);
boolean negative = x < 0;
if (negative)
x = -x;
StringBuffer it = new StringBuffer();
it.append(x);
it.reverse();
return negative... |
d1d86ae7-c4b3-4fbe-95bd-3312f208a862 | 0 | private boolean remove(int target)
{
// Student will replace this return statement with their own code:
return false;
} |
17176c72-491d-4221-b33c-62b1201393ea | 0 | public void setNewValue(String newValue){
this.newValue.setText(newValue);
} |
9a672846-d3e1-4332-96de-07eb4a6fd1a2 | 1 | public int getUpperLeftY() {
if (y1 > y2) {
return y1;
} else {
return y2;
}
} |
195757cc-1405-4cbf-bf7b-80622a7b6be0 | 4 | public void guiForSavingTheOutputFileWithXmlOrSpecialChars() {
frmSavingTheOutputFileWithXmlOrSpecialChars.setSize(400, 300);
frmSavingTheOutputFileWithXmlOrSpecialChars
.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmSavingTheOutputFileWithXmlOrSpecialChars.setVisible(true);
frmSavingTheOutputFileWith... |
95168abb-a0ee-4aad-bbb3-7078a88ec7be | 4 | private LocalVarEntry find(int addr) {
LocalVarEntry li = list;
while (li != null && li.endAddr < addr)
li = li.next;
if (li == null || li.startAddr > addr) {
return null;
}
return li;
} |
4c09a766-7725-404d-ad37-c528cddf3e97 | 4 | private static List<int[]> startFolkRankCreationForResources(BookmarkReader reader, int sampleSize) {
int size = reader.getBookmarks().size();
int trainSize = size - sampleSize;
List<Map<Integer, Integer>> userMaps = Utilities.getUserMaps(reader.getBookmarks());
System.out.println("\nStart FolkRank Calculat... |
497a3c93-089c-4d08-8e0d-646321278154 | 7 | public String toString() {
String sql = "REPLACE "+table;
if(expressions != null && columns != null ) {
//the SET col1=exp1, col2=exp2 case
sql += " SET ";
//each element from expressions match up with a column from columns.
for (int i = 0, s = columns.size(); i < s; i++) {
sql += ""+columns.get(... |
39cd47db-3a82-4b9d-9926-d04fec4be487 | 4 | public int get(int x, int y) {
if (x < 0 || y < 0 || x > 3 || y > 3) throw new IllegalArgumentException("The position must be on range");
return this.board[x][y];
} |
b4cbe4c7-2222-4881-b17d-a940ecb77088 | 9 | public boolean equals (Object o) {
if (!(o instanceof Argument))
return false;
Argument a = (Argument)o;
return
((a.arg_label == arg_label) ||
(a.arg_label != null && a.arg_label.equals(arg_label))) &&
((a.mod_label == mod_label) ||
... |
6ea24bfb-cfe5-4eeb-8f02-aaee2e24a865 | 7 | public boolean isPreselectionValid(final SettingsData settingsData) {
if(settingsData.getObjects().size() != 1){
_tooltipText = "Genau ein Objekt muss ausgewählt sein.";
return false;
}
if(settingsData.getObjects().get(0) instanceof ClientApplication
&& (settingsData.getAttributeGroup() == null || sett... |
7004030d-0071-4cf8-9955-026db8effc2c | 2 | public void visitIntInsn(final int opcode, final int operand) {
if (opcode == SIPUSH) {
minSize += 3;
maxSize += 3;
} else {
minSize += 2;
maxSize += 2;
}
if (mv != null) {
mv.visitIntInsn(opcode, operand);
}
} |
b20c6831-03f1-4936-8e2c-c4a2836b5552 | 2 | public boolean isAccepted()
{
Iterator it = myConfigurations.iterator();
while(it.hasNext())
{
MealyConfiguration config = (MealyConfiguration) it.next();
if(config.isAccept())
return true;
}
return false;
} |
0c146bb3-d5db-42b6-aeca-2a53153b25a2 | 9 | private void field_sit_frente_ivaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_sit_frente_ivaFocusLost
if((field_sit_frente_iva.isEditable())&&(validar.isInt(field_calle.getText()))){
boolean es_componente=false;
//voy a preguntar si la componente que me saco el foco ... |
c7e58f88-1aac-4068-b294-d51239bf7c29 | 4 | private byte[] fetchClassFromFS(String path) throws FileNotFoundException, IOException {
InputStream is = new FileInputStream(new File(path));
// Get the size of the file
long length = new File(path).length();
if (length > Integer.MAX_VALUE) {
// File is too large
}... |
86158a09-e3ff-4905-a954-0f706b7f53a9 | 8 | public static <T, S> void selectGroupedFields(CriteriaBuilder cb,
CriteriaQuery<S> criteria, Root<T> root, List<String> group) {
List<Selection<?>> listSelection = new ArrayList<Selection<?>>();
if (group != null) {
for (String currentVal : group) {
/**
* separate field and function
*/
Strin... |
4526962e-b3a8-463c-b981-2174c9b7dcc7 | 5 | public static List<Measurement> loadMeasurements(Mouse mouse)
{
ArrayList<Measurement> measurements = new ArrayList<>();
try (BufferedReader measurementReader = new BufferedReader(
new FileReader(mouse.getFileName())))
{
String measurementString;
while ((measurementString = measurementReader.readLine()... |
41862cbb-4643-4f73-9b4f-d938632b8336 | 3 | @Override
public void itemStateChanged(ItemEvent e) {
//To change body of implemented methods use File | Settings | File Templates.
if (e.getStateChange() == ItemEvent.SELECTED) {
Object item = e.getItem();
// do something with object
if(item instanceof Persoon) {... |
28682e06-efd1-47c8-acc7-e3eae394ed21 | 4 | public com.novativa.www.ws.streamsterapi.Trade[] getTrades() throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[3]);
... |
d9917678-148e-41d1-b11e-3a97c016bce4 | 2 | @SuppressWarnings("deprecation")
public static void createPet(LivingEntity e, UUID toFollow) {
try {
Object nms_entity = ((CraftLivingEntity) e).getHandle();
if (nms_entity instanceof EntityInsentient) {
PathfinderGoalSelector goal = (PathfinderGoalSelector) goalSelector.get(nms_entity);
PathfinderGo... |
3c57545d-b9db-489d-9fd3-9c8dbcfcedc9 | 1 | public static Type getObjectType(final String internalName) {
char[] buf = internalName.toCharArray();
return new Type(buf[0] == '[' ? ARRAY : OBJECT, buf, 0, buf.length);
} |
e36c0907-72ed-4c62-aad3-6f2000ef8ca9 | 2 | public CommandLineMode(String propertyFileName, Controller controller){
this.controller = this.controller;
try {
controller.loadPropertiesFromFile(new File(propertyFileName));
int width = controller.getPanelWidth();
int height = controller.getPanelHeight();
... |
71c1c4e9-a254-44cc-9144-27d8e09b1962 | 6 | public void Loading(){
ServerUp=true;
isPainted=false;
while(ServerUp){
repaint();
try{Thread.sleep(OPTIMAL_TIME/1000000);}catch (Exception e) {}
if(isServer&&sendMap){
server.sendData(("2 "+Main.mapaS+" ").getBytes());
}
if(!isServer) client.sendData("1 ".getBytes());
if... |
bfc77323-5413-4fc2-9833-e2fceff9a0eb | 8 | private JPanel buildButtons() {
JPanel panel = new JPanel(new BorderLayout());
panel.setMaximumSize(new Dimension(2000,50));
JButton deleteButton = new JButton("Delete");
deleteButton.setFocusable(false);
deleteButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEv... |
07fc2f16-d822-494d-a25a-68d801d5bf6d | 4 | @Override
void handleInput(Input input, boolean isMousePressed) {
if (input.isKeyPressed(Input.KEY_ENTER) && !hasMadeChoice()) {
makeChoice(selectedChoice);
}
int numberOfButtons = choiceButtons.getNumberOfButtons();
if (input.isKeyPressed(Input.KEY_RIGHT)) {
selectedChoice = (selectedChoice + 1) % numb... |
4bcf03e3-037b-46d0-b58d-6428b23f680e | 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 fe... |
6fc21b12-ba6d-479d-b060-35524ca87e36 | 3 | public ArrayList<Tayte> haeFantasiaTaytteet(int tayteId1, int tayteId2, int tayteId3, int tayteId4) throws DAOPoikkeus {
ArrayList<Tayte> fantasiataytteet = new ArrayList<Tayte>();
// Avataan yhteys
Connection yhteys = avaaYhteys();
try {
// Haetaan tietokannasta täytteet Fantasiapizzaa varten
... |
edb35d05-9427-4ae8-afc0-eca9cb7451aa | 4 | public void validateForFile(ScriptRunner pScriptRunner, PromotionFile pPromotionFile)
throws ExPromote {
List<Closeable> lStreamsToClose = new ArrayList<Closeable>();
try {
for(ScriptExecutable lExecutable : mExecutableList){
if(lExecutable instanceof ScriptSQL){
//If this fails an... |
77298a4a-a4ec-4da6-9065-ae6d64ab53ee | 4 | public void hit(Entity e, Level level)
{
if (e instanceof CoinEntity)
{
CoinEntity ce = ((CoinEntity) e);
if (!ce.collected)
{
score++;
Sound.coin.play();
ce.collected = true;
}
}
if (e instanceof SoildEntity)
{
health--;
System.out.println(health);
System.out.println(MAX_HEA... |
330b33ed-1713-4263-8c34-eec9cefa3dfa | 5 | private static void doFind() throws MVDToolException
{
try
{
char[] pattern = new char[findString.length()];
findString.getChars(0,pattern.length,pattern,0);
if ( pattern.length > 0 )
{
MVD mvd = loadMVD();
BitSet bs = new BitSet();
if ( version == 0 )
{
for ( int... |
5d21d6e7-a886-43b8-a1b2-10e8764ef2e9 | 5 | private int getfittestParticle(Vector<Integer> particles) {
if(maximum){
double fitness = solutionFitness.get(particles.get(0));
int result = particles.get(0);
for(int i = 1; i < particles.size(); i++){
double temp = solutionFitness.get(particles.get(i));
if(temp > fitness){
fitness = temp;
... |
6c5c66e9-5e2a-4bfb-bca4-a143f756ab31 | 4 | public static void main(String[] args) {
TalkToMe ttm;
if (args.length != 0 && args[0].equalsIgnoreCase("g")) {
ttm = new TalkToMe(args);
try {
ttm.readFile(ttm.filename);
} catch (Exception ex) {
ttm.guiMode.setMsgToChat(ERROR_READ_FIL... |
bfd7e4a0-8c9c-46f6-9509-bd48622638b5 | 6 | public void initialize() {
setLayout(new MigLayout("wrap 1", "", ""));
add(question, "wrap 20");
int recruitPrice = 0;
Player player = getMyPlayer();
if ((getGame() != null) && (player != null)) {
int production = 0;
for (Colony colony : player.getColo... |
3ae11d04-0d6b-4d82-9970-3d6fc47f159d | 0 | public void actionPerformed(ActionEvent e) {
beginQuit();
} |
a86de31a-6cc2-4e99-a4a5-0ab5a7e7709b | 7 | public void print(Byte[] jeu){
for (int i=0; i < 37; i++){
if (i==4 || i==9 || i==15 || i==22 || i==28 || i==33)
System.out.println();
System.out.print(jeu[i]);
}
System.out.println();
} |
4c4767e0-254f-4e97-ae4b-c757d4cb5334 | 2 | public boolean promoteUser(String name){ //op a user by name
UserAccount user = users.get(name.toLowerCase()); if (user==null) return false;
user.setIsAdmin(true);
if (user.getThread()!=null) user.getThread().send("You are now op!");
return true;
} |
9d35c174-4545-4d37-89ff-16b033504fff | 5 | @Override
protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(field.id);
if (setField != null) {
switch (setField) {
case TITAN_ID:
... |
dd71df52-c77b-471e-96a7-10f83d5ec568 | 2 | @Override
public void main() {
cleanOutput();
List<String> list = new ArrayList<String>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
Iterator<String> it = list.iterator();
String s;
while(it.hasNext()) {
s = it.next();
if (s.equals("4")) {
it.remove... |
238185b5-121a-4cad-a0e5-599e7997670b | 6 | public void stop() {
if (isMovingRight() == false && isMovingLeft() == false) {
playerSpeedX = 0;
}
if (isMovingRight() == false && isMovingLeft() == true) {
moveLeft();
}
if (isMovingRight() == true && isMovingLeft() == false) {
moveRight();
... |
91867066-172c-483a-8fea-738427e310a4 | 6 | private static void createAndShowGUI() {
//Check the SystemTray support
if (!SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return;
}
final PopupMenu popup = new PopupMenu();
// Create a popup menu components
Men... |
c13b9234-030c-48ab-a5bd-a50e750a8b6b | 0 | public String getCode() {
return code;
} |
027e6ba0-88aa-421d-8f4d-db7beeceaae9 | 7 | public static String computeCommonLispFileExtension(Keyword type) {
if (!(Stella.runningAsLispP())) {
throw ((StellaException)(StellaException.newStellaException("Shouldn't call COMPUTE-COMMON-LISP-FILE-EXTENSION unless running in Lisp").fillInStackTrace()));
}
{ String suffix = null;
if (type ... |
5f8983ae-bec5-4e52-adc5-f3543fc18b39 | 9 | public static BufferedImage rotate(BufferedImage src, Rotation rotation) throws IllegalArgumentException,
ImagingOpException {
long t = System.currentTimeMillis();
if (src == null)
throw new IllegalArgumentException("src cannot be null");
if (rotation == null)
throw new IllegalArgumentException("rotatio... |
eb535e47-0693-4126-8b61-45ef78329dd9 | 5 | public static String readFile2(String file) throws IOException{
//System.out.println("path : " + path + " reading...");
Watch t = new Watch();t.start();
System.out.println("read......");
String sJSON = "";
Path path = Paths.get(file);
List<String> text =Files.readAllLines(path,StandardCharsets.UTF_8);
... |
5ce4e222-2ec8-4507-a111-e307dc403855 | 1 | public void broadcastPQ(final BigInteger p, final BigInteger q,
final int numUsers) throws InterruptedException, IOException {
final Subscription pqSub = elvin.subscribe(NOT_TYPE + " == '"
+ BROADCAST_PQ_REPLY + "' && " + GAME_ID + " == '"
+ gameHost.getID() + "'");
Notification pqnot = new Notification... |
f4417cf2-1e5a-42aa-9821-779c75776ce9 | 1 | public float median() {
Collections.sort(data);
if (data.size() % 2 == 0) {
return (data.get(data.size() / 2 - 1) + data.get(data.size())) / 2;
}
return data.get(data.size() / 2);
} |
66191ecc-781f-4635-9735-d0849a69a2fa | 2 | public KiesOnderwerp(Spel spel) {
setBounds(0, 0, 773, 318);
setLayout(new MigLayout("", "[100px:100px:100px,grow][700px,grow][100px:100px:100px]",
"[173.00px][150.00][150px][173.00px,grow]"));
/**
* De titel "Kies een onderwerp"
*/
JLabel lblNewLabel = new JLabel("Kies een onderwerp");
lblNewLabel... |
746a3f9f-80da-43ed-9f7a-c43d17a3220e | 3 | /* */ public static String excutePost(String targetURL, String urlParameters)
/* */ {
/* 54 */ HttpURLConnection connection = null;
/* */ try
/* */ {
/* 57 */ URL url = new URL(targetURL);
/* 58 */ connection = (HttpURLConnection)url.openConnection();
/* 59 */ connection.se... |
112289bd-564b-4e3f-a09a-2a43016517c8 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Timing that = (Timing) o;
if (Double.compare(that.ioResponseTime, ioResponseTime) != 0) return false;
if (Double.compare(that.worstReadeTime, w... |
19234abf-d90a-411e-a1a0-5a33ead58017 | 2 | public Plateau()
{
this.plateau = new EtatDesCases[LONGUEUR_DE_LA_MAP][LARGEUR_DE_LA_MAP];
for (int indiceParcoursLongueurMap=0; indiceParcoursLongueurMap<LONGUEUR_DE_LA_MAP; indiceParcoursLongueurMap++)
for (int indiceParcoursLargeurMap=0; indiceParcoursLargeurMap<LARGEUR_DE_LA_MAP; indiceParcoursLargeurMap++... |
2ec5592b-eef1-4ec6-8eeb-ee2f6d129ed9 | 9 | private static List<? extends Tuple> toList(Object[][] table) {
List<Tuple> list = new ArrayList<>(table.length);
for (Object[] aTable : table) {
List<Value> row = new ArrayList<>(aTable.length);
for (Object val : aTable) {
if (val instanceof DataType) {
... |
b3a4f970-d490-4065-9fa4-9bdd60241f0c | 9 | public void writeResultFile() {
try {
FileWriter fstream = new FileWriter(resultFile);
StringBuilder sb = new StringBuilder();
BufferedWriter out = new BufferedWriter(fstream);
sb.append("StartNr; Namn; ");
if(!(driverAttributes == null) && !driverAttributes.isEmpty()){
for(int i = 0; i < driverAtt... |
279a5f4d-1cac-48f6-b118-4f0827394597 | 2 | public void addValue(double dist, Object value) {
// If there is still room in the heap
if (values < size) {
// Insert new value at the end
data[values] = value;
distance[values] = dist;
upHeapify(values);
values++;
}
// If there is no room left in the heap, and the new entry is lower
... |
35880125-7169-43d1-9ecc-ccc8bdbbffc9 | 0 | public int getForce() {
return force;
} |
f8cf743a-001a-4a6c-a012-c48b46ed5121 | 0 | @BeforeClass
public static void initServices() throws Exception
{
ServiceManager.getServices().initializeServices(
new Object[] { new TestRailwayRepository()});
} |
d6f17d9a-1fc5-44e1-92c8-0524fc90756e | 4 | public static final float atan2(float y, float x) {
float add, mul;
if (x < 0) {
if (y < 0) {
y = -y;
mul = 1;
} else
mul = -1;
x = -x;
add = -3.141592653f;
} else {
if (y < 0) {
y = -y;
mul = -1;
} else
mul = 1;
add = 0;
}
float invDiv = 1 / (((x < y) ? y : x) * I... |
e4f8a45f-49bd-4bbb-ab60-db8aac5c7cd8 | 9 | @Override
protected List<Chromosome> filter(List<Chromosome> children) {
List<Chromosome> newChildren = new ArrayList<Chromosome>();
int repeats = 0;
// Remove children which are too similar
for (Chromosome c : children) {
boolean unique = true;
for (Chromosome c2 : children) {
if (c == c2) continue;... |
474f6cef-d07a-4524-bf99-68b985d47c9e | 1 | public void setMaxCapacity(int maxCapacity) throws CarriageException {
if (maxCapacity >= 0) {
this.maxCapacity = maxCapacity;
} else {
throw new CarriageException("Maximum capacity is under zero");
}
} |
e672302a-4cab-413f-b47b-a604a4362aa5 | 7 | public Problem11(){
loadData();
for(int x1 = 0; x1<20;x1++){
for(int y1=0;y1 < 20;y1++){
if(grid[x1][y1] > 0){
long dow = down(x1,y1);
long acc = across(x1,y1);
long dia1 = diagP(x1,y1);
long diaN = diagN(x1,y1);
long highest1 = (dow > acc)?dow:acc;
long highest2 = (dia1 > ... |
f504633c-2282-441c-8aa3-643ff05f600a | 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 Article)) {
return false;
}
Article other = (Article) object;
if ((this.articleID == null && other.articleID !=... |
6ffe2890-6304-4e1e-9b8e-1861a8a222a4 | 7 | public static void preE(Topic root) {
// Fetching the edge set for the topic
ArrayList<SparseMatrix> getset = root.Get_edgeset();
//System.out.println("Edge size" + getset.size());
// Fetching the Max word it of the topic
Integer MaxWordId = root.Get_Maxwordid();
// Fetching the edge weight acros... |
f9dcc1d0-91c6-41fd-86e8-02c533a38c21 | 7 | public Instance convertInstance(Instance instance) throws Exception {
if (m_s == null) {
throw new Exception("convertInstance: Latent Semantic Analysis not " +
"performed yet.");
}
// array to hold new attribute values
double [] newValues = new double[m_outputNumAtt... |
27f4355e-0f50-4d68-b410-199b7f82e7f4 | 3 | public void printMatrix() {
// Column attributes stuff
System.out.println(columnAttributes);
System.out.println();
// Column names
for (int i = 0; i < getNumCols(); i++) {
System.out.printf("%15s", columnAttributes.get(i).getName());
}
System.out.pri... |
4ff15c84-808a-4723-ba57-c91d6ce98f07 | 5 | @SuppressWarnings("unchecked")
private void readFile() {
FileInputStream
gfis = null,
gcfis = null;
ObjectInputStream
gois = null,
gcois = null;
try {
gfis = new FileInputStream(goodsURL);
gcfis = new FileInputStream(goodsClassURL);
if(gfis.available() > 0) gois = new ObjectInpu... |
5ac32221-d697-49cc-9d2e-c773c51fdb08 | 2 | public Match requestNextMatch(int userID) {
alstNewMatchRequests.add(userID);
int userCount = 0;
for (Team team : playmode.getTeams()) {
userCount += team.getUser().length;
}
Match nextMatch = upcomingMatches.peek();
if((alstNewMatchRequests.size() - alstLeftUser.size()) == userCount){
nextMatch(userI... |
89a50938-c1e3-4278-9e9a-6235a654a5ce | 3 | public static String coverttoText(String rtfText) {
byte[] rtfBytes = rtfText.getBytes();
RTFEditorKit rtfParser = new RTFEditorKit();
Document document = rtfParser.createDefaultDocument();
try {
rtfParser.read(new ByteArrayInputStream(rtfBytes), document, 0);
} catch (IOException e) {
// TODO Auto-gene... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.