method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
01945d40-7b12-416d-b888-577168d8b829 | 9 | private boolean objectsAreEqual(SMPLContainer e1, SMPLContainer e2) {
if (!e1.getType().equals(e2.getType())) {
return false;
} else {
if ("Vector".equals(e1.getType())) {
SMPLVector v1 = (SMPLVector) e1.getValue();
SMPLVector v2 = (SMPLVector) e2... |
3de1bd4d-35a6-472e-8252-ac193b32dfcc | 8 | * @param p
* the type of particle to be inserted. If null, then use the parameters specified by <code>GayBerneConfigure</code>
* @return 'true' if the action is done, 'false' if not
*/
public boolean insertAnGB(int x, int y, GayBerneParticle p) {
if (nParticle >= gb.length)
return false;
if (p ... |
8c65c2f4-b0e0-49db-bf6f-45796a770938 | 3 | public Object invoke(Object proxy, Method m, Object[] args) throws Throwable
{
// print implicit argument
System.out.print(target);
// print method name
System.out.print("." + m.getName() + "(");
// print explicit arguments
if (args != null)
{
for (int i = 0; i < ar... |
5f8ee24d-1b8c-40bd-9592-6bf7cee0701e | 2 | public boolean serializeSessionKey(String keyFilename, SessionKey sessionKey) {
try {
File f = new File(keyFilename);
f.createNewFile();
OutputStream file = new FileOutputStream(keyFilename);
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new ObjectOutputStream(buffer);
... |
0b264b99-5bc2-4235-a801-55dda2fbcb4b | 5 | private Class getNFontClass(int fontType) throws ClassNotFoundException {
Class fontClass = null;
if (FONT_OPEN_TYPE == fontType) {
fontClass = Class.forName(NFONT_OPEN_TYPE);
} else if (FONT_TRUE_TYPE == fontType) {
fontClass = Class.forName(NFONT_TRUE_TYPE);
} e... |
9cc2906d-15a1-4367-b4dd-ef098f40da14 | 6 | @Override
public boolean addItem(Item item) {
//TODO: koordinovane ulozenie rozlozeneho itemu.
int shelfCap = Shelf.DEFAULT_CAPACITY;
int itemAmount = item.getAmount();
List<IShelf> shelfs = new ArrayList();
//rozlozenie itemu.
int numofShelfs = itemAmount / shelfCap ... |
899a3444-501c-45ce-88bc-9e7f035e38e4 | 8 | public byte[][] getBoard() {
int width = gameBoard.getWidth();
int height = gameBoard.getHeight();
byte[][] ret = new byte[height][width];
if (opponentAttack.getType() == Attack.INVISIBLE_GAME
&& opponentAttack.isActive()) {
for (int r = 0; r < height; r++) {
for (int c = 0; c < width; c++) {
re... |
cfe3e2a5-2557-4e66-85c2-0c9f13f4fd7c | 3 | public Icon setDescription(String description)
{
this.description = description;
this.appendlessDescription = description;
ItemMeta im = item.getItemMeta();
//Create an ArrayList to hold the lore that will be added to the item
ArrayList<String> lore = new ArrayList<String>();
//Split the descripti... |
1d6b31e1-d726-4491-bb9d-77870ef73cb4 | 9 | public static void compter(final int lastSecond,final int lastMinute){
secondes=lastSecond;
minutes=lastMinute;
ActionListener compterTemps=new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean rep=verifier();
if(rep){
pauseTime();
return;
}
if(sec... |
bceae948-6ae5-4542-aba3-18c69305cbce | 2 | public InnerClassInfo getOuterClassInfo(ClassInfo ci) {
if (ci != null) {
InnerClassInfo[] outers = ci.getOuterClasses();
if (outers != null)
return outers[0];
}
return null;
} |
35eef781-1c03-482a-bbfc-5b8dedc1f9d5 | 6 | public Boolean loadElGamalKey() {
Console console = System.console();
String message = "Enter the location of the Authority ElGamal public key";
String input;
ElGamalPublicKeyParameters pubKey = null;
while (true) {
try {
System.out.println(message);
input = console.readLine();
pubKey = Importe... |
d96b45db-44d9-4a65-a6cd-b358949e3a97 | 9 | @SuppressWarnings("serial")
public SchemaEditorMenuBar(final BasicGraphEditor editor)
{
final mxGraphComponent graphComponent = editor.getGraphComponent();
final mxGraph graph = graphComponent.getGraph();
JMenu menu = null;
JMenu submenu = null;
// Creates the file menu
menu = add(new JMenu(mxResources.g... |
5e48b00b-5aa6-4971-a399-8fcc4053b017 | 4 | public boolean readBoolean(String pSection, String pKey, boolean pDefault)
{
//if the ini file was never loaded from memory, return the default
if (buffer == null) {return pDefault;}
Parameters params = new Parameters();
//get the value associated with pSection and PKey
String valueText = getValu... |
51beae61-3701-4c8f-a25d-29d83a26c8fb | 3 | public ConfigurationSection getDefaultSection() {
Configuration root = getRoot();
Configuration defaults = root == null ? null : root.getDefaults();
if (defaults != null) {
if (defaults.isConfigurationSection(getCurrentPath())) {
return defaults.getConfigurationSecti... |
d52e1814-3d66-498f-9c7c-9b0036f2e7ee | 9 | private void processNodeTag(Attributes attributes) {
byte[] node = null;
long lastTS = 0;
short lastClockSeq = 0;
for (int i = 0; i < attributes.getLength(); i++) {
String attributeName = attributes.getLocalName(i);
if ("".equals(attributeN... |
12c6efa3-2c72-4fc8-a6a3-19c747013653 | 6 | private void handle_kick(String[] cmd) {
boolean exists = false;
if (!is_admin()) // Only Admin can kick
return;
if (cmd.length != 2) {
cliprint("Wrong parameter count. See \\help for details." + VT100.crlf);
return;
}
for (Enumeration e = cliinfo.elements(); e.hasMoreElements();) {
cli_info nn ... |
3c72920f-1b8f-440c-a4ab-acf1217f9791 | 0 | public String getUser() {
return user;
} |
44f92534-39af-4ed8-8019-724d3144c78f | 2 | @Override
public final Component getTableCellRendererComponent(
final JTable table,
final Object value,
final boolean isSelected,
final boolean hasFocus,
final int row,
final int column)
{
if (value instanceof Program) {
final Program program =... |
7a578d84-467b-4ef0-afb4-ffa15a6d4f44 | 0 | public void removeUndoQueueListener(UndoQueueListener l) {
undoQueueListeners.remove(l);
} |
6ad32678-a3ce-4266-9c21-f11207b5d46a | 8 | public void renderTileWithAlpha(int xp, int yp, Tile tile, int alphaPercentage) {
xp -= xOffset;
yp -= yOffset;
Sprite sprite = tile.getSprite();
for (int y = 0; y < sprite.SIZE; y++) {
int ya = y + yp;
for (int x = 0; x < sprite.SIZE; x++) {
int xa = x + xp;
if (xa < -sprite.SIZE || xa >= width |... |
09324755-ce0f-4fb8-b810-7e6d9a909dd6 | 3 | ComponentAccess lookup(Object cmd) {
if (cmd == null) {
throw new ComponentException("null component.");
}
if (cmd == ca.getComponent()) {
throw new ComponentException("Cannot add the compound to itself "
+ cmd.toString());
}
ComponentAccess w = oMap.get(cmd);
if (w == null) {
oMap.put(cmd, w ... |
6f830608-d087-4901-a2c1-97f9bce1de66 | 5 | @Override
public Node beforeDecode(mxCodec dec, Node node, Object into)
{
if (into instanceof mxRootChange)
{
mxRootChange change = (mxRootChange) into;
if (node.getFirstChild() != null
&& node.getFirstChild().getNodeType() == Node.ELEMENT_NODE)
{
// Makes sure the original node isn't modified
... |
04f493df-b98c-4463-916a-36253ea8e3c5 | 2 | private void updateGameQueue(GameTime gameTime) {
// Iterate and call the start ups of any hudItems which are
// waited to be added to the HUDSystem explicitly
for (IHudItem hudItem : hudItemQueue.getAllWaiting()) {
hudItem.startUp(gameTime);
}
// Get the list of HUDItems which wanted to be removed from t... |
d5d567ca-116f-4c2a-96c3-c2fc5339e2ad | 7 | public Tilemap(String path, int dimension, boolean setCurrent) {
// TODO - Save all tile textures on one texture
block = Texture.getTexture("block");
block.setSize(dimension, dimension);
this.dimension = dimension;
// TODO - Load a tile map from file
glBindBuffer(GL_ARRAY_BUFFER, Game.VBO.get(0));
vtBu... |
1b6a85ce-73fc-4596-a42e-279533118bdf | 6 | @Override
public Anomaly.AnomalyLevel checkPoint(Point point) {
if (globalOverview.isEmpty()) {
lastTimeStamp = point.getTime();
}
long currentTimeStamp = point.getTime();
while (currentTimeStamp - lastTimeStamp > globalOverviewInterval) {
globalOverview.rem... |
852a84a7-1abe-4ee2-939a-2cac7112365d | 7 | public String getMacro()
{
String macro = null;
// Have a shape with an embed?
OOXMLElement oe = getObject( SP );
if( oe != null )
{
macro = ((Sp) oe).getMacro();
}
// how's about a picture?
if( macro == null )
{
oe = getObject( PIC );
}
if( (oe != null) && (macro == null) )
{
macro = ... |
2d652376-defb-4575-9a1d-3cea9499ffbf | 8 | private boolean isValidNumber(String text) {
if (text.endsWith("1") || text.endsWith("2") || text.endsWith("3") || text.endsWith("4") ||
text.endsWith("5") || text.endsWith("6") || text.endsWith("7") || text.endsWith("8")) {
return true;
} else {
return false;
... |
87eea9a6-fd17-412a-827b-1d4f869de108 | 0 | public void closeConsole() {
this.open = false;
} |
3b62b4a2-7248-45bb-a4a0-703de90ed654 | 0 | public List<String> getMessages() {
return messages;
} |
6248f64e-961e-4e6e-a5ab-82ddfac159a6 | 0 | public boolean isEmpty() { return size() == 0; } |
80ac1698-464a-4e8d-97a1-95a40656a513 | 3 | public static synchronized IMySQLConnection getConnection(String databaseName) throws MySQLException, SQLException {
if(sPools == null) { throw new MySQLException("No pool for database: " + databaseName); }
MySQLConnectionPool pool = sPools.get(databaseName);
if(pool == null) { throw new MySQLException("No po... |
cafe7c78-499f-4041-abae-55e9baa8d169 | 6 | public static String getCoastlineCoding(Game game, Position center) {
char[] coding = {'0','0','0','0' };
int row = center.getRow(), col = center.getColumn();
Position p;
int offsetRow[] = { -1,0,+1,0 };
int offsetCol[] = { 0,+1,0,-1 };
// iterate over the four compas directions
// for... |
40c32bf7-8274-48f0-922c-d6d6371ba756 | 5 | public String execute(JavaService js) {
if (args.length < 2) {
return invalidArguments;
}
switch (args[1]) {
case "options":
return loadElectionOptions();
case "rsa":
return loadRSAKeys();
case "elgamal":
return loadElGamalKeys();
case "all":
StringBuilder sb = new StringBuilder();
sb.a... |
befa0501-2dc5-4a12-bec5-b2f55451a291 | 5 | public void showBankAccount(CommandSender player, String bank, String name)
{
Bank Bank = null;
BankAccount account = null;
Holdings holdings = null;
boolean self = Misc.isSelf(player, name);
if (!iConomy.Banks.exists(bank)) {
Messaging.send(player, this.Template.parse("error.bank.d... |
240f25bf-ce6b-4e13-95c3-fa3b62d5b0fd | 8 | public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
/*
* The difference between this impl. and the previous is that, rather
* than creating and retaining a matrix of size s.length()+1 by
* t.len... |
5fbace18-92f3-4b95-8717-ebbe24deb2f9 | 0 | @Override
public void mouseExited(MouseEvent e) {
} |
e0c575eb-1cf1-47c9-906f-d283d6894bb1 | 2 | @Override
@SuppressWarnings("unchecked")
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
CommandContext cc = new CommandContext(sender, cmd, alias, args, annot);
try {
if (mcomplete != null) {
return (List<String>)mcomplete.invoke(cmdinstance, cc);
... |
ab051814-7b5d-4daf-9904-2e509583e4e0 | 3 | private void createSupplyProductList() {
productList = new ArrayList<ArrayList<Product>>();
ArrayList<Product> list;
for (Person supplier : getPersonDB().getSupplierList()) {
list = new ArrayList<Product>();
for (StockItem stockItem : getStockDB().getStockList()) {
Product product = stockItem.getProduct... |
74eff4da-e756-42ee-8b39-ea07280ccade | 0 | public void BusJourneyComplete()
{
/*
* robert add your journey completion code here
*/
/*
* This is clean up code for the bus in preperation for the next trip
*/
//clear the passangers on board
this.passengersOnBoard = 0;
} |
a1fca10a-e896-4919-8294-39e3c7c218a3 | 0 | public void setTile(int x, int y, Image tile) {
tiles[x][y] = tile;
} |
3112e226-a6aa-4ff3-bd31-8e4198d546e7 | 7 | private boolean checkForKey() throws Exception {
String query = m_query;
query = query.replaceAll(" +"," ");
//query has to use all columns
if(!query.startsWith("SELECT *"))
return false;
m_orderBy.clear();
if(!m_DataBaseConnection.isConnected())
m_Dat... |
19fa1206-b9ac-4766-810b-086d21a1188d | 1 | private void setClass( Token token ) {
Table existingTable = null;
String value = token.getValue();
table.setDomName( value );
table.setTableName( camelToCaps( value ) );
// if table already exists, stop parsing.
existingTable = tableMap.get( value );
if ( exist... |
6da48551-d956-45b6-b10c-331bd57a6465 | 6 | private int jjMoveStringLiteralDfa12_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(10, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0);
return 12;
}
switch(curChar)
{
case 3... |
af17d03b-df13-4fe0-a1e3-6aa0036ba2c1 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
c913a170-efe6-470c-9a40-3d8c7299fb1a | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
1e881a38-0737-4066-b6e4-ad0571f58beb | 8 | public void newarray(final Type type) {
int typ;
switch (type.getSort()) {
case Type.BOOLEAN:
typ = Opcodes.T_BOOLEAN;
break;
case Type.CHAR:
typ = Opcodes.T_CHAR;
break;
case Type.BYTE:
typ = Opcodes.T_BYTE;
break;
case Type.SHORT:
typ = Opcodes.T_SHORT;
break;
case Type.INT:
t... |
e2486efb-c0c3-4d9d-b643-a5ece9c5a599 | 2 | public static String readData(InputStream in)
{
StringBuffer sb = new StringBuffer();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
} cat... |
87d60615-b57f-41c8-96ae-dcc3484c15a1 | 0 | public double getPosX() {
return posX;
} |
52ae2c04-5cb8-475a-8155-6ce4a982eb68 | 0 | public EnemyCar() {
//load resources
Initialize();
LoadContent();
// Now that we have carImgWidth we set starting x coordinate.
x = (int) (Framework.frameWidth * 0.60);
} |
d8bcf497-5b44-4c54-bbfb-ee74ce317d63 | 7 | public Deck deckReader(String xmlFile) throws ParserConfigurationException, SAXException, IOException {
Deck deck = new Deck();
File deckXML = new File(xmlFile);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuil... |
eeb21cdf-de94-48bc-a750-b4c3d7d083b2 | 6 | private ArrayList<ExtendedModInfo> examineModPath() {
ArrayList<ExtendedModInfo> list = new ArrayList<>();
String[] entries = modDir.getEntries();
log.info("Examine directory \"" + modDir.getPath() + "\"");
log.info("Found " + entries.length + " entities");
for(String entry : entries) {
IDirec... |
fdd455ac-c8c3-4eda-b57f-29a9a1ade8d8 | 2 | public URL downloadUrl(String genomeVer) {
try {
String version = SnpEff.VERSION_MAJOR;
// Replace '.' by '_'
version = version.replace('.', '_');
String urlRoot = getDatabaseRepository();
StringBuilder urlsb = new StringBuilder();
urlsb.append(urlRoot);
if (urlsb.charAt(urlRoot.length() - 1)... |
dfac0959-d857-4d8e-b144-c1e6c417f488 | 0 | @Override
public void actionPerformed(ActionEvent e) {
Outliner.documentAttributes.configureAndShow(Outliner.documents.getMostRecentDocumentTouched().getTree());
} |
e8e8ffdf-b8bd-4316-8b79-1b90b41ab48e | 8 | private void writeInformation(String key,dir_type type)
{
recourcePanel.removeAll();
HashMap<String, String> information = null;
JLabel lable = new JLabel();
lable.setFont(new Font("Information",0, 30));
if(ref_key_pat.containsKey(key) || ref_key_stu.containsKey(key) || ref_key_ser.containsKey(key)){
swit... |
5bf99714-ad3e-485f-b013-989000021eb5 | 3 | public LayeredPanelList openProject(){
LayeredPanelList lstOut = null;
fc = new JFileChooser(strProjectsDir);
fc.showOpenDialog(compParent);
//System.out.println(fc.getSelectedFile());
try{
if(fc.getSelectedFile() != null){
this.strCurrentProject = fc... |
3aa92c4f-92df-4147-a120-36e6c87447bb | 2 | public static void saveGameData()
{
String output ="savedata/"+idString+".jokes";
try
{
PrintWriter fout=new PrintWriter(new FileWriter(output));
if(VERSION.equals("Peaches"))
fout.println("PDAE"+idString);
else
fout.println("CDAE"+idString);
//Game Vars
fout.println(name);
fout.prin... |
c28a46ca-9369-4501-b50c-ac30232dfe4d | 3 | private boolean bajaUsuarios(HttpServletRequest request, HttpServletResponse response) throws IOException {
ConexionBD con = new ConexionBD();
String[] seleccion = request.getParameterValues("usuarios");
if (seleccion != null && seleccion.length > 0) {
for (int cont = 0; cont < sel... |
70f8330e-f1f7-476b-926a-2f55c0208ca2 | 2 | public static synchronized NetworkSharedUser getUserById(int id) {
for(NetworkSharedUser u : usersOnline) {
if(u.getId() == id) {
return u;
}
}
return null;
} |
5fce3579-0dd5-4597-a8ff-cfc79b21d1cf | 9 | private int paintStr(int i, int sides)
{
// Try to find an empty space of the string
Point position = null;
Rectangle bounds = null;
Shape draw_word = null;
AffineTransform tx = null;
boolean found = false;
Point[] str_vertex = new Point[4];
while (!found)
{
// Set the font
try
{
f... |
c91349be-84ba-402a-aa87-b54bb54748fe | 0 | public static String getFileName(String filepath) {
File file = new File(filepath);
return file.getName();
} |
1b9974cf-3e6b-4a2b-a5f3-b9580e4a8b2a | 0 | public void setTaskId(Integer taskId) {
this.taskId = taskId;
} |
63e4c228-7e45-4329-8f62-2f8cd9bb4fc1 | 0 | public int getX() {
return x;
} |
78ae82ee-6337-4ce8-ad87-0221719d7ec8 | 5 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (args.length > 0) {
switch (args[0]) {
case "craft":
... |
4a0119fe-3d92-4b8c-879e-355d9c147959 | 4 | public char[] getSaleParams() throws Exception
{
char[] params = new char[55];
// Массивы параметров
char[] count_array = Convert.toCharArray(new Double(this.count * 1000).intValue());
char[] price_array = Convert.toCharArray(new Double(this.price * 100).intValue... |
0d81148e-68d4-470e-94c0-d8f6a2934fe0 | 4 | private boolean isNear(int i1, int j1, int i2, int j2){
int idif = Math.abs(i1-i2);
int jdif = Math.abs(j1-j2);
if(idif > -1 && idif < 2 && jdif > -1 && jdif < 2)
return true;
return false;
} |
a88d9a91-64ec-4f91-87bc-c00d04fd422a | 9 | @Override
public boolean equals(Object loan){
if (loan == null)
return false;
Loan l = (Loan)loan;
//first of all, if the two loans are void, they are equal
if(l.isVoidLoan() && voidLoan)
return true;
if((l.isVoidLoan() && !voidLoan) || (!l.isVoidLoan() && voidLoan))
return false;
//System.o... |
08cced95-1310-40f1-88b3-38a49a367190 | 4 | public void removePersons(int persons) {
int i = 0;
try {
int loops = 0;
while (i < persons) {
loops++;
if (items.get(loops) instanceof Person) {
if (!((MovingMapItem) items.get(loops)).dying()) {
((MovingMapItem) items.get(loops)).kill();
i++;
... |
4f37fa0d-c0da-4490-ba6e-eba3bbf379b2 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
5fec5b18-409d-429f-8c57-5b0e488b001a | 5 | private IResult handle(String url, String queryString, String mode) {
IResult result = new ResultPojo();
BufferedReader rd = null;
HttpURLConnection con = null;
try {
URL urx = new URL(url+queryString);
con = (HttpURLConnection)urx.openConnection();
con.setReadTimeout(1000);
con.setRequestMethod(mod... |
d3b605fe-940a-4889-b519-9b4ff86873ea | 7 | public String getPath(String path) {
String split[] = path.split("\\.");
if (split.length <= 0)
return path;
String newPath = "";
boolean set = true;
ConfigurationSection section = file.getRoot();
for (int i = 0; i < split.length; i++) {
if (!set) {
newPath += "." + split[i];
continue;
}... |
afb3e3ea-860b-4573-ae02-f4cb115efde3 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Customer other = (Customer) obj;
if (age != other.age)
return false;
... |
e1e5fdd2-ee60-43fd-9347-568a68da3986 | 4 | public int[] lectura(){
try {
// Apertura del fichero y creacion de BufferedReader para poder
// hacer una lectura comoda (disponer del metodo readLine()).
archivo = new File ("C:\\Users\\Temp\\Desktop\\Cuarto Semestre\\Algoritmos y estructura de datos\\Hoja de trabajo/archivo.txt");... |
ce48f60e-5b80-4d5f-875d-8107fc7ceb80 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!(affected instanceof MOB))
return super.tick(ticking,tickID);
if(!super.tick(ticking,tickID))
return false;
final Room R=((MOB)affected).location();
for(int i=0;i<R.numInhabitants();i++)
{
final MOB M=R.fetchInhabitant(i);
if((M... |
617a10e0-0c78-4398-a08e-24639cff88f8 | 8 | public static ArrayList<Question> getQuestions() {
synchronized (MainInfo.class) {
ArrayList<Question> aryQuestions = new ArrayList<Question>();
try {
for (int i = 0; true; i++) {
{
Class<?> clsQuestion = Class.forName("questions.QuestionW" + i + "_" + 0);
aryQu... |
9f22e814-9840-4bfa-8788-3f08ce3f2d6d | 9 | public static void main(String[]args){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int e = in.nextInt();
TreeSet<Integer> m = new TreeSet<>();
TreeSet<Integer> p = new TreeSet<>();
for (int i = 0 ; i < ... |
3b1eae96-4343-48c2-9c38-157e7891bcd2 | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cachedPath == null) ? 0 : cachedPath.hashCode());
result = prime * result + ((lastChecked == null) ? 0 : lastChecked.hashCode());
result = prime * result + ((linkStatus == null... |
f7802c39-96b9-4e15-a748-a1e8cad35f7b | 5 | private double getAverage(String dsName, String rpnExpression) throws RrdException {
RpnCalculator rpnCalculator = null;
if(rpnExpression != null) {
rpnCalculator = new RpnCalculator(rpnExpression);
}
double vals[] = getValues(dsName);
double totalVal = 0;
long totalSecs = 0;
for(int i = 0; i < vals.le... |
61bb9908-6d74-4900-88dd-1c387096ef7a | 4 | private static List<String> reproduceSentence(final Map<Integer, Set<String>> words, final int[] indexes, int phoneLength) {
List<String> sentence = new LinkedList<String>();
for (int i = 0; i < indexes.length && indexes[i] != -1; i++) {
int startIndex = indexes[i];
int endIndex ... |
8eb787e1-edcd-43e2-a84c-e2bd11537951 | 2 | public void setProtected(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int mod = methodInfo.modifiers();
if (flag) {
mod |= Modifiers.PROTECTED;
} else {
mod &= ~Modifiers... |
e5043b32-8378-406d-8e07-762878ea7401 | 4 | private static boolean containsOpCode(int[] opCodeClass) {
assert(_opCode != 1 && _opCode != 0 && _opCode != 28);
for (int i = 0; i < opCodeClass.length; i++) {
if (_opCode == opCodeClass[i]) {
return true;
}
}
return false;
} |
c6504450-fe79-4fcd-9873-ca722957656a | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return id == user.id && this.hashCode() == user.hashCode();
} |
269aaa2d-11ec-4aa5-9e9d-7477b066f94d | 9 | private void buildFieldRef() {
// if (editableElements.size() == 0 || editableTextFields.size() == 0) {
// Build up a reference to the screens to make the status, reset and addProcessStatus easier
Field[] fields = this.getClass().getDeclaredFields();
for (Field field : fields) {
// As long as I ... |
603101c0-3c3c-469b-b75b-cdbc02ada2e6 | 3 | public static void main(String[] args)
{
int port = 9090;
String ip = "localhost";
if (args.length == 2)
{
port = Integer.parseInt(args[0]);
ip = args[1];
}
try
{
Test test = new Test();
ChatClient tester = new C... |
bb49c9ed-e85c-4664-bfe6-344c5bcbf9db | 0 | public DeviceInfoType getDeviceInfo() {
return deviceInfo;
} |
4cbdcb27-3fff-49f0-9ec5-5ae3425fa83f | 5 | private void loadRandomSplashes() {
try {
// Total number of screens to display
int totalScreens = 1;
// Used in display screens randomly
// All of this is mostly unused
List<Integer> usedInts = new LinkedList<Integer>();
// Text file containing names of images for splash screens
BufferedReader r... |
72c66e13-1a8e-4ad0-8285-09a5ee9870ee | 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 Cliente)) {
return false;
}
Cliente other = (Cliente) object;
if ((this.id == null && other.id != null) || (thi... |
6dba90f5-ed6a-49fb-87a8-041dadb039d4 | 0 | public IUserDao getUserDao() {
return userDao;
} |
27f8c012-499c-4cf1-9c51-4010fddd80ba | 5 | public static void menuRemove(HousePetList hpArray)
{
HousePet housepet = new HousePet();
HousePet removedHP = new HousePet();
@SuppressWarnings("resource")
Scanner console = new Scanner(System.in);
int aChipID = -1;
String outputStatement = "";
/* di... |
6e4ad19b-7666-40c6-8340-60befaffae31 | 8 | private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... |
cf261a61-3de1-46b2-801e-b069eb449a4f | 5 | public void run() {
decompiler.setOption("verbose", verboseCheck.getState() ? "1" : "0");
decompiler.setOption("pretty", prettyCheck.getState() ? "1" : "0");
errorArea.setText("");
// /#ifdef AWT10
// / saveButton.disable();
// /#else
saveButton.setEnabled(false);
// /#endif
lastClassName = classFiel... |
5cbdc1b6-5c66-465a-8db1-37e806bfc9ac | 8 | public boolean executeMouvement() {
int tabXY[ ] = new int[2];
boolean positionOK=true;
Carte carte = null;
int compteur=0;
if (Carte.isCreated()){
carte = Carte.getInstance(0, 0, 0, null);
}
if (carte!=null){
carte.getCartePanel().getTabLignes().get(chevalier.getPositionX()).get(chevalier.getPos... |
6e079f53-4c14-41fa-a339-4aa346f09f4a | 0 | public SpaceShipDelegation(String name) {
this.name = name;
} |
f185bdc7-994a-438a-b1d7-cf696075e398 | 2 | private XMLReader createNewXmlReader() {
try {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); // Disable
// DTD
// validation
parserFact... |
cf67b7e7-30a5-4dde-bde7-0e7a9fc31c56 | 7 | public static String resultString(int width,List<Board> boards) {
String ret="";
String[] lines=new String[8];
for (int i=0;i<8;i++) lines[i]="";
for (int bdi=0;bdi<boards.size();) {
for (int j=0;(j<width)&&(bdi<boards.size());j++,bdi++) {
String[] bdLines=boards.get(bdi).toString().split("\n");
for ... |
2ef37653-afd3-40d6-b1a1-5ee75658875b | 4 | private void parse_require( String line,
String keyword,
String[] split,
int lineNumber,
boolean strictMode )
throws ParseException {
// Line has the format:
// "Require" {"Group"|"User"} [UserList|GroupList]
if( split.length < 2 ) {
throw new ParseException( "Invalid '"+keyword+"' declarati... |
119793c2-2e8a-4f0d-9068-b84fe08d76a0 | 3 | public Resolution newOrderForm() {
HttpSession session = context.getRequest().getSession();
AccountActionBean accountBean = (AccountActionBean) session.getAttribute("/actions/Account.action");
CartActionBean cartBean = (CartActionBean) session.getAttribute("/actions/Cart.action");
clear();
if (acco... |
05d3644a-a092-4f37-abc2-a93d8e4682fb | 8 | * @param yPos y coordinate
* @param ySp 1 for down, -1 for up
* @param xSp 1 right, -1 for left
* @return
*/
private boolean checkDir(int xPos, int yPos, int ySp, int xSp){
StringBuilder sb = new StringBuilder(xPos + "," + yPos);
int p = board[yPos][xPos];
int totalCount = 1;
short doItTwice = 2;
... |
0d7c888e-86c6-4d75-a7e8-52ad6a552b92 | 7 | public void unknownInstruction(int pc, int op) {
switch (op) {
case SLEEP:
cycles += 100;
break;
case LOAD_FILE:
if (acc == 0)
monitor.info("**** LOAD FILE! ***** PC = " +
Integer.toString(pc, 16) + " => " +
Integer.toString(rindex, 16));
else
... |
bb130ba0-bb1a-4455-8033-e3cd2077c7b8 | 8 | public static boolean isObstacle(byte a_data)
{
return a_data != MAP_NOTHING && //nothing
a_data != MAP_SOFT_OBSTACLE && //border hill, jumpable from the bottom.
a_data != MAP_SIMPLE_BRICK && //Breakable brick
a_data != MAP_QUESTION_BRICK && //Unbreakable bri... |
2622e801-be61-4d3a-b2fd-3e684be65185 | 2 | public void gameInit() { //creates stuff
ball = new Ball(); //creates the ball
paddle = new Paddle(); //creates the paddle
bg = new Background(0,0);
bullet = new Bullet();
int k = 0; //this whole things creates the bricks from the array (30 bricks in total)
for (int i ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.