method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1bff51c2-5ca7-49f9-9887-19a4c3cf9bbb | 7 | public void moveDOWN() {
y += Bullet_SPEED;
if (x > 1800 || x<1 || y>900 || y<1){
//explode();
visible = false;
if(x > 1351 && y>396 && y<600){
GameArea.scoreamount++;
}
}
} |
94ffc9be-bfe2-4bba-813b-5c3933e16c9e | 1 | public static void print(StackMapTable smt, PrintWriter writer) {
try {
new Printer(smt.get(), writer).parse();
}
catch (BadBytecode e) {
writer.println(e.getMessage());
}
} |
7dc58301-92b4-495c-8fb2-7111bd7db80b | 3 | public static void main(String[] args) {
int[] tree;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int size = 1;
while (size < n) size <<= 1;
tree = new int[2 * size];
Arrays.fill(tree, Integer.MAX_VALUE);
for (in... |
4c544243-6365-49ee-a9c5-2e493c4f3b96 | 0 | @Override
public void addPreference(PreferencesGUITreeComponent pref) {
prefs.add(pref);
} |
afef830f-94d0-4c72-b2f5-8aa1780a252a | 9 | public boolean excludeClass(Class<?> clazz, boolean serialize) {
if (version != Excluder.IGNORE_VERSIONS
&& !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) {
return true;
}
if (!serializeInnerClasses && isInnerClass(clazz)) {
return true;
}
... |
28ee11ac-e44f-4169-a8d6-deb33e4a77f4 | 5 | public void z40_calculateFirePower() {
double P = 0.25;
if (_robot._currentEnegy >= AngryTankJr.ENERGY_NORMAL_THRESHOLD) {
P = 0.2;
if (_robot._aliveRobotsCount > 2) {
P = 0.4;
}
} else if (_robot._currentEnegy <= AngryTankJr.ENERGY_WARNING_THRESHOLD) {
P = 0.25;
if (_robot._aliveRobotsCount > ... |
30a953c1-5480-4223-a669-f2e6c076055d | 2 | @Override
public String toString() {
if (getFileNames().isEmpty()) {
return "No files found.";
}
StringBuilder sb = new StringBuilder();
for (FileModel fileName : getFileNames()) {
sb.append(fileName).append("\n");
}
return sb.toString();
} |
24c6356d-2542-4b0d-a8af-97ded90d59e1 | 0 | public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
} |
3b2424af-1839-48c0-b9d8-4ea47ed3bd25 | 0 | public int getLength(){
return listDataOut.size();
} |
2ce1a5df-d985-4068-bc80-ff495bddf57a | 2 | @Test
public void testDeleteElement() throws Exception {
List<String> list = new List<>();
list.addToEnd("test1");
list.addToEnd("test2");
for (String current : list) {
assertTrue(list.exist(current));
}
list.deleteElement("test2");
list.deleteElem... |
9a7d4a60-04ac-4550-997c-780f10f04ade | 4 | @Override
public void keyReleased(KeyEvent e) {
if (open) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
open = false;
currentMessage = "";
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
open = false;
if (!currentMessage.equals("")) {
waitingMessage = currentMessage;
}
currentMes... |
2850ba43-328c-4207-bdd2-645332eb12c0 | 1 | public static String removeDoubleSpace(String s)
{
return s == null ? null : StringUtils.replace(s, " ", " ");
} |
62f5de0f-000c-49b9-8cb2-f3764646132f | 6 | public void setSelectedItem(Object element) {
if (element == null) {
if (elementIndex != -1) {
elementIndex = -1;
fireContentsChanged(this, -1, -1);
}
} else if (element instanceof String) {
int index = 0;
String name = (Str... |
16dc3cf8-eaa7-46df-a387-11881a21cd95 | 3 | public void addPolyNodeLast(int coefficient, int exponent){
//Check to see if exponent is a positive number(-1 = no exponent)
if(exponent < -1)
throw new IllegalArgumentException("Exponent must be a positive"
+ " integer.");
//Check to see if Polynomial is empty
... |
003c49f5-1da5-4170-8e2e-08cbc88cfd04 | 7 | public static void genLibList() {
String strPath = launcher.workingDirectory.getAbsolutePath() + "\\serverside\\all_libs_to_download_and_add_to_classpath.txt";
System.out.println("> TRY-DIR == " + strPath);
System.out.println("");
System.out.println("");
ArrayList<String> paths = new ArrayList<String>();
... |
c8d663f0-7110-45d6-a188-ce3fe04d1cc4 | 8 | protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
Content contentTree) {
arr = Util.filterOutPrivateClasses(arr, configuration.javafx);
if(arr.length > 0) {
Arrays.sort(arr);
boolean printedHeader = false;
HtmlTree ul = new HtmlTree(... |
71fe5147-a63c-4368-b5ee-0d904287e428 | 8 | public void keyReleased(KeyEvent e) {
// Verifica que la tecla se haya soltado para dejar de mover el personaje
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
izquierda2 = false;
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
derecha2... |
8555fef4-75a6-4e9e-abc7-ec1cd856b5b7 | 2 | public List<Node> getRoute(Node toNode)
{
if (route == null || route.isEmpty())
{
route = new ArrayList<>();
//for(Node node : edgeTo.keySet())
{
//route.add(node);
}
getPathRecoursive(toNode);
System.out.println("edgeTo: " + edgeTo.size());
System.out.println("route: " + route.size());
... |
51c6329e-efdd-4604-8265-1e4f3c7b02ac | 3 | public void append(WordData word) {
lock.lock();
try {
//Buffer Full Wait for slot to open
while (count == buffer.length) {
empty.await();
}
//Put WordData in buffer
buffer[appendPointer] = new WordData(word.getWord(), word.getLineNumber() , word.getFileName() );
appendPointer++;
//... |
b4b3f47c-e635-4e94-8bce-ccd6580fe965 | 3 | public void inserta(Nodo m)
{
if(llave < m.llave)
if(der == null)
der = m;
else
der.inserta(m);
else
if(izq == null)
izq = m;
else
... |
caa2f8be-e099-453b-934e-70194c41f7d8 | 6 | private void loadForeground(String file)
{
int r, g, b;
int width, height;
Scanner sc;
try {
sc = new Scanner(new File(file));
sc.nextLine();
sc.nextLine();
width = sc.nextInt();
height = sc.nextInt();
sc.nextInt();
for (int i=0; i<height; ++i) {
for (int j=0; j<width; ++j) {
r... |
6fe446e9-d357-44d5-b054-361ddbd1e06e | 5 | public void ge_and_logical(TextArea area,SimpleNode node,String prefix,int cur_end_num,int if_or_while)throws SemanticErr{
int and_num = node.jjtGetNumChildren();
int con=0;
for(int i=0;i<and_num;){
and_last=0;
if(i==0)and_last=-1;
if(i==and_num-1) and_last=1;... |
08419652-9731-42db-9cd3-6e0d560011b5 | 9 | public CalendarCache getCacheItem(int iIndex)
{
if (m_modelCache == null)
m_modelCache = new Vector<CalendarCache>();
if (iIndex < m_modelCache.size())
{
// Check to make sure the cache matches
return (CalendarCache)m_modelCache.elementAt(iIndex);
... |
c4ee9c67-e280-4d48-bd71-33a08908c9b3 | 5 | public int getMagicIndex(int array[], int lo, int hi) {
if (lo > hi)
return -1;
else if (lo == hi && array[lo] == lo)
return lo;
else {
int mid = (lo + hi) / 2;
if (array[mid] > mid)
return getMagicIndex(array, lo, mid - 1);
else if (array[mid] == mid)
return mid;
else
return getMagi... |
3292725d-1e45-4903-96fc-310efb26c9a1 | 8 | private int findPosEnd(String label, int cursor) {
int posEnd = label.indexOf('@', cursor);
int posEndPrime = label.indexOf('.', cursor);
if(posEnd == -1 || (posEndPrime < posEnd && posEndPrime != -1)) {
posEnd = posEndPrime;
}
if(posEnd == -1) {
posEnd = label.length();
}
else if(label.substring(po... |
a27efda1-beb7-4d9f-9a84-d40aa93cbf97 | 7 | public List<List<Integer>> levelOrder(TreeNode root) {
ArrayList<List<Integer>> result = new ArrayList<List<Integer>>();
if (root == null) {
return result;
}
Queue<TreeNode> queue = new LinkedList<TreeNode>();
Set<TreeNode> V = new HashSet<TreeNode>();
V.ad... |
59ffa476-a860-4776-8792-e3434d422ac5 | 8 | @Override
public void mouseReleased(MouseEvent ev) {
if (ev.getButton() == MouseEvent.BUTTON1 && !wasMenuShowing) {
if (graph.isNodeSelected() && computation != null) {
int x = ev.getX();
int y = ev.getY();
boolean wasStarted = false;
if (!computation.isDone()) {
computation.cancel(tr... |
300c5d83-002e-4e9d-9837-bbb2e63a7df1 | 8 | private void addSlider(int startIndex, int delta, int piece) {
int square = startIndex + delta; // Initialize the square by moving
// to the next square from
// startIndex in the delta direction
// Follow the delta until we exit the board or run into a piece
while ((square & 0x88) == 0 && b... |
6a67b8c3-6fee-4bd1-add6-181f144a1a8b | 8 | @Override
public void startElement(String uri, String localName, String qName,
Attributes attrs) throws SAXException {
if ("way".equals(qName)) {
vw.setWayId(Integer.parseInt(attrs.getValue("id")));
}
else if ("nd".equals(qName) && "way".equals(eleStack.peek())) {
if (clcMainNodes
.containsKey(Inte... |
08548312-bcfc-49b0-b36b-d1107b7a0042 | 6 | public int useOrderOn(Territory territory){ // int ou void ???
if(this==territory){
return 3;
}else if(order.getType()==OrderType.RAI){
if(territory.getOrder().getType()==OrderType.CON) pillaging(territory);
territory.rmOrder();
this.rmOrder();
return 0;
}else{
if((territory.getTroup()==null || ... |
d7225ee3-728d-461f-a834-71d1c0736752 | 0 | public static void main(String[] args) throws IntrospectionException {
BeanInfo beanInfo = Introspector.getBeanInfo(BeanInfoTest.class);
System.out.println(beanInfo.toString());
System.out.println(beanInfo.getBeanDescriptor());
} |
e1a0914d-5593-4bdb-b45b-cac8159ee81a | 3 | public boolean duplicateEntryRow(int x, String entry) {
boolean duplicate = false;
for (int i=0; i < sudokuGrid.length && !duplicate; i++) {
duplicate = (sudokuGrid[x][i].equals(entry) ? true : false);
}
return duplicate;
} |
59052dc1-c3bf-4535-ae9c-c1b65c1efae0 | 6 | public void setLines(List<String> data) {
lines.clear();
sequence = "";
boolean seqReading = false;
for (String dataPart: data) {
String[] linesRead = dataPart.split("\\r?\\n");
for (String l : linesRead){
if (seqReading && !l.startsWith("//")) {
String seqPart = l.trim();
... |
f32ab378-3853-403b-bc98-0ab723c6df95 | 7 | static final void method1352(int i, int i_0_, int i_1_, byte i_2_) {
anInt4664++;
if (i_2_ != -98)
method1354((byte) 69);
i_0_ = (i_0_ * ((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub26_7260.method1838(-32350)
>> -2091864696);
if (i_0_ != 0 && i != -1) {
if (!EntityPacket.aBool... |
fd951181-4d03-4578-8b85-1773fd3c0cb6 | 4 | @Override
public void run()
{
super.run();
try
{
// read
//socket = new Socket("192.168.117.107", 3773); //prof's comp
socket = new Socket("localhost", 3773);
// once connection is made, send it back to the UI
chatUI.setSocketComponets(socket);
InputStream in = socket.getInputStream();
... |
a4d16488-7ad2-4019-809f-a5b976d69745 | 9 | static byte CraftingTableFix(byte data, String kierunek)
{
if (kierunek.equals("left"))
{
if (data == 1) {
return 2;
}
if (data == 2) {
return 3;
}
if (data == 3) {
return 4;
}
if (data == 4) {
return 1;
}
}
... |
284b2f8e-2871-41bb-8abc-b4bfa7ae13a3 | 4 | public int setEtat(String etat) {
if(etat.equalsIgnoreCase(ConfigGlobale.etatHS) || etat.equalsIgnoreCase(ConfigGlobale.etatOK) || etat.equalsIgnoreCase(ConfigGlobale.etatOFF) || etat.equalsIgnoreCase(ConfigGlobale.etatMaintenance)){
this.etat = etat.toLowerCase();
return 0;
}
... |
04c5e54b-0330-4a35-80f5-dceeb39d9d3f | 8 | public void renderProjectile(double xPos, double yPos, Sprite p, boolean flip) {
xPos -= cameraXCoord;
yPos -= cameraYCoord;
for(int y = 0; y < p.getSizeY(); y++) {
double yAbs = y + yPos;
for(int x = 0; x < p.getSizeX(); x++) {
double xAbs = x + xPos;
int xs = x;
if(flip) xs = (p.getSizeX() - 1... |
7b6cd14c-3259-461a-be9d-4875664979a5 | 7 | @SuppressWarnings("unchecked")
private GUI getGUI(Color faction)
{
if(playerType.equals(HUMAN))
{
@SuppressWarnings("rawtypes")
Class gui = GUIList.get()[specificType.getSelectedIndex()];
@SuppressWarnings("rawtypes")
Constructor cntr = null;
try {
cntr = gui.getConstructor(new Class... |
dc1cc015-49e4-4d88-83fb-3608cfd9953c | 5 | public static void main(String[] args) throws IOException {
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedReader br = new BufferedReader(new FileReader("input.in"));
StringBuilder sb = new StringBuilder();
String line = "";
d: do {
line = br.readLine();
if (line == n... |
ec542532-85b2-4058-85d6-ecd466bfd9fc | 5 | public LoginPanel() {
super();
setLayout(new GridBagLayout());
clicked = false;
username.addMouseListener(new MouseAdapter(){
public void mouseClicked( MouseEvent e ){
if ( !clicked ) {
clicked = true;
username.setText("");
return;
}
... |
d0a8f762-3bdc-4ea8-bbe8-2e41e2ec4f6d | 4 | public int checkAcross() {
int found = 0;
boolean same;
//this function checks all the rows
//it stores the moves performed in a rows
//in an array and checks if they were performed by the same player
char[] checker = new char[3];
int x = 0;
int y = 0;
while((found==0) && (y<3)) {
for(x=0; x<ROWCOL; ... |
c7885aad-0993-409c-81e6-a558ed0a5751 | 5 | private void setCommonCoordinates() throws Exception {
ArrayList<Coordinate> commonCoordinates = new ArrayList<Coordinate>();
for(Coordinate c1 : v.getCoordinates()){
for(Coordinate c2 : w.getCoordinates()){
if(c1.equals(c2)){
commonCoordinates.add(c1);
}
}
}
if(commonCoordinates.size(... |
82f3559d-988f-40ad-93d4-73969cac763d | 7 | private void disconnect() { //pour déconnecter le client proprement
try {
if(sInput != null) sInput.close();
}
catch(Exception e) {}
try {
if(sOutput != null) sOutput.close();
}
catch(Exception e) {}
try{
if(socket != null) socket.close();
}
catch(Exception e) {}
if(clientUI != nu... |
9a158fa0-1664-45e9-84e1-e0e0881031ff | 1 | public void test_now_nullChronology() throws Throwable {
try {
MutableDateTime.now((Chronology) null);
fail();
} catch (NullPointerException ex) {}
} |
f921005b-b3e8-4bbd-b76e-90601d9e8912 | 6 | private void initDragAndDrop() {
dragAndDropPanel.setDropTarget(new DropTarget() {
@Override
public synchronized void drop(DropTargetDropEvent dtde) {
try {
Transferable transfer = dtde.getTransferable();
if (transfer.isDataFlavorS... |
ae177b5e-7beb-4d5c-a433-623689e3120b | 5 | public static void tweet(String text)
{
if(!(text.equals("")))
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey(OAUTH_CONSUMER_KEY);
cb.setOAuthConsumerSecret(OAUTH_CONSUMER_SECRET);
cb.setOAuthAccessToken(OAUTH_ACCESS_TO... |
6390a4c2-d967-4741-9d8e-cfd30b449d7f | 1 | private void setPropAndAdd(SurfaceShape shape, String tooltip) {
shape.setHighlightAttributes(attrHigh);
if (tooltip != null) {
shape.setValue(AVKey.HOVER_TEXT, tooltip);
}
addRenderable(shape);
} |
b1f7d01a-2202-4e49-9adc-d364e6f24527 | 2 | public boolean charsAtEqual(ArrayList<String> file, int index, int num, String[] chars) {
for (int j=0; j<chars.length; ++j){
if(!charAtEquals(file, index, num, chars[j])) {
return false;
}
}
return true;
} |
5a3dfd13-35dd-4e28-a44e-cce35c10ffa2 | 5 | public static void main(String[] args) throws Exception {
long t = System.currentTimeMillis();
/* Configure command line */
Options cmdLineOptions = new Options();
cmdLineOptions.addOption("g", "graph", true, "graph file name");
cmdLineOptions.addOption("n", "nshards", true, "n... |
132d956a-b10f-413c-9a31-1541e34fb580 | 3 | public void printStatistics() {
System.out.printf("Trace Aspect recorded following results:%n");
List<MethodStatistics> statistics = MethodStatisticsHelper.sortDescendingByTime(methodStatistics.values());
for (MethodStatistics statistic : statistics) {
System.out.println(statistic);
}
System.out.printf("C... |
274b5825-ded7-4ccd-ad4a-ec582c0b4213 | 2 | public Connection connect(){
try{
//load and register the driver
Class drvClass = Class.forName(driverName);
DriverManager.registerDriver((Driver) drvClass.newInstance());
}
catch(Exception ex){
System.out.println("<hr>" + ex.getMessage() + "<hr>");
}
try{
//establish the connection
... |
64ab3c31-2d86-4847-84bd-20c5e1c0cdd0 | 1 | private static int initImage1(final Display display, Composite inComposite) {
int heightHint = 0;
final Composite original = new Composite(inComposite, SWT.BORDER);
try {
image1 = new Image(display, Resource.class.getResourceAsStream(image1Path));
} catch (Exception e1) {
throw new RuntimeException(e1);
... |
901db6eb-daac-49ae-b8fd-bc2139c982ad | 6 | public static void ReadHistory() {
String file = JServer.rootDir + "history";
String cLine;
int lines = 0;
int line = 0;
history = "";
try (BufferedReader bReader = new BufferedReader(new FileReader(file))) {
while (bReader.readLine() != null)
lines++;
} catch (IOException ex) { }
try (Bu... |
d08d2e62-b72c-44b0-8b95-060566bbf9f6 | 7 | public static void assignByReference(String result, String exp, int[] offset) throws Exception{
if(result.equals("MP_FIXED")){
result = "MP_FLOAT";
}
if(exp.equals("MP_FIXED")){
exp = "MP_FLOAT";
}
if(result.equals(exp)) {
// do nothing
} else if(result.equals("MP_FLOAT") && exp.equals("MP_INTEGER"... |
ee1c3062-2431-41a1-9fe5-1beba91a33f0 | 0 | public void setMoney(int money) {
this.money = money;
getPlayer().sendPluginMessage(The5zigMod.getInstance(), "5ZIG", ("/s/money=" + money).getBytes());
} |
8ffb7650-0d4f-40cd-9dd8-809665077ef7 | 9 | private OutputModel _solve(boolean probalistic, double alpha)
throws Exception
{
//Debug flags
boolean needPresolveCorrection = true;
boolean ownConvexClass = false;
boolean needHalfPresolve = true;
boolean KKKT = false;
//Conditions
... |
d6bd49c8-a15d-4031-9b12-b5e675a85c41 | 2 | public void flush(){
System.err.println("Flushing the DB...");
for(;;){
try{
synchronized(this.queue){
this.queue.wait();
System.err.println("Flushed");
return;
}
}catch(InterruptedException e){
//if we are interrupted go back to waiting some mor... |
7834d9be-7eaa-4607-bb1f-3b7e2bfcd5dd | 3 | @Override
public void write(int index, Data data) {
if (index > -1 && index < 16) { //Ensure valid index (0-15)
if (data == null) { //Indicates clearing of register field on GUI
fireUpdate(index, "");
}
else {
generalPurposeRegisters[index] = data;
fireUpdate(index, data.toString());
}
}
} |
73f1012e-e6fd-4360-b916-94e6e500ba7d | 8 | void copy(boolean toModel, String fieldToUpdate, YIComponent view, Object model) {
ArrayList components = YUIToolkit.getViewComponents(view);
Iterator it = components.iterator();
while (it.hasNext()) {
Object comp = it.next();
// copying first extended fields since this is usu... |
3aa4dfb8-97c6-4998-8d4d-a82b241b9982 | 5 | protected void WaitTillFinish(OperationType opt){
if (opt == OperationType.OT_train)
allocateQueries();
for(LambdaRankWorker worker:m_workers) {
worker.setWeight(m_weight);
worker.setType(opt);//evaluation on training queries
}
for(int i=0; i<m_threadpool.length; i++){
m_threadpool[i] = new Th... |
3a0c2680-9ca7-4b25-855d-ba7e3f52edb3 | 6 | public static boolean verifySmelter(Location machineLocation)
{
BlockFace facing = Smelter.getDirection(machineLocation.getBlock().getState().getRawData());
Location startingPosition = machineLocation.add(Smelter.getOffset(facing));
Dimensions dimensions = Smelter.getDimensions(facing);
for (int x = 0; x < ... |
306c71a1-3a29-4a1f-8dee-d33b6d30afb6 | 4 | @Override
public void actionPerformed(ActionEvent event) {
Object source = event.getSource();
if (source.equals(itemNewGame)) {
// start a new Game
new GraphicalUIMenuNewGame(controller);
} else if (source.equals(itemExitGame)) {
// exit the Game
... |
01ed99e2-0793-4d0d-95ed-83d87b2c3949 | 7 | public int draguer(Client joueur, int dette) {
int nombreAtrouver, nombreDuJoueur = 100, nombreEssais = 0;
String nombreString;
nombreAtrouver = (int) (Math.random() * 50);
System.out.println("Si vous êtes bon en drague, l'autre personne paiera pour vous et votre dette sera effa... |
5bca1084-6ae0-4bea-9829-9a6976f1a971 | 0 | private boolean move() {
double value = random.nextDouble();
return value < MOVE_CHANCE;
} |
111d1c67-4886-4cee-b3f1-178684ac001c | 2 | ArrayList<Integer> OJ(TreeNode p) {
Queue<TreeNode> queue = new LinkedList<TreeNode>();
ArrayList<Integer> result = new ArrayList<Integer>();
queue.offer(p);
while (!queue.isEmpty()) {
TreeNode current = queue.poll();
if (current == null) {
result... |
10760710-b5ac-4b36-8929-e3c05de0392e | 5 | public static Model concatenate(Model... models) {
int newSize = 0;
for (Model model : models) newSize += model.elementCapacity;
Model newModel = new Model(newSize);
for (Model model : models) {
model.rewindBuffers();
// copy over other data
for (int i = 0; i < model.elementCapacity * VERTEX_STRID... |
3b39df0d-14d6-46f6-8f8e-55cd0fe34173 | 5 | @Override
public byte[] getBytes() {
ByteArrayOutputStream b = new ByteArrayOutputStream();
try {
b.write(getMessageFactory().createVariableLengthIntegerMessage(encoding.getConstant()).getBytes());
switch (encoding) {
case IGNORE:
break;
case TRIVIAL:
data = content.getBytes("UTF-8");
br... |
becc0f80-981a-4810-8c1e-c352230f1dfb | 1 | public void setStatustextFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.statustextFontStyle = UIFontInits.STATUS.getStyle();
} else {
this.statustextFontStyle = fontstyle;
}
somethingChanged();
} |
2f8ddd8a-6d56-4264-a457-9caba479494f | 3 | protected void paintProvince(final Graphics2D g, int provId) {
final String religion = mapPanel.getModel().getHistString(provId, "religion");
if (religion == null) {
mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST);
} else if (religion.length() == 0 || religion.equalsIgnore... |
f96ac43e-f27b-49fa-8648-bcfd54dc2f93 | 9 | public void processPacket(String received) {
stringParts = received.split(" ");
try {
// auction- ended- notification
if (stringParts[0].equals("!auction-ended")) {
String describtion = "";
// user is the highest bidder
if (username.equals(stringParts[1].trim())) {
for (int i = 3; i < st... |
61ea9d4d-2533-4681-b26a-31ad3d7f9ef4 | 8 | public static void main(String[] argv) throws IOException {
if (argv.length < 2) {
System.out
.println("Please provide at least two arguments: <Config File> <Name>");
return;
}
String configPath = argv[0];
String name = argv[1];
Messag... |
4595d5c2-4367-4f94-a4f2-dc645fd04a4b | 5 | public void run() {
// Set the north label
turnLabel.setText("Player " + player.getNumber() + "'s Turn");
// Set color based on player number
if(player.getNumber() == 1)
turnLabel.setForeground(GameBoard.PLAYER1);
else if(player.getNumber() == 2)
turnLabel.setForeground(GameBoard.PLAYER2);
else if(... |
2d107d67-e5dc-4118-ae70-89f51cc3a262 | 5 | private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
String number = jTextField1.getText();
if (!number.equals("") && !word(number) && Integer.parseInt(number)<=12) {
numberOfProcess... |
62e1ef31-ca1a-40ce-b2cf-66d185c25766 | 6 | public void play() throws InterruptedException {
Chord tempChord;
int notes = 0;
int thisNote;
// For each chord, if the last has gone on long enough play the next one
// Notes are played every 1/4 chord in between
while (iterChord.hasNext()) {
... |
9f4bceb4-d8ea-47d2-afb9-75f3a3396eda | 5 | public static void main(String[] args) throws ParseException {
Options options = new Options();
OptionBuilder.isRequired();
OptionBuilder.hasArg();
OptionBuilder.withArgName("file");
OptionBuilder.withDescription("Input file");
options.addOption(OptionBuilder.create("inputFile"));
OptionBuilder.i... |
56b517cf-1fc0-4605-96a8-dff93acca204 | 1 | public void testConstructor_invalidObject_Chronology() throws Throwable {
try {
new MutableDateTime(new Object(), GregorianChronology.getInstance());
fail();
} catch (IllegalArgumentException ex) {}
} |
0c43e348-5366-4db8-ab2b-f3d89cfb68d9 | 9 | public String[][] filterPenalties(String array[][], int member, int direction)
{
// sortLog.log("--------------------------");
int arrayLength = getArrayLength(array);
DataRow list[] = new DataRow[arrayLength];
DataRow dr2;
DataRow dr1;
DataRow parser = new DataRow()... |
eebdc2c3-c41f-4b45-9514-fd0c4071d39a | 2 | public SignatureVisitor visitExceptionType() {
if (state != RETURN) {
throw new IllegalStateException();
}
SignatureVisitor v = sv == null ? null : sv.visitExceptionType();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
} |
697b02a1-b2a0-49ca-93a1-9e87a246b4cf | 4 | public String[] justify(String[] textIn)
{
int l = 0;
StringBuilder sb = new StringBuilder();
for(int i = 0; i < textIn.length; i++)
if(textIn[i].length() > l)
l = textIn[i].length();
for(int i = 0; i < textIn.length; i++)
{
sb = new StringBuilder(textIn[i]).reverse();
while(sb.toString().... |
5de84229-6d1a-46a8-90f1-a7480a9b34ff | 0 | private void mundoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mundoButtonActionPerformed
// TODO add your handling code here:
EventDescriptionWindow newWindow = new EventDescriptionWindow();
EventDescriptionWindow.setEventDesription(knowledge.mundo.getEventDescriptio... |
8563174d-ccca-4b73-8696-c72eaaba6255 | 5 | public static void main(String[] args) throws IOException {
HashMap<String, File> fileMap = Utility.prepareDictionaryFiles(args[0]);
InfoLoader infoLoader = new InfoLoader(fileMap.get("ifo"),
Constant.UTF8);
infoLoader.loadData();
File[] dictFiles = { fileMap.get("idx"), fileMap.get("dict") };
final DB... |
c99eda73-5a7b-4085-a3c4-fe3907ae64af | 0 | @Id
@Column(name = "PRP_ID_ELEMENTO")
public Integer getPrpIdElemento() {
return prpIdElemento;
} |
59d9d257-8765-44bb-a1e5-596f86b4b149 | 8 | public Response getResponse (Request req, Route route)
{
if (!req.path.startsWith (route.pathPrefix))
throw new IllegalArgumentException ("bad request path for view");
String subpath = req.path.substring (route.pathPrefix.length ());
if (subpath.startsWith ("/"))
subpath = subpath.substring (1);
St... |
4e425916-a589-499b-8a10-056c94e5278a | 4 | static String getPlatformFontFace(int index) {
if (SWT.getPlatform() == "win32") {
return new String[] { "Courier", "Impact" }[index];
} else if (SWT.getPlatform() == "motif") {
return new String[] { "Courier", "URW Gothic L" }[index];
} else if (SWT.getPlatform() == "gtk") {
return new String[] { "Couri... |
04393029-0666-4652-98ce-60a75138fdb3 | 2 | public Map<String, Integer> getGroups(Connection con) {
/* Compose query. */
String SQL_QUERY= "SELECT user_group_id, title "
+ "FROM xf_user_group;";
/* Execute query. */
try {
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(SQL_QUERY);
/* Create map of groups and their id... |
c5b2c27d-eb1f-469c-bf30-b00d1122e701 | 0 | public void addPermission(String permission){
this.permissions.add(permission);
} |
09431756-e7ab-41e3-b2c7-e7950426f4b6 | 3 | public boolean openAndReadData(){
try {
String line;
reader = new BufferedReader(new FileReader("data/Database_v2.txt"));
while ((line = reader.readLine()) != null) {
content.add(line);
}
reader.close();
return true;
} catch (FileNotFoundException e) {
writeLog(e);
return false;
} catc... |
4c932fa1-9c73-42cb-be1b-1f5168e8c0a1 | 0 | public DijkstraTest() {
} |
31bcc944-bcff-4916-ad26-4d23ea9e5e36 | 3 | private void createList(Class<?> c){
if(map.containsKey(c)){
if(map.get(c)== null){
map.put(c, new ArrayList<Listener>());
}
}else{
map.put(c, new ArrayList<Listener>());
}
} |
62d70698-c88b-47a8-b1bc-7bf24a62263b | 5 | private Pid tryMakePid(String uri, String checksum, String RoR) throws IOException {
List<PidData> data = new ArrayList<PidData>();
data.add(new PidData(Strings.PID_RECORD_KEY_URL, uri));
if (checksum != null) {
data.add(new PidData(Strings.PID_RECORD_KEY_CHECKSUM, checksum));
... |
04fd9919-f487-4221-8577-25f9ea65a81b | 5 | @Override
public void update(GameContainer gc, StateBasedGame sb, int delta)
throws SlickException {
for (MenuButton button : buttons) {
button.update(gc, sb, delta);
}
if (musicButton.isMousePressed()) {
if (Game.getMusic().paused()) {
Game.getMusic().resume();
} else {
Game.getMusic().paus... |
2095c153-ccbc-4c8e-a470-7f7feabf972d | 0 | public String displayInfo(){
return "All animal classes are subclasses of Animal.";
} |
0a7cc4a7-0fe2-43d8-9e85-4ab5c63c9790 | 6 | @SuppressWarnings("unchecked")
public static void onReadMSConfig(JSONObject json){
log.info("onReadMSConfig called.. : " + json.toJSONString());
MSConfig serviceCfg = MSConfig.getInstance();
String fileName = serviceCfg.getConfigMap().get("MSConfigFile");
InputStream ins;
BufferedReader br;
try... |
8198770a-84a8-45e8-8111-9044f0f90081 | 8 | public final void push(View view, LayoutType layout, View pusher) {
if (pusher != null) {
int origin = this.stack.indexOf(pusher);
if (origin == -1) {
// pusher.. didn't.. exist..
throw new RuntimeException("WAT. This should never happen.");
}
if (origin < this.stackPointer) {
try {
this.... |
49fd56bf-eb82-4ff1-9ad4-3fdd95ce003b | 9 | public SpriteSheet(){
try{
// Get the image file for the sprite sheet of towers
BufferedImage towerSheetBig = ImageIO.read(new File("res/tower_sheet.png"));
// Set the dimensions of the sprites
final int tsWidth = 64;
final int tsHeight = 64;
// Set the number of rows and columns in t... |
22d19055-d479-4fdb-ac00-1ea95f0c1549 | 8 | public static boolean createNativeClassP(Stella_Class renamed_Class) {
{ String classnativetype = null;
if (((Keyword)(Stella.$TRANSLATOROUTPUTLANGUAGE$.get())) == Stella.KWD_COMMON_LISP) {
classnativetype = ((StringWrapper)(KeyValueList.dynamicSlotValue(renamed_Class.dynamicSlots, Stella.SYM_STELLA_... |
5ce2398f-0ad4-4cef-80c3-3f676102a9c0 | 1 | private String generateBoundary() {
final char[] BOUNDARY_CHARS = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
final String BOUNDARY_BASE = "---BOUNDARY-";
StringBuilder buffer = new StringBuilder();
buffer.append(BOUNDARY_BASE);
Random rand = new Random();
int count =... |
2ae67e3c-d628-4e76-ba81-7ccd37d9f661 | 5 | public synchronized void drawCards(byte playerNum){
System.out.println(playerNum + "wants to draw cards");
if (!playersAskingDraw.contains(playerNum)) {
playersAskingDraw.add(playerNum);
}
if (playersAskingDraw.size()<=(numPlayers-numPlayersRemoved)/2) {
return;
}
if(cardsOnField>=21){
return;
... |
07003199-badc-4c2c-8c26-d3ffc02df7df | 3 | public String getConsulDefMap(String arg_dt1) throws SQLException, ClassNotFoundException {
ResultSet rs;
String sts = "";
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Conexoes Atingida!");
}
tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.