method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1e6d81ac-4f45-4bbc-bf03-98d2b2ae93ad | 9 | protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.enabled)
{
if (par1GuiButton.id == 2)
{
String var2 = ((ServerNBTStorage)this.serverList.get(this.selectedServer)).name;
if (var2 != null)
{
... |
fdbdbad4-534c-4c9f-8d3d-d9ca753ecd52 | 9 | public static int[][] setZero(int[][] matrix) {
if (matrix == null) {
return null;
}
int row = matrix.length;
int column = 0;
if (row > 0) {
column = matrix[0].length;
}
int[] rows = new int[row];
int[] columns = new int[column];
... |
d1749bf9-b398-4c69-9570-117fdff10b62 | 5 | public Logging(String loglevel) {
// Setup logger via slf4j
Log = LoggerFactory.getLogger("TRUSS");
// Send passed value to upper case
String compare = "FATAL";
if (!loglevel.isEmpty()) {
compare = loglevel.toUpperCase();
}
// Set log level to passed paramaters (if it can be mapped)
if (compare.sta... |
0f8c4718-934b-41e4-bfeb-32ede29ee03a | 8 | @Override
public int attack(NPC npc, Entity target) {
final NPCCombatDefinitions defs = npc.getCombatDefinitions();
int distanceX = target.getX() - npc.getX();
int distanceY = target.getY() - npc.getY();
boolean distant = false;
int size = npc.getSize();
Familiar familiar = (Familiar) npc;
boolean usingS... |
63138fe8-55cd-4bce-b4aa-c7d543588d94 | 9 | @Override
public void moveCustomerToSellerQueue(int currentPhase, Queue lineQueue,
ArrayList<TicketSeller> sellers) {
if( !lineQueue.isEmpty()){
Customer tmpCustomer;
for(int i = 0 ; i < Define.theNumberOfTicketSeller && !lineQueue.isEmpty() ; i++ ){
TicketSeller tmpSeller = sellers.get(i);... |
06f8c96a-67c7-4039-8476-8779de13feff | 2 | protected void doTestCycAccess8(CycAccess cycAccess) {
long startMilliseconds = System.currentTimeMillis();
try {
// List containing null is coerced to list containing NIL.
String script = "(put-api-user-variable 'a '(nil 1))";
Object responseObject = cycAccess.converseObject(script);
... |
439462a3-dcf8-43b0-8109-844d48c3a624 | 0 | public String getCountry() {
return country;
} |
04990a87-736e-4672-9462-22fbd427c747 | 7 | public LegendItem getLegendItem(int datasetIndex, int series) {
XYPlot plot = getPlot();
if (plot == null) {
return null;
}
LegendItem result = null;
XYDataset dataset = plot.getDataset(datasetIndex);
if (dataset != null) {
if (getItemVisible(ser... |
bf42c524-cbbf-4387-a2b1-bd6b1bb1456d | 0 | @Override
public void mouseExited(MouseEvent e) {
} |
834b5215-60cf-4984-8b6b-f56ca18ca714 | 4 | @DELETE()
@Path("release/{playerId}")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player releasePlayer(@PathParam("playerId") int iPlayerId)
{
Player p = new Player();
UserTransaction utx = null;
try
{
... |
ee5e41f8-bd38-4205-856f-f1548b03810d | 0 | public boolean getAdapt()
{
return adapt;
} |
6a7f4d1f-b39f-40fc-b0cf-d0f550bced3c | 5 | private void drawEditingCollection() {
// Prints name of current Collection
parent.fill(255);
parent.textAlign(PConstants.CENTER);
parent.text(selectedCollection.getCollectionName(), posX + 438,
posY + 117);
// Draws file paths in window
parent.stroke(0);
parent.fill(225);
parent.rect(posX + 35, p... |
940c7ef5-c42a-4b3e-981c-f0601cb925e4 | 3 | @Override
public Competicao remove(Object key) {
try {
Competicao al = this.get((String) key);
Statement stm = conn.createStatement();
if (al.getClass().getName().equals("Competicao.Eliminatorias") || al.getClass().getName().equals("Competicao.EliminatoriaDupla")) {
... |
a3777973-0b1f-44fd-8072-59f54ae03653 | 7 | public static void computeSlotDirectEquivalent(Slot self) {
{ Stella_Class renamed_Class = ((Stella_Class)(self.slotOwner.surrogateValue));
Symbol slotname = self.slotName;
Symbol slotrenames = ((Symbol)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Stella.SYM_STELLA_SLOT_RENAMES, null)));
Slot... |
15f83d2c-360e-472b-9537-bd8ff24d8e69 | 9 | @Override
public LocationCollection getMovePositions() {
LocationCollection locs = new LocationCollection();
Point myLoc = this.getLocation();
Point toAdd = new Point(myLoc);
//Spots to try...always 8 spots.
for(int i = 1; i < 3; i++){
toAdd.setLocation(myLoc.getX() + i, myLoc.getY() + (i % 2 + 1));
if... |
8cdba283-b32a-49c1-a496-86de2045325b | 0 | protected MyWorkerThread(ForkJoinPool pool) {
super(pool);
} |
d47a6d32-0c69-41d0-be72-2ca4e1362a35 | 2 | public String getMessage(int iqseq) {
String msgText = "";
int msgId = iqseq;
try {
PreparedStatement prepStmt = connection.prepareStatement(
"select msg_seq, msg_text from hl7_q where msg_seq = ?");
prepStmt.setInt(1, msgId);
ResultSet ... |
61e37bf9-fc9f-4179-ad0d-bb845e237cc9 | 6 | public synchronized Tile getTile(int x, int y)
{
if (x < 0 || y < 0 || x >= xSize || y >= ySize)
return new Tile(VOID_TILE, -1, -1);
if (x == xSize || y == ySize)
return new Tile(VOID_TILE, -1, -1);
return tiles[x][y];
} |
e9e5810f-d427-47e0-b969-7bc209472c26 | 3 | @Test
public void testVoidPayment() {
Gateway beanstream = new Gateway("v1", 300200578,
"4BaD82D9197b4cc4b70a221911eE9f70");
CardPaymentRequest paymentRequest = new CardPaymentRequest();
paymentRequest.setAmount(90.00);
paymentRequest.setOrderNumber(getRandomOrderId... |
c7719e5b-e808-4c09-96dd-3a05b885819b | 5 | @Override
public void execute(double t) {
if (dynaSys != null) {
Matrix u = new ColumnMatrix(inputU.getDim());
if (inputU.isConnected())
u = inputU.getInput();
Matrix y = new ColumnMatrix(outputY.getDim());
y = putTogether(u, 0, y);
int index = 1;
for (DynaSys ds : dynaSys) {
if (ds != null... |
0cf739cd-a32a-4ee6-95f1-45a9b0391a81 | 6 | public static void main(String[] args) {
System.out.println("asfdf");
System.out.println(56);
logger.setLevel(Level.SEVERE);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.SEVERE);
logger.addHandler(handler);
if (args.length == 0) {
... |
877144a8-3a14-42f0-8cf5-e0c12e479423 | 2 | public void persistRuleSet(RuleSet ruleSet) {
String sqlStatement;
dao.connect();
sqlStatement = generateInsertStmt(ruleSet);
if(dao.getErrorLogs().getErrorMsgs().size() == 0){
dao.executeUpdate(sqlStatement);
}
if(dao.getErrorLogs().getErrorMsgs().size() == 0){
dao.disconnect();
}
} |
e89b140e-fb10-4385-b7e6-21dc5a7dae2b | 9 | public static void loadConfig(String filename)
{
if (filename == null)
filename = System.getProperty("user.home") + "/.SliceAndDaid.conf";
BufferedReader br = null;
try
{
br = new BufferedReader(new FileReader(filename));
} catch (FileNotFoundException e)
{
return;
}
String line;
String sect... |
f39fb52d-c4af-4d68-9fae-7829a03ef170 | 8 | public int threeSumClosest(int[] num, int target) {
Arrays.sort(num);
int min = 0;
boolean firstMin = true;
for (int i = 0; i < num.length - 2; i++) {
int subTarget = target - num[i];
int start = i + 1;
int end = num.length - 1;
int finalSt... |
053ce192-4200-49aa-ad8e-53519c043c56 | 0 | public QueueIterator()
{
modcountAtConstruction = modcount;
} |
05b68a52-b82d-43b8-8526-17b90226fa38 | 1 | public JPanel getUserlistImageMenu() {
if (!this.init_1) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.userlistImageMenu;
} |
18557aec-c719-4206-89f8-1e8971e8421d | 7 | public int[] solutionThree(int[] a) {
if (a == null || a.length == 0) {throw new IllegalArgumentException();}
for (int i = 0; i < a.length - 1; i++) {
if (((i & 1) == 0 && (a[i] > a[i + 1])) || ((i & 1) == 1) && (a[i] < a[ i + 1])... |
544eb85b-15ad-4628-a01f-4c6b7844e543 | 6 | public static void applyNormalAbilities(LivingEntity entity, MobAbilityConfig ma)
{
if (ma == null)
{
ma = MMComponent.getAbilities().getConfig().getMobConfig(entity.getWorld().getName(), ExtendedEntityType.valueOf(entity), null);
if (ma == null)
{
return;
}
}
ValueChance<Ability> abilityChance... |
889dab02-03fd-44fc-95df-2c0445a9be8e | 9 | public float asFloat()
{
try {
if (isNull()) {
return 0.0F;
} else if (isFloat()) {
return ((Float) value).floatValue();
} else if (isString()) {
String s = (String) value;
s=s.replaceAll(",","");
return Float.valueOf(s).floatValue();
} else if (isShort()) {
... |
fe67f989-cdad-4269-8411-5efa725bc5e7 | 2 | public LigneBus getLigne(int id) {
LigneBus val = null;
for (LigneBus l : ligne) {
if(l.getNumero()==id){
val=l;
}
}
return val;
} |
f9cb3adb-0cd4-4b67-b3c7-39f37f8d9dd8 | 2 | @Override
public AbstractComponent getComponent(int index) throws ComponentException {
if (index > components.size()) {
throw new ComponentException(
"Index is larger than the size of the list");
} else if (index < 0) {
throw new ComponentException("Index is under zero");
}
return components.get(ind... |
3dfe18ed-c4fb-4c2c-8567-21e6dbfdadd9 | 6 | public static BufferedImage genServerIcon(String[] data) {
BufferedImage MonitIcon = Util.getRes("monitor.png");
if ((data[0] == null) && (data[1] == null) && (data[2] == null)) return MonitIcon.getSubimage(0, 0, MonitIcon.getHeight(), MonitIcon.getHeight());
if ((data[1] != null) && (data[2] !=... |
a8e01096-ba41-4f87-a156-fb1068d6be51 | 1 | public static void clearTable(PatientProfilePage profileP){
int rows= profileP.getPrescriptionHistory().getRowCount();
int i=0;
while(i<rows){
profileP.getPrescriptionHistory().setValueAt("",i,0);
profileP.getPrescriptionHistory().setValueAt("",i,1);
profileP.getPrescriptionHistory().setValueAt("",i,2);
... |
365f237c-66ae-4c87-a848-67b936e6ea8d | 5 | public static int medianOfMedians(List<Integer> list) {
int groupCount = list.size() / 5;
List<Integer> medians = new ArrayList<Integer>();
for (int i = 0; i <= groupCount; i++) {
List<Integer> group = new ArrayList<Integer>();
int startIndex = i * 5;
... |
d4281421-b3d9-42ce-bb05-6cdf0414e672 | 1 | public void addDoors(Set<Point> doors) {
for (Point door : doors) addDoor(door);
} |
80a664c7-9518-4dd5-a6dd-7c27c19b207d | 7 | public static void paymentOptions()
{
System.out.print("Would you like to do with a payment? Add/Remove/Exit: ");
String addOrRemovePayment = sc.nextLine();
boolean successful = false;
while (!successful)
{
switch (addOrRemovePayment.toUpperCase())
{
case "ADD":
System.out.println("You select... |
0e2ecd8e-67ed-467c-affe-a9e26188d41a | 9 | int insertKeyRehash(byte val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
214a936d-5105-40ff-bbad-0d254b4389c2 | 0 | @AnnotationTestTool
public void doSomething(String str)
{
System.out.println(str);
} |
6d28f064-0093-4035-9ee2-8106f22d4d31 | 1 | public Insets getInsets() {
if (myInsets == null) {
Insets appInsets = super.getInsets();
// /#endif
myInsets = new Insets(appInsets.top + BORDER, appInsets.left
+ BORDER, appInsets.bottom + BORDER, appInsets.right
+ BORDER);
}
return myInsets;
} |
0c7cf8af-d728-407e-ac3c-95b846b0569e | 4 | public static void moveTextLeftText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
int start = textArea.getSelectionStart();
int end = textArea.getSelectionEnd();
String selected_text = textArea.getSelectedText();
// Abort if no selectio... |
cdd027d4-f54f-416a-a055-dd07ef4e9384 | 6 | private static final int method3991(int i, int i_244_) {
int i_245_ = (i & 0xff0000) * i_244_ >> 23;
if (i_245_ < 2)
i_245_ = 2;
else if (i_245_ > 253)
i_245_ = 253;
int i_246_ = (i & 0xff00) * i_244_ >> 15;
if (i_246_ < 2)
i_246_ = 2;
else if (i_246_ > 253)
i_246_ = 253;
int i_247_ = (i & 0x... |
46c9e5b7-5d49-46cd-9b1a-b0f79f61e303 | 5 | private void initDataLayout(File file) throws IOException {
if (file.exists()) { // Load the data formats from the file
ras.read(buffer, 0, 24);
int index;
if ((index = indexOf(FLOAT_COOKIE_BIG_ENDIAN, buffer)) != -1) {
bigEndian = true;
} else if ((index = indexOf(FLOAT_COOKIE_LITTLE_ENDIAN, bu... |
a3d33e6d-b617-4ae5-b046-832e4dcdd71d | 6 | static Object[][] multiply(Object[][] x, Object[][] y) {
Object[][] ret = new Object[x.length][];
for (int i = 0; i < x.length; i++) {
ret[i] = new Object[x[i].length];
for (int j = 0; j < x[i].length; j++) {
Object a = x[i][j];
... |
0b6e8aa4-5bc3-4981-b49e-f1bf9a1e6e3f | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
0705ebfb-0eb5-4295-a911-a4f42e332ec0 | 8 | public void init() {
frame = new JFrame("Ajándék kártyák");
frame.setBounds(200, 20, 600, 400);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.setContentPane(new JLabel(new ImageIcon((URL)this.getClass().getResource("/otherImages/background.jpg"))))... |
69ca079b-37f4-4ef0-9d94-adfd6ffb8ae8 | 4 | private File getConfigFile(String file)
{
if(file.isEmpty() || file == null)
return null;
File configFile;
if(file.contains("/"))
{
if(file.startsWith("/"))
configFile = new File(plugin.getDataFolder() + file.replace("/", File.separator));
else configFile = new File(plugin.getDataFolder() + F... |
1d08b261-b21e-456c-85ad-ae907ed13cbf | 2 | private void lifeCycle() {
for (int i = this.iFrom;i<=this.iTo;i++) {
if (isValidNumber(i)) {
action(i);
}
}
} |
f99f530b-a435-4591-b8d2-b71ce86a3abb | 9 | private Object[] executeAll(Object ctx, VariableResolverFactory vars, Method m) {
if (length == 0) return GetterAccessor.EMPTY;
Object[] vals = new Object[length];
for (int i = 0; i < length - (m.isVarArgs() ? 1 : 0); i++) {
vals[i] = parms[i].getValue(ctx, vars);
}
if (m.isVarArgs()) {
... |
01e29eab-fd33-4bcf-b3ff-648983c17f06 | 0 | @Override
public boolean isSinkMethod(SootMethod sMethod) {
return this.matchesMethod(sMethod, this.sinkMethods);
} |
a81bc0ed-5060-49ce-a603-060028c56b40 | 3 | private void firstRun() throws Exception {
if(!configFile.exists()){
configFile.getParentFile().mkdirs();
copy(plugin.getResource("config.yml"), configFile);
}
if(!msgConfigFile.exists()){
msgConfigFile.getParentFile().mkdirs();
copy(plugin.getReso... |
3378ac62-9005-4b16-9086-7552c00a2626 | 8 | private int readFrameType(final Object[] frame, final int index, int v,
final char[] buf, final Label[] labels) {
int type = b[v++] & 0xFF;
switch (type) {
case 0:
frame[index] = Opcodes.TOP;
break;
case 1:
frame[index] = Opcodes.INTEGER;
... |
0158a852-0a79-4203-a414-9299f68642a7 | 2 | @Test
public void test() {
String[] arr = {"BPACD", "APPC", "APPAC", "APPLE", "A", "BDBD", "Z"};
// Sort an array a[] of N integers between 0 and R - 1
for(String s : arr)
System.out.print(s + " ");
System.out.println();
Strings.MSDsort(arr);
for(String s : arr)
System.out.print(s + " ");
} |
0eff9910-d790-4bce-8911-22767c119ad2 | 6 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int n = in.nextInt();
int a[] = new int[n];
for( int i = 0;i < n;i++ ) {
a[i] = in.nextInt();
}
int b[][] = new int[n+1][n+1];
for( int k = 2;k <= n;k++) {
for( int i = 0;i <... |
2c7f0245-4cbb-435b-a8e7-2b54bd51c491 | 9 | @Override
public void update(Observable o, Object o1) {
for (Component c : pannello.getComponents()) {
((JButton) c).setBorder(null);
if (((JButton) c).getComponentCount() > 0) {
((JButton) c).remove(0);
}
}
for (int i = 0; i < model.getTab... |
1552b557-87d4-4c5e-9fa0-084de145a0c8 | 1 | public void inlineCompare(Serializable test, boolean same) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(test);
oos.close();
ByteArrayInputStream bais = new ByteArrayInp... |
98baea42-71bd-4d75-90d5-8536edf5e219 | 6 | public boolean isSameTree(TreeNode p, TreeNode q) {
if(p == null && q == null)
return true;
else if(p != null && q != null)
return (p.val == q.val) && (isSameTree(p.left,q.left)) && (isSameTree(p.right,q.right));
return false;
} |
20351a5d-6347-4d7e-a543-a97e95cd3c9b | 7 | public static void clearMemoizationTables(Keyword timestampname) {
{ MemoizationTable table = null;
Cons iter000 = Stella.$ALL_MEMOIZATION_TABLES$.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
table = ((MemoizationTable)(iter000.value));
{ boolean foundP000 = fa... |
6e9b8301-a3c5-4d5d-be85-1604cca44259 | 8 | void selectSeqcodeRange(int seqcodeA, int seqcodeB, BitSet bs) {
int i = 0;
if (seqcodeB == Integer.MAX_VALUE)
seqcodeB = getMaxSeqcode();
int groupIndexB = getNextSeqcodeIndex(0, seqcodeB);
if (groupIndexB < 0)
return;
do {
int groupIndexA = getNextSeqcodeIndex(i, seqcodeA);
... |
386c7406-9052-4e05-ba44-2706b81b839f | 7 | public boolean testWinProb(int changeCount) throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
if (playerInfo.isTing() && changeCount > 0)
return false; // XXX - 写死了听牌后不能换牌
if (subChoices == null) {
// 没有后续动作,收集结果为和牌的换牌,并计算和牌概率(将其发生概率相加)
List<BarBotSimChanging>... |
b4ff4935-3f0f-40d3-83c7-beb1c4b0299e | 8 | final public Stat IfThenElse() throws ParseException {
Block b, b2, b3 = null;
Exp e, e2;
List<Exp> el = null;
List<Block> bl = null;
jj_consume_token(IF);
e = Exp();
jj_consume_token(THEN);
b = Block();
label_2: while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case ELSEIF:
;
... |
08c2e0d6-1ac5-45e5-9123-05fe664e47af | 8 | public Collection<Corpo> getCorpos()
{
Collection<Corpo> corpos = new ArrayList();
if (norteLeste instanceof Corpo)
{
corpos.add((Corpo) norteLeste);
}
else if(norteLeste instanceof ArvoreQuadLocal)
{
corpos.addAll(((ArvoreQuadLocal) norteLeste).getCorpos());
}
if (norteOeste instanceof C... |
43bd46ba-2346-4569-962c-51b7c27b2cc7 | 2 | public double[] getEigenEnergy() {
if (eigenEnergy != null) {
// Already calculated
return eigenEnergy;
}
ArrayList<Double> eigenEnergyList = new ArrayList<>();
// for (int i = 1; i < intervals.size() - 1; i++) {
// if (intervals.get(i).getY() <= intervals.get(i... |
091afc6f-5935-488e-9a7e-9fdb4b07310a | 0 | @Test
public void testGetDiag() {
System.out.println("getDiag");
double l=Math.sqrt(3*3)+Math.sqrt(1*1);
assertEquals(l, new Cylinder(3,1,2.8).getDiag(), 0.01);
} |
b5ace47c-ff31-4619-9f94-dc4127e68326 | 5 | public final Buffer method19(boolean bool, int i) {
if (((Class366) this).anIDirect3DVertexBuffer8511 == null)
return null;
bool &= aBoolean8509;
if (i != 26775)
method21(93);
if (!aBoolean8510
&& ue.a((((Class366) this).anIDirect3DVertexBuffer8511.Lock
(0, anInt8514, !bool ? 0 : 8192,
... |
6093b6c4-9214-497a-b7c0-59c90c6e4c69 | 9 | @Override
public void actionPerformed(ActionEvent e){
//System.out.println(e.getActionCommand());
if (e.getActionCommand().compareTo("Copy")==0 ||
e.getActionCommand().compareTo("Copy_Mac")==0){
StringBuilder sbf =new StringBuilder();
// Check to ensure we hav... |
eb1dedbe-64c9-45f6-ad38-b43cd1ca7a88 | 1 | private static int sumOfArray(int[] binAry) {
int sum = 0;
for (int i = 0; i < binAry.length; i++) {
sum += binAry[i];
}
return sum;
} |
32474a2f-4033-4b7b-82a7-c616d5dd099d | 0 | public Throwable get(int index) {
return exceptions.get(index);
} |
71756bf0-ee5c-4c8d-a1e1-f35b77efa345 | 0 | public HistoryView(int height, int width)
{
textArea = new JTextArea(height, width);
} |
8c2bb5cf-f475-4187-8ace-31f97a100825 | 1 | public DialogFrame(Game owner,DialogMessage message)
{
super("Game Over!");
this.msg = message;
if(owner != null)
{
setLocationRelativeTo(owner);
}
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setResizable(false);
backgroundImage ... |
dd91986c-08c5-477a-803e-c5edef3b8873 | 4 | @Test
public void testFullHouse(){
Set<Hand> previous = new HashSet<Hand>();
for (int i = 2; i < 14; i++) {
for (int j = 2; j < 14; j++) {
if(i == j) continue;
Hand high = new Hand(new Card[]{new Card(Suit.HEARTS,i),new Card(Suit.DIAMONDS,i), new Card(Suit.CLUBS,i), new Card(Suit.DIAMONDS,j), new Card(S... |
8e87983c-7fe9-494f-ba7e-1e0695ad1a32 | 7 | public static void main(String[] args) {
RandomRects a = new RandomRects();
int[] last4Heights = {0, 0, 0, 0};
int[] last4Widths = {0, 0, 0, 0};
while (!(last4Heights[0] < last4Heights[1] && last4Heights[1] < last4Heights[2] && last4Heights[2] < last4Heights[3]) && !(last4Widths[0] < las... |
57fbfa91-b153-4629-835e-849ea454feb0 | 1 | public void setValueAt(Object aValue, int row, int col) {
//data[rowIndex][columnIndex] = (String) aValue;
try {
Files element = fileResultList.get(row);
element.setColumnData(col, aValue);
fireTableCellUpdated(row, col);
} catch(Exception err) {
err.toString();
}
} |
60e65b38-13f6-431e-931d-6f9362ca0e96 | 5 | private void addUndo(CPUndo undo) {
if (undoList.isEmpty() || !(undoList.getFirst()).merge(undo)) {
if (undoList.size() >= maxUndo) {
undoList.removeLast();
}
undoList.addFirst(undo);
} else {
// Two merged changes can mean no change at all
// don't leave a useless undo in the list
if ((undoLi... |
bce2c9d2-4d73-48a6-89a1-10084ca24c6f | 7 | public Grid(short dimension)
{
width = height = dimension;
short squared = (short) (dimension*dimension);
short squaredMinus = (short) (squared - dimension);
short[] state = new short[squared];
for(short i = 0; i < squaredMinus; i++)
{
state[i] = 0;
}
short j = 1;
for(short i = squaredMinus; i < ... |
2c3d891d-b533-4a28-9484-3e68be91da99 | 1 | public static List<String> extractStereotypes(CharSequence text) {
List<String> stereotypes = new ArrayList<String>();
Matcher matcher = Pattern.compile("(<<[^>]+>>)").matcher(text);
while(matcher.find()) {
stereotypes.add(matcher.group(1));
}
return stereotypes;
... |
cd808790-ae59-4737-83ba-c9aa56417b25 | 1 | public BigDecimal getBookingsPrize(List<Booking> bookings) {
Iterator<Booking> iter;
iter = bookings.iterator();
BigDecimal amount = new BigDecimal(0.0);
while (iter.hasNext()) {
amount = amount.add(iter.next().getDiningHall().getPrice());
}
return amount;
} |
c07b2144-9479-4653-a847-b6f4b256115f | 3 | public void generateLevel() {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if(x*y%10<7){
tiles[x + y * width] = Tile.GRASS.getId();
}else{
tiles[x + y * width] = Tile.STONE.getId();
}
}
}
} |
c438aacc-de84-4785-9628-367950f16b8e | 7 | private String getEadURL()
{
if ( getUrl() != null && getUrl().length() != 0 &&
!getUrl().equals( "" ) )
{
BufferedReader in;
String inputLine;
String result;
result = null;
try
{
in =
new BufferedReader( new InputStreamReader( new URL( getUrl... |
c48137a3-0f67-43b1-b07f-20f072fb4c42 | 1 | public void sendMessage(JSONObject o) throws IOException{
if(!isAlive){
Debug.debug("player '" + this.username + "' disconnected, not sending...");
return;
}
socket.getOutputStream().write((o.toString() + "\n").getBytes());
} |
36c2d85c-4035-42f6-aa0e-48920d3c089c | 8 | private void merge( T[] a,T[] tmpArray,int leftPos, int rightPos, int rightEnd){
int leftEnd = rightPos - 1;
int tmpPos = leftPos;
int numElements = rightEnd - leftPos + 1;
// Main loop
while( leftPos <= leftEnd && rightPos <= rightEnd ){
try{
if( (Integ... |
17e28a73-5ed3-49db-a384-0d19309d90e2 | 8 | public void resolveAddresses(){
HashMap<String,Integer> addresses = new java.util.HashMap<String,Integer>();
// Map each Name associated with a Label byte code to the address
// of that label byte code.
for ( int i=0; i<byteCodes.size(); i++){
if (byteCodes... |
2ae0e6a3-028b-4796-b864-2c5b64b76c72 | 9 | String disambiguateName(String name) throws ParsingException {
String[] fields = name.split("[.]");
if (fields.length == 2 && (!fields[0].equals("null")))
return name;
if (fields.length > 2)
throw new ParsingException("Field " + name + " is not a valid field reference."... |
d3965066-acb9-41c7-8aa4-2be1822183e9 | 8 | @Override
public void unInvoke()
{
final Physical P=affected;
super.unInvoke();
if((P instanceof MOB)&&(this.canBeUninvoked)&&(this.unInvoked))
{
if((!P.amDestroyed())&&(((MOB)P).amFollowing()==null))
{
final Room R=CMLib.map().roomLocation(P);
if(!CMLib.law().doesHavePriviledgesHere(invoker(), ... |
499c6041-bfd5-4111-8f3e-c22bf855e3b5 | 4 | public Boolean isSubgraph(Graph g) {
if(g.getNoVertices() < getNoVertices()) {
return false;
}
for(int i = 0; i < getNoVertices(); i++) {
List<Integer> vertices = adjacencyList.get(i);
for (Integer vertice : vertices) {
if (!g.getAdjacentsFor(i... |
9921c37b-44b0-499b-a72f-f5dc05b87d31 | 2 | public double[] columnMinima(){
double[] minima = new double[this.numberOfRows];
for(int i=0; i<this.numberOfColumns; i++){
double[] hold = new double[this.numberOfRows];
for(int j=0; j<this.numberOfRows; j++){
hold[i] = this.matrix[j][i];
... |
b7d3c87e-55d6-4ecc-b290-643ebf4c089f | 8 | private boolean r_verb() {
int among_var;
int v_1;
// (, line 136
// [, line 137
ket = cursor;
// substring, line 137
among_var = find_among_b(a_4, 46);
if (among_var == 0)
... |
fb2cbf03-d8f7-4c9c-bf10-164b1093f011 | 9 | public static void handleItemOnObject(final Player player, WorldObject object, Item item) {
player.getControlerManager().startControler("WGuildControler", new Object[] { });
if(isArmour(item.getId())) {
if(player.getY() != 3533) {
player.getPackets().sendGameMessage("You cannot add the armour from this side.... |
74003d0e-6094-4e49-9f18-997127e8eaf8 | 2 | @Override
public int[] sort(int[] a) {
this.a = a;
len = a.length;
for(int i = 0; i < len; i++) {
bubbleUp(i);
}
for(int i = 0; i < a.length; i++) {
popToEnd();
}
return a;
} |
6f15f428-bd62-456a-b27a-836fb13402f5 | 9 | private boolean r_t_plural() {
int among_var;
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
// (, line 160
// setlimit, line 161
v_1 = limit - cursor;
... |
26b99982-c80a-4623-84f0-82cca7d7148b | 1 | public void printPastMeetings(List<PastMeeting> contactMeetings) {
for (int i = 0; i < contactMeetings.size(); i++) {
System.out.println("Meeting ID: " + contactMeetings.get(i).getID());
System.out.println("Date: "
+ df.format(contactMeetings.get(i).getDate().getTime()));
System.out.print("Attendees: "... |
7d8c7488-beb0-4a5a-ae4e-c87fece3f4f7 | 6 | private void exportToHTML() {
// Prompt save dialog
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(false);
chooser.addChoosableFileFilter(new ExtensionFileFilter(
new String[]{".html"}, // Extensions we accept
"HTML files (*.h... |
465d0545-b469-4521-b074-a0ee0e4e8809 | 3 | public static String left(String str, int len)
{
if (str == null)
{
return null;
}
if (len < 0)
{
return EMPTY;
}
if (str.length() <= len)
{
return str;
}
return str.substring(0, len);
} |
01a499cd-a675-4567-98b0-04b12de540bb | 6 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Undo")) {
((ShapeMaker) frame).getShapeDrawer().undo();
} else if (e.getActionCommand().equals("Redo")) {
((ShapeMaker) frame).getShapeDrawer().redo();
} else if (e.getActionCommand().equals("Finish")) {
System.out.p... |
81ae9b90-92a1-4244-8de6-ddf2643b1f6e | 1 | public static String tankString(Tank t){
String tankString =
t.getId()+","
+t.getName()+","
+t.getX()+","
+t.getY()+","
+dirString(t.getLastDir())+","
+booleanString(t.isAlive())+","
+t.getHp()+","
+t.getCx()+","
+t.getCy()+","
+t.getCwidth()+","
... |
e65f64a1-6691-41e6-be30-f815d38486d1 | 5 | private void optimizarCaminos()
{
ArrayList<Integer> disponibles = new ArrayList<Integer>(); //metas dis�nibles
ArrayList<Integer> asignados = new ArrayList<Integer>(); //metas asignadas
//Asignando camino a bodega para los autos cargados, se elimina el camino a bodega de todos los autos
asignarABodega();
... |
b805a96a-bfe7-49b2-9046-c5682b299526 | 7 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String text, letter;
String used = "";
int count = 0;
boolean charUsed = false;
System.out.print("Please write a text: ");
text = scan.nextLine();
... |
3f59c925-ab16-42e1-9bde-0c757ba75ee6 | 3 | public int getTotalPlaytime(String playerName) {
int totalPlaytime = 0;
try {
ResultSet rs = _sqLite.query("SELECT total(time_online) "
+ "AS total_playtime "
+ "FROM player, login "
+ "WHERE player.playername = '" + playerName + "' "
+ "AND player.id = login.id_pl... |
1349d535-6320-4922-9e17-8a6235f260e5 | 3 | public void setRelativeMouseMode(boolean mode) {
if (mode == isRelativeMouseMode()) {
return;
}
if (mode) {
try {
robot = new Robot();
recenterMouse();
}
catch (AWTException ex) {
// couldn't create ... |
a17ccf3b-5afb-4691-a0d7-3f53edd9c925 | 9 | public void keyReleased(KeyEvent e, boolean type) {
int key = e.getKeyCode();
if (type) {
if (key == KeyEvent.VK_A)
dx = 0;
if (key == KeyEvent.VK_D)
dx = 0;
if (key == KeyEvent.VK_W)
dy = 0;
if (key == KeyEvent.VK_S)
dy = 0;
} else {
if (key == KeyEvent.VK_LEFT)
dx = 0;
if ... |
e4dbdfd3-3fbb-48c9-a374-3d90bce5b185 | 3 | @Override
public List<Produto> filterGrid(final String filter) {
if ("".equals(filter) || filter.equals("*")) {
final List<Produto> lista = service.findAll();
return lista;
}
final ApacheRequest apacheRequest = new ApacheRequest("http://localhost:9000/api/produtos");
final String json = apacheRequest.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.