method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e78571d8-aeff-41aa-927d-63ea902e724c | 3 | public static void main(String[] args) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
5f9ba0a7-099e-4980-b400-9354cc955103 | 5 | public void saveProgress(boolean overwrite) {
//
// In the case of an overwrite, just save under the current file-
if (overwrite) {
PlayLoop.saveGame(fullSavePath(savesPrefix, CURRENT_SAVE)) ;
return ;
}
//
// If necessary, delete the least recent save.
if (timeStamps.size() >=... |
9374d86f-40b3-42f4-8800-24ac5c8d0e47 | 8 | public void fetchReplicaUsers()
{
LOGGER.info("Fetching Replicas for : " + orgMap.size() + " Orgs");
if(orgMap!=null && orgMap.size()>0)
{
XLSHandler orgXLS = new XLSHandler();
ArrayList<HashMap<String, String>> replicaData = orgXLS.getExcelRows("C:\\temp\\Replicas.xlsx");
//load users in Org from S... |
ef152111-ce29-4764-9bcc-8955fcda5047 | 8 | private static void Factor()
{
if( sym == ident )
{
Designator();
if( sym == assign )
{
Scan();
ActPars();
}
else if( sym == lpar )
{
ActPars();
}
}
els... |
ba8be2c6-7c0b-4831-bd30-c06eba1a212f | 7 | protected void init() {
GridBagLayout layout = new GridBagLayout();
this.setLayout(layout);
nameLabel = new JLabel("Name");
phoneLabel = new JLabel("Phone");
nameField = new JTextField(20);
phoneField = new JTextField(20);
addButton = new JButton("Add");
... |
3985f6c6-72a0-42e5-a534-abadd5f4940b | 7 | public static String strip_vt100(String line)
{
int i;
StringBuffer nline = new StringBuffer();
for(i = 0; i < line.length(); i++) {
while(i < line.length() && line.charAt(i) == vt_esc.charAt(0)) { // Got escape sequence
// OK. All VT100 cmds seems to end either with m or H
while(i < line.length() ... |
ef69f71d-29da-49c9-8d21-5dd4d7a5501d | 5 | @Override
protected boolean doSecondPhase(String query, Configuration conf, String outputPath, String[] dimensionTables,
String[] filter_table, int numberOfReducer) {
try {
List<String> AllDimensionTalbes = new ArrayList<String>();
AllDimensionTalbes.add(TABLE_CUSTOMER);
AllDimensionTalbes.add(TABLE_DATE... |
75b27065-1522-44c8-8014-4f73ee07d13a | 9 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
super.executeMsg(host,msg);
if((msg.source()==affected)
&&(msg.targetMinor()==CMMsg.TYP_EAT)
&&(msg.target() instanceof Food)
&&(msg.target() instanceof Item))
{
if(((((Item)msg.target()).material()&RawMaterial.MATERIAL_MASK)==RawMateria... |
c2b8d9ef-9f6a-45ca-9487-fcecee147d7c | 6 | @Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex == DELIVERY_PACKET_ID) {
return Integer.class;
} else if (columnIndex == MEMBER_NAME) {
return String.class;
} else if (columnIndex == EVENT) {
return String.class;
} else ... |
f99d4ca6-3b95-4ffd-9a37-9234eeb07e15 | 3 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
switch (oContexto.getSearchingFor()) {
case "usuario": {
oContexto.setVista("jsp/usuario/list.jsp... |
125528cb-27f8-4ca1-b2fe-fe4007e3b105 | 9 | private static boolean backtrack(int[][] maze, Cell end, int y, int x, Deque<Cell> path) {
// GQ!
//if (end.equals(path.peek())) {
if (end.equals(path.peekLast())) {
return true;
}
final int R = maze.length;
final int C = maze[0].length;
for (int i = 0... |
72923acc-4e66-48c7-9179-141e85626743 | 8 | public boolean canFallthrough() {
return opcode != opc_goto && opcode != opc_goto_w && opcode != opc_ret &&
!(opcode >= opc_ireturn && opcode <= opc_return) && opcode != opc_athrow
&& opcode != opc_jsr && opcode != opc_tableswitch && opcode != opc_lookupswitch;
} |
ddabab30-556a-4cac-91b2-2058c98560b6 | 1 | public static Filter not( Filter delegate )
{
if ( delegate == null )
{
throw new IllegalArgumentException( "Parameter 'delegate' must be not null" );
}
return new Not( delegate );
} |
3fb22f8d-ddda-48c5-b44e-65aaa95c44c3 | 0 | protected void onEntryRemove(Object key, ICacheable data){
} |
601a296b-dcf3-46cf-94da-e30c3426bc52 | 4 | private void maybeShowPopup(MouseEvent e) {
int x = e.getX() / imagemapPanel.zoomFactor;
int y = e.getY() / imagemapPanel.zoomFactor;
if (e.isPopupTrigger()
&& (shapeList.isPointInsideShape(x, y) || shapeList
.isShapePointAt(x, y))) {
menuItem_rempoint.setEnabled(shapeList.getFoundKeyPoint() > ... |
08794922-13bc-40bf-9c48-ee100008b5ce | 9 | private Grammar readGrammar(File file) {
Grammar g = new UnboundGrammar();
int lineNum = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = null;
while ((line = reader.readLine()) != null) {
line = line.trim();
lineNum++;
if (line.length() == 0)
cont... |
21d9e8cf-5d94-4330-92ee-5a377cdddc91 | 3 | @Override
public String print() {
String numberToReturn = "" + number;
if (((number % number) == 0 ) || number == 0)
numberToReturn = "" + (int) number;
if (number < 0)
return "( " + numberToReturn + " )";
return numberToReturn;
} |
8c4dfe42-e32c-4d24-aa52-33bef428e9ef | 7 | private void joinChan(String user_name, CommandArgsIterator args_it)
throws IOException
{
if (args_it.hasNext()) {
String chan_arg = args_it.next();
if (!args_it.hasNext() && chan_arg.length() >= 2
&& chan_arg.charAt(0) == '#') {
Strin... |
8db645fa-5ec1-4203-8aec-a8b1aae75293 | 8 | public int maxArea(int[] height) {
if (height.length == 0) {
return 0;
}
int result = 0;
int left = 0;
int right = height.length - 1;
while (left < right) {
int lh = height[left];
int rh = height[right];
int temp = (right - left) * Math.min(lh, rh);
if (temp > result) {
result = temp;
... |
52726b63-1ebe-42b6-a6af-bb8a5b2324f7 | 2 | public static void main(String[] args) throws IOException, InterruptedException {
int portNumber = 7777;//Integer.parseInt(args[0]);
ServerSocket serverSocket= new ServerSocket(portNumber);
try {
while (true){
//System.out.println(available.getQueueLength());
So... |
f0862a68-19ba-4181-9858-10040235987e | 7 | public boolean merge() throws FileNotFoundException, IOException {
//Select your favourate Jersey No to assign it to the final Index. :)
//Ok we need similarity and we reuse indexreaders for merging so using the same constructor.
int fileNumber = 2;
//Modify here to expand for a distributed index structur... |
22356c5f-603e-4b5d-8e6a-ac1f2ab046ff | 5 | public static SolveMethod getSolveMethod(Scanner scan) {
while (true) {
System.out.print("Choose Right, Left, Middle, or Trapazoid: ");
switch (scan.nextLine().toLowerCase().charAt(0)) {
case 'r':
return SolveMethod.RIGHT;
case 'l':
... |
711fdbb1-1454-42a4-85ef-06f27074517d | 0 | public static void main(String[] args) {
SummaryRanges summaryRanges=new SummaryRanges();
summaryRanges.addNum(6);
summaryRanges.addNum(6);
summaryRanges.addNum(0);
summaryRanges.addNum(4);
summaryRanges.addNum(8);
summaryRanges.addNum(7);
summaryRanges.ad... |
03537cf3-4492-4009-829c-2e729e49607a | 1 | public List<List<Integer>> levelOrder(TreeNode root){
List<List<Integer>> result = new ArrayList<List<Integer>>();
List<TreeNode> levelNode = new ArrayList<TreeNode>();
if(root == null)
return result;
else
levelNode.add(root);
order(result,levelNode);
... |
401b9626-a5de-4f5a-bc69-c2d86ac6ffa9 | 5 | private Response dequeueMessage(ByteBuffer buffer) {
int receiverId = buffer.getInt();
int senderId = buffer.getInt();
int queueId = buffer.getInt();
int peekFlag = buffer.getInt();
boolean peek = false;
if (peekFlag == 1) {
peek = true;
}
Mess... |
c5242f9f-8f5b-4e00-ad31-a4753a110235 | 7 | public MainGUI(Player p){
this.p = p;
nextSongButton = new GenericButton("Music On"); //The first button.
nextSongButton.setAnchor(WidgetAnchor.CENTER_CENTER); //We are "sticking" it from the center_center, from there we will be shifting.
nextSongButton.setWidth(90).setHeight(20); //Setting the width and height... |
fbd53d79-8d0b-4396-a2aa-15ebb1f0694f | 3 | public boolean addAll(Collection<? extends T> arg0) {
boolean result = false;
for (T object : arg0) {
if (add(object)) {
result = true;
}
}
return result;
} |
f73ca2df-ffff-4fcf-8d26-5d50d8965e61 | 1 | public void addUserToDB() {
try {
String statement = new String("INSERT INTO " + DBTable
+ " (username, password, url, permission, isblocked, isdead, practicenumber, highscorenumber)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new Str... |
d996f6b6-8424-41dd-9c73-3d684a3fe666 | 0 | public void removePerson(Person P){
Persons.remove(P);
setCantPerson(CantPerson-1);
} |
6ac96f3f-6267-4749-8046-3023bdc67542 | 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;
... |
666aabc6-b7fb-47bb-a3f6-3831efe84ee1 | 0 | public short getId() {
return id;
} |
064996e4-8a7d-4fd6-9cd5-251f99f11f5f | 1 | public void run() {
int[] route = new int[salesman.n];
minRoute = new int[salesman.n];
minCosts = -1;
count = 0;
route[0] = 0;//first city always zero
for(int i = 1;i < salesman.n;i++){
route[1] = i;
checkRoute(route,2);
}
System.out.println("Brute force results count: "+count+", mi... |
b10e2126-3cee-45dd-94f5-61caac326e5e | 5 | public static int eggOnFloor (int f, int e, int[][] s, int[][] c ) {
if ( s[f][e] != -9999999) {
return s[f][e];
}
if ( f == 0 ) {
return 0;
}
if ( e <= 0) {
return 9999999;
}
int min = 99999999;
for (int i = 1; i <= f; ++i) {
int tmp = Math.max(eggOnFloor(i-1, e-1, s, c),
... |
5a71eb4f-0378-4987-a03c-46323c5b66ec | 6 | private void init() {
isRunning = true;
gcCallbackProcessor = new Thread(new Runnable() {
@Override
public void run() {
while (isRunning) {
try {
listen();
} catch (Throwable e) {
e.printStackTrace();
}
}
}
private void listen() throws InterruptedException {
fi... |
33769d56-2260-4d4f-9c5e-dfaac53a46d7 | 1 | public String getLatestMessage() {
if(history.size()>0) {
return history.get(history.size()-1).getMessageText();
} else {
return null;
}
} |
8a11c6e6-8d39-4f4c-bad7-1dcacac110ab | 5 | private void processCatalogueAddReplicaResult(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] pack = (Object[]) ev.get_data();
if (pack == null) {
return;
}
String filename = (String) pack[0]; // get file name
int msg = (... |
ac49a6bd-155a-400b-9607-0f2d77d6ef9a | 6 | public void stop() {
if(playList != null) {
stopping = true;
GameSong gs = null;
if(currentSongIndex < playList.size()) {
gs = playList.get(currentSongIndex);
currentSongIndex++;
}
if(currentSongIndex > playList.size()) ... |
80b5a00e-225d-4de4-bce6-02afd2f6d580 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.createorder");
try {
Criteria criteria = new Criteria();
Order order = (Order) request.getSessionAttribute(JSP_CURRENT_ORDER... |
026e7f13-15b2-488d-be9f-b78d5f0efe27 | 7 | private int calculateSpeed(Street currentStreet) throws InterruptedException {
int speedLimit = 0;
// Limit by street type
if(!SimulationOption.IGNORE_SPEEDLIMIT.equals(vehicle.getSimulationOption())) {
speedLimit = Math.min(currentStreet.getStreetType().getSpeedLimit(), vehicle.getMaxSpeed());
}el... |
47b428b3-5c7f-4304-a00f-064ffd463e52 | 6 | private int numberOfEnemiesToFight(int number){
int res = 0;
for (int i = 0; i < beings.size(); i++){
if (((beings.get(i).isZombie() && beings.get(number).isHuman()) || (beings.get(i).isHuman() && beings.get(number).isZombie())) && getDistance(i, number) < RADIUS_FIGHT){
res+... |
c51d247c-50cb-4f64-997f-427bbc0ca13c | 3 | public Object getValueAt(int row, int col) {
if (data == null) {
return null;
}
if (row == -1 || col == -1) {
return null;
}
return data[row][col];
} |
91a7983f-2770-405c-bd43-e2d210eb486f | 6 | private static void RelationalOperators() {
System.out.println("Start of RelationalOperators");
int a = 1;
int b = 2;
// Check Equality
if (a == b) {
System.out.println("a is equal to b");
} else {
System.out.println("a is not equal to b");
}
// Check Inequality
if (a != b) {
System.out.p... |
19370edf-6303-43de-b3ad-83d04ac66413 | 6 | protected TorrentMetaInfo (
TorrentInfoSection info, String announce, List<Set<String>> announceList, DateTime creationDate,
String comment, String createdBy)
{
if (announce == null | info == null)
throw new NullPointerException();
this.announce = announce;
this.... |
79fafe61-dce7-4805-81ea-3c24b924c58c | 8 | final void method3287() {
if (secondInt == -1) {
secondInt = 0;
if (aByteArray3899 != null && aByteArray3899.length == 1
&& aByteArray3899[0] == 10)
secondInt = 1;
for (int i_13_ = 0; i_13_ < 5; i_13_++) {
if (options[i_13_] != null) {
secondInt = 1;
break;
}
}
}
if (anInt38... |
a7029a47-666f-4d85-ab71-f87c32fdd2f1 | 7 | private void renderPatch(MeshPatch patch, Rendering rendering, float time) {
if (patch == null) return ;
final float alphaVal =
patch.inceptTime == TIME_DONE ? 1 :
((time - patch.inceptTime) / 2f) ;
if (alphaVal >= 1 && patch.previous != null) {
patch.previous = null ;
patch.inceptTi... |
c03ca7f1-5aae-4f02-ac27-4a15e920f449 | 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... |
8d8e553d-f8de-489d-9fc4-d34ffea4509e | 8 | public void testBug4706479() throws Exception {
Random rnd = new Random( 1234 );
TCustomHashMap<byte[], Integer> map =
new TCustomHashMap<byte[], Integer>( new ByteArrayStrategy() );
List<byte[]> list = new ArrayList<byte[]>();
List<Integer> expected = new ArrayList<Integer>();
for ( int i = 0; i < 1000; ... |
33c25cca-250d-4c54-85aa-819f0dd5bc74 | 4 | public int createGroup( String name, String members ){
int id = dao_id.getID( IDListDao.PARA_GROUP_ID );
if( !handler_group.initialize() ){
System.out.println( "GroupServer : failed to initialize group hander!" );
return 0;
}
if( id == -1 || !handler_group.insertNewGroup( id, name ) ){
handler_group.c... |
4d734209-eb1c-475e-8bdb-29825c0a0e61 | 9 | private int tabulateTrees(TreeReader reader,
Map<String, TreeItem> clades) throws IOException {
int countedTrees = 0;
int examinedTrees =0;
SunFishFrame.getSunFishFrame().setInfoLabelText("Parsing trees file");
progressMonitor.setNote("Counting clades");
progressMonitor.setProgress(0);
DrawableTree ... |
992beb6c-6639-4819-b976-1d75e3aa80de | 8 | public ArrayList<ArrayList<Course>> getPrereqs(String crn, String term, String year, String subj, String crse) throws Exception {
ArrayList<ArrayList<Course>> prereqs = new ArrayList<ArrayList<Course>>();
// Make url
String courseUrl = COURSE_URL + "?CRN=" + crn + "&TERM=" + term + "&YEAR=" + year +
"&SUBJ="... |
355c0e74-2d71-4910-b398-de07d5ef5ddc | 4 | @Override
public void run() {
/**
* Monitor para que se ejecute la funcion cada tick de reloj.
*/
synchronized (this) {
while (simulacion) {
try {
wait();
} catch (InterruptedException ex) {
System.... |
f174499f-b2ac-47b0-a706-094bc8c2b1bc | 9 | private void addItem(String title, String name, ComponentType type, boolean isSimple, JMenuItem classCheckItem) {
if (isSimple && simpleMode) {
simpleMenu.add(classCheckItem);
return;
}
switch (type) {
case ACTIVE:
activeMenu.add(classCheckItem... |
8cc58aed-656a-48a1-87a9-b048798f3bd4 | 5 | public static String payXP(Player p, int tier, double basepay, String job) {
double iTimes = tier;
double totalPay = PlayerCache.getEarnedIncome(p.getName());
String pLang = PlayerCache.getLang(p.getName());
String jobName = UpperCaseFirst.toUpperFirst(McJobs.getPlugin().getLanguage().ge... |
70892cd1-b7dd-4c5f-9665-1f397c12ba7b | 9 | public void levelCheck()
{
boolean found1 = false;
int i = 0;
while(!found1 && i < arraySecondOrdering.length)
{
if (arraySecondOrdering[i].getQualification().charAt(3) > '1')
{
allocatedReferee1 = arraySecondOrdering[i];
found1 = true;
}
i++;
}
boolean found2 = false;
int j = 0;
... |
02343890-446f-4b05-ba46-70bd0b40344f | 5 | private void calculate(int[] aux,int[] prices,int i){
int max=0;
for( int j=i+1;j<aux.length;++j){
int temp=0;
if(prices[j]>prices[i]) temp+=prices[j]-prices[i];
if(j+2<aux.length){
temp+=aux[j+2];
}
if(temp>max) max=temp;
... |
dee4abe8-50e2-465c-8d06-66eb15a92c44 | 2 | public static void printData(List<?> objects){
for(Object object: objects){
System.out.println(object);
}
} |
3772dd3c-793e-4a11-957b-ca566ce6f255 | 0 | public String getDirection(int tape) {
return (String) direction.get(tape);
} |
6051adb0-c46f-4862-b2f9-25efdafaafa5 | 4 | public void writeRefereesOutFile()
{
// create file writer object
FileWriter refereesOutWriter = null;
try
{
try
{
// instantiate file writer object
refereesOutWriter = new FileWriter(refereesOutFile);
// array length for use as iterator limit
int arrayLength = refereeProgram.getreferee... |
018bcb92-7624-47c1-9938-429012259004 | 2 | private void expand(int[] array, int lay) {
int k = 0;
for (int i = 0; i < HEIGHT; i++) {
for (int j = 0; j < HEIGHT; j++) {
yCbCr[i][j][lay] = array[k++];
}
}
} |
61bff27a-82e1-4789-b588-c0871cfaf176 | 1 | public static <E> List<E> set2list(Set<E> set) {
ArrayList<E> list = new ArrayList<E>();
for (E e : set) {
list.add(e);
}
return list;
} |
e86a79e3-80aa-42e3-b79b-0bbbc2382590 | 6 | @Override
public void init() {
log.info("BasicSIRModel - init");
/////////////////////////////////////////////////////////////////
// INITIALISE TRANSITION KERNEL
/////////////////////////////////////////////////////////////////
// an empty kernel f... |
a93431d1-e3a6-4f27-aead-26d2f8f37635 | 4 | public static void getOOXML( WorkBookHandle bk, String path ) throws IOException
{
try
{
if( !OOXMLAdapter.hasMacros( bk ) )
{
path = StringTool.replaceExtension( path, ".xlsx" );
}
else // it's a macro-enabled workbook
{
path = StringTool.replaceExtension( path, ".xlsm" );
}
java.... |
bc2e9f13-3c3d-4e03-8cef-081eeb6facf0 | 1 | private String derivationString() {
StringBuffer sb = new StringBuffer();
for (int i = 1; i < STACK.size(); i += 2)
sb.append(STACK.get(i));
sb.append(STRING.substring(P, STRING.length() - 1));
return sb.toString();
} |
08a2af9b-f0d1-4091-8aad-28f09d1f7d2b | 5 | public boolean doMostFavorableMove(Integer[] nextMove) {
Integer[] noMove = nextMove.clone();
Object[] bestCount = getBestLineCount();
String type = bestCount[0].toString();
int i = Integer.parseInt(bestCount[1].toString());
if(type.equals("row")) {
... |
85f942d2-d34a-4c2c-8bdb-9f308fd15b4c | 6 | public void onKeyEvent(KeyEvent e) {
if (player == null) return;
switch (e.getKeyCode()) {
// 上
case KeyEvent.VK_UP:
player.moveUp();
break;
case KeyEvent.VK_DOWN:
player.moveDown();
break;
case KeyEvent.VK_LEFT:
player.moveLeft();
break;
case KeyEvent.VK_RIGHT:
player.moveRight(... |
bf44509c-9132-41fc-8b7a-594972062b87 | 4 | public void deleteMethod(final int nameIndex, final int typeIndex) {
final List newMethods = new ArrayList();
boolean foundIt = false;
for (int i = 0; i < this.methods.length; i++) {
final Method method = this.methods[i];
if ((method.nameIndex() == nameIndex)
&& (method.typeIndex() == typeIndex)) {
... |
f77f2f08-68f7-4ed0-8ade-8636b601b504 | 0 | public Atvalinajums() {
} |
105ff255-6f9a-4a0f-a6c8-e4db308de559 | 4 | private void annuleer() {
try {
quizWijzigenView.confirmationWindow(
"Ben je zeker dat je de wijzigingen wilt annuleren?",
"Annuleer wijzigingen");
if (quizWijzigenView.isTrueIndicator()) {
for (Quiz q : quizCatalogus.getQuizzen()) {
if (q.getId() == copyQuizOld.getId()) {
q = copyQuiz... |
f395e69a-c373-459c-8145-5b7deff97126 | 2 | private String cleanInput(String input) {
if (input == null) {
return null;
}
input = input.trim();
if (input.length() == 0) {
return null;
}
return input.toUpperCase();
} |
b0c86083-6dcb-4caa-afa2-7eb6a2f927f6 | 1 | static Subject populate() {
ArrayList<Subject> data = new ArrayList<>();
Subject sun = new Subject(1392e+6);
sun.meta.color = new Color(0xFEE640);
sun.meta.name = "Sun";
sun.meta.type = SubjectType.STAR;
sun.meta.scale = 0.5f;
Subject mercury = new Subject(2439... |
84badf5d-5106-4544-88c8-04c33f551431 | 4 | public int antiFire() {
int toReturn = 0;
if (c.antiFirePot)
toReturn++;
if (c.playerEquipment[c.playerShield] == 1540 || c.prayerActive[12] || c.playerEquipment[c.playerShield] == 11284)
toReturn++;
return toReturn;
} |
bbae24fe-54d2-4400-8636-fdda40084bb4 | 7 | public void saveResult(GameResult result) {
cacheGameResultsMaps(result);
FileOutputStream fo = null;
BufferedWriter bw = null;
try {
fo = new FileOutputStream(new File(this.resultsDataFilePath));
bw = new BufferedWriter(new OutputStreamWriter(fo));
fo... |
73e919d8-aa3c-4d3b-9162-4f8c7fe2d464 | 2 | @Override
public void setPrerequisites(String prerequisites) {
if(prerequisites == null || prerequisites.length() == 0) {
JOptionPane.showMessageDialog(null,
"Error: prerequisites cannot be null of empty string");
System.exit(0);
}
this.prerequisit... |
965a764b-dec4-4291-93ac-d61872dc2b49 | 7 | @Override
public Object getValueAt(int i, int i1) {
Tenant t=tenants.get(i); //To change body of generated methods, choose Tools | Templates.
switch(i1){
case 0:
return t.getId();
case 1:
return t.getName();
... |
d43072ad-1ef5-429e-b762-bc36e60cac42 | 6 | @Test
public final void testIntersectCorners() {
SpaceRegion sr1 = new SpaceRegion("sr1");
SpaceRegion sr2 = new SpaceRegion( sr1, "sr1");
Assert.assertTrue( sr1.intersects( sr1 ) );
Assert.assertTrue( sr1.intersects( sr2 ) );
for ( float x = -1.0f; x <= 1.0f; x += 0.1f ) {
sr2.localPosition.... |
cfdd8a29-8a34-4962-a89d-24e098006f60 | 6 | private boolean check(EdgeWeightedDigraph G) {
// edge-weighted digraph is cyclic
if (hasCycle()) {
// verify cycle
DirectedEdge first = null, last = null;
for (DirectedEdge e : cycle()) {
if (first == null) first = e;
if (last != null... |
e13dcf85-1bfa-49ba-97bd-a01bae4dd2f2 | 9 | @Override
//Controls the MainCharacterFigure's movement based on user input from the arrow keys
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
System.exit(0);
} else if (e.getKeyCode... |
6353486a-974a-4a52-a2a1-a7e18ef9870e | 1 | protected XPathFactory newFactory()
throws XPathFactoryConfigurationException
{
// First try to force the default JRE impl
try
{
return XPathFactory.newInstance(
XPathFactory.DEFAULT_OBJECT_MODEL_URI,
"com.sun.org.apache.xpath.internal.jaxp... |
a34d0dc7-bd13-4297-afbd-3bb76ba617d3 | 9 | public String readLine() throws IOException
{
String s = super.readLine();
if (s.indexOf('\\') >= 0)
{
StringBuffer buffer = new StringBuffer(s.length());
for (int i = 0; i < s.length();)
{
char c = s.charAt(i++);
if (c == '... |
54cd420c-420e-4198-b552-79c78d0adc1c | 6 | public int mergeAdjacentFace (HalfEdge hedgeAdj,
Face[] discarded)
{
Face oppFace = hedgeAdj.oppositeFace();
int numDiscarded = 0;
discarded[numDiscarded++] = oppFace;
oppFace.mark = DELETED;
HalfEdge hedgeOpp = hedgeAdj.getOpposite();
HalfEdge hedgeAdjPrev = hedgeAdj.prev;
Ha... |
d183603b-6d94-40c9-bc5c-9e111916711f | 3 | @Override
public void start()
{
worker = new Thread()
{
@Override
public void run()
{
while (!this.isInterrupted())
{
int currentFrame = Integer.parseInt(pModel.getProperty(PRP_CURRENT_PLAYBACK_FRAME));
... |
fe2169f5-bb0e-456c-919b-2112a77431dc | 1 | public boolean contains(Coordinate p) {
double res = 0;
for(int i=1; i<this.corners.length; i++)
res += this.corners[i-1].sub(p).angle(this.corners[i].sub(p));
return Math.abs(res) > 6;
} |
a0c853b9-14f3-4285-b769-7cf93674f47f | 0 | public void mouseClicked(MouseEvent e) {
} |
e8793960-bdc5-4db8-8245-30bd4508f12c | 1 | public static void main(String[] args) {
logger.info("Trains application started");
TrainGenerator tGenerator = null;
try {
tGenerator = new TrainGenerator( 20 );
PassengerTrain pTrain = tGenerator.buildPassengerTrain();
double commonBaggageWeight = TrainOperations.commonBaggageWeight( pTrain );... |
c7cb3e53-0c15-49c3-a439-ec9a0638d7bb | 0 | public void setStartStop(int value) {
this._startStop = value;
} |
2b9bb4e9-74b0-420b-a859-831dca90e50a | 2 | public static void main(String[] args) throws Exception {
if (args.length > 0 && args[0].equals("-r")) {
remove = true;
String[] nargs = new String[args.length - 1];
System.arraycopy(args, 1, nargs, 0, nargs.length);
args = nargs;
}
new ProcessFiles(new AtUnitRemover(), "class").start(args);
} |
970fb304-aa0f-428d-9d1a-302b47077d9f | 4 | public Ventana() {
initComponents();
leerProperties();
//PERSONAS
//creo el modelo, sobreescribiendo el método isCellEditable para que
//sólo pueda modificarse el campo persona.
DefaultTableModel modeloPersona = new DefaultTableModel() {
@Override
... |
44e2dc8f-90d9-455e-a401-4cea64439cd1 | 6 | @Override
public void mouseClicked(final MouseEvent e) {
this.e = e;
player.setActivityTimer(1000);
//if(player.getActivityTimer()==0){
new Thread(new Runnable(){
@Override
public void run() {
FlirtOverlay overlay = (FlirtOverlay)((JLabel) e.getSource()).getParent();
overlay.progress... |
e8c3e009-1bfe-4bac-96b7-73c37868a76b | 3 | public void start(MouseEvent e, mxCellState state)
{
startState = state;
movingCells = getCells(state);
previewStates = (!placeholderPreview) ? getPreviewStates() : null;
if (previewStates == null || previewStates.length >= threshold)
{
placeholder = getPlaceholderBounds(startState).getRectangle();
in... |
8dc5e8a9-928b-4151-9fc4-236852bb465a | 1 | public void upByThrees(int n) {
/*int tracker = 1;
for (int i = 0; i < n; i++) {
System.out.println(tracker);
tracker +=3;
}*/
int tracker = 1;
int i = 0;
while(i < n){
System.out.println(tracker);
tracker=tracker+3;
i++;
}
} |
31c5cf25-cc9e-48ee-89ff-c16e139af172 | 1 | public void run(){
while (!stop) {
String randData = Rndm.randString(Rndm.intRandInt(32, 1024));
int port = Rndm.intRandInt(1, 65535);
send(randData, port);
}
} |
f25a5ec2-eeff-4c3e-8a79-4e1fbed0ac2c | 6 | public ProvaDequantizzazione(String fileName) throws Exception {
encoder = new LayerIIIEnc(N_FRAME);
is = getClass().getResourceAsStream(fileName);
bitstream = new BitStream(is);
real_stream = getClass().getResourceAsStream(fileName);
//byte [] b = new byte [100000];
... |
d174bed4-c909-4576-a37b-0054eb731ab1 | 8 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g); //To change body of generated methods, choose Tools | Templates.
g.drawImage(image, 0, 0, image.getWidth(this), image.getHeight(this), this);
g.setColor(Color.red);
if(points != null && !points.is... |
7db7d6e8-03a0-4d8e-accd-e055d8c1fd7c | 0 | @Test
public void testGetCondVal() {
System.out.println("getCondVal");
Sense instance = new Sense(Sense.senseDir.HERE, 3, 6, Sense.condition.FOE);
Sense.condition expResult = Sense.condition.FOE;
Sense.condition result = instance.getCondVal();
assertEquals(expResult, result);... |
8add2a6d-8c11-46af-be22-bd63479e2e0a | 2 | private void fatalErrorOccured(String message, Exception ex){
if (ex != null) ex.printStackTrace();
frame.txtrn.setText("Ошибка: " + message);
try {
this.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
} |
0ee53c77-bd60-4937-b64d-6440be915c3c | 5 | public void registerEvents(Plugin plugin, EventListener listener) {
for (Method method : listener.getClass().getMethods()) {
Annotation annotation = method.getAnnotation(EventHandler.class);
if (annotation == null)
continue;
Class[] params = method.getParame... |
fc2fde0d-40a6-47f1-8cc9-ddaea07ecbfa | 6 | public void run(){
while(true){
try {
if(Go==true){
if (vehicleList.size()>0){
printStreet(this);
Vehicle toMove = vehicleList.getFirst();
Street target = toMove.getTargetStreet();
if (target == null) {
vehicleList.removeFirst();
toMove.stopVehicleThread();
}
... |
57f41839-f09e-4408-af79-87c38bc8fab8 | 2 | protected AudioDeviceFactory[] getFactoriesPriority()
{
AudioDeviceFactory[] fa = null;
synchronized (factories)
{
int size = factories.size();
if (size!=0)
{
fa = new AudioDeviceFactory[size];
int idx = 0;
Enumeration e = factories.elements();
while (e.hasMoreElements())
{
Audi... |
e55723b6-2d11-45ce-9933-dce4e011b61b | 2 | private void render(Graphics2D graphics2D) {
for (Cell[] cells1 : cells) {
for (Cell cell : cells1) {
cell.render(graphics2D);
}
}
} |
e431e8ff-ad99-4f1c-ac61-2f6bb716c663 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Genre other = (Genre) obj;
if (myName == null) {
if (other.myName != null... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.