method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
64464b3e-4f01-4006-86ce-740c67272f9c | 1 | @Override
public AState breakTie(AState state1, AState state2)
{
if(state1.getH() > state2.getH())
return state1;
else
return state2;
} |
f3049d54-9234-4ff6-91d5-9d7aa1c3167b | 4 | private BufferedImage doManipulation(BufferedImage input)
{
recalculateDimensions();
double radianAngle = Math.toRadians(rotation);
BufferedImage newImage;
if(Game.TEST_ACCELERATION) newImage = SimpleImage.createQuickImage(rotatedSize.x, rotatedSize.y);
else newImage = new BufferedImage(r... |
1a2d1e14-ce12-460d-b386-674f1a0a96cc | 8 | public void checkEnemyCollision(ArrayList<Enemy> list){
//setFalling(true);
//double tempDx=getDx();
//double tempX=getXTemp();
for(int i=0;i<list.size();i++){
//boolean rgt=false;
//boolean lft=false;
double w=.5*(list.get(i).getCWidth()+getWidth());
... |
5473d008-8406-42a8-aac6-47f3de73710f | 2 | public static void main(String[] params) {
try {
decompile(params);
} catch (ExceptionInInitializerError ex) {
ex.getException().printStackTrace();
} catch (Throwable ex) {
ex.printStackTrace();
}
printSummary();
/*
* When AWT applications are compiled with insufficient classpath the
* type g... |
d3b5af45-47a5-4cc8-acb2-1fba4b37b685 | 6 | private void cargarImagenPPM(BufferedReader br) throws IOException {
setMatrizR(new short[getN()][getM()]);
setMatrizG(new short[getN()][getM()]);
setMatrizB(new short[getN()][getM()]);
int key = 0;
int fila = 0;
int columna = 0;
String data;
String rgb[] ... |
12185279-6f45-465d-bea0-91886e08c241 | 4 | public static void main(String[] args) {
int x = 3;
int y = 4;
System.out.println((x == 3) && (y == 4)) ;
System.out.println((x == 3) && (y == 7)) ;
System.out.println((x == 3 || y == 4)) ;
System.out.println((x != 3 || y == 4)) ;
} |
ee1233ac-4adb-4308-a59a-fad2b8093442 | 3 | @SuppressWarnings("deprecation")
public static void readRAF() throws IOException
{
String fileName = "/Users/Abhi/Desktop/Database";
ObjectInputStream inputStream = null;
try{
inputStream = new ObjectInputStream(new FileInputStream(fileName));
}catch(... |
dc9910c1-fd36-42c1-922b-9585359f80d2 | 8 | private void loadAndDisplayInfo()
{
String filename =
"Help Files" + File.separator + "Temperature Monitor Help.txt";
String line;
FileInputStream fileInputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader in = null;
textArea.append("\n"); //blank line at the ... |
c297899a-4769-479e-89d4-60d059aa5f38 | 2 | public sButton(String text, OggClip toPlay, boolean bugged) {
this.setText(text);
this.sound = toPlay;
this.addActionListener(this);
// Set all missing sounds to red
if (this.sound == null) {
this.setBackground(Color.RED);
}
// And all bugged sounds to yellow
else if(bugged) {
this.s... |
ff0bfd2e-7699-44ed-8b2d-d5449eb2d5e2 | 4 | private int encoderSerie(String s) {
String concatBin="";
for(int i=0;i<s.length();i++) {
short e=(short)s.charAt(i);
String st=Integer.toBinaryString(e);
for(int j=st.length();j<TAILLE_CHAR;j++) {
st="0"+st;
}
concatBin+=st;
}
int aRetourner=0;
for(int i=0;i<concatBin.length();i++) {
i... |
b8b9ef06-749b-4984-8565-34adf90475c8 | 0 | public void setDirectoryFilter(FileFilter dirFilter) {
this.dirFilter = dirFilter;
} |
dd39ee81-fa05-488c-af25-758039a570e7 | 5 | private static List<String> getAllLocalIp_window_mac() {
List<String> list = new ArrayList<String>();
try {
String hostName = getLocalHostName();
if (hostName.length() > 0) {
InetAddress[] addrArray = InetAddress.getAllByName(hostName);
if (addrA... |
e6dce3bb-0384-4ca3-99ec-ed15fcfb5f5f | 1 | private static boolean sendRequest() throws IOException {
boolean holdTheLine = true; // Connection exists
toServer.writeBytes((lineProtocol = user.getAllInformations()) + '\n');
if (lineProtocol.equals("!")) { // Does the user want to end the
// session?
holdTheLine = false;
}
return holdTheLine... |
f364fb92-fc4b-454f-b31a-c8627faf0465 | 1 | public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
new MainFrame();
} catch (... |
13f79eb8-5d35-48e9-b5d8-be02e07bc2ec | 2 | public String getID ()
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("getID", true);
$in = _invoke ($out);
String $result = $in.read_string ();
return $result;
... |
652769c2-94ef-4a4b-a4ae-071db6bc3a3d | 9 | private void doline() {
String txt = "";
IECTCItem item =null;
try {
while (!isValidLine(txt)&&(PlayFileEnd == false)) {
txt = br.readLine();
// System.out.println("LINE_"+lineNo+ ": "+txt);
lineNo++;
}
if (PlayFileEnd == false) {
System.out.println("Player: Type "+iectype+" ASDU "+ASDU... |
08542b0d-3360-47f0-812e-8f1cf7dddf30 | 3 | public boolean mousePressed(int x, int y) {
if (bounds.contains(x, y)) {
beingClicked = true;
if (!animating && images != null) {
currentIndex = 2;
}
onMousePress(x, y);
return true;
}
return false;
} |
a5bec51c-31ab-43fd-b13e-1792d6f41774 | 3 | Instruction get0(int index) {
Instruction instr = borderInstr;
if (index < instructionCount / 2) {
for (int i = 0; i <= index; i++)
instr = instr.nextByAddr;
} else {
for (int i = instructionCount; i > index; i--)
instr = instr.prevByAddr;
}
return instr;
} |
9224a789-a4ea-4849-b94f-c4e0290d88bf | 5 | private void testTouching(){
if(deadly){
if(Display.player.me(0, 1).intersects(getRect()))Display.player.dead=true;
if(Display.player.me(0, -1).intersects(getRect()))Display.player.dead=true;
if(Display.player.me(1, 0).intersects(getRect()))Display.player.dead=true;
if(Display.player.me(-1, 0).intersects(getR... |
248899d0-6235-4f05-94de-81fc4eae56a8 | 1 | public void testConstructor_invalidObject_DateTimeZone() throws Throwable {
try {
new DateTime(new Object(), PARIS);
fail();
} catch (IllegalArgumentException ex) {}
} |
8c13631d-4f50-4377-9a41-dc2a35cbc34f | 1 | private boolean paikkaSisaltyySyotteeseen() {
return paikka >= 0 && paikka < syote.length();
} |
c835a1b6-a276-4cc2-9537-e492f2245a69 | 7 | private void initValidationData(HashMap<String,Object> parameterDefinition){
this.type = "string";
this.required = false;
this.regexp = null;
this.minLength = null;
this.maxLength = null;
if ( parameterDefinition.containsKey("type") ){
this.type = par... |
671f3a61-f823-4fa3-a88e-0d73f557b99b | 8 | private int alphabetaScore(GameState state, Color faction)
{
state = state.getCounter().score(state,false);
int playerScore = 0;
Color maxPlayer = null;
int maxScore = Integer.MIN_VALUE;
for(Player p : state.getPlayerList())
{
//determine the player's score
if(p.getFaction().equals(faction))
{
... |
ba9698e0-0f10-4427-bb00-51fc364ec057 | 7 | public final FunctionTypeDec parametersDecl() throws RecognitionException {
FunctionTypeDec dec = null;
try {
// C:\\Users\\pc\\Desktop\\IPL\\ew\\JPocl\\JPoclTypedAST.g:288:8: ( ^( PDECS ( parameterDecl[dec] )+ ) )
// C:\\Users\\pc\\Desktop\\IPL\\ew\\JPocl\\JPoclTypedAST.g:289:... |
a1f21b25-d517-484a-a86d-6d7cd57e78fc | 9 | public boolean isMatch(String s, String p) {
int n = s.length();
int m = p.length();
int i = 0;
int j = 0;
int star = -1;
int sp = 0;
while (i < n) {
//one * and multiple *, same effect
while (j < m && p.charAt(j) == '*') {
... |
16ce0e43-30a2-4b78-ad35-5170f3a03e95 | 7 | public Grenade doCommand(Command command) {
Grenade grenade = null;
if (command.getRotate() == CommandType.TURN_LEFT) {
addToDirection(-command.getAngle());
}
if (command.getRotate() == CommandType.TURN_RIGHT) {
addToDirection(command.getAngle());
}
... |
9a8a35c6-7b6a-450c-8bdd-b5e8b75dd1bf | 9 | public XmlSaver(final GlyphBank gb, File file) {
Set<GlyphBank.Glyph> glyphs = gb.glyphs();
List<GlyphBank.Kerning> kernings = gb.kernings();
Map<String, GlyphBank.GlyphModificator> modifiers = gb.modifiers;
try(BufferedWriter writer = Files.newBufferedWriter(file.toPath(), Charset.forName("UTF-8"))) {
... |
fd9ae08a-1ab4-4601-884b-2059c8f4a1ee | 4 | @Override
public void onEnable() {
instance = this;
this.saveDefaultConfig();
this.settings = new Settings(this.getConfig());
this.i18n = new I18n(this);
this.i18n.setLocale(this.settings.getLocale());
this.debugger = new Debugger();
this.debugger.setOutpu... |
e3ee97d5-5941-4d21-8340-59b93d7aeb8e | 3 | public void testGetGostRezervacija(){
Rezervacija r=new Rezervacija();
Boravak b=new Boravak();
Gost g=new Gost();
Gost novi=new Gost();
Osoba o=new Osoba();
Soba soba=new Soba();
soba.setBrojKreveta(1);
soba.setBrojSobe(1);
soba.setBalkon(true);
soba.setZauzeta(t... |
410fa34a-b1fa-4b79-a86e-65bec3b3c4d1 | 5 | public TileMap(String file, GamePanel gp) {
tiles = new ArrayList <BufferedImage> ();
trashCanTiles = new ArrayList <Point> ();
trashTiles = new ArrayList <ArrayList <Point>> ();
spikeTiles = new ArrayList <Point> ();
enemySpawns = new ArrayList <Point> ();
for (int i = 0; i < 4; i++) {
trashTiles.add(ne... |
b69de078-3071-4cdd-9971-552fd878e739 | 6 | private static String getFirstLine(FMSConnection connection, int articleId) throws IOException {
debug("Trying to read article: " + articleId);
ArticleResponse response = connection.article(articleId);
// MUST be on the first line of the message body.
LineNumberReader reader =
... |
9673cbbe-dadc-45e3-95e8-4c860ea658ed | 0 | public void setRHS(String rhs) {
myRHS = rhs;
} |
d1e4a9d3-b482-4663-8870-57fc80269f1e | 2 | @Override
public void mouseClicked(MouseEvent e) {
if(!innerCircle.contains(e.getPoint()) && outerCircle.contains(e.getPoint())) {
centerColor = new Color(bimage.getRGB(e.getX(), e.getY()));
System.out.println("New Color: " + centerColor);
this.repaint();
mast... |
16b9ee29-3e09-49c7-b14d-54a6f05ea058 | 3 | public String[][] crossover(String[] d1, String[] d2, String args){
String[][] crossedDecks = new String[2][];
Random rng = new Random();
int crossoverStart;
int crossoverEnd;
if (args.compareToIgnoreCase("chunk") == 0) {
if (d1.length < d2.length) {
crossoverStart = rng.nextInt(d1.length);
cross... |
07c9e940-3724-4d53-847b-b6845ad4b9c4 | 5 | @Override
public Map<String, Collection<?>> call() throws Exception {
Map<String, Collection<?>> resultMap = new HashMap<String, Collection<?>>();
Collection<Fetcher> fetchers = new ArrayList<Fetcher>();
resultMap.put(FetcherConstants.Fetcher, fetchers);
this.getLogger().info("...");
List<String> itemUrlLi... |
ccc4830b-244f-4cec-a7dd-6e04976104d5 | 5 | public EnvironmentLauncher() {
initComponents();
Path currentRelative = Paths.get("");
File directory = new File(currentRelative.toFile().getAbsolutePath());
File[] filelist = directory.listFiles();
ArrayList<String> items = new ArrayList<>();
for(int i = 0; i < filelist.... |
5851a932-3fd6-49b1-8a85-3bb4e4d07b57 | 0 | public int f() {
return 1;
} |
524661a9-e248-4f08-89cb-f4781471b11b | 0 | public Person getPersonByLogin(String login) {
return (Person) getEntityManager().createQuery("select p from Person p where p.username = :login").setParameter("login", login).getSingleResult();
} |
62567ae1-9295-48d7-b1f0-1c6a626de725 | 8 | private void stratChooser(int i) {
buy = 0;
hold = 0;
sell = 0;
Stock[] stocks = stockSheet.getStockArray();
for (Stock currStock: stocks) {
switch(i) {
case 1:
currStock.whatToDo(new BuyIncSellDec());
break;
case 2:
currStock.whatToDo(new BuyDecSellInc());
break;
c... |
eef8cebe-b4ed-4874-9cc7-97c604376c2b | 4 | public static int getBaggageCount(SimpleTrain train) {
if(train == null){
LOG.error("Train is null");
throw new IllegalArgumentException("Train is null");
}
int count = 0;
for (AbstractCarriage ac : train) {
if (ac instanceof AbstractPassengerCarriage) {
count += ((AbstractPassengerCarriage) ac).ge... |
ce1769c0-db8f-44ce-ba2c-313d39fa6f12 | 6 | public static final int EntrustedStoreTax(final int meso) {
if (meso >= 100000000) {
return (int) Math.round(0.03 * meso);
} else if (meso >= 25000000) {
return (int) Math.round(0.025 * meso);
} else if (meso >= 10000000) {
return (int) Math.round(0.02 * meso)... |
5c83b8d6-f94a-4f26-a322-a481972553d2 | 3 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
String line = "";
StringBuilder out = new StringBuilder();
while (in.hasNext()) {
String num = "";
BigInteger n, div = new BigInteger("131071");
while (!(l... |
b704984e-c61d-4e52-ab6f-8cf80e5d1a7c | 0 | public GoogleMapPanel(int width, int height)
{
setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
imageWidth=width;
imageHeight=height;
MapGetter.setImageSizeH(imageHeight);
MapGetter.setImageSizeW(imageWidth);
viewMode[0]="roadmap";
viewMode[1]="sate... |
95058c5e-8658-4a32-b8f7-0aeb33550dfa | 4 | protected final synchronized void enterLine(){
int i=0;
this.fullLine=this.readLineL();
// check for readWord reading allowed spaces
if(this.wordMethod)this.checkWordSpaces();
this.fullLineT=this.fullLine;
if(!this.fullLi... |
c897469b-6b6d-42bd-87b3-8f3321bbcb6e | 9 | @Override
public byte[] handleSpecificRequest(String request) {
String[] reqBrokenOnCommandParamSeparator = request
.split(COMMAND_PARAM_SEPARATOR);
logger.info("$$$$$$$$$$$$Message received at quorumServer"
+ reqBrokenOnCommandParamSeparator);
if (request.startsWith(CLIENT_REQUEST.READ_ITEMS.name())) {
... |
51988489-7f88-4f21-9119-34d61731b8e0 | 8 | public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
(( this.first == otherPair.first ||
( this.first != null && otherPair.first != null &&
this.first.equals(otherPair.first))) &&
( this.second == otherPair.second ||
... |
6971b7be-2f5c-4340-aac1-497a111e6e0e | 4 | private void readtRNS() throws IOException {
switch (colorType) {
case COLOR_GREYSCALE:
checkChunkLength(2);
transPixel = new byte[2];
readChunk(transPixel, 0, 2);
break;
case COLOR_TRUECOLOR:
checkChunkLengt... |
7a9c3501-ac26-402d-a753-6ae406780ea6 | 0 | public Date getPaid() {
return paid;
} |
4073e5a1-cfbd-4300-8d44-63ee5f2f71da | 8 | private static Principal resolvePrincipal(String groupName,
String className) {
Exception e = null;
try {
Class clazz = Class.forName(className);
if (Principal.class.isAssignableFrom(clazz)) {
Constructor c = clazz.getConstructor(STR_ARG);
return (Principal) c
.new... |
bcc5bb58-a260-49bd-8f08-6d1f416e179e | 1 | public static PreparedStatement getSatement(Connection conn, String sql){
PreparedStatement statement = null;
try {
statement = conn.prepareStatement(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return statement;
} |
3c413af7-8aa6-4ef1-b14e-8e97da6ffd8a | 8 | public void recordStat(Stat stat)
{
boolean flag = true;
int i = 0;
int length = 0;
if (excludeFromProcessing_ != null)
{
length = excludeFromProcessing_.length;
for (i = 0; i < length; i++)
{
if ( (stat.getCategory()+".").... |
ac7d7d64-47b6-4ffe-aff7-049c1c066300 | 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... |
8c8f1e25-c42f-41dd-83ff-99916bbf93ea | 3 | private String getFullName(Class<?> clazz) {
String name = clazz.getSimpleName();
Class<?> superclass = clazz.getSuperclass();
if (superclass != null) {
return getFullName(superclass) + " > " + name;
} else {
return name;
}
} |
b7837294-758d-4075-9676-b9e9d0be800d | 8 | public void upLoadData() throws ServerException {
if (log.isDebugEnabled())
log.debug("Method call");
for (Group oldGroup : groupsLocalCopy) {
int i = 0;
for (Group newGroup : groups) {
if (oldGroup.equals(newGroup)) {
checkStudents(newGroup, oldGroup);
break;
}
if (!oldGroup.equals(n... |
f489b56b-3b57-4319-baec-9630544b1d71 | 8 | public BillHistoryWindow(Household h) {
setResizable(false);
setTitle("Recibos");
Household household = h;
this.familyService = FamilyService.getInstance();
this.billService = BillService.getInstance();
String[] yearString = new String[20];
String[] monthString = new String[12];
monthString[0] = "ENER... |
387ab86a-cf9f-4351-9d55-8b052ab5ff12 | 9 | final void method3938(Class21 class21, int i,
Interface5_Impl2 interface5_impl2, int i_40_,
int i_41_, int i_42_, int i_43_) {
try {
if (i_43_ <= 46)
aClass262_9903 = null;
anInt9867++;
int i_44_;
int i_45_;
if (Class249.aClass21_3217 != class21) {
if (class21 == Class348_Sub5_Su... |
a528c2ab-1a69-4fce-8cd3-8c3e8b5c117d | 9 | @Override
public void scheduleStart() {
if (netList == null || netList.size() <= 0) {
return;
}
new Thread() {
@Override
public void run() {
try {
Iterator<SubNetData> it = netList.iterator();
while (... |
c3e851ba-7f14-4505-b06f-d8e59116f5f6 | 5 | public int hgetbits(int N)
{
totbit += N;
int val = 0;
int pos = buf_byte_idx;
if (pos+N < BUFSIZE)
{
while (N-- > 0)
{
val <<= 1;
val |= ((buf[pos++]!=0) ? 1 : 0);
}
}
else
{
while (N-- > 0)
{
val <<= 1;
val |= ((buf[pos]!=0) ? 1 : 0);
pos = (pos+1) & BU... |
7eaa3223-d504-4541-9e40-0b91dc86cb1a | 0 | public FunctionEnvironmentRecord() {
this.beginScopeSymbolTable();
} |
a1de8986-1147-4045-9747-f48635d7bbe5 | 2 | public static void main(String[] args) throws FileNotFoundException{
int count=0;
for(String s: words()){
if(triWord(s)){
count++;
}
}
System.out.println("Number of triangular words: "+count);
} |
6e917994-61f7-40c7-ae75-835f33c2be09 | 9 | public static String getMouseName(int mouseCode) {
switch (mouseCode) {
case MOUSE_MOVE_LEFT: return "Mouse Left";
case MOUSE_MOVE_RIGHT: return "Mouse Right";
case MOUSE_MOVE_UP: return "Mouse Up";
case MOUSE_MOVE_DOWN: return "Mouse Down";
case MOUSE... |
2b2ce496-d641-4a8f-a308-7c281fb0f45c | 9 | static final Actor method1115(int i, int i_3_, int i_4_, int i_5_) {
anInt1347++;
Class261 class261 = Class175.aClass261ArrayArrayArray2099[i_4_][i][i_3_];
if (class261 == null) {
return null;
}
Actor actor = null;
int i_6_ = -1;
if (i_5_ != 252) {
return null;
}
for (Class256 class256 = class26... |
abf74f44-2bba-4bb5-9b62-d516e613984f | 1 | public Canvas()
{
// We use double buffer to draw on the screen.
this.setDoubleBuffered(true);
this.setFocusable(true);
this.setBackground(Color.black);
// If you will draw your own mouse cursor or if you just want that mouse cursor disapear,
// insert "true... |
a59ccd81-2fb9-4c2a-9950-d22a3cbb1626 | 5 | @Override
public void paintComponent(Graphics g) {
g.setColor(Color.black);
g.fillRect(0, 0, data.length, HALF_WIDTH * 5);
g.setColor(Color.white);
g.setFont(DATA_FONT);
int j = 0;
for (Entry< Long,Double> ent : freq_s.entrySet()) {
j += 3;
g.drawString(" frequency: " + ent.getKey(), 40, FONT_... |
3179a042-5876-4a64-a2f2-088802e8c7ad | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
e390f25d-f3aa-45b1-b74f-dbd6b7416f1b | 5 | @Override
public void OnTrigger(Connection User, RoomItem Item, int Request, boolean UserHasRights)
{
if (!UserHasRights)
{
return;
}
if(Request == -1)
{
return;
}
Room Room = User.Environment.RoomManager.GetRoom(I... |
9e8e25f2-a85e-4719-92a2-4dafaea40317 | 0 | @Test()
public void getMalesCount() {
Assert.assertEquals( addressBook.getMalesCount(), 3 );
} |
14ccf398-2c2c-402a-bce1-9ebd3942b274 | 7 | private static List<Person> loadPeople(BufferedReader reader) throws IOException{
List<String> category = new ArrayList<>();
List<Person> people = new ArrayList<>();
List<String> buf = new ArrayList<>();
int size;
String line;
line = reader.readLine();
//head
... |
99a57e87-e5b4-442a-99d3-6a29c007bfda | 7 | public static void main(String[] args) {
BufferedReader cIn = new BufferedReader(new InputStreamReader(System.in));
if(args.length > 0) {
if(args[0].equals("verify")) {
try {
int result = verify(System.in);
if(result == 0) {
System.err.println("Chain is valid.");
System.exit(0);
... |
8ee0dc3b-35b2-489f-b8d0-244b0f96f975 | 3 | @Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
int i = new Random().nextInt();
if (i % 10 == 0) {
fireDecadeHappened(i);
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
47e0d14b-ab72-46a7-8b5d-ca9c96736317 | 4 | public static String readUrl(String address){
BufferedReader reader = null;
try {
URL url = new URL(address);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer buffer = new StringBuffer();
int read;
char[] chars... |
633c9c89-f792-4447-a5c2-ba3c09c492a2 | 7 | public static boolean checkTargetCollide(Sprite t1, Sprite t2) {
boolean leftCollide = (t1.x_pos > t2.x_pos && t1.x_pos < t2.x_pos + t2.width);
boolean rightCollide = (t1.x_pos + t1.width > t2.x_pos && t1.x_pos + t1.width < t2.x_pos + t2.width);
boolean topCollide = (t1.y_pos > t2.y_pos && t1.y_pos < t2.y_pos + t... |
9090d83d-ad49-42b4-ad8c-258caf3fb8cd | 6 | public void paint(Graphics g2) {
if (this.applet != null) {
return;
}
int w = getWidth() / 2;
int h = getHeight() / 2;
if ((this.img == null) || (this.img.getWidth() != w) || (this.img.getHeight() != h)) {
this.img = createVolatileImage(w, h);
}
Graphics g = this.img.getGraphics... |
624deee0-4083-46da-8da9-e48f739ea6f7 | 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... |
4c5b37db-7024-47b3-a8f4-b5716b1ae1e4 | 4 | private GameSystem readGameSystem(ByteArrayInputStream inputStream) throws XmlException, IOException {
final GameSystem gameSystem = new GameSystem();
try {
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(inputStream, new DefaultHandler() {
... |
aa329046-30c3-4743-8283-3ed3138025fd | 3 | public static DamageType getType(int i) {
switch (i) {
case 1:
return NONE;
case 2:
return PHYSICAL;
case 3:
return SPECIAL;
}
return null;
} |
95802267-4e8b-4f73-8b5e-6c8bd9ba15ed | 9 | public static Method[] getUniqueDeclaredMethods(Class<?> leafClass) throws IllegalArgumentException {
final List<Method> methods = new ArrayList<Method>(32);
doWithMethods(leafClass, new MethodCallback() {
@Override
public void doWith(Method method) {
boolean knownSignature = false;
Method methodBeing... |
4c298e24-ee28-4cfe-b64a-b9968da9c8a2 | 9 | @Override
public boolean isCollidingWith(Collidable c) {
if (!super.isCollidingWith(c)) {
return false;
}
Rectangle2D thisRect = this.getLogicalBounds();
Rectangle2D cRect = c.getLogicalBounds();
int outCode = thisRect.outcode(new Point2D.Double(cRect.getCenterX(),
cRect.getCenterY()));
if (directio... |
31321926-d6b6-4e89-90c0-59b41bc65605 | 1 | private String create_json(String subject, String requester_name,
String requester_email, String copied_emails,
String notify_requester, String content) {
JSONArray cc = new JSONArray();
cc.add(requester_email);
JSONObject cont = new JSONObject();
cont.put("text", content);
cont.put("html", "");
JSO... |
1892c897-c1a0-4214-9b2c-585b1f005ea8 | 4 | private Complex parse_complex(String substring) {
StringBuilder sb = new StringBuilder(substring);
Scanner s;
double r = 0.0;
double i = 0.0;
if (sb.charAt(0) == '(') {
sb.deleteCharAt(0);
}
if (sb.charAt(sb.length() - 1) == ')') {
sb.del... |
f9155a29-5422-49ad-9257-48ac24d493b8 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RobotData other = (RobotData) obj;
if (isInKitchen != other.isInKitchen)
return false;
if (robotID != other.robotID)
return false;
if (... |
e9def186-e978-4f06-8eb8-da00e167ada4 | 7 | public int AddTradesBatchToVault(List<MatchProps> mProps, String tradeDateTime) throws SQLException
{
int retval = 0;
Connection con = null;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.sql.PreparedStatement psTrades = null;
String psTradesSQL= "INSERT OR IGNORE INTO trades(T... |
db31d436-6616-4449-b32e-b6b6615190b3 | 4 | public static char four(int r, int c, int f) {
if (s1(r, c, f) || s4(r, c, f) || s5(r, c, f))
return '|';
else if (s7(r, c, f))
return '_';
return '.';
} |
60d239a5-ec1f-4b79-a830-6bb639aafca5 | 5 | public boolean editManufacturedProduct(String productName, String newProductName,
int newProductQuantity, long newSalePrice){
for (int i = 0; i < manufacturedProductList.size(); i++) {
int actualQuantity = 0;
if (manufacturedProductList.get(i).getP... |
45ec3a9b-c63b-4075-8279-c5d41281dc4f | 1 | protected String getOptionTypeName(String arg) {
Record rec = getRecord(arg, null);
return (rec != null) ? rec.valTypeName() : null;
} |
19c4e725-6734-4619-8e93-a625bf2429fd | 0 | LockAndModify(ByteBuffer mbb, int start, int end) {
this.start = start;
this.end = end;
mbb.limit(end);
mbb.position(start);
buff = mbb.slice();
start();
} |
6784a2ba-1dfb-45d7-bbd9-a92c9c674e8d | 3 | private boolean goOrBack(String res) {
JSONArray jsonArray;
try {
jsonArray = new JSONArray(res);
int size = jsonArray.length();
if (size==0) {
return false;
}
int startTime = parseDate(jsonArray.getJSONObject(size-1).getString("created_at"));
if (startTime>=Integer.valueOf(Container... |
b7f97b5c-2ec1-4180-a5cc-25c463ba9384 | 2 | private void drawBackgroundPattern(Graphics2D g, float interpol, Vector offset) {
Vector position = Vector.scalar(BACKGROUND_DEPTH,Vector.subtract(new Vector(), offset));
Composite old = g.getComposite();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, BACKGROUND_OPACITY));
// draw vertica... |
af897d02-bd09-428d-b88e-faad1ce284ae | 3 | private static boolean isLayerName( String shortName )
{
int top = 0;
int bot = layerNames.length-1;
while ( top <= bot )
{
int mid = (top+bot)/2;
int res = shortName.compareTo(layerNames[mid]);
if ( res == 0 )
return true;
... |
a1ca95be-feac-4498-9f92-571a59020052 | 1 | @Override
public void in() throws Exception {
if (data == null) {
throw new ComponentException("Not connected: " + toString());
}
Object val = data;
// fire only if there is a listener
// if (ens.shouldFire()) {
// DataflowEvent e = new DataflowEvent(ens... |
9af0cb83-7a37-4eb7-af10-58efaa551bb1 | 7 | public void paintComponent(Graphics g) {
updateScale();
System.out.println("Canvas size actually is: " +this.getSize().width +", "+this.getSize().height);
System.out.println("Trying to paint Canvas of size: "+thisSize.width +", "+thisSize.height);
super.paintComponent(g);
Graphics2D g2d = (Graphics2D... |
64d69bf4-1df1-4712-974a-3d7b6dab18f9 | 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://download.ora... |
4243542c-bb30-4b88-a6c1-2996fb42c917 | 1 | @Override
public Answer getRightAnswer() {
return operator.getAssociativity() == Associativity.RIGHT ?
RightAssociativityAnswer.getInstance() : LeftAssociativityAnswer.getInstance();
} |
0299feb2-6f3a-4a0f-ac57-8ea48c53e74c | 7 | * @param carrier The <code>Unit</code> acting as carrier.
*/
public void loadCargo(Goods goods, Unit carrier) {
if (!requireOurTurn()) return;
// Sanity checks.
if (goods == null) {
throw new IllegalArgumentException("Null goods.");
} else if (goods.getAmount() <= 0... |
cf940764-d452-4caf-8472-55cacf34f4bf | 1 | public void init() {
try {
loadedWorld = new World("World1.txt");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
loadedWorld.load();
} |
7b3c5795-aa1f-409b-b3d4-835873367e19 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Vehicle other = (Vehicle) obj;
if (horizontal != other.horizontal)
return false;
if (identifier != other.identifier)
return false;
if (... |
65ce03aa-5beb-4c56-a1a7-5be7abc57f9d | 6 | @Override
public void takeTurn(Party allies, Party enemy)
{
if(this.getHp() > 0)
{
allies.showParty();
enemy.showParty();
setTaunt(-1);
Ability selectedAction = showActions();
Character target;
if(selectedAction.isAOE())
{
if(selectedAction.isHelpful())
{
for(int i = 0; i < allie... |
89302511-308d-4ca6-83f6-97913ab99eb4 | 6 | private static Allocation takeLeastNOFBalanced(String consumer,
List<AllocationInfo> infos,
AllocationInfo requestInfo, Map<String, Double> balances) {
//picks allocations that match requirements
List<AllocationInfo> matchedAllocations = new LinkedList<AllocationInfo>(infos);
if (matchedAllocations.isEmp... |
1859d4ee-6aa1-4a1e-9627-f1237562262d | 7 | public static void main(String args[]) {
//If there is already a org.xito with a running task just display that
if(dialog != null && dialog.getTaskThread() != null && dialog.getTaskThread().isAlive()) {
dialog.setVisible(true);
return;
}
ProgressDialogDescriptor d... |
70dadf41-8a16-4795-abc8-d18de41e117b | 7 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
final String str=CMParms.combine(commands,1).toUpperCase();
final StringBuffer msg=new StringBuffer("");
if(str.length()==0)
msg.append(L("\n\r^xThe known deities:^.^? \n\r\n\r"));
else
msg.app... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.