method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dae7ea3a-2d24-430a-a657-309995f83cf1 | 4 | @Override
public void render(float interpolation) {
if(pos == null)
return;
Renderer.drawArrow(pos.add(new Vector2(10,0)), longDim, shortDim, 0, new Vector2(tipDim), 0xff0000, clickMode == 1 ? 1 : 0.6f);
Renderer.drawArrow(pos.add(new Vector2(0,10)), longDim, shortDim, 90, new Vector2(tipDim), 0x00ff00, click... |
4ffefb9f-b4f6-46ef-9493-102638393ec4 | 5 | public ListNode removeNthFromEnd(ListNode head, int n) {
if(n<1)
return head;
ListNode p1 = head;
ListNode p2 = head;
for (int i = 1; i < n; i++) {
if (p2 == null)
return head;
p2 = p2.next;
}
p2 = p2.n... |
1ecc0dfe-b08e-4b5e-b317-55a635d4a0f8 | 8 | public String simplifyPath(String path) {
// Start typing your Java solution below
// DO NOT write main() function
String[] arr = path.split("/", -1);
int n = arr.length;
if (n < 2)
return path;
Stack<String> pathName = new Stack<String>();
for (int i = 0; i < n; i++) {
String tmp = arr[i].trim();
... |
389a6386-a48a-4093-9fe1-2bf5d4d38462 | 1 | public void startMove() {
PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent");
if(ownPC != null) {
moving = true;
ownPC.setTarget(targetX, targetY);
}
} |
823b82a2-9d76-480f-a854-490ce362c6ce | 4 | private String createOptionDisplay( OptionDescriptor descriptor ) {
StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" );
for ( Iterator<String> i = descriptor.options().iterator(); i.hasNext(); ) {
String option = i.next();
buffer.append( option.lengt... |
d6adb181-a1ba-4e24-9f62-36324327f123 | 7 | private void assignToGroups()
{
clear();
try
{
int counter = teammgr.showCount();
int maxId = teammgr.maxTeamId();
if (counter > 0)
{
int tm = teammgr.getById(maxId).getGroupId();
if (tm == 0)
{
... |
5e2d22e3-5ba1-41ed-8d17-6535d93d1e5d | 3 | private Runnable createProducer(final CloudNode cloudNode) {
return () -> {
logger.info("Producer thread started.");
while (this.isMaster(cloudNode)) {
try {
final Set<String> nodes = new HashSet<>(HazelcastHelper.this.getActiveNodes());
... |
cf136126-80da-440d-a167-89fc26a868f3 | 5 | public Letter<?> createRandomLetter() {
Letter<?> letter;
Inhabitant sender = this.inhabitants[r.nextInt(100)] ;
Inhabitant receiver = this.inhabitants[r.nextInt(100)] ;
Letter<TextContent> lettre = new SimpleLetter<TextContent>(sender, receiver, new TextContent("Bonjour tu vas bien ?")) ;
switch (r.nextInt(4... |
805af05a-c5b3-415f-bcbb-7fcf330a4887 | 1 | public static boolean transform(InstructionContainer ic,
StructuredBlock last) {
return transformNormal(ic, last) || transformJikesString(ic, last);
} |
1198d47f-8142-473f-9d80-89a7f5bbd33c | 6 | public void update() {
long ct = System.currentTimeMillis();
map.update();
p.update();
if (ct - lastTimerTime >= 1000) {
lastTimerTime = ct;
onTimer();
}
if (keys.get(KeyEvent.VK_LEFT)) {
p.move(true);
} else if (keys.get(KeyEvent.VK_RIGHT)) {
p.move(false);
}
if (keys.get(KeyE... |
253838d6-d94c-4bd9-900d-d95265d3db2d | 8 | @Override
public int writeString(String encoding, String val, int length) throws IOException
{
Charset charset = Charset.forName(encoding);
CharsetEncoder enc = charset.newEncoder();
CharBuffer bin = CharBuffer.allocate(1);
ByteBuffer bout = ByteBuffer.allocate(8);
int le... |
9e70e258-7fc3-4a56-93de-685d3a70e54f | 9 | public static void main(String[] args)
throws NumberFormatException, IOException {
BufferedReader bufReader =
new BufferedReader(
new InputStreamReader(System.in));
LifeGame game = new LifeGame(10, 25);
System.out.println("Game of life Progra... |
1438b8bc-1b80-4bff-9666-00280bd10d00 | 9 | public void ProcessText(String path,int index) {
Pattern regex=Pattern.compile("(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})");
Matcher regexMatcher;
try {
in=new BufferedReader(new FileReader(new File(path)));
out=new BufferedWriter(new FileWriter(new File("hosts"),true));
while((line=in.readLine())!=nul... |
0a6cebd2-7780-495d-b07e-586908e4b56c | 9 | @Override
public void run() {
ar.loadLevel(currentLevel);
while (true) {
GameState state = solve();
if (state == GameState.WON) {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
int score = -2;
while (score != StateUtil.checkCurrentScore(ar.pr... |
88f07066-0900-4aa7-8b48-c9c55cb74902 | 1 | public void printBoard(String[] board){
for(int i =0 ;i< board.length;i++)
System.out.println(board[i]);
} |
1aba8b75-072c-4dd2-b6e3-5610e1dbc9a5 | 5 | @Override
public boolean onCommand(CommandSender cs, Command c, String l, String[] args) {
if((c.getName().equalsIgnoreCase("attach") || c.getName().equalsIgnoreCase("detach")) && checkPermission(cs, "forcechat.attach")){
new AttachDetachCommand(c.getName(), cs, args);
return true;
}
if(c.getName().equa... |
ad404655-3c63-44df-a320-dec420848665 | 7 | public void actionPerformed(ActionEvent e){
int buttnum = 0;
for(int a = 0; a < butts.length; a++){
if(e.getSource() == butts[a]){buttnum = a;}
}
switch(buttnum){
case 0:command = 300; fireucEvent(); break;//Select by Brush
case 1:command = 301; fireucEvent(); break;//Select Rectangle
case 2:comman... |
4a4ee339-6197-423f-9c5d-7da8babd14e0 | 9 | @Override
public int hashCode() {
int result = (regDst ? 1 : 0);
result = 31 * result + (regWrite ? 1 : 0);
result = 31 * result + (aluSrcA ? 1 : 0);
result = 31 * result + (memRead ? 1 : 0);
result = 31 * result + (memWrite ? 1 : 0);
result = 31 * result + (memtoReg ... |
e1113bbb-8682-4166-9e67-f85f61330b9f | 8 | public void renderSprite(int xPos, int yPos, Sprite sprite){
int height = sprite.h;
int width = sprite.w;
xPos -= xOffset;
yPos -= yOffset;
for(int y = 0; y < height; y++){
if(yPos + y < 0 || yPos + y >= h) continue;
for(int x = 0; x < width; x++){
if(xPos + x < 0 || xPos + x >= w) continue;
... |
e9bd5440-67cc-45f1-91f8-a596e8ee4a28 | 3 | private boolean doActionWithNumber(int number) {
if (number == 1)
return this.feelHungry();
if (number == 2)
return this.feelPassion(this.badFemale);
if (number == 3)
return this.feelSleepy();
return false;
} |
cbd379e0-5a9d-4706-9959-35a68416c203 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} |
d77e7b37-9bbc-43d3-91fd-08d197a6f353 | 1 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
String s = in.next();
permutate(s.toCharArray(), 0);
for(String str:permutations){
System.out.println(str);
}
} |
32699e5e-4179-417d-9a1d-2118ca23109c | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
7b299934-081b-4f7f-9d83-116db98b0889 | 2 | public List<T> concat(List<T> s)
{ List<T> res=this;
if(s==null)
{ return res;
}
else
{ if(s.next==null)
{ return res.append(s.a);}
else//s.next!=null
{ return res.append(s.a).concat(s.next);}
}
} |
6e7bad98-4bbc-48dc-835f-1d6bd6b23660 | 2 | Module addCommand(String name, Command command) {
if (StringUtils.isEmpty(name)) {
return this;
}
if (null == this.commands) {
this.commands = new HashMap<>();
}
this.commands.put(name, command);
return this;
} |
e1dba704-25e3-4664-8f65-f75be4c42340 | 1 | private void buttonRequestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRequestActionPerformed
//Получаем текущего клиента по Id пользователя
Client client = clientDAO.getByUsersId(curUserId);
//Если клиент заполнил информацию о себе
if (client != null) {
... |
b05a150b-af7e-4d05-a382-ba4a7e43b550 | 6 | public void insertNode(int index, SinglyLinkedListNode<T> newNode) {
// Check for out of bounds insertion.
if (index > size) {
return;
}
if (size == 0) {
// Deal with special case of the first node.
start = newNode;
} else if (index == 0) {
// Deal with special case of inser... |
91d5df03-d79e-4cd7-8f9c-325fedb747b4 | 5 | public Server(int port) throws Exception
{
//setup JFrame
super("Server");
initGui();
//Run Server
printMessage("Server Starting...");
serverSocket = new ServerSocket(port);
printMessage("Server Online");
//this loop waits for a connection attempt
while(true) {
socket = serverSocket.accept();
... |
137ee081-0bd6-41c1-9526-02e4463a0330 | 7 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int caseCount = 1;
int totalCases = Integer.parseInt(in.nextLine());
StringBuilder results = new StringBuilder();
for(; caseCount <= totalCases; caseCount++){
int gridSize = Integer.parseInt(in.nextLine());
String[][] grid ... |
cc0fc55e-6f5b-4ac5-9cb4-996cc6c1e91e | 2 | public boolean comparePoint( Point comparedPoint)
{
float compareX = comparedPoint.getXPos();
float compareY = comparedPoint.getYPos();
if( this.getXPos() == compareX &&
this.getYPos() == compareY)
{
return true;
}
else
{
return false;
}
} |
c57449e6-ce8a-4a77-91de-b7cd658e8b24 | 0 | @Override
public void destroy() throws Exception {
logger.info(getName() + " finalization execute.");
remoteServerCall.destroy();
logger.info(getName() + " finalization success.");
} |
a4bc6a41-a582-480c-9ee7-c92c1642bc4b | 9 | @Override
public void operate( FlowProcess process, FunctionCall call )
{
// thrift lists
List<MentionEntity> mentionEntities = new ArrayList<>();
List<HashtagEntity> hashtagEntities = new ArrayList<>();
List<URLEntity> urlEntities = new ArrayList<>();
try
... |
1aba7c8f-7515-40a2-9ccc-eca1dd694bc8 | 9 | public ArrayList<ArrayList<Integer>> threeSum(int[] num) {
Set<ArrayList<Integer>> result = new HashSet<ArrayList<Integer>>();
if (num == null || num.length == 0) {
return new ArrayList<ArrayList<Integer>>();
}
Arrays.sort(num);
for (int i = 0; i < num.length; i++) {
if (num[i] > 0 || (i... |
33b9d60d-6395-48a9-823f-cc057a96df4d | 6 | public <T extends ActiveRecord> Query select(Class<T> clazz,
String... columns) {
if (columns.length == 0) {
throw new IllegalArgumentException(
"Columns must be defined for the select method.");
}
StringBuilder sb = new StringBuilder();
sb.append("select ");
for (int i = 0; i < columns.length; i+... |
71d51bdf-b5e5-49db-8da3-fb944190a56a | 2 | public String getDirection(Room pRoom)
{
String direction = null;
for (String key : exits.keySet())
{
if (pRoom.equals(exits.get(key)))
{
direction = key;
break;
}
}
return direction;
} |
5d669533-36a8-4c8f-99f5-de1081a93012 | 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.or... |
28e6a4c6-9f3a-4f0a-a850-10965c77cf27 | 5 | public static void completeElementInfo(ElementInfo element,
WsdlSchema schema) {
if (element != null) {
Element parent = XmlUtil.getParentElement(element.getElement());
List<Element> childElements = XmlUtil.getAllChilds(parent, schema);
int size = childElements == null ? 0 : childElements.size();
eleme... |
de368909-2966-441e-9de1-8e483ae5782f | 9 | public static int findLargestPalindrome(){
int product;
int highest = 0;
for(int first = MAX; first > MIN; first--){
boolean firstIteration = true;
for(int second = first; second > MIN; second --){
if(firstIteration){
if(((first*second)<highest) && highest != 0){
return highest;
}
... |
4744ea82-dcc4-4d04-b39d-ec810c60bd3b | 9 | public void paintIcon(Graphics g, Point p, Dimension r, int iconIndex) {
int x, y;
int h = (int) r.getHeight();
int h2 = h / 2;
int h10 = h / 10;
x = (int) p.getX();
y = (int) p.getY();
switch (iconIndex) {
case OVAL:
g.drawOval(x, y, ... |
f5ab505f-abd5-4d79-b6f4-ebd92ff6739a | 4 | public static void handleMain(String[] args, OggAudioInfoTool tool) throws Exception {
if(args.length == 0) {
printHelp(tool);
}
boolean debugging = false;
String filename = args[0];
if(args.length > 1 && args[0].equals("-d")) {
filename = args[1];
... |
3962e5f5-a54b-4390-a25c-ba1f50b7debb | 5 | private void setPlayerFacing(){
if ((this.playerMoveCounter != 0) && (this.player.getSavedDir() != -1)){
if (!this.player.checkCell(this.player.getFacing())){
this.player.setFacing(this.player.getSavedDir());
this.player.setSavedDir(-1);
}
else {
if (isJunction(this.player) && (this.player.checkC... |
db825460-be9c-48c4-960a-275af8f40705 | 7 | @Override
public void deleteAll() throws Exception {
Feed feed = getFeed("/s-ramp?query=/s-ramp&startIndex=0&count=10000", 200);
for (Entry entry : feed.getEntries()) {
// Delete all primary artifacts
if (entry.getExtensionAttributes().containsKey(DERIVED_QNAME)
... |
f7dac951-8284-43ce-9daf-4bc6673a0275 | 3 | private void btnEliminarMesaDulcesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarMesaDulcesActionPerformed
// TODO add your handling code here:
/*Obtenemos la mesa de dulces seleccionada de la tabla:*/
MesaDeDulces mesaDeDulcesQueSeEliminara = obtenerInformacionDe... |
473ea7a4-9e01-45a7-86b2-f1175debdf71 | 2 | public static final void register(String extension, StdImageSet iconset, String description, String referenceURL, FileProxyCreator fileProxyCreator, boolean allowOpen) {
extension = normalizeExtension(extension);
for (FileType type : TYPES) {
if (type.mExtension.equals(extension)) {
TYPES.remove(type);
b... |
4ffe7d44-c1a7-4c07-916b-545813eb95d4 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.codusuario == null && other.codusuario ... |
65518f99-6916-4eda-804b-1e80938f9d7a | 5 | public static BufferedImage loadImage(String filename, ImageViewer imViewer, ImageMapper imMapper)
throws WrongSizeException, WrongProportionException, WrongImageTypeException
{
BufferedImage img = null;
try
{
img = ImageIO.read(new File(filename));
}
catc... |
ea8466ba-57a2-4985-b9a5-dea79b98c196 | 4 | public void GetInRelation(Integer id) {
inauthorMap = new HashMap<>();
authors = new ArrayList<>();
String query = "select name,inauthors from inauthor where paperid="
+ id;
ResultSet set = sqLconnection.Query(query);
String author, inauthor;
try {
while (set.next()) {
author = set.getString("nam... |
42b695fe-272f-435b-8db8-0b04588cfacb | 9 | @Override
public SetOfSentences doProcess(SetOfSentences sos) {
ArrayList<Eojeol[]> eojeolSetArray = sos.getEojeolSetArray();
ArrayList<Eojeol[]> resultSetArray = new ArrayList<Eojeol[]>();
int len = eojeolSetArray.size();
String prevTag = null;
boolean changed = false;
for (int pos = 0; pos < len; p... |
81a6e7d7-ff83-42ab-9a6e-2b668b3240fb | 9 | public static void main(String[] args) {
BaseAccount[] list = new BaseAccount[5];
list[0] = new SavingsAccount("Fred");
list[1] = new ChequeAccount("Jim");
list[2] = new ChequeAccount("Sue");
list[3] = new SavingsAccount("Jim");
list[4] = new SavingsAccount("Jill");
int i;
// print the account owners... |
b3392463-8f8f-40f6-b45b-5c0e4a6c6127 | 3 | public DaemonStorageProcess(){
super();
String fname = "/sphinx.properties";
InputStream is = DaemonStorageProcess.class.getResourceAsStream(fname);
Properties prop = new Properties();
logger.info("reading: " + fname);
try {
if(is ... |
5d0b8c98-caec-4599-9be6-6954a5ba1a66 | 0 | public static void setRules(String ruleString, JCellule[][] grid, JLabel lblGeneration, JButton btnProchaineGeneration) {
ControllerGrille.grid.setRuleSet(ruleString);
synchroniser(grid, lblGeneration, btnProchaineGeneration);
} |
567794a9-38db-4a7d-95e0-7b8134681af6 | 3 | public boolean hasBreeze(int x, int y)
{
if (!isValidPosition(x,y)) return false;
if (isUnknown(x,y)) return false;
if (w[x][y].contains(BREEZE))
return true;
else
return false;
} |
f8da7958-341e-4b3b-91af-c0c80c902f66 | 6 | public boolean eliminarCliente(int id)
{
boolean correcto = false;
TransactionManager.obtenerInstanacia().nuevaTransaccion();
try
{
TransactionManager.obtenerInstanacia().getTransaccion().start();
TCliente t... |
9242691a-f189-4bd5-a6eb-f31986dd39b5 | 3 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
int userId = Integer.parseInt(request.getParameter("userId"));
String password = request.getParameter("password");
try
{
User usr = UsersDAO.selectUserById(ds, userId);
if (usr.getUse... |
68b6ff3f-305c-42c0-9ac5-dbc5a10c747a | 1 | public void connect() throws IOException, Exception{
if (isDownloadPassive()){
//creating a listener for current client
ServerSocket localListener = new ServerSocket(0);
setLocalAddress("127.0.0.1"); //TODO: determine IP from serve... |
1a0244a1-5909-4b3d-99e6-0bd269a472cb | 2 | public static Level Load(String filename) throws IOException, ClassNotFoundException {
Level l = null;
if (filename.endsWith(".dat"))
l = Convert(filename);
else {
FileInputStream fis = new FileInputStream(filename);
GZIPInputStream gis = new GZIPInputStream(fis);
ObjectInputStream obj = new ObjectInp... |
b8ba6e5e-fbab-491f-9f5d-16a5fe377c9b | 1 | @Override
protected Pizza createPizza(String type) {
Pizza pizza;
if(type.equals("cheese")) {
pizza = new NYStyleCheesePizza();
} else {
pizza = new NYStyleMeatPizza();
}
return pizza;
} |
d2ec6ac2-f7cf-458f-8087-3502821d5456 | 9 | private void cargaProcedimiento(String nombre) {
int procACargar = 0;
while (!procedimientos.get(procACargar).getNombre().equals(nombre))
procACargar++;
for (int i = 0; i < procedimientos.get(procACargar).getvariablesEnterasL(); i++)
contEntLoc.add(new VariableInt());
for (int i = 0; i < procedimientos.ge... |
5a353efc-1c25-4815-8ff7-3355c78befa5 | 4 | public boolean importHistoryJPHA(String myuin, String dir) throws IOException {
String contactuin = "";
File importDir = new File(dir);
// make output file in dir with history files
File outputFile = new File(importDir + "\\" + myuin + ".jpha");
... |
4da41dfd-d5ff-4e58-8cb1-3fb9297d5f52 | 1 | private HttpHandler createRole() {
return new HttpHandler() {
@Override
public void handle(HttpExchange he) throws IOException {
he.getResponseHeaders().add("Access-Control-Allow-Origin", "*");
String path = he.getRequestURI().getPath();
i... |
8ad33af2-27b9-4c91-986b-1a94fde6309d | 2 | public Digit resolve(String... segments)
{
StringBuffer sb = new StringBuffer();
for (String string : segments) {
sb.append(string);
}
Digit digit = digits.get(sb.toString());
return digit != null ? digit : Digit.INV;
} |
7adff1f0-a76c-4404-99e7-a0237312824d | 8 | public void setDevice(){
boolean hasMake = false;
boolean hasModel = false;
ExifIFD0Directory dir = md.getDirectory(ExifIFD0Directory.class);
if (dir == null) {
return;
}
for (final Tag t: dir.getTags()) {
if (t.getTagName().equals("Make")) {
... |
dd901d24-8ebe-4733-98a8-30621342c391 | 6 | private void initDialog(final JDialog dialog, int style, Frame parent) {
dialog.setComponentOrientation(this.getComponentOrientation());
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(this, BorderLayout.CENTER);
dialog.setResizable(false);
// if (... |
d441ecc1-e3b7-4c02-8e18-4874d64279ba | 5 | private void writeIntArray(Object value, int type) {
writeList.clear();
int len = Array.getLength(value);
if (len > 0) {
if (type == ElementType.TYPE_INTEGER_ARRAY) {
for (int i=0;i<len;i++) {
writeList.append(Array.getInt(value,i));
... |
97c291b5-b35e-43c8-bbfd-9155c0038e37 | 6 | @EventHandler
public void PigZombieJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getPigZombieConfig().getDouble("PigZombie.J... |
0fcbfdbe-283c-4829-bdb6-9358cd230a68 | 7 | public CheckResultMessage checkF1(int day) {
BigDecimal f = new BigDecimal(0);
int row = get(20, 5);
int clums = get(21, 5);
int total = get(22, 5);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
for (int i = row; i < total; i++) {
f ... |
4381298e-5780-4f2f-b0b1-e523abec9a1e | 9 | @SuppressWarnings({ "unchecked", "rawtypes" })
private void init(Object object, Parameterized parameterized, ResourceBundle bundle, JCommander jCommander)
{
m_object = object;
m_parameterized = parameterized;
m_bundle = bundle;
if (m_bundle == null)
{
m_bundle = findResourceBundle(object);
}
m_jComma... |
d625e6e1-a41f-444a-ab6d-d3ee21f78182 | 9 | public boolean update() {
boolean rv = false;
boolean sliding=true;
updateneeded = false;
if (!velocity.isZero()) {
justpotted = false;
double dt = (System.currentTimeMillis()-lt)/1000;
if (!hascollided)
{
MyVector dirofshot = pointofboard.normalize();
velocity = dirofshot.dotProduct(veloc... |
244839ce-83be-46a1-bcb0-9b89ddf41e89 | 1 | public MainFrame() {
super("Ip phone interface");
setSize(WIDTH, HEIGHT);
Toolkit kit = Toolkit.getDefaultToolkit();
setLocation((kit.getScreenSize().width - WIDTH)/2, (kit.getScreenSize().height - HEIGHT)/2);
setExtendedState(MAXIMIZED_BOTH);
container = this.getContentPane();
... |
1b927abb-5f3a-4316-be35-bb90b5a24800 | 9 | public String printZigZagTree(BinaryTree t) {
Stack<Node> s1 = new Stack<Node>();
Stack<Node> s2 = new Stack<Node>();
boolean leftToRight = true;
s1.add(t.root);
StringBuilder output = new StringBuilder();
while(!(s1.empty() && s2.empty())) {
if(leftToRight) {... |
ee0b7930-3512-4569-abcf-7cb2e028dd70 | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s;
int cas = 0;
while ((s = br.readLine()) != null) {
StringTokenizer st = new StringTokenizer(s);
Integer N = new Integer(... |
a8c03942-3b47-4866-9f01-ab0e5731abf7 | 6 | public static void run() {
final String dir = "E:\\DropBox\\DEV\\AdCleaner\\adcleaner\\~\\.adcelaner\\screens\\";
ArrayList<File> files = new ArrayList<File>() {{
add(new File(dir + "video1_out_10.png"));
add(new File(dir + "video1_out_115.png"));
add(new File(dir +... |
a1b0dbbf-042c-42a1-aa57-10456c8ac8e8 | 8 | void loadObjects(Document xmlDoc) throws Exception {
Rectangle truck=panelWorkplace.truck.getBounds();
panelLibrary.destroyLiraryTable();
boolean libraryModified=false;
///first add containers to library, if missing
NodeList nodeList=xmlDoc.getElementsByTagName("container"); //$NON-NLS-1$
for(int i=0; ... |
198546e5-b0b5-460e-8094-d6b9ef159f61 | 5 | public void mouseClicked(MouseEvent e)
{
if(!loading && !updating && !saving && !verticalScrollbar.isSelected() && !horizontalScrollbar.isSelected())
{
overlay.mouseClicked(e);
}
} |
d9228d40-9cbf-4955-adfc-f20e8418aa97 | 3 | private static boolean isOperator(char chr) {
return chr == '+' || chr == '-' || chr == '*' || chr == '/';
} |
38a2b1d8-603c-4ff0-aae5-d9784b4ad878 | 2 | public void updateSchedule(Schedule schedule)
{
PreparedStatement ps;
try {
if(schedule.getId() > 0)
{
ps = con.prepareStatement("UPDATE schedule SET name=?, week_day=? WHERE id=?");
ps.setInt(3, schedule.getId());
}
else
{
ps = con.prepareStatement("INSERT INTO schedule (name, week_day)... |
10101d3f-4743-4336-a02a-c62b22fb164d | 0 | private void setConnections(List<ISocketServerConnection> connections) {
this.connections = connections;
} |
738f4965-ed03-411e-8372-ee7fd820d2e9 | 9 | @Override
protected boolean canRun(ClassNode node) {
if (!node.superName.endsWith(classNodes.get("Renderable").name) || classNodes.containsKey("Model"))
return false;
ListIterator<MethodNode> mnLi = node.methods.listIterator();
int count = 0; // static boolean[] of length 4096, w... |
b4aa2d4b-9d15-4e54-997f-fcbf68b3608a | 9 | public Object invoke(String name, Object[] params, String[] signature)
throws MBeanException,
ReflectionException
{
if(log.isDebugEnabled())log.debug("invoke "+name);
String methodKey=name+"(";
if (signature!=null)
for (int i=0;i<signature.length;i++)
... |
fa578484-1dc4-4f18-adc2-d3ef29659d54 | 8 | public static Message getNoteMessageByXMLElem(XMLElement root) {
User toUser = null;
User fromUser = null;
String content = new String("This message has no content.");
boolean isRead = false;
if (root.attributeMap.containsKey("isread") && root.attributeMap.get("isread").equals("true"))
isRead = true;
fo... |
f87262a0-c81b-4c40-922d-a018dab51bf3 | 2 | public static void main(String[] args){
List<String[]> list = new N_Queens().solveNQueens(4);
String[] board;
for(int i = 0; i< list.size();i++){
board = list.get(i);
for(int j = 0 ; j < board.length;j++)
System.out.println(board[j].toString());
... |
666cce16-5317-4550-835d-428d3954c2c4 | 7 | public static void sortNumberMSD(int[] numbers, int numCount, int longestBit) {
if(longestBit<=0) {
return;
}
int bucketNum = 10;
int[][] bucket = new int[bucketNum][numbers.length];
int[] bucketCount = new int[bucketNum];
for(int i=0;i<numCount;i++) {
int lsd = numbers[i]/(int)Math.pow(10, long... |
e88e5d32-8d82-432f-bf5d-3f6cb6ae465f | 5 | public void renderSprites() {
if(game.menu == null || game.menu.transparentMenu()){
int px = player.x >> 4;
int py = player.y >> 4;
for(int x = px - 5; x < px+6; x++){
for(int y = py-4; y < py+5; y++){
rowSprites.addAll(entitiesInTiles[x + y * this.w]);
}}
if (rowSprites.size() > 0) {
sortA... |
7a1a1495-67a8-4307-896d-5c713a91a72c | 2 | public static boolean skipClass(ClassInfo clazz) {
InnerClassInfo[] outers = clazz.getOuterClasses();
if (outers != null) {
if (outers[0].outer == null) {
return doAnonymous();
} else {
return doInner();
}
}
return false;
} |
c3185111-bb21-45b1-bdf1-30741e88459d | 0 | @Override
public String toString() {
return value;
} |
0feb1884-b7ac-4678-969a-5a7936ead323 | 5 | @Test
public void testSchemaPermissionException() throws Exception
{
boolean thrown = false;
PersistenceManager persist = null;
//create a normal PersistManager
persist = new PersistenceManager(driver, database, login, password);
assertTrue(persist.getPersist().isCreateSchema());
persist.getPersist().s... |
4f736cd1-ebf7-4edf-9872-b1fea19eecef | 6 | @Override
public boolean execute(MessageContext context) {
String arguments = getArguments(context);
if (arguments.equals("")) {
sendUsageBack(context);
return false;
}
Matcher matcher = dicePattern.matcher(arguments);
if (!matcher.matches()) {
sendUsageBack(context);
return false;
}
int di... |
234a9d86-eacd-4c26-98dc-946c7f66bb9e | 5 | public int devuelveSegundo() {
// variable para obtener el tiempo al iniciar el metodo
milisegundosactuales = System.currentTimeMillis();
int segundo = 0;
if(Constantes.IMPULSO_RELOJ_SEGUNDOS == 1)
{
while (segundo <= 1) {
// Metodo para obtener el tiempo actual
milisegundos = System.currentTimeMill... |
bd616ebc-ff7e-4507-98ba-c4824462b987 | 2 | public static void main(String[] args) {
for(int i =0;i< 9;i++){
for (int j =0;j < 9 ; j++) {
int val = i/3*3 + j/3;
System.out.print(val +" ");
}
System.out.println();
}
System.out.println("Hello world");
} |
3d99126c-c1a9-4017-87e2-f6b1316333bd | 0 | public JLabel getjLabelLabo() {
return jLabelLabo;
} |
483751f8-0536-4152-a86a-b07630b2d3cd | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PojoVideo other = (PojoVideo) obj;
if (Double.doubleToLongBits(dDuration) != Double
.doubleToLongBits(other.dDuration))
return false;
if... |
0ec5d1fb-f13d-46ca-b5ea-c49eb183912d | 5 | public void parse_Segments() {
/*
* Parse MSH for MESSAGE Information
*/
String SendingApp = ""; // MSH 3
String SendingFacility = ""; // MSH 4
String ReceivingApp = ""; // MSH 5
String ReceivingFacility = ""; // MSH 6
String MsgDateTime = ""; // MSH 7
String Security = ""; // MSH 8... |
a97639b4-b910-4ac1-bfc9-f1df5ed5a656 | 8 | public double[] distributionForInstance(Instance instance) throws Exception {
//Definition of local variables
double[] probs = new double[m_NumClasses];
int sIndex;
double prob;
double condiMutualInfoSum;
// store instance's att values in an int array
int[] attIndex = new int[m_NumAttribut... |
99d4c081-c62d-4d8c-a27a-16f1af59ceb4 | 0 | public static void main(String args[]) {
SimpleFind sf = new SimpleFind(args);
} |
87146fd1-d79d-4f56-a777-ede2dab21588 | 0 | public void create(String timeOfDay, String serviceType, String description) {
this.setTime(timeOfDay);
this.setServiceType(serviceType);
this.setDescription(description);
} |
ea09aa3f-a35d-4b3d-a9f3-be05bb61dd5b | 0 | public static void main(String[] args) {
} |
296b298b-5119-467f-9cc2-62a96ef5fd90 | 3 | private static boolean sectorsRightAngleBeforeLastAngle(Heap<AngleInterval> endAngles, double lastAngle)
{
return !endAngles.isEmpty() && lastAngle > endAngles.peek().rightAngle &&
(endAngles.peek().leftAngle < endAngles.peek().rightAngle ||
lastAngle < endAngles.peek()... |
c2618bc4-1795-4174-986e-034bb5f01953 | 3 | public BufferedImage asImage() {
BufferedImage image = new BufferedImage(pixels.length, pixels[0].length, BufferedImage.TYPE_INT_ARGB);
for(int x = 0; x < image.getWidth(); x++) {
for(int y = 0; y < image.getHeight(); y++) {
image.setRGB(x, y, pixels[x][y] ? Color.BLACK.getRGB() : Color.WHITE.getRed());
... |
7897085d-4d7e-4fd2-980d-b30f6a1a25c8 | 0 | public static Test suite()
{
return new TestSuite( AppTest.class );
} |
b8868948-34a7-4746-b8ef-c4ee7d15dd71 | 8 | private static void hbCreateDecodeTables(final int[] limit,
final int[] base, final int[] perm, final char[] length,
final int minLen, final int maxLen, final int alphaSize) {
for (int i = minLen, pp = 0; i <= maxLen; i++)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.