method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
69e29d1a-f5b9-40cc-875e-914e0e857da6 | 8 | @Override
public void genOperationFunction(StringBuffer buff, Operation o) {
StringBuilder funcbuff = new StringBuilder();
funcbuff.append(String.format("json.%s<-function(", o.name));
if (o.parameters != null) {
Request r = o.parameters.request;
if (r.parameter != n... |
90f31995-4407-4f0d-bcc4-edb51c3d33c6 | 4 | void handleMouseUp (Event event) {
if (link != null) {
int offset = styledText.getCaretOffset();
StyleRange range = offset > 0 ? styledText.getStyleRangeAtOffset(offset-1) : null;
if (range != null) {
if (link == range.data) {
Shell dialog = new Shell(shell);
dialog.setLayout(new FillLayout());... |
1823cf0f-c4c0-4ae3-87d3-eb1e50ba7942 | 4 | protected RequestDispatcher userIsLogout(HttpServletRequest request) {
RequestDispatcher rd = null;
String page = (String) request.getAttribute("page");
if (page == null || page.contentEquals("/")) {
rd = getServletContext().getRequestDispatcher(LOGIN);
} else if (page.contentEquals("inscription")) {
rd =... |
a9ba5419-88f7-4a5f-aa18-dff64ca244b4 | 8 | public void setOptions(String[] options) throws Exception {
String optionString;
resetOptions();
optionString = Utils.getOption('X',options);
if (optionString.length() != 0) {
m_CVFolds = Integer.parseInt(optionString);
}
m_useIBk = Utils.getFlag('I',options);
m_displayRules = Uti... |
46e14abc-fefb-4242-a331-7e1e61aea10b | 4 | public void run() {
while (true) {
try {
String message = messages.take();
Iterator<Socket> iter = sockets.iterator();
while (iter.hasNext()) {
Socket socket = iter.next();
try {
OutputStream out = socket.getOutputStream();
PrintWriter writer = new PrintWriter(out);
writer... |
00353033-65ff-4ed8-9fb6-770c56e38629 | 9 | void updateFramebufferSize() {
// Useful shortcuts.
int fbWidth = rfb.framebufferWidth;
int fbHeight = rfb.framebufferHeight;
// Calculate scaling factor for auto scaling.
if (maxWidth > 0 && maxHeight > 0) {
int f1 = maxWidth * 100 / fbWidth;
int f2 = maxHeight * 100 / fbHeight;
... |
ec13d508-7603-4ecc-afea-fe7348432629 | 6 | public boolean postMortem(PostMortem pm) {
MapKeep that = (MapKeep) pm;
if (this.length != that.length) {
JSONzip.log(this.length + " <> " + that.length);
return false;
}
for (int i = 0; i < this.length; i += 1) {
boolean b;
if (this.list[i... |
48c7161e-b863-4a7c-bd94-fe6c1cd58f7d | 2 | private int[][] copyBoard(Board b) {
int[][] oldBoard = new int[8][8];
for (int rank = 0; rank < b.board.length; rank++) {
for (int file = 0; file < b.board[rank].length; file++) {
oldBoard[rank][file] = b.board[rank][file];
}
}
return oldBoard;
} |
2dd15df9-5384-4a5f-9099-b0ebaf2c6562 | 8 | private int properRoomIndex(int x, int y)
{
if(rooms.size()==0)
return 0;
synchronized(rooms)
{
int start=0;
int end=rooms.size()-1;
int comp=0;
final long total=((long)x<<31)+y;
long comptotal=0;
int mid=0;
while(start<=end)
{
mid=(end+start)/2;
comptotal=((long)rooms.elementA... |
c97b367a-6dc6-44ab-8924-df9cade1d313 | 6 | public boolean validarFormato(String vIngreso){
if (vIngreso.isEmpty()){
return true;
}
for(int i = 0; i < vIngreso.length(); i++){
if(!((vIngreso.charAt(i) > 64 && vIngreso.charAt(i) < 91) || (vIngreso.charAt(i) > 96 && vIngreso.charAt(i) < 123))){
... |
a55f2869-454e-4ccf-82ff-f33f95452fc3 | 0 | private void kill()
{
hp = mp = exp = 0;
dead = moved = done = true;
} |
be50e24e-5a95-400c-99fd-51f32f78c6d1 | 0 | private void announceWinner(Resolver resolve, Dealer dealer){
System.out.println(winner);
System.out.println("The dealer had: "+ dealer.getHandCount()+" consisting of: ");
System.out.println(dealer.stringHand());
System.out.println();
System.out.println("The player had: "+ resolve.returnPlayer().getHandCount()+" c... |
8595b011-0c8d-4447-a5bf-9fbfc6746832 | 2 | public static Connection createConnection(){
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
try {
connection = DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
System.out.println("connect error");
e.printStackTrace();
}
} catch (C... |
3add6591-3b28-49ff-8a15-f08b7346c29d | 0 | @Before
public void setUp() {
} |
e193e6cb-c521-4632-9e3e-0ce6d06ddbe1 | 7 | private static void adjust(Comparable[] a ,int i,int length){
int left = 2*i + 1,
right= 2*i + 2 ;
if(left >= length && right >= length) return ;
int max = i;
if(left < length && less(a[max],a[left]))
max = left;
if(right <length && less(a[max],a[right]))
max = right ;
if(max!=i){
exch(a... |
4651ec51-895a-4106-881e-33840bb271e8 | 4 | private void solveGraph(int x, int y , int num)
{
int idx,sqrX,sqrY;
for(idx=0;idx<9;idx++)
{
(numGraph.get(idx)).matrix[x][y] = false;
}
for(idx=0;idx<9;idx++)
{
(numGraph.get(num)).matrix[x][idx] = false;
(numGraph.get(num)).matrix[idx][y] = false;
}
sqrX = x-(x%3)... |
8122b508-8fb9-45a5-ac41-6c7de116a652 | 5 | @RequestMapping(value="/BusinessUnitMaintenance.do", method=RequestMethod.POST)
public String doActions(@ModelAttribute BusinessUnitMaintenance BusinessUnitMaintenance, BindingResult result, @RequestParam String action, Map<String, Object> map){
BusinessUnitMaintenance BusinessUnitMaintenanceResult = new BusinessUni... |
a52ed903-7c51-440d-91b1-1a0e93eeb3ec | 0 | public String getOrder() {
return order;
} |
956d8fc2-1acc-43a1-8a2b-550a1c1a69d7 | 1 | public <T extends BusinessObject> T searchForBO(String boType, SearchCriteria... criteria) throws DataException {
// this is not the most efficient way to do this, but it is simple and works for our purposes here.
List<T> li = searchForList(boType, criteria);
if (li.size() > 0) {
return (T)l... |
43b07a86-befa-4828-8365-77ead43542d6 | 3 | @SuppressWarnings("deprecation")
private boolean setBlockIfAlreadyAirWithData(World world, int x, int y, int z, int id, int data)
{
int curID = getBlock(world, x, y, z);
if(curID == 0 ||
curID == Material.SNOW.getId() ||
curID == Material.VINE.getId())
{
setBlockWithData(world, x, y, z, id, data);
... |
71b82b74-fcbe-49fa-ab5f-85dd82f497a2 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Fraction fraction = (Fraction) o;
if (getDenominator() != fraction.getDenominator()) return false;
if (getNumerator() != fraction.getNumerator(... |
bbd9f058-7c4d-4e58-9fc9-90f3adc1b024 | 8 | public Cell[][] getSeatVisualisationForMethod(DefaultSeatingMethod method) {
switch (method) {
case BACK_TO_FRONT:
return this.btfBoardingHandler.getSeatVisualisation();
case BLOCK_BOARDING:
return this.bBoardingHandler.getSeatVisualisation();
... |
0b9a1666-d88b-4748-8b83-4984ed324549 | 1 | public static ExchangeContext createRemoteContext(Case CASE) {
PGridHost localHost = null;
PGridHost remoteHost = null;
RoutingTable localRT = null;
RoutingTable remoteRT = null;
try {
localHost = new PGridHost("127.0.0.1", 3000);
localHost.setUUID(hostUU... |
14998ba8-02f9-4d49-b35d-cfa02a74b72b | 9 | @Override
public void run() {
try {
new LoginProtocol(s, in, out, inStream, getOutStream(), playerId);
flushOutStream();
} catch (IOException e) {
e.printStackTrace();
}
buffer = new byte[BUFFER_SIZE];
readPtr = 0;
writePtr = 0;
int position, offset;
while (!disconnected && online) {
sync... |
f5c92edf-1da9-4c7d-9f61-cd245bb21649 | 1 | public void loadImage() {
try {
image = ImageIO.read(new File(filePath));
} catch (IOException e) {
System.err.println("Failed to load image!");
e.printStackTrace();
}
imageLoaded = true;
} |
c69a5e6f-ac91-4b7c-8258-ac9cc4f2b38d | 2 | public byte[] getValueAsBytes() throws IllegalArgumentException {
if (!isOptionAsBytes(code)) {
throw new IllegalArgumentException("DHCP option type ("+ this.code +") is not bytes");
}
if (this.value == null) {
throw new IllegalStateException("value is null");
}
... |
313ee543-09a3-4e7c-a23c-9c8f16b8b349 | 3 | public String toString()
{
if (desc_ == null)
{
StringBuffer sb = new StringBuffer("Packet #");
sb.append(pktNum);
sb.append(", out of, ");
sb.append(totalPkts);
sb.append(", with id, ");
sb.append(pktID_);
sb.append... |
5a1da3dc-d3a8-4748-9387-aefaad59142c | 9 | public ArrayList <Jogo> inserirJogo( ArrayList <Jogo> games ){
Scanner scan = new Scanner(System.in);
int op;
if ( games.isEmpty() ){
System.out.println("\nVocê não tem nenhum jogo!");
}
else{
System.out.println("\nQual dos jogos você quer inserir? [ 1 - "... |
be684d2a-1a54-484b-bc67-f77f8bb6dedb | 6 | @Override
public void approveSelection(){
File f = getSelectedFile();
if(f.exists() && getDialogType() == SAVE_DIALOG){
int result = JOptionPane.showConfirmDialog(this,"The file exists, overwrite?","Existing file",JOptionPane.YES_NO_CANCEL_OPTION);
switch(result){
... |
94a1c4a8-6f7f-48ca-b66f-2bd4400f056e | 7 | public void mouseDragged(MouseEvent e) {
// if (e.getButton()==1) {
// switch (curseur) {
//
// //////////////////////////////////////////////////////////////////////////////
//
// case 1 : { //// en mode Selection
if (curseur == 1) {
if (rctSelection != null) {
getSelect(e);
// repaint();
... |
ae93fbde-a9d1-48c6-b698-dc25411b110e | 3 | public static boolean isBit1(int src,int position){
if(src ==0 || position < 0){
return false;
}
src >>= position;
if((src & 1) == 1){
return true;
}else{
return false;
}
} |
d177d3e4-1fb7-41c7-987c-1030c05a0603 | 9 | private int buildJump(int xo, int maxLength)
{
int js = random.nextInt(4) + 2;
int jl = random.nextInt(2) + 2;
int length = js * 2 + jl;
boolean hasStairs = random.nextInt(3) == 0;
int floor = height - 1 - random.nextInt(4);
for (int x = xo; x < xo + length; x++)
... |
d80ebfb2-2fd5-4833-ab27-1e44fa973c7b | 3 | public void initialisation(int fromScoreParam, int toScoreParam){
synchronized(this){//one thread at time access one posting list
if(postingListMemoryMapped!=null){
if(inUse){
// System.out.println("Waiting for posting list "+entry+ "to become available");
... |
2c424bd5-7839-4f97-8d55-9aca368c66ac | 4 | public void draw(Graphics g)
{
for (int i = 0; i < NUM_ROWS; i++) // Loop through rows
{
for (int j = 0; j < NUM_COLUMNS; j++) // Loop through columns
{
// If index is 9 or 0, do not paint, else paint a square
if(gameBoard[i][j] != BORDER && gameBoard[i][j] != EMPTY)
{
// WARNING: MAGIC NUM... |
276ad61e-d9e8-40aa-83b4-6116e343cda3 | 0 | private String readInput() throws IOException {
return this.keyboard.readLine();
} |
fa184ddb-ea7b-41fb-8f04-6a48af652b0f | 1 | public void next() {
if (i < items.length)
i++;
} |
734e2d8b-e7e7-48bd-9e9e-42a1222079fe | 9 | public List<List<Integer>> getSCCs () {
finishTimesPerVertex = new int [graph.numVertices()];
int [] vertexPerFinishTimes = new int [graph.numVertices()];
leaders = new int [graph.numVertices()];
visited = new boolean [graph.numVertices()];
time = 0;
source = -1;
... |
bf319731-adf9-4f14-a91f-d5da78c32fb3 | 6 | public void implementAns( Card choiceC, int ans ) {
int pos = finder( _playerH, choiceC );
boolean needsLoop = true;
while ( needsLoop ) {
if (ans == 1) {
if (pos > -1) {
_compH.add( _playerH.draw(pos) );
checkPairs( _compH, _compP, "Computer" );
System.out.println("Now the comput... |
b92c9dd5-336e-4651-b92a-14955eda9a2c | 6 | private static final Object[] decodeInteger(byte[] bencoded_bytes, int offset) throws BencodingException
{
StringBuffer int_chars = new StringBuffer();
offset++;
for(; bencoded_bytes[offset] != (byte)'e' && bencoded_bytes.length > (offset); offset++)
{
if((bencoded_bytes[... |
8dfc3613-eba8-46d4-b903-6b3464e14d1c | 1 | public String getTransitionCondition(Element tcElement){
if (tcElement.getName().equals("transitionCondition")){
return tcElement.getText();
}else{
return null;
}
} |
31ba7d06-03b0-4906-8833-a846d0c4fa6d | 0 | private void setContactNumber() {
Phone.getInstance(phoneType).setCountryCode("+91");
Phone.getInstance(phoneType).setCityCode(cityCodeText.getText());
Phone.getInstance(phoneType).setLocalNumber(localNumberText.getText());
Phone.getInstance(phoneType).setExtension(extensionText.getText());
Body.getInstance... |
90f7d690-46f8-4d74-88a8-b1d1ccca14f8 | 2 | private boolean avgHigherThanThreshold(float thres, float[] values){
float sum = 0;
for (float count : values){
sum+=count;
}
if (sum/values.length > thres)
return true;
return false;
} |
09bcd78e-043d-4fa5-8812-00ef7ae19c7d | 0 | protected <E> void saveArray(String fieldName, Collection<E> aValue) throws SQLException {
Data._saveArray(this.tableName + "_" + fieldName, this.getId(), aValue);
} |
37c6cabe-71b5-496f-8ce9-39c1248af0bb | 1 | public void stopRunning(){
try{
isRunning = false; clientSocket1.close(); clientSocket2.close();
} catch (Exception e){ e.printStackTrace(); }
System.out.println("Audio chat server closing on command.");
} |
c397dbdd-67fd-421e-b654-6e0664280a13 | 9 | public void processDecksOld() {
DBCursor cursor = deckCollection.find();
cursor.addOption(Bytes.QUERYOPTION_NOTIMEOUT);
int countProcessed = 0;
while (cursor.hasNext()) {
countProcessed++;
DBObject deckObject = cursor.next();
List<String> cards = (List... |
38b69e7a-976f-4f71-95b2-7bebe9a8990e | 0 | public void setAge(int age) {
Age = age;
} |
9f29d701-e926-4da5-b632-19dd9eff7c30 | 1 | public void start() throws DataBaseServerException {
initDBManager();
try {
httpServer = HttpServer.create(new InetSocketAddress(serverPort), 10);
} catch (IOException exception) {
throw new DataBaseServerException("Unable to start database server");
}
htt... |
bbf9f0b5-e993-4801-b922-19684dcbcfa6 | 5 | private ArrayList<ArrayList<Event>> getCalendarEntries(int weekNumber) {
ArrayList<ArrayList<Event>> calendarEntries = new ArrayList<ArrayList<Event>>();
ArrayList<User> activeCalendars = guicontroller.getActiveCalendars();
for(User otheruser:user.getImportedCalendars()) {
if(activeCalendars.contains(otheruser... |
4e346a17-5a58-4281-8c6c-fcd7f203e699 | 1 | public String getEntityNotationName(String eName)
{
Object entity[] = (Object[]) entityInfo.get(eName);
if (entity == null) {
return null;
} else {
return (String) entity[4];
}
} |
dbb6cecc-a917-46c3-8bde-cf7c3615caf8 | 5 | public void Process()
{
Scanner sc = new Scanner(System.in);
int choice = 0;
while(choice != 2)
{
printMenu();
choice = sc.nextInt();
switch(choice)
{
case 1://DCT-Based Image Compression
System.out.println("DCT-Based Image Compression-------------");
System... |
e92d9a91-e60c-49e5-a150-dcbfc4a7b207 | 6 | public List<String> getIsAssignedEdgeIds(String resource_id, String inode_id)
{
String edge_id = null;
OrientGraph graph = null;
List<String> edge_list = null;
try
{
if((resource_id != null) && (inode_id != null))
{
edge_list = new Arra... |
fefe1bb1-8045-40a1-9ce0-47874bda2bf8 | 3 | private double testBinaryHeapInserts(int[] inserts) {
System.out.print("Testing BinaryHeap with " + inserts.length + " inserts... ");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
binaryHeap = new BinaryHeap();
... |
89e2935e-7490-41aa-81eb-397e60441bb3 | 4 | private boolean readHeader(SeekableStream fis, long fileOffset, boolean isLowToHigh){
LittleEndianInputStream lbdis;
DataInputStream bdis;
byte[] buffer = new byte[RPTREE_HEADER_SIZE];
try {
// Read R+ tree header into a buffer
fis.seek(fileOffset);
fis.readFully(buffer);
... |
7fb4d25e-7c43-4684-b619-72dd34fb2358 | 9 | static boolean matchValue(FacesContext ctx,
UIComponent component,
Object value,
Iterator<SelectItem> items,
Converter converter) {
while (items.hasNext()) {
SelectItem item = ite... |
ebdb08ab-8a35-496d-be41-9c3ddfc7cfad | 8 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
List errorMsgs = new LinkedList();
// Store this set in the request scope, in case we need to
// send the ErrorPage view.
request.setAttribute(... |
5b8f899c-c964-45c3-b699-a98587144b88 | 9 | public RecoveryScannerData removeUnused() {
if(this.insertedTokens != null) {
int newInsertedTokensPtr = -1;
for (int i = 0; i <= this.insertedTokensPtr; i++) {
if(this.insertedTokenUsed[i]) {
newInsertedTokensPtr++;
this.insertedTokens[newInsertedTokensPtr] = this.insertedTokens[i];
this.ins... |
0040b36d-6347-4474-8fac-3456c56bfc7e | 6 | public static int getAuctionType(int auction) {
int type = auction / 4;
switch (type) {
case 0: return TYPE_INFLIGHT;
case 1: return TYPE_OUTFLIGHT;
case 2: return TYPE_CHEAP_HOTEL;
case 3: return TYPE_GOOD_HOTEL;
case 4: return TYPE_ALLIGATOR_WRESTLING;
case 5: return TYPE_AMUSEMENT;
... |
e67cab1b-038c-4617-abc6-11c503b69547 | 2 | public String getUsername() {
int i = prefix.indexOf('!') + 1;
if (i != 0) {
int j = prefix.indexOf('@', i);
return prefix.substring(i, (j != -1) ? j : prefix.length());
}
return null;
} |
60570bc7-2080-469a-b76a-107754f9122d | 2 | public void delete() {
board.removeFromAllTowers(this);
board.removeFromAllTowers(this);
for (Placeable currentPlaceable : this.getPlacablesWithinRangeOfThisTower()) {
for (GameAction action : this.getGameActions()) {
currentPlaceable.removeBuffer(action);
... |
4fe96270-40e5-4302-b1e4-abca0f92a9d3 | 2 | public
void stopJobsForPage(AbstractPage page) {
for (JobFuturePair pair: submittedPairs)
// no new tasks will be submitted because of synchronization.
if (pair.job.page.equals(page))
// we don't remove pair from queue here to not mess up with main JobMaster thread.
pair.future.cancel(true);
} |
03542af3-4c2f-487e-b827-a3d04972665f | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node other = (Node) obj;
if (data != other.data)
return false;
return true;
} |
88c6b0a1-3497-484f-ad74-7fe4a08f9e00 | 3 | public void setNumReal(TNumReal node)
{
if(this._numReal_ != null)
{
this._numReal_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this... |
a764c00d-fa11-4154-83fa-8bcb046bac01 | 9 | public ImmIndReg(ImmIndRegOp operation, long leftOperandImm,
Register leftOperandReg, Register rightOperand) {
switch(rightOperand.width()) {
case Byte:
if(leftOperandImm < Byte.MIN_VALUE || leftOperandImm > Byte.MAX_VALUE) {
throw new IllegalArgumentException("immediate operand does not fit into byt... |
80750f35-bf69-4efd-9845-b39d4a743804 | 1 | private static void shrink() {
if ( getSize() > MAX_COUNT)
removeFirst();
} |
cbdb929c-fbab-42ce-b41f-bb39bbb283e3 | 9 | public double[] noRehearsalSerialLearning(double[][] baseinputs, double[][] baseoutputs,
double[][] serialinputs, double[][] serialoutputs, double maxerror) {
double[] outputs = new double[serialinputs.length + 1];
double error = maxerror + 1;
int counter = 0;
// train base population
while (maxerror ... |
d2cd7e20-df2c-4095-9e40-62436ce4d14a | 8 | private String downloadWebContent(String url) throws ParseException, IOException {
CloseableHttpResponse response = null;
try {
response = requestWebContent(url);
int i=0;
while(i<3 && response!=null){
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
... |
8c9df8eb-6da1-4f48-af5e-487460b2da92 | 4 | public static void main(String[] args) {
ListeFleches lf1=new ListeFleches();
ListeFleches lf2=new ListeFleches();
Fleche f1=new Fleche(0);
Fleche f2=new Fleche(1);
Fleche f3=new Fleche(2);
Fleche f4=new Fleche(3);
Fleche f5=new Fleche(4);
Fleche f6=new Fleche(5);
Fleche f7=new Fleche(6);
... |
6cbcd079-4ff9-4299-b52e-7af9f6565b77 | 9 | @Override
public void write(NgramLM lm, OutputStream os) throws IOException {
out = new PrintStream(os);
sb = new StringBuffer();
br = System.getProperty("line.separator");
this.lm = lm;
// identity variables
printOne("name", lm.getName(), null);
printOne("symbol", lm.getSymbol(), null);
printOne("pa... |
03cfc45b-ea8e-468e-a8fa-1e4bcadff054 | 4 | public void calcTargetsRec(int row, int column, int step) {
LinkedList<Integer> adjCells = adjMatrix.get(calcIndex(row,column));
//sets the current cell to visited
visited.set(calcIndex(row,column), true);
//for each adjacent cell
for (Integer i : adjCells) {
//if the cell has not been visited
... |
d2af5e12-814c-4ae1-874b-6ccd4c87f18e | 6 | @Override
public void addSelectionPath(TreePath p) {
if (p.getPathCount() == 1) {
clearSelection();
gui.imageBrowser.clearDates();
}
else if (p.getPathCount() == 2 || p.getPathCount() == 3) {
Enumeration<?> e = ((MutableTreeNode) p.getLastPathComponent()).children();
while (e.hasMoreElements()) {
... |
5b958922-e304-452e-934a-aa3c15c7efc7 | 2 | private void createUserMenu() {
userMenu = new JMenu("Uživatel");
userMenu.setVisible(false);
JMenuItem changeNickname = new JMenuItem("Změnit přezdívku");
changeNickname.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK) );
changeNickname.addActionListe... |
91b0b046-385c-4a37-b037-4ff90c426019 | 6 | public static void main(String[] args) {
int numeratorProduct = 1;
int denominatorProduct = 1;
for (int n = 10; n < 99; n++)
for (int d = n + 1; d < 100; d++)
if (digitCancelledFraction(n, d)){
numeratorProduct *= n;
denominatorProduct *= d;
}
ArrayList<Integer> numPrimeFactors = prime... |
a2de67e5-4b84-4564-8b69-a2b1f09eb896 | 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... |
02dee9e4-0328-44cf-a05e-fae98ec8251c | 6 | public static Stella_Object withTokenizer(Stella_Object table, Stella_Object input, Cons body) {
{ Stella_Object inputtree = null;
StandardObject inputtype = null;
{ Object [] caller_MV_returnarray = new Object[1];
inputtree = Stella_Object.walkATree(input, caller_MV_returnarray);
inpu... |
661a1b5e-fb4d-4de6-8305-082b65d3b7f4 | 0 | public void setSaleId(int saleId) {
this.saleId = saleId;
} |
58433485-35d2-4569-b45f-c36d18a58b17 | 1 | @Override
protected DataSet doParse() {
final DataSet ds = new BuffReaderDataSet(getPzMetaData(), this);
lineCount = 0;
recordLengths = ParserUtils.calculateRecordLengths(getPzMetaData());
try {
// gather the conversion properties
ds.setPZConvertProps(ParserUt... |
0cb84e6c-1ab9-4945-8635-623696b1df35 | 7 | private boolean processFields() {
//
// Get the starting principal
//
if (!principalField.isEditValid()) {
JOptionPane.showMessageDialog(this, "You must specify a valid starting principal",
"Error", JOptionPane.ERROR_MESSAGE);
... |
2dfd76eb-7b1d-4257-b9c0-0b39f55b2e5c | 7 | public static void main(String[] args) {
double integral=0;
double integralprev = 0;
double sum = 0;
do {
integral = function(a) + function(b);
xi = a;
sum = 0;
for (int i = 1; i < n; i++) {
xi += h;
if (i %... |
b6ea043f-eab6-46a1-9cdc-b105adb95ee9 | 9 | @Override
public Set<? extends String> getRoles(final Principal[] principals) throws PolicyContextException {
final String cn = this.getClass().getName();
final Logger logger = Logger.getLogger(cn);
if (logger != null && logger.isLoggable(Level.FINER)) {
logger.entering(cn, "getRoles", java.util.Arr... |
185642cf-58e3-41f7-9653-596c2a1d7065 | 6 | public List<Organism> crossover(int numForAverageFitness) throws Exception {
//find number of parents
int N = this.getOrganisms().size();
int nParents = (N % 2 == 0) ? N / 2 : N / 2 + 1;
double mediane = this.findMedianFitness();
int counter = 0;
List<Integer> parents =... |
623c1ea1-10bc-40c1-90a9-7b78f9906025 | 3 | @Override
protected void paintComponent(Graphics g) {
if (counter != 0) {
super.paintComponent(g);
for (int i = 0; i < 4; i++) {
g.drawImage(layers[i], 0, 0, null);
if (i == layerSelected) {
listener.drawPreview((Graphics2D) g);
}
}
}
} |
22a01859-3538-4b26-b569-31d26fcf48a9 | 4 | private void addOkButtonEventHandler() {
okButton.addActionListener (new ActionListener() {
public void actionPerformed(ActionEvent e) {
File usersFile = new File(usersTextField.getText());
if (!usersFile.exists())
{
showFileNotFoundError(usersTextField.getText());
return;
}
File... |
4c231c77-7156-4864-88b5-cac1546b15f3 | 9 | public static void main(String args[]) {
int run = 1;
GameServer server = new GameServer(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
for (int i = 0; i < server.getMaxPlayers(); i++) {
server.getPlayerKeys().add(args[i + 3]);
server.ge... |
e68d6ade-4a2e-4c70-bccb-3b60a7593c71 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof ScatterRenderer)) {
return false;
}
ScatterRenderer that = (ScatterRenderer) obj;
if (!ObjectUtilities.equal(this.seriesShapesFilled,
... |
2fc68ac7-601f-4d84-b936-9a7119ec15f7 | 4 | public static void setChookBlad(float x, float y) {
switch(map[(int) (y / 18)][(int) (x / 18)]){
case 2:
System.out.println("Chook DOWN");
map[(int) (y / 18)][(int) (x / 18)] = 6;
break;
case 3:
System.out.println("Chook UP");
map[(int) (y / 18)][(int) (x / 18)] = 7;
break;
case 4:
System.o... |
813fae55-c623-4d46-a185-9c32ce338aee | 6 | public void saveFile(String filename) {
try {
List<String> sections_list = new ArrayList<String>();
for (String key : map.keySet()) {
String section = key.split("\\.")[0];
if (!sections_list.contains(section)) sections_list.add(section);
}
PrintWriter writer = new PrintWriter(new OutputStreamWr... |
026c9ba2-ea41-43e4-8ddd-d9e9d826ac62 | 0 | @Override
public void mouseExited(MouseEvent e) {
} |
c835388a-0b9c-4fa4-8d9e-c5605a708a56 | 8 | @Override
public List<AdminTbl> getTableList(String tblType) {
log.debug("get table list...");
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
ArrayList<AdminTbl> list = new ArrayList<AdminTbl>();
StringBuilder sql = new StringBuilder();
sql.append(" select tbl_nm, dsp... |
1852e3b8-728a-440b-9b2f-4570e9449dd0 | 6 | @Override
public int compareTo(MyNumber o) {
double a = getDoubleFromMyNumber(base);
double b = getDoubleFromMyNumber(exponent);
double power = Math.pow(a, b);
if(o instanceof MyInteger) {
int num = ((MyInteger)o).getIntegerValue();
if(power > num)
return 1;
else if(power == num)
return 0;... |
abc675bb-a7ff-4533-955f-614842151177 | 9 | @Override
protected void handleMovement() {
//first, try to grab a point
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
Location potential = new Location(location.getX() + dx, location.getY() + dy);
synchronized (graphics) {
if (graphics.checkForPoint(potential)) {
p... |
13976b79-60a7-4d4b-b7b6-1b8b296039c8 | 5 | @EventHandler(priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event){
Entity ent = event.getEntity();
if(ent instanceof Player){
Player player = (Player)event.getEntity();
World world = player.getWorld();
String worldname = world.getName();
String playername = player.getNam... |
a14632e2-4622-47df-a271-1e5b2b51b2ba | 6 | public static void insertFields(Work work){
//カテゴリー情報登録
String[] list = work.getCategory();
if(list != null){
for(String str : list){
//属性情報テーブルから ID取得
int id = getFieldId(str);
//登録されていない場合 登録する
if(id == -1){
insertFieldInfo(str);
id = getFieldId(str);
}
insertField(CATEGORY... |
67e258fd-f352-41f4-bcaa-61df8f39f6a2 | 9 | boolean advance() {
while (i < v.size()) {
Param p = (Param)v.elementAt(i++);
type = p.type;
entity = p.entity;
group = p.group;
value = p.value;
switch (type) {
case Param.REFERENCE:
if (showReferences && entity.semantic > 0) {
int level = 0;
for (;;) {
p = (Pa... |
d56fb3fd-1f6c-4a7a-b63f-1e084d323261 | 1 | public boolean isOutput(int contact) {
return contact >= icnt && contact < icnt + ocnt;
} |
d766b383-9a29-4fac-aaf5-7faade369934 | 0 | public int getPriority(){
return priority;
} |
cf573a1a-10c3-4c75-ba9c-9ea4233d5c5d | 6 | private int getNumberOfPossibleMoves(int x, int y)
{
int moves = 0;
for (Point p : moveRules)
{
int newX = x + p.x,
newY = y + p.y;
if (newX >= 0 && newX < columns && newY >= 0 && newY < rows && !board[newY][newX])
moves++;
}
return moves;
} |
1c8f8e9a-5186-4c32-9d0e-910fccf4fbf3 | 3 | public void init()
{
bg.init(100);
if (!stars.isEmpty())
{
stars.clear();
}
for(int i=0; i <numOfStars; i++)
{
stars.add(new StarObject(180,-i));
}
for(int i=0; i<stars.size(); i++)
{
stars.get(i).init();
}
playButton = new Rectangle(0,200,200,50);
tutorialButton = new Rectan... |
ec2e1e15-ced3-41d4-9ed8-096e05f5065d | 0 | public static void main(String[] args)
{
OutputFile f = new OutputFile("test.txt");
f.OpenFile();
f.WriteToFile("this is a test");
f.WriteToFile("second line written");
f.CloseFile();
} |
a6e08ce2-5d58-43bc-a87b-64daa2441900 | 3 | public void loadDictionary(File dictionary) throws Exception {
try {
BufferedReader is = null;
try {
is = new BufferedReader (new FileReader(dictionary));
String line = null;
while ((line = is.readLine()) != null) {
this.attach(line.toLowerCase());
}
} finally {
i... |
399a052e-b712-4dde-b532-3f539f243e15 | 3 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Connection connection=new Connection();
System.out.print("If you want to host type 1, if you want to join a game type 2:");
String chat_type = br.readLine();
if(chat_type.equa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.