method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
308744ba-f4dd-435e-876b-3457e0add320 | 9 | public void use(ArrayList<Choice> choices, Game game) {
Player p = game.getCurrentPlayer();
boolean found = false;
for (int i = 0; i < p.hand.size(); i++) {
if (p.hand.get(i) instanceof Wound && !found) {
p.hand.remove(i);
this.draw += 1;
for (int j = 0; j < game.getOpponents().size(); j++) {
... |
edfd95b8-dcd0-4ecd-9fb8-6afac140cbca | 1 | public void addID(MusicObject obj) {
if (!this.duplicateID.containsKey(obj.getUid())) {
duplicateID.put(obj.getUid(), obj);
}
} |
a9806188-5735-47d8-92a2-e57104a5ec15 | 1 | public void update(){
if (life.isOver()){
dead = true;
}
} |
0766d044-55b0-40f2-b5e4-e87d2910f99b | 3 | public NoInterference() {
super(false);
if(firstTime && Configuration.interference && Configuration.showOptimizationHints) {
Main.warning("At least some nodes use the 'NoInterference' interfernce model. " +
"If you do not consider interference at all in your project, you can " +
"... |
fca013f2-bd11-41ff-a464-7c57d871e0cd | 1 | @Test
public void string_test() {
try{
double []vec1= {1.0,2.0};
String result= Vector.toString(vec1);
String expected=" 1.0\n 2.0\n";
Assert.assertEquals(result,expected);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemen... |
9777c319-671d-49ae-a90d-a28338e7b2f8 | 4 | public void onDisable() {
if (abm != null) {
abm.setGo(false);
}
if (fc != null) {
fc.setGo(false);
}
if (pg != null) {
pg.setGo(false);
}
if (ss != null) {
ss.setGo(false);
}
log.info(name + "DISABLED!");
} |
453da00d-e91d-4de7-b7d9-74e620126369 | 0 | @Override
public void onStringInput(String input) {
System.out.println("Your name is: " + input);
} |
73a39509-64ea-4208-b7e0-a1f1064cbc43 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Customer customer = (Customer) o;
if (zip != customer.zip) return false;
if (city != null ? !city.equals(customer.city) : customer.city != null... |
ff3fa5b8-b938-490d-906e-259e373bceba | 0 | private static int extractReminder(int number, int divisor, ArrayList<Integer> resultByDigits, ArrayList<String> pseudographics) {
int integerDivision;
int reminder;
int subtrahend;
integerDivision = number / divisor;
resultByDigits.add(integerDivision);
subtrahend = integerDivision * divisor;
pseudograp... |
75c94af6-75cc-4f9b-bd4c-88776a24da2f | 9 | private Method findMethod(Object base, String name, Class<?>[] types, int paramCount) {
if (types != null) {
try {
return findAccessibleMethod(base.getClass().getMethod(name, types));
} catch (NoSuchMethodException e) {
return null;
}
}
Method varArgsMethod = null;
for (Method method : base.get... |
9dea4edc-ce21-47f0-840c-821753e6cf19 | 8 | protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_ClustererEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst ... |
a8c241da-0ba8-415e-8e7e-c9f9171f03b8 | 7 | @RequestMapping(value = "addTask", method = RequestMethod.POST)
public @ResponseBody
TodoTask addTask(@RequestParam String title, @RequestParam String content,
@RequestParam String targetTime, @RequestParam Integer priority,
@RequestParam Integer list, WebRequest webReq... |
7beb9c4d-5bc3-4d43-bb45-c6a99015b92e | 4 | private boolean vaikuttaaOlevanOikeassaMestassa()
{
Tetrimino aave = aavetetrimino.tetrimino();
ArrayList<Palikka> palikat = new ArrayList<Palikka>( tetrimino.palikkakokoelma().palikat() );
Iterator<Palikka> alkuperaisesta = palikat.iterator();
for(Palikka aaveesta ... |
547416c7-347e-4fc2-abe4-af0314ebe302 | 5 | @Override
public void service(AgiRequest request, AgiChannel channel) throws AgiException {
try {
// Answer the channel...
this.answer();
// retrieve a non-existent filename
String fileName;
int name;
do {
name = Math.abs(this.random.nextInt());
fileName = EPursuit.properties.getProperty("... |
84cc2ac3-a70f-4b00-8252-28344ca275f4 | 3 | private boolean isInheritable(int mod, CtClass superclazz) {
if (Modifier.isPrivate(mod))
return false;
if (Modifier.isPackage(mod)) {
String pname = getPackageName();
String pname2 = superclazz.getPackageName();
if (pname == null)
return ... |
c1ef8086-abee-4af2-bd63-aac1cc422b70 | 7 | public void run() {
while (r != null && !this.isInterrupted()) {
try {
StringBuilder sb = new StringBuilder();
String pac = r.readUTF();
if (pac != null && pac.startsWith("pac")) {
sb.append(pac);
if (!pac.endsWith("ket")) {
String stack;
do {
stack = r.read... |
0f214c0f-b4d2-438e-b338-1f946fec80dc | 7 | private String getTerm(ActivityType activity) {
switch(activity) {
case BREAK:
return termBreak;
case PLACE:
return termPlace;
case TRAVEL:
return termTravel;
case CHAT:
return termChat;
case ANIMAL:
return termAnimal;
case MONSTER:
return termMonster;
case PLAYER:
ret... |
503a084f-af7c-4d52-9010-9c10b326c22c | 4 | private static int hexValue(char c)
{
if ((c >= '0') && (c <= '9'))
return (int) (c - '0');
if ((c >= 'A') && (c <= 'F'))
return ((int) (c - 'A')) + 0x0A;
throw new NumberFormatException();
} |
b05fe68e-3992-4890-9fed-12e41a04bbc9 | 4 | @SuppressWarnings("unchecked")
public static void writeLinesSorted(String file, ArrayList<?> uniWordMap,
ArrayList<?> uniWordMapCounts, int flag) {
// flag = 0 decreasing order otherwise increasing
HashMap map = new HashMap();
if (uniWordMap.size() != uniWordMapCounts.size()) {
System.err.println("Array si... |
2e69385c-142f-4614-8fc4-dafe9524bae0 | 1 | private void renderItemList() {
for (int i = 0; i < items.size(); i++)
renderItemOption(i, items.get(i), new Position(10, 50 + (i * 60)));
} |
51566280-6e13-4853-ad4f-5909e9e77e47 | 2 | public String getNthSegment(int n){
if(n == 0){
return operator;
} else if(segments.size() < n){
return null;
} else {
return segments.get(n-1);
}
} |
915ac9f4-8682-4d3d-ad20-64fff113d387 | 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... |
8a98c5ac-7e7e-4fba-9220-c8a713a408c1 | 0 | public static void cantPlace(String place) { System.out.printf("\"%s\"には置けません!\n", place); } |
67ee9a81-ce52-4423-9bc2-1358c62f14df | 0 | public void setBranchLeaderList(final List<BranchLeader> branchLeaderList) {
this.branchLeaderList = branchLeaderList;
} |
1e42bed6-6f2b-40a5-8c19-cf83e3289775 | 7 | public void testConstructor_int_int_int_int_int_int_int() throws Throwable {
LocalDateTime test = new LocalDateTime(2005, 6, 9, 10, 20, 30, 40);
assertEquals(ISO_UTC, test.getChronology());
assertEquals(2005, test.getYear());
assertEquals(6, test.getMonthOfYear());
assertEquals(9... |
653fcee0-10e6-4ab8-85a7-3e4fa10a9bb5 | 6 | public String[] getAvailableStyle() {
if (fontList != null) {
String[] availableStyles = new String[fontList.size()];
Iterator nameIterator = fontList.iterator();
Object[] fontData;
int decorations;
String style = "";
for (int i = 0; nameIt... |
79c668ad-48eb-460b-9b1e-608a8d894bc5 | 0 | public Node(String data){
this.data = data;
} |
3f03bf3b-06e4-4887-ac81-d7c9624d6e12 | 0 | public final void setWrapWidth(double wrapWidth) {
this.wrapWidth.set(wrapWidth);
} |
d33e962e-437d-44ef-94a8-a59e1f8cce3c | 0 | public String getDescription() {
return description;
} |
befaf287-3f00-46ed-9fe1-9418a221d77c | 5 | public int reverse(int x) {
int abs = x < 0 ? -x : x;
long result = 0;
while (abs > 0) {
result = result * 10 + abs % 10;
abs = abs / 10;
}
result = x < 0 ? result * -1 : result;
if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) {
... |
45653308-2424-4eaa-ada5-f83ecaca6cdf | 5 | private void showBoard(boolean activate) {
for (int row = 0; row < 8; row++)
for (int column = 0; column < 8; column++){
Position position = new Position(row,column);
if (board.isEmpty(position))
add(new EmptyTile((row+column)%2==0 ? Boar... |
ac41598b-6dd0-4cbe-bd3b-e9d7531481d1 | 4 | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
// If the NamespaceManager state is already set up from the
// context of the task creator the current namespace will not
// be null. It's important to che... |
476211a8-2698-4e0a-99bb-7981251bb659 | 7 | @Override
public void run() {
int fillPerLoop = 256;
for (int i=0; i<BUFFER_LENGTH; i+=fillPerLoop) {
mInput.read(backupBuffer, i, fillPerLoop);
}
double[] temp = new double[BUFFER_LENGTH];
for (int i=0; i<BUFFER_LENGTH; i++) {
temp[i] = backupBuffer[i];
}
FastFourierTransformer fft = new... |
f3e6f223-f34d-4633-998a-90fc61249edc | 1 | public Gui(){
picLabel=new JLabel(new ImageIcon("img/bg.jpg"));
this.add(picLabel);
picLabel.setLayout(new GridBagLayout());
loginPanel = new JPanel(new GridBagLayout());
loginPanel.setPreferredSize(new java.awt.Dimension(800, 600));
GridBagConstraints c = new GridBagConstraints();
if (should... |
4abdbf7d-4963-4831-8851-6534304342b3 | 6 | @EventHandler
public void onTagApi(PlayerReceiveNameTagEvent event){
Player player = event.getNamedPlayer();
String[] groups = ApiLayer.getGroups("world", CalculableType.USER, player.getName());
if(groups.length == 0){
return;
}
if(groups[0].equalsIgnoreCase("New")){
return;
}else if(groups[0].equ... |
bce93e00-0110-4653-9d42-5fc7f0551d2d | 1 | public synchronized boolean add(Object obj) {
boolean retVal = false;
if (!isFull()) {
queue.addElement(obj);
retVal = true;
}
return retVal;
} |
b60fa214-62cc-4e89-b565-202c3cb4648c | 8 | public String toString() {
final StringBuffer buf;
Class<?> target;
buf = new StringBuffer();
buf.append(this.getClass().getName());
buf.append("\n");
target = this.getClass();
while (target != Object.class) {
Field[] fields;
int i;
... |
4894be17-1028-4971-8adc-0db4f74d9c31 | 2 | public void checkCbolOriginalDir() {
Path dir = Paths.get(CBOL_HOME);
//
//http://docs.oracle.com/javase/tutorial/essential/io/dirs.html
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
for (Path file : stream) {
System.out.println(file.ge... |
3078e760-cfd0-4335-878d-56f5f159f2a8 | 0 | public OSCByteArrayToJavaConverter() {
} |
931028e2-10ff-4c0e-8792-5217a0588804 | 7 | public String toString()
{
//Print the Process ID and process state (READY, RUNNING, BLOCKED)
String result = "Process id " + processId + " ";
if (isBlocked())
{
result = result + "is BLOCKED for ";
//Print device, syscall and addre... |
45170fa5-e625-425d-8231-3f38850b4e78 | 6 | public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{
if (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0)
{
return;
}
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
if (var6 == null)
{
... |
c8b042a3-7817-4391-a40e-b7fc3834526c | 5 | public static File findMinecraftFolder() {
final String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("win") >= 0) {
return new File(System.getenv("APPDATA"), ".minecraft");
} else if (os.indexOf("mac") >= 0) {
return new File(System.getProperty("user.home"),
"Library/Application Sup... |
2f97c4ba-bb74-4b06-82fa-553101625946 | 9 | private boolean r_mark_suffix_with_optional_n_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 132
// or, line 134
lab0: do {
... |
d18cd309-b926-4e8e-b220-40beebf930ed | 7 | protected void importInput(String section, Engine engine) throws Exception {
BufferedReader reader = new BufferedReader(new StringReader(section));
reader.readLine(); //ignore first line [InputX]
InputVariable inputVariable = new InputVariable();
engine.addInputVariable(inputVariable);
... |
f0d02253-630b-4ea2-a43b-ef1b8d745b16 | 4 | @Test
public void testGetMessageNoUnexpectedMessages() {
try {
int noOfMessages = 2;
final String message = "TestMessage-testGetMessage_OneSubscriber";
final CountDownLatch gate = new CountDownLatch(1);
final AtomicInteger msgCount = new AtomicInteger(0);
final Message expected = new MockMessage(messa... |
c81f6a6f-d382-4e92-9e9d-519460058742 | 6 | public static String escape(String text, char escapeChar, char[] reserved) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
// Is the char reserved
boolean isReserved = false;
if (reserved != null) {
for (int j = 0; j < reserved.leng... |
6aaebcde-1a05-49c7-a9f9-92a894204e20 | 1 | public boolean contains(int index, int val) {
if (adj[index].contains(val)) { return true;}
else return false;
} |
adc8a4c9-255b-4899-804f-2b79b37a6b72 | 8 | private void checkForPrompt()
{
// Text has been entered, remove the prompt
if (document.getLength() > 0)
{
setVisible( false );
return;
}
// Prompt has already been shown once, remove it
if (showPromptOnce && focusLost > 0)
{
setVisible(false);
return;
}
// Check the Show property... |
cef6c477-7476-4e00-b9c3-f7f5a683e5ca | 0 | public void setPcaSubgru(Integer pcaSubgru) {
this.pcaSubgru = pcaSubgru;
} |
860c9b64-4b7d-416c-b4c2-587c222af610 | 8 | public static boolean isMaskActive( InputMask mask )
{
switch ( mask )
{
case CONTROL_MASK:
return Keyboard.isKeyDown( Keyboard.KEY_LCONTROL ) || Keyboard.isKeyDown( Keyboard.KEY_RCONTROL );
case MENU_MASK:
return Keyboard.isKeyDown( Keyboar... |
60253840-cb0f-4735-9b68-97138fa96857 | 1 | public void testWithDurationBeforeEnd3() throws Throwable {
Duration dur = new Duration(-1);
Interval base = new Interval(TEST_TIME_NOW, TEST_TIME_NOW);
try {
base.withDurationBeforeEnd(dur);
fail();
} catch (IllegalArgumentException ex) {}
} |
3f514a2c-91a3-490f-a0ac-f15d1c9cb635 | 6 | * @return
*/
public Condfmt createCondfmt( String location, WorkBookHandle wbh )
{
Condfmt cfx = (Condfmt) Condfmt.getPrototype();
int insertIdx = win2.getRecordIndex() + 1;
BiffRec rec = (BiffRec) SheetRecs.get( insertIdx );
while( (rec.getOpcode() != HLINK) &&
(rec.getOffset() != DVAL) &&
(rec.get... |
f8470a37-c5aa-4cb3-b7c7-f2d944967824 | 8 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... |
bb1f47d3-c838-4336-9ea6-6da1623756ed | 4 | private static void Mergeforcemethod(int i, int n) {
// TODO Auto-generated method stub
if((n-i)<100000){
int il=0;
int j=0;
for(il=i;il<n;il++){
for(j=il;j<n;j++){
if (array[il]>array[j]){
total++;
}
}
}
Arrays.sort(array, i, n);
}else{
Mergeforcemetho... |
257ed02f-1ccb-4625-a457-349f2412b367 | 1 | @Test
public void transferInstrMOVE_testInvalidDestinationRegisterRef() { //Checks MOVE instr. not created with invalid register ref.
try {
instr = new TransferInstr(Opcode.MOVE, 5, -1);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr);
} |
3b4dce0e-fd2b-4290-9192-50245061e5f2 | 9 | private int one(String num)
{
switch(num)
{
case "one": return 1;
case "two": return 2;
case "three": return 3;
case "four": return 4;
case "five": return 5;
case "six": return 6;
case "seven": return 7;
case "eight": return 8;
case "nine": return 9;
default: return 0;
}
} |
676d3911-1e44-4f84-9f3a-bc18db75793a | 8 | public void addClientToDialog(String clientId, ClientDialog dialog)
{
System.out.println("Ajout d'un client a un dialog");
try
{
boolean alreadyKnow = false;
ClientServerData clientAdd = null;
System.out.println("On recherche le client");
for (ClientServerData client : this.getClients())
{
if ... |
a2d1403d-f265-4329-a705-a4d9c12e7137 | 5 | private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
// TODO add your handling code here:
liceu.Administrator admin = new liceu.Administrator(usernameProfesor.getText(), parolaProfesor.getText(),ncProfesor.getText(),cnpProfesor.getText(),"Prof... |
32697b7f-1f93-453b-9717-a2dca17ba800 | 3 | private DeclarationList declaration_list(int fallbackLineNumber, int fallbackCharPosition) throws RequiredTokenException
{
enterRule(NonTerminal.DECLARATION_LIST);
ArrayList<Declaration> declarations = new ArrayList<Declaration>();
while(firstSetSatisfied(NonTerminal.DECLARATION))
{
declarations.add(declar... |
73569d4f-8c32-44e6-b216-f77477cf9b42 | 1 | public int getIntValue() {
if (this.slider != null) {
return this.slider.getValue();
}
return ((Number) this.spinner.getValue()).intValue();
} |
fe3b870a-15a5-4de9-a840-2fe93c355b5f | 8 | public static int direction(int dx, int dy) {
if (dx < 0) {
if (dy < 0)
return 5;
else if (dy > 0)
return 0;
else
return 3;
} else if (dx > 0) {
if (dy < 0)
return 7;
else if (dy > 0)
return 2;
else
return 4;
} else {
if (dy < 0)
return 6;
else if (dy > 0)
r... |
0f171b46-024f-4a3c-89d2-f8f6d751fdf5 | 5 | private void halfFruits(int nfruits) {
int r;
int subset[] = new int[6];
boolean filled = false;
for(int i=0; i < 6; i++) {
boolean unique;
do {
unique = true;
r = (int)(Math.random()*12);
for(int j=0; j < i; j++) {
if(subset[j] == r)
... |
2550acd6-5a1a-46cf-8c30-2d3c3e63f183 | 7 | public byte getMemory(int address, boolean shouldNotify) {
if (shouldNotify && _readObserver != null) {
_readObserver.updateReadMemory(address);
}
if (isCPUMapped(address)) {
return getCPUMappedMemory(address);
} else if (_ppu.isReadMapped(address)) {
... |
445c4836-05f1-4ebd-92c9-dc0160e8c003 | 9 | public ArrayList<Integer> postorderTraversal(TreeNode root) {
ArrayList<Integer> result = new ArrayList<Integer>();
if (root == null)
return result;
Stack<TreeNode> stack = new Stack<TreeNode>();
stack.push(root);
TreeNode prev = null;
while (!stack.empty()) {
TreeNode curNode = sta... |
1a9831d6-82e5-4a99-8f3c-12e3c910a38e | 2 | public DMatrix(int dim, int cls, int num){
samplenum = num;
dimension = dim;
groundcls = new int[samplenum];
knewcls = new int[samplenum];
nnnewcls = new int[samplenum];
test = new int[samplenum];
for(int i = 0; i < samplenum; i++){
groundcls[i] = cls;
knewcls[i] = -1;
nnnewcls[i] = -1;
test[i... |
3967f59d-7aa9-4279-b3c2-38bb101977d0 | 0 | public static void main(String[] args) {
interactInput();
new TwitterCrawler();
} |
9efa6b28-0ff1-4197-99ee-0fc84474665d | 1 | static public Mantenimiento_Modulos instancia() {
if (UnicaInstancia == null) {
UnicaInstancia = new Mantenimiento_Modulos();
}
return UnicaInstancia;
} |
d1734923-1dc8-4155-b6cd-ebeaf0f916ba | 3 | private void loadDates() {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
HashMap<String, String> dates = new HashMap<>();
try {
String query = "select startdatum,releasedatum from spelprojekt where sid=" + selectedSpelprojekt;
dates = DB.fetchRow(query);
... |
aed9eb60-0ca8-40bb-8506-c33cdbc04741 | 5 | public void run() {
if (list.isEmpty()) {
return;
}
Collection<ProxiedPlayer> players = ProxyServer.getInstance().getPlayers();
if (players.isEmpty()) {
return;
}
for(ProxiedPlayer player: players){
for ( String line : list.get(count).split( "\n" ) ) {
player.sendMessage(line)... |
4caafeb7-ae33-4db4-8c1a-646b6e01b7ac | 7 | @Override
public void addPoint(double distance, int index) {
if (distance >= worstDistance)
return;
if (count < capacity)
count++;
int i;
for (i = count-1; i > 0; i--) {
if (distanceIndexArray.get(i-1).distance > distance ||
(distanceIndexArray.get(i-1).distance == distance && distanceIndexArray... |
9ad1ad29-f193-47b3-b45b-2944d1eb6ccd | 4 | private boolean disjointSquare(MoveNode[][] b) {
for(int i = 0; i < boardSize; i++){
for(int j = 0; j < boardSize; j++){
if(!b[i][j].isVisited() && !b[i][j].anyUnvisitedNeghbours())
return true;
}
}
return false;
} |
73c392ac-7514-42e5-8489-6391045d1688 | 5 | private final long method1865(int i) {
long l = System.nanoTime();
long l_0_ = -aLong6169 + l;
if (i != 10)
return -56L;
aLong6169 = l;
if (4999999999L > (l_0_ ^ 0xffffffffffffffffL)
&& -5000000001L < (l_0_ ^ 0xffffffffffffffffL)) {
aLongArray6171[anInt6170] = l_0_;
if ((anInt6168 ^ 0xffffffff)... |
000f8954-b05f-4b2d-b163-9a6f551b2035 | 5 | private void writeROM() {
DataOutputStream out = null; // Used to write out the data to the ROM file
try { out = new DataOutputStream( // Create output stream used to write the ROM file
new FileOutputStream(game)); }
catch (FileNotFoundException e) { Error.fatalError(1); } // 1 -- Cannot write to... |
377b369e-447e-4129-aa00-242c0bb6c4ae | 9 | public static void evalAUC(Dataset dataset)
{
double trainArea = 0, trainPosi = 0, trainRank = dataset.trainCount;
double testArea = 0, testPosi = 0, testRank = dataset.testCount;
double quizArea = 0, quizPosi = 0, quizRank = dataset.quizCount;
Collections.sort(dataset.data, new InstanceComparator());
for(In... |
ea41adf5-767f-43c8-9fdd-c54f712e71d5 | 5 | static String demandeIntermediare(String ip, int port, String question, boolean attCrochets, int nombreMot, int nbIteration, int tmpAttente ) throws UnknownServiceException {
String reponse = "";
int tmp = 0;
while (tmp < nbIteration){
try { reponse = demanderQuestion(ip, port, question, attCrochets, nombreMot)... |
9cb4d115-8504-4282-9e07-05fe76ff985b | 9 | @Override
public void run() {
while((client.isConnected()) && !client.isLogged()) {
client.println(welcomeMessage);
String nick = client.readLine();
if ((nick != null) && (!farewellMessage.equals(nick))) {
if (client.setNick(nick)) {
qu... |
6fb8aabe-ffb2-4a98-a0da-4d677743a216 | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
Connection cx = null;
cx = Conexion.getConexion();
if(cx != null){
JOptionPane.showMessageDialog(null , "exito");
}
... |
6eadddb9-421f-4aa4-84e5-203d1bba6d2f | 4 | public double getData(String ticker) {
try {
URL interWebs = new URL(baseURL + ticker + baseURLend); // create a URL instance of the API
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("149.89.1.30", 3128)); // the proxy in the Stuy computer lab
URLConnection interwebConnect = interWebs... |
b0efce2e-f423-49bb-a928-9d8298f801f5 | 2 | private void HandleLogin() throws IOException {
String line;
String[] parts;
while (true) {
line = in.readLine();
parts = line.split(" ");
if (parts[0].equals("USER")) {
uid = parts[1];
UserControl.addUserIfNotExist(uid);
... |
68f63838-e751-407f-8a3f-d19c09aa4686 | 1 | public Expression simplify() {
if (local.getExpression() != null)
return local.getExpression().simplify();
return super.simplify();
} |
5d7cb349-6a54-4a47-9ffc-3d8dcd490844 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
037d7628-9fa5-463f-9f1a-9e1de4aa69c7 | 8 | @Override
public void actionPerformed(ActionEvent arg0) {
if(arg0.getActionCommand().equals("file")){
JFileChooser chooser = new JFileChooser();
int retval = chooser.showOpenDialog(null);
if(retval == JFileChooser.APPROVE_OPTION){
chooser.setVisible(false);
fileDir = chooser.getSelected... |
5f192be4-59d4-488f-bcc0-92a8e97634c0 | 0 | public ArrayList<Company> getCompanies() {
return Companies;
} |
b7e21d0d-e383-464c-9d0e-3798fa6a8d6a | 3 | private void executeForwardJob(ForwardJob job) throws IOException,
JSchException {
updateable.send(new StatusUpdate("VM " + id + " Executing ForwardJob", id,
VMState.EXECUTING, JobType.FORWARD));
HashMap<Integer, String> files = new HashMap<Integer, String>();
String sessionName = job.getRemoteFileName()... |
b0d01b3d-13b2-4441-8c12-d68590fc0f39 | 9 | void entityDestroyCheck(DownlinkState linkState) {
if(linkState != null) {
if(packetId == 0x1D && linkState.entityIds != null) {
Integer entityId = (Integer)fields[0].getValue();
linkState.entityIds.remove(entityId);
} else if (packetId == 0x32) {
Integer x = (Integer)fields[0].getValue();
Integ... |
d0f1c57c-0eb7-4ec2-94f7-0a3eeb113b84 | 6 | public static boolean methodInlinableP(MethodSlot method) {
if (StandardObject.voidP(method.type()) ||
((method.methodReturnTypeSpecifiers().length() > 1) ||
((BooleanWrapper)(KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_METHOD_VARIABLE_ARGUMENTSp, Stella.FALSE_WRAPPER))).wr... |
38c51a14-b497-452f-ba61-d37183ad417d | 0 | public String getValue() {
return _value;
} |
10358d1e-f626-4683-9533-d7e1d9033c75 | 3 | public int getPointFromPos(Double x, Double y) {
int point;
if (y > HEIGHT/2) {
// flip logic
point = 24 - (int) (x / baseUnit);
point += 2;
if (point > 18) {
point--;
}
} else {
point = (int) (x / baseUnit);
if (point > 6) {
point --;
}
}
return point;
} |
7ae3bc6b-6e17-4020-b13c-0d7f965a4b52 | 6 | public static Router getRouter(String name, LinkedList routerList)
{
if (name == null || routerList == null || name.length() == 0) {
return null;
}
Router router = null;
try
{
Iterator it = routerList.iterator();
while ( it.hasNext() )
... |
69504b25-9341-4add-8da6-368d3b9f155d | 1 | @Override
public double bonusDefense(Territoire t, Peuple attaquant) {
if( t.has(SallePartiel.class) )
return 1.0;
return 0.0;
} |
721f52b1-cab8-48af-b49d-18786244ede5 | 4 | public boolean hasError() {
if (value instanceof ErrorMessage == false) {
return false;
}
ErrorMessage probableError = (ErrorMessage) value;
switch (probableError) {
case EMPTY_STRUCTURE:
case INDEX_OUT_OF_BOUNDS:
case INVALID_ARGUMENT:
return true;
default:
return false;
}
} |
1800fc11-4b30-4cd1-be33-d05515060d76 | 0 | public LambdaPane(AutomatonPane ap) {
super(new BorderLayout());
add(ap, BorderLayout.CENTER);
add(new JLabel(Universe.curProfile.getEmptyString()+"-transitions are highlighted."),
BorderLayout.NORTH);
ArrowDisplayOnlyTool tool = new ArrowDisplayOnlyTool(ap, ap
.getDrawer());
ap.addMouseListene... |
60c129a8-cca3-4e91-9fcb-2292e773ad0c | 1 | public static void revalidateImmediately(Component comp) {
if (comp != null) {
RepaintManager mgr = RepaintManager.currentManager(comp);
mgr.validateInvalidComponents();
mgr.paintDirtyRegions();
}
} |
f28ae19d-0600-403e-90ec-dff10c4508b4 | 6 | public static Boolean compareArgLists(Map<String, Object> args1, Map<String, Object> args2)
{
if (args1 == null && args2 == null)
return true;
if (args1 != null) {
for (Map.Entry<String, Object> arg : args1.entrySet()) {
if (args2 != null) {
if (!args2.containsKey(arg.getKey()))
return false... |
a0662439-c855-47d9-a4ea-509dc67efb8d | 7 | public Integer kthToLast(int k)
{
if (k <= 0 || head == null)
throw new IllegalArgumentException("There is no such element.");
Node runner = head;
Node pointer = head;
int counter = 1;
for (; runner.next != null && counter < k; counter++)
{
runner = runner.next;
}
if (counter < k && runner.next =... |
a721d9ab-96fd-4a11-884f-705145cb030d | 0 | public void setIndirizzo(Address indirizzo) {
this.address = indirizzo;
} |
2745a757-9c7d-4745-88d0-a9dc5088d85d | 1 | @Override
public String toString() {
StringBuilder info = new StringBuilder();
info.append("GameScreen :: ")
.append(getName())
.append("\n");
// Iterate over all of the registered game layers and append their
// toString values
for (GameLayer gameLayer : gameLayers.values()) {
info.append(gameLay... |
8a3071a3-6b9b-4fe8-afc0-31232b05d070 | 2 | private void accept(SelectionKey key,Boolean isClusters) throws IOException {
// For an accept to be pending the channel must be a server socket channel.
ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel();
// Accept the connection and make it non-blocking
SocketChannel socketChannel ... |
ed62c991-105b-4b67-9c7a-1585f710ce6a | 7 | public void checkSideCollision(Rectangle rleft, Rectangle rright, Rectangle leftfoot, Rectangle rightfoot) {
if (type != 5 && type != 2 && type != 0){
if (rleft.intersects(r)) {
robot.setCenterX(tileX + 102);
robot.setSpeedX(0);
}else if (leftfoot.intersects(r)) {
robot.setCenterX(tileX + 85);
... |
3e5023c7-a82b-4609-a44b-fbdd422fb8ce | 9 | private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
try{
if (nameOutlet.getText().isEmpty()
|| codeOutlet.getText().isEmpty()
|| priceAOutlet.getText().isEmpty()
|| priceBOutlet.getText().isEmpty()) {... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.