method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d24cfbf9-95a8-4fe2-8462-b08e59088515 | 7 | private void send_with_congestion_control(Packet[] packets) throws InterruptedException
{
boolean recebeu = false;
ArrayList<Integer> acks = new ArrayList<Integer>();
this.sliding_window = 1;
for (int curr_packet = 0; curr_packet < packets.length; curr_packet++)
{
//envia uma janela de pacotes
for (... |
8d707b5f-ea37-4d8d-b48e-bfdef5d3d0dd | 3 | public void visitMonitorStmt(final MonitorStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
stmt.visitChildren(this);
genPostponed(stmt);
if (stmt.kind() == MonitorStmt.ENTER) {
method.addInstruction(Opcode.opcx_monitorenter);
stackHeight -= 1;
} else if (stmt.ki... |
8bc64188-8ed2-4ed9-a247-5d7124bec0b5 | 1 | public static void hypothesizeUnit(GrammarEnvironment env, Grammar g) {
UnitProductionRemover remover = new UnitProductionRemover();
if (remover.getUnitProductions(g).length > 0) {
UnitPane up = new UnitPane(env, g);
env.add(up, "Unit Removal", new CriticalTag() {
});
env.setActive(up);
return;
}
... |
526eb44c-2085-4249-9ed0-50147c2f4f24 | 1 | public static synchronized Singleton getInstance() {
if (instance == null) {
instance = new Singleton();
}
return instance;
} |
e3c6af88-b2df-4c93-a3c8-784b9c82c527 | 3 | private static String getCryptFilterName(PDFObject param) throws IOException {
String cfName = PDFDecrypterFactory.CF_IDENTITY;
if (param != null) {
final PDFObject nameObj = param.getDictRef("Name");
if (nameObj != null && nameObj.getType() == PDFObject.NAME) {
c... |
ca2e8e4a-2ca5-4f3e-94ba-0ed15b3d08ad | 0 | public void setId(String id)
{
this.id = id;
} |
24bc0d85-3630-4345-ab93-edb927801ad3 | 9 | public void remove(Integer k) {
Node<Integer, Integer> x = root, y = null;
while (x != null) {
int cmp = k.compareTo(x.key);
if (cmp == 0) {
break;
} else {
y = x;
if (cmp < 0) {
x = x.left;
... |
0798dc0f-434c-4874-b060-d85b09c38e38 | 0 | protected StringBuffer prepareFile(JoeTree tree, DocumentInfo docInfo) {
//String lineEnding = Preferences.platformToLineEnding(docInfo.getLineEnding());
StringBuffer buf = new StringBuffer();
// write the prelude to data
// TBD
// write the data
//Node node = tree.getRootNode();
//for (int i = 0... |
13e24d28-53d2-4433-8a7c-38008a689d36 | 1 | public void setPrivate(final boolean flag) {
int modifiers = classInfo.modifiers();
if (flag) {
modifiers |= Modifiers.PRIVATE;
} else {
modifiers &= ~Modifiers.PRIVATE;
}
classInfo.setModifiers(modifiers);
this.setDirty(true);
} |
e5a8b705-4bdb-48be-b66a-408049fc7714 | 6 | public boolean parse(Throwable throwable) {
boolean identified = false;
if (throwable.getCause() != null) {
identified |= parse(throwable.getCause());
}
if (throwable instanceof UmbrellaException) {
if (((UmbrellaException) throwable).getCauses() != null) {
for (Throwable subthrowable : ((UmbrellaExce... |
15cdcda1-4544-4b8d-8688-8d1a9de6ca99 | 4 | private void loadEmployerDateFromFile(String employerRepository) {
InputStream is = getInputStreamForFile(employerRepository);
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
try {
XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(is);
while (xmlEventReade... |
26b3043c-25cc-4764-bb08-896c842c009e | 6 | @Override
public void render(Graphics2D g)
{
int textBaseLine = getYI() + fontMetrics.getAscent();
if (showLine)
{
g.setColor(lineColour);
g.drawLine(getXI(), textBaseLine, getXI() + getWidthI(), textBaseLine);
}
if (this.getSelectedText() != "")
{
g.setColor(selectionC... |
b06bc738-bb1b-4643-9260-8030bcc74866 | 3 | private void doUpdateXinWen(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String xinwenId = StringUtil.toString(request.getParameter("xinwenId"));
if(!StringUtil.isEmpty(xinwenId)) {
ObjectMapper mapper = new ObjectMapper();
Map... |
925872d1-119d-40ec-9489-9d56b4552a38 | 9 | @Override
public String stringify(int level) {
ArrayList<String> strArray = new ArrayList<String>();
int width = 0;
for (int i = 0; i < length; ++i) {
JSON obj = mapArray.get(i);
String strJSON;
if (obj == null)
strJSON = "null";
else
strJSON = obj.stringify(level + 1);
width += strJSON... |
26d7c424-cdf8-4899-83e2-2ac7da85ff38 | 2 | private String getDateValue(final Field field, final Object object) {
String resValue = null;
Object value = getRawValue(field, object);
if (value != null && value instanceof Date) {
resValue = DateUtils.format((Date) value, DATE_FORMAT);
}
return resValue;
} |
49ecf551-f774-45ce-a704-c5bec91745c8 | 5 | public void ausschreiben(){
for(int i=0; i < spieler.length; i++){
if(spieler[i].getX(i) - spieler[i].getRange(i) < pos_x && pos_x < spieler[i].getX(i) + spieler[i].getRange(i)
&& spieler[i].getY(i) - spieler[i].getRange(i) < pos_y && pos_y < spieler[i].getY(i) + spieler[i].getRange(i)){
spieler[i]... |
1c348cca-4c6f-47fa-8d71-79dad1ea9394 | 8 | public String getTwitchInfo(String message)
{
URL url;
StringBuilder allWords = new StringBuilder();
String[] parts = message.split(" ");
for (String word:parts)
{
if (word.contains("twitch.tv/") && (word.contains("/c/") || word.contains("/b/")))
{
... |
1b7a826d-d90c-4cdb-86f0-5c8d93344b4c | 5 | InventoryGUI(CardGUI c) {
cgui = c;
inv = c.currentGame.player.getItems();
inventorySize = c.currentGame.player.inventorySpace;
this.setLayout(new AbsoluteLayout());
slots = new JLabel[inventorySize];
stackCount = new JLabel[inventorySize];
highLights = new JLabel... |
95ff16d0-5aba-4903-b508-f1530dfb644a | 2 | private boolean win(){
for(ERow row : ERow.values()){
if(getRow(row) == -2){
//we may win
System.out.println("we may win!");
return getFreeCell(row);
}
}
return false;
} |
fa3b11d0-3ca4-47bf-b7ea-1750efaa4148 | 2 | public void resetPlotOption(int opt){
if(opt<0 || opt>4)throw new IllegalArgumentException("The plot option, " + opt + ", must be greater than or equal to 0 and less than 5");
this.plotOptions = opt;
} |
40672ddf-7c82-4bc4-8108-131345a323c2 | 2 | private void loadConfig(){
if(xmlConfig == null){
xmlConfig = new XMLConfiguration();
try {
xmlConfig.load(PublishConstants.SYSTEM_CONFIG_DIR + PublishConstants.PUBLISH_CONFIG_FILE_NAME);
} catch (ConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
5579fb68-7c0d-4387-abeb-a484a0fcc046 | 3 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (cmbProjeto.getSelectedItem().equals("Selecione")) {
JOptionPane.showMessageDialog(null, "Erro selecione o Projeto",
"Gestão de Atividade", JOptionPane.ERROR_MES... |
c62a3f63-2753-4192-b49d-09b5dada1903 | 3 | public void addBit(int theBit) {
if (!(theBit == 0 || theBit == 1)) {
throw new IllegalArgumentException("argument must be 0 or 1");
}
if (length == 32) {
throw new IllegalStateException("cannot fit additional bits");
}
// Add the new bit to the right of... |
1bc6f576-cd24-43b0-86ec-4680cd0cebd6 | 3 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
JpcapCaptor captor=JpcapCaptor.openFile("test");
while(true) {
Packet readPacket = captor.getPacket();
if(readPacket==null || readPacket==Packet.EOF) break;
System.out.println(readPacket);
captor.close(... |
27dd6a9d-b571-493a-96dc-85f94b4e11a0 | 9 | public boolean isUgly(int num) {
if(num <=0){
return false;
}
if(num ==1){
return true;
}
long tnum = num;
// if (num<0){
// tnum = -tnum;
// }
System.out.println(tnum);
boolean res = true;
int i=0;
List<Integer> l = new LinkedList<>();
int[] arr = {2,3,5};
while(i<arr.length ){
int t... |
cd99a887-9ced-4fd4-8362-9a78a5062308 | 9 | public JanelaPrincipal() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 701, 399);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnFile = new JMenu("File");
menuBar.add(mnFile);
JMenuItem mntmOpen = new JMenuItem("Carrega Imagem...");
mntmOpen.addActionListener... |
9df9d451-15fe-478f-b61d-81d928316bb9 | 8 | @Override
public void update() {
if (!init)
init();
level.update();
mouseOverOptionIndex = -1;
double mouseX = GameInput.mouseX;
double mouseY = GameInput.mouseY;
for (int i = 0; i < menuOptions.length; i++) {
float x = xyWidthHeight[i][X];
... |
8cfbe629-f7ae-4eda-9f3c-5b7dda4e0525 | 2 | @Override
protected DPLotSizingDecision getDecision(
DPBackwardRecursionPeriod[] periods, int setupPeriod,
int nextSetupPeriod, double alpha)
throws ConvolutionNotDefinedException {
//Get the vector of open and realized demand
RealDistribution[] openOrders = new RealDistribution[nextSetupPeriod-setupPe... |
010ed69f-ca9a-462f-a0fa-ae3460922460 | 0 | public ProductionChecker() {
} |
bb07b526-3ee5-4c38-b2d8-943e1f29faec | 0 | public PosControlTransacciones getPosControlTransaccionesFromItemDeMovimiento(PhpposSalesItemsEntity itemMovPos,
long fesCedula,
PhpposSalesEntity movimient... |
5c58e2e8-0cc4-4a5f-a886-efa650ab5c5f | 7 | private static String locate(CSVParser csv, String name, String... type) throws IOException {
if (name == null) {
// match anything
name = ".+";
}
Pattern p = Pattern.compile(name);
String[] line = null;
while ((line = csv.getLine()) != null) {
... |
7691329b-2584-4d57-88ad-2f5ff45094ec | 1 | public static AbilityType getAbility(ActiveWeaponEnchant type) {
switch (type) {
case FIREBALL:
return AbilityType.abil_aim_fire;
}
return null;
} |
27f3c41f-4cf5-4c87-940a-2897d707daed | 3 | protected void takeTier(){
//check how many tiers is taken and take another tier if possible
if(this.tiersTaken < this.enhancementMaxRank && requirementsMetSpend()){
if(DDOCharacter.pointAvailible()){
DDOCharacter.pointsSpent(prestige, apPerTier.get(tiersTaken));
++this.tiersTaken;
this.setImage(tier... |
a1babbf6-7ef4-4926-888b-9b4e277b5c96 | 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... |
089b5132-6ca6-432f-a304-0039ed087e47 | 7 | @Test
public void test()
{
clock = new Clock();
TimeControl tc = new Quota(30, 1800, 5, IncrementTypes.FISCHER);
clock.setTimeControl(tc);
clock.init();
Thread t = new Thread(new Runnable(){
public void run()
{
while(true)
{... |
c7711356-194e-4b9a-b68c-f110173353be | 3 | public static void close() { //Закрытие окна
if(Core.getIntance().getCurrentController().equals(EForm.MainForm.getController()))
Model.getIntance().empty(); //Если закрывается окно с игрой, то удаляем игру (иначе таймеры продолжат работать)
stage.close();
if(!stages.isEmpty())... |
ca1eb4d3-ca90-401c-b15d-668f4647b3e8 | 2 | @EventHandler
public void onFrameBrake(HangingBreakEvent e) {
if(e.getCause() == RemoveCause.ENTITY){
if(e.getEntity() instanceof ItemFrame){
e.setCancelled(true);
}
}
} |
86f95d28-1220-4bf2-bf8b-f3ab4627a013 | 9 | @Override
public void keyPressed(KeyEvent e) {
System.out.println(e.getKeyCode());
switch(e.getKeyCode()) {
case KeyEvent.VK_UP:
if(Snake.direction != Util.SOUTH)
Snake.direction = 0;
break;
case KeyEvent.VK_LEFT:
if(Snake.direction != Util.EAST)
Snake.direction = 1;
break;
case KeyEvent.... |
ec2c510a-1f8c-4962-9092-be534279e95d | 1 | public boolean editShipWorks(Ship ship)
{
if(myTurnEditing)
return mySea.shipWorks(ship);
else
return theirSea.shipWorks(ship);
} |
28168d9f-1ca9-4f9f-929a-aa44b9f85f26 | 7 | void hideAndShowToolbars(boolean leftOnly) {
boolean hide = bottomPanelVisible || leftPanelVisible;
MouseEvent me;
if (leftOnly || hide == leftPanelVisible) {
me = new MouseEvent(hideLeftPanel, 0, 0, 0, 1, 1, 1, false);
for (MouseListener ml : hideLeftPanel.getMouseListeners()) {
ml.mouseReleased(me);... |
2c6ef8e4-5070-4009-870f-5cba32dd8643 | 6 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Tree other = (Tree) obj;
if (root == null) {
if (other.root != null) {
return false;
}
} else if (!root... |
3ed87fbd-267f-423b-b091-3572147fe95e | 6 | public boolean isConnectedOK() {
boolean ok = false;
Connection conn = null;
SQLException ex = null;
try {
conn = DriverManager.getConnection(jdbcUrl,user,password);
if (!conn.isClosed()) {
ok = true;
}
} catch (SQLException e) ... |
8a2b3f47-15e5-4616-ab27-714586774f26 | 6 | public static void solve(String[] args) throws IOException{
String fileName = null;
// get the temp file name
for(String arg : args){
if(arg.startsWith("-file=")){
fileName = arg.substring(6);
}
if(arg.startsWith("-type=")){
ty... |
49622e91-173f-4dc3-b9db-161caf3b2618 | 7 | public boolean calculateEnergyConsumptionGeneration() {
int i = 1;
boolean feasible = false;
System.out.println("EVALUATING SYSTEMS\n");
for (SoftwareSystem system : systems) {
System.out.println("\tSystem " + (i++) + "\n\t\t" + system);
int j = 0;
double totalTime = 0;
Calculator calculator = new C... |
3542be43-178a-4089-998d-8a6f1f47026a | 1 | @Test
public void tasoAsetaPelaajanAlkusijaintiToimii() {
Piste r = new Piste(20, 20);
t.asetaPelaajanAlkusijainti(r);
Pelaaja pe = new Pelaaja();
pe.setTaso(t);
assertTrue("Pelaajan alkusijainti oli väärä", pe.getX() == 20 && pe.getY() == 20);
assertTrue("GetPelaajan... |
d554721b-8783-4982-8270-71c8dc77b335 | 2 | private void send(String pro,String sxo){
/*
* apothikeuei sthn vash thn anafora
*/
String query="insert into anafores(provlima,sxolia,odigos_id) values(?,?,?)";
try {
con.pS=con.conn.prepareStatement(query);
con.pS.setString(1, pro);
con.pS.setString(2, sxo);
con.pS.setInt(3, odigosId);
} cat... |
9f14f2e1-bf6c-4a91-8a0a-c8ac607e5683 | 0 | @Override
public void disconnected(DisconnectedEvent e) {
} |
fa587161-c810-4390-afc9-6177e233544a | 5 | private Cell[] getWillFlip(int x, int y){
List<Cell> willFlip = new ArrayList<>();
try {
willFlip.add(puzzlePanels[y][x]);
} catch (ArrayIndexOutOfBoundsException ex) {
throw new RectangularPuzzleIndexOutOfBoundsException();
}
try {
willFlip.add(puzzlePanels[y][x + 1]);
} catch (ArrayIndexOutOfBou... |
3b37cf9d-df82-48db-b2ef-7d0236f3b4e2 | 9 | public String addBinary(String a, String b) {
if (a == null && b == null)
return null;
if (a == null)
return b;
if (b== null)
return a;
int lengthA = a.length();
int lengthB = b.length();
int length = Math.max(lengthA, lengthB);
... |
b2ccbdd1-060e-4ec9-b845-783649a5f043 | 3 | public boolean testEgalite() {
for (Case c : this._j2.getCases()) {
if (c.isAPortee() && !c.isEtat()) {
return false;
}
}
return true;
} // testEgalite() |
e42996bd-6121-4aa1-a139-3ec7a3e3071b | 8 | @Override
public void execute(CommandSender sender, String[] args) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.tp + " (playername)");
return;
}
if (ar... |
976be055-7c7a-4239-adb2-094b788ecde0 | 9 | private State_Abstract createState(String[] tokens) {
// tokens[0] is the instruction for this state
if (!E_Instruction.valid().contains(E_Instruction.valueOf(tokens[0]))) {
Main.error("Error : unknown instruction: " + tokens[0]);
}
// Based on this we create the correct state
switch (E_Instruction.valueO... |
3b16e7e7-3534-4caa-9829-a69c53929294 | 1 | public int getPriority() {
return postfix ? 800 : 700;
} |
2edfcafe-f6aa-43d9-ab08-7c571a8eae85 | 3 | public boolean areAllClientsReady() {
if (clients.size() == 1) return true;
for (Player p : clients) {
if (!p.isReady()) return false;
}
return true;
} |
1a8c59e9-b041-46e3-b544-ba672b4ac394 | 4 | public static java.awt.Color getColorForPlayer(Player p) {
switch (p) {
case RED:
return java.awt.Color.RED;
case BLUE:
return java.awt.Color.CYAN;
case YELLOW:
return java.awt.Color.YELLOW;
case GREEN:
return java.awt.Color.GREEN;
}
return java.awt.Color.WHITE;
} |
70e05836-3f27-4c97-9f1e-cd8c6c29a57d | 5 | public int getIsoinLapsi(int indeksi) {
int isoin = -1;
if (keko.size() == 0) {
return isoin;
}
int ekanLapsenIndeksi = indeksi * this.d + 1;
isoin = ekanLapsenIndeksi;
if (ekanLapsenIndeksi >= keko.size()) {
return -1;
}
for (int i... |
06d2e34b-123f-406b-a384-0ed1962dd89b | 4 | public static int personneX(int travee,int orientation){
int centreX = centrePositionX(travee) ;
switch(orientation){
case Orientation.NORD :
centreX -= 10 ;
break ;
case Orientation.EST :
centreX -= 25 ;
break ;
case Orientation.SUD :
centreX -= 10 ;
break ;
case Orientation.OUE... |
34277c55-11c0-4973-8e11-607418015db3 | 2 | private void initializeLogger() {
this.log = Logger.getLogger(this.getClass().getName());
try {
FileHandler fh = new FileHandler(this.getClass().getName()
.replace("class ", "")
+ this.id + ".log");
fh.setFormatter(new SimpleFormatter());
this.log.addHandler(fh);
} catch (SecurityException e1) ... |
953010f8-3984-4408-a6fb-3139ec804aa1 | 2 | public void buttonP()
{
if(bMSounds.contains(Main.mse))
{
mSounds = !mSounds;
if(mSounds)
{
sS = "On";
}
else
{
sS = "Off";
}
}
} |
0b79e5cb-68c1-4d47-9244-bca993427ad8 | 8 | public static int findPalindromeMinCut(String input) {
int[][]cost = new int[input.length()][input.length()];
boolean [][] isPalindrome = new boolean[input.length()][input.length()];
//base case all single length elements are palindromes
for( int i=0; i< input.length(); i++) {
... |
94949397-b4c3-4dab-a1ad-984e94672328 | 9 | public ACodeInterface(String file, JavaScriptObject callbacks) {
this.file = file;
init0(callbacks);
stateChange0("LOADING");
timer = new Timer() {
@Override
public void run() {
if (!paused) {
try {
trace0("Running code...");
// Run only if the interpreter is running
for (int ... |
18be4300-a782-43d7-ac19-3068e88445a5 | 9 | @Override
public void removerUsuario(){
if ( this.num_usuarios == 0 ) System.out.println("\nNão existem "
+ "usuários.");
else{
System.out.println("\nQual dos usuários você gostaria de remover? "
+ "[ 1 - " + this.num_usuarios + " ]" );
int... |
1f92b37a-259f-4953-9e1c-74e7801f8fd9 | 9 | @Test
public void test_1_Constructor() {
// Initialisation
int size = 10;
Grid g = new Grid(size);
// TEST FOR SIZE (SQUARE)
boolean ok = true;
if(g.getBoard().length != size) {
ok = false;
}
int badSize =size;
int i = 0;
while(ok && (i<g.getBoard().length)) {
if(g.getBoard()[i].length != s... |
bd864673-c5de-463e-aa82-6e904e57bed3 | 1 | public void update() {
if (active) {
x += vx / Level.speed();
y += vy / Level.speed();
}
} |
6dde4734-daa6-443a-98e1-f203418c3e14 | 5 | private double readFloatBody(final boolean shouldBeNegative)
throws IOException {
long signif;
long exp;
if (trace == API_TRACE_DETAILED) {
debugNote("readFloatBody shouldBeNegative=" + shouldBeNegative);
}
Object obj = readObject();
if (obj instanceof BigInteger) {
BigInte... |
24336ea8-e930-4af1-bbbd-2d057eac475b | 2 | public void save(DataOutputStream out) {
try {
for (Blocks b : blocks) {
b.save(out);
}
} catch (IOException e) {
e.printStackTrace();
}
} |
97d53e94-1183-4e31-b700-c0d67e478d5c | 6 | public void buildSituations() {
System.out.println("Building graph database...");
serverSituationHistory = new HashMap<>();
applicationSituationHistory = new HashMap<>();
FakeServer livingServer;
FakeApplication livingApplication;
int stepStartResearch;
int state ... |
fb2c6a56-0918-4bdf-974a-946ce0319bb6 | 1 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Close")) {
this.dispose();
}
} |
df0e9aa2-6c65-47fb-902d-59d35082f975 | 3 | private void jRadioButton1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jRadioButton1KeyPressed
if (evt.getKeyCode() == 40) {
jRadioButton2.setSelected(true);
} else if (evt.getKeyCode() == 37) {
jTextField9.grabFocus();
} else if (evt.getKeyCode() == 38) {
jRadioButton1... |
bdfbff01-714d-4599-bdff-464519c995aa | 7 | private void compileColorBoard() {
cells = new int[board.length][board[0].length];
largest = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[0].length; j++) {
Matcher m = compileRegex(reg, board[i][j]);
int amt = 0;
... |
48086ce6-139c-4325-9491-cd04b274826d | 2 | private void browseButtonAction() {
loggerMainClass.entry();
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setDialogTitle("Select The Source Directory");
if (fileChooser.showDialog(nu... |
74a1d15d-8c7d-4ef0-9fd4-a901a04b2e1d | 5 | public static void main(String[] args) throws CloneNotSupportedException {
IPlaystationNetwork device = new Uncharted();
device.uploadUpdate();
System.out.println("Version: " + IPlaystationNetwork.VERSION);
if(device instanceof Uncharted &&
device instanceof PS3Game &... |
d7458ebb-8433-4729-8293-9eb35f6c4ed1 | 9 | @Override
public Token parse() {
Token test = first.getNext();
if (!test.isOperator(Operator.BRACKET_LEFT))
throw new RuntimeException("Expected '(' after FOR, found: " + test.toString());
test = test.getNext();
if (!test.isOperator()) {
preForAssign = new AssignmentExpression(test, scope);
test... |
ec394860-85d6-4112-9eba-375e717b13ba | 0 | @SuppressWarnings("unchecked")
public List<Order> getAllDoneOrders() {
return (List<Order>)this.em.createNamedQuery("findAllDoneOrders").getResultList();
} |
94c7d79d-ef27-4801-887c-294726019b14 | 8 | public void paint2D(Graphics graphics) {
Graphics2D g2 = (Graphics2D)graphics;
/** set the rendering hints */
g2.setRenderingHints((RenderingHints)hints);
/** if game is over */
if (gameOver) {
/** fill the screen with black color */
g2.setColor(Color.blac... |
fa38247d-d612-4bcb-aded-1f759edcc9c3 | 4 | public void move() {
if(hasBreadcrumb) {
location = tripAdvisor.proceed(location, colonyLocation);
} else if(pileLocation != null) {
location = tripAdvisor.proceed(location, pileLocation);
} else {
location = tripAdvisor.randomWalk();
}
if(isOnAPile()) {
hasBreadcrumb = true;
} else if(isInCo... |
b6542b81-a447-44b8-83c3-a22d33dc81c4 | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
int times = 1;
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
double[] val = returnDoubles(line);
double[] answe... |
209640a4-d898-4153-bda6-34244f26c709 | 8 | private XML buildElement() {
EventNode token = eventReader.next();
if (token.getType() != TokenType.START_TAG) throw new XMLException("Broken XML: first token must be START_TAG");
String qname = token.getValue();
XMLElement element = new XMLElement(qname);
List<Entry<String, String>> attributes = token.getA... |
59065e3f-073f-49cd-8bcf-dc0923575f88 | 2 | public void Menu(String protocolo, BufferedReader in, PrintWriter out){
System.out.println("Entrou menu\n");
String comando[] = protocolo.split("-");
System.out.println(comando[0]);
switch (comando[0]) {
case "Logar":
try {
... |
013ef9f5-6e2c-4e99-b2ce-c074665cee9a | 0 | public SatisfiedApplication() {
setBounds(10, 50, 836, 739);
setLocationRelativeTo(rootPane);
setModal(true);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBackground(new Color(248, 248, 255));
contentPanel.setLayout(new FlowLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));... |
49d08a9b-3f64-4190-bc9a-09b5bb7e5c5b | 3 | public boolean areNondeterministic(Transition t1, Transition t2) {
FSATransition transition1 = (FSATransition) t1;
FSATransition transition2 = (FSATransition) t2;
if (transition1.getLabel().equals(transition2.getLabel()))
return true;
else if (transition1.getLabel().startsWith(transition2.getLabel()))
ret... |
6bc7dacd-0123-4e7b-aafe-1ea80ef6144b | 9 | public ArrayList<Integer> mergeTwoArrays(ArrayList<Integer> a,
ArrayList<Integer> b) {
if (a.size() != b.size()) {
return null;
}
if (a.size() == 0) {
return new ArrayList<Integer>();
}
ArrayList<Integer> result = new ArrayList<Integer>();
int len = a.size();
int ai = 0;
int bi = 0;
while (ai... |
27d736d7-9d4e-408e-bab8-4e71092afb7e | 2 | public int getQueueSize() {
int count = 0;
try {
QueueBrowser browser = context.createBrowser(pointsQueue);
Enumeration elems = browser.getEnumeration();
while (elems.hasMoreElements()) {
elems.nextElement();
count++;
}
... |
f5d443b2-33e4-4c07-8c5d-967c5dea10ba | 0 | @Override
public void signalEndOfData() {
synchronized (taskQueue) {
endOfData = true;
taskQueue.notifyAll();
}
} |
55629a50-e528-4653-81c6-0666db8fd1b7 | 3 | @Override
public void performPhysics(Matter matter, Planet nearbyPlanet) {
Gravity planetGravity = nearbyPlanet.getGravity();
double hitsGroundIn = getHitGroundTime(matter, planetGravity);
double processedTime = 0;
double currentTimeStep = 1;
while (hitsGroundIn < currentTimeStep && !Matter.isEffectivelyRest... |
2882bbd2-4916-43e3-a1b6-48b04b1c63cb | 1 | public void write6bytes(long n) throws IOException {
long b0 = n & 0xff;
long b1 = (n & 0xff00) >> 8;
long b2 = (n & 0xff0000) >> 16;
long b3 = (n & 0xff000000) >>> 24;
long b4 = (n & 0xff00000000L) >> 32;
long b5 = (n & 0xff0000000000L) >> 40;
if (le) {
write(b0); write(b1); write(b2); write(b3); writ... |
67ec0496-1347-456d-8f20-e0bcaca02dd7 | 9 | private boolean check() {
if (!isBST()) System.out.println("Not in symmetric order");
if (!isSizeConsistent()) System.out.println("Subtree counts not consistent");
if (!isRankConsistent()) System.out.println("Ranks not consistent");
if (!is23()) System.out.println(... |
77451881-6a5e-41fc-b783-c02462368460 | 0 | public static WebDriver getDriver() {
return driver;
} |
bc0a503f-6132-431a-8c61-c0389d78354f | 7 | public Poly getPoly(int type) {
switch(type) {
case 0: {
return new Poly(makeL()); //creates an L-piece
}
case 1: {
return new Poly(makeJ()); //creates a J-piece
}
case 2: {
return new Poly(makeS()); //creates an S-piece
}
case 3: {
return new Poly(makeZ()); //creates a Z-piece
... |
d9c1c132-2e37-4e20-8ae6-7ecbf330ea2b | 3 | public int get_main_data_len(){
int ans = 0;
for(int gr = 0; gr < max_gr; gr ++)
for(int ch = 0; ch < channels; ch ++) {
ans += side_info.gr[gr].ch[ch].part2_3_length;
}
ans = ((ans % 8) > 0)? (ans/8 + 1): (ans / 8);
return ans;
} |
bf999281-cc5f-4e91-8822-863b8db3b783 | 2 | @Override
public final void refreshList() {
entityList.clear();
// Update our entityList to only bother with enemies which contain
// OUR specific SpawnSystemTag.
List<Entity> entitesWithSpawnTags = entityManager.getEntitiesContaining(SpawnSystemTag.class);
// Only keep track of our own spawn tag list
for ... |
1f28e088-031f-4201-baf6-f87c1e42048f | 6 | public Point getFaceOffset(Face face) {
switch (face) {
case TOP:
return this.getTopFaceOffset();
case BOTTOM:
return this.getBottomFaceOffset();
case FRONT:
return this.getFrontFaceOffset();
case BACK:
return this.getBackFaceOffset();
case LEFT:
return this.getLeftFaceOffset();
... |
00d7b551-08c1-4108-b1af-b7888defa680 | 1 | public static boolean isMac() { // [deric] 31Sep2001
String osName = System.getProperty("os.name");
if (osName.toLowerCase().startsWith("mac")) {
return true;
} else {
return false;
}
} |
2045c3ca-597f-4392-bcb7-918e1ca55d16 | 7 | private void initText() throws FileNotFoundException, IOException {
java.io.BufferedReader reader;
String line;
String[] splitLine;
for (File f : filenameresolver.listFiles("localisation")) {
if (!f.getName().endsWith(".csv"))
continue; // Could use a FileFi... |
12ad000d-87ef-4ed7-ab82-8289c383ae2f | 3 | public static ArrayList<Rating> getTestSet(String file) {
ArrayList<Rating> testset = new ArrayList<Rating>();
InputStream fis = null;
BufferedReader br;
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
br = new ... |
bb50ec65-85ed-47bd-a086-67bce6691383 | 4 | protected void addListeners() {
buttonStart.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String fResult = "# Celsius to Fahrenheit: \n";
String cResult = "# Fahrenheit to Celsius: \n";
try {
fResult += String.valueOf(adapter.celsiusT... |
f3924fec-5ffb-452b-bfc9-7d917c993cfe | 9 | static byte PistonFix(byte data, String kierunek)
{
if (kierunek.equals("right"))
{
if (data == 2) {
return 5;
}
if (data == 4) {
return 2;
}
if (data == 5) {
return 3;
}
if (data == 3) {
return 4;
}
}
else... |
fb015366-2db1-4525-b592-13f20a03bb57 | 2 | public boolean isMouseOverCloseButton(Point mousePosition) {
if(mousePosition == null || fButtonShape == null) {
return false;
}
return fButtonShape.contains(mousePosition);
} |
98b8a8af-7e3e-440f-a811-79fd02ec3f15 | 2 | private int findSlot(int hash){
int mask = cap - 1;
int bkt = (hash & mask);
int bhash = hopidx[bkt<<2];
int slot;
if(bhash == 0)
slot = bkt<<2;
else
{
for(;hopidx[(bkt<<2) + 2] != 0; bkt = (bkt + 1) & mask)
;
slot = (bkt<<2) + 2;
}
return slot;
} |
b1d53743-96bc-4168-9aa0-9d021c764d88 | 3 | public static void main(String[] args) throws Exception {
String baseFilename = args[0];
int nShards = Integer.parseInt(args[1]);
String fileType = (args.length >= 3 ? args[2] : null);
/* Create shards */
FastSharder sharder = createSharder(baseFilename, nShards);
if (b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.