method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5a73f8a2-311d-47ca-8a80-db01b88a7a13 | 9 | public final boolean isBoxInFrustrum(float var1, float var2, float var3, float var4, float var5, float var6) {
for(int var7 = 0; var7 < 6; ++var7) {
if(this.frustrum[var7][0] * var1 + this.frustrum[var7][1] * var2 + this.frustrum[var7][2] * var3 + this.frustrum[var7][3] <= 0.0F && this.frustrum[var7][0] ... |
78e74ff2-38a3-4c99-b7be-b7c069267e5f | 3 | protected void mkBus (String busname, int busnum)
throws IOException, SecurityException
{
USB bus;
bus = new USB (directory_prefix, busname, busnum, listeners, self);
if (trace)
System.err.println ("mkBus " + bus);
busses.put (busname, b... |
03cc95cd-6ca1-4665-9e7c-2c96bb1b3422 | 3 | public String[] readAllStrings() {
// we could use readAll.trim().split(), but that's not consistent
// since trim() uses characters 0x00..0x20 as whitespace
String[] tokens = WHITESPACE_PATTERN.split(readAll());
if (tokens.length == 0 || tokens[0].length() > 0)
return tokens... |
7757fdb4-c690-4560-a691-ea0d67532a3f | 2 | private static void checkAndRemoveAnyHordeSpies(ArrayList<Character> characters)
{
// TODO loop through each character in the characters list
// if the character is of Race: ORC, remove that character from the
// list
Iterator<Character> iterator = characters.iterator();
while (iterator.hasNext())
{
Ch... |
7fbeef82-9f73-4b10-b574-2f25d8f013b4 | 5 | public boolean isWallCollision()
{
for (Wall wall : world.getWalls()) {
if (snake.getHead().getX()+5 >= wall.getX() &&
snake.getHead().getY()+5 >= wall.getY() &&
snake.getHead().getX()+ 5 <= wall.getX() + wall.getWidth() &&
snake.getHea... |
a3f6929d-43ee-40a2-b155-0e8216a4febc | 9 | @Override
public boolean equals(Object obj) {
// standard equals() technique 1
if (obj == this) return true;
// standard equals() technique 2
// (null will be false)
// any other class object will be caught as false
if (!(obj instanceof Piece)) return false;
Piece other = (Piece)obj;
// above ... |
434c7433-a884-49e6-8eb9-9e8101286780 | 6 | private Point getRowColOfSelectedCard(Point pressPt) {
/*
* Stage 6 (8 Marks)
*/
for (int i = 0; i < cards.length; i++) {
for (int j = 0; j < cards[i].length; j++) {
if (cards[i][j] != null && !cards[i][j].getHasBeenRemoved()
&& cards[i][j].getIsFaceUp()
&& cards[i][j].pressPointIsInsideCar... |
8a1ec1d1-b42a-4879-ad5a-b8e4533211cd | 0 | public Function getFunction() {
return _function;
} |
f40bcc04-2c0a-40dc-acdb-2f92ede7a158 | 0 | public void setServerHandleConnectList(
Vector<ServerHandleConnect> serverHandleConnectList) {
this.serverHandleConnectList = serverHandleConnectList;
} |
fd82d4e4-0e49-4a2d-94a9-df96ca3ee71b | 1 | @Override
public String toString() {
StringBuilder foo = new StringBuilder(super.toString());
if (this.booktitle != null) {
foo.append("Booktitle: ");
foo.append(this.booktitle);
foo.append("\n");
}
return foo.toString();
} |
6b7014df-fba8-4118-b4b8-a5ca32ccca87 | 2 | public void obfuscateProject() {
if (variablePanel.getVariableListSize() == 0) {
MessageDialog.displayMessageDialog(new JFrame(), MessageUtils.getMessage("INFORMATION_DIALOG"), MessageUtils.getMessage("NO_VAR_TO_OBF"));
return;
}
if (!destinationDirectory.equals("")) {
setActionButtonsEnabled(false);
... |
f9d01953-0e7e-4ddf-b9b0-fd0bb0067dab | 8 | public void init(ServletConfig config) throws ServletException{
String props = config.getInitParameter("propertyConfig");
//web.xml에서 propertyconfig에 해당하는 패러미터 읽어옴
Properties pr = new Properties();
// String realpath = config.getServletContext().getRealPath(".");
FileInputStream f = null;
try{
f = new Fil... |
bcf16872-f1bf-47b0-89ec-e26843e229d2 | 3 | public String save() {
if (employee.getReportsTo() != null && employee.getReportsTo().getEmployeeNumber() == -1) {
employee.setReportsTo(null);
}
if (employee.getEmployeeNumber() != null) {
employeeService.updateEmployee(employee);
} else {
employeeService.addEmployee(employee);
}
return EMPLOYEE_L... |
61fa1acd-46ce-431b-a256-57c9a804f01e | 0 | public int getClassID() {
return classID;
} |
5c53b977-f023-45e6-bacd-ea9d253dcc92 | 1 | static boolean question(int nr) {
Question q = new Question();
write("Question "+nr+": "+q.computation+" = ");
if(q.check(read())) {
writeln("Correct!");
return true;
}
else {
writeln("Wrong, the correct answer was "+q.answer);
return false;
}
} |
1f9c75c3-5d09-41e9-ac95-2b3252ae83ea | 3 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
setUser((User) session.get("User"));
Publish sitepublish = new Publish(getUser(), siteurl, catgry);
... |
21dfc04a-039e-451f-bb6b-8e02955287f5 | 7 | public int getInt(char c) {
if (c == 'I') {
return 1;
} else if (c == 'V') {
return 5;
} else if (c == 'X') {
return 10;
} else if (c == 'L') {
return 50;
} else if (c == 'C') {
return 100;
} else if (c == 'D') {
return 500;
} else if (c == 'M') {
return 1000;
} else
return 0;
... |
54d049cc-0c4a-4eed-98b9-65f3edbc5b5e | 9 | public static Region getByName(String region) {
switch (region) {
case "na":
return NA;
case "euw":
return EUW;
case "eune":
return EUNE;
case "lan":
return LAN;
case "las":
... |
ac10c46a-add6-4d92-b96e-afa06d9926f2 | 8 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
request.setCharacterEncoding("UTF-8");
ou... |
732ea0d0-8433-44c3-bdd2-b4901e60eca2 | 1 | public static boolean chequearError(String textoJSON) {
boolean resultado = false;
JSONParser parser = new JSONParser();
try {
Object objeto = parser.parse(textoJSON);
JSONObject objetoJSON = (JSONObject) objeto;
resultado = objetoJSON.containsKey(ERROR);
} catch (ParseException e) {
e.printStackTra... |
11fb4c82-1389-4821-93d9-a9c201e6db40 | 4 | private static int checkClassTypeSignature(final String signature, int pos) {
// ClassTypeSignature:
// L Identifier ( / Identifier )* TypeArguments? ( . Identifier
// TypeArguments? )* ;
pos = checkChar('L', signature, pos);
pos = checkIdentifier(signature, pos);
while (getChar(signature, pos) == '/') {
... |
6d351f07-bd07-453e-9850-391ef380c3bf | 7 | public void paint(Graphics g){
g.drawImage(bgBlue, 0, 0, 900, 600, this);
Font font = new Font("alias", Font.PLAIN, 20);
g.setFont(font);//设置字体
stageNum = FileUtils.getStagesSize();
//g.setColor(Color.black);
//g.fillRect(0, 0, 1000, 1000);
g.setColor(Color.blue);
g.drawString("选择关卡", 400, 30);
... |
10b568ce-56cf-420b-b539-a55d80522335 | 4 | public XRayConfig(XRayLookup plugin) {
this.plugin = plugin;
File configDir = new File("plugins/"+plugin.getName());
if (!configDir.exists()) {
configDir.mkdir();
}
File configFile = new File("plugins/"+plugin.getName()+"/config.yml");
if (!configFile.exists()) {
try {
... |
2ffafe4b-6296-40b1-be2f-3f858ab224fb | 0 | public NamePopup(final Stage parentStage, String titleText)
throws MalformedURLException {
this.root = new StackPane();
this.root.autosize();
this.scene = new Scene(root,
AppSettings.getDoubleValue("name.popup.width"),
AppSettings.getDoubleValue("name.popup.height"),
Color.web(AppSettings.getStri... |
37cc033a-fda0-4de2-9e9f-b5fb7302b2f1 | 5 | @SuppressWarnings("deprecation")
public Scoreboard addDefaultScoreboard(Scoreboard sb) {
if(isGameRunning()) {
for(RushTeam rt : getRushTeams()) {
Team t = sb.registerNewTeam(rt.getName());
t.setAllowFriendlyFire(false);
t.setPrefix(""+rt.getColor());
t.setSuffix(ChatColor.RESET+"");
t.setDisp... |
c2dcef30-935f-4666-a736-318c00b46478 | 1 | @Test
public void ensureSalaryItemInBudgetContainsDifferentValueFormObjectTestOne() {
when(budgetFormData.getSalary()).thenReturn(new BigDecimal("1000"));
try {
budget.buildBudget(budgetFormData);
} catch (Exception e) {
e.printStackTrace();
}
asser... |
c704fa80-6dba-4a1e-9480-f2660ef66b2c | 7 | public static void main(String[] args) throws IOException {
String hostName = args[0]; //localhost
Checker checker = new PortChecker();
int port = checker.check(args[1]);
Socket socket = new Socket(hostName, port);
BufferedReader input = new BufferedReader(new InputStreamRead... |
6a4c691a-3796-49b9-91a0-f0095cfe30a8 | 6 | * @param drawUnexploredBorders If true; draws border between explored and
* unexplored terrain.
* @param withNumber indicates if the number of inhabitants should be drawn too.
*/
private void displayTileOverlays(Graphics2D g, Tile tile,
boolean drawUnexplor... |
787ff8dc-d40a-45b0-8e22-759ba2729072 | 0 | @AnnotationTest(value="aaa",value1="a",value2=EnumTest.WELCOME)
public void method()
{
System.out.println("used of annocation !");
} |
07e46e8b-dc6b-4039-b030-3364d9f37b20 | 6 | public int addReport(Report report) {
PreparedStatement pStatement = null;
ResultSet rs = null;
int id = 0;
try{
statement = connection.createStatement();
String query = "INSERT INTO reports (cabin_id, wood, damage, missing, other, email, report_date) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?)";
pStatemen... |
484fad86-32b7-46e0-a0e8-edfe46fc265b | 3 | public ByteBuffer decryptBuffer(
String cryptFilterName, PDFObject streamObj, ByteBuffer streamBuf)
throws PDFParseException {
final PDFDecrypter decrypter;
if (cryptFilterName == null) {
decrypter = defaultStreamDecrypter;
} else {
decrypter = dec... |
ae0ef295-1001-4bd0-9749-e903ff92cf84 | 0 | protected void onSetTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} |
637a503e-80f8-4cd6-95fa-ea13722cf958 | 0 | @Override
public void setCur(String value) {this.cur = value;} |
2ec6ecf9-0f02-433f-a479-aa279296d940 | 9 | @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();
if... |
40b2b981-5a12-46f9-ae83-0d3d3d1b91da | 5 | public List<Claim> getSubclaimList(String fileName, String teamType) {
List<Claim> claimList = new ArrayList<Claim>();
Element claimE;
Claim claim = null, claimFlag = null;
ClaimDao claimDao = new ClaimDao(fileName);
List<Claim> subClaimParentList = claimDao.getClaimAndSubclaimList(teamType);
for (Iterator ... |
b6817f85-7e79-4560-918e-e588b198e28a | 2 | public String maybeAddLoginRedirect(final String urlString, final CycFort cyclist,
final CycDenotationalTerm applicationTerm) {
// sample urlString: cg?CB-CF&236134
final int questionMarkPos = urlString.indexOf('?');
if ((cyclist instanceof CycConstant) && (questionMarkPos >= 0)) {
final Str... |
f7aa0ace-7529-41b0-a931-889d1bf0ab76 | 0 | public static String readFile(String path, Charset encoding) throws IOException {
byte[] encoded = Files.readAllBytes(Paths.get(path));
return encoding.decode(ByteBuffer.wrap(encoded)).toString();
} |
dc5a3bcf-564a-480f-9ccd-8ca9266041ff | 6 | private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
... |
bc0c055c-7381-4d6b-8dff-a9cb1f8d1657 | 7 | private static int getChromaticIndex(String note) {
int base = getNaturalIndex(note.charAt(0));
if(note.length() == 1) {
return base;
}
if(note.length() == 2) {
if(note.charAt(1)=='b') {
return (base+11)%12;
}
if(note.charAt(1)=='#') {
return (base+1);
}
}
if(note.length() == 3) {
... |
3fcc23fc-d061-4a19-9074-f3e84de45751 | 6 | public int updateHiScore() {
for (int i = 0; i < hiScores.length; i++) {
HiScore s = hiScores[i];
if((s.score < score) ||
((s.score == score) && (s.lines >= lines))) {
//Stack the HiScore
switch (i) {
case 0:
... |
c83d3d0d-46c5-4bdc-9911-14f69ba4418c | 3 | private void initGUI() {
try {
final GridBagLayout gridBag = new GridBagLayout();
final GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
mainPanel.setLayout(gridBag);
getContentPane().add(mainPanel, BorderLayout.CENTER);
mainPanel.setBorder(BorderFactory.createTitledB... |
ed1932ec-26b3-4bf7-9350-a0665df4894a | 2 | @Override
public String getColumnType(String prop)
{
String res = adapter.getColumnType(this.getReturnType(prop), null);
Long size = getColumnSize(prop);
if(size != null && res.contains("("))
{
//overwrite the size we got from the default column type
String start = res.substring(0, res.indexOf("(")+1);
... |
3d2c47d2-e276-4f48-b744-ed8b84c7042e | 7 | @Override
public synchronized boolean runTick() {
if(this.myIsGameOver)
return false;
if(myIsStuck){
if(checkIfStuck()){
crashPiece();
return false;
}
else{
myIsStuck = false;
}
}
if(myPiece.equals(IPiece.NULL_OP)){
clearRows();
return true && !this.myIsGameOver;
}
/... |
753e7388-1875-4838-8f53-5bac23101e3b | 3 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(errorType){
case ERROR_UNEXPECTED_CHAR:
sb.append("Unexpected character (").append(unexpectedObject).append(") at position ").append(position).append(".");
break;
case ERROR_UNEXPECTED_TOKEN:
sb.append("Unexpected token ").append... |
ca98597e-3919-4d2f-9a36-2d44ed14ae56 | 6 | public static void main(String[] args) {
try {
File file = new File("C:\\Users\\Collin\\Downloads\\names.txt");
Scanner readFile = new Scanner(file);
String namesList = readFile.nextLine();
String[] names;
names = namesList.replace("\"","").split(",");
System.out.println("Array Created: " + names.l... |
fab8b99b-72f7-4c28-b140-9bfe9f2a4094 | 9 | private void run() {
// repita ate que a lista de algum homem esteja vazia ou todos estejam casados
while(!someManListEmpty() && !everyoneEngaged()) {
boolean existFreeMan = true;
// enquanto existir homem solteiro
while(existFreeMan) {
Person currentMan = existFreeMan();
if(currentMan != null && c... |
d1b65a0d-272d-469b-aa11-9553458c20ef | 0 | public Xor( Filter a, Filter b )
{
this.a = a;
this.b = b;
} |
a0d8f32c-98ed-44d3-ae7e-aaaff22a7b09 | 3 | public static int[] findspaces(String text) {
java.util.List<Integer> l = new ArrayList<Integer>();
for(int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if(Character.isWhitespace(c))
l.add(i);
}
int[] ret = new int[l.size()];
for(int i = 0; i < ret.length; i++)
ret[i] = l.get(i);
ret... |
ad4cadfd-49c0-4b2f-b866-6ca85766c785 | 4 | public void readConfigFile(){
configs = new HashMap<String,String>();
try {
BufferedReader reader = new BufferedReader(new FileReader(new File("config.txt")));
String line = "";
while ((line=reader.readLine())!=null){
String []split = line.split("::");
if (split.length>1){
configs.put(split[0]... |
554dca6a-5be8-4c9a-aa48-73e2569a0f1f | 5 | @Override
public void downloadImage(ModpackModel key, File target) {
Resource res = resourceType.getResource(key);
if (res == null || res.getUrl() == null || res.getUrl().isEmpty())
return;
try {
mirrorStore.downloadFile(res.getUrl(), userModel.getCurrentUser().getD... |
12c768b5-e59c-47c4-967f-15f5307bc4bf | 9 | public void testWeatherReportAppUsingDateMaster(){
PreparedStatement pstmt = null;
conn = DBConnectionMgr.getConnection();
HashMap<Double, DateMasterVO> hm = new HashMap<Double, DateMasterVO>();
double avgTemp = 0.0;
DateMasterVO dateMasterVO = null;
ResultSet rs = null;
try{
if(conn != null && !conn.i... |
35d2a5ba-6640-422c-9686-cd1955b0e72b | 0 | public List findByRealname(Object realname) {
return findByProperty(REALNAME, realname);
} |
3c5d865f-9ec8-407c-993a-54a5d04f6594 | 4 | public void run()
{
long startTime = System.nanoTime();
LinkedList<Integer> list = new LinkedList();
int length = a.length;
for(int i=1;i<length;i++)
{
for(int j=i;j>0;j--)
{
if(a[j] < a[j-1])
{
int temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
}
}
for(int i=0... |
2c35cde4-6967-4012-8c51-06c11dc89924 | 3 | public static void filledSquare(double x, double y, double r) {
if (r < 0) throw new RuntimeException("square side length can't be negative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
double hs = factorY(2*r);
if (ws <= 1 && hs <= 1) pixel(x... |
55d3f979-5eaa-478c-8287-ff4af80d57fd | 3 | public void showLoginStatsDate(CommandSender sender,
String date,
int page,
int itemsPerPage) {
int totalTimeOnline = 0;
int totalBlocksPlaced = 0;
int totalBlocksBroken = 0;
List<LoginEntry> rawList = plugin.sqlDb.readLoginsDate(date);
List<LoginEntry> playerList = plug... |
7a690832-6597-46dd-9729-20d2cbf3845f | 3 | private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
} |
0fe2926e-ab27-4e73-a5a6-49f6be25f73b | 2 | @Override
public boolean colides(SchlangenKopf head) {
if (!catched && super.colides(head)) {
head.eatDiamant(this);
return true;
}
return false;
} |
fc5bb869-a4b7-40b5-9e3c-dc9eb2139845 | 3 | public void calcTargets(int square, int steps){
LinkedList<Integer> tempAdj = adjMtx.get(square);
for(int i : tempAdj) {
if(!visitedMtx.get(i)) {
if(steps == 1) {
targets.add(i);
} else {
visitedMtx.put(i, true);
calcTargets(i, steps - 1);
visitedMtx.put(i, false);
}
... |
52711830-d5fc-4e2d-a4ae-a6adc899a722 | 0 | public String toString() {
return super.toString() + ": \"" + getInputToRead() + "\"" + ": \""
+ getStringToPop() + "\"" + ": \"" + getStringToPush() + "\"";
} |
eb7222a9-3ac9-4ae9-8076-4452c7db658d | 0 | public static void main(String[] args) {
System.out.println(1 + 2); // 3
System.out.println(2 - 3); // -1
System.out.println(3 * 4); // 12
System.out.println(16 / 5); // 3
System.out.println(16 % 5); // 1
} |
d771b4d9-9e20-40fc-88e0-0fba654ff85c | 5 | @BeforeClass
public static void beforeClass()
{
List<Double> genes = new ArrayList<Double>();
genes.add(1.0);
genes.add(0.0);
genes.add(0.0);
genes.add(1.0);
genes.add(1.0);
Genotype g = new Genotype(0,1,1,genes);
try {
moveForwardAgent = new Agent(g,0,0,0);
} catch (WeigthNumberNotMatchExcept... |
9b56e3cf-f7b2-430c-87f9-d820f63f509f | 8 | public static int init_machine() {
int i;
if (code_init() != 0)
return out();
for (i = 0; i < MAX_MEMORY_REGIONS; i++) {
Machine.memory_region[i] = null;
Machine.memory_region_length[i] = 0;
Machine.memory_region_type[i] = 0;
}
... |
3d76775d-8969-4f69-9da4-36757e5b9c66 | 5 | public static void main(String[] args) {
/*
* Der Benutzer soll die möglichkeit haben eine Portnummer als Argument über die Kommandozeile zu übergeben.
* Wenn kein Port übergeben wird, wird der Standardport gesetzt
*/
int port = Registry.REGISTRY_PORT;
if(args.length == 1) {
port = Integer.parseInt(ar... |
667238b5-cec4-4675-ba9a-48f2ed11e9b7 | 3 | public void run() {
try {
ServerSocket server = new ServerSocket(HTTP_PORT);
while (true) {
try {
Socket connection = server.accept();
threadPool.execute(new HTTPWorker(connection));
} catch (IOException e) { e.printStackTrace(); }
}
} catch (IOException e) { e.printStackTrace(); }
} |
e80c559a-9c12-4572-bfd8-792fe6a09054 | 0 | @Override
public int fight() {
return super.fight();
} |
62a2e791-b4d4-40ad-8c22-51c2abc6196f | 6 | private void computeWeight() {
weight = 0.0F;
final Iterator iter = defs.iterator();
// Look at all(?) of the definitions of the IGNode
while (iter.hasNext()) {
final LocalExpr def = (LocalExpr) iter.next();
weight += blockWeight(def.block());
final Iterator uses = def.uses().iterator();
... |
2d2298ec-e45b-4ddf-ad4a-c126914a5e6b | 4 | public void setText(SectionType name, String text) {
if (name.toString().contains("PERSONAL")) {
SingleRowSection personalSec = (SingleRowSection) textSections
.get(SectionType.PERSONAL_INFO);
personalSec.setText(name, text);
} else if (name.toString().contains("HEADER")) {
SingleRowSection headerSec ... |
a6a1ee97-9fa1-486f-a0e1-da353a029a02 | 9 | public static String toHexString(String s) {
StringBuilder sb = new StringBuilder();
for(int i=0;i<s.length();i++) {
char ch = s.charAt(i);
if (i > 0) {
sb.append(' ');
}
if (ch < 128) {
sb.append(ch);
} else {
if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_H... |
66aefc3c-306d-4a12-817d-df22efa9f2e8 | 9 | private int decideSlotClassic(Range target, int cardDrawn){
//Original logic for the hard player
int slot = 0;
if (target.getNumSlots() > 1){
int span1 = target.getHighEnd() - cardDrawn; //test card in first slot
int span2 = (target.getHighEnd() - cardDrawn) + (cardDrawn - target.getLowEnd()); //test card i... |
ac750a5d-0728-4703-84dc-5683973b532e | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
Outliner.menuBar.searchMenu = this;
} |
0093acc4-6e72-46a1-a9a6-1c1e41de636c | 7 | public boolean treeContains(Object object) {
if (object instanceof CycNart) {
object = ((CycNart) object).toCycList();
}
if (this.contains(object)) {
return true;
}
for (int i = 0; i < this.size(); i++) {
Object element = this.get(i);
if (element instanceof CycNart) {
... |
5ae31925-1411-44a9-9e7f-8176ad70bac0 | 7 | public void readLocations(String fileName)
{
try {
this.fileName = fileName;
if (!new File(fileName).exists())
{
new File(fileName).createNewFile();
return;
}
else {
ObjectInputStream input = new ObjectInputStream(new FileInputStream(fileName));
while (true)
try... |
734b1e6c-caba-42a3-99e8-af58955abf7d | 5 | @Override
public void execute(CharSequence str) {
int selectedItemLevel = this
.getItemLevel(this.editor.getSelectedItem());
int newSectionLvl = 0;
for (newSectionLvl = 0; str.charAt(newSectionLvl) == '*'; newSectionLvl++)
;
StringBuilder title = new StringBuilder(str.subSequence(
newSectionLvl + 1... |
417e8b5f-f6c3-4932-b766-720299f5eb9d | 8 | private JComponent getHeadline(Object source) {
JComponent headline;
if (source == null) {
return new JLabel();
} else if (source instanceof Player) {
Player player = (Player) source;
headline = localizedLabel(StringTemplate.template("playerNation")
... |
1819fb37-77ab-4abb-8616-8ee6104bb4cc | 8 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(args[0]));
String s;
while ((s = br.readLine()) != null) {
int t = 0;
char c;
for (int i = 0; i < s.length(); i++) {
c = s.charAt(s.length() - i - 1);
if (c == 'a') t += 10 * ((int... |
238d39b6-1923-4b99-8a71-6a5a809f756b | 3 | public void process(int start, int end, Node node)
{
node.leaves.add(leaf);
node.count++;
for (int i = 0; i < node.children.size(); i++)
{
if (input.substring(start, end).startsWith(
input.substring(node.children.get(i).stringStart,
node.children.get(i).stringEnd)))
... |
9db27b32-22c4-4e03-b861-55583f153e0f | 1 | public void ensureSize(final int size) {
ensureCapacity(size);
while (size() < size) {
add(null);
}
} |
1c0a05ce-b769-4d47-b1e5-465d7e417bf2 | 1 | @Test
public void testTagMp3FileNoDoublingTags() throws CannotReadException, IOException {
t.tagAudioFile(false);
t.tagAudioFile(false);
AudioFile mp3File = AudioFileIO.read(workingCopyPath.toFile());
entagged.audioformats.Tag mp3Tag = mp3File.getTag();
assertTrue(mp3Tag instanceof Id3v2Tag);
assertTrue... |
8aeb8a9e-66f9-4906-8ea7-a197b3a6bd67 | 8 | public void analyzeCode(MethodIdentifier methodIdent, BytecodeInfo bytecode) {
this.bytecode = bytecode;
TodoQueue modifiedQueue = new TodoQueue();
MethodInfo minfo = bytecode.getMethodInfo();
for (Iterator iter = bytecode.getInstructions().iterator(); iter
.hasNext();) {
Instruction instr = (Instructio... |
ae7d0755-4959-4ea6-baa8-cb2b06c1c553 | 3 | public REDemo(final JFrame parent) throws BadLocationException {
super();
JMenuBar bar = new JMenuBar();
JMenu file = new JMenu("File");
bar.add(file);
JMenuItem quitItem = new JMenuItem("Exit");
file.add(quitItem);
quitItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEv... |
47e1f63b-4b20-4c6f-9d0c-08f2a984bd8a | 0 | public void setNom(String nom) {
this.nom = nom;
} |
5fe66b47-a567-47b4-8b8d-69567bec734c | 7 | @Override
public boolean canImport(TransferHandler.TransferSupport info)
{
GlobalLogger.getLogger().logp(Level.FINE, this.getClass().getName(),
"canImport(TransferSupport)", "Can import called.");
if (!info.isDrop())
{
return false;
}
// Check for Task flavor
if (!info.isDataFlavorSupported(new Da... |
76d10982-ec65-44f6-9a13-3a8a675cf395 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
235c45d2-ca66-409f-805c-4f7e1b8e985f | 2 | public String toCSVString(){
String csvString = "";
//First cell is the setup cost parameter
csvString = csvString + setupCost+";";
//Second cell is the inventory cost parameter
csvString = csvString + inventoryHoldingCost+";";
//The next cells are the order distributions
for (int i = 0; i < orde... |
77c354f5-08cc-4a78-b5a0-7f509d31ea10 | 3 | public DefaultComboBoxModel<String> buildList() {
DefaultComboBoxModel<String> comboBoxModel = new DefaultComboBoxModel<String>();
String line;
try {
BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/spells"));
while((line = reader.readLine()) != null) {
... |
2da218f2-8ac0-437c-a67e-c548481714dc | 4 | private Connection getConnection() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
Utilities.outputError("Could not find sql drivers");
return null;
}
try {
Connection connection = DriverManager.getConnection(
"jdbc:mysql://" + m_options.host + ":" + m_... |
65690122-5d15-4a6b-b9d9-c87e736ac308 | 7 | public static void main(String[] args){
ParallelPort lpt1 = new ParallelPort(0x378);
String s = "n";
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
// Input
System.out.println("Ligar, Desligar ou Sair?(l/d/s)");
try{
s = br.readLine();
}catch(Excep... |
5a1bf0a1-c29a-4d03-be7f-87a70b6bd921 | 6 | public static void main(String s[])
{
startTime = System.nanoTime();
Date date = new Date();
/*
System.out.println("This is "+getFullVersion());
System.out.println(getCopyright());
System.out.println("");
*/
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
startD... |
77f7b798-3b11-40f0-aa63-d43c86ec2105 | 5 | private void updatePlayers(int packetSize, Buffer stream) {
actorsToUpdateCount = 0;
playersObservedCount = 0;
updateLocalPlayerMovement(stream);
updateOtherPlayerMovement(stream);
updatePlayerList(stream, packetSize);
updatePlayersBlock(stream);
for (int p = 0; p < actorsToUpdateCount; p++) {
int play... |
a2a1c8e0-9ce4-4e5e-b7c1-0c1071d65078 | 4 | private Vector<Integer> getCompleteLineYIndices() {
Vector<Integer> indexY = new Vector<Integer>();
boolean completeLine = true;
for (int y = boardSizeY; y >= 0; y--) {
for (int x = 0; x <= boardSizeX - 1; x++) {
if (tetrisMap[x][y] == 0) {
completeLine = false;
}
}
if (completeLine) {
i... |
4e1316f0-2720-4b98-9fc1-14d9d7aaedfc | 1 | @Override
public void showQuestionText(Question question) {
if (statistic != null) {
console.printf("%d %s%n", statistic.getNextQuestionNumber(), question.getQuestionText());
} else {
console.printf("%s%n", question.getQuestionText());
}
} |
b88a9de2-0ab2-4604-82b9-b556deaf5e93 | 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... |
a9b96d82-2dda-48a7-8690-0a65a97832d7 | 0 | public List<PosFuncionarios> getFuncionarios(){
return getHibernateTemplate().find("from PosFuncionarios ");
} |
2b55ac71-5ecc-49c9-80ea-4096f50f15a3 | 6 | public static void main(String[] args) throws IOException {
CommandLine cmd = CliUtil.parse("Builder : ", getOptions(), args);
if(cmd == null)
return;
InputStream inputStream = null;
if(cmd.hasOption("fileName"))
{
inputStream = new FileInputStream(new File(cmd.getOptionValue("fileName")));
}... |
e21b8497-3d9b-4c65-ad6f-dcdd5dd5ef68 | 0 | public String getName() {
return name;
} |
69309c0d-7f60-4ae2-aea8-494c69746988 | 0 | int getParentId()
{
return parentId;
} |
44a7803b-78a6-4132-8e91-04da35e68a1e | 7 | private boolean isSpecialContinuation() {
boolean result = false;
final CobolToken lastToken = allTokens.getFromLast(0);
final CobolToken prevToken = allTokens.getFromLast(1);
if (lastToken != null && prevToken != null) {
if (lastToken.getType() == CobolType.CONTINUATION && ... |
59e51825-f72e-4454-828c-244453e5d3d1 | 1 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
AccountManager am = (AccountManager)getServletContext().getAttribute("account manager");
String username = request.getParameter("username");
String password = request.getParameter("password");
... |
933a1b0e-2783-4219-bcd7-54e9ceb473d4 | 1 | static public String iso639_2_to_iso639_1(String threeCharCode) throws UnsupportedEncodingException {
String lowercase=threeCharCode.toLowerCase(Locale.ENGLISH);
String iso639_1=iso639_2to1.get(lowercase);
if (iso639_1==null)
throw new UnsupportedEncodingException("Can't use ISO 6... |
3757fae7-9c17-42a9-9109-ceb43887c67f | 2 | private void drawRight(Graphics g) {
Direction left = backDir.getRightDirection();
Rectangle leftDoorBound = leftDoor.getBounds();
if(tile.hasExit(left))
{
g.setColor(DOOR_COLOR);
g.fillPolygon(leftDoor);
g.setColor(DOORNOB_COLOR);
g.fillOval((int)leftDoorBound.getMinX() + DOORNOB_SIZE/2, (int)l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.