method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6021f3bc-a2d4-4e33-9f50-35262a878193 | 6 | public Result fire(int ...coords) throws BadCoordinate {
if (coords.length != 3)
throw new BadCoordinate();
for (int d=0; d<3; d++) {
if (coords[d] < 0 || coords[d] >= 10) {
throw new BadCoordinate();
} else {
coords[d] = pos[d... |
2e62437d-5b19-47e4-b6de-c0a5d802661c | 1 | public void setUpdatedTime(Date time)
{
if (time == null) throw new IllegalArgumentException("Time cannot be null");
this.time = time;
} |
fdb6b852-0952-4d7b-9be4-a503745e34d7 | 4 | private static float reservedForCollection(
Batch <Behaviour> doing, Service goodType
) {
float sum = 0 ;
for (Behaviour b : doing) {
if (b instanceof Delivery) for (Item i : ((Delivery) b).items) {
if (i.type == goodType) sum += i.amount ;
}
}
return sum ;
} |
4adedea8-b839-437e-a425-9c9127202322 | 6 | public MainMenuWindow() {
super();
getContentPane().setLayout(null);
JLabel lblVersion = new JLabel(Constants.NAVALBATTLE_VERSION_TITLE);
lblVersion.setForeground(Color.WHITE);
JLabel lblNavalBattle = new JLabel("NavalBattle");
JButton btnSingleplayer = new JButton("Singleplayer");
JButton btnHelp = new... |
3457df0c-22fd-4d06-ae12-7372e370bba4 | 0 | public static long read32bitLittleEndianUnsignedInt(RandomAccessFile f) throws IOException {
Integer d0,d1,d2,d3;
d0=0xff & read_sure(f);
d1=0xff & read_sure(f);
d2=0xff & read_sure(f);
d3=0xff & read_sure(f);
return (long)(d3<<24) + (d2<<16) + (d1<<8) + d0;
} |
5d2b3a9c-39ee-41b1-b671-de9eed23c0af | 5 | public void move(int direction) {
boolean temp = this.moveBoolean(direction);
if (this.moveBoolean(direction) == true) {
switch (direction) {
case 2:
this.row++;
break;
case 4:
this.col--;
... |
1d76238d-9709-43df-8313-f127e71f61d3 | 3 | public Sentence (CoreMap annotatedSentence, int index, int docnum)
{
this.sentence = annotatedSentence.get(TextAnnotation.class);
this.terms = new ArrayList<String>();
this.posTags = new ArrayList<String>();
this.index = index;
this.docnum = docnum;
for (CoreLabel token: annotatedSentence.get(TokensAnnotat... |
799910c7-d906-4119-9e3d-463c8726a005 | 9 | private static boolean is4Prime(int n){
if (didThis[n] == true) return is4Prime[n];
didThis[n] = true;
Set<Integer> used = new HashSet<Integer>();
int t = n;
for(Integer p : primes){
if (t%p==0){
t/=p;
used.add(p);
if(used.size()==4) break;
}
}
while(t!=1){
boolean found = false;
... |
5d08d787-4af3-4944-a840-3825f0201c57 | 0 | public int size() {
return exceptions.size();
} |
9e8673e6-b33b-40e5-a268-6a0aafbae5e1 | 5 | public String[][] searchProgrammsLinux() {
//
// These method searches for some standard programs
// with are usually installed on a linux system.
// The return String[] includes:
// [0] - FileBrowser
// [1] - WebBrowser
// [2] - mp3/ogg Player
// [3] - streamripper
//
String[][] programNames = {
/*[0]*/ {"... |
debca052-71bc-4204-8fbb-2b37ffbe0f3a | 6 | @SuppressWarnings("unchecked")
public static Entry<String, Object> getEntry(Object obj)
{
if (obj instanceof Entry)
{
Entry<?,?> e = (Entry<?,?>) obj;
if (e.getKey() instanceof String)
return (Entry<String, Object>) e;
}
return null;
} |
762fd3ae-5b3f-4d09-a0d6-adb14c0736ce | 7 | public boolean inferenceCheckerHelper(LinkedList<String> curQueue,ArrayList<LinkedList<String>> Queues) throws IllegalInferenceException
{
String curSymbol = (String) curQueue.pop();
if(curSymbol.equals("=>"))
{
boolean bol1 = inferenceCheckerHelper(curQueue,Queues);
boolean bol2 = inferenceCheckerHelper(... |
8171208f-6ab1-417d-a88d-6a410dfbb34c | 9 | @SuppressWarnings("unchecked")
private void disableMash() {
// one source of references to PySystemState
Py.getSystemState().cleanup();
Py.setSystemState(null);
Py.defaultSystemState = null;
// another reference, the ThreadLocal - doesn't get cleaned up *ever*
Object... |
962e10da-9f60-450d-8a59-3dd6de1007bf | 5 | public void Top100(String Top100Sort) throws IOException {
if (!Top100Sort.equals(TOP100REALTIME) && !Top100Sort.equals(TOP100WEEKLY)) {
try {
throw new Top100SearchException("You Must use TOP100REALTIME or TOP100WEEKLY");
} catch (Top100SearchException e) {
... |
3751226e-e365-4d68-aeef-52721e494fb5 | 5 | private int getPriority(String priority) {
if (priority.equals(m_settings.getLocalizedMessage("priority.vlow")))
return 1;
else if (priority.equals(m_settings.getLocalizedMessage("priority.low")))
return 2;
else if (priority.equals(m_settings.getLocalizedMessage("priority.medium")))
return 3;
else if ... |
b8f8c066-d97e-4839-be08-9306d0205442 | 2 | protected PlayerStartPosition getPlayerStartPosition(Grid grid, Player player) {
if (grid == null || player == null)
throw new IllegalArgumentException("The given arguments are invalid!");
return new PlayerStartPosition(grid, player);
} |
013379be-cac5-4529-a71d-a25ba6190fcc | 7 | protected double getNumericValue(Cell cell) throws InvalidCellException {
int cellType = cell.getCellType();
if (cellType != Cell.CELL_TYPE_STRING && cellType != Cell.CELL_TYPE_NUMERIC) {
throw new InvalidCellException(cell);
} else if (cellType == Cell.CELL_TYPE_STRING) {
try {
double value = Double.pa... |
fd02d9c7-678d-4eef-9a80-867492287fdf | 0 | public void mouseExited(MouseEvent event) {
} |
b0409462-53f4-4745-842b-212ee800b24c | 3 | public final static Opponent getById(String id) throws NotFound {
Opponent o = new Opponent();
String profilePage = Utils.getString("characters/profile/" + id);
int pos = profilePage.indexOf("href=\"/fights/start/");
if (pos == -1) {
throw new NotFound();
}
String page = profilePage.substring(pos);
... |
133dfdc7-cf57-499b-95c9-d095fd148cda | 2 | public synchronized static void configure(File... files) {
if (INSTANCE == null) {
INSTANCE = new LaunchProxy(files);
try {
// Give it a chance to terminate this run...
Thread.sleep(1500);
} catch (Exception exception) {
// Ignore
}
} else {
Log.error("Can only call configure once."); //$... |
07e4700f-9e9f-4858-97d8-8c7252f5066d | 9 | public void func_50032_g(int par1)
{
int var2 = this.text.length();
if (par1 > var2)
{
par1 = var2;
}
if (par1 < 0)
{
par1 = 0;
}
this.field_50048_p = par1;
if (this.fontRenderer != null)
{
if (th... |
dd362736-58da-453b-a21e-e70f22fc1df9 | 4 | private Tile getTile(int x, int y){
return x >= 0 && y >= 0 && x < width && y < height ? grid[x][y] : null;
} |
49ffbfe3-7b31-4436-9450-998efb7fc5b4 | 3 | @Override
public boolean execute(CommandSender sender, String identifier,
String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (DonorTitles.chat.getPlayerPrefix(player) != null
&& DonorTitles.chat.getPlayerPrefix(player) != "") {
DonorTitles.chat.setPlayerPrefix(play... |
8d02f1c8-21ea-4994-84bc-7af076dbd02a | 3 | public void setValue(Object value){
int currentValue = (Integer) getValue();
int v = (Integer) value;
int result = v;
if(v > getMaximum()){
result = getMaximum();
}
else if(v < getMinimum()){
result = getMinimum();
}
... |
b66aaf71-e9e8-4cc0-8744-a76e73960cbc | 7 | public void drawProps(Graphics g){
if( number % 4 == 0 ){
for(Prop p : PropsContainer.getValidProps()){
if( p.getStatus() == PropStatus.ALIVE)
switch( p.getType()){
case PropType.mime :
g.drawImage(this.prop_mime, p.getX(), p.getY(), Constant.PROP_WIDTH_HEIGHT, Constant.PROP_WIDTH_HEIGHT, th... |
ed6cb5ca-5a4b-4b7d-8d8c-a54aff557b42 | 8 | public static void main(String[] args) {
TotalOrder g;
String arg;
long timeout=200;
int num_fields=3;
int field_size=80;
String props=null;
int num=0;
props="udp.xml";
for(int i=0; i < args.length; i++) {
arg=args[i];
if... |
842f28e5-6265-4d53-9a64-5665492caf8b | 9 | public NioSocketServer() {
try {
// Create an AsynchronousServerSocketChannel that will listen on port 5000
final AsynchronousServerSocketChannel listener =
AsynchronousServerSocketChannel.open().bind(new InetSocketAddress(5000));
// Listen for a new requ... |
43e889e4-8a0d-48a5-ac8a-9ee769bccd23 | 1 | public void addCircle(Circle circle) {
if (this.next == start) {
this.next = circle;
circle.next = start;
} else {
this.next.addCircle(circle);
}
} |
d67a1781-8d4d-4bac-a268-a92c64d01b8a | 2 | public static void stopPlayback() {
try {
if(currentPlayback != null) {
currentPlayback.stop();
}
} catch (MediaException e) {
System.out.println("Invalid media type.");
}
} |
c5f8ebca-f11e-451d-b73b-68ba31f26358 | 4 | private byte[] insertGapCore0w(byte[] code, int where, int gapLength, boolean exclusive,
ExceptionTable etable, CodeAttribute ca, Gap newWhere)
throws BadBytecode
{
if (gapLength <= 0)
return code;
ArrayList jumps = makeJumpList(code, code.leng... |
4424c6de-8c32-430e-acd4-8d94e3928dac | 2 | public static JnlpCache create() {
try {
Class<? extends ServiceManager> cl = Class.forName("javax.jnlp.ServiceManager").asSubclass(ServiceManager.class);
Method m = cl.getMethod("lookup", String.class);
BasicService basic = (BasicService)m.invoke(null, "javax.jnlp.BasicService");
PersistenceServic... |
ae50a195-774e-4f20-96e4-7ffe254bbf27 | 5 | private MapSquare getMapSquare(int x, int y)
{
ArrayList<MapSquare> d_map = dp.getDisplay();
for (int i = 0; i < d_map.size(); i++)
{
//find which square was clicked
if(d_map.get(i).getDisplayX() * GlobalSettings.SQUARE_SIZE <= x &&
d_map.get(i).getDisplayX() * GlobalSettings.SQUARE_SIZE + GlobalSetti... |
d895bfdb-3e3d-4ab7-a1df-d41cd3c37920 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {try {
//GEN-FIRST:event_jButton1ActionPerformed
list = new DessertDao();
} catch (SAXException ex) {
Logger.getLogger(addItemToDessertMenu.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParserConfigur... |
e20842f0-1657-44cf-af84-85bef8c840e4 | 5 | public double kurtosisExcess_as_double() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double kurtosis = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
kurto... |
521d9c2e-7f37-4ec3-8689-7dd5ec1dd0da | 0 | public void setEmail(String email) {
this.email = email;
} |
ba67e615-8ab2-4c29-a772-d8e29a19bc1e | 1 | public void testFactory_monthsBetween_RPartial_YearMonth() {
YearMonth start1 = new YearMonth(2011, 1);
for (int i = 0; i < 6; i++) {
YearMonth start2 = new YearMonth(2011 + i, 1);
YearMonth end = new YearMonth(2011 + i, 3);
assertEquals(i * 12 + 2, Months.monthsBetwe... |
ade168d7-08d0-4cb8-a958-61aef6d2b5ba | 0 | public boolean isMaximized() {
return ((OutlinerDesktopManager) getDesktopManager()).isMaximized();
} |
6f2d194f-8718-483f-ba31-384a9d488e26 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tag other = (Tag) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (val... |
54304007-45f0-4e25-b03a-d00f4662cabd | 3 | public static void saveDataToFile(File file, String content) throws IOException {
File storage = getStorageFolder();
if(!storage.exists()) {
if(!storage.mkdir()) {
throw new IOException("Can not create a storage folder " + storage.getAbsolutePath());
}
}
... |
d64b3e06-5a4a-4b9c-a5de-0c932928f2b3 | 0 | public static void confirmationNouvellePartie(int lignes, int colonnes) {
fenetrePrincipale = new WindowPrincipale(lignes, colonnes);
fenetreNouvellePartie.dispose();
} |
f10c7e60-34f1-4dcc-9ea9-c15ffd40b5b3 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
48647454-c717-47e8-9b67-59d0e1133919 | 1 | private String getTestName(int no) {
return name != null ? name : ("test-" + no);
} |
ea1f8456-11ef-41e1-afa6-de80b6b1036f | 1 | @Override
public Object clone( ){// Clone an IntTreeBag object.
IntTreeBag answer = null;
try{
answer = (IntTreeBag) super.clone();
}catch(CloneNotSupportedException e){
System.out.println(e.toString());
}
answer.root = IntBTNode.treeCopy(root);
return answer;
} |
271113e5-8bee-4461-8115-9840cafa52d4 | 8 | public void setRange(Map m)
{
tilesInRange = new ArrayList<Tile>();
Tile[][] grid = m.getGrid();
//grab which tiles are in range
int xMin = location.getX() - attacks.get(0).getHorizontalRange();
int xMax = location.getX() + attacks.get(0).getHorizontalRange();
int yMin = location.getY() - attacks.get(0).ge... |
e4b92d5e-2970-41bc-9dfb-12292e596cd3 | 2 | public void stop() {
if(this.thread != null) {
this.cont = false;
try {
logger.info("Stopping monitor thread.");
this.thread.join(JOIN_TIME);
} catch(Exception e) {
logger.info("Error in thread processing.", e);
} finally {
logger.info("Thread is destroyed.");
this.thread = null;
}
... |
0728f7db-a68a-486a-96ba-9d246fb1f6a1 | 2 | public static void addGolden(JSONObject fight) {
if (isHtmlOutput()) {
try {
// Dateinamen generieren
String filename = String.valueOf(new Date().getTime())
+ fight.getJSONObject("opponent").getString("name")
.replaceAll("[^a-zA-Z0-9]", "_") + ".html";
// Kampf-Daten schreiben
add(n... |
df7bd9ca-1a70-4cc6-8b72-3d40b3a7ba7e | 4 | private void managePeerConnection() throws Exception{
//Send/ receive handshake
if(!manageHandshake()){
//handshake failed - quit connection to this peer.
return;
}
//After handshake, instantiates a message sender;
this.messageSender = new MessageSen... |
4ca68601-7396-475b-8a74-16a1b54f0de7 | 2 | public boolean contains(StructuredBlock child) {
while (child != this && child != null)
child = child.outer;
return (child == this);
} |
5a93072a-a78f-4eaa-9f6c-96eec59ed46c | 2 | void close ()
throws USBException
{
if (fd < 0)
return;
try {
// make sure this isn't usable any more
int status = closeNative (fd);
if (status < 0)
throw new USBException (
"error closing device",
-status);
} finally {
// make sure nobody else sees the device
usb.remov... |
531714df-f4cd-4d1c-91ad-ad0eb145e773 | 2 | @Override
public TreeModel getTreeModel() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Threats");
List<Archive> archives = new ArrayList<Archive>();
archives.add(FileManager.getRuntimeArchive());
archives.addAll(FileManager.getPlugins());
for (Archive archive : archives)
for (ClassNode clas... |
3103f52e-74e2-435f-a408-45bcb01a490a | 2 | @Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
Contestant contestant = contestants.get(rowIndex);
switch (columnIndex) {
case COLUMN_USERNAME:
contestant.setUsername(value.toString());
break;
case COLUMN_PASSWORD:
contestant.setPassword(value.toString());
break;
... |
00a1856d-e042-417a-a395-d08a9d9b57c2 | 2 | public final synchronized Complex readComplex(){
this.inputType = true;
String word="";
Complex cc = null;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)cc = Complex.parseComplex(word.trim());
... |
6eae6999-922d-4ac4-9aa1-09a61a07dfb0 | 0 | public boolean test(int i){
return (datamap[i>>5] & (1<<(i & 0x1F))) != 0;
} |
29114249-4b79-4162-b66c-7b4c51e070c6 | 2 | private int[] extractSameValues(ArrayList<Card> cards) {
int[] valueCount = new int[VALUE.values().length];
for (int i = 0; i < valueCount.length; i++) {
valueCount[i] = 0;
}
// sort highest first
for (int i = 0; i < cards.size(); ++i) {
valueCount[cards.get(i).value.ordinal()]++;
}
return valueCoun... |
19541644-f641-445b-a5bd-25d859ae1347 | 6 | private Class<?> createRelated(Class<?> type, Class<?> relatedType) {
if (relatedType == null && type.isArray()) {
relatedType = Array.newInstance(type, 0).getClass();
}
if (!type.equals(relatedType)) {
return type.getSuperclass();
}
return null;
} |
6fd15f3c-eda3-409e-a7da-864cb7b8943f | 0 | public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
} |
a68c5753-755f-43e2-a908-9c3be419f421 | 4 | private void setupLiseners()
{
addHipsterButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent click)
{
sendHipsterInfoToController();
updateHipsterComboBox();
blankFields(false);
}
});
showSelfButton.addActionListener(new ActionListener()
{
public... |
19670351-5780-445c-8615-d3d4081afd04 | 5 | public static void main(String[] args) throws Exception{
//ColorDisplay is a frame. 1,1 in arguments mean 7*7. 2,1 is 14*7 and so on.
ColorDisplay d = new ColorDisplay(1,1,Color.RED, Color.CYAN);
//An object with all possible characters
ArrayChars chars = new ArrayChars();
//An input window as... |
b3e89488-3d10-4680-b420-5f6ec7f2dda1 | 4 | public static void main(String[] args) throws IOException {
int height = 15;
int[][] triangle = new int[height][height];
File file = new File("0018/triangle.txt");
List<String> lines = FileUtils.readLines(file);
int y = 0;
for (String line : lines) {
String[] numbers = line.split(" ");
int x = 0;
... |
c6ed11cc-0ef5-41c7-bba6-f8fbdc35e809 | 2 | public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException
{
if(!isGameOver)
{
if(!isPause)
{
}
else
{
}
}
else
{
}
} |
2d240447-ad2e-4c38-8172-11bccaf8da17 | 9 | private void draw(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
// antialiasing ON
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
//enable user input
if(fleetEditorModel.getVehicles().size() > 0){
saveVehicleJB.setEnabled(true);
deleteVehicleJB.se... |
98b071ec-707c-4a7e-a264-ea98b04c4ff8 | 0 | public CanonicalizationMethodType createCanonicalizationMethodType() {
return new CanonicalizationMethodType();
} |
c8921f40-a06c-4d18-a530-68160e1f4a6d | 4 | @Override
public boolean keyUp(int keycode) {
switch(keycode) {
case Keys.W:
direction.y = 0;
animationTime = 0;
break;
case Keys.A:
direction.x = 0;
animationTime = 0;
break;
case Keys.S:
direction.y = 0;
animationTime = 0;
break;
case Keys.D:
direction.x = 0;
animationTime ... |
3e22a612-a5a2-4f78-a38f-462d86d4a4eb | 2 | public String readField(String fields[], int fieldNum) {
if (fields.length > fieldNum) {
if (fields[fieldNum].equals(MISSING)) return EMPTY;
return fields[fieldNum];
}
return EMPTY;
} |
0e75c36e-06e6-4249-9a24-6b6598cec457 | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((!mob.amDead())&&((--diseaseTick)<=0))
{
diseaseTick=DISEASE_DELAY();
fin... |
c6fe3580-4a26-475a-a65c-f143a70ce3fd | 8 | public static void main(String[] args) throws Throwable{
long[] arr = new long[30001];
int[] costos = new int[]{10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5};
arr[0]=1;
for (int i = 0; i < costos.length; i++)
for (int j = costos[i]; j < arr.length; j++)
arr[j]+=arr[j-costos[i]];
BufferedRead... |
581c5df1-0e18-43b8-9089-fb12031f8e06 | 0 | public int getXSize() {
return xSize;
} |
ab6fde5b-1a32-464a-b461-e27c07e07ca8 | 5 | public static void cleanUp () {
Map map = Map.getMap(LaunchFrame.getSelectedMapIndex());
File tempFolder = new File(OSUtils.getCacheStorageLocation(), MAPS.replace("/",sep) + map.getMapName() + sep);
for (String file : tempFolder.list()) {
if (!file.equals(map.getLogoName()) && !fil... |
cb133d28-25fa-42a7-aae1-e24b912eb7cd | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/javascript");
String voornaam = request.getParameter("voornaam");
String username = request.getParameter("username");
String wachtwoord = request.getParameter("wac... |
229670e0-a4cb-4c41-ae98-07ded8502fdd | 0 | public ImageIcon getFrame() {
return frame;
} |
54005fa0-1bb0-4bfe-a97c-6fb56138fd28 | 3 | public void setAnd(TAnd node)
{
if(this._and_ != null)
{
this._and_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
e8e7c0fb-3f36-4ef2-8121-302014532a72 | 3 | private static void startTheGame() {
System.out.println("Консольные крестики-нолики");
System.out.println("Разработка, дизайн и саундтрек: Илья Серебряков (aka Lungo)");
System.out.println("Все права защищены");
try {
Thread.sleep(2000);
} catch (InterruptedException ... |
da11a4c9-38d7-4c28-ac7e-f4fd8d86d5d4 | 2 | @Override
public boolean matches(String[] input) {
for (String word: input) {
matcher.reset(word);
if (matcher.find()) {
return true;
}
}
return false;
} |
410d3932-54b1-45f7-875a-0f58e3e7866d | 1 | public JPanel getShutdownmenuMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.shutdMenu;
} |
f5151e2c-a368-477d-8f4b-e698bc10379d | 4 | public String suitToString() {
switch(suit) {
case DIAMONDS:
return "Diamonds";
case CLUBS:
return "Clubs";
case HEARTS:
return "Hearts";
case SPADES:
return "Spades";
default:
return null;
}
} |
6056d6e8-adcf-452d-bd78-5e1529ac8495 | 8 | private void scanDirectory(String directoryName, String fileNameFilter)
{
File dir = new File(directoryName);
FilenameFilter filter = new FilenameFilterImpl(fileNameFilter);
if(DEBUG) System.out.println("Scanning '" +directoryName +"' for file matching '" +fileNameFilter +"'");
String[] files = dir.list(... |
61859e95-a31d-460f-bd58-f18df8a54dff | 3 | public String getEmail(String username)
{
Connection connection = null;
String email = null;
String query = null;
PreparedStatement statement = null;
try
{
connection = dataSource.getConnection();
query = "SELECT email FROM users WHERE username = ?;";
statement = (PreparedStatement)conne... |
035f6042-0db5-4c0a-a60b-ab827e7d6399 | 5 | @GET
@Produces(MediaType.LIBROS_API_RESENA_COLLECTION)
public ResenaCollection getResenas(@PathParam("idlibro") String idlibro) {
ResenaCollection resenas = new ResenaCollection();
Connection conn = null;
Statement stmt = null;
String sql;
try {
conn = ds.getConnection();
} catch (SQLException e) {
... |
3f552777-ddee-403e-a240-74b69b60c10a | 7 | public void getInput() {
if(Keyboard.isKeyDown(Keyboard.KEY_W))
move(0,1);
if(Keyboard.isKeyDown(Keyboard.KEY_S))
move(0,-1);
if(Keyboard.isKeyDown(Keyboard.KEY_A))
move(-1,0);
if(Keyboard.isKeyDown(Keyboard.KEY_D))
move(1,0);
if(Keyboard.isKeyDown(Keyboard.KEY_SPACE) && attackDelay.isOver())
... |
9f7b2e14-fae6-4211-895a-002326d47d5a | 2 | private void establishCanvas() {
alloyWindow = new JPanel();
alloyWindow.setLayout(new BorderLayout());
drawing = new BufferedImage(alloy.getWidth(), alloy.getHeight(), BufferedImage.TYPE_INT_ARGB);
int color = (Color.decode("#770077")).getRGB();
for (int x = 0; x < drawing.getWi... |
d4ce3f17-ecab-4e75-8749-6d76c5416851 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
else if (!(obj instanceof GenericList))
return false;
GenericList gl = (GenericList) obj;
return (quotes == gl.quotes) && varname.equals(gl.varname) && list.equals(gl... |
9c81f15b-0f59-4c5f-a56e-9e5889aef618 | 7 | public String NetSpanProcess(String url,String data,String tagName){
try{
URL oURL = new URL(url);
HttpURLConnection soapConnection = (HttpURLConnection) oURL.openConnection();
System.out.println("connect to server...");
//prop= new PropertiesConfiguration("NetSpanIntegrator.properties")... |
f005bd19-d78d-4d36-a20e-3285a1382b03 | 1 | public String getUserInfo(String appKey, String userKey) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
} catch (UnsupportedEncodingException e) {
BmLog.error(e);
}
return String.format("%s/api/rest/... |
5823d308-4daf-4d98-9089-8bc433c0dc00 | 2 | @Override
public void draw(Graphics2D drawScreen, int offsetX, int offsetY) {
for (Entity entity : entityList) {
Spatial spatial = entity.getComponent(Spatial.class);
Health health = entity.getComponent(Health.class);
HealthBar healthBarInfo = entity.getComponent(HealthBar.class);
// Draw the red
... |
001d8153-dacc-471f-b8c5-71987208a33a | 6 | private void buildTree(TeaClassifier tc, TeaNode parent, String[] valueCombo, int level, List<Integer> usedAttributes, double sugar) {
if (length < level + 1) {
length = level + 1;
}
if (parent.getAttributeNum() == 0) {
for (String val : Tea.TEA_TYPE_VALUES) {
buildForStringFeature(tc, parent, valueComb... |
0a5457fa-5765-4b0a-85a8-77c132f03b1c | 3 | public IntelligenceArtificielle getIntelligenceArtificielle(Parametre parametre) {
IntelligenceArtificielle intelligenceArtificielle = null;
switch (parametre.getDifficulte()) {
case "Facile":
intelligenceArtificielle = new IntelligenceArtificielleFacile(parametre);
... |
1e1c642d-5cd3-4d89-9b90-ae700c6c1baf | 9 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
super.unInvoke();
if((canBeUninvoked())&&(clan1!=null)&&(clan2!=null))
{
final Clan C1=clan1;
final Clan C2=clan2;
if((C1!=null)&&(C2!=null))
{
if(C1.getClanRelations(C2.clanID())=... |
c5d9cab9-673d-4385-9550-a650e92d8a3f | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
ab5cff87-a279-4b9b-ba69-a63cd7097155 | 1 | public boolean setPWfieldHeight(int height) {
boolean ret = true;
if (height <= 10) {
this.pwfield_Height = UISizeInits.PWFIELD.getHeight();
ret = false;
} else {
this.pwfield_Height = height;
}
somethingChanged();
return ret;
} |
af84cb42-80e9-4c13-8cae-481daa587d81 | 0 | @Override
public void simpleInitApp() {
flyCam.setMoveSpeed(2); /** Translucent/transparent cube. Uses Texture from jme3-test-data library! */
ContentManager.getInstance().setAssetManager(assetManager);
ContentManager.getInstance().setMinecraft(this);
Bloc... |
c12f164c-075c-4a5d-ac9e-90fb46213641 | 2 | Entry insert(int key, int value) {
Entry node = new Entry(key, value);
node.degree = 0;
node.marked = false;
node.left = node.right = node;
node.parent = null;
node.child = null;
// Podpinamy pod korzen
// ++
access += 1;
if (minimum == n... |
5e2b1a58-3f37-40c7-a983-95894f251932 | 9 | private void btn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_buscarActionPerformed
ocultarMensaje();
try{
// buscar por numero de factura
if((!campo_buscar1.getText().equals(""))&&(!campo_buscar1.getText().e... |
00e2f393-9e5a-4837-9c3d-d5a46ff11f16 | 7 | public static void load(File par1File) {
InputStreamReader isr = null;
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
try {
isr = new InputStreamReader(new FileInputStream(par1File));
br = new BufferedReader(isr);
while(br.ready()){
sb.append(br.readLine());
sb.appen... |
73d7e505-dd40-4fa7-8371-33a14da31c34 | 7 | public void setAttributeValue(String value) {
if (value == null || value.length() < 7 || value.length() > 15)
throw new IllegalArgumentException("bad IP number");
StringTokenizer tok = new StringTokenizer(value, ".");
if (tok.countTokens() != 4)
throw new IllegalArgumentException("bad IP number: 4 number... |
e12e079d-075e-4c18-8998-0c3cfd35ee54 | 8 | public void addLightSource(int x, int y, int r, int br) {
x -= xOff;
y -= yOff;
for (int yy = -r; yy < r; yy++) {
if ((yy + y) < 0 || (yy + y) >= height)
continue;
for (int xx = -r; xx < r; xx++) {
if ((xx + x) < 0 || (xx + x) >= width)
continue;
int d = (xx * xx) + (yy * yy);
if (d > ... |
f924a621-1ee5-496a-a80b-e56e112fe65a | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
c70e44d3-8592-4b18-b1ac-00b8f243af91 | 2 | public double standardizedStandardDeviationCorrelationCoefficientsWithTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.standardizedStandardDeviationRhoWithTotals;
} |
889baa7e-88bd-4bb4-8b5a-d7e64a93c29f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final Transaction another = (Transaction) obj;
if (getTransactor().equals(another.getTransactor())) {
if (getReceiver().equals(another.getRece... |
9aeb5c4b-7919-40cd-aeb3-02f512ab6247 | 2 | private void onopen() {
logger.fine("open");
this.cleanup();
this.readyState = ReadyState.OPEN;
this.emit(EVENT_OPEN);
final com.github.nkzawa.engineio.client.Socket socket = this.engine;
this.subs.add(On.on(socket, Engine.EVENT_DATA, new Listener() {
@Over... |
ba69a493-c1bb-49dd-ba41-b8127f6804d2 | 3 | private static boolean formQueryStay(Criteria crit, List params, StringBuilder sb, StringBuilder sbw, Boolean f234) {
List list = new ArrayList<>();
StringBuilder str = new StringBuilder(" ( ");
String qu = new QueryMapper() {
@Override
public String mapQuery() {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.