method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8c7fc3b6-844d-4f51-b323-a039da2debd0 | 4 | * @return
*/
public ImageHandle getImageByMsoIndex( int index )
{
if( imageMap == null )
{
return null;
}
Iterator<ImageHandle> ir = imageMap.keySet().iterator();
ImageHandle ret = null;
while( ir.hasNext() && (ret == null) )
{
ImageHandle im = ir.next();
if( im.getMsodrawing().getImageIndex(... |
c51ec0b4-dc87-4839-9ac6-c12ca61f44c8 | 4 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
ProxiedPlayer player = (ProxiedPlayer) sender;
if (plugin.blockedTeleports.contains(player.getServer().getInfo().getNa... |
a4300ce3-fa83-4309-85d6-71bb83a19c1d | 0 | @Basic
@Column(name = "FUN_MM")
public Integer getFunMm() {
return funMm;
} |
d8af2802-8479-4ba5-8f87-a1bfe85b8e56 | 8 | public static void setLevel(int lvl)
{
if( logger == null )
return;
level = lvl;
switch( level )
{
case DebugLevel.OFF:
logger.setLevel(Level.OFF);
break;
case DebugLevel.ALL:
logger.setLevel(Level.ALL);
break;
case DebugLevel.DE... |
a7754718-0cf7-48fa-815d-a814b9244443 | 6 | @EventHandler
public void IronGolemJump(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.getIronGolemConfig().getDouble("IronGolem.J... |
49c4543f-cd3d-42b4-85fb-ed80e285fe34 | 2 | public void run(){ //void run method for the threads
launchPad(shell); //Calls the launchpad method on the shell
shell.open(); //Opens the shell
while (!shell.isDisposed()){ //while the shell isn't disposed
if (!display.readAndDispatch()) //If there is no event on the event queue
display.sleep(); //Put th... |
0043e7f3-1e79-469a-9800-6aec57d18a21 | 9 | public static void main(String args[]){
SisalocaIF sistema = new Sisaloca();
try {
sistema.cadastraProfessor("Maria", "9999");
sistema.adicionaDisciplina("Cálculo", "1234");
sistema.adicionaTurma("1234", 1);
sistema.cadastraHorarioTurma("1234", 1, Horario.SEGUNDA, 8, 10);
sistema.cadastraHorarioTurma... |
047a10b9-d5cd-431a-a2b5-8bdef73922ff | 6 | @Override
public void fileChoosed(String filePath, int code) {
this.setVisible(true);
if (filePath.length() > 0) {
if (code == FILE_CHOOSER_CODE_SOURCE_FILE) {
sourceFileField.setText(filePath);
} else if (code == FILE_CHOOSER_CODE_SOURCE_IMAGE) {
... |
33e2e691-dd7c-47a1-ac96-ade540df3a2b | 2 | public Color getAttackColor() {
Color attackColor = Color.cyan;
for (GameAction currentGameAction : getGameActions()) {
if (currentGameAction.hasAnAttack()) {
return currentGameAction.getAttackData().getColor();
}
}
return attackColor;
} |
2fa87e55-aba0-4c36-a1c5-7b77922ab49f | 5 | @Override
public void update() {
// TODO Auto-generated method stub
player.update();
player.checkAttack(enemies);
bg.setPosition(tileMap.getx(), 0);
if(devil.isDead()){
gsm.setState(GameStateManager.LEVEL13STATE);
}
tileMap.setPosition(
0,
GamePanel.HEIGHT / 2 - player.gety());
... |
b8fa605f-eeb9-4ba1-902c-55370dd64792 | 6 | public ArrayList<String[]> read(String filename) {
file = new File(filename);
// Specify the regex used for splitting the line
String regex = ",|\\|";
ArrayList<String[]> contents = new ArrayList<String[]>();
try {
reader = new BufferedReader(new FileReader(file));
// Ignore the first line
... |
08af5ac8-677b-4923-b21d-1db21d474a00 | 2 | public boolean checkEndFightMonster(){
boolean checking = true;
int counter = 0 ;
int i = 0;
while(i <numMonster){
MonsterSlots slot = monsterTurn.remove();
if(slot.checkDefeated() == false)
checking = false;
//counter++;
monsterTurn.add(slot);
i++;
}
return checking;
} |
0962877f-e565-4eb5-b81d-e507b600fbf6 | 6 | private void performGetStatus() {
//TODO: Conditions for STATUS_ZERO and STATUS_UNKNOWN_ERROR
if (!checkForVacuum()) {
dcpu.registers[2] = 0; //Note: Specification doesn't state that this should be set to anything
dcpu.registers[1] = STATUS_NOT_IN_A_VACUUM;
} else if (!checkForFuel()) {
dcpu.registers[2]... |
64007923-5aad-4db2-a95a-fab2cd90b9d4 | 8 | private static boolean extractLastIf(DoStatement stat) {
// search for an if condition at the end of the loop
Statement last = stat.getFirst();
while (last.type == Statement.TYPE_SEQUENCE) {
last = last.getStats().getLast();
}
if (last.type == Statement.TYPE_IF) {
IfStatement lastif = ... |
53d8f35d-0fa4-4c9a-9053-b1327ef00d8b | 7 | public boolean numericReceived(int num, String val, String msg) {
synchronized (map) {
boolean retval = false;
String id = getID(num, val, msg);
Container container;
if (contains(starterNums, num) && !map.containsKey(id)) {
container = new Container(id, getInitObject(id));
map.put(id, container);
... |
e02b18d9-f76e-4f7a-b238-1fb817181128 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("rawtypes")
ImmutableStack other = (ImmutableStack) obj;
if (head == null) {
if (other.head != null)
return false;
}... |
ad9cab1e-44fc-454d-a5f4-efce20afe9ae | 8 | void sendStickyTable(final long clusterId) {
final ArrayList<ClusterPacket> lcp = new ArrayList<ClusterPacket>();
if (true) {
final ClusterPacket packet = context.allocateClusterPacket();
packet.rawType(ClusterPacket.CLUSTER_MSG_TYPE_SYNC_BEGIN);
lcp.add(packet);
}
for (final StickyStore<InetAdd... |
de8b32d8-1d9a-4b64-838e-10e92a0042c0 | 6 | @Override
public int compareTo(SimpleVersion other) {
if (this.major > other.major) {
return 1;
}
if (this.major < other.major){
return -1;
}
if (this.minor > other.minor) {
return 1;
}
if (this.minor < other.minor) {
return -1;
}
if (this.patch > other.patch) {
return 1;
}
if (thi... |
bca24bea-659c-455e-84b1-18793027874e | 5 | protected static boolean isPrimeAdaptative(long number) {
if (number == 1) {
return false;
}
if (isEven(number)) {
return (number == 2) ? true : false;
}
for (long i = 3; i <= (number / i); i+=2) {
if ((number % i) == 0 ) {
return false;
}
}
return true;
} |
c4878d41-7cac-47a3-828b-fa333074592a | 8 | private static TwitterResponseWrapper sendRequestAppAuthGet(String baseUrl, Hashtable<String, String> httpParams, String authHeader) {
HttpURLConnection conn = null;
InputStream is = null;
TwitterResponseWrapper response = new TwitterResponseWrapper();
try {
String combinedHttpUrl = baseUrl;
if(!httpPa... |
80c52122-22d7-4feb-86ba-d00d4eedd774 | 7 | private synchronized void saveResult() {
int maxScore = -1;
for(ClientGameTread cgt : playerThreads) {
if(cgt.playerState.getScore() > maxScore) {
maxScore = cgt.playerState.getScore();
}
}
boolean isDraw = true;
for(Clien... |
af00c95f-0cc6-4170-99f4-75b3a6a0054f | 6 | public static void move(Avatar name, String direction){
Room location = name.getCurrentLocation();
if (direction.equals("north")||direction.equals("east")||direction.equals("south")||direction.equals("west")){
if (location.validateConnection(direction)) {
if (location.isOpen(... |
7bcb8b61-2579-446e-9348-ecd9fa223258 | 3 | private void drawPath(Speed speed) {
Tile parent = end.getParent();
while (parent != null) {
if (!parent.getState().equals(State.START)) {
parent.setState(State.PATH);
}
parent = parent.getParent();
try {
Thread.sleep(speed.... |
5ff0b4a3-ea12-4b82-b164-e640140aec12 | 5 | private void changeGender() {
characterModelChanged = true;
for (int type = 0; type < 7; type++) {
characterEditIdentityKits[type] = -1;
for (int kit = 0; kit < IdentityKit.count; kit++) {
if (IdentityKit.cache[kit].widgetDisplayed
|| IdentityKit.cache[kit].partId != type
+ (characterEditCha... |
79c416ba-cb07-4167-aec4-c10ac32773d6 | 5 | public static boolean readUserSelectedFile() {
if (fileDialog == null)
fileDialog = new JFileChooser();
fileDialog.setDialogTitle("Select File for Input");
int option = fileDialog.showOpenDialog(null);
if (option != JFileChooser.APPROVE_OPTION)
return false;
File selected... |
4a7cb483-6c77-40d9-99ed-741e84399571 | 1 | public String getFilePath(){
int last = fileName.lastIndexOf("\\");
if(last == -1) last = fileName.lastIndexOf("/");
return fileName.substring(0, last+1);
} |
dee5abcf-7c1b-4374-b26d-5de19490dedd | 9 | public void keyReleased() {
if (key == 'e') {
//println("called");
drawMode=false;
editMode=true;
}
if (key == 'd') {
drawMode=true;
editMode=false;
}
if (key == 'c') {
showCorners=!showCorners;
}
if (key == 'n' && editMode && showCorners) {
showCorner = model.corner... |
5a121d77-4360-4670-bd70-951e8c75ea43 | 5 | private void fireBreath (Player p, int level, ItemStack i) {
System.out.println("FireBreath has been called for player " + p.getDisplayName() + ".");
int fireDuration = 0;
int breathDuration = 0;
int cooldown = 200;
if (level == 1) {
fireDuration = 60;
breathDuration = 80;
} else if (level == 2)... |
c7ecae5a-b7fd-4316-b08b-66bfe81250aa | 8 | public static OOXMLElement parseOOXML( XmlPullParser xpp, Stack<String> lastTag, WorkBookHandle bk )
{
SpPr sp = null;
String size = null; // size element: val is only attribute + no children
String symbol = null; // symbol element: val is only attribute + no children
try
{
int eventType = xpp.g... |
52065936-edc6-44c2-9edf-a3a7b5e29b52 | 2 | public static JPanel tabPieces(){
JFrame fen = new JFrame("Pieces disponibles");
JPanel pan = new JPanel();
pan.setSize(400, 100);
pan.setLayout(new GridLayout(6,2));
JButton roin = new JButton(new ImageIcon("src//main/java/images/roin.gif"));
roin.setSize(200, 16);
tabPiece[0][0] = roin;
JButton roi... |
c8045a9a-be45-4c83-9cb4-56914eaf7ce0 | 1 | private void updatedownloads(List<Download> downloadsList) {
for (Download download : downloadsList) {
updatedownload(download);
}
eventBus.fire(new DownloadsUpdatedEvent(getDownloadsListFiltered()));
} |
e0197655-04ae-461f-81ba-a73752e90489 | 0 | private void initTextFild(){
nameAlgorythm = new JLabel("test");
nameAlgorythm.setFont(new Font(nameAlgorythm.getFont().getName(),Font.BOLD,20));
nameAlgorythm.setBounds(INDENT_LEFT,INDENT_UP,getWidth()-INDENT_LEFT*2,nameAlgorythm.getFont().getSize()+5);
JLabel labelTotalPoints = new ... |
b6a62097-42fe-4610-be31-5bca49b39f51 | 4 | public void click(int mouseX, int mouseY, int dX, int dY) {
if (mouseX >= dX && mouseX < dX + _nX * _cellWidth &&
mouseY >= dY && mouseY < dY + _nY * _cellHeight) {
int cellX = (mouseX - dX) / _cellWidth;
int cellY = (mouseY - dY) / _cellHeight;
_gameLogic.clickOn(cellX, cellY);
}
} |
7b41eb40-7028-4092-b184-2445996d93d2 | 7 | public boolean getCanSpawnHere()
{
if (worldObj.rand.nextInt(3) == 0)
{
return false;
}
if (worldObj.checkIfAABBIsClear(boundingBox) && worldObj.getCollidingBoundingBoxes(this, boundingBox).isEmpty() && !worldObj.isAnyLiquid(boundingBox))
{
int i = Ma... |
734d9049-f935-477f-90f9-60c18aeff042 | 6 | public static boolean getRoadsData(String pathName)
{
DocumentBuilderFactory docBuilderFactory;
DocumentBuilder docBuilder;
Document document = null;
try {
docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilder = docBuilderFactory.newDocumentBuilder();
document = docBu... |
47662a51-75a4-4da4-9c5b-504e679cf43e | 4 | private static void processDirective(WebDriver driver, Directive direc) throws InterruptedException {
Thread.sleep(1000);
if(direc instanceof HasElementDirective) {
HasElementDirective directive = (HasElementDirective)direc;
By byXPath = By.xpath(directive.getElementFinderXPath... |
383e87ec-9d18-4cbc-bf5f-4d3d9cca5a13 | 4 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == showAnswer){
if(showAnswer.isSelected()){
show = true;
areaF.setTextArea(Question.readCellContent(7, row));
}
else{
show = false;
areaF.setTextArea("");
}
}
if(e.getSourc... |
3eb1c9b2-3a14-4375-abe0-f363ff7b0e3f | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == okBtn) {
try {
double[] v = new double[flds.length];
for (int i = 0; i < flds.length; i++) {
v[i] = Double.parseDouble(flds[i].getText());
}
x = new ColumnMatrix(v);
ok = true;
setVisible(false);
} catch (N... |
a4eb0f04-58e3-4fb5-b376-d46cdae7717f | 2 | public boolean pollerr (int index) {
if (index < 0 || index >= this.next)
return false;
return items [index].isError();
} |
89dc0472-c51f-48e2-a5ab-ac19c837e466 | 4 | public static void main(String[] args)
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException ex)
{
Logger.getLogger(VMainWindow.class.getName()).log(Level.SEVERE, null, ex);
}
c... |
872293d9-fd3b-4c7b-8358-1eec23e95d02 | 4 | public int selectToHome(boolean extend) {
if (mSize > 0) {
if (extend && !isEmpty()) {
if (mAnchor < 0) {
mAnchor = lastSelectedIndex();
}
select(0, mAnchor, true);
} else {
select(0, false);
}
return 0;
}
return -1;
} |
1ef18dfe-b4eb-480e-bfd1-a0b5fdfbbb4a | 8 | final public void Function_parameter_list() throws ParseException {
/*@bgen(jjtree) Function_parameter_list */
SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_PARAMETER_LIST);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
... |
e39c3816-f6c7-4ca2-aa5d-dc5a26c19c5a | 6 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ServletContext sc = this.getServletConfig().getServletContext();
String localPath = sc.getInitParameter("ottzRimagePath");
HttpSession session... |
adcbbc1d-4339-410a-9755-b2b54118dfda | 5 | public void reloadPlayerCommands() {
playercommands.clear();
try {
ClassFinder classFinder = new ClassFinder();
String[] classes = classFinder.listClasses("net.sf.odinms.client.messages.commands.player", true);
registerPlayerCommand(new HelpPlayerCommand()); // regist... |
69323bc4-6a07-4365-bf4f-76af77168670 | 7 | void disconnect() {
ClientLogger.info(Client.class, RemoteResourcesLocalization.getMessage(
RemoteResourcesMessages.Client_Info_DisconnectingFromServer,
new Object[] { hostname, port }), null);
deviceChangesThread.cancel();
for (String dataConnection : dataConnections.keySet()) {
ClientConnectionMana... |
afc8c161-9fba-41ad-89a8-f818147cb20b | 1 | public CallGraph getCallGraph() {
if (this.callGraph == null) {
// Create a new CallGraph
this.callGraph = new CallGraph(this, this.roots);
}
return (this.callGraph);
} |
a6db8890-f774-4dad-bcfb-67a154db5231 | 7 | public static void main(String [] args) {
int charCount = 0;
for (int i = 1; i < 1001; i++) {
int o = i % 10; // ones
int t = (i / 10) % 10; // tens
int h = (i / 100) % 10; // hundreds
String hundredPrefix="";
if (h!=0) {
hundredPrefix = digits[h] + " hundred";
if (i%100 != 0) {
... |
14a635fe-3c9f-4f13-ae7e-5b615ebde1de | 7 | public boolean errorChecking()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:TetrisDataBase";
Connection con = DriverManager.getConnection(url);
Statement stmt = con.createStatement();
userNameList.clear();
ResultSet rs = stmt.executeQuery("SELECT Username FROM Hi... |
8351097d-0108-4151-b451-743aff628dee | 8 | public static void main(String[] args) {
CommandLine cmd = createOptions(args);
GeneratorError result = GeneratorError.NO_ERROR;
try {
//Build the output name, by default ./output
String directory = cmd.getOptionValue("output", "./");
if (!directory.endsWith(File.separator))
directory += File.separa... |
38d38bee-956a-4766-8b4d-12ad004cd240 | 4 | public String generate() {
String error = "No errors.";
if (details)
System.out.println("TileBorders flags: PRODUCE="+ioflags.PRODUCE+", SAVE="+ioflags.SAVE+", LOAD="+ioflags.LOAD);
if (Utils.flagsCheck(ioflags) != 0) {
System.out.println("ERROR: IOFlags object is corrupted, error: "+Utils.flagsCheck(... |
092dade9-e4a6-4528-b67d-a7ac1b9f17d0 | 7 | public static void checkCaddieLifetime (Connection conn) throws BDException {
String requete = "select duree_vie_cad from config";
Statement stmt = null;
ResultSet rs = null;
try {
conn = BDConnexion.getConnexion();
stmt = conn.createStatement();
rs = stmt.executeQuery(requete);
boolean delete = ... |
8d177470-404b-4031-b9fa-b657e36426b9 | 1 | public static LineaAereaDAO getInstance(){
if (instance==null) {
instance= new LineaAereaDAO();
}
return instance;
} |
9c9c220f-d455-4a61-92c6-49ae34be2aed | 6 | public static List<GenbankAnnotations> getGenbankAnnotations(File file)
throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(
file));
List<GenbankAnnotations> returnList = new ArrayList<GenbankAnnotations>();
String nextLine = reader.readLine();
while(! nextLine.startsWi... |
d8b543ef-b541-4694-8f51-b9243423a594 | 8 | @Override
public List<Cell> createCells(Line quotedLine) {
String quotes = quotedLine.getRawLine();
List<Cell> cells = new ArrayList<>();
int headerIndex = 0;
for (int i = 0; i < quotes.length(); i++) {
StringBuilder quotedValues = new StringBuilder();
char c ... |
74c1b78c-833a-4d66-86db-9a8e52e4bdb8 | 7 | public static List<List<Integer>> zigzagLevelOrder(TreeNode root) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
List<TreeNode> stack = new ArrayList<TreeNode>();
int start = 0;
int end = 0;
if (null != root) {stack.add(root);end = 1;}
boolean l2r = true;
... |
b54f4cde-6502-4e0f-b3e6-4e678701a9ce | 5 | private void processResolveFrame(int channelPtr,
int ctype,
int flag,
ByteBuffer data) {
OpenRequest request;
Channel channel;
ChannelError error;
ByteBuffer path;
syn... |
ce38d5c5-c500-45b3-9a70-28052fe050e5 | 2 | private void initialize() {
frmProgrammingContestSystem = new JFrame();
frmProgrammingContestSystem.setTitle("Programming Contest System");
frmProgrammingContestSystem.setBounds(100, 100, 450, 249);
frmProgrammingContestSystem
.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridBagLayout gridBagLayout = ... |
2097e6b1-c809-4a8c-bf8e-0311cb905a4c | 9 | public void testForLoop(String[][] steps){
for(int i = 1; i< steps.length; i++){
if(steps[i][0].equalsIgnoreCase("Y")){
if("open_browser".equalsIgnoreCase(steps[i][4])){
wd = GetExcelData.open_browser(steps[i][7]);
System.out.println(steps[i][3]+" -- "+steps[i][4]);
}else if("navigate_to".e... |
1bbfc92c-cf3f-4a95-b28d-3e537703e673 | 1 | @Override
public int hashCode() {
int hash = 3;
hash = 97 * hash + (this.getValue() != null ? this.getValue().hashCode() : 0);
return hash;
} |
80cf0e54-2067-40be-b1b1-6dd2d897e3fe | 1 | private void placerPionsJoueurs()
{
for (Pion pion : Pion.values())
{
pion.deplacerPion(pion.lieuInitialPion().positionsDuLieu().get(0));
}
} |
731404dd-2ea5-4dd8-a4fe-37c156fa7904 | 9 | @Override
protected final void waitForBattleEndImpl() {
eventManager.clearAllEvents(false);
graphicsProxy.setPaintingEnabled(false);
do {
// Make sure remaining system events like e.g. are processed this round
try {
eventManager.processEvents();
// The exceptions below are expected to occur, and h... |
ad1de071-c888-4568-8db0-3f4b5b1fba6a | 4 | public static BufferedImage drawMBRs(BufferedImage screenshot) {
// get game state
GameStateExtractor game = new GameStateExtractor();
GameStateExtractor.GameState state = game.getGameState(screenshot);
if (state != GameStateExtractor.GameState.PLAYING) {
screenshot = VisionUtils.convert2grey(screenshot);
... |
c561c820-c63c-43a1-8801-cfff0d7a1442 | 7 | public Parser(){
String input = Utilities.ReadStringFromInput();
List<String> list = Arrays.asList(input.split("\n"));
Iterator<String> it = list.iterator();
String line = it.next();
if(line.substring(0,2).equals("%V")){
FillNonTerminalSymbols(line);
line = it.next();
};
// ... |
5c3377b2-5718-484e-9ae1-e72a731bc270 | 6 | public static void main(String[] args) throws IOException {
Options options = getOptions();
CommandLine line = getCommandLine(options, args);
InputStream in = System.in;
PrintOutputStreamWrapper out = new PrintOutputStreamWrapper(System.out);
if (line.hasOption("help")) {
... |
67620c44-d45e-438d-b9e6-dea061302989 | 4 | public LinkedList<ReservationStation> runCycle() {
LinkedList<ReservationStation> done = new LinkedList<ReservationStation>();
for (int i = 0; i < stations.length; i++) {
for (int j = 0; j < stations[i].length; j++) {
if (stations[i][j].isBusy() && stations[i][j].exec()) {
done.add(stations[i][j]);
... |
ce6ed1bd-a204-4baf-b7ed-c11ffa4b61c4 | 8 | public PrimitiveOperator combineLeftNLeftOnMid(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 2 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[0]) ? 2 : 0) | 1]; //001
newTruthTable[2] = truthTable[((ot... |
92423e05-937f-4362-91b0-221ca66a2754 | 5 | public boolean hasCycle(ListNode head) {
if(head == null || head.next == null){
return false;
}
ListNode fast = head;
ListNode lower = head;
while(fast != null && fast.next != null ){
lower = lower.next;
fast = fast.next.next;
if(lower == fast ){
return true;
}
}
return fal... |
625ff662-fade-44cb-9386-f2be966095b9 | 8 | public static int getLeaderIndex(int[] input) {
if (input.length < 1) return -1;
int size = 1;
int value = input[0];
int valueIndex = 0;
for (int i = 1; i < input.length; i++) {
if (size == 0) {
value = input[i];
valueIndex = i;
... |
ee04cec6-90e8-4b88-95bd-a415ae981772 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != d.getClass()) { return false; }
if (obj == this) { return true; }
Data Data = (Data) obj;
String[] excludeFields = {"id", "sensorId", "sensor"};
return EqualsBuilder.reflectionEquals(d, Data, excludeFields);
} |
39991b90-5af1-48fa-8717-d8e344404936 | 8 | private void init() {
try {
Class<?> examples = Reflector.classForName(name);
Constructor<?> constructor =
examples.getDeclaredConstructor();
Reflector.ensureIsAccessible(constructor);
o = constructor.newInstance();
System.out.println(... |
c7ffac24-4f55-4010-a50a-476f8d170731 | 8 | private boolean doVote(Student Stud) {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String query;
try{
conn = panel.connPool.getConnection();
query = "SELECT VOTED FROM eligible_students WHERE id = ?";
stmt = conn.prepareStatement( query );
stmt.setString( 1 , St... |
af5d459c-2884-42f9-8d16-354afc676896 | 1 | private static int getInteger(StringTokenizer tokenizer, int def) {
try {
return Integer.parseInt(tokenizer.nextToken().trim());
} catch (Exception exception) {
return def;
}
} |
3a59b85b-ab68-4970-baf2-00213e750871 | 5 | @Override
public List<Album> getAlbums() throws RemoteException {
List<Album> albums = new ArrayList<Album>();
File file = new File(path.concat(albumsSERFile));
if(file.exists()){
try {
FileInputStream fileInputStream = new FileInputStream(path.concat(albumsSERFil... |
be46764d-3131-4ed4-bebf-a7c980ee6aa6 | 8 | protected void loadServices() throws ApplicationException {
String packag = config.getProperty(Config.SCAN_PACKAGE);
if (packag == null) {
log.warn(MessageFormat.format("{0} is null. You can set it in your configuration properties.", Config.SCAN_PACKAGE));
} else {
Reflections reflections = ne... |
0893c28f-9974-4d88-9b7b-f6c6a6366a90 | 8 | private boolean isComplementary(String first, String second){
if(first.equals("A")){
if(second.equals("T")){
return true;
}else{
return false;
}
}else if(first.equals("T")){
if(second.equals("A")){
return true;
}else{
return false;
}
}else if(first.equals("C")){
if(second.equa... |
b119870b-0d2d-4ced-a3ec-f73bfdc7495a | 6 | public void reponerProd(AlmacenLocal alm,Producto prod,int cantidad) throws NumberFormatException, Exepciones{
Producto pr=this.buscarProd(prod.getId());
String[] prodPerm=this.buscarProdPerm(prod.getNombre());
if(pr.getCantidad()>=cantidad){
alm.buscarProd(prod.getId()).setCantidad(cantidad);
pr.setCantida... |
12b4d5b7-ca2e-4d31-a2d2-a408ddb49f62 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposItemsTaxesEntityPK that = (PhpposItemsTaxesEntityPK) o;
if (itemId != that.itemId) return false;
if (Double.compare(that.percent, percent... |
3e712430-6e4f-4af0-ba85-9a12bfeb04ab | 0 | public void setStrada(String strada) {
this.strada = strada;
} |
7178e257-7f49-48de-9919-2a9889c5773f | 5 | @Override
public void run() {
try {
ServerSocket s = new ServerSocket(this.port);
Socket clientsock = null;
Client client;
while (true) {
try {
client = new Client(this, clientsock = s.accept());
System.out.println("Client connected");
client.start();
System.out.println("Client... |
f55149ef-d1b7-42ff-a539-bf6df273aa19 | 7 | public static void main(String args[]){
EventManager manager = new EventManager();
Event e = new Event(new Date(), "TEST", "HERE", "THIS IS A TEST");
manager.addEvent(e);
if(!manager.getEvent(e.getId()).equals(e)){
System.out.println("ERROR in get");
}
if(!manager.removeEvent(e).equals(e)){
System.out... |
9fbfc3b7-63f8-46f8-81a4-a65362f2dde7 | 2 | private void btnBorrarClaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBorrarClaveActionPerformed
if (!"------".equals(selectorClave.getSelectedItem().toString())) {
int g = JOptionPane.showConfirmDialog(null,
"Se va ha borrar la clave " + selectorClave... |
f9cdde99-e431-40a8-ad15-e01f5106f2dc | 7 | protected float cost(Boardable prior, Boardable spot) {
if (spot == null) return -1 ;
if (spot == destination) return 0 ;
float mods = 0 ;
if (client != null) {
//
// TODO: Stay out of the unfogged areas of hostile bases, and fogged
// areas of your own.
// If the area ... |
2a4120e8-1818-483a-b308-5f57eac71cf3 | 6 | public void dInputAutoUpdate(Character typedChar)
{
String newInput = dInput.getText();
// If its not a back space, add it to string
if(!(typedChar == '\b')) { newInput = newInput + typedChar; }
char newGuess[] = newInput.toLowerCase().toCharArray();
newInput = "";
... |
32a82e71-14ab-49ec-896f-fd3b9cc062bb | 1 | private static long randomMillis(Random rnd) {
long millis = rnd.nextLong();
if (millis >= 0) {
millis = millis % MAX_MILLIS;
} else {
millis = millis % -MIN_MILLIS;
}
return millis;
} |
2e989755-3ab8-4e0b-a549-8e3b12473d67 | 8 | public int getType(TextGrid grid) {
if(typeIsValid) return type;
typeIsValid = true;
if(size() == 1) {
type = TYPE_OPEN;
return TYPE_OPEN;
}
int typeTrace = getTypeAccordingToTraceMethod(grid);
if(DEBUG){
System.out.println("trace: "+typeTrace);
}
if(typeTrace == TYPE_OPEN) {
type = TYPE_... |
c173f065-e6dd-42e7-91af-607149f28d41 | 3 | public void CreateReplicaLink(XmlNode parent, XmlNode replica,
XmlNode from, XmlNode to, //interface nodes
String linkname, String ref1name, String ref2name,
float delay, float bandwidth)
{
if (parent == null || from == null... |
68bccae7-4417-4953-a077-fbd7c28521f1 | 2 | public List<Berechtigung> getBerechtigungenZuWebmethode(int Webmethode) {
ResultSet resultSet;
List<Berechtigung> rueckgabe = new ArrayList<Berechtigung>();
try {
resultSet = db
.executeQueryStatement("SELECT a.* FROM Berechtigungen a, Berechtigung_Webmethode b "
+ "WHERE a.idBerechtigung = b.idBer... |
2e0a3c24-dcc1-4620-bf93-81be24f3b206 | 2 | public boolean isBeingInvoked(Input input) {
switch (inputType) {
case KEY_PRESSED:
return input.isKeyPressed(key.get());
case KEY_DOWN:
return input.isKeyDown(key.get());
default:
return false;
}
} |
d7793d70-449e-49b5-a9bd-dd7b073f0565 | 3 | public static String getIPAddressByInterfaceName(String name) {
String address = "NOT FOUND";
try {
NetworkInterface nif = NetworkInterface.getByName(name);
for (InetAddress addr : Collections.list(nif
.getInetAddresses())) {
if (addr instanceof Inet4Address) {
address = addr.getHostAddress();
... |
6aae0b9b-b1fa-4b55-949c-256e0dea3830 | 5 | public static synchronized SocketServer handle(SocketTestServer parent,
ServerSocket s) {
if(socketServer==null)
socketServer=new SocketServer(parent, s);
else {
if(socketServer.server!=null) {
try {
socketServer.setDesonnected(true... |
2bf1afd3-677c-4e14-b549-819ee518769a | 0 | public void decrementResting() {
this.resting--;
} |
5226cd6c-0662-4b13-9198-a86cab62c428 | 3 | private static synchronized void broadcast(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
String messageK = message + "\n";
if (gui != null) {
gui.appendRoom(messageK);
... |
5836b63c-29f8-4d1d-8d79-3ae59915544b | 9 | public synchronized void clear(){
if(_fsqNet != null &&!_fsqNet.terminated()){
_fsqNet.stop();
}
if(_fsaNet != null &&!_fsaNet.terminated()){
_fsaNet.stop();
}
try
{
if(_userSocket != null && !_userSocket.isClosed())
_userSocket.close();
if(_socket != null &&!_socket.isClosed())
_sock... |
ccd58655-117b-46f4-a580-145b85150fa4 | 2 | public void setupGUI()
{
JFrame jf = new JFrame("--TRON--");
jf.setSize(550, 550);
jf.setLayout(new GridLayout(1,1));
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setLocationRelativeTo(null);
jf.setResizable(false);
this.setLayout(null);
Container cp = jf.getContentPane();
for(int ... |
688f6d2a-197d-4fd9-bfef-048edf46a833 | 0 | public void saveMemento(MementoIF m) {
this.m = m;
} |
346e85cf-bba0-4480-9f89-931c9509a2fe | 3 | public static boolean isUrl(String resourceLocation) {
if (resourceLocation == null) {
return false;
}
if (resourceLocation.startsWith(CLASSPATH_URL_PREFIX)) {
return true;
}
try {
new URL(resourceLocation);
return true;
}
catch (MalformedURLException ex) {
return false;
}
} |
517ef73c-b548-4556-a8aa-0ea42c8b9cd3 | 4 | private String getSuitChar() {
String suitC;
switch (suit) {
case SUIT_HEARTS_NUM:
suitC = SUIT_HEARTS;
break;
case SUIT_CROSS_NUM:
suitC = SUIT_CROSS;
break;
case SUIT_SPADES_NUM:
suitC = SU... |
2e269fac-e851-40f1-aa75-964998a9dd48 | 5 | public boolean equals(
Object o)
{
if (o == null || !(o instanceof DEROctetString))
{
return false;
}
DEROctetString other = (DEROctetString)o;
byte[] b1 = other.getOctets();
byte[] b2 = this.getOctets();
if (b1.length != b2.length)
... |
b252a52e-6c98-43f6-a936-720ff0c7123e | 3 | private void saveData(MapDataBase var1) {
if(this.saveHandler != null) {
try {
File var2 = this.saveHandler.func_28113_a(var1.field_28168_a);
if(var2 != null) {
NBTTagCompound var3 = new NBTTagCompound();
var1.writeToNBT(var3);
NBTTagCo... |
a8497d60-9be5-454b-9003-f0b43427c76e | 7 | public File getAppDir(String s) {
String s1 = System.getProperty("user.home", ".");
File file;
switch (EnumOSMap.map[Os.getOs().ordinal()]) {
case 1:
case 2:
file = new File(s1, (new StringBuilder()).append('.').append(s).append('/').toString());
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.